Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : // C++ Headers
49 : #include <algorithm>
50 : #include <cassert>
51 : #include <cmath>
52 : #include <numeric>
53 : #include <string>
54 : #include <unordered_map>
55 : #include <unordered_set>
56 :
57 : // ObjexxFCL Headers
58 : #include <ObjexxFCL/Array.functions.hh>
59 : #include <ObjexxFCL/Fmath.hh>
60 : #include <ObjexxFCL/member.functions.hh>
61 :
62 : // EnergyPlus Headers
63 : #include <EnergyPlus/BITF.hh>
64 : #include <EnergyPlus/Construction.hh>
65 : #include <EnergyPlus/ConvectionCoefficients.hh>
66 : #include <EnergyPlus/ConvectionConstants.hh>
67 : #include <EnergyPlus/CurveManager.hh>
68 : #include <EnergyPlus/Data/EnergyPlusData.hh>
69 : #include <EnergyPlus/DataEnvironment.hh>
70 : #include <EnergyPlus/DataErrorTracking.hh>
71 : #include <EnergyPlus/DataHVACGlobals.hh>
72 : #include <EnergyPlus/DataHeatBalSurface.hh>
73 : #include <EnergyPlus/DataHeatBalance.hh>
74 : #include <EnergyPlus/DataIPShortCuts.hh>
75 : #include <EnergyPlus/DataLoopNode.hh>
76 : #include <EnergyPlus/DataRoomAirModel.hh>
77 : #include <EnergyPlus/DataSurfaces.hh>
78 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
79 : #include <EnergyPlus/DataZoneEquipment.hh>
80 : #include <EnergyPlus/General.hh>
81 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
82 : #include <EnergyPlus/Material.hh>
83 : #include <EnergyPlus/Psychrometrics.hh>
84 : #include <EnergyPlus/ScheduleManager.hh>
85 : #include <EnergyPlus/SurfaceGeometry.hh>
86 : #include <EnergyPlus/UtilityRoutines.hh>
87 : #include <EnergyPlus/Vectors.hh>
88 : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
89 :
90 : namespace EnergyPlus::ConvectionCoefficients {
91 :
92 : // Module containing the routines dealing with the convection coefficients
93 :
94 : // MODULE INFORMATION:
95 : // AUTHOR Rick Strand
96 : // DATE WRITTEN August 2000
97 : // MODIFIED Brent Griffith, August 2010 expanded model choices
98 : // RE-ENGINEERED na
99 :
100 : // PURPOSE OF THIS MODULE:
101 : // This module contains the routines dealing with convection coefficients.
102 : // This module collects correlations/calculations for both the interior and exterior
103 : // Manages a portion of the input and calculations for Hc values for use in surface heat balances.
104 :
105 : // METHODOLOGY EMPLOYED:
106 : // Subroutines are called to fill the variable HConvIn with the convection coefficient at
107 : // the inside face. or outside face for the current surface.
108 :
109 : using namespace DataLoopNode;
110 : using namespace DataHeatBalance;
111 : using namespace DataSurfaces;
112 : using namespace DataVectorTypes;
113 :
114 : // Coefficients that modify the convection coeff based on surface roughness
115 : std::array<Real64, 6> const RoughnessMultiplier{2.17, 1.67, 1.52, 1.13, 1.11, 1.0};
116 : constexpr std::array<std::string_view, static_cast<int>(ConvectionConstants::RefTemp::Num)> RefTempNamesUC{
117 : "MEANAIRTEMPERATURE", "ADJACENTAIRTEMPERATURE", "SUPPLYAIRTEMPERATURE"};
118 : constexpr std::array<std::string_view, static_cast<int>(ConvectionConstants::RefWind::Num)> RefWindNamesUC{
119 : "WEATHERFILE", "HEIGHTADJUST", "PARALLELCOMPONENT", "PARALLELCOMPONENTHEIGHTADJUST"};
120 :
121 : enum class ConvSurfDeltaT
122 : {
123 : Invalid = -1,
124 : Positive,
125 : Zero,
126 : Negative,
127 : Num
128 : };
129 :
130 : // parameters, by zone, for flow regimes for adaptive convection on inside face
131 : enum class InConvFlowRegime
132 : {
133 : Invalid = -1,
134 : A1, // In-floor heating or in-ceiling cooling
135 : A2, // In-wall heating
136 : A3, // no HVAC system, all buoyancy
137 : B, // Convective heater in zone
138 : C, // central mechanical air
139 : D, // zone mechanical air
140 : E, // mixed. mechanical air and buoyancy
141 : Num
142 : };
143 :
144 : enum class SurfacesType
145 : {
146 : Invalid = -1,
147 : AllExteriorSurfaces,
148 : AllExteriorWindows,
149 : AllExteriorWalls,
150 : AllExteriorRoofs,
151 : AllExteriorFloors,
152 : AllInteriorSurfaces,
153 : AllInteriorWindows,
154 : AllInteriorWalls,
155 : AllInteriorRoofs,
156 : AllInteriorCeilings,
157 : AllInteriorFloors,
158 : Num
159 : };
160 :
161 : constexpr std::array<std::string_view, static_cast<int>(SurfacesType::Num)> SurfacesTypeNamesUC{"ALLEXTERIORSURFACES",
162 : "ALLEXTERIORWINDOWS",
163 : "ALLEXTERIORWALLS",
164 : "ALLEXTERIORROOFS",
165 : "ALLEXTERIORFLOORS",
166 : "ALLINTERIORSURFACES",
167 : "ALLINTERIORWINDOWS",
168 : "ALLINTERIORWALLS",
169 : "ALLINTERIORROOFS",
170 : "ALLINTERIORCEILINGS",
171 : "ALLINTERIORFLOORS"};
172 2570270 : void InitInteriorConvectionCoeffs(EnergyPlusData &state,
173 : const Array1D<Real64> &SurfaceTemperatures, // Temperature of surfaces for evaluation of HcIn
174 : Optional_int_const ZoneToResimulate // if passed in, then only calculate surfaces that have this zone
175 : )
176 : {
177 :
178 : // SUBROUTINE INFORMATION:
179 : // AUTHOR Rick Strand
180 : // DATE WRITTEN March 1998
181 : // MODIFIED Dan Fisher, Nov 2000
182 : // Sep 2011 LKL/BG - resimulate only zones needing it for Radiant systems
183 : // RE-ENGINEERED na
184 :
185 : // PURPOSE OF THIS SUBROUTINE:
186 : // This subroutine initializes the arrays associated with interior
187 : // surface convection. The main parameter which is initialized
188 : // in this routine is HConvIn, the convection coefficient on the
189 : // inside surface.
190 :
191 : // METHODOLOGY EMPLOYED:
192 : // Determine the temperature difference between the surface and the
193 : // zone air for the last time step and then base the calculation
194 : // of the convection coefficient on that value and the surface tilt.
195 :
196 : // REFERENCES:
197 : // (I)BLAST legacy routine VARTMP
198 : // 1. Passive Solar Extension of the BLAST Program
199 : // Appendix E. p. 17,18
200 : // 2. ASHRAE
201 : // Simple Algorithm: ASHRAE Handbook of Fundamentals 1985, p. 23.2, Table 1
202 : // Detailed Algorithm: ASHRAE Handbook of Fundamentals 2001, p. 3.12, Table 5
203 : // 3. Walton, G. N. 1983. Thermal Analysis Research Program (TARP) Reference Manual,
204 : // NBSSIR 83-2655, National Bureau of Standards, "Surface Inside Heat Balances", pp 79-80
205 : // 4. Fisher, D.E. and C.O. Pedersen, Convective Heat Transfer in Building Energy and
206 : // Thermal Load Calculations, ASHRAE Transactions, vol. 103, Pt. 2, 1997, p.137
207 : // 5. ISO Standard 15099:2003e
208 :
209 2570270 : auto &Zone(state.dataHeatBal->Zone);
210 2570270 : auto &Surface(state.dataSurface->Surface);
211 :
212 2570270 : if (state.dataConvectionCoefficient->GetUserSuppliedConvectionCoeffs) {
213 771 : GetUserConvectionCoefficients(state);
214 771 : state.dataConvectionCoefficient->GetUserSuppliedConvectionCoeffs = false;
215 : }
216 :
217 2570270 : if (state.dataConvectionCoefficient->NodeCheck) { // done once when conditions are ready...
218 1254152 : if (!state.dataGlobal->SysSizingCalc && !state.dataGlobal->ZoneSizingCalc && state.dataZoneEquip->ZoneEquipInputsFilled &&
219 235287 : allocated(state.dataLoopNodes->Node)) {
220 704 : state.dataConvectionCoefficient->NodeCheck = false;
221 5346 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
222 4642 : if (Zone(ZoneNum).InsideConvectionAlgo != ConvectionConstants::HcInt_CeilingDiffuser) continue;
223 10 : if (Zone(ZoneNum).SystemZoneNodeNumber != 0) continue;
224 0 : ShowSevereError(state,
225 0 : "InitInteriorConvectionCoeffs: Inside Convection=CeilingDiffuser, but no system inlet node defined, Zone=" +
226 0 : Zone(ZoneNum).Name);
227 0 : ShowContinueError(state, "Defaulting inside convection to TARP. Check ZoneHVAC:EquipmentConnections for Zone=" + Zone(ZoneNum).Name);
228 0 : Zone(ZoneNum).InsideConvectionAlgo = ConvectionConstants::HcInt_ASHRAETARP;
229 : }
230 : // insert one-time setup for adaptive inside face
231 : }
232 : }
233 :
234 2571460 : if (state.dataConvectionCoefficient->ActiveSurfaceCheck && !state.dataGlobal->SysSizingCalc && !state.dataGlobal->ZoneSizingCalc &&
235 1190 : state.dataZoneEquip->ZoneEquipSimulatedOnce) {
236 769 : SetupAdaptiveConvectionRadiantSurfaceData(state);
237 769 : state.dataConvectionCoefficient->ActiveSurfaceCheck = false;
238 : }
239 :
240 2570270 : if (state.dataGlobal->BeginEnvrnFlag && state.dataConvectionCoefficient->MyEnvirnFlag) {
241 6218 : bool anyAdaptiveConvectionAlgorithm = false;
242 426513 : for (int SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
243 420305 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) == ConvectionConstants::HcInt_AdaptiveConvectionAlgorithm) {
244 10 : anyAdaptiveConvectionAlgorithm = true;
245 10 : break;
246 : }
247 : }
248 52361 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
249 46168 : if (state.dataHeatBal->Zone(ZoneNum).InsideConvectionAlgo == ConvectionConstants::HcInt_AdaptiveConvectionAlgorithm) {
250 25 : anyAdaptiveConvectionAlgorithm = true;
251 25 : break;
252 : }
253 : }
254 6218 : if (anyAdaptiveConvectionAlgorithm) {
255 : // need to clear out node conditions because dynamic assignments will be affected
256 35 : if (state.dataLoopNodes->NumOfNodes > 0 && allocated(state.dataLoopNodes->Node)) {
257 2564 : for (auto &e : state.dataLoopNodes->Node) {
258 2530 : e.Temp = state.dataLoopNodes->DefaultNodeValues.Temp;
259 2530 : e.TempMin = state.dataLoopNodes->DefaultNodeValues.TempMin;
260 2530 : e.TempMax = state.dataLoopNodes->DefaultNodeValues.TempMax;
261 2530 : e.TempSetPoint = state.dataLoopNodes->DefaultNodeValues.TempSetPoint;
262 2530 : e.MassFlowRate = state.dataLoopNodes->DefaultNodeValues.MassFlowRate;
263 2530 : e.MassFlowRateMin = state.dataLoopNodes->DefaultNodeValues.MassFlowRateMin;
264 2530 : e.MassFlowRateMax = state.dataLoopNodes->DefaultNodeValues.MassFlowRateMax;
265 2530 : e.MassFlowRateMinAvail = state.dataLoopNodes->DefaultNodeValues.MassFlowRateMinAvail;
266 2530 : e.MassFlowRateMaxAvail = state.dataLoopNodes->DefaultNodeValues.MassFlowRateMaxAvail;
267 2530 : e.MassFlowRateSetPoint = state.dataLoopNodes->DefaultNodeValues.MassFlowRateSetPoint;
268 2530 : e.Quality = state.dataLoopNodes->DefaultNodeValues.Quality;
269 2530 : e.Press = state.dataLoopNodes->DefaultNodeValues.Press;
270 2530 : e.Enthalpy = state.dataLoopNodes->DefaultNodeValues.Enthalpy;
271 2530 : e.HumRat = state.dataLoopNodes->DefaultNodeValues.HumRat;
272 2530 : e.HumRatMin = state.dataLoopNodes->DefaultNodeValues.HumRatMin;
273 2530 : e.HumRatMax = state.dataLoopNodes->DefaultNodeValues.HumRatMax;
274 2530 : e.HumRatSetPoint = state.dataLoopNodes->DefaultNodeValues.HumRatSetPoint;
275 2530 : e.TempSetPointHi = state.dataLoopNodes->DefaultNodeValues.TempSetPointHi;
276 2530 : e.TempSetPointLo = state.dataLoopNodes->DefaultNodeValues.TempSetPointLo;
277 : }
278 34 : if (allocated(state.dataLoopNodes->MoreNodeInfo)) {
279 546 : for (auto &e : state.dataLoopNodes->MoreNodeInfo) {
280 538 : e.WetBulbTemp = state.dataLoopNodes->DefaultNodeValues.Temp;
281 538 : e.RelHumidity = 0.0;
282 538 : e.ReportEnthalpy = state.dataLoopNodes->DefaultNodeValues.Enthalpy;
283 538 : e.VolFlowRateStdRho = 0.0;
284 538 : e.VolFlowRateCrntRho = 0.0;
285 538 : e.Density = 0.0;
286 : }
287 : }
288 : }
289 : }
290 6218 : state.dataConvectionCoefficient->MyEnvirnFlag = false;
291 : }
292 :
293 2570270 : if (!state.dataGlobal->BeginEnvrnFlag) state.dataConvectionCoefficient->MyEnvirnFlag = true;
294 :
295 21027345 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
296 18457075 : switch (Zone(ZoneNum).InsideConvectionAlgo) {
297 195186 : case ConvectionConstants::HcInt_CeilingDiffuser:
298 195186 : CalcCeilingDiffuserIntConvCoeff(state, ZoneNum, SurfaceTemperatures);
299 195186 : break;
300 3657 : case ConvectionConstants::HcInt_TrombeWall:
301 3657 : CalcTrombeWallIntConvCoeff(state, ZoneNum, SurfaceTemperatures);
302 3657 : break;
303 18457075 : default:;
304 : // nothing
305 : }
306 : }
307 21027345 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
308 36930326 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
309 18473251 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
310 178282616 : for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
311 :
312 159809365 : if (present(ZoneToResimulate)) {
313 0 : if ((ZoneNum != ZoneToResimulate) && (state.dataSurface->SurfAdjacentZone(SurfNum) != ZoneToResimulate)) {
314 0 : continue; // skip surfaces that are not associated with this zone
315 : }
316 : }
317 159809365 : auto &surface(Surface(SurfNum));
318 159809365 : if (state.dataSurface->UseRepresentativeSurfaceCalculations) {
319 397773 : int repSurfNum = surface.RepresentativeCalcSurfNum;
320 397773 : if (SurfNum != repSurfNum) continue;
321 : }
322 :
323 : int algoNum;
324 : bool standardAlgo;
325 159719368 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) <= -1) { // Set by user using one of the standard algorithms...
326 0 : algoNum = std::abs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum));
327 0 : standardAlgo = true;
328 159719368 : } else if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) ==
329 : ConvectionConstants::HcInt_SetByZone) { // Not set by user, uses Zone Setting
330 159470352 : algoNum = Zone(ZoneNum).InsideConvectionAlgo;
331 159470352 : standardAlgo = true;
332 : } else {
333 249016 : algoNum = Zone(ZoneNum).InsideConvectionAlgo;
334 249016 : standardAlgo = false;
335 : }
336 :
337 159719368 : if (standardAlgo) {
338 159470352 : switch (algoNum) {
339 27543340 : case ConvectionConstants::HcInt_ASHRAESimple: {
340 55086680 : CalcASHRAESimpleIntConvCoeff(
341 55086680 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
342 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
343 27543340 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
344 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
345 27543340 : } break;
346 129411035 : case ConvectionConstants::HcInt_ASHRAETARP: {
347 129411035 : if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) {
348 223979104 : CalcASHRAEDetailedIntConvCoeff(
349 223979104 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
350 : } else {
351 34842966 : CalcISO15099WindowIntConvCoeff(
352 34842966 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
353 : }
354 :
355 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
356 129411035 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
357 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
358 129411035 : } break;
359 567084 : case ConvectionConstants::HcInt_AdaptiveConvectionAlgorithm: {
360 567084 : ManageInsideAdaptiveConvectionAlgo(state, SurfNum);
361 567084 : } break;
362 1941009 : case ConvectionConstants::HcInt_CeilingDiffuser:
363 : case ConvectionConstants::HcInt_TrombeWall: {
364 : // Already done above and can't be at individual surface
365 1941009 : } break;
366 7884 : case ConvectionConstants::HcInt_ASTMC1340: {
367 15768 : CalcASTMC1340ConvCoeff(
368 15768 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
369 7884 : } break;
370 0 : default: {
371 0 : ShowFatalError(state, "Unhandled convection coefficient algorithm.");
372 0 : } break;
373 : }
374 :
375 : } else { // Interior convection has been set by the user with "value" or "schedule"
376 249016 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = SetIntConvectionCoeff(state, SurfNum);
377 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
378 249016 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
379 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
380 : }
381 :
382 159719368 : if (state.dataSurface->SurfEMSOverrideIntConvCoef(SurfNum)) {
383 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataSurface->SurfEMSValueForIntConvCoef(SurfNum);
384 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
385 0 : Real64 hConst = state.dataSurface->SurfEMSValueForIntConvCoef(SurfNum);
386 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in = KIVA_CONST_CONV(hConst);
387 : }
388 : }
389 : }
390 : }
391 : }
392 :
393 21027345 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
394 36930326 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
395 18473251 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
396 40497597 : for (int SurfNum = thisSpace.WindowSurfaceFirst; SurfNum <= thisSpace.WindowSurfaceLast; ++SurfNum) {
397 22024346 : auto &surface(Surface(SurfNum));
398 22024346 : if (state.dataSurface->UseRepresentativeSurfaceCalculations) {
399 122286 : int repSurfNum = surface.RepresentativeCalcSurfNum;
400 122286 : if (SurfNum != repSurfNum) continue;
401 : }
402 21946028 : if (Surface(SurfNum).ExtBoundCond == ExternalEnvironment) {
403 21918836 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) =
404 21918836 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) * state.dataHeatBalSurf->SurfWinCoeffAdjRatio(SurfNum);
405 : }
406 : }
407 : }
408 : }
409 2570270 : }
410 :
411 65645677 : void InitExteriorConvectionCoeff(EnergyPlusData &state,
412 : int const SurfNum, // Surface number (in Surface derived type)
413 : Real64 const HMovInsul, // Equivalent convection coefficient of movable insulation
414 : DataSurfaces::SurfaceRoughness const Roughness, // Roughness index (1-6), see DataHeatBalance parameters
415 : Real64 const AbsExt, // Exterior thermal absorptance
416 : Real64 const TempExt, // Exterior surface temperature (C)
417 : Real64 &HExt, // Convection coefficient to exterior air
418 : Real64 &HSky, // "Convection" coefficient to sky temperature
419 : Real64 &HGround, // "Convection" coefficient to ground temperature
420 : Real64 &HAir // Radiation to Air Component
421 : )
422 : {
423 :
424 : // SUBROUTINE INFORMATION:
425 : // AUTHOR George Walton
426 : // DATE WRITTEN January 1990
427 : // MODIFIED na
428 : // RE-ENGINEERED Mar98 (RKS); Sep03 (LKL): Add additional flavors of Ext Convection Coeff.
429 : // Dec03 (PGE): Re-eng'd ASHRAEDetailed to match BLAST and TARP.
430 : // Aug04 (PGE): Corrected error for calculating local wind speeds for different terrains.
431 : // Aug 2010 B. Griffith. for outside air convection, added new adaptive convection algorithm etc.
432 :
433 : // PURPOSE OF THIS SUBROUTINE:
434 : // This subroutine determines the outside convection coefficient for
435 : // a particular surface.
436 :
437 : // METHODOLOGY EMPLOYED:
438 : // Based on the properties of a particular surface, determine what the
439 : // outside convection coefficients are for outside air, the sky, and
440 : // the ground. Convection coefficients for the sky and ground are
441 : // actually linearized radiation coefficients. The ground surface is
442 : // assumed to be the same temperature as the outside air.
443 :
444 : // REFERENCES:
445 : // (I)BLAST legacy routine OCNVCO
446 : // TARP Reference Manual, "Surface Outside Heat Balances", pp 71ff
447 :
448 : // Using/Aliasing
449 : using ScheduleManager::GetCurrentScheduleValue;
450 :
451 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
452 : Real64 TAir; // Absolute dry bulb temperature of outdoor air (K)
453 : Real64 TSurf; // Absolute temperature of the exterior surface (K)
454 : Real64 SurfWindSpeed; // Local wind speed at height of the heat transfer surface (m/s)
455 : Real64 SurfWindDir;
456 : Real64 TSky;
457 : Real64 TGround;
458 : Real64 Hn; // Natural part of exterior convection
459 : Real64 Hf; // Forced part of exterior convection
460 : Real64 rCalcPerimeter; // approximation for Perimeter
461 : int BaseSurf;
462 :
463 65645677 : auto &Zone(state.dataHeatBal->Zone);
464 65645677 : auto &Surface(state.dataSurface->Surface);
465 :
466 65645677 : if (state.dataConvectionCoefficient->GetUserSuppliedConvectionCoeffs) {
467 0 : GetUserConvectionCoefficients(state);
468 0 : state.dataConvectionCoefficient->GetUserSuppliedConvectionCoeffs = false;
469 : }
470 :
471 65645677 : TAir = state.dataSurface->SurfOutDryBulbTemp(SurfNum) + DataGlobalConstants::KelvinConv;
472 65645677 : TSurf = TempExt + DataGlobalConstants::KelvinConv;
473 65645677 : TSky = state.dataEnvrn->SkyTempKelvin;
474 65645677 : TGround = TAir;
475 :
476 65645677 : if (state.dataSurface->Surface(SurfNum).SurfHasSurroundingSurfProperty) {
477 8118 : int SrdSurfsNum = state.dataSurface->Surface(SurfNum).SurfSurroundingSurfacesNum;
478 8118 : if (state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SkyTempSchNum != 0) {
479 0 : TSky = GetCurrentScheduleValue(state, state.dataSurface->SurroundingSurfsProperty(SrdSurfsNum).SkyTempSchNum) +
480 : DataGlobalConstants::KelvinConv;
481 : }
482 : }
483 65645677 : if (state.dataSurface->Surface(SurfNum).UseSurfPropertyGndSurfTemp) {
484 16236 : int gndSurfsNum = state.dataSurface->Surface(SurfNum).SurfPropertyGndSurfIndex;
485 16236 : TGround = state.dataSurface->GroundSurfsProperty(gndSurfsNum).SurfsTempAvg + DataGlobalConstants::KelvinConv;
486 : }
487 :
488 65645677 : BaseSurf = Surface(SurfNum).BaseSurf; // If this is a base surface, BaseSurf = SurfNum
489 :
490 65645677 : SurfWindDir = state.dataSurface->SurfOutWindDir(SurfNum);
491 :
492 65645677 : if (!Surface(SurfNum).ExtWind) {
493 277203 : SurfWindSpeed = 0.0; // No wind exposure
494 65368474 : } else if (Surface(SurfNum).Class == SurfaceClass::Window && state.dataSurface->SurfWinShadingFlag(SurfNum) == WinShadingType::ExtShade) {
495 17373 : SurfWindSpeed = 0.0; // Assume zero wind speed at outside glass surface of window with exterior shade
496 : } else {
497 65351101 : SurfWindSpeed = state.dataSurface->SurfOutWindSpeed(SurfNum);
498 : }
499 :
500 : // Check if exterior is to be set by user
501 :
502 : int algoNum;
503 : bool standardAlgo;
504 65645677 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) <= -1) { // Set by user using one of the standard algorithms...
505 16236 : algoNum = std::abs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum));
506 16236 : standardAlgo = true;
507 65629441 : } else if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) == 0) { // Not set by user, uses Zone Setting
508 65476003 : algoNum = Zone(Surface(SurfNum).Zone).OutsideConvectionAlgo;
509 65476003 : standardAlgo = true;
510 : } else {
511 153438 : algoNum = Zone(Surface(SurfNum).Zone).OutsideConvectionAlgo;
512 153438 : standardAlgo = false;
513 : }
514 :
515 65645677 : if (standardAlgo) {
516 :
517 65492239 : switch (algoNum) {
518 10426293 : case ConvectionConstants::HcExt_ASHRAESimple:
519 10426293 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
520 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [](double, double, double, double windSpeed) -> double {
521 0 : return windSpeed;
522 0 : };
523 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out = [=](double, double, double hfTerm, double, double) -> double {
524 0 : return CalcASHRAESimpExtConvectCoeff(Roughness, hfTerm);
525 0 : };
526 : } else {
527 10426293 : HExt = CalcASHRAESimpExtConvectCoeff(Roughness, SurfWindSpeed); // includes radiation to sky, ground, and air
528 : }
529 10426293 : break;
530 6185910 : case ConvectionConstants::HcExt_ASHRAETARP:
531 : case ConvectionConstants::HcExt_BLASTHcOutside:
532 : case ConvectionConstants::HcExt_TarpHcOutside:
533 : // Convection is split into forced and natural components. The total
534 : // convective heat transfer coefficient is the sum of these components.
535 : // Coefficients for subsurfaces are handled in a special way. The values for perimeter and gross area
536 : // are actually referencing the base surface because a subsurface does not initiate a completely new
537 : // thermal boundary layer (although it may add some additional complexity that cannot be accounted for
538 : // here). The values for height (Z) and roughness do, however, come from the subsurface.
539 : // BLAST algorithm has been replaced by this one since it was identical except for the standard wind
540 : // speed measurement height which was only different because of unit conversions: 10 m vs. 30 ft (= 9.14 m).
541 : // ASHRAE/BLAST REFERENCES:
542 : // ?
543 : // TARP REFERENCES:
544 : // Walton, G. N. 1983. Thermal Analysis Research Program Reference Manual.
545 : // National Bureau of Standards. NBSSIR 83-2655.
546 :
547 : // due to outlying calculations when perimeter is very small compared to area, use Perimeter
548 : // approximation calculation
549 :
550 6185910 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
551 2025 : if (Surface(SurfNum).Class == SurfaceClass::Wall) {
552 0 : auto &fnd = state.dataSurfaceGeometry->kivaManager.surfaceMap[SurfNum].get_instance(0).first->foundation;
553 0 : const double length = fnd.netPerimeter;
554 0 : const double height = fnd.wall.heightAboveGrade;
555 0 : const double area = length * height;
556 0 : const double perim = 2.0 * (length + height);
557 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [=](double, double, double, double windSpeed) -> double {
558 : // Average windward and leeward since all walls use same algorithm
559 0 : double windwardHf = CalcSparrowWindward(Roughness, perim, area, windSpeed);
560 0 : double leewardHf = CalcSparrowLeeward(Roughness, perim, area, windSpeed);
561 0 : return (windwardHf + leewardHf) / 2.0;
562 0 : };
563 : } else { // Slab (used for exterior grade convection)
564 : // Assume very large area for grade (relative to perimeter).
565 2025 : constexpr double area = 9999999.;
566 2025 : constexpr double perim = 1.;
567 4186 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [=](double, double, double, double windSpeed) -> double {
568 136 : return CalcSparrowWindward(Roughness, perim, area, windSpeed);
569 6075 : };
570 : }
571 4050 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out =
572 2900 : [=](double Tsurf, double Tamb, double hfTerm, double, double cosTilt) -> double {
573 2900 : Real64 Ts = Tsurf;
574 2900 : if (HMovInsul > 0.0) Ts = (HMovInsul * Tsurf + hfTerm * Tamb) / (HMovInsul + hfTerm);
575 2900 : return CalcASHRAETARPNatural(Ts, Tamb, cosTilt) + hfTerm;
576 6075 : };
577 : } else {
578 6183885 : if (Surface(BaseSurf).GrossArea != 0.0 && Surface(BaseSurf).Height != 0.0) {
579 6183885 : rCalcPerimeter = 2.0 * (Surface(BaseSurf).GrossArea / Surface(BaseSurf).Height + Surface(BaseSurf).Height);
580 18551655 : Hf = CalcHfExteriorSparrow(SurfWindSpeed,
581 6183885 : Surface(BaseSurf).GrossArea,
582 : rCalcPerimeter,
583 6183885 : Surface(SurfNum).CosTilt,
584 6183885 : Surface(SurfNum).Azimuth,
585 : Roughness,
586 : SurfWindDir);
587 : } else {
588 0 : Hf = 0.0;
589 : }
590 :
591 6183885 : if (HMovInsul > 0.0) TSurf = (HMovInsul * TSurf + Hf * TAir) / (HMovInsul + Hf);
592 6183885 : Hn = CalcASHRAETARPNatural(TSurf, TAir, Surface(SurfNum).CosTilt);
593 6183885 : HExt = Hn + Hf;
594 : }
595 6185910 : break;
596 16236 : case ConvectionConstants::HcExt_MoWiTTHcOutside:
597 16236 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
598 :
599 0 : if (Surface(SurfNum).Class == SurfaceClass::Wall) {
600 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [=](double, double, double, double windSpeed) -> double {
601 : // Average windward and leeward since all walls use same algorithm
602 0 : double windwardHf = CalcMoWITTForcedWindward(windSpeed);
603 0 : double leewardHf = CalcMoWITTForcedLeeward(windSpeed);
604 0 : return (windwardHf + leewardHf) / 2.0;
605 0 : };
606 : } else {
607 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [=](double, double, double, double windSpeed) -> double {
608 0 : return CalcMoWITTForcedWindward(windSpeed);
609 0 : };
610 : }
611 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out =
612 0 : [=](double Tsurf, double Tamb, double hfTerm, double, double) -> double {
613 0 : Real64 Hn = CalcMoWITTNatural(Tsurf - Tamb);
614 0 : return std::sqrt(pow_2(Hn) + pow_2(hfTerm));
615 0 : };
616 : } else {
617 : // NOTE: Movable insulation is not taken into account here
618 16236 : if (Windward(Surface(SurfNum).CosTilt, Surface(SurfNum).Azimuth, SurfWindDir)) {
619 8118 : HExt = CalcMoWITTWindward(TAir - TSurf, SurfWindSpeed);
620 : } else { // leeward
621 8118 : HExt = CalcMoWITTLeeward(TAir - TSurf, SurfWindSpeed);
622 : }
623 : }
624 16236 : break;
625 48552595 : case ConvectionConstants::HcExt_DOE2HcOutside:
626 48552595 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
627 69513 : if (Surface(SurfNum).Class == SurfaceClass::Wall) {
628 30106 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [=](double, double, double, double windSpeed) -> double {
629 : // Average windward and leeward since all walls use same algorithm
630 340 : double windwardHf = CalcMoWITTForcedWindward(windSpeed);
631 340 : double leewardHf = CalcMoWITTForcedLeeward(windSpeed);
632 340 : return (windwardHf + leewardHf) / 2.0;
633 29766 : };
634 : } else {
635 112264 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = [=](double, double, double, double windSpeed) -> double {
636 3004 : return CalcMoWITTForcedWindward(windSpeed);
637 109260 : };
638 : }
639 139026 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out =
640 68172 : [=](double Tsurf, double Tamb, double hfTerm, double, double cosTilt) -> double {
641 68172 : Real64 Hf = CalcDOE2Forced(Tsurf, Tamb, cosTilt, hfTerm, Roughness);
642 :
643 68172 : Real64 Ts = Tsurf;
644 68172 : if (HMovInsul > 0.0) {
645 0 : Ts = (HMovInsul * TSurf + Hf * Tamb) / (HMovInsul + Hf);
646 : }
647 :
648 68172 : Real64 Hn = CalcASHRAETARPNatural(Ts, Tamb, cosTilt);
649 68172 : return Hn + Hf;
650 208539 : };
651 : } else {
652 48483082 : if (Windward(Surface(SurfNum).CosTilt, Surface(SurfNum).Azimuth, SurfWindDir)) {
653 32943554 : Hf = CalcDOE2Windward(TSurf, TAir, Surface(SurfNum).CosTilt, SurfWindSpeed, Roughness);
654 : } else { // leeward
655 15539528 : Hf = CalcDOE2Leeward(TSurf, TAir, Surface(SurfNum).CosTilt, SurfWindSpeed, Roughness);
656 : }
657 48483082 : if (HMovInsul > 0.0) {
658 4047 : TSurf = (HMovInsul * TSurf + Hf * TAir) / (HMovInsul + Hf);
659 : }
660 :
661 48483082 : Hn = CalcASHRAETARPNatural(TSurf, TAir, Surface(SurfNum).CosTilt);
662 : // Better if there was iteration for movable insulation?
663 :
664 48483082 : HExt = Hn + Hf;
665 : }
666 48552595 : break;
667 311205 : case ConvectionConstants::HcExt_AdaptiveConvectionAlgorithm:
668 311205 : ManageOutsideAdaptiveConvectionAlgo(state, SurfNum, HExt);
669 311205 : break;
670 0 : default:
671 0 : ShowFatalError(state, "InitExtConvection Coefficients: invalid parameter -- outside convection type, Surface=" + Surface(SurfNum).Name);
672 : }
673 :
674 : } else { // Exterior convection scheme for this surface has been set by user
675 :
676 153438 : HExt = SetExtConvectionCoeff(state, SurfNum);
677 : }
678 :
679 65645677 : if (state.dataSurface->SurfEMSOverrideExtConvCoef(SurfNum)) {
680 0 : HExt = state.dataSurface->SurfEMSValueForExtConvCoef(SurfNum);
681 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
682 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = KIVA_HF_ZERO;
683 0 : Real64 hConst = state.dataSurface->SurfEMSValueForExtConvCoef(SurfNum);
684 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out = KIVA_CONST_CONV(hConst);
685 : }
686 : }
687 :
688 65645677 : HExt = HExt * state.dataHeatBalSurf->SurfWinCoeffAdjRatio(SurfNum);
689 :
690 65645677 : if (TSurf == TSky || algoNum == ConvectionConstants::HcExt_ASHRAESimple) {
691 10426293 : HSky = 0.0;
692 : } else {
693 : // Compute sky radiation coefficient
694 165658152 : HSky = DataGlobalConstants::StefanBoltzmann * AbsExt * Surface(SurfNum).ViewFactorSkyIR * state.dataSurface->SurfAirSkyRadSplit(SurfNum) *
695 110438768 : (pow_4(TSurf) - pow_4(TSky)) / (TSurf - TSky);
696 : }
697 :
698 65645677 : if (TSurf == TAir || algoNum == ConvectionConstants::HcExt_ASHRAESimple) {
699 10591650 : HGround = 0.0;
700 10591650 : HAir = 0.0;
701 : } else {
702 : // Compute ground radiation coefficient
703 55054027 : HGround =
704 55054027 : DataGlobalConstants::StefanBoltzmann * AbsExt * Surface(SurfNum).ViewFactorGroundIR * (pow_4(TSurf) - pow_4(TGround)) / (TSurf - TGround);
705 :
706 : // Compute air radiation coefficient
707 165162081 : HAir = DataGlobalConstants::StefanBoltzmann * AbsExt * Surface(SurfNum).ViewFactorSkyIR *
708 110108054 : (1.0 - state.dataSurface->SurfAirSkyRadSplit(SurfNum)) * (pow_4(TSurf) - pow_4(TAir)) / (TSurf - TAir);
709 : }
710 65645677 : }
711 :
712 6183885 : Real64 CalcHfExteriorSparrow(Real64 const SurfWindSpeed, // Local wind speed at height of the heat transfer surface (m/s)
713 : Real64 const GrossArea, // Gross surface area {m2}
714 : Real64 const Perimeter, // Surface perimeter length {m}
715 : Real64 const CosTilt, // Cosine of the Surface Tilt Angle
716 : Real64 const Azimuth, // Facing angle (degrees) of the surface outward normal
717 : DataSurfaces::SurfaceRoughness const Roughness, // Surface roughness index (6=very smooth, 5=smooth, 4=medium smooth,
718 : Real64 const WindDirection // Wind (compass) direction (degrees)
719 : )
720 : {
721 6183885 : if (Windward(CosTilt, Azimuth, WindDirection)) {
722 4107416 : return CalcSparrowWindward(Roughness, Perimeter, GrossArea, SurfWindSpeed);
723 : } else {
724 2076469 : return CalcSparrowLeeward(Roughness, Perimeter, GrossArea, SurfWindSpeed);
725 : }
726 : }
727 :
728 54941077 : bool Windward(Real64 const CosTilt, // Cosine of the surface tilt angle
729 : Real64 const Azimuth, // or Facing, Direction the surface outward normal faces (degrees)
730 : Real64 const WindDirection // Wind direction measured clockwise from geographic North
731 : )
732 : {
733 :
734 : // FUNCTION INFORMATION:
735 : // AUTHOR Linda K. Lawrie
736 : // DATE WRITTEN September 2003
737 : // MODIFIED na
738 : // RE-ENGINEERED na
739 :
740 : // PURPOSE OF THIS FUNCTION:
741 : // This function determines if a surface is "windward" or "leeward" (that is,
742 : // into / against the wind (true) or in shelter from wind (false).
743 :
744 : // METHODOLOGY EMPLOYED:
745 : // Leeward is defined as greater than 100 degrees from normal incidence.
746 : // Note that a sufficiently horizontal surface is always considered windward.
747 :
748 : // REFERENCES:
749 : // Walton, G. N. 1981. Passive solar extension of the Building Loads
750 : // Analysis and System Thermodynamics (BLAST) program. Technical Report,
751 : // United States Army Construction Engineering Research Laboratory,
752 : // Champaign, IL.
753 :
754 : // Return value
755 : bool AgainstWind; // True for windward, false for leeward.
756 :
757 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
758 : Real64 Diff; // Difference between the wind direction and the surface azimuth
759 :
760 54941077 : AgainstWind = true;
761 54941077 : if (std::abs(CosTilt) < 0.98) { // Surface is not horizontal
762 46157190 : Diff = std::abs(WindDirection - Azimuth);
763 46157190 : if ((Diff - 180.0) > 0.001) Diff -= 360.0;
764 46157190 : if ((std::abs(Diff) - 90.0) > 0.001) AgainstWind = false; // Surface is leeward
765 : }
766 :
767 54941077 : return AgainstWind;
768 : }
769 :
770 135 : int SetInsideAdaptiveConvectionAlgo(EnergyPlusData &state,
771 : const std::unordered_map<std::string, int> &HcInt_ConvectionTypesMap,
772 : bool &ErrorsFound,
773 : const std::string &equationName,
774 : const std::string &curveName,
775 : const std::string &sourceFieldName,
776 : const std::string &curveFieldName,
777 : const std::string_view RoutineName,
778 : const std::string_view CurrentModuleObject)
779 : {
780 :
781 135 : int InsideAdaptiveConvectionAlgoParam = 0;
782 :
783 135 : if (HcInt_ConvectionTypesMap.find(equationName) != HcInt_ConvectionTypesMap.end()) {
784 135 : int HcInt = HcInt_ConvectionTypesMap.at(equationName);
785 135 : InsideAdaptiveConvectionAlgoParam = HcInt;
786 135 : if (HcInt == ConvectionConstants::HcInt_UserCurve) {
787 0 : InsideAdaptiveConvectionAlgoParam = UtilityRoutines::FindItemInList(curveName, state.dataConvectionCoefficient->HcInsideUserCurve);
788 0 : if (InsideAdaptiveConvectionAlgoParam == 0) {
789 0 : ShowSevereError(state, std::string{RoutineName} + std::string{CurrentModuleObject} + "=\"" + equationName + ", invalid value");
790 0 : ShowContinueError(state, "Invalid Name choice Entered, for " + curveFieldName + '=' + curveName);
791 0 : ErrorsFound = true;
792 : }
793 : }
794 : } else {
795 0 : ShowSevereError(state, std::string{RoutineName} + std::string{CurrentModuleObject} + "=\"" + equationName + ", invalid value");
796 0 : ShowContinueError(state, "Invalid Key choice Entered, for " + sourceFieldName + '=' + equationName);
797 0 : ErrorsFound = true;
798 : }
799 135 : return InsideAdaptiveConvectionAlgoParam;
800 : }
801 :
802 18 : int SetOutsideAdaptiveConvectionAlgo(EnergyPlusData &state,
803 : const std::unordered_map<std::string, int> &HcExt_ConvectionTypesMap,
804 : bool &ErrorsFound,
805 : const std::string &equationName,
806 : const std::string &curveName,
807 : const std::string &sourceFieldName,
808 : const std::string &curveFieldName,
809 : const std::string_view RoutineName,
810 : const std::string_view CurrentModuleObject)
811 : {
812 :
813 18 : int OutsideAdaptiveConvectionAlgoParam = 0;
814 :
815 18 : if (HcExt_ConvectionTypesMap.find(equationName) != HcExt_ConvectionTypesMap.end()) {
816 18 : int HcInt = HcExt_ConvectionTypesMap.at(equationName);
817 18 : OutsideAdaptiveConvectionAlgoParam = HcInt;
818 18 : if (HcInt == ConvectionConstants::HcExt_UserCurve) {
819 0 : OutsideAdaptiveConvectionAlgoParam = UtilityRoutines::FindItemInList(curveName, state.dataConvectionCoefficient->HcOutsideUserCurve);
820 0 : if (OutsideAdaptiveConvectionAlgoParam == 0) {
821 0 : ShowSevereError(state, std::string{RoutineName} + std::string{CurrentModuleObject} + "=\"" + equationName + ", invalid value");
822 0 : ShowContinueError(state, "Invalid Name choice Entered, for " + curveFieldName + '=' + curveName);
823 0 : ErrorsFound = true;
824 : }
825 : }
826 : } else {
827 0 : ShowSevereError(state, std::string{RoutineName} + std::string{CurrentModuleObject} + "=\"" + equationName + ", invalid value");
828 0 : ShowContinueError(state, "Invalid Key choice Entered, for " + sourceFieldName + '=' + equationName);
829 0 : ErrorsFound = true;
830 : }
831 18 : return OutsideAdaptiveConvectionAlgoParam;
832 : }
833 :
834 771 : void GetUserConvectionCoefficients(EnergyPlusData &state)
835 : {
836 :
837 : // SUBROUTINE INFORMATION:
838 : // AUTHOR Linda K. Lawrie
839 : // DATE WRITTEN February 2003
840 : // MODIFIED November 2004; add more "user supplied convection coefficients"
841 : // RE-ENGINEERED na
842 :
843 : // PURPOSE OF THIS SUBROUTINE:
844 : // This subroutine gets the input for the object "Convection Coefficients" which
845 : // can be specified by a user to override the "normally" calculated convection coefficients. The
846 : // change (November 2004) allows the user to specify down to the "surface level" the
847 : // exterior or interior algorithm to be used.
848 :
849 : // Using/Aliasing
850 : using Curve::GetCurveIndex;
851 : using ScheduleManager::CheckScheduleValueMinMax;
852 : using ScheduleManager::GetScheduleIndex;
853 :
854 : // SUBROUTINE PARAMETER DEFINITIONS:
855 : static constexpr std::string_view RoutineName("GetUserConvectionCoefficients");
856 : const std::unordered_set<std::string> ValidSurfaceTypes = {"ALLEXTERIORSURFACES",
857 : "ALLEXTERIORWINDOWS",
858 : "ALLEXTERIORWALLS",
859 : "ALLEXTERIORROOFS",
860 : "ALLEXTERIORFLOORS",
861 : "ALLINTERIORSURFACES",
862 : "ALLINTERIORWINDOWS",
863 : "ALLINTERIORWALLS",
864 : "ALLINTERIORROOFS",
865 : "ALLINTERIORCEILINGS",
866 1542 : "ALLINTERIORFLOORS"};
867 :
868 : const std::unordered_map<std::string, int> HcInt_ConvectionTypesMap = {
869 : {"VALUE", ConvectionConstants::HcInt_Value},
870 : {"SCHEDULE", ConvectionConstants::HcInt_Schedule},
871 : {"SIMPLE", ConvectionConstants::HcInt_ASHRAESimple},
872 : {"TARP", ConvectionConstants::HcInt_ASHRAETARP},
873 : {"ADAPTIVECONVECTIONALGORITHM", ConvectionConstants::HcInt_AdaptiveConvectionAlgorithm},
874 : {"ASTMC1340", ConvectionConstants::HcInt_ASTMC1340},
875 : {"USERCURVE", ConvectionConstants::HcInt_UserCurve},
876 : {"ASHRAEVERTICALWALL", ConvectionConstants::HcInt_ASHRAEVerticalWall},
877 : {"WALTONUNSTABLEHORIZONTALORTILT", ConvectionConstants::HcInt_WaltonUnstableHorizontalOrTilt},
878 : {"WALTONSTABLEHORIZONTALORTILT", ConvectionConstants::HcInt_WaltonStableHorizontalOrTilt},
879 : {"FISHERPEDERSENCEILINGDIFFUSERWALLS", ConvectionConstants::HcInt_FisherPedersenCeilDiffuserWalls},
880 : {"FISHERPEDERSENCEILINGDIFFUSERCEILING", ConvectionConstants::HcInt_FisherPedersenCeilDiffuserCeiling},
881 : {"FISHERPEDERSENCEILINGDIFFUSERFLOOR", ConvectionConstants::HcInt_FisherPedersenCeilDiffuserFloor},
882 : {"ALAMDARIHAMMONDSTABLEHORIZONTAL", ConvectionConstants::HcInt_AlamdariHammondStableHorizontal},
883 : {"ALAMDARIHAMMONDUNSTABLEHORIZONTAL", ConvectionConstants::HcInt_AlamdariHammondUnstableHorizontal},
884 : {"ALAMDARIHAMMONDVERTICALWALL", ConvectionConstants::HcInt_AlamdariHammondVerticalWall},
885 : {"KHALIFAEQ3WALLAWAYFROMHEAT", ConvectionConstants::HcInt_KhalifaEq3WallAwayFromHeat},
886 : {"KHALIFAEQ4CEILINGAWAYFROMHEAT", ConvectionConstants::HcInt_KhalifaEq4CeilingAwayFromHeat},
887 : {"KHALIFAEQ5WALLNEARHEAT", ConvectionConstants::HcInt_KhalifaEq5WallNearHeat},
888 : {"KHALIFAEQ6NONHEATEDWALLS", ConvectionConstants::HcInt_KhalifaEq6NonHeatedWalls},
889 : {"KHALIFAEQ7CEILING", ConvectionConstants::HcInt_KhalifaEq7Ceiling},
890 : {"AWBIHATTONHEATEDFLOOR", ConvectionConstants::HcInt_AwbiHattonHeatedFloor},
891 : {"AWBIHATTONHEATEDWALL", ConvectionConstants::HcInt_AwbiHattonHeatedWall},
892 : {"BEAUSOLEILMORRISONMIXEDASSISTEDWALL", ConvectionConstants::HcInt_BeausoleilMorrisonMixedAssistingWall},
893 : {"BEAUSOLEILMORRISONMIXEDOPPOSINGWALL", ConvectionConstants::HcInt_BeausoleilMorrisonMixedOppossingWall},
894 : {"BEAUSOLEILMORRISONMIXEDSTABLEFLOOR", ConvectionConstants::HcInt_BeausoleilMorrisonMixedStableFloor},
895 : {"BEAUSOLEILMORRISONMIXEDUNSTABLEFLOOR", ConvectionConstants::HcInt_BeausoleilMorrisonMixedUnstableFloor},
896 : {"BEAUSOLEILMORRISONMIXEDSTABLECEILING", ConvectionConstants::HcInt_BeausoleilMorrisonMixedStableCeiling},
897 : {"BEAUSOLEILMORRISONMIXEDUNSTABLECEILING", ConvectionConstants::HcInt_BeausoleilMorrisonMixedUnstableCeiling},
898 : {"FOHANNOPOLIDORIVERTICALWALL", ConvectionConstants::HcInt_FohannoPolidoriVerticalWall},
899 : {"KARADAGCHILLEDCEILING", ConvectionConstants::HcInt_KaradagChilledCeiling},
900 : {"ISO15099WINDOWS", ConvectionConstants::HcInt_ISO15099Windows},
901 : {"GOLDSTEINNOVOSELACCEILINGDIFFUSERWINDOW", ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserWindow},
902 : {"GOLDSTEINNOVOSELACCEILINGDIFFUSERWALLS", ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserWalls},
903 : {"GOLDSTEINNOVOSELACCEILINGDIFFUSERFLOOR", ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserFloor},
904 1542 : };
905 :
906 : std::unordered_map<std::string, int> HcExt_ConvectionTypesMap = {
907 : {"VALUE", ConvectionConstants::HcExt_Value},
908 : {"SCHEDULE", ConvectionConstants::HcExt_Schedule},
909 : {"TARP", ConvectionConstants::HcExt_TarpHcOutside},
910 : {"SIMPLE", ConvectionConstants::HcExt_ASHRAESimple},
911 : {"MOWITT", ConvectionConstants::HcExt_MoWiTTHcOutside},
912 : {"DOE-2", ConvectionConstants::HcExt_DOE2HcOutside},
913 : {"ADAPTIVECONVECTIONALGORITHM", ConvectionConstants::HcExt_AdaptiveConvectionAlgorithm},
914 : {"USERCURVE", ConvectionConstants::HcExt_UserCurve},
915 : {"ASHRAEVERTICALWALL", ConvectionConstants::HcExt_NaturalASHRAEVerticalWall},
916 : {"WALTONUNSTABLEHORIZONTALORTILT", ConvectionConstants::HcExt_NaturalWaltonUnstableHorizontalOrTilt},
917 : {"WALTONSTABLEHORIZONTALORTILT", ConvectionConstants::HcExt_NaturalWaltonStableHorizontalOrTilt},
918 : {"NUSSELTJURGES", ConvectionConstants::HcExt_NusseltJurges},
919 : {"MCADAMS", ConvectionConstants::HcExt_McAdams},
920 : {"MITCHELL", ConvectionConstants::HcExt_Mitchell},
921 : {"CLEARROOF", ConvectionConstants::HcExt_ClearRoof},
922 : {"EMMELVERTICAL", ConvectionConstants::HcExt_EmmelVertical},
923 : {"EMMELROOF", ConvectionConstants::HcExt_EmmelRoof},
924 : {"ALAMDARIHAMMONDVERTICALWALL", ConvectionConstants::HcExt_AlamdariHammondVerticalWall},
925 : {"FOHANNOPOLIDORIVERTICALWALL", ConvectionConstants::HcExt_FohannoPolidoriVerticalWall},
926 : {"ISO15099WINDOWS", ConvectionConstants::HcExt_ISO15099Windows},
927 : {"ALAMDARIHAMMONDSTABLEHORIZONTAL", ConvectionConstants::HcExt_AlamdariHammondStableHorizontal},
928 : {"ALAMDARIHAMMONDUNSTABLEHORIZONTAL", ConvectionConstants::HcExt_AlamdariHammondUnstableHorizontal},
929 : {"SIMPLECOMBINED", ConvectionConstants::HcExt_ASHRAESimpleCombined},
930 : {"TARPWINDWARD", ConvectionConstants::HcExt_SparrowWindward},
931 : {"TARPLEEWARD", ConvectionConstants::HcExt_SparrowLeeward},
932 : {"MOWITTWINDWARD", ConvectionConstants::HcExt_MoWiTTWindward},
933 : {"MOWITTLEEWARD", ConvectionConstants::HcExt_MoWiTTLeeward},
934 : {"DOE2WINDWARD", ConvectionConstants::HcExt_DOE2Windward},
935 : {"DOE2LEEWARD", ConvectionConstants::HcExt_DOE2Leeward},
936 : {"BLOCKENWINDWARD", ConvectionConstants::HcExt_BlockenWindward},
937 1542 : };
938 :
939 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
940 1542 : Array1D_string Alphas(9);
941 1542 : Array1D<Real64> Numbers(2);
942 : int NumAlphas;
943 : int NumNumbers;
944 : int Count;
945 : int Status;
946 : int Found;
947 771 : bool ErrorsFound(false);
948 : int ExtValue;
949 : int IntValue;
950 : int Ptr;
951 : int Pass;
952 : int FieldNo;
953 : int NumField;
954 1542 : std::string CurrentModuleObject;
955 : int PotentialAssignedValue;
956 : int SurfNum;
957 :
958 771 : auto &Zone(state.dataHeatBal->Zone);
959 771 : auto &Surface(state.dataSurface->Surface);
960 :
961 : // first get user-defined H models so they can be processed for later objects
962 771 : CurrentModuleObject = "SurfaceConvectionAlgorithm:Inside:UserCurve";
963 771 : int TotInsideHcUserCurves = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
964 771 : state.dataConvectionCoefficient->HcInsideUserCurve.allocate(TotInsideHcUserCurves);
965 773 : for (int Loop = 1; Loop <= TotInsideHcUserCurves; ++Loop) {
966 14 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
967 : CurrentModuleObject,
968 : Loop,
969 2 : state.dataIPShortCut->cAlphaArgs,
970 : NumAlphas,
971 2 : state.dataIPShortCut->rNumericArgs,
972 : NumNumbers,
973 : Status,
974 2 : state.dataIPShortCut->lNumericFieldBlanks,
975 2 : state.dataIPShortCut->lAlphaFieldBlanks,
976 2 : state.dataIPShortCut->cAlphaFieldNames,
977 2 : state.dataIPShortCut->cNumericFieldNames);
978 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).Name = state.dataIPShortCut->cAlphaArgs(1);
979 :
980 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).ReferenceTempType = static_cast<ConvectionConstants::RefTemp>(
981 4 : getEnumerationValue(RefTempNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2))));
982 2 : if (state.dataConvectionCoefficient->HcInsideUserCurve(Loop).ReferenceTempType == ConvectionConstants::RefTemp::Invalid) {
983 0 : ShowSevereError(state,
984 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Key choice Entered, for " +
985 0 : state.dataIPShortCut->cAlphaFieldNames(2) + '=' + state.dataIPShortCut->cAlphaArgs(2));
986 0 : ErrorsFound = true;
987 : }
988 :
989 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) {
990 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffCurveNum = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(3));
991 2 : if (state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffCurveNum == 0) {
992 0 : ShowSevereError(state,
993 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
994 0 : state.dataIPShortCut->cAlphaFieldNames(3) + '=' + state.dataIPShortCut->cAlphaArgs(3));
995 0 : ErrorsFound = true;
996 : } else { // check type
997 6 : ErrorsFound |= Curve::CheckCurveDims(state,
998 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffCurveNum, // Curve index
999 : {1}, // Valid dimensions
1000 : RoutineName, // Routine name
1001 : CurrentModuleObject, // Object Type
1002 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).Name, // Object Name
1003 2 : state.dataIPShortCut->cAlphaFieldNames(3)); // Field Name
1004 : }
1005 : } else {
1006 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffCurveNum = 0;
1007 : }
1008 :
1009 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) {
1010 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffDivHeightCurveNum =
1011 0 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(4));
1012 0 : if (state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffDivHeightCurveNum == 0) {
1013 0 : ShowSevereError(state,
1014 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
1015 0 : state.dataIPShortCut->cAlphaFieldNames(4) + '=' + state.dataIPShortCut->cAlphaArgs(4));
1016 0 : ErrorsFound = true;
1017 : } else { // check type
1018 0 : ErrorsFound |=
1019 0 : Curve::CheckCurveDims(state,
1020 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffDivHeightCurveNum, // Curve index
1021 : {1}, // Valid dimensions
1022 : RoutineName, // Routine name
1023 : CurrentModuleObject, // Object Type
1024 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).Name, // Object Name
1025 0 : state.dataIPShortCut->cAlphaFieldNames(4)); // Field Name
1026 : }
1027 : } else {
1028 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnTempDiffDivHeightCurveNum = 0;
1029 : }
1030 :
1031 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) {
1032 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHCurveNum = GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(5));
1033 0 : if (state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHCurveNum == 0) {
1034 0 : ShowSevereError(state,
1035 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
1036 0 : state.dataIPShortCut->cAlphaFieldNames(5) + '=' + state.dataIPShortCut->cAlphaArgs(5));
1037 0 : ErrorsFound = true;
1038 : } else { // check type
1039 0 : ErrorsFound |= Curve::CheckCurveDims(state,
1040 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHCurveNum, // Curve index
1041 : {1}, // Valid dimensions
1042 : RoutineName, // Routine name
1043 : CurrentModuleObject, // Object Type
1044 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).Name, // Object Name
1045 0 : state.dataIPShortCut->cAlphaFieldNames(5)); // Field Name
1046 : }
1047 : } else {
1048 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHCurveNum = 0;
1049 : }
1050 :
1051 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(6)) {
1052 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHDivPerimLengthCurveNum =
1053 0 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(6));
1054 0 : if (state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHDivPerimLengthCurveNum == 0) {
1055 0 : ShowSevereError(state,
1056 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
1057 0 : state.dataIPShortCut->cAlphaFieldNames(6) + '=' + state.dataIPShortCut->cAlphaArgs(6));
1058 0 : ErrorsFound = true;
1059 : } else { // check type
1060 0 : ErrorsFound |=
1061 0 : Curve::CheckCurveDims(state,
1062 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHDivPerimLengthCurveNum, // Curve index
1063 : {1}, // Valid dimensions
1064 : RoutineName, // Routine name
1065 : CurrentModuleObject, // Object Type
1066 0 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).Name, // Object Name
1067 0 : state.dataIPShortCut->cAlphaFieldNames(6)); // Field Name
1068 : }
1069 : } else {
1070 2 : state.dataConvectionCoefficient->HcInsideUserCurve(Loop).HcFnACHDivPerimLengthCurveNum = 0;
1071 : }
1072 :
1073 : } // end of 'SurfaceConvectionAlgorithm:Inside:UserCurve'
1074 :
1075 771 : CurrentModuleObject = "SurfaceConvectionAlgorithm:Outside:UserCurve";
1076 771 : int TotOutsideHcUserCurves = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
1077 771 : state.dataConvectionCoefficient->HcOutsideUserCurve.allocate(TotOutsideHcUserCurves);
1078 773 : for (int Loop = 1; Loop <= TotOutsideHcUserCurves; ++Loop) {
1079 14 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1080 : CurrentModuleObject,
1081 : Loop,
1082 2 : state.dataIPShortCut->cAlphaArgs,
1083 : NumAlphas,
1084 2 : state.dataIPShortCut->rNumericArgs,
1085 : NumNumbers,
1086 : Status,
1087 2 : state.dataIPShortCut->lNumericFieldBlanks,
1088 2 : state.dataIPShortCut->lAlphaFieldBlanks,
1089 2 : state.dataIPShortCut->cAlphaFieldNames,
1090 2 : state.dataIPShortCut->cNumericFieldNames);
1091 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).Name = state.dataIPShortCut->cAlphaArgs(1);
1092 :
1093 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).WindSpeedType = static_cast<ConvectionConstants::RefWind>(
1094 4 : getEnumerationValue(RefWindNamesUC, UtilityRoutines::MakeUPPERCase(state.dataIPShortCut->cAlphaArgs(2))));
1095 2 : if (state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).WindSpeedType == ConvectionConstants::RefWind::Invalid) {
1096 0 : ShowSevereError(state,
1097 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Key choice Entered, for " +
1098 0 : state.dataIPShortCut->cAlphaFieldNames(2) + '=' + state.dataIPShortCut->cAlphaArgs(2));
1099 0 : ErrorsFound = true;
1100 : }
1101 :
1102 : // A3 , \field Hf Function of Wind Speed Curve Name
1103 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(3)) {
1104 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HfFnWindSpeedCurveNum =
1105 2 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(3));
1106 2 : if (state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HfFnWindSpeedCurveNum == 0) {
1107 0 : ShowSevereError(state,
1108 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
1109 0 : state.dataIPShortCut->cAlphaFieldNames(3) + '=' + state.dataIPShortCut->cAlphaArgs(3));
1110 0 : ErrorsFound = true;
1111 : } else { // check type
1112 6 : ErrorsFound |= Curve::CheckCurveDims(state,
1113 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HfFnWindSpeedCurveNum, // Curve index
1114 : {1}, // Valid dimensions
1115 : RoutineName, // Routine name
1116 : CurrentModuleObject, // Object Type
1117 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).Name, // Object Name
1118 2 : state.dataIPShortCut->cAlphaFieldNames(3)); // Field Name
1119 : }
1120 : } else {
1121 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HfFnWindSpeedCurveNum = 0;
1122 : }
1123 :
1124 : // A4 , \field Hn Function of Temperature Difference Curve Name
1125 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(4)) {
1126 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffCurveNum =
1127 0 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(4));
1128 0 : if (state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffCurveNum == 0) {
1129 0 : ShowSevereError(state,
1130 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
1131 0 : state.dataIPShortCut->cAlphaFieldNames(4) + '=' + state.dataIPShortCut->cAlphaArgs(4));
1132 0 : ErrorsFound = true;
1133 : } else { // check type
1134 0 : ErrorsFound |= Curve::CheckCurveDims(state,
1135 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffCurveNum, // Curve index
1136 : {1}, // Valid dimensions
1137 : RoutineName, // Routine name
1138 : CurrentModuleObject, // Object Type
1139 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).Name, // Object Name
1140 0 : state.dataIPShortCut->cAlphaFieldNames(4)); // Field Name
1141 : }
1142 : } else {
1143 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffCurveNum = 0;
1144 : }
1145 :
1146 : // A5 , \field Hn Function of Temperature Difference Divided by Height Curve Name
1147 2 : if (!state.dataIPShortCut->lAlphaFieldBlanks(5)) {
1148 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffDivHeightCurveNum =
1149 0 : GetCurveIndex(state, state.dataIPShortCut->cAlphaArgs(5));
1150 0 : if (state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffDivHeightCurveNum == 0) {
1151 0 : ShowSevereError(state,
1152 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ": Invalid Name Entered, for " +
1153 0 : state.dataIPShortCut->cAlphaFieldNames(5) + '=' + state.dataIPShortCut->cAlphaArgs(5));
1154 0 : ErrorsFound = true;
1155 : } else { // check type
1156 0 : ErrorsFound |=
1157 0 : Curve::CheckCurveDims(state,
1158 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffDivHeightCurveNum, // Curve index
1159 : {1}, // Valid dimensions
1160 : RoutineName, // Routine name
1161 : CurrentModuleObject, // Object Type
1162 0 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).Name, // Object Name
1163 0 : state.dataIPShortCut->cAlphaFieldNames(5)); // Field Name
1164 : }
1165 : } else {
1166 2 : state.dataConvectionCoefficient->HcOutsideUserCurve(Loop).HnFnTempDiffDivHeightCurveNum = 0;
1167 : }
1168 :
1169 : } // 'SurfaceConvectionAlgorithm:Outside:UserCurve'
1170 :
1171 : // now get user directed overrides at the surface level.
1172 771 : state.dataSurface->TotIntConvCoeff = 0;
1173 771 : state.dataSurface->TotExtConvCoeff = 0;
1174 771 : CurrentModuleObject = "SurfaceProperty:ConvectionCoefficients:MultipleSurface";
1175 771 : Count = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
1176 772 : for (int Loop = 1; Loop <= Count; ++Loop) {
1177 5 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1178 : CurrentModuleObject,
1179 : Loop,
1180 : Alphas,
1181 : NumAlphas,
1182 : Numbers,
1183 : NumNumbers,
1184 : Status,
1185 1 : state.dataIPShortCut->lNumericFieldBlanks,
1186 1 : state.dataIPShortCut->lAlphaFieldBlanks,
1187 1 : state.dataIPShortCut->cAlphaFieldNames,
1188 1 : state.dataIPShortCut->cNumericFieldNames);
1189 1 : if (Alphas(2) == "INSIDE") {
1190 0 : ++state.dataSurface->TotIntConvCoeff;
1191 : }
1192 1 : if (Alphas(6) == "INSIDE") {
1193 0 : ++state.dataSurface->TotIntConvCoeff;
1194 : }
1195 1 : if (Alphas(2) == "OUTSIDE") {
1196 1 : ++state.dataSurface->TotExtConvCoeff;
1197 : }
1198 1 : if (Alphas(6) == "OUTSIDE") {
1199 0 : ++state.dataSurface->TotExtConvCoeff;
1200 : }
1201 1 : if (NumAlphas >= 2 && state.dataIPShortCut->lAlphaFieldBlanks(2)) {
1202 0 : ShowWarningError(state,
1203 0 : "GetUserConvectionCoefficients: " + CurrentModuleObject + ", for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
1204 0 : Alphas(1));
1205 0 : ShowContinueError(state, state.dataIPShortCut->cAlphaFieldNames(2) + " is blank and rest of fields will not be processed.");
1206 : }
1207 1 : if (NumAlphas >= 6 && state.dataIPShortCut->lAlphaFieldBlanks(6)) {
1208 0 : ShowWarningError(state,
1209 0 : "GetUserConvectionCoefficients: " + CurrentModuleObject + ", for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
1210 0 : Alphas(1));
1211 0 : ShowContinueError(state, state.dataIPShortCut->cAlphaFieldNames(6) + " is blank and rest of fields will not be processed.");
1212 : }
1213 : }
1214 771 : CurrentModuleObject = "SurfaceProperty:ConvectionCoefficients";
1215 771 : Count = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
1216 821 : for (int Loop = 1; Loop <= Count; ++Loop) {
1217 250 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1218 : CurrentModuleObject,
1219 : Loop,
1220 : Alphas,
1221 : NumAlphas,
1222 : Numbers,
1223 : NumNumbers,
1224 : Status,
1225 50 : state.dataIPShortCut->lNumericFieldBlanks,
1226 50 : state.dataIPShortCut->lAlphaFieldBlanks,
1227 50 : state.dataIPShortCut->cAlphaFieldNames,
1228 50 : state.dataIPShortCut->cNumericFieldNames);
1229 50 : if (Alphas(2) == "INSIDE") {
1230 29 : ++state.dataSurface->TotIntConvCoeff;
1231 : }
1232 50 : if (Alphas(6) == "INSIDE") {
1233 19 : ++state.dataSurface->TotIntConvCoeff;
1234 : }
1235 50 : if (Alphas(2) == "OUTSIDE") {
1236 21 : ++state.dataSurface->TotExtConvCoeff;
1237 : }
1238 50 : if (Alphas(6) == "OUTSIDE") {
1239 5 : ++state.dataSurface->TotExtConvCoeff;
1240 : }
1241 50 : if (NumAlphas >= 2 && state.dataIPShortCut->lAlphaFieldBlanks(2)) {
1242 0 : ShowWarningError(state,
1243 0 : "GetUserConvectionCoefficients: " + CurrentModuleObject + ", for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
1244 0 : Alphas(1));
1245 0 : ShowContinueError(state, state.dataIPShortCut->cAlphaFieldNames(2) + " is blank and rest of fields will not be processed.");
1246 : }
1247 50 : if (NumAlphas >= 6 && state.dataIPShortCut->lAlphaFieldBlanks(6)) {
1248 0 : ShowWarningError(state,
1249 0 : "GetUserConvectionCoefficients: " + CurrentModuleObject + ", for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
1250 0 : Alphas(1));
1251 0 : ShowContinueError(state, state.dataIPShortCut->cAlphaFieldNames(6) + " is blank and rest of fields will not be processed.");
1252 : }
1253 : }
1254 :
1255 771 : state.dataSurface->UserIntConvectionCoeffs.allocate(state.dataSurface->TotIntConvCoeff);
1256 771 : state.dataSurface->UserExtConvectionCoeffs.allocate(state.dataSurface->TotExtConvCoeff);
1257 :
1258 771 : state.dataSurface->TotIntConvCoeff = 0;
1259 771 : state.dataSurface->TotExtConvCoeff = 0;
1260 :
1261 : // Now, get for real and check for consistency
1262 771 : CurrentModuleObject = "SurfaceProperty:ConvectionCoefficients";
1263 771 : Count = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
1264 821 : for (int Loop = 1; Loop <= Count; ++Loop) {
1265 250 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1266 : CurrentModuleObject,
1267 : Loop,
1268 : Alphas,
1269 : NumAlphas,
1270 : Numbers,
1271 : NumNumbers,
1272 : Status,
1273 50 : state.dataIPShortCut->lNumericFieldBlanks,
1274 50 : state.dataIPShortCut->lAlphaFieldBlanks,
1275 50 : state.dataIPShortCut->cAlphaFieldNames,
1276 50 : state.dataIPShortCut->cNumericFieldNames);
1277 50 : Found = UtilityRoutines::FindItemInList(Alphas(1), Surface);
1278 50 : if (Found == 0) {
1279 0 : ShowSevereError(state,
1280 0 : "GetUserConvectionCoefficients: " + CurrentModuleObject + ", illegal value for " +
1281 0 : state.dataIPShortCut->cAlphaFieldNames(1) + '=' + Alphas(1));
1282 0 : ErrorsFound = true;
1283 0 : continue;
1284 : }
1285 :
1286 50 : Ptr = 2;
1287 50 : FieldNo = 2;
1288 50 : NumField = 1;
1289 150 : for (Pass = 1; Pass <= 2; ++Pass) {
1290 :
1291 : {
1292 100 : if (Alphas(Ptr) == "OUTSIDE") {
1293 26 : if (Surface(Found).OSCPtr > 0) {
1294 0 : ShowSevereError(state,
1295 0 : "GetUserSuppliedConvectionCoefficients: " + CurrentModuleObject + ", OUTSIDE " + CurrentModuleObject +
1296 0 : " cannot be specified for OtherSideCoefficient Surface=" + Alphas(1));
1297 0 : ErrorsFound = true;
1298 : }
1299 26 : ExtValue = 0;
1300 26 : PotentialAssignedValue = 0;
1301 52 : std::string equationName = Alphas(Ptr + 1);
1302 26 : if (HcExt_ConvectionTypesMap.find(equationName) != HcExt_ConvectionTypesMap.end()) {
1303 26 : ExtValue = HcExt_ConvectionTypesMap.at(equationName);
1304 :
1305 26 : if ((ExtValue == ConvectionConstants::HcExt_ASHRAESimpleCombined) || (ExtValue == ConvectionConstants::HcExt_TarpHcOutside) ||
1306 26 : (ExtValue == ConvectionConstants::HcExt_MoWiTTHcOutside) || (ExtValue == ConvectionConstants::HcExt_DOE2HcOutside) ||
1307 : (ExtValue == ConvectionConstants::HcExt_AdaptiveConvectionAlgorithm)) {
1308 0 : PotentialAssignedValue = -ExtValue;
1309 26 : } else if (ExtValue == ConvectionConstants::HcExt_Value) {
1310 22 : ++state.dataSurface->TotExtConvCoeff;
1311 22 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(1);
1312 22 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = Found;
1313 22 : if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) {
1314 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", out of range value");
1315 0 : ShowContinueError(state,
1316 0 : format("{}={}, {}=[{:.5R}].",
1317 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr),
1318 : Alphas(Ptr),
1319 0 : state.dataIPShortCut->cNumericFieldNames(NumField),
1320 0 : Numbers(NumField)));
1321 0 : ShowContinueError(state,
1322 0 : format("Out-of-range from low/high limits=[>={:.9R}, <={:.1R}].",
1323 0 : state.dataHeatBal->LowHConvLimit,
1324 0 : state.dataHeatBal->HighHConvLimit));
1325 0 : ShowContinueError(state, "Limits are set (or default) in HeatBalanceAlgorithm object.");
1326 0 : ErrorsFound = true;
1327 : }
1328 22 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1329 : ConvectionConstants::ConvCoefOverrideType::Value;
1330 22 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideValue = Numbers(NumField);
1331 22 : if (!state.dataIPShortCut->lAlphaFieldBlanks(Ptr + 2)) {
1332 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", duplicate value");
1333 0 : ShowContinueError(state,
1334 0 : "Since VALUE is used for \"" + state.dataIPShortCut->cAlphaFieldNames(FieldNo + 2) + "\", " +
1335 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + '=' + Alphas(Ptr + 2) + " is ignored.");
1336 : }
1337 22 : PotentialAssignedValue = state.dataSurface->TotExtConvCoeff;
1338 4 : } else if (ExtValue == ConvectionConstants::HcExt_Schedule) { // Schedule
1339 2 : ++state.dataSurface->TotExtConvCoeff;
1340 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(1);
1341 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = Found;
1342 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1343 : ConvectionConstants::ConvCoefOverrideType::Schedule;
1344 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).ScheduleIndex =
1345 2 : GetScheduleIndex(state, Alphas(Ptr + 2));
1346 2 : if (state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).ScheduleIndex == 0) {
1347 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1348 0 : ShowContinueError(state,
1349 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + " entered=" + Alphas(Ptr + 2));
1350 0 : ErrorsFound = true;
1351 : } else {
1352 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).ScheduleName = Alphas(Ptr + 2);
1353 : }
1354 2 : PotentialAssignedValue = state.dataSurface->TotExtConvCoeff;
1355 2 : } else if (ExtValue == ConvectionConstants::HcExt_UserCurve) { // User curve
1356 2 : ++state.dataSurface->TotExtConvCoeff;
1357 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(1);
1358 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = Found;
1359 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1360 : ConvectionConstants::ConvCoefOverrideType::UserCurve;
1361 2 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).UserCurveIndex =
1362 2 : UtilityRoutines::FindItemInList(Alphas(Ptr + 3), state.dataConvectionCoefficient->HcOutsideUserCurve);
1363 2 : if (state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).UserCurveIndex == 0) {
1364 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1365 0 : ShowContinueError(state,
1366 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 3) + " entered=" + Alphas(Ptr + 3));
1367 0 : ErrorsFound = true;
1368 : }
1369 2 : PotentialAssignedValue = state.dataSurface->TotExtConvCoeff;
1370 0 : } else if (ExtValue > ConvectionConstants::HcExt_UserCurve) {
1371 : // specificmodel
1372 0 : ++state.dataSurface->TotExtConvCoeff;
1373 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(1);
1374 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = Found;
1375 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1376 : ConvectionConstants::ConvCoefOverrideType::SpecifiedModel;
1377 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).HcModelEq = ExtValue;
1378 0 : PotentialAssignedValue = state.dataSurface->TotExtConvCoeff;
1379 :
1380 : } else {
1381 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", check input");
1382 0 : ShowContinueError(state, "Check Input Entered :" + Alphas(Ptr + 1));
1383 0 : ErrorsFound = true;
1384 : }
1385 26 : if (state.dataSurface->SurfExtConvCoeffIndex(Found) != 0) {
1386 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1387 0 : ShowContinueError(state, "Duplicate (Outside) assignment attempt");
1388 0 : ErrorsFound = true;
1389 : } else {
1390 26 : state.dataSurface->SurfExtConvCoeffIndex(Found) = PotentialAssignedValue;
1391 : }
1392 : }
1393 :
1394 74 : } else if (Alphas(Ptr) == "INSIDE") {
1395 48 : IntValue = 0;
1396 48 : PotentialAssignedValue = 0;
1397 96 : std::string equationName = Alphas(Ptr + 1);
1398 48 : if (HcInt_ConvectionTypesMap.find(equationName) != HcInt_ConvectionTypesMap.end()) {
1399 48 : IntValue = HcInt_ConvectionTypesMap.at(equationName);
1400 48 : if ((IntValue == ConvectionConstants::HcInt_ASHRAESimple) || (IntValue == ConvectionConstants::HcInt_ASHRAETARP) ||
1401 48 : (IntValue == ConvectionConstants::HcInt_AdaptiveConvectionAlgorithm) ||
1402 : (IntValue == ConvectionConstants::HcInt_ASTMC1340)) {
1403 0 : ApplyConvectionValue(state, Alphas(1), "INSIDE", -IntValue);
1404 48 : } else if (IntValue == ConvectionConstants::HcInt_Value) {
1405 44 : ++state.dataSurface->TotIntConvCoeff;
1406 44 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(1);
1407 44 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = Found;
1408 44 : if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) {
1409 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", out of range value");
1410 0 : ShowContinueError(state,
1411 0 : format("{}={}, {}=[{:.5R}].",
1412 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr),
1413 : Alphas(Ptr),
1414 0 : state.dataIPShortCut->cNumericFieldNames(NumField),
1415 0 : Numbers(NumField)));
1416 0 : ShowContinueError(state,
1417 0 : format("Out-of-range from low/high limits=[>={:.9R}, <={:.1R}].",
1418 0 : state.dataHeatBal->LowHConvLimit,
1419 0 : state.dataHeatBal->HighHConvLimit));
1420 0 : ShowContinueError(state, "Limits are set (or default) in HeatBalanceAlgorithm object.");
1421 0 : ErrorsFound = true;
1422 : }
1423 44 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1424 : ConvectionConstants::ConvCoefOverrideType::Value;
1425 44 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideValue = Numbers(NumField);
1426 44 : if (!state.dataIPShortCut->lAlphaFieldBlanks(Ptr + 2)) {
1427 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", duplicate value");
1428 0 : ShowContinueError(state,
1429 0 : "Since VALUE is used for \"" + state.dataIPShortCut->cAlphaFieldNames(FieldNo + 1) + "\", " +
1430 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + '=' + Alphas(Ptr + 2) + " is ignored.");
1431 : }
1432 44 : PotentialAssignedValue = state.dataSurface->TotIntConvCoeff;
1433 4 : } else if (IntValue == ConvectionConstants::HcInt_Schedule) {
1434 2 : ++state.dataSurface->TotIntConvCoeff;
1435 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(1);
1436 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = Found;
1437 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1438 : ConvectionConstants::ConvCoefOverrideType::Schedule;
1439 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).ScheduleIndex =
1440 2 : GetScheduleIndex(state, Alphas(Ptr + 2));
1441 2 : if (state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).ScheduleIndex == 0) {
1442 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1443 0 : ShowContinueError(state,
1444 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + " entered=" + Alphas(Ptr + 2));
1445 0 : ErrorsFound = true;
1446 : } else {
1447 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).ScheduleName = Alphas(Ptr + 2);
1448 : }
1449 2 : PotentialAssignedValue = state.dataSurface->TotIntConvCoeff;
1450 2 : } else if (IntValue == ConvectionConstants::HcInt_UserCurve) {
1451 2 : ++state.dataSurface->TotIntConvCoeff;
1452 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(1);
1453 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = Found;
1454 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1455 : ConvectionConstants::ConvCoefOverrideType::UserCurve;
1456 2 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).UserCurveIndex =
1457 2 : UtilityRoutines::FindItemInList(Alphas(Ptr + 3), state.dataConvectionCoefficient->HcInsideUserCurve);
1458 2 : if (state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).UserCurveIndex == 0) {
1459 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1460 0 : ShowContinueError(state,
1461 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 3) + " entered=" + Alphas(Ptr + 3));
1462 0 : ErrorsFound = true;
1463 : }
1464 2 : PotentialAssignedValue = state.dataSurface->TotIntConvCoeff;
1465 0 : } else if (IntValue > ConvectionConstants::HcInt_UserCurve) {
1466 : // specificmodel
1467 0 : ++state.dataSurface->TotIntConvCoeff;
1468 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(1);
1469 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = Found;
1470 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1471 : ConvectionConstants::ConvCoefOverrideType::SpecifiedModel;
1472 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).HcModelEq = IntValue;
1473 0 : PotentialAssignedValue = state.dataSurface->TotIntConvCoeff;
1474 :
1475 : } else {
1476 : // treat CeilingDiffuser and TrombeWall special
1477 0 : if (UtilityRoutines::SameString(Alphas(Ptr + 1), "CEILINGDIFFUSER") ||
1478 0 : UtilityRoutines::SameString(Alphas(Ptr + 1), "TROMBEWALL")) {
1479 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1480 0 : ShowContinueError(state,
1481 0 : "Invalid Value Entered, for " + state.dataIPShortCut->cAlphaFieldNames(Ptr) + '=' + Alphas(Ptr));
1482 0 : ShowContinueError(state,
1483 0 : "invalid value in " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 1) + '=' + Alphas(Ptr + 1) +
1484 : "\". This type is only applicable at a Zone level.");
1485 0 : ErrorsFound = true;
1486 : } else { // really invalid
1487 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1488 0 : ShowContinueError(state,
1489 0 : "Invalid Value Entered, for " + state.dataIPShortCut->cAlphaFieldNames(Ptr) + '=' + Alphas(Ptr));
1490 0 : ShowContinueError(state,
1491 0 : "invalid value in " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 1) + '=' + Alphas(Ptr + 1));
1492 0 : ErrorsFound = true;
1493 : }
1494 : }
1495 : }
1496 48 : if (state.dataSurface->SurfIntConvCoeffIndex(Found) != 0) {
1497 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", duplicate (inside)");
1498 0 : ShowContinueError(state, "Duplicate (Inside) assignment attempt.");
1499 0 : ErrorsFound = true;
1500 : } else {
1501 48 : state.dataSurface->SurfIntConvCoeffIndex(Found) = PotentialAssignedValue;
1502 : }
1503 :
1504 26 : } else if (Alphas(Ptr).empty()) { // Blank
1505 :
1506 : } else {
1507 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1508 0 : ShowContinueError(state, "Invalid Value Entered, for " + state.dataIPShortCut->cAlphaFieldNames(Ptr) + '=' + Alphas(Ptr));
1509 0 : ErrorsFound = true;
1510 : }
1511 : }
1512 :
1513 100 : Ptr += 4;
1514 100 : FieldNo += 4;
1515 100 : ++NumField;
1516 : }
1517 : }
1518 :
1519 771 : CurrentModuleObject = "SurfaceProperty:ConvectionCoefficients:MultipleSurface";
1520 771 : Count = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
1521 772 : for (int Loop = 1; Loop <= Count; ++Loop) {
1522 5 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1523 : CurrentModuleObject,
1524 : Loop,
1525 : Alphas,
1526 : NumAlphas,
1527 : Numbers,
1528 : NumNumbers,
1529 : Status,
1530 1 : state.dataIPShortCut->lNumericFieldBlanks,
1531 1 : state.dataIPShortCut->lAlphaFieldBlanks,
1532 1 : state.dataIPShortCut->cAlphaFieldNames,
1533 1 : state.dataIPShortCut->cNumericFieldNames);
1534 : // Check Field 1 for validity
1535 1 : if (ValidSurfaceTypes.find(Alphas(1)) == ValidSurfaceTypes.end()) {
1536 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1537 0 : ShowContinueError(state, "illegal value for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' + Alphas(1));
1538 0 : ErrorsFound = true;
1539 : }
1540 1 : Ptr = 2;
1541 1 : FieldNo = 2;
1542 1 : NumField = 1;
1543 3 : for (Pass = 1; Pass <= 2; ++Pass) {
1544 :
1545 : {
1546 2 : if (Alphas(Ptr) == "OUTSIDE") {
1547 2 : std::string equationName = Alphas(Ptr + 1);
1548 1 : if (HcExt_ConvectionTypesMap.find(equationName) != HcExt_ConvectionTypesMap.end()) {
1549 1 : ExtValue = HcExt_ConvectionTypesMap.at(equationName);
1550 1 : if ((ExtValue == ConvectionConstants::HcExt_ASHRAESimple) || (ExtValue == ConvectionConstants::HcExt_ASHRAETARP) ||
1551 0 : (ExtValue == ConvectionConstants::HcExt_MoWiTTHcOutside) || (ExtValue == ConvectionConstants::HcExt_DOE2HcOutside) ||
1552 : (ExtValue == ConvectionConstants::HcExt_AdaptiveConvectionAlgorithm)) {
1553 1 : ApplyConvectionValue(state, Alphas(1), "OUTSIDE", -ExtValue);
1554 0 : } else if (ExtValue == ConvectionConstants::HcExt_Value) {
1555 : // SimpleValueAssignment via UserExtConvectionCoeffs array
1556 0 : ++state.dataSurface->TotExtConvCoeff;
1557 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(Ptr);
1558 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = -999;
1559 0 : if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) {
1560 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", out of range value");
1561 0 : ShowContinueError(state,
1562 0 : format("{}={}, {}=[{:.5R}].",
1563 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr),
1564 : Alphas(Ptr),
1565 0 : state.dataIPShortCut->cNumericFieldNames(NumField),
1566 0 : Numbers(NumField)));
1567 0 : ShowContinueError(state,
1568 0 : format("Out-of-range from low/high limits=[>={:.9R}, <={:.1R}].",
1569 0 : state.dataHeatBal->LowHConvLimit,
1570 0 : state.dataHeatBal->HighHConvLimit));
1571 0 : ShowContinueError(state, "Limits are set (or default) in HeatBalanceAlgorithm object.");
1572 0 : ErrorsFound = true;
1573 : }
1574 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1575 : ConvectionConstants::ConvCoefOverrideType::Value;
1576 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideValue = Numbers(NumField);
1577 0 : if (!state.dataIPShortCut->lAlphaFieldBlanks(Ptr + 2)) {
1578 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", duplicate value");
1579 0 : ShowContinueError(state,
1580 0 : "Since VALUE is used for \"" + state.dataIPShortCut->cAlphaFieldNames(FieldNo + 2) + "\", " +
1581 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + '=' + Alphas(Ptr + 2) + " is ignored.");
1582 : }
1583 0 : ApplyConvectionValue(state, Alphas(1), "OUTSIDE", state.dataSurface->TotExtConvCoeff);
1584 0 : } else if (ExtValue == ConvectionConstants::HcExt_Schedule) {
1585 0 : ++state.dataSurface->TotExtConvCoeff;
1586 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(Ptr);
1587 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = -999;
1588 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1589 : ConvectionConstants::ConvCoefOverrideType::Schedule;
1590 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).ScheduleIndex =
1591 0 : GetScheduleIndex(state, Alphas(Ptr + 2));
1592 0 : if (state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).ScheduleIndex == 0) {
1593 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1594 0 : ShowContinueError(state,
1595 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + " entered=" + Alphas(Ptr + 2));
1596 0 : ErrorsFound = true;
1597 : } else {
1598 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).ScheduleName = Alphas(Ptr + 2);
1599 : }
1600 0 : ApplyConvectionValue(state, Alphas(1), "OUTSIDE", state.dataSurface->TotExtConvCoeff);
1601 0 : } else if (ExtValue == ConvectionConstants::HcExt_UserCurve) { // User curve
1602 0 : ++state.dataSurface->TotExtConvCoeff;
1603 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(Ptr);
1604 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = -999;
1605 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1606 : ConvectionConstants::ConvCoefOverrideType::UserCurve;
1607 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).UserCurveIndex =
1608 0 : UtilityRoutines::FindItemInList(Alphas(Ptr + 3), state.dataConvectionCoefficient->HcOutsideUserCurve);
1609 0 : if (state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).UserCurveIndex == 0) {
1610 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1611 0 : ShowContinueError(state,
1612 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 3) + " entered=" + Alphas(Ptr + 3));
1613 0 : ErrorsFound = true;
1614 : }
1615 0 : PotentialAssignedValue = state.dataSurface->TotExtConvCoeff;
1616 0 : ApplyConvectionValue(state, Alphas(1), "OUTSIDE", state.dataSurface->TotExtConvCoeff);
1617 :
1618 0 : } else if (ExtValue > ConvectionConstants::HcExt_UserCurve) {
1619 : // specificmodel
1620 0 : ++state.dataSurface->TotExtConvCoeff;
1621 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).SurfaceName = Alphas(Ptr);
1622 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).WhichSurface = -999;
1623 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).OverrideType =
1624 : ConvectionConstants::ConvCoefOverrideType::SpecifiedModel;
1625 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->TotExtConvCoeff).HcModelEq = ExtValue;
1626 0 : PotentialAssignedValue = state.dataSurface->TotExtConvCoeff;
1627 0 : ApplyConvectionValue(state, Alphas(1), "OUTSIDE", state.dataSurface->TotExtConvCoeff);
1628 : }
1629 : } else {
1630 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", check input");
1631 0 : ShowContinueError(state, "Check Input Entered :" + Alphas(Ptr + 1));
1632 0 : ErrorsFound = true;
1633 : }
1634 1 : } else if (Alphas(Ptr) == "INSIDE") {
1635 0 : std::string equationName = Alphas(Ptr + 1);
1636 0 : if (HcInt_ConvectionTypesMap.find(equationName) != HcInt_ConvectionTypesMap.end()) {
1637 0 : IntValue = HcInt_ConvectionTypesMap.at(equationName);
1638 0 : if ((IntValue == ConvectionConstants::HcInt_ASHRAESimple) || (IntValue == ConvectionConstants::HcInt_ASHRAETARP) ||
1639 0 : (IntValue == ConvectionConstants::HcInt_AdaptiveConvectionAlgorithm ||
1640 : (IntValue == ConvectionConstants::HcInt_ASTMC1340))) {
1641 0 : ApplyConvectionValue(state, Alphas(1), "INSIDE", -IntValue);
1642 0 : } else if (IntValue == ConvectionConstants::HcInt_Value) {
1643 : // SimpleValueAssignment via UserExtConvectionCoeffs array
1644 0 : ++state.dataSurface->TotIntConvCoeff;
1645 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(Ptr);
1646 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = -999;
1647 0 : if (Numbers(NumField) < state.dataHeatBal->LowHConvLimit || Numbers(NumField) > state.dataHeatBal->HighHConvLimit) {
1648 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", out of range value");
1649 0 : ShowContinueError(state,
1650 0 : format("{}={}, {}=[{:.5R}].",
1651 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr),
1652 : Alphas(Ptr),
1653 0 : state.dataIPShortCut->cNumericFieldNames(NumField),
1654 0 : Numbers(NumField)));
1655 0 : ShowContinueError(state,
1656 0 : format("Out-of-range from low/high limits=[>={:.9R}, <={:.1R}].",
1657 0 : state.dataHeatBal->LowHConvLimit,
1658 0 : state.dataHeatBal->HighHConvLimit));
1659 0 : ShowContinueError(state, "Limits are set (or default) in HeatBalanceAlgorithm object.");
1660 0 : ErrorsFound = true;
1661 : }
1662 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1663 : ConvectionConstants::ConvCoefOverrideType::Value;
1664 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideValue = Numbers(NumField);
1665 0 : if (!state.dataIPShortCut->lAlphaFieldBlanks(Ptr + 2)) {
1666 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", duplicate value");
1667 0 : ShowContinueError(state,
1668 0 : "Since VALUE is used for \"" + state.dataIPShortCut->cAlphaFieldNames(FieldNo + 2) + "\", " +
1669 0 : state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + '=' + Alphas(Ptr + 2) + " is ignored.");
1670 : }
1671 0 : ApplyConvectionValue(state, Alphas(1), "INSIDE", state.dataSurface->TotIntConvCoeff);
1672 0 : } else if (IntValue == ConvectionConstants::HcInt_Schedule) {
1673 0 : ++state.dataSurface->TotIntConvCoeff;
1674 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(Ptr);
1675 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = -999;
1676 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1677 : ConvectionConstants::ConvCoefOverrideType::Schedule;
1678 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).ScheduleIndex =
1679 0 : GetScheduleIndex(state, Alphas(Ptr + 2));
1680 0 : if (state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).ScheduleIndex == 0) {
1681 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1682 0 : ShowContinueError(state,
1683 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 2) + " entered=" + Alphas(Ptr + 2));
1684 0 : ErrorsFound = true;
1685 : } else {
1686 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).ScheduleName = Alphas(Ptr + 2);
1687 : }
1688 0 : ApplyConvectionValue(state, Alphas(1), "INSIDE", state.dataSurface->TotIntConvCoeff);
1689 0 : } else if (IntValue == ConvectionConstants::HcInt_UserCurve) {
1690 0 : ++state.dataSurface->TotIntConvCoeff;
1691 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(Ptr);
1692 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = -999;
1693 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1694 : ConvectionConstants::ConvCoefOverrideType::UserCurve;
1695 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).UserCurveIndex =
1696 0 : UtilityRoutines::FindItemInList(Alphas(Ptr + 3), state.dataConvectionCoefficient->HcInsideUserCurve);
1697 0 : if (state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).UserCurveIndex == 0) {
1698 :
1699 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1700 0 : ShowContinueError(state,
1701 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 3) + " entered=" + Alphas(Ptr + 3));
1702 0 : ErrorsFound = true;
1703 : }
1704 0 : PotentialAssignedValue = state.dataSurface->TotIntConvCoeff;
1705 0 : ApplyConvectionValue(state, Alphas(1), "INSIDE", state.dataSurface->TotIntConvCoeff);
1706 0 : } else if (IntValue > ConvectionConstants::HcInt_UserCurve) {
1707 : // specificmodel
1708 0 : ++state.dataSurface->TotIntConvCoeff;
1709 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).SurfaceName = Alphas(Ptr);
1710 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).WhichSurface = -999;
1711 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).OverrideType =
1712 : ConvectionConstants::ConvCoefOverrideType::SpecifiedModel;
1713 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->TotIntConvCoeff).HcModelEq = IntValue;
1714 0 : PotentialAssignedValue = state.dataSurface->TotIntConvCoeff;
1715 0 : ApplyConvectionValue(state, Alphas(1), "INSIDE", state.dataSurface->TotIntConvCoeff);
1716 :
1717 : } else {
1718 : // treat CeilingDiffuser and TrombeWall special
1719 0 : if (UtilityRoutines::SameString(Alphas(Ptr + 1), "CEILINGDIFFUSER") ||
1720 0 : UtilityRoutines::SameString(Alphas(Ptr + 1), "TROMBEWALL")) {
1721 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1722 0 : ShowContinueError(state, " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr) + " entered=" + Alphas(Ptr));
1723 0 : ShowContinueError(state,
1724 0 : "invalid value in " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 1) + '=' + Alphas(Ptr + 1) +
1725 : "\". This type is only applicable at a Zone level.");
1726 0 : ErrorsFound = true;
1727 : } else { // really invalid
1728 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1729 0 : ShowContinueError(state,
1730 0 : " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr + 1) + " entered=" + Alphas(Ptr + 1));
1731 0 : ErrorsFound = true;
1732 : }
1733 : }
1734 : }
1735 1 : } else if (Alphas(Ptr).empty()) { // Blank
1736 :
1737 : } else { // Error Case
1738 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alphas(1) + ", invalid value");
1739 0 : ShowContinueError(state, " Invalid " + state.dataIPShortCut->cAlphaFieldNames(Ptr) + " entered=" + Alphas(Ptr));
1740 0 : ErrorsFound = true;
1741 : }
1742 : }
1743 :
1744 2 : Ptr += 4;
1745 2 : FieldNo += 4;
1746 2 : ++NumField;
1747 : }
1748 : }
1749 :
1750 819 : for (int Loop = 1; Loop <= state.dataSurface->TotIntConvCoeff; ++Loop) {
1751 48 : if (state.dataSurface->UserIntConvectionCoeffs(Loop).OverrideType != ConvectionConstants::ConvCoefOverrideType::Schedule) continue;
1752 2 : if (state.dataSurface->UserIntConvectionCoeffs(Loop).ScheduleIndex == 0) continue;
1753 6 : if (CheckScheduleValueMinMax(state,
1754 2 : state.dataSurface->UserIntConvectionCoeffs(Loop).ScheduleIndex,
1755 : ">=",
1756 2 : state.dataHeatBal->LowHConvLimit,
1757 : "<=",
1758 2 : state.dataHeatBal->HighHConvLimit))
1759 2 : continue;
1760 0 : ShowSevereError(state,
1761 0 : std::string{RoutineName} + "Surface=\"" + state.dataSurface->UserIntConvectionCoeffs(Loop).SurfaceName +
1762 : "\", out-of-range convection coefficient:");
1763 0 : ShowContinueError(state, "Out-of-range value found in schedule=" + state.dataSurface->UserIntConvectionCoeffs(Loop).ScheduleName);
1764 0 : ShowContinueError(state,
1765 0 : format("User supplied convection coefficients must be in range [>={:.9R}, <={:.1R}]",
1766 0 : state.dataHeatBal->LowHConvLimit,
1767 0 : state.dataHeatBal->HighHConvLimit));
1768 0 : ShowContinueError(state, "Limits are set (or default) in HeatBalanceAlgorithm object.");
1769 0 : ErrorsFound = true;
1770 : }
1771 :
1772 797 : for (int Loop = 1; Loop <= state.dataSurface->TotExtConvCoeff; ++Loop) {
1773 26 : if (state.dataSurface->UserExtConvectionCoeffs(Loop).OverrideType != ConvectionConstants::ConvCoefOverrideType::Schedule) continue;
1774 2 : if (state.dataSurface->UserExtConvectionCoeffs(Loop).ScheduleIndex == 0) continue;
1775 6 : if (CheckScheduleValueMinMax(state,
1776 2 : state.dataSurface->UserExtConvectionCoeffs(Loop).ScheduleIndex,
1777 : ">=",
1778 2 : state.dataHeatBal->LowHConvLimit,
1779 : "<=",
1780 2 : state.dataHeatBal->HighHConvLimit))
1781 2 : continue;
1782 0 : ShowSevereError(state,
1783 0 : std::string{RoutineName} + "Surface=\"" + state.dataSurface->UserExtConvectionCoeffs(Loop).SurfaceName +
1784 : "\", out-of-range convection coefficient:");
1785 0 : ShowContinueError(state, "Out-of-range value found in schedule=" + state.dataSurface->UserExtConvectionCoeffs(Loop).ScheduleName);
1786 0 : ShowContinueError(state,
1787 0 : format("User supplied convection coefficients must be in range [>={:.9R}, <={:.1R}]",
1788 0 : state.dataHeatBal->LowHConvLimit,
1789 0 : state.dataHeatBal->HighHConvLimit));
1790 0 : ShowContinueError(state, "Limits are set (or default) in HeatBalanceAlgorithm object.");
1791 0 : ErrorsFound = true;
1792 : }
1793 :
1794 3273 : if (state.dataHeatBal->DefaultOutsideConvectionAlgo == ConvectionConstants::HcExt_ASHRAESimple ||
1795 6260 : std::any_of(Zone.begin(), Zone.end(), [](DataHeatBalance::ZoneData const &e) {
1796 3758 : return e.OutsideConvectionAlgo == ConvectionConstants::HcExt_ASHRAESimple;
1797 3758 : })) {
1798 201 : Count = 0;
1799 201 : for (int Loop = 1; Loop <= state.dataSurface->TotExtConvCoeff; ++Loop) {
1800 0 : SurfNum = state.dataSurface->UserExtConvectionCoeffs(Loop).WhichSurface;
1801 : // Tests show that Zone will override the simple convection specification of global.
1802 0 : if (SurfNum <= 0) continue; // ignore this error condition
1803 0 : if (Surface(SurfNum).Zone == 0) continue; // ignore this error condition
1804 0 : if (Zone(Surface(SurfNum).Zone).OutsideConvectionAlgo == ConvectionConstants::HcExt_ASHRAESimple &&
1805 0 : ((state.dataSurface->UserExtConvectionCoeffs(Loop).OverrideType == ConvectionConstants::ConvCoefOverrideType::SpecifiedModel &&
1806 0 : state.dataSurface->UserExtConvectionCoeffs(Loop).HcModelEq != ConvectionConstants::HcExt_ASHRAESimple) ||
1807 0 : state.dataSurface->UserExtConvectionCoeffs(Loop).OverrideType != ConvectionConstants::ConvCoefOverrideType::SpecifiedModel)) {
1808 0 : ++Count;
1809 0 : if (state.dataGlobal->DisplayExtraWarnings) {
1810 0 : ShowSevereError(state,
1811 0 : std::string{RoutineName} + "Surface=\"" + state.dataSurface->UserExtConvectionCoeffs(Loop).SurfaceName +
1812 : "\", mixed algorithms.");
1813 0 : ShowContinueError(
1814 : state, "Zone Outside Convection Algorithm specifies \"SimpleCombined\". SimpleCombined will be used for this surface.");
1815 : }
1816 : }
1817 : }
1818 201 : if (Count > 0) {
1819 0 : ShowSevereMessage(state,
1820 0 : std::string{RoutineName} + format("{} surfaces had different outside convection algorithms specified when", Count));
1821 0 : ShowContinueError(state,
1822 : "the Zone Outside Convection Algorithm specifies \"SimpleCombined\". SimpleCombined will be used for these surfaces.");
1823 0 : if (!state.dataGlobal->DisplayExtraWarnings) {
1824 0 : ShowContinueError(state, "Use OutputDiagnostics,DisplayExtraWarnings; to see specific instances.");
1825 0 : state.dataErrTracking->TotalSevereErrors += Count;
1826 : }
1827 : }
1828 : }
1829 :
1830 : // get SurfaceConvectionAlgorithm:Inside:AdaptiveModelSelections
1831 :
1832 771 : CurrentModuleObject = "SurfaceConvectionAlgorithm:Inside:AdaptiveModelSelections";
1833 771 : Count = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
1834 771 : if (Count == 1) {
1835 21 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
1836 : CurrentModuleObject,
1837 : 1,
1838 3 : state.dataIPShortCut->cAlphaArgs,
1839 : NumAlphas,
1840 3 : state.dataIPShortCut->rNumericArgs,
1841 : NumNumbers,
1842 : Status,
1843 3 : state.dataIPShortCut->lNumericFieldBlanks,
1844 3 : state.dataIPShortCut->lAlphaFieldBlanks,
1845 3 : state.dataIPShortCut->cAlphaFieldNames,
1846 3 : state.dataIPShortCut->cNumericFieldNames);
1847 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.Name = state.dataIPShortCut->cAlphaArgs(1); // not used by E+, unique object
1848 :
1849 3 : int i = 2;
1850 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyVertWallEqNum =
1851 6 : SetInsideAdaptiveConvectionAlgo(state,
1852 : HcInt_ConvectionTypesMap,
1853 : ErrorsFound,
1854 3 : state.dataIPShortCut->cAlphaArgs(i),
1855 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1856 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1857 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1858 : RoutineName,
1859 : CurrentModuleObject);
1860 3 : i += 2;
1861 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyStableHorizEqNum =
1862 6 : SetInsideAdaptiveConvectionAlgo(state,
1863 : HcInt_ConvectionTypesMap,
1864 : ErrorsFound,
1865 3 : state.dataIPShortCut->cAlphaArgs(i),
1866 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1867 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1868 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1869 : RoutineName,
1870 : CurrentModuleObject);
1871 :
1872 3 : i += 2;
1873 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyUnstableHorizEqNum =
1874 6 : SetInsideAdaptiveConvectionAlgo(state,
1875 : HcInt_ConvectionTypesMap,
1876 : ErrorsFound,
1877 3 : state.dataIPShortCut->cAlphaArgs(i),
1878 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1879 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1880 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1881 : RoutineName,
1882 : CurrentModuleObject);
1883 :
1884 3 : i += 2;
1885 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyStableTiltedEqNum =
1886 6 : SetInsideAdaptiveConvectionAlgo(state,
1887 : HcInt_ConvectionTypesMap,
1888 : ErrorsFound,
1889 3 : state.dataIPShortCut->cAlphaArgs(i),
1890 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1891 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1892 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1893 : RoutineName,
1894 : CurrentModuleObject);
1895 :
1896 3 : i += 2;
1897 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyUnstableTiltedEqNum =
1898 6 : SetInsideAdaptiveConvectionAlgo(state,
1899 : HcInt_ConvectionTypesMap,
1900 : ErrorsFound,
1901 3 : state.dataIPShortCut->cAlphaArgs(i),
1902 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1903 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1904 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1905 : RoutineName,
1906 : CurrentModuleObject);
1907 :
1908 3 : i += 2;
1909 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyWindowsEqNum =
1910 6 : SetInsideAdaptiveConvectionAlgo(state,
1911 : HcInt_ConvectionTypesMap,
1912 : ErrorsFound,
1913 3 : state.dataIPShortCut->cAlphaArgs(i),
1914 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1915 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1916 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1917 : RoutineName,
1918 : CurrentModuleObject);
1919 :
1920 3 : i += 2;
1921 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum =
1922 6 : SetInsideAdaptiveConvectionAlgo(state,
1923 : HcInt_ConvectionTypesMap,
1924 : ErrorsFound,
1925 3 : state.dataIPShortCut->cAlphaArgs(i),
1926 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1927 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1928 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1929 : RoutineName,
1930 : CurrentModuleObject);
1931 :
1932 3 : i += 2;
1933 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum =
1934 6 : SetInsideAdaptiveConvectionAlgo(state,
1935 : HcInt_ConvectionTypesMap,
1936 : ErrorsFound,
1937 3 : state.dataIPShortCut->cAlphaArgs(i),
1938 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1939 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1940 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1941 : RoutineName,
1942 : CurrentModuleObject);
1943 :
1944 3 : i += 2;
1945 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum =
1946 6 : SetInsideAdaptiveConvectionAlgo(state,
1947 : HcInt_ConvectionTypesMap,
1948 : ErrorsFound,
1949 3 : state.dataIPShortCut->cAlphaArgs(i),
1950 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1951 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1952 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1953 : RoutineName,
1954 : CurrentModuleObject);
1955 :
1956 3 : i += 2;
1957 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum =
1958 6 : SetInsideAdaptiveConvectionAlgo(state,
1959 : HcInt_ConvectionTypesMap,
1960 : ErrorsFound,
1961 3 : state.dataIPShortCut->cAlphaArgs(i),
1962 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1963 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1964 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1965 : RoutineName,
1966 : CurrentModuleObject);
1967 :
1968 3 : i += 2;
1969 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum =
1970 6 : SetInsideAdaptiveConvectionAlgo(state,
1971 : HcInt_ConvectionTypesMap,
1972 : ErrorsFound,
1973 3 : state.dataIPShortCut->cAlphaArgs(i),
1974 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1975 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1976 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1977 : RoutineName,
1978 : CurrentModuleObject);
1979 :
1980 3 : i += 2;
1981 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum =
1982 6 : SetInsideAdaptiveConvectionAlgo(state,
1983 : HcInt_ConvectionTypesMap,
1984 : ErrorsFound,
1985 3 : state.dataIPShortCut->cAlphaArgs(i),
1986 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1987 3 : state.dataIPShortCut->cAlphaFieldNames(i),
1988 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
1989 : RoutineName,
1990 : CurrentModuleObject);
1991 :
1992 3 : i += 2;
1993 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum =
1994 6 : SetInsideAdaptiveConvectionAlgo(state,
1995 : HcInt_ConvectionTypesMap,
1996 : ErrorsFound,
1997 3 : state.dataIPShortCut->cAlphaArgs(i),
1998 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
1999 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2000 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2001 : RoutineName,
2002 : CurrentModuleObject);
2003 :
2004 3 : i += 2;
2005 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum =
2006 6 : SetInsideAdaptiveConvectionAlgo(state,
2007 : HcInt_ConvectionTypesMap,
2008 : ErrorsFound,
2009 3 : state.dataIPShortCut->cAlphaArgs(i),
2010 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2011 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2012 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2013 : RoutineName,
2014 : CurrentModuleObject);
2015 :
2016 3 : i += 2;
2017 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum =
2018 6 : SetInsideAdaptiveConvectionAlgo(state,
2019 : HcInt_ConvectionTypesMap,
2020 : ErrorsFound,
2021 3 : state.dataIPShortCut->cAlphaArgs(i),
2022 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2023 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2024 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2025 : RoutineName,
2026 : CurrentModuleObject);
2027 :
2028 3 : i += 2;
2029 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum =
2030 6 : SetInsideAdaptiveConvectionAlgo(state,
2031 : HcInt_ConvectionTypesMap,
2032 : ErrorsFound,
2033 3 : state.dataIPShortCut->cAlphaArgs(i),
2034 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2035 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2036 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2037 : RoutineName,
2038 : CurrentModuleObject);
2039 :
2040 3 : i += 2;
2041 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum =
2042 6 : SetInsideAdaptiveConvectionAlgo(state,
2043 : HcInt_ConvectionTypesMap,
2044 : ErrorsFound,
2045 3 : state.dataIPShortCut->cAlphaArgs(i),
2046 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2047 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2048 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2049 : RoutineName,
2050 : CurrentModuleObject);
2051 :
2052 3 : i += 2;
2053 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum =
2054 6 : SetInsideAdaptiveConvectionAlgo(state,
2055 : HcInt_ConvectionTypesMap,
2056 : ErrorsFound,
2057 3 : state.dataIPShortCut->cAlphaArgs(i),
2058 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2059 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2060 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2061 : RoutineName,
2062 : CurrentModuleObject);
2063 :
2064 3 : i += 2;
2065 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum =
2066 6 : SetInsideAdaptiveConvectionAlgo(state,
2067 : HcInt_ConvectionTypesMap,
2068 : ErrorsFound,
2069 3 : state.dataIPShortCut->cAlphaArgs(i),
2070 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2071 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2072 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2073 : RoutineName,
2074 : CurrentModuleObject);
2075 :
2076 3 : i += 2;
2077 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum =
2078 6 : SetInsideAdaptiveConvectionAlgo(state,
2079 : HcInt_ConvectionTypesMap,
2080 : ErrorsFound,
2081 3 : state.dataIPShortCut->cAlphaArgs(i),
2082 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2083 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2084 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2085 : RoutineName,
2086 : CurrentModuleObject);
2087 :
2088 3 : i += 2;
2089 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum =
2090 6 : SetInsideAdaptiveConvectionAlgo(state,
2091 : HcInt_ConvectionTypesMap,
2092 : ErrorsFound,
2093 3 : state.dataIPShortCut->cAlphaArgs(i),
2094 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2095 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2096 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2097 : RoutineName,
2098 : CurrentModuleObject);
2099 :
2100 3 : i += 2;
2101 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum =
2102 6 : SetInsideAdaptiveConvectionAlgo(state,
2103 : HcInt_ConvectionTypesMap,
2104 : ErrorsFound,
2105 3 : state.dataIPShortCut->cAlphaArgs(i),
2106 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2107 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2108 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2109 : RoutineName,
2110 : CurrentModuleObject);
2111 :
2112 3 : i += 2;
2113 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum =
2114 6 : SetInsideAdaptiveConvectionAlgo(state,
2115 : HcInt_ConvectionTypesMap,
2116 : ErrorsFound,
2117 3 : state.dataIPShortCut->cAlphaArgs(i),
2118 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2119 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2120 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2121 : RoutineName,
2122 : CurrentModuleObject);
2123 :
2124 3 : i += 2;
2125 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum =
2126 6 : SetInsideAdaptiveConvectionAlgo(state,
2127 : HcInt_ConvectionTypesMap,
2128 : ErrorsFound,
2129 3 : state.dataIPShortCut->cAlphaArgs(i),
2130 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2131 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2132 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2133 : RoutineName,
2134 : CurrentModuleObject);
2135 :
2136 3 : i += 2;
2137 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum =
2138 6 : SetInsideAdaptiveConvectionAlgo(state,
2139 : HcInt_ConvectionTypesMap,
2140 : ErrorsFound,
2141 3 : state.dataIPShortCut->cAlphaArgs(i),
2142 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2143 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2144 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2145 : RoutineName,
2146 : CurrentModuleObject);
2147 :
2148 3 : i += 2;
2149 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum =
2150 6 : SetInsideAdaptiveConvectionAlgo(state,
2151 : HcInt_ConvectionTypesMap,
2152 : ErrorsFound,
2153 3 : state.dataIPShortCut->cAlphaArgs(i),
2154 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2155 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2156 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2157 : RoutineName,
2158 : CurrentModuleObject);
2159 :
2160 3 : i += 2;
2161 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum =
2162 6 : SetInsideAdaptiveConvectionAlgo(state,
2163 : HcInt_ConvectionTypesMap,
2164 : ErrorsFound,
2165 3 : state.dataIPShortCut->cAlphaArgs(i),
2166 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2167 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2168 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2169 : RoutineName,
2170 : CurrentModuleObject);
2171 :
2172 3 : i += 2;
2173 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum =
2174 6 : SetInsideAdaptiveConvectionAlgo(state,
2175 : HcInt_ConvectionTypesMap,
2176 : ErrorsFound,
2177 3 : state.dataIPShortCut->cAlphaArgs(i),
2178 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2179 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2180 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2181 : RoutineName,
2182 : CurrentModuleObject);
2183 :
2184 3 : i += 2;
2185 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum =
2186 6 : SetInsideAdaptiveConvectionAlgo(state,
2187 : HcInt_ConvectionTypesMap,
2188 : ErrorsFound,
2189 3 : state.dataIPShortCut->cAlphaArgs(i),
2190 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2191 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2192 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2193 : RoutineName,
2194 : CurrentModuleObject);
2195 :
2196 3 : i += 2;
2197 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum =
2198 6 : SetInsideAdaptiveConvectionAlgo(state,
2199 : HcInt_ConvectionTypesMap,
2200 : ErrorsFound,
2201 3 : state.dataIPShortCut->cAlphaArgs(i),
2202 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2203 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2204 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2205 : RoutineName,
2206 : CurrentModuleObject);
2207 :
2208 3 : i += 2;
2209 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum =
2210 6 : SetInsideAdaptiveConvectionAlgo(state,
2211 : HcInt_ConvectionTypesMap,
2212 : ErrorsFound,
2213 3 : state.dataIPShortCut->cAlphaArgs(i),
2214 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2215 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2216 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2217 : RoutineName,
2218 : CurrentModuleObject);
2219 :
2220 3 : i += 2;
2221 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum =
2222 6 : SetInsideAdaptiveConvectionAlgo(state,
2223 : HcInt_ConvectionTypesMap,
2224 : ErrorsFound,
2225 3 : state.dataIPShortCut->cAlphaArgs(i),
2226 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2227 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2228 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2229 : RoutineName,
2230 : CurrentModuleObject);
2231 :
2232 3 : i += 2;
2233 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum =
2234 6 : SetInsideAdaptiveConvectionAlgo(state,
2235 : HcInt_ConvectionTypesMap,
2236 : ErrorsFound,
2237 3 : state.dataIPShortCut->cAlphaArgs(i),
2238 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2239 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2240 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2241 : RoutineName,
2242 : CurrentModuleObject);
2243 :
2244 3 : i += 2;
2245 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum =
2246 6 : SetInsideAdaptiveConvectionAlgo(state,
2247 : HcInt_ConvectionTypesMap,
2248 : ErrorsFound,
2249 3 : state.dataIPShortCut->cAlphaArgs(i),
2250 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2251 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2252 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2253 : RoutineName,
2254 : CurrentModuleObject);
2255 :
2256 3 : i += 2;
2257 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum =
2258 6 : SetInsideAdaptiveConvectionAlgo(state,
2259 : HcInt_ConvectionTypesMap,
2260 : ErrorsFound,
2261 3 : state.dataIPShortCut->cAlphaArgs(i),
2262 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2263 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2264 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2265 : RoutineName,
2266 : CurrentModuleObject);
2267 :
2268 3 : i += 2;
2269 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum =
2270 6 : SetInsideAdaptiveConvectionAlgo(state,
2271 : HcInt_ConvectionTypesMap,
2272 : ErrorsFound,
2273 3 : state.dataIPShortCut->cAlphaArgs(i),
2274 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2275 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2276 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2277 : RoutineName,
2278 : CurrentModuleObject);
2279 :
2280 3 : i += 2;
2281 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum =
2282 6 : SetInsideAdaptiveConvectionAlgo(state,
2283 : HcInt_ConvectionTypesMap,
2284 : ErrorsFound,
2285 3 : state.dataIPShortCut->cAlphaArgs(i),
2286 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2287 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2288 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2289 : RoutineName,
2290 : CurrentModuleObject);
2291 :
2292 3 : i += 2;
2293 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum =
2294 6 : SetInsideAdaptiveConvectionAlgo(state,
2295 : HcInt_ConvectionTypesMap,
2296 : ErrorsFound,
2297 3 : state.dataIPShortCut->cAlphaArgs(i),
2298 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2299 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2300 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2301 : RoutineName,
2302 : CurrentModuleObject);
2303 :
2304 3 : i += 2;
2305 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBuoyAssistingFlowWallEqNum =
2306 6 : SetInsideAdaptiveConvectionAlgo(state,
2307 : HcInt_ConvectionTypesMap,
2308 : ErrorsFound,
2309 3 : state.dataIPShortCut->cAlphaArgs(i),
2310 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2311 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2312 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2313 : RoutineName,
2314 : CurrentModuleObject);
2315 :
2316 3 : i += 2;
2317 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBuoyOpposingFlowWallEqNum =
2318 6 : SetInsideAdaptiveConvectionAlgo(state,
2319 : HcInt_ConvectionTypesMap,
2320 : ErrorsFound,
2321 3 : state.dataIPShortCut->cAlphaArgs(i),
2322 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2323 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2324 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2325 : RoutineName,
2326 : CurrentModuleObject);
2327 :
2328 3 : i += 2;
2329 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum =
2330 6 : SetInsideAdaptiveConvectionAlgo(state,
2331 : HcInt_ConvectionTypesMap,
2332 : ErrorsFound,
2333 3 : state.dataIPShortCut->cAlphaArgs(i),
2334 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2335 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2336 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2337 : RoutineName,
2338 : CurrentModuleObject);
2339 :
2340 3 : i += 2;
2341 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum =
2342 6 : SetInsideAdaptiveConvectionAlgo(state,
2343 : HcInt_ConvectionTypesMap,
2344 : ErrorsFound,
2345 3 : state.dataIPShortCut->cAlphaArgs(i),
2346 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2347 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2348 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2349 : RoutineName,
2350 : CurrentModuleObject);
2351 :
2352 3 : i += 2;
2353 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum =
2354 6 : SetInsideAdaptiveConvectionAlgo(state,
2355 : HcInt_ConvectionTypesMap,
2356 : ErrorsFound,
2357 3 : state.dataIPShortCut->cAlphaArgs(i),
2358 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2359 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2360 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2361 : RoutineName,
2362 : CurrentModuleObject);
2363 :
2364 3 : i += 2;
2365 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum =
2366 6 : SetInsideAdaptiveConvectionAlgo(state,
2367 : HcInt_ConvectionTypesMap,
2368 : ErrorsFound,
2369 3 : state.dataIPShortCut->cAlphaArgs(i),
2370 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2371 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2372 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2373 : RoutineName,
2374 : CurrentModuleObject);
2375 :
2376 3 : i += 2;
2377 3 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum =
2378 6 : SetInsideAdaptiveConvectionAlgo(state,
2379 : HcInt_ConvectionTypesMap,
2380 : ErrorsFound,
2381 3 : state.dataIPShortCut->cAlphaArgs(i),
2382 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2383 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2384 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2385 : RoutineName,
2386 : CurrentModuleObject);
2387 : }
2388 :
2389 771 : CurrentModuleObject = "SurfaceConvectionAlgorithm:Outside:AdaptiveModelSelections";
2390 771 : Count = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
2391 771 : if (Count == 1) {
2392 21 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
2393 : CurrentModuleObject,
2394 : 1,
2395 3 : state.dataIPShortCut->cAlphaArgs,
2396 : NumAlphas,
2397 3 : state.dataIPShortCut->rNumericArgs,
2398 : NumNumbers,
2399 : Status,
2400 3 : state.dataIPShortCut->lNumericFieldBlanks,
2401 3 : state.dataIPShortCut->lAlphaFieldBlanks,
2402 3 : state.dataIPShortCut->cAlphaFieldNames,
2403 3 : state.dataIPShortCut->cNumericFieldNames);
2404 6 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.Name =
2405 6 : state.dataIPShortCut->cAlphaArgs(1); // not used by E+, unique object
2406 :
2407 3 : int i = 2;
2408 3 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum =
2409 6 : SetOutsideAdaptiveConvectionAlgo(state,
2410 : HcExt_ConvectionTypesMap,
2411 : ErrorsFound,
2412 3 : state.dataIPShortCut->cAlphaArgs(i),
2413 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2414 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2415 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2416 : RoutineName,
2417 : CurrentModuleObject);
2418 :
2419 3 : i += 2;
2420 3 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum =
2421 6 : SetOutsideAdaptiveConvectionAlgo(state,
2422 : HcExt_ConvectionTypesMap,
2423 : ErrorsFound,
2424 3 : state.dataIPShortCut->cAlphaArgs(i),
2425 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2426 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2427 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2428 : RoutineName,
2429 : CurrentModuleObject);
2430 :
2431 3 : i += 2;
2432 3 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum =
2433 6 : SetOutsideAdaptiveConvectionAlgo(state,
2434 : HcExt_ConvectionTypesMap,
2435 : ErrorsFound,
2436 3 : state.dataIPShortCut->cAlphaArgs(i),
2437 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2438 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2439 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2440 : RoutineName,
2441 : CurrentModuleObject);
2442 :
2443 3 : i += 2;
2444 3 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum =
2445 6 : SetOutsideAdaptiveConvectionAlgo(state,
2446 : HcExt_ConvectionTypesMap,
2447 : ErrorsFound,
2448 3 : state.dataIPShortCut->cAlphaArgs(i),
2449 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2450 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2451 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2452 : RoutineName,
2453 : CurrentModuleObject);
2454 :
2455 3 : i += 2;
2456 3 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum =
2457 6 : SetOutsideAdaptiveConvectionAlgo(state,
2458 : HcExt_ConvectionTypesMap,
2459 : ErrorsFound,
2460 3 : state.dataIPShortCut->cAlphaArgs(i),
2461 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2462 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2463 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2464 : RoutineName,
2465 : CurrentModuleObject);
2466 :
2467 3 : i += 2;
2468 3 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum =
2469 6 : SetOutsideAdaptiveConvectionAlgo(state,
2470 : HcExt_ConvectionTypesMap,
2471 : ErrorsFound,
2472 3 : state.dataIPShortCut->cAlphaArgs(i),
2473 3 : state.dataIPShortCut->cAlphaArgs(i + 1),
2474 3 : state.dataIPShortCut->cAlphaFieldNames(i),
2475 3 : state.dataIPShortCut->cAlphaFieldNames(i + 1),
2476 : RoutineName,
2477 : CurrentModuleObject);
2478 : }
2479 :
2480 771 : if (ErrorsFound) {
2481 0 : ShowFatalError(state, std::string{RoutineName} + "Errors found getting input. Program termination.");
2482 : }
2483 :
2484 771 : SetupAdaptiveConvectionStaticMetaData(state);
2485 771 : }
2486 :
2487 1 : void ApplyConvectionValue(EnergyPlusData &state, std::string const &SurfaceTypes, std::string const &ConvectionType, int const Value)
2488 : {
2489 :
2490 : // SUBROUTINE INFORMATION:
2491 : // AUTHOR Linda Lawrie
2492 : // DATE WRITTEN November 2004
2493 : // MODIFIED na
2494 : // RE-ENGINEERED na
2495 :
2496 : // PURPOSE OF THIS SUBROUTINE:
2497 : // This subroutine applies a convection type to a set of surfaces. This is
2498 : // one of the "regular" convection types and becomes a "negative" convection
2499 : // type to that surface.
2500 :
2501 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2502 : int SurfNum;
2503 : bool SurfacesOfType;
2504 : int SurfaceCountOutside;
2505 : int SurfaceCountInside;
2506 2 : std::string OverwriteMessage;
2507 :
2508 1 : auto &Surface(state.dataSurface->Surface);
2509 :
2510 1 : SurfacesType SurfType = static_cast<SurfacesType>(getEnumerationValue(SurfacesTypeNamesUC, UtilityRoutines::MakeUPPERCase(SurfaceTypes)));
2511 :
2512 1 : switch (SurfType) {
2513 0 : case SurfacesType::AllExteriorSurfaces: {
2514 0 : SurfacesOfType = false;
2515 0 : SurfaceCountOutside = 0;
2516 0 : SurfaceCountInside = 0;
2517 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2518 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2519 0 : if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces
2520 0 : SurfacesOfType = true;
2521 0 : if (ConvectionType == "OUTSIDE") {
2522 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2523 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2524 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2525 0 : ShowWarningError(state,
2526 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2527 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2528 : } else {
2529 0 : ++SurfaceCountOutside;
2530 : }
2531 : } else {
2532 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2533 : }
2534 : } else {
2535 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2536 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2537 0 : ShowWarningError(state,
2538 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2539 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2540 : } else {
2541 0 : ++SurfaceCountInside;
2542 : }
2543 : } else {
2544 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2545 : }
2546 : }
2547 : }
2548 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2549 0 : if (SurfaceCountOutside > 0) {
2550 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2551 : }
2552 0 : if (SurfaceCountInside > 0) {
2553 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2554 : }
2555 0 : ShowWarningError(state,
2556 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2557 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2558 : }
2559 0 : } break;
2560 1 : case SurfacesType::AllExteriorWindows: {
2561 1 : SurfacesOfType = false;
2562 1 : SurfaceCountOutside = 0;
2563 1 : SurfaceCountInside = 0;
2564 51 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2565 50 : if (!Surface(SurfNum).HeatTransSurf) continue;
2566 46 : if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces
2567 20 : if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue;
2568 6 : SurfacesOfType = true;
2569 6 : if (ConvectionType == "OUTSIDE") {
2570 6 : if (Surface(SurfNum).OSCPtr > 0) continue;
2571 6 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2572 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2573 0 : ShowWarningError(state,
2574 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2575 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2576 : } else {
2577 0 : ++SurfaceCountOutside;
2578 : }
2579 : } else {
2580 6 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2581 : }
2582 : } else {
2583 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2584 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2585 0 : ShowWarningError(state,
2586 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2587 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2588 : } else {
2589 0 : ++SurfaceCountInside;
2590 : }
2591 : } else {
2592 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2593 : }
2594 : }
2595 : }
2596 1 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2597 0 : if (SurfaceCountOutside > 0) {
2598 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2599 : }
2600 0 : if (SurfaceCountInside > 0) {
2601 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2602 : }
2603 0 : ShowWarningError(state,
2604 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2605 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2606 : }
2607 1 : } break;
2608 0 : case SurfacesType::AllExteriorWalls: {
2609 0 : SurfacesOfType = false;
2610 0 : SurfaceCountOutside = 0;
2611 0 : SurfaceCountInside = 0;
2612 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2613 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2614 0 : if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces
2615 0 : if (Surface(SurfNum).Class != SurfaceClass::Wall) continue;
2616 0 : SurfacesOfType = true;
2617 0 : if (ConvectionType == "OUTSIDE") {
2618 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2619 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2620 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2621 0 : ShowWarningError(state,
2622 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2623 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2624 : } else {
2625 0 : ++SurfaceCountOutside;
2626 : }
2627 : } else {
2628 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2629 : }
2630 : } else {
2631 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2632 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2633 0 : ShowWarningError(state,
2634 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2635 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2636 : } else {
2637 0 : ++SurfaceCountInside;
2638 : }
2639 : } else {
2640 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2641 : }
2642 : }
2643 : }
2644 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2645 0 : if (SurfaceCountOutside > 0) {
2646 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2647 : }
2648 0 : if (SurfaceCountInside > 0) {
2649 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2650 : }
2651 0 : ShowWarningError(state,
2652 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2653 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2654 : }
2655 0 : } break;
2656 0 : case SurfacesType::AllExteriorRoofs: {
2657 0 : SurfacesOfType = false;
2658 0 : SurfaceCountOutside = 0;
2659 0 : SurfaceCountInside = 0;
2660 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2661 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2662 0 : if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces
2663 0 : if (Surface(SurfNum).Class != SurfaceClass::Roof) continue;
2664 0 : SurfacesOfType = true;
2665 0 : if (ConvectionType == "OUTSIDE") {
2666 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2667 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2668 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2669 0 : ShowWarningError(state,
2670 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2671 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2672 : } else {
2673 0 : ++SurfaceCountOutside;
2674 : }
2675 : } else {
2676 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2677 : }
2678 : } else {
2679 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2680 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2681 0 : ShowWarningError(state,
2682 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2683 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2684 : } else {
2685 0 : ++SurfaceCountInside;
2686 : }
2687 : } else {
2688 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2689 : }
2690 : }
2691 : }
2692 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2693 0 : if (SurfaceCountOutside > 0) {
2694 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2695 : }
2696 0 : if (SurfaceCountInside > 0) {
2697 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2698 : }
2699 0 : ShowWarningError(state,
2700 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2701 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2702 : }
2703 0 : } break;
2704 0 : case SurfacesType::AllExteriorFloors: {
2705 0 : SurfacesOfType = false;
2706 0 : SurfaceCountOutside = 0;
2707 0 : SurfaceCountInside = 0;
2708 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2709 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2710 0 : if (Surface(SurfNum).ExtBoundCond > 0) continue; // Interior surfaces
2711 0 : if (Surface(SurfNum).Class != SurfaceClass::Floor) continue;
2712 0 : SurfacesOfType = true;
2713 0 : if (ConvectionType == "OUTSIDE") {
2714 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2715 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2716 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2717 0 : ShowWarningError(state,
2718 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2719 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2720 : } else {
2721 0 : ++SurfaceCountOutside;
2722 : }
2723 : } else {
2724 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2725 : }
2726 : } else {
2727 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2728 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2729 0 : ShowWarningError(state,
2730 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2731 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2732 : } else {
2733 0 : ++SurfaceCountInside;
2734 : }
2735 : } else {
2736 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2737 : }
2738 : }
2739 : }
2740 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2741 0 : if (SurfaceCountOutside > 0) {
2742 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2743 : }
2744 0 : if (SurfaceCountInside > 0) {
2745 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2746 : }
2747 0 : ShowWarningError(state,
2748 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2749 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2750 : }
2751 0 : } break;
2752 0 : case SurfacesType::AllInteriorSurfaces: {
2753 0 : SurfacesOfType = false;
2754 0 : SurfaceCountOutside = 0;
2755 0 : SurfaceCountInside = 0;
2756 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2757 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2758 0 : if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces
2759 0 : SurfacesOfType = true;
2760 0 : if (ConvectionType == "OUTSIDE") {
2761 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2762 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2763 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2764 0 : ShowWarningError(state,
2765 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2766 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2767 : } else {
2768 0 : ++SurfaceCountOutside;
2769 : }
2770 : } else {
2771 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2772 : }
2773 : } else {
2774 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2775 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2776 0 : ShowWarningError(state,
2777 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2778 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2779 : } else {
2780 0 : ++SurfaceCountInside;
2781 : }
2782 : } else {
2783 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2784 : }
2785 : }
2786 : }
2787 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2788 0 : if (SurfaceCountOutside > 0) {
2789 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2790 : }
2791 0 : if (SurfaceCountInside > 0) {
2792 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2793 : }
2794 0 : ShowWarningError(state,
2795 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2796 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2797 : }
2798 0 : } break;
2799 0 : case SurfacesType::AllInteriorWindows: {
2800 0 : SurfacesOfType = false;
2801 0 : SurfaceCountOutside = 0;
2802 0 : SurfaceCountInside = 0;
2803 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2804 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2805 0 : if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces
2806 0 : if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) continue;
2807 0 : SurfacesOfType = true;
2808 0 : if (ConvectionType == "OUTSIDE") {
2809 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2810 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2811 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2812 0 : ShowWarningError(state,
2813 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2814 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2815 : } else {
2816 0 : ++SurfaceCountOutside;
2817 : }
2818 : } else {
2819 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2820 : }
2821 : } else {
2822 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2823 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2824 0 : ShowWarningError(state,
2825 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2826 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2827 : } else {
2828 0 : ++SurfaceCountInside;
2829 : }
2830 : } else {
2831 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2832 : }
2833 : }
2834 : }
2835 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2836 0 : if (SurfaceCountOutside > 0) {
2837 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2838 : }
2839 0 : if (SurfaceCountInside > 0) {
2840 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2841 : }
2842 0 : ShowWarningError(state,
2843 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2844 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2845 : }
2846 0 : } break;
2847 0 : case SurfacesType::AllInteriorWalls: {
2848 0 : SurfacesOfType = false;
2849 0 : SurfaceCountOutside = 0;
2850 0 : SurfaceCountInside = 0;
2851 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2852 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2853 0 : if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces
2854 0 : if (Surface(SurfNum).Class != SurfaceClass::Wall) continue;
2855 0 : SurfacesOfType = true;
2856 0 : if (ConvectionType == "OUTSIDE") {
2857 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2858 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2859 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2860 0 : ShowWarningError(state,
2861 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2862 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2863 : } else {
2864 0 : ++SurfaceCountOutside;
2865 : }
2866 : } else {
2867 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2868 : }
2869 : } else {
2870 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2871 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2872 0 : ShowWarningError(state,
2873 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2874 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2875 : } else {
2876 0 : ++SurfaceCountInside;
2877 : }
2878 : } else {
2879 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2880 : }
2881 : }
2882 : }
2883 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2884 0 : if (SurfaceCountOutside > 0) {
2885 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2886 : }
2887 0 : if (SurfaceCountInside > 0) {
2888 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2889 : }
2890 0 : ShowWarningError(state,
2891 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2892 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2893 : }
2894 0 : } break;
2895 0 : case SurfacesType::AllInteriorRoofs:
2896 : case SurfacesType::AllInteriorCeilings: {
2897 0 : SurfacesOfType = false;
2898 0 : SurfaceCountOutside = 0;
2899 0 : SurfaceCountInside = 0;
2900 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2901 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2902 0 : if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces
2903 0 : if (Surface(SurfNum).Class != SurfaceClass::Roof) continue;
2904 0 : SurfacesOfType = true;
2905 0 : if (ConvectionType == "OUTSIDE") {
2906 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2907 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2908 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2909 0 : ShowWarningError(state,
2910 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2911 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2912 : } else {
2913 0 : ++SurfaceCountOutside;
2914 : }
2915 : } else {
2916 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2917 : }
2918 : } else {
2919 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2920 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2921 0 : ShowWarningError(state,
2922 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2923 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2924 : } else {
2925 0 : ++SurfaceCountInside;
2926 : }
2927 : } else {
2928 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2929 : }
2930 : }
2931 : }
2932 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2933 0 : if (SurfaceCountOutside > 0) {
2934 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2935 : }
2936 0 : if (SurfaceCountInside > 0) {
2937 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2938 : }
2939 0 : ShowWarningError(state,
2940 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2941 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2942 : }
2943 0 : } break;
2944 0 : case SurfacesType::AllInteriorFloors: {
2945 0 : SurfacesOfType = false;
2946 0 : SurfaceCountOutside = 0;
2947 0 : SurfaceCountInside = 0;
2948 0 : for (SurfNum = 1; SurfNum <= state.dataSurface->TotSurfaces; ++SurfNum) {
2949 0 : if (!Surface(SurfNum).HeatTransSurf) continue;
2950 0 : if (Surface(SurfNum).ExtBoundCond <= 0) continue; // Exterior surfaces
2951 0 : if (Surface(SurfNum).Class != SurfaceClass::Floor) continue;
2952 0 : SurfacesOfType = true;
2953 0 : if (ConvectionType == "OUTSIDE") {
2954 0 : if (Surface(SurfNum).OSCPtr > 0) continue;
2955 0 : if (state.dataSurface->SurfExtConvCoeffIndex(SurfNum) != 0) {
2956 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2957 0 : ShowWarningError(state,
2958 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2959 0 : "\", not overwriting already assigned value for (Outside) in Surface=" + Surface(SurfNum).Name);
2960 : } else {
2961 0 : ++SurfaceCountOutside;
2962 : }
2963 : } else {
2964 0 : state.dataSurface->SurfExtConvCoeffIndex(SurfNum) = Value;
2965 : }
2966 : } else {
2967 0 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
2968 0 : if (state.dataGlobal->DisplayExtraWarnings) {
2969 0 : ShowWarningError(state,
2970 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2971 0 : "\", not overwriting already assigned value for (Inside) in Surface=" + Surface(SurfNum).Name);
2972 : } else {
2973 0 : ++SurfaceCountInside;
2974 : }
2975 : } else {
2976 0 : state.dataSurface->SurfIntConvCoeffIndex(SurfNum) = Value;
2977 : }
2978 : }
2979 : }
2980 0 : if (!state.dataGlobal->DisplayExtraWarnings && (SurfaceCountOutside > 0 || SurfaceCountInside > 0)) {
2981 0 : if (SurfaceCountOutside > 0) {
2982 0 : OverwriteMessage = format("{} Outside", SurfaceCountOutside);
2983 : }
2984 0 : if (SurfaceCountInside > 0) {
2985 0 : OverwriteMessage = format("{} Inside", SurfaceCountInside);
2986 : }
2987 0 : ShowWarningError(state,
2988 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
2989 0 : "\", not overwriting already assigned values for " + OverwriteMessage + " assignments.");
2990 : }
2991 0 : } break;
2992 0 : default: {
2993 0 : SurfacesOfType = false;
2994 0 : } break;
2995 : }
2996 :
2997 1 : if (!SurfacesOfType) {
2998 0 : ShowWarningError(state,
2999 0 : "User Supplied Convection Coefficients, Multiple Surface Assignments=\"" + SurfaceTypes +
3000 0 : "\", there were no surfaces of that type found for " + ConvectionType + " assignment.");
3001 : }
3002 1 : }
3003 :
3004 : Real64
3005 22682103 : CalcASHRAESimpExtConvectCoeff(DataSurfaces::SurfaceRoughness const Roughness, // Integer index for roughness, relates to parameter array indices
3006 : Real64 const SurfWindSpeed // Current wind speed, m/s
3007 : )
3008 : {
3009 :
3010 : // FUNCTION INFORMATION:
3011 : // AUTHOR Rick Strand
3012 : // DATE WRITTEN August 2000
3013 : // MODIFIED na
3014 : // RE-ENGINEERED na
3015 :
3016 : // PURPOSE OF THIS FUNCTION:
3017 : // This subroutine calculates the exterior convection coefficient
3018 : // using the ASHRAE Simple Method from a correlation from Figure 1
3019 : // on p. 22.4 of the 1989 ASHRAE Handbook of Fundamentals.
3020 : // This is a combined coefficient that includes radiation to sky, ground, and air.
3021 :
3022 : // METHODOLOGY EMPLOYED:
3023 : // Apply the correlation based on the input data.
3024 :
3025 : // REFERENCES:
3026 : // ASHRAE Handbook of Fundamentals 1989, p.22.4
3027 :
3028 : // Return value
3029 : Real64 CalcASHRAESimpExtConvectCoeff;
3030 :
3031 : // FUNCTION PARAMETER DEFINITIONS:
3032 : constexpr static std::array<Real64, 6> D = {11.58, 12.49, 10.79, 8.23, 10.22, 8.23};
3033 : constexpr static std::array<Real64, 6> E = {5.894, 4.065, 4.192, 4.00, 3.100, 3.33};
3034 : constexpr static std::array<Real64, 6> F = {0.0, 0.028, 0.0, -0.057, 0.0, -0.036};
3035 :
3036 22682103 : CalcASHRAESimpExtConvectCoeff =
3037 22682103 : D[static_cast<int>(Roughness)] + E[static_cast<int>(Roughness)] * SurfWindSpeed + F[static_cast<int>(Roughness)] * pow_2(SurfWindSpeed);
3038 :
3039 22682103 : return CalcASHRAESimpExtConvectCoeff;
3040 : }
3041 :
3042 27568939 : Real64 CalcASHRAESimpleIntConvCoeff(Real64 const Tsurf, Real64 const Tamb, Real64 const cosTilt)
3043 : {
3044 : // SUBROUTINE INFORMATION:
3045 : // AUTHOR Rick Strand
3046 : // DATE WRITTEN August 2000
3047 : // MODIFIED na
3048 : // RE-ENGINEERED na
3049 :
3050 : // PURPOSE OF THIS FUNCTION:
3051 : // This subroutine calculates the interior convection coefficient for a surface.
3052 :
3053 : // METHODOLOGY EMPLOYED:
3054 : // The convection coefficients are taken directly from the TARP Reference Manual. TARP calculated
3055 : // its coefficients using the surface conductances for e=0.9 found in ASHRAE Handbook of Fundamentals
3056 : // 1985 in Table 1 on p. 23.2, but subtracted off the radiative component which was estimated at
3057 : // 1.02 * 0.9 = 0.918 BTU/h-ft2-F. Coefficients were then converted to SI units to yield the values
3058 : // in this subroutine.
3059 :
3060 : // REFERENCES:
3061 : // 1. Walton, G. N. 1983. Thermal Analysis Research Program (TARP) Reference Manual,
3062 : // NBSSIR 83-2655, National Bureau of Standards, "Surface Inside Heat Balances", pp 79.
3063 : // 2. ASHRAE Handbook of Fundamentals 1985, p. 23.2, Table 1.
3064 :
3065 : // +---------------------+-----------+---------------------------------------------+------------------+-----------------+-------------+
3066 : // | Situation | DeltaTemp | CosTilt | cos(tilt)*deltaT | Convection Type | Coefficient |
3067 : // +---------------------+-----------+---------------------------------------------+------------------+-----------------+-------------+
3068 : // | Vertical Surface | N/A | -0.3827 to 0.3827 (67.5 to 112.5 degrees) | N/A | Normal | 3.076 |
3069 : // | Horizontal Surface | Positive | 0.9238 to 1.0 (0 to 22.5 degrees) | Positive | Enhanced | 4.043 |
3070 : // | Horizontal Surface | Positive | -0.9238 to -1.0 (157.5 to 180 degrees) | Negative | Reduced | 0.948 |
3071 : // | Horizontal Surface | Negative | 0.9239 to 1.0 (0 to 22.5 degrees) | Negative | Reduced | 0.948 |
3072 : // | Horizontal Surface | Negative | -0.9239 to -1.0 (157.5 to 180 degrees) | Positive | Enhanced | 4.040 |
3073 : // | Tilted Surface | Positive | 0.3827 to 0.9239 (22.5 to 67.5 degrees) | Positive | Enhanced | 3.870 |
3074 : // | Tilted Surface | Negative | -0.3827 to -0.9239 (157.5 to 157.5 degrees) | Positive | Enhanced | 3.870 |
3075 : // | Tilted Surface | Negative | 0.3827 to 0.9239 (22.5 to 67.5 degrees) | Negative | Reduced | 2.281 |
3076 : // | Tilted Surface | Positive | -0.3827 to -0.9239 (157.5 to 157.5 degrees) | Negative | Reduced | 2.281 |
3077 : // +---------------------+-----------+---------------------------------------------+------------------+-----------------+-------------+
3078 :
3079 : // Set HConvIn using the proper correlation based on DeltaTemp and Cosine of the Tilt of the Surface
3080 27568939 : if (std::abs(cosTilt) < 0.3827) { // Vertical Surface
3081 18420005 : return 3.076;
3082 : } else {
3083 9148934 : Real64 DeltaTempCosTilt = (Tamb - Tsurf) * cosTilt;
3084 9148934 : if (std::abs(cosTilt) >= 0.9239) { // Horizontal Surface
3085 9148934 : if (DeltaTempCosTilt > 0.0) { // Enhanced Convection
3086 4072541 : return 4.040;
3087 5076393 : } else if (DeltaTempCosTilt < 0.0) { // Reduced Convection
3088 5050371 : return 0.948;
3089 : } else { // Zero DeltaTemp
3090 26022 : return 3.076;
3091 : }
3092 : } else { // tilted surface
3093 0 : if (DeltaTempCosTilt > 0.0) { // Enhanced Convection
3094 0 : return 3.870;
3095 0 : } else if (DeltaTempCosTilt < 0.0) { // Reduced Convection
3096 0 : return 2.281;
3097 : } else { // Zero DeltaTemp
3098 0 : return 3.076;
3099 : }
3100 : }
3101 : }
3102 : }
3103 :
3104 27568939 : void CalcASHRAESimpleIntConvCoeff(EnergyPlusData &state,
3105 : int const SurfNum, // surface number for which coefficients are being calculated
3106 : Real64 const SurfaceTemperature, // Temperature of surface for evaluation of HcIn
3107 : Real64 const ZoneMeanAirTemperature // Mean Air Temperature of Zone
3108 : )
3109 : {
3110 27568939 : auto &Surface(state.dataSurface->Surface);
3111 27568939 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3112 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in = [](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
3113 0 : return CalcASHRAESimpleIntConvCoeff(Tsurf, Tamb, cosTilt);
3114 0 : };
3115 : } else {
3116 27568939 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) =
3117 27568939 : CalcASHRAESimpleIntConvCoeff(SurfaceTemperature, ZoneMeanAirTemperature, Surface(SurfNum).CosTilt);
3118 : }
3119 :
3120 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
3121 27568939 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = max(state.dataHeatBalSurf->SurfHConvInt(SurfNum), state.dataHeatBal->LowHConvLimit);
3122 27568939 : }
3123 :
3124 218171959 : Real64 CalcASHRAETARPNatural(Real64 const Tsurf, Real64 const Tamb, Real64 const cosTilt)
3125 : {
3126 : // SUBROUTINE INFORMATION:
3127 : // AUTHOR Rick Strand
3128 : // DATE WRITTEN August 2000
3129 : // MODIFIED na
3130 : // RE-ENGINEERED na
3131 :
3132 : // PURPOSE OF THIS FUNCTION:
3133 : // This subroutine calculates the convection coefficient for a surface.
3134 :
3135 : // NOTE:
3136 : // Because surface tilts are given with respect to the outward normal, applications for interior
3137 : // surfaces should use a negative cos(Tilt).
3138 :
3139 : // METHODOLOGY EMPLOYED:
3140 : // The algorithm for convection coefficients is taken directly from the TARP Reference Manual.
3141 : // ASHRAE Handbook of Fundamentals 2001, p. 3.12, Table 5 gives equations for natural convection
3142 : // heat transfer coefficients in the turbulent range for large, vertical plates and for large,
3143 : // horizontal plates facing upward when heated (or downward when cooled). A note in the text
3144 : // also gives an approximation for large, horizontal places facing downward when heated (or
3145 : // upward when cooled) recommending that it should be half of the facing upward value.
3146 : // TARP then adds a curve fit as a function of the cosine of the tilt angle to provide intermediate
3147 : // values between vertical and horizontal. The curve fit values at the extremes match the ASHRAE
3148 : // values very well.
3149 :
3150 : // REFERENCES:
3151 : // 1. Walton, G. N. 1983. Thermal Analysis Research Program (TARP) Reference Manual,
3152 : // NBSSIR 83-2655, National Bureau of Standards, "Surface Inside Heat Balances", pp 79-80.
3153 : // 2. ASHRAE Handbook of Fundamentals 2001, p. 3.12, Table 5.
3154 :
3155 218171959 : Real64 DeltaTemp = Tsurf - Tamb;
3156 :
3157 : // Set HConvIn using the proper correlation based on DeltaTemp and Surface (Cosine Tilt)
3158 :
3159 218171959 : if ((DeltaTemp == 0.0) || (cosTilt == 0.0)) { // Vertical Surface
3160 :
3161 10828268 : return CalcASHRAEVerticalWall(DeltaTemp);
3162 :
3163 207343691 : } else if (((DeltaTemp < 0.0) && (cosTilt < 0.0)) || ((DeltaTemp > 0.0) && (cosTilt > 0.0))) { // Enhanced Convection
3164 :
3165 114720284 : return CalcWaltonUnstableHorizontalOrTilt(DeltaTemp, cosTilt);
3166 :
3167 : } else { // (((DeltaTemp > 0.0) && (cosTilt < 0.0)) || ((DeltaTemp < 0.0) && (cosTilt > 0.0))) // Reduced Convection
3168 :
3169 92623407 : return CalcWaltonStableHorizontalOrTilt(DeltaTemp, cosTilt);
3170 :
3171 : } // ...end of IF-THEN block to set HConvIn
3172 : }
3173 :
3174 111989552 : void CalcASHRAEDetailedIntConvCoeff(EnergyPlusData &state,
3175 : int const SurfNum, // surface number for which coefficients are being calculated
3176 : Real64 const SurfaceTemperature, // Temperature of surface for evaluation of HcIn
3177 : Real64 const ZoneMeanAirTemperature // Mean Air Temperature of Zone
3178 : )
3179 : {
3180 111989552 : auto &Surface(state.dataSurface->Surface);
3181 111989552 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3182 212844 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in = [](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
3183 77754 : return CalcASHRAETARPNatural(Tsurf, Tamb, cosTilt);
3184 135090 : };
3185 : } else {
3186 111922007 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = CalcASHRAETARPNatural(
3187 111922007 : SurfaceTemperature, ZoneMeanAirTemperature, -Surface(SurfNum).CosTilt); // negative CosTilt because CosTilt is relative to exterior
3188 : }
3189 :
3190 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
3191 111989552 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
3192 332342 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
3193 111989552 : }
3194 :
3195 2212319 : void CalcDetailedHcInForDVModel(EnergyPlusData &state,
3196 : int const SurfNum, // surface number for which coefficients are being calculated
3197 : const Array1D<Real64> &SurfaceTemperatures, // Temperature of surfaces for evaluation of HcIn
3198 : Array1D<Real64> &HcIn, // Interior Convection Coeff Array
3199 : Optional<Array1S<Real64> const> Vhc // Velocity array for forced convection coeff calculation
3200 : )
3201 : {
3202 :
3203 : // SUBROUTINE INFORMATION:
3204 : // AUTHOR Rick Strand
3205 : // DATE WRITTEN August 2000
3206 : // MODIFIED Used for DV model; Feb 2004, LKL
3207 : // RE-ENGINEERED na
3208 :
3209 : // PURPOSE OF THIS FUNCTION:
3210 : // This subroutine calculates the interior convection coefficient for a surface.
3211 :
3212 : // Using/Aliasing
3213 :
3214 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3215 : Real64 TAirConv;
3216 : Real64 Hf;
3217 2212319 : auto &Surface(state.dataSurface->Surface);
3218 :
3219 2212319 : if (Surface(SurfNum).HeatTransSurf) { // Only treat heat transfer surfaces
3220 :
3221 : // UCSD
3222 : {
3223 2212319 : if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::AdjacentAirTemp) {
3224 2212319 : TAirConv = state.dataHeatBal->SurfTempEffBulkAir(SurfNum);
3225 : } else {
3226 : // currently set to mean air temp but should add error warning here
3227 0 : TAirConv = state.dataZoneTempPredictorCorrector->zoneHeatBalance(Surface(SurfNum).Zone).MAT;
3228 : }
3229 : }
3230 :
3231 2212319 : assert(state.dataRoomAirMod->AirModel.allocated());
3232 5570717 : if (state.dataRoomAirMod->AirModel(Surface(SurfNum).Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDDV ||
3233 3200048 : state.dataRoomAirMod->AirModel(Surface(SurfNum).Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFI ||
3234 987729 : state.dataRoomAirMod->AirModel(Surface(SurfNum).Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDUFE) {
3235 :
3236 : // Set HConvIn using the proper correlation based on DeltaTemp and CosTiltSurf
3237 2031477 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
3238 :
3239 79562 : HcIn(SurfNum) = SetIntConvectionCoeff(state, SurfNum);
3240 :
3241 : } else {
3242 1951915 : HcIn(SurfNum) = CalcASHRAETARPNatural(SurfaceTemperatures(SurfNum),
3243 : TAirConv,
3244 1951915 : -Surface(SurfNum).CosTilt); // negative CosTilt because CosTilt is relative to exterior
3245 : }
3246 :
3247 180842 : } else if (state.dataRoomAirMod->AirModel(Surface(SurfNum).Zone).AirModelType == DataRoomAirModel::RoomAirModel::UCSDCV) {
3248 :
3249 180842 : Hf = 4.3 * Vhc()(Surface(SurfNum).Zone);
3250 :
3251 : // Set HConvIn using the proper correlation based on DeltaTemp and CosTiltSurf
3252 180842 : if (state.dataSurface->SurfIntConvCoeffIndex(SurfNum) != 0) {
3253 :
3254 0 : HcIn(SurfNum) = SetIntConvectionCoeff(state, SurfNum);
3255 :
3256 : } else {
3257 180842 : HcIn(SurfNum) = CalcASHRAETARPNatural(SurfaceTemperatures(SurfNum),
3258 : TAirConv,
3259 180842 : -Surface(SurfNum).CosTilt); // negative CosTilt because CosTilt is relative to exterior
3260 180842 : HcIn(SurfNum) = std::pow(std::pow(HcIn(SurfNum), 3.2) + std::pow(Hf, 3.2), 1.0 / 3.2);
3261 : }
3262 : }
3263 : }
3264 :
3265 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
3266 2212319 : if (HcIn(SurfNum) < state.dataHeatBal->LowHConvLimit) HcIn(SurfNum) = state.dataHeatBal->LowHConvLimit;
3267 2212319 : }
3268 :
3269 203070 : Real64 CalcZoneSystemACH(EnergyPlusData &state, int const ZoneNum)
3270 : {
3271 :
3272 203070 : if (!allocated(state.dataLoopNodes->Node)) {
3273 0 : return 0.0;
3274 : } else {
3275 : // Set local variables
3276 203070 : Real64 ZoneVolume = state.dataHeatBal->Zone(ZoneNum).Volume;
3277 203070 : Real64 ZoneVolFlowRate = CalcZoneSystemVolFlowRate(state, ZoneNum);
3278 :
3279 : // Calculate ACH
3280 203070 : return ZoneVolFlowRate / ZoneVolume * DataGlobalConstants::SecInHour;
3281 : }
3282 : }
3283 :
3284 0 : Real64 CalcZoneSupplyAirTemp(EnergyPlusData &state, int const ZoneNum)
3285 : {
3286 : using namespace DataZoneEquipment;
3287 :
3288 0 : int ZoneNode = state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber;
3289 0 : int thisZoneInletNode = 0;
3290 0 : if (ZoneNode > 0) {
3291 0 : Real64 SumMdotTemp = 0.0;
3292 0 : Real64 SumMdot = 0.0;
3293 0 : for (int EquipNum = 1;
3294 0 : EquipNum <= state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).NumOfEquipTypes;
3295 : ++EquipNum) {
3296 0 : if (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipData(EquipNum).NumOutlets > 0) {
3297 0 : thisZoneInletNode = state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
3298 0 : .EquipData(EquipNum)
3299 0 : .OutletNodeNums(1);
3300 0 : if ((thisZoneInletNode > 0) && (state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate > 0.0)) {
3301 0 : SumMdotTemp += state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate * state.dataLoopNodes->Node(thisZoneInletNode).Temp;
3302 0 : SumMdot += state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate;
3303 : }
3304 : }
3305 : }
3306 0 : if (SumMdot > 0.0) {
3307 0 : return SumMdotTemp / SumMdot; // mass flow weighted inlet temperature
3308 : } else {
3309 0 : if (thisZoneInletNode > 0) {
3310 0 : return state.dataLoopNodes->Node(thisZoneInletNode).Temp;
3311 : } else {
3312 0 : return state.dataLoopNodes->Node(ZoneNode).Temp;
3313 : }
3314 : }
3315 : } else {
3316 0 : return state.dataLoopNodes->Node(ZoneNode).Temp;
3317 : }
3318 : }
3319 :
3320 203070 : Real64 CalcZoneSystemVolFlowRate(EnergyPlusData &state, int const ZoneNum)
3321 : {
3322 : using Psychrometrics::PsyRhoAirFnPbTdbW;
3323 : using Psychrometrics::PsyWFnTdpPb;
3324 :
3325 203070 : auto &Zone(state.dataHeatBal->Zone);
3326 :
3327 203070 : int ZoneNode = Zone(ZoneNum).SystemZoneNodeNumber;
3328 203070 : if (!state.dataGlobal->BeginEnvrnFlag && ZoneNode > 0) {
3329 194864 : int ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;
3330 974320 : Real64 AirDensity = PsyRhoAirFnPbTdbW(state,
3331 194864 : state.dataEnvrn->OutBaroPress,
3332 194864 : state.dataLoopNodes->Node(ZoneNode).Temp,
3333 584592 : PsyWFnTdpPb(state, state.dataLoopNodes->Node(ZoneNode).Temp, state.dataEnvrn->OutBaroPress));
3334 194864 : return state.dataLoopNodes->Node(ZoneNode).MassFlowRate / (AirDensity * ZoneMult);
3335 : } else {
3336 8206 : return 0.0;
3337 : }
3338 : }
3339 :
3340 195186 : Real64 CalcCeilingDiffuserACH(EnergyPlusData &state, int const ZoneNum)
3341 : {
3342 195186 : constexpr Real64 MinFlow(0.01); // Minimum mass flow rate
3343 195186 : constexpr Real64 MaxACH(100.0); // Maximum ceiling diffuser correlation limit
3344 :
3345 195186 : auto &Zone(state.dataHeatBal->Zone);
3346 :
3347 195186 : Real64 ACH = CalcZoneSystemACH(state, ZoneNum); // Air changes per hour
3348 :
3349 : Real64 ZoneMassFlowRate;
3350 195186 : Real64 ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;
3351 195186 : int ZoneNode = Zone(ZoneNum).SystemZoneNodeNumber; // Zone node as defined in system simulation
3352 195186 : if (!state.dataGlobal->BeginEnvrnFlag && ZoneNode > 0) {
3353 194864 : ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneNode).MassFlowRate / ZoneMult;
3354 : } else { // because these are not updated yet for new environment
3355 322 : ZoneMassFlowRate = 0.0;
3356 : }
3357 :
3358 195186 : if (ZoneMassFlowRate < MinFlow) {
3359 85823 : ACH = 0.0;
3360 : } else {
3361 : // Calculate ACH
3362 109363 : ACH = min(ACH, MaxACH);
3363 109363 : ACH = max(ACH, 0.0);
3364 : }
3365 :
3366 195186 : return ACH;
3367 : }
3368 :
3369 1914912 : Real64 CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state,
3370 : Real64 const ACH, // [1/hr] air system air change rate
3371 : Real64 const Tsurf,
3372 : Real64 const Tair,
3373 : Real64 const cosTilt,
3374 : Real64 const humRat,
3375 : Real64 const height,
3376 : bool const isWindow)
3377 : {
3378 : // SUBROUTINE INFORMATION:
3379 : // AUTHOR Rick Strand
3380 : // DATE WRITTEN August 2000
3381 : // MODIFIED na
3382 : // RE-ENGINEERED na
3383 :
3384 : // PURPOSE OF THIS FUNCTION:
3385 : // This subroutine calculates the interior convection coefficients
3386 : // for ceiling diffusers correlated to the outlet air temperature.
3387 :
3388 : // METHODOLOGY EMPLOYED:
3389 : // call functions with the actual model equations
3390 :
3391 : // REFERENCES:
3392 : // Fisher, D.E. and C.O. Pedersen, Convective Heat Transfer in Building Energy and
3393 : // Thermal Load Calculations, ASHRAE Transactions, vol. 103, Pt. 2, 1997, p.137
3394 :
3395 : // OTHER NOTES:
3396 : // The correlations shown below differ from (and are less accurate than) those shown
3397 : // in the reference above (Fisher 1997). They have been reformulated with an outlet
3398 : // temperature reference in order to accommodate the structure of the EnergyPlus code.
3399 :
3400 : // If the Ceiling Diffuser option is selected the following correlations are used.
3401 : // The development of the ceiling diffuser convection correlations is shown in reference 4.
3402 : // The correlations shown below differ from (and are less accurate than) those shown in reference 4 because they have been
3403 : // reformulated with an outlet temperature reference in order to accommodate the structure of the
3404 : // EnergyPlus code.
3405 :
3406 : // Set HConvIn using the proper correlation based on Surface Tilt
3407 : static const Real64 cos45(sqrt(2.) / 2.0);
3408 :
3409 1914912 : if (cosTilt < -cos45) {
3410 189111 : return CalcFisherPedersenCeilDiffuserFloor(state, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow); // Floor correlation
3411 1725801 : } else if (cosTilt > cos45) {
3412 200763 : return CalcFisherPedersenCeilDiffuserCeiling(state, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow); // Ceiling correlation
3413 : } else {
3414 1525038 : return CalcFisherPedersenCeilDiffuserWalls(state, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow); // Wall correlation
3415 : }
3416 : }
3417 :
3418 195186 : void CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state,
3419 : int const ZoneNum,
3420 : const Array1D<Real64> &SurfaceTemperatures) // zone number for which coefficients are being calculated
3421 : {
3422 :
3423 195186 : auto &Surface(state.dataSurface->Surface);
3424 :
3425 195186 : Real64 ACH = CalcCeilingDiffuserACH(state, ZoneNum);
3426 :
3427 195186 : Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg;
3428 :
3429 390372 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
3430 195186 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
3431 2110596 : for (auto SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
3432 1915410 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3433 6075 : Real64 height = state.dataSurface->Surface(SurfNum).Height;
3434 6075 : bool isWindow = state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).TypeIsWindow;
3435 12150 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in =
3436 11154 : [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
3437 11154 : return CalcCeilingDiffuserIntConvCoeff(state, ACH, Tsurf, Tamb, cosTilt, AirHumRat, height, isWindow);
3438 18225 : };
3439 : } else {
3440 1909335 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) =
3441 9546675 : CalcCeilingDiffuserIntConvCoeff(state,
3442 : ACH,
3443 1909335 : SurfaceTemperatures(SurfNum),
3444 1909335 : state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT,
3445 1909335 : Surface(SurfNum).CosTilt,
3446 : AirHumRat,
3447 1909335 : Surface(SurfNum).Height,
3448 1909335 : state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow);
3449 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
3450 1909335 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
3451 3552 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
3452 : }
3453 : } // SurfNum
3454 : }
3455 195186 : }
3456 :
3457 : // CalcCeilingDiffuserInletCorr should replace CalcCeilingDiffuser (above), if ZoneTempPredictorCorrector can
3458 : // ever be made to work correctly with the inlet air temperature.
3459 :
3460 0 : void CalcCeilingDiffuserInletCorr(EnergyPlusData &state,
3461 : int const ZoneNum, // Zone number
3462 : const Array1S<Real64> &SurfaceTemperatures // For CalcASHRAEDetailed, if called
3463 : )
3464 : {
3465 :
3466 : // SUBROUTINE INFORMATION:
3467 : // AUTHOR Rick Strand
3468 : // DATE WRITTEN August 2000
3469 : // RE-ENGINEERED July 2003 (Peter Graham Ellis)
3470 : // MODIFIED July 2003, (CC) set a flag for reference temperature so that supply air temperature
3471 : // is used as the reference in the inside heat balance calculations
3472 :
3473 : // PURPOSE OF THIS FUNCTION:
3474 : // This subroutine calculates the interior convection coefficients
3475 : // for ceiling diffusers correlated to the inlet air temperature.
3476 :
3477 : // REFERENCES:
3478 : // Fisher, D.E. and C.O. Pedersen, Convective Heat Transfer in Building Energy and
3479 : // Thermal Load Calculations, ASHRAE Transactions, vol. 103, Pt. 2, 1997, p.137
3480 :
3481 : // Using/Aliasing
3482 : using Psychrometrics::PsyRhoAirFnPbTdbW;
3483 : using Psychrometrics::PsyWFnTdpPb;
3484 :
3485 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3486 0 : Real64 constexpr MinFlow(0.01); // Minimum mass flow rate
3487 0 : Real64 constexpr MaxACH(100.0); // Maximum ceiling diffuser correlation limit
3488 : Real64 ACH; // Air changes per hour
3489 : int ZoneNode; // Zone node as defined in system simulation
3490 : Real64 ZoneVolume; // Zone node as defined in system simulation
3491 : Real64 ZoneMassFlowRate; // Zone node as defined in system simulation
3492 : Real64 AirDensity; // zone air density
3493 : int SurfNum; // DO loop counter for surfaces
3494 : Real64 Tilt; // Surface tilt
3495 : Real64 ZoneMult;
3496 :
3497 0 : auto &Zone(state.dataHeatBal->Zone);
3498 0 : auto &Surface(state.dataSurface->Surface);
3499 :
3500 0 : if (state.dataGlobal->SysSizingCalc || state.dataGlobal->ZoneSizingCalc || !allocated(state.dataLoopNodes->Node)) {
3501 0 : ACH = 0.0;
3502 : } else {
3503 : // Set local variables
3504 0 : ZoneVolume = Zone(ZoneNum).Volume;
3505 0 : ZoneNode = Zone(ZoneNum).SystemZoneNodeNumber;
3506 0 : ZoneMult = Zone(ZoneNum).Multiplier * Zone(ZoneNum).ListMultiplier;
3507 0 : AirDensity = PsyRhoAirFnPbTdbW(state,
3508 0 : state.dataEnvrn->OutBaroPress,
3509 0 : state.dataLoopNodes->Node(ZoneNode).Temp,
3510 0 : PsyWFnTdpPb(state, state.dataLoopNodes->Node(ZoneNode).Temp, state.dataEnvrn->OutBaroPress));
3511 0 : ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneNode).MassFlowRate / ZoneMult;
3512 :
3513 0 : if (ZoneMassFlowRate < MinFlow) {
3514 0 : ACH = 0.0;
3515 : } else {
3516 : // Calculate ACH
3517 0 : ACH = ZoneMassFlowRate / AirDensity / ZoneVolume * DataGlobalConstants::SecInHour;
3518 : // Limit ACH to range of correlation
3519 0 : ACH = min(ACH, MaxACH);
3520 0 : ACH = max(ACH, 0.0);
3521 : }
3522 : }
3523 :
3524 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
3525 0 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
3526 0 : for (SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
3527 0 : if (ACH <= 3.0) { // Use the other convection algorithm
3528 0 : if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) {
3529 0 : CalcASHRAEDetailedIntConvCoeff(
3530 0 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
3531 : } else {
3532 0 : CalcISO15099WindowIntConvCoeff(
3533 0 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
3534 : }
3535 : } else { // Use forced convection correlations
3536 0 : Tilt = Surface(SurfNum).Tilt;
3537 :
3538 : // assume that reference air temp for user defined convection coefficient is the mean air temperature (=MAT)
3539 : // Calculate the convection coefficient based on inlet (supply) air conditions
3540 0 : if (Tilt < 45.0) {
3541 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = 0.49 * std::pow(ACH, 0.8); // Ceiling correlation
3542 0 : } else if (Tilt > 135.0) {
3543 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = 0.13 * std::pow(ACH, 0.8); // Floor correlation
3544 : } else {
3545 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = 0.19 * std::pow(ACH, 0.8); // Wall correlation
3546 : }
3547 : // set flag for reference air temperature
3548 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneSupplyAirTemp;
3549 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
3550 : }
3551 :
3552 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
3553 0 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
3554 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
3555 :
3556 : } // SurfNum
3557 : }
3558 0 : if (ACH > 100.0) ShowWarningError(state, "CeilingDiffuser convection correlation is out of range: ACH > 100");
3559 0 : }
3560 :
3561 3657 : void CalcTrombeWallIntConvCoeff(EnergyPlusData &state,
3562 : int const ZoneNum, // Zone number for which coefficients are being calculated
3563 : const Array1D<Real64> &SurfaceTemperatures // Temperature of surfaces for evaluation of HcIn
3564 : )
3565 : {
3566 :
3567 : // SUBROUTINE INFORMATION:
3568 : // AUTHOR Peter Graham Ellis
3569 :
3570 : // PURPOSE OF THIS FUNCTION:
3571 : // This subroutine calculates the interior convection coefficient
3572 : // using the Trombe Wall correlation ?????
3573 :
3574 : // SUBROUTINE PARAMETER DEFINITIONS:
3575 3657 : constexpr Real64 g(9.81); // gravity constant (m/s**2)
3576 3657 : constexpr Real64 v(15.89e-6); // kinematic viscosity (m**2/s) for air at 300 K
3577 3657 : constexpr Real64 k(0.0263); // thermal conductivity (W/m K) for air at 300 K
3578 3657 : constexpr Real64 Pr(0.71); // Prandtl number for air at ?
3579 :
3580 3657 : auto &Zone(state.dataHeatBal->Zone);
3581 3657 : auto &Surface(state.dataSurface->Surface);
3582 :
3583 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3584 3657 : int Surf1 = 0; // first major wall surface
3585 3657 : int Surf2 = 0; // second major wall surface
3586 :
3587 : Real64 H; // height of enclosure
3588 : Real64 minorW; // width of enclosure (narrow dimension)
3589 : Real64 majorW; // width of major surface
3590 : Real64 gapW; // width of air gap
3591 : Real64 asp; // aspect ratio H/gapW
3592 : Real64 beta; // volumetric thermal expansion coefficient
3593 : Real64 Gr; // Grashof number
3594 : Real64 Nu; // Nusselt number
3595 : Real64 HConvNet; // net heat transfer coefficient from wall to wall
3596 : Real64 Tso; // outside surface temperature [K]
3597 : Real64 Tsi; // inside surface temperature [K]
3598 :
3599 : // If the Trombe Wall option is selected the following correlations
3600 : // will be used based on references by .....
3601 : // tall enclosed rectangular cavity
3602 :
3603 : // This routine assumes that the major Trombe wall surfaces are of the
3604 : // "WALL" class and are vertical. The important heat transfer surfaces
3605 : // are assumed to have exactly equal widths AND must have a greater
3606 : // width than the side surfaces.
3607 :
3608 3657 : H = Zone(ZoneNum).CeilingHeight;
3609 3657 : minorW = 100000.0; // An impossibly big width
3610 3657 : majorW = 0.0;
3611 3657 : gapW = 0.0;
3612 :
3613 3657 : Tso = 0.0;
3614 3657 : Tsi = 0.0;
3615 3657 : HConvNet = 0.0;
3616 :
3617 : // determine major width and minor width
3618 7314 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
3619 3657 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
3620 29256 : for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
3621 25599 : if (Surface(SurfNum).Class != SurfaceClass::Wall) continue;
3622 :
3623 14628 : if (Surface(SurfNum).Width > majorW) {
3624 3657 : majorW = Surface(SurfNum).Width;
3625 : }
3626 :
3627 14628 : if (Surface(SurfNum).Width < minorW) {
3628 7314 : minorW = Surface(SurfNum).Width;
3629 : }
3630 : }
3631 :
3632 : // assign major surfaces
3633 14628 : for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
3634 14628 : if (Surface(SurfNum).Class != SurfaceClass::Wall) continue;
3635 :
3636 14628 : if (Surface(SurfNum).Width == majorW) {
3637 7314 : if (Surf1 == 0) {
3638 3657 : Surf1 = SurfNum;
3639 : } else {
3640 3657 : Surf2 = SurfNum;
3641 :
3642 3657 : break; // both major surfaces are now assigned
3643 : }
3644 : }
3645 : }
3646 : }
3647 :
3648 : // check to make sure major surfaces were found
3649 3657 : if (Surf1 > 0 && Surf2 > 0) {
3650 3657 : gapW = minorW;
3651 3657 : asp = H / gapW; // This calc should only be done once for the zone
3652 :
3653 : // make sure inside surface is hot, outside is cold
3654 : // NOTE: this is not ideal. could have circumstances that reverse this?
3655 3657 : if (SurfaceTemperatures(Surf1) > SurfaceTemperatures(Surf2)) {
3656 0 : Tsi = SurfaceTemperatures(Surf1) + DataGlobalConstants::KelvinConv;
3657 0 : Tso = SurfaceTemperatures(Surf2) + DataGlobalConstants::KelvinConv;
3658 : } else {
3659 3657 : Tso = SurfaceTemperatures(Surf1) + DataGlobalConstants::KelvinConv;
3660 3657 : Tsi = SurfaceTemperatures(Surf2) + DataGlobalConstants::KelvinConv;
3661 : }
3662 :
3663 3657 : beta = 2.0 / (Tso + Tsi);
3664 :
3665 3657 : Gr = (g * beta * std::abs(Tsi - Tso) * pow_3(gapW)) / pow_2(v); // curve fit for v = v(T)?
3666 :
3667 3657 : CalcNusselt(state, Surf2, asp, Tso, Tsi, Gr, Pr, Nu); // curve fit for Pr = Pr(T)?
3668 :
3669 3657 : HConvNet = (k / gapW) * Nu; // curve fit for k = k(T)?
3670 :
3671 : } else {
3672 : // fatal Error msg "heat transfer surfaces not found"
3673 : }
3674 :
3675 : // Assign convection coefficients
3676 7314 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
3677 3657 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
3678 29256 : for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
3679 : // Use ASHRAESimple correlation to give values for all the minor surfaces
3680 51198 : CalcASHRAESimpleIntConvCoeff(
3681 51198 : state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
3682 :
3683 : // assign the convection coefficent to the major surfaces and any subsurfaces on them
3684 25599 : if ((Surface(SurfNum).BaseSurf == Surf1) || (Surface(SurfNum).BaseSurf == Surf2)) {
3685 10971 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3686 0 : ShowFatalError(state, "Trombe wall convection model not applicable for foundation surface =" + Surface(SurfNum).Name);
3687 : }
3688 10971 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = 2.0 * HConvNet;
3689 : }
3690 :
3691 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
3692 25599 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
3693 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
3694 : }
3695 : }
3696 3657 : }
3697 :
3698 3657 : void CalcNusselt(EnergyPlusData &state,
3699 : int const SurfNum, // Surface number
3700 : Real64 const asp, // Aspect ratio: window height to gap width
3701 : Real64 const tso, // Temperature of gap surface closest to outside (K)
3702 : Real64 const tsi, // Temperature of gap surface closest to zone (K)
3703 : Real64 const gr, // Gap gas Grashof number
3704 : Real64 const pr, // Gap gas Prandtl number
3705 : Real64 &gnu // Gap gas Nusselt number
3706 : )
3707 : {
3708 :
3709 : // SUBROUTINE INFORMATION:
3710 : // AUTHOR Peter Graham Ellis, based on code adapted by Fred Winkelmann
3711 : // from Window5 subroutine NusseltNumber
3712 : // DATE WRITTEN September 2001
3713 : // MODIFIED na
3714 : // RE-ENGINEERED na
3715 :
3716 : // PURPOSE OF THIS SUBROUTINE:
3717 : // Finds the Nusselt number for gas-filled gaps between isothermal solid layers.
3718 : // The gap may be filled with a single gas or a gas mixture.
3719 :
3720 : // METHODOLOGY EMPLOYED:
3721 : // Based on methodology in Chapter 5 of the July 18, 2001 draft of ISO 15099,
3722 : // "Thermal Performance of Windows, Doors and Shading Devices--Detailed Calculations."
3723 : // The equation numbers below correspond to those in the standard.
3724 :
3725 : // REFERENCES:
3726 : // Window5 source code; ISO 15099
3727 :
3728 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS
3729 : Real64 ra; // Rayleigh number
3730 : Real64 gnu901; // Nusselt number temporary variables for
3731 : Real64 gnu902;
3732 : Real64 gnu90;
3733 : Real64 gnu601;
3734 : Real64 gnu602; // different tilt and Ra ranges
3735 : Real64 gnu60;
3736 : Real64 gnu601a;
3737 : Real64 gnua;
3738 : Real64 gnub;
3739 : Real64 cra; // Temporary variables
3740 : Real64 a;
3741 : Real64 b;
3742 : Real64 g;
3743 : Real64 ang;
3744 : Real64 tilt;
3745 : Real64 tiltr;
3746 : Real64 costilt;
3747 : Real64 sintilt;
3748 :
3749 3657 : auto &Surface(state.dataSurface->Surface);
3750 :
3751 3657 : tilt = Surface(SurfNum).Tilt;
3752 3657 : tiltr = tilt * DataGlobalConstants::DegToRadians;
3753 3657 : costilt = Surface(SurfNum).CosTilt;
3754 3657 : sintilt = Surface(SurfNum).SinTilt;
3755 3657 : ra = gr * pr;
3756 : //! fw if (ra > 2.0e6): error that outside range of Rayleigh number?
3757 :
3758 3657 : if (ra <= 1.0e4) gnu901 = 1.0 + 1.7596678e-10 * std::pow(ra, 2.2984755); // eq. 51
3759 3657 : if (ra > 1.0e4 && ra <= 5.0e4) gnu901 = 0.028154 * std::pow(ra, 0.4134); // eq. 50
3760 3657 : if (ra > 5.0e4) gnu901 = 0.0673838 * std::pow(ra, 1.0 / 3.0); // eq. 49
3761 :
3762 3657 : gnu902 = 0.242 * std::pow(ra / asp, 0.272); // eq. 52
3763 3657 : gnu90 = max(gnu901, gnu902);
3764 :
3765 3657 : if (tso > tsi) { // window heated from above
3766 0 : gnu = 1.0 + (gnu90 - 1.0) * sintilt; // eq. 53
3767 : } else { // window heated from below
3768 3657 : if (tilt >= 60.0) {
3769 3657 : g = 0.5 * std::pow(1.0 + std::pow(ra / 3160.0, 20.6), -0.1); // eq. 47
3770 3657 : gnu601a = 1.0 + pow_7(0.0936 * std::pow(ra, 0.314) / (1.0 + g)); // eq. 45
3771 3657 : gnu601 = std::pow(gnu601a, 0.142857);
3772 :
3773 : // For any aspect ratio
3774 3657 : gnu602 = (0.104 + 0.175 / asp) * std::pow(ra, 0.283); // eq. 46
3775 3657 : gnu60 = max(gnu601, gnu602);
3776 :
3777 : // linear interpolation for layers inclined at angles between 60 and 90 deg
3778 3657 : gnu = ((90.0 - tilt) * gnu60 + (tilt - 60.0) * gnu90) / 30.0;
3779 : }
3780 3657 : if (tilt < 60.0) { // eq. 42
3781 0 : cra = ra * costilt;
3782 0 : a = 1.0 - 1708.0 / cra;
3783 0 : b = std::pow(cra / 5830.0, 0.33333) - 1.0; // LKL- replace .333 with OneThird?
3784 0 : gnua = (std::abs(a) + a) / 2.0;
3785 0 : gnub = (std::abs(b) + b) / 2.0;
3786 0 : ang = 1708.0 * std::pow(std::sin(1.8 * tiltr), 1.6);
3787 0 : gnu = 1.0 + 1.44 * gnua * (1.0 - ang / cra) + gnub;
3788 : }
3789 : }
3790 3657 : }
3791 :
3792 153438 : Real64 SetExtConvectionCoeff(EnergyPlusData &state, int const SurfNum) // Surface Number
3793 : {
3794 :
3795 : // FUNCTION INFORMATION:
3796 : // AUTHOR Linda K. Lawrie
3797 : // DATE WRITTEN May 1998
3798 : // MODIFIED na
3799 : // RE-ENGINEERED na
3800 :
3801 : // PURPOSE OF THIS FUNCTION:
3802 : // This function accesses the data structure for the User
3803 : // Supplied Exterior Convection Coefficients and returns that
3804 : // as the result of this function. The surface has already
3805 : // been verified to have user supplied exterior convection values.
3806 :
3807 : // Using/Aliasing
3808 : using ScheduleManager::GetCurrentScheduleValue;
3809 :
3810 : // Return value
3811 : Real64 SetExtConvectionCoeff;
3812 :
3813 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
3814 153438 : Real64 HExt(0.0); // Will become the returned value
3815 :
3816 153438 : auto &Surface(state.dataSurface->Surface);
3817 :
3818 153438 : switch (state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).OverrideType) {
3819 145338 : case ConvectionConstants::ConvCoefOverrideType::Value:
3820 145338 : HExt = state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).OverrideValue;
3821 145338 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3822 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = KIVA_HF_ZERO;
3823 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out = KIVA_CONST_CONV(HExt);
3824 : }
3825 145338 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = ConvectionConstants::HcExt_UserValue; // reporting
3826 145338 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = ConvectionConstants::HcExt_None; // reporting
3827 145338 : break;
3828 0 : case ConvectionConstants::ConvCoefOverrideType::Schedule:
3829 0 : HExt = GetCurrentScheduleValue(state,
3830 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).ScheduleIndex);
3831 : // Need to check for validity
3832 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3833 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = KIVA_HF_ZERO;
3834 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out = KIVA_CONST_CONV(HExt);
3835 : }
3836 0 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = ConvectionConstants::HcExt_UserSchedule; // reporting
3837 0 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = ConvectionConstants::HcExt_None; // reporting
3838 0 : break;
3839 8100 : case ConvectionConstants::ConvCoefOverrideType::UserCurve:
3840 8100 : CalcUserDefinedOutsideHcModel(
3841 8100 : state, SurfNum, state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).UserCurveIndex, HExt);
3842 : // Kiva convection handled in function above
3843 8100 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = ConvectionConstants::HcExt_UserCurve; // reporting
3844 8100 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = ConvectionConstants::HcExt_None; // reporting
3845 8100 : break;
3846 0 : case ConvectionConstants::ConvCoefOverrideType::SpecifiedModel:
3847 0 : EvaluateExtHcModels(state,
3848 : SurfNum,
3849 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).HcModelEq,
3850 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).HcModelEq,
3851 : HExt);
3852 : // Kiva convection handled in function above
3853 0 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) =
3854 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).HcModelEq; // reporting
3855 0 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) =
3856 0 : state.dataSurface->UserExtConvectionCoeffs(state.dataSurface->SurfExtConvCoeffIndex(SurfNum)).HcModelEq; // reporting
3857 0 : break;
3858 0 : default:
3859 0 : assert(false);
3860 : }
3861 :
3862 153438 : SetExtConvectionCoeff = HExt;
3863 :
3864 153438 : return SetExtConvectionCoeff;
3865 : }
3866 :
3867 328578 : Real64 SetIntConvectionCoeff(EnergyPlusData &state, int const SurfNum) // Surface Number
3868 : {
3869 :
3870 : // FUNCTION INFORMATION:
3871 : // AUTHOR Linda K. Lawrie
3872 : // DATE WRITTEN May 1998
3873 : // MODIFIED na
3874 : // RE-ENGINEERED na
3875 :
3876 : // PURPOSE OF THIS FUNCTION:
3877 : // This function accesses the data structure for the User
3878 : // Supplied Interior Convection Coefficients and returns that
3879 : // as the result of this function. The surface has already
3880 : // been verified to have user supplied interior convection values.
3881 :
3882 : // Using/Aliasing
3883 : using ScheduleManager::GetCurrentScheduleValue;
3884 :
3885 : // Return value
3886 : Real64 SetIntConvectionCoeff;
3887 :
3888 328578 : Real64 HInt(0.0); // Will become the returned value
3889 :
3890 328578 : auto &Surface(state.dataSurface->Surface);
3891 :
3892 328578 : switch (state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum)).OverrideType) {
3893 316428 : case ConvectionConstants::ConvCoefOverrideType::Value:
3894 316428 : HInt = state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum)).OverrideValue;
3895 316428 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3896 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in = KIVA_CONST_CONV(HInt);
3897 : }
3898 316428 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = ConvectionConstants::HcInt_UserValue; // reporting
3899 316428 : break;
3900 4050 : case ConvectionConstants::ConvCoefOverrideType::Schedule:
3901 4050 : HInt = GetCurrentScheduleValue(state,
3902 4050 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum)).ScheduleIndex);
3903 : // Need to check for validity
3904 4050 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
3905 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in = KIVA_CONST_CONV(HInt);
3906 : }
3907 4050 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = ConvectionConstants::HcInt_UserSchedule; // reporting
3908 4050 : break;
3909 8100 : case ConvectionConstants::ConvCoefOverrideType::UserCurve:
3910 8100 : CalcUserDefinedInsideHcModel(
3911 8100 : state, SurfNum, state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum)).UserCurveIndex, HInt);
3912 : // Kiva convection handled in function above
3913 8100 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = ConvectionConstants::HcInt_UserCurve; // reporting
3914 8100 : break;
3915 0 : case ConvectionConstants::ConvCoefOverrideType::SpecifiedModel:
3916 0 : EvaluateIntHcModels(
3917 0 : state, SurfNum, state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum)).HcModelEq, HInt);
3918 : // Kiva convection handled in function above
3919 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
3920 0 : state.dataSurface->UserIntConvectionCoeffs(state.dataSurface->SurfIntConvCoeffIndex(SurfNum)).HcModelEq;
3921 0 : break;
3922 0 : default:
3923 0 : assert(false);
3924 : }
3925 :
3926 328578 : SetIntConvectionCoeff = HInt;
3927 :
3928 328578 : return SetIntConvectionCoeff;
3929 : }
3930 :
3931 50321213 : Real64 CalcISO15099WindowIntConvCoeff(EnergyPlusData &state,
3932 : Real64 const SurfaceTemperature, // Temperature of surface for evaluation of HcIn
3933 : Real64 const AirTemperature, // Mean Air Temperature of Zone (or adjacent air temperature)
3934 : Real64 const AirHumRat, // air humidity ratio
3935 : Real64 const Height, // window cavity height [m]
3936 : Real64 TiltDeg, // glazing tilt in degrees
3937 : Real64 const sineTilt // sine of glazing tilt
3938 : )
3939 : {
3940 :
3941 : // SUBROUTINE INFORMATION:
3942 : // AUTHOR B. Griffith
3943 : // DATE WRITTEN January 2009
3944 : // MODIFIED BG May 2009, added EMS override for window coeffs.
3945 : // RE-ENGINEERED na
3946 :
3947 : // PURPOSE OF THIS SUBROUTINE:
3948 : // Calculate interior surface convection coefficients for windows
3949 :
3950 : // METHODOLOGY EMPLOYED:
3951 : // correlation documented in ISO 15099, Section 8.3.2.2
3952 :
3953 : // REFERENCES:
3954 : // Internation Standard ISO 15099. Thermal performance of windows, doors and shading devices -- Detailed Calculations
3955 : // First Edition 2003-11-15. ISO 15099:2003(E)
3956 :
3957 : // Using/Aliasing
3958 : using Psychrometrics::PsyCpAirFnW;
3959 : using Psychrometrics::PsyRhoAirFnPbTdbW;
3960 :
3961 : // Locals
3962 : static constexpr Real64 OneThird((1.0 / 3.0)); // 1/3 in highest precision
3963 50321213 : static Real64 const pow_5_25(0.56 * root_4(1.0E+5));
3964 50321213 : static Real64 const pow_11_25(0.56 * root_4(1.0E+11));
3965 : static Real64 const pow_11_2(0.58 * std::pow(1.0E+11, 0.2));
3966 : static constexpr std::string_view RoutineName("WindowTempsForNominalCond");
3967 :
3968 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3969 : Real64 DeltaTemp; // Temperature difference between the zone air and the surface
3970 : Real64 TmeanFilm; // mean film temperature
3971 : Real64 TmeanFilmKelvin; // mean film temperature for property evaluation
3972 : Real64 rho; // density of air [kg/m3]
3973 : Real64 g; // acceleration due to gravity [m/s2]
3974 : Real64 Cp; // specific heat of air [J/kg-K]
3975 : Real64 lambda; // thermal conductivity of air [W/m-K]
3976 : Real64 mu; // dynamic viscosity of air [kg/m-s]
3977 : Real64 RaH; // Rayleigh number for cavity height [ Non dim]
3978 : Real64 RaCV; // Rayleigh number for slanted cavity
3979 50321213 : Real64 Nuint(0.0); // Nusselt number for interior surface convection
3980 : Real64 SurfTempKelvin; // surface temperature in Kelvin
3981 : Real64 AirTempKelvin; // air temperature in Kelvin
3982 :
3983 50321213 : SurfTempKelvin = SurfaceTemperature + 273.15;
3984 50321213 : AirTempKelvin = AirTemperature + 273.15;
3985 50321213 : DeltaTemp = SurfaceTemperature - AirTemperature;
3986 :
3987 : // protect against wildly out of range temperatures
3988 50321213 : if ((AirTempKelvin < 200.0) || (AirTempKelvin > 400.0)) { // out of range
3989 15651 : return state.dataHeatBal->LowHConvLimit;
3990 : }
3991 50305562 : if ((SurfTempKelvin < 180.0) || (SurfTempKelvin > 450.0)) { // out of range
3992 0 : return state.dataHeatBal->LowHConvLimit;
3993 : }
3994 :
3995 : // mean film temperature
3996 50305562 : TmeanFilmKelvin = AirTempKelvin + 0.25 * (SurfTempKelvin - AirTempKelvin); // eq. 133 in ISO 15099
3997 50305562 : TmeanFilm = TmeanFilmKelvin - 273.15;
3998 :
3999 50305562 : rho = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TmeanFilm, AirHumRat, RoutineName);
4000 50305562 : g = 9.81;
4001 :
4002 : // the following properties are probably for dry air, should maybe be remade for moist-air
4003 50305562 : lambda = 2.873E-3 + 7.76E-5 * TmeanFilmKelvin; // Table B.1 in ISO 15099,
4004 50305562 : mu = 3.723E-6 + 4.94E-8 * TmeanFilmKelvin; // Table B.2 in ISO 15099
4005 :
4006 50305562 : Cp = PsyCpAirFnW(AirHumRat);
4007 :
4008 : // four cases depending on tilt and DeltaTemp (heat flow direction )
4009 50305562 : if (DeltaTemp > 0.0) TiltDeg = 180.0 - TiltDeg; // complement angle if cooling situation
4010 :
4011 50305562 : RaH = (pow_2(rho) * pow_3(Height) * g * Cp * (std::abs(SurfTempKelvin - AirTempKelvin))) / (TmeanFilmKelvin * mu * lambda); // eq 132 in ISO 15099
4012 :
4013 : // case a)
4014 50305562 : if ((0.0 <= TiltDeg) && (TiltDeg < 15.0)) {
4015 :
4016 2859548 : Nuint = 0.13 * std::pow(RaH, OneThird);
4017 :
4018 : // case b)
4019 47446014 : } else if ((15.0 <= TiltDeg) && (TiltDeg <= 90.0)) {
4020 :
4021 45912755 : RaCV = 2.5E+5 * std::pow(std::exp(0.72 * TiltDeg) / sineTilt, 0.2); // eq. 137
4022 :
4023 91825510 : if (RaH <= RaCV) {
4024 45422329 : Nuint = 0.56 * root_4(RaH * sineTilt); // eq. 135 in ISO 15099
4025 : } else {
4026 490426 : Nuint = 0.13 * (std::pow(RaH, OneThird) - std::pow(RaCV, OneThird)) + 0.56 * root_4(RaCV * sineTilt); // eq. 136 in ISO 15099
4027 : }
4028 :
4029 : // case c)
4030 1533259 : } else if ((90.0 < TiltDeg) && (TiltDeg <= 179.0)) {
4031 : // bound by applicability
4032 139240 : if (RaH * sineTilt < 1.0E+5) {
4033 14 : Nuint = pow_5_25; // bounded
4034 69606 : } else if (RaH * sineTilt >= 1.0E+11) {
4035 987 : Nuint = pow_11_25; // bounded
4036 : } else {
4037 68619 : Nuint = 0.56 * root_4(RaH * sineTilt); // eq.. 138
4038 : }
4039 :
4040 : // case d)
4041 1463639 : } else if ((179.0 < TiltDeg) && (TiltDeg <= 180.0)) {
4042 :
4043 2927278 : if (RaH > 1.0E+11) {
4044 0 : Nuint = pow_11_2; // bounded
4045 : } else {
4046 1463639 : Nuint = 0.58 * std::pow(RaH, 0.2);
4047 : }
4048 :
4049 : } else {
4050 0 : assert(false);
4051 : }
4052 :
4053 50305562 : return Nuint * lambda / Height;
4054 : }
4055 :
4056 50015144 : void CalcISO15099WindowIntConvCoeff(EnergyPlusData &state,
4057 : int const SurfNum, // surface number for which coefficients are being calculated
4058 : Real64 const SurfaceTemperature, // Temperature of surface for evaluation of HcIn
4059 : Real64 const AirTemperature // Mean Air Temperature of Zone (or adjacent air temperature)
4060 : )
4061 : {
4062 50015144 : auto &Surface(state.dataSurface->Surface);
4063 :
4064 : // Get humidity ratio
4065 : Real64 AirHumRat;
4066 50015144 : if (Surface(SurfNum).Zone > 0) {
4067 50015144 : AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(Surface(SurfNum).Zone).ZoneAirHumRatAvg;
4068 : } else {
4069 0 : AirHumRat = state.dataEnvrn->OutHumRat;
4070 : }
4071 :
4072 50015144 : Real64 Height = Surface(SurfNum).Height;
4073 50015144 : Real64 TiltDeg = Surface(SurfNum).Tilt;
4074 50015144 : Real64 sineTilt = Surface(SurfNum).SinTilt;
4075 :
4076 50015144 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
4077 0 : ShowFatalError(state, "ISO15099 convection model not applicable for foundation surface =" + Surface(SurfNum).Name);
4078 : }
4079 :
4080 50015144 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) =
4081 50015144 : CalcISO15099WindowIntConvCoeff(state, SurfaceTemperature, AirTemperature, AirHumRat, Height, TiltDeg, sineTilt);
4082 :
4083 : // EMS override point (Violates Standard 15099? throw warning? scary.
4084 50015144 : if (state.dataSurface->SurfEMSOverrideIntConvCoef(SurfNum))
4085 0 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataSurface->SurfEMSValueForIntConvCoef(SurfNum);
4086 : else
4087 50015144 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) *= state.dataHeatBalSurf->SurfWinCoeffAdjRatio(SurfNum);
4088 :
4089 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
4090 50015144 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
4091 52615 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
4092 50015144 : }
4093 :
4094 771 : RoofGeoCharacteristicsStruct getRoofGeometryInformation(EnergyPlusData &state)
4095 : {
4096 771 : RoofGeoCharacteristicsStruct RoofGeo;
4097 :
4098 1542 : std::vector<Vector> uniqueRoofVertices;
4099 1542 : std::vector<SurfaceGeometry::EdgeOfSurf> uniqEdgeOfSurfs; // I'm only partially using this
4100 44533 : for (const auto &surface : state.dataSurface->Surface) {
4101 :
4102 43762 : if (surface.ExtBoundCond != ExternalEnvironment) {
4103 25141 : continue;
4104 : }
4105 18621 : if (!surface.HeatTransSurf) {
4106 1541 : continue;
4107 : }
4108 :
4109 17080 : if (surface.Tilt > 45.0) { // TODO Double check tilt wrt outside vs inside?
4110 14538 : continue;
4111 : }
4112 :
4113 2542 : Real64 const z_min(minval(surface.Vertex, &Vector::z));
4114 2542 : Real64 const z_max(maxval(surface.Vertex, &Vector::z));
4115 2542 : Real64 const verticalHeight = z_max - z_min;
4116 2542 : RoofGeo.Height += verticalHeight * surface.Area;
4117 2542 : RoofGeo.Tilt += surface.Tilt * surface.Area;
4118 2542 : RoofGeo.Azimuth += surface.Azimuth * surface.Area;
4119 2542 : RoofGeo.Area += surface.Area;
4120 :
4121 12858 : for (auto it = surface.Vertex.begin(); it != surface.Vertex.end(); ++it) {
4122 :
4123 10316 : auto itnext = std::next(it);
4124 10316 : if (itnext == std::end(surface.Vertex)) {
4125 2542 : itnext = std::begin(surface.Vertex);
4126 : }
4127 :
4128 20632 : auto curVertex = *it;
4129 20632 : auto nextVertex = *itnext;
4130 778786 : auto it2 = std::find_if(uniqueRoofVertices.begin(), uniqueRoofVertices.end(), [&curVertex](const auto &unqV) {
4131 1137231 : return SurfaceGeometry::isAlmostEqual3dPt(curVertex, unqV);
4132 789102 : });
4133 10316 : if (it2 == std::end(uniqueRoofVertices)) {
4134 7765 : uniqueRoofVertices.emplace_back(curVertex);
4135 : }
4136 :
4137 20632 : SurfaceGeometry::EdgeOfSurf thisEdge;
4138 10316 : thisEdge.start = std::move(curVertex);
4139 10316 : thisEdge.end = std::move(nextVertex);
4140 10316 : thisEdge.count = 1;
4141 :
4142 : // Uses the custom operator== that uses isAlmostEqual3dPt internally and doesn't care about order of the start/end
4143 20632 : auto itEdge = std::find(uniqEdgeOfSurfs.begin(), uniqEdgeOfSurfs.end(), thisEdge);
4144 10316 : if (itEdge == uniqEdgeOfSurfs.end()) {
4145 9243 : uniqEdgeOfSurfs.emplace_back(std::move(thisEdge));
4146 : } else {
4147 1073 : ++(itEdge->count);
4148 : }
4149 : }
4150 : }
4151 :
4152 771 : if (RoofGeo.Area > 0) {
4153 722 : RoofGeo.Height /= RoofGeo.Area;
4154 722 : RoofGeo.Tilt /= RoofGeo.Area;
4155 722 : RoofGeo.Azimuth /= RoofGeo.Area;
4156 : } else {
4157 49 : RoofGeo.Height = 0.0;
4158 49 : RoofGeo.Tilt = 0.0;
4159 49 : RoofGeo.Azimuth = 0.0;
4160 : }
4161 :
4162 : // Remove the ones that are already used twice
4163 10014 : uniqEdgeOfSurfs.erase(std::remove_if(uniqEdgeOfSurfs.begin(), uniqEdgeOfSurfs.end(), [](const auto &edge) -> bool { return edge.count == 2; }),
4164 1542 : uniqEdgeOfSurfs.end());
4165 :
4166 : // Intersect with unique vertices as much as needed
4167 771 : bool insertedVertext = true;
4168 4117 : while (insertedVertext) {
4169 1673 : insertedVertext = false;
4170 :
4171 40011 : for (auto &edge : uniqEdgeOfSurfs) {
4172 :
4173 : // now go through all the vertices and see if they are colinear with start and end vertices
4174 6149088 : for (const auto &testVertex : uniqueRoofVertices) {
4175 6110750 : if (edge.containsPoints(testVertex)) {
4176 1804 : SurfaceGeometry::EdgeOfSurf newEdgeOfSurface;
4177 902 : newEdgeOfSurface.start = testVertex;
4178 902 : newEdgeOfSurface.end = edge.end;
4179 902 : edge.end = testVertex;
4180 902 : uniqEdgeOfSurfs.emplace_back(std::move(newEdgeOfSurface));
4181 902 : insertedVertext = true;
4182 902 : break;
4183 : }
4184 : }
4185 : // Break out of the loop on edges, and start again at the while
4186 39240 : if (insertedVertext) {
4187 902 : break;
4188 : }
4189 : }
4190 : }
4191 :
4192 : // recount
4193 9843 : for (auto &edge : uniqEdgeOfSurfs) {
4194 9072 : edge.count = std::count(uniqEdgeOfSurfs.begin(), uniqEdgeOfSurfs.end(), edge);
4195 : }
4196 :
4197 9843 : uniqEdgeOfSurfs.erase(std::remove_if(uniqEdgeOfSurfs.begin(), uniqEdgeOfSurfs.end(), [](const auto &edge) -> bool { return edge.count == 2; }),
4198 1542 : uniqEdgeOfSurfs.end());
4199 :
4200 771 : RoofGeo.Perimeter =
4201 8506 : std::accumulate(uniqEdgeOfSurfs.cbegin(), uniqEdgeOfSurfs.cend(), 0.0, [](const double &sum, const SurfaceGeometry::EdgeOfSurf &edge) {
4202 6964 : return sum + edge.length();
4203 6964 : });
4204 :
4205 1542 : return RoofGeo;
4206 : }
4207 :
4208 771 : void SetupAdaptiveConvectionStaticMetaData(EnergyPlusData &state)
4209 : {
4210 :
4211 : // SUBROUTINE INFORMATION:
4212 : // AUTHOR Brent Griffith
4213 : // DATE WRITTEN Aug 2010
4214 : // MODIFIED na
4215 : // RE-ENGINEERED na
4216 :
4217 : // PURPOSE OF THIS SUBROUTINE:
4218 : // do one-time setup needed to store static data
4219 : // for adaptive convection algorithm
4220 :
4221 : // Using/Aliasing
4222 :
4223 : using General::ScanForReports;
4224 : using Vectors::CreateNewellAreaVector;
4225 : using Vectors::CreateNewellSurfaceNormalVector;
4226 : using Vectors::DetermineAzimuthAndTilt;
4227 : using Vectors::VecLength;
4228 :
4229 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
4230 : Real64 BldgVolumeSum;
4231 : Real64 PerimExtLengthSum;
4232 :
4233 : Real64 thisWWR;
4234 : Real64 thisZoneSimplePerim;
4235 : Real64 thisZoneHorizHydralicDiameter;
4236 : int ExtWallCount;
4237 : int ExtWindowCount;
4238 : Real64 thisAzimuth;
4239 : Real64 thisArea;
4240 : int thisZone;
4241 : bool DoReport;
4242 :
4243 771 : auto &Zone(state.dataHeatBal->Zone);
4244 771 : auto &Surface(state.dataSurface->Surface);
4245 :
4246 771 : BldgVolumeSum = 0.0;
4247 5585 : for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) {
4248 :
4249 4814 : BldgVolumeSum += Zone(ZoneLoop).Volume * Zone(ZoneLoop).Multiplier * Zone(ZoneLoop).ListMultiplier;
4250 4814 : PerimExtLengthSum = 0.0; // init
4251 4814 : ExtWallCount = 0; // init
4252 4814 : ExtWindowCount = 0; // init
4253 : // model perimeter of bounding horizontal rectangle from max and min x and y values
4254 4814 : thisZoneSimplePerim = 2.0 * (Zone(ZoneLoop).MaximumY - Zone(ZoneLoop).MinimumY) + 2.0 * (Zone(ZoneLoop).MaximumX - Zone(ZoneLoop).MinimumX);
4255 4814 : if (thisZoneSimplePerim > 0.0) {
4256 4814 : thisZoneHorizHydralicDiameter = 4.0 * Zone(ZoneLoop).FloorArea / thisZoneSimplePerim;
4257 : } else {
4258 0 : if (Zone(ZoneLoop).FloorArea > 0.0) {
4259 0 : thisZoneHorizHydralicDiameter = std::sqrt(Zone(ZoneLoop).FloorArea);
4260 : }
4261 : }
4262 :
4263 4814 : if (Zone(ZoneLoop).ExtGrossWallArea > 0.0) {
4264 4120 : thisWWR = Zone(ZoneLoop).ExtWindowArea / Zone(ZoneLoop).ExtGrossWallArea;
4265 : } else {
4266 694 : thisWWR = -999.0; // throw error?
4267 : }
4268 9632 : for (int spaceNum : state.dataHeatBal->Zone(ZoneLoop).spaceIndexes) {
4269 4818 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
4270 : // first pass thru this zones surfaces to gather data
4271 47024 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
4272 : // first catch exterior walls and do summations
4273 42206 : if ((Surface(SurfLoop).ExtBoundCond == ExternalEnvironment) && (Surface(SurfLoop).Class == SurfaceClass::Wall)) {
4274 8470 : PerimExtLengthSum += Surface(SurfLoop).Width;
4275 8470 : ++ExtWallCount;
4276 : }
4277 65245 : if ((Surface(SurfLoop).ExtBoundCond == ExternalEnvironment) &&
4278 28198 : ((Surface(SurfLoop).Class == SurfaceClass::Window) || (Surface(SurfLoop).Class == SurfaceClass::GlassDoor))) {
4279 5960 : ++ExtWindowCount;
4280 : }
4281 : }
4282 : }
4283 9632 : for (int spaceNum : state.dataHeatBal->Zone(ZoneLoop).spaceIndexes) {
4284 4818 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
4285 : // second pass thru zone surfs to fill data
4286 47024 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
4287 : // now fill values
4288 42206 : state.dataSurface->SurfIntConvZoneWallHeight(SurfLoop) = Zone(ZoneLoop).CeilingHeight;
4289 42206 : state.dataSurface->SurfIntConvZonePerimLength(SurfLoop) = PerimExtLengthSum;
4290 42206 : state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfLoop) = thisZoneHorizHydralicDiameter;
4291 42206 : state.dataSurface->SurfIntConvWindowWallRatio(SurfLoop) = thisWWR;
4292 : } // 2nd pass over surfaces.
4293 : }
4294 :
4295 : // third pass for window locations
4296 4814 : if ((ExtWindowCount > 0) && (ExtWallCount > 0)) {
4297 5972 : for (int spaceNum : state.dataHeatBal->Zone(ZoneLoop).spaceIndexes) {
4298 2987 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
4299 30448 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
4300 45205 : if ((Surface(SurfLoop).ExtBoundCond == ExternalEnvironment) &&
4301 18214 : ((Surface(SurfLoop).Class == SurfaceClass::Window) || (Surface(SurfLoop).Class == SurfaceClass::GlassDoor))) {
4302 5758 : if (state.dataSurface->SurfIntConvWindowWallRatio(SurfLoop) < 0.5) {
4303 5240 : if (Surface(SurfLoop).Centroid.z < Zone(ZoneLoop).Centroid.z) {
4304 2334 : state.dataSurface->SurfIntConvWindowLocation(SurfLoop) = ConvectionConstants::InConvWinLoc::LowerPartOfExteriorWall;
4305 : } else {
4306 2906 : state.dataSurface->SurfIntConvWindowLocation(SurfLoop) = ConvectionConstants::InConvWinLoc::UpperPartOfExteriorWall;
4307 : }
4308 : } else {
4309 518 : state.dataSurface->SurfIntConvWindowLocation(SurfLoop) = ConvectionConstants::InConvWinLoc::LargePartOfExteriorWall;
4310 : }
4311 11514 : if ((Surface(Surface(SurfLoop).BaseSurf).ExtBoundCond == ExternalEnvironment) &&
4312 5756 : (Surface(Surface(SurfLoop).BaseSurf).Class == SurfaceClass::Wall)) {
4313 5565 : if (Surface(Surface(SurfLoop).BaseSurf).Centroid.z < Surface(SurfLoop).Centroid.z) {
4314 3041 : state.dataSurface->SurfIntConvWindowLocation(Surface(SurfLoop).BaseSurf) =
4315 : ConvectionConstants::InConvWinLoc::WindowAboveThis;
4316 : } else {
4317 2524 : state.dataSurface->SurfIntConvWindowLocation(Surface(SurfLoop).BaseSurf) =
4318 : ConvectionConstants::InConvWinLoc::WindowBelowThis;
4319 : }
4320 : }
4321 : }
4322 32401 : if ((Surface(SurfLoop).ExtBoundCond == ExternalEnvironment) && (Surface(SurfLoop).Class == SurfaceClass::Wall) &&
4323 4940 : (state.dataSurface->SurfIntConvWindowLocation(SurfLoop) == ConvectionConstants::InConvWinLoc::NotSet)) {
4324 4940 : if (Surface(SurfLoop).Centroid.z < Zone(ZoneLoop).Centroid.z) {
4325 1359 : state.dataSurface->SurfIntConvWindowLocation(SurfLoop) = ConvectionConstants::InConvWinLoc::WindowAboveThis;
4326 : } else {
4327 3581 : state.dataSurface->SurfIntConvWindowLocation(SurfLoop) = ConvectionConstants::InConvWinLoc::WindowBelowThis;
4328 : }
4329 : }
4330 : }
4331 : } // third pass over surfaces
4332 : }
4333 : } // loop over zones for inside face parameters
4334 :
4335 771 : state.dataConvectionCoefficient->CubeRootOfOverallBuildingVolume = std::pow(BldgVolumeSum, ConvectionConstants::OneThird);
4336 :
4337 771 : auto &NorthFacade = state.dataConvectionCoefficient->NorthFacade;
4338 771 : auto &NorthEastFacade = state.dataConvectionCoefficient->NorthEastFacade;
4339 771 : auto &EastFacade = state.dataConvectionCoefficient->EastFacade;
4340 771 : auto &SouthEastFacade = state.dataConvectionCoefficient->SouthEastFacade;
4341 771 : auto &SouthFacade = state.dataConvectionCoefficient->SouthFacade;
4342 771 : auto &SouthWestFacade = state.dataConvectionCoefficient->SouthWestFacade;
4343 771 : auto &WestFacade = state.dataConvectionCoefficient->WestFacade;
4344 771 : auto &NorthWestFacade = state.dataConvectionCoefficient->NorthWestFacade;
4345 :
4346 : // Calculate roof perimeter, Area, weighted-by-area average height azimuth
4347 771 : auto &RoofGeo = state.dataConvectionCoefficient->RoofGeo;
4348 771 : RoofGeo = getRoofGeometryInformation(state);
4349 771 : state.dataConvectionCoefficient->RoofLongAxisOutwardAzimuth = RoofGeo.Azimuth;
4350 :
4351 : // first pass over surfaces for outside face params
4352 44533 : for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) {
4353 43762 : if (Surface(SurfLoop).ExtBoundCond != ExternalEnvironment) {
4354 25141 : continue;
4355 : }
4356 18621 : if (!Surface(SurfLoop).HeatTransSurf) {
4357 1541 : continue;
4358 : }
4359 17080 : thisAzimuth = Surface(SurfLoop).Azimuth;
4360 17080 : thisArea = Surface(SurfLoop).Area;
4361 17080 : thisZone = Surface(SurfLoop).Zone;
4362 17080 : if ((Surface(SurfLoop).Tilt >= 45.0) && (Surface(SurfLoop).Tilt < 135.0)) { // treat as vertical wall
4363 :
4364 14429 : auto const &vertices(Surface(SurfLoop).Vertex);
4365 14429 : Real64 const x_min(minval(vertices, &Vector::x));
4366 14429 : Real64 const y_min(minval(vertices, &Vector::y));
4367 14429 : Real64 const z_min(minval(vertices, &Vector::z));
4368 14429 : Real64 const x_max(maxval(vertices, &Vector::x));
4369 14429 : Real64 const y_max(maxval(vertices, &Vector::y));
4370 14429 : Real64 const z_max(maxval(vertices, &Vector::z));
4371 :
4372 14429 : if ((thisAzimuth >= NorthFacade.AzimuthRangeLow) || (thisAzimuth < NorthFacade.AzimuthRangeHi)) {
4373 2957 : NorthFacade.Area += thisArea;
4374 2957 : NorthFacade.Zmax = max(z_max, NorthFacade.Zmax);
4375 2957 : NorthFacade.Zmin = min(z_min, NorthFacade.Zmin);
4376 2957 : NorthFacade.Ymax = max(y_max, NorthFacade.Ymax);
4377 2957 : NorthFacade.Ymin = min(y_min, NorthFacade.Ymin);
4378 2957 : NorthFacade.Xmax = max(x_max, NorthFacade.Xmax);
4379 2957 : NorthFacade.Xmin = min(x_min, NorthFacade.Xmin);
4380 :
4381 11472 : } else if ((thisAzimuth >= NorthEastFacade.AzimuthRangeLow) && (thisAzimuth < NorthEastFacade.AzimuthRangeHi)) {
4382 806 : NorthEastFacade.Area += thisArea;
4383 806 : NorthEastFacade.Zmax = max(z_max, NorthEastFacade.Zmax);
4384 806 : NorthEastFacade.Zmin = min(z_min, NorthEastFacade.Zmin);
4385 806 : NorthEastFacade.Ymax = max(y_max, NorthEastFacade.Ymax);
4386 806 : NorthEastFacade.Ymin = min(y_min, NorthEastFacade.Ymin);
4387 806 : NorthEastFacade.Xmax = max(x_max, NorthEastFacade.Xmax);
4388 806 : NorthEastFacade.Xmin = min(x_min, NorthEastFacade.Xmin);
4389 :
4390 10666 : } else if ((thisAzimuth >= EastFacade.AzimuthRangeLow) && (thisAzimuth < EastFacade.AzimuthRangeHi)) {
4391 2465 : EastFacade.Area += thisArea;
4392 2465 : EastFacade.Zmax = max(z_max, EastFacade.Zmax);
4393 2465 : EastFacade.Zmin = min(z_min, EastFacade.Zmin);
4394 2465 : EastFacade.Ymax = max(y_max, EastFacade.Ymax);
4395 2465 : EastFacade.Ymin = min(y_min, EastFacade.Ymin);
4396 2465 : EastFacade.Xmax = max(x_max, EastFacade.Xmax);
4397 2465 : EastFacade.Xmin = min(x_min, EastFacade.Xmin);
4398 8201 : } else if ((thisAzimuth >= SouthEastFacade.AzimuthRangeLow) && (thisAzimuth < SouthEastFacade.AzimuthRangeHi)) {
4399 624 : SouthEastFacade.Area += thisArea;
4400 624 : SouthEastFacade.Zmax = max(z_max, SouthEastFacade.Zmax);
4401 624 : SouthEastFacade.Zmin = min(z_min, SouthEastFacade.Zmin);
4402 624 : SouthEastFacade.Ymax = max(y_max, SouthEastFacade.Ymax);
4403 624 : SouthEastFacade.Ymin = min(y_min, SouthEastFacade.Ymin);
4404 624 : SouthEastFacade.Xmax = max(x_max, SouthEastFacade.Xmax);
4405 624 : SouthEastFacade.Xmin = min(x_min, SouthEastFacade.Xmin);
4406 :
4407 7577 : } else if ((thisAzimuth >= SouthFacade.AzimuthRangeLow) && (thisAzimuth < SouthFacade.AzimuthRangeHi)) {
4408 3645 : SouthFacade.Area += thisArea;
4409 3645 : SouthFacade.Zmax = max(z_max, SouthFacade.Zmax);
4410 3645 : SouthFacade.Zmin = min(z_min, SouthFacade.Zmin);
4411 3645 : SouthFacade.Ymax = max(y_max, SouthFacade.Ymax);
4412 3645 : SouthFacade.Ymin = min(y_min, SouthFacade.Ymin);
4413 3645 : SouthFacade.Xmax = max(x_max, SouthFacade.Xmax);
4414 3645 : SouthFacade.Xmin = min(x_min, SouthFacade.Xmin);
4415 :
4416 3932 : } else if ((thisAzimuth >= SouthWestFacade.AzimuthRangeLow) && (thisAzimuth < SouthWestFacade.AzimuthRangeHi)) {
4417 803 : SouthWestFacade.Area += thisArea;
4418 803 : SouthWestFacade.Zmax = max(z_max, SouthWestFacade.Zmax);
4419 803 : SouthWestFacade.Zmin = min(z_min, SouthWestFacade.Zmin);
4420 803 : SouthWestFacade.Ymax = max(y_max, SouthWestFacade.Ymax);
4421 803 : SouthWestFacade.Ymin = min(y_min, SouthWestFacade.Ymin);
4422 803 : SouthWestFacade.Xmax = max(x_max, SouthWestFacade.Xmax);
4423 803 : SouthWestFacade.Xmin = min(x_min, SouthWestFacade.Xmin);
4424 :
4425 3129 : } else if ((thisAzimuth >= WestFacade.AzimuthRangeLow) && (thisAzimuth < WestFacade.AzimuthRangeHi)) {
4426 2505 : WestFacade.Area += thisArea;
4427 2505 : WestFacade.Zmax = max(z_max, WestFacade.Zmax);
4428 2505 : WestFacade.Zmin = min(z_min, WestFacade.Zmin);
4429 2505 : WestFacade.Ymax = max(y_max, WestFacade.Ymax);
4430 2505 : WestFacade.Ymin = min(y_min, WestFacade.Ymin);
4431 2505 : WestFacade.Xmax = max(x_max, WestFacade.Xmax);
4432 2505 : WestFacade.Xmin = min(x_min, WestFacade.Xmin);
4433 :
4434 624 : } else if ((thisAzimuth >= NorthWestFacade.AzimuthRangeLow) && (thisAzimuth < NorthWestFacade.AzimuthRangeHi)) {
4435 624 : NorthWestFacade.Area += thisArea;
4436 624 : NorthWestFacade.Zmax = max(z_max, NorthWestFacade.Zmax);
4437 624 : NorthWestFacade.Zmin = min(z_min, NorthWestFacade.Zmin);
4438 624 : NorthWestFacade.Ymax = max(y_max, NorthWestFacade.Ymax);
4439 624 : NorthWestFacade.Ymin = min(y_min, NorthWestFacade.Ymin);
4440 624 : NorthWestFacade.Xmax = max(x_max, NorthWestFacade.Xmax);
4441 624 : NorthWestFacade.Xmin = min(x_min, NorthWestFacade.Xmin);
4442 : }
4443 : }
4444 : } // fist loop over surfaces for outside face params
4445 :
4446 1542 : NorthFacade.Perimeter = 2.0 * std::sqrt(pow_2(NorthFacade.Xmax - NorthFacade.Xmin) + pow_2(NorthFacade.Ymax - NorthFacade.Ymin)) +
4447 771 : 2.0 * (NorthFacade.Zmax - NorthFacade.Zmin);
4448 771 : NorthFacade.Height = NorthFacade.Zmax - NorthFacade.Zmin;
4449 :
4450 771 : NorthEastFacade.Perimeter =
4451 1542 : 2.0 * std::sqrt(pow_2(NorthEastFacade.Xmax - NorthEastFacade.Xmin) + pow_2(NorthEastFacade.Ymax - NorthEastFacade.Ymin)) +
4452 771 : 2.0 * (NorthEastFacade.Zmax - NorthEastFacade.Zmin);
4453 771 : NorthEastFacade.Height = NorthEastFacade.Zmax - NorthEastFacade.Zmin;
4454 :
4455 1542 : EastFacade.Perimeter = 2.0 * std::sqrt(pow_2(EastFacade.Xmax - EastFacade.Xmin) + pow_2(EastFacade.Ymax - EastFacade.Ymin)) +
4456 771 : 2.0 * (EastFacade.Zmax - EastFacade.Zmin);
4457 771 : EastFacade.Height = EastFacade.Zmax - EastFacade.Zmin;
4458 :
4459 771 : SouthEastFacade.Perimeter =
4460 1542 : 2.0 * std::sqrt(pow_2(SouthEastFacade.Xmax - SouthEastFacade.Xmin) + pow_2(SouthEastFacade.Ymax - SouthEastFacade.Ymin)) +
4461 771 : 2.0 * (SouthEastFacade.Zmax - SouthEastFacade.Zmin);
4462 771 : SouthEastFacade.Height = SouthEastFacade.Zmax - SouthEastFacade.Zmin;
4463 :
4464 1542 : SouthFacade.Perimeter = 2.0 * std::sqrt(pow_2(SouthFacade.Xmax - SouthFacade.Xmin) + pow_2(SouthFacade.Ymax - SouthFacade.Ymin)) +
4465 771 : 2.0 * (SouthFacade.Zmax - SouthFacade.Zmin);
4466 771 : SouthFacade.Height = SouthFacade.Zmax - SouthFacade.Zmin;
4467 :
4468 771 : SouthWestFacade.Perimeter =
4469 1542 : 2.0 * std::sqrt(pow_2(SouthWestFacade.Xmax - SouthWestFacade.Xmin) + pow_2(SouthWestFacade.Ymax - SouthWestFacade.Ymin)) +
4470 771 : 2.0 * (SouthWestFacade.Zmax - SouthWestFacade.Zmin);
4471 771 : SouthWestFacade.Height = SouthWestFacade.Zmax - SouthWestFacade.Zmin;
4472 :
4473 1542 : WestFacade.Perimeter = 2.0 * std::sqrt(pow_2(WestFacade.Xmax - WestFacade.Xmin) + pow_2(WestFacade.Ymax - WestFacade.Ymin)) +
4474 771 : 2.0 * (WestFacade.Zmax - WestFacade.Zmin);
4475 771 : WestFacade.Height = WestFacade.Zmax - WestFacade.Zmin;
4476 :
4477 771 : NorthWestFacade.Perimeter =
4478 1542 : 2.0 * std::sqrt(pow_2(NorthWestFacade.Xmax - NorthWestFacade.Xmin) + pow_2(NorthWestFacade.Ymax - NorthWestFacade.Ymin)) +
4479 771 : 2.0 * (NorthWestFacade.Zmax - NorthWestFacade.Zmin);
4480 771 : NorthWestFacade.Height = NorthWestFacade.Zmax - NorthWestFacade.Zmin;
4481 :
4482 44533 : for (int SurfLoop = 1; SurfLoop <= state.dataSurface->TotSurfaces; ++SurfLoop) {
4483 43762 : if (Surface(SurfLoop).ExtBoundCond != ExternalEnvironment) continue;
4484 18621 : if (!Surface(SurfLoop).HeatTransSurf) continue;
4485 17080 : thisAzimuth = Surface(SurfLoop).Azimuth;
4486 :
4487 17080 : auto const &vertices(Surface(SurfLoop).Vertex);
4488 17080 : Real64 const z_min(minval(vertices, &Vector::z));
4489 17080 : Real64 const z_max(maxval(vertices, &Vector::z));
4490 17080 : Real64 const z_del(z_max - z_min);
4491 :
4492 17080 : if ((Surface(SurfLoop).Tilt >= 45.0) && (Surface(SurfLoop).Tilt < 135.0)) { // treat as vertical wall
4493 14429 : if ((thisAzimuth >= NorthFacade.AzimuthRangeLow) || (thisAzimuth < NorthFacade.AzimuthRangeHi)) {
4494 2957 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(NorthFacade.Area, Surface(SurfLoop).GrossArea);
4495 2957 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(NorthFacade.Perimeter, Surface(SurfLoop).Perimeter);
4496 2957 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(NorthFacade.Height, z_del);
4497 11472 : } else if ((thisAzimuth >= NorthEastFacade.AzimuthRangeLow) && (thisAzimuth < NorthEastFacade.AzimuthRangeHi)) {
4498 806 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(NorthEastFacade.Area, Surface(SurfLoop).GrossArea);
4499 806 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(NorthEastFacade.Perimeter, Surface(SurfLoop).Perimeter);
4500 806 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(NorthEastFacade.Height, z_del);
4501 10666 : } else if ((thisAzimuth >= EastFacade.AzimuthRangeLow) && (thisAzimuth < EastFacade.AzimuthRangeHi)) {
4502 2465 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(EastFacade.Area, Surface(SurfLoop).GrossArea);
4503 2465 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(EastFacade.Perimeter, Surface(SurfLoop).Perimeter);
4504 2465 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(EastFacade.Height, z_del);
4505 8201 : } else if ((thisAzimuth >= SouthEastFacade.AzimuthRangeLow) && (thisAzimuth < SouthEastFacade.AzimuthRangeHi)) {
4506 624 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(SouthEastFacade.Area, Surface(SurfLoop).GrossArea);
4507 624 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(SouthEastFacade.Perimeter, Surface(SurfLoop).Perimeter);
4508 624 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(SouthEastFacade.Height, z_del);
4509 7577 : } else if ((thisAzimuth >= SouthFacade.AzimuthRangeLow) && (thisAzimuth < SouthFacade.AzimuthRangeHi)) {
4510 3645 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(SouthFacade.Area, Surface(SurfLoop).GrossArea);
4511 3645 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(SouthFacade.Perimeter, Surface(SurfLoop).Perimeter);
4512 3645 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(SouthFacade.Height, z_del);
4513 3932 : } else if ((thisAzimuth >= SouthWestFacade.AzimuthRangeLow) && (thisAzimuth < SouthWestFacade.AzimuthRangeHi)) {
4514 803 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(SouthWestFacade.Area, Surface(SurfLoop).GrossArea);
4515 803 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(SouthWestFacade.Perimeter, Surface(SurfLoop).Perimeter);
4516 803 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(SouthWestFacade.Height, z_del);
4517 3129 : } else if ((thisAzimuth >= WestFacade.AzimuthRangeLow) && (thisAzimuth < WestFacade.AzimuthRangeHi)) {
4518 2505 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(WestFacade.Area, Surface(SurfLoop).GrossArea);
4519 2505 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(WestFacade.Perimeter, Surface(SurfLoop).Perimeter);
4520 2505 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(WestFacade.Height, z_del);
4521 624 : } else if ((thisAzimuth >= NorthWestFacade.AzimuthRangeLow) && (thisAzimuth < NorthWestFacade.AzimuthRangeHi)) {
4522 624 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(NorthWestFacade.Area, Surface(SurfLoop).GrossArea);
4523 624 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(NorthWestFacade.Perimeter, Surface(SurfLoop).Perimeter);
4524 624 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(NorthWestFacade.Height, z_del);
4525 : }
4526 2651 : } else if (Surface(SurfLoop).Tilt < 45.0) { // assume part of roof
4527 2540 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = max(RoofGeo.Area, Surface(SurfLoop).GrossArea);
4528 2540 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = max(RoofGeo.Perimeter, Surface(SurfLoop).Perimeter);
4529 2540 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = max(RoofGeo.Height, z_del);
4530 111 : } else if (Surface(SurfLoop).Tilt >= 135.0) { // assume floor over exterior, just use surface's geometry
4531 111 : state.dataSurface->SurfOutConvFaceArea(SurfLoop) = Surface(SurfLoop).GrossArea;
4532 111 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop) = Surface(SurfLoop).Perimeter;
4533 111 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop) = z_del;
4534 : }
4535 : } // second pass thru surfs for outside face convection params.
4536 :
4537 : // now send to EIO if surface reporting selected
4538 771 : ScanForReports(state, "Surfaces", DoReport, "Details");
4539 771 : if (DoReport) { // echo out static geometry data related to convection models
4540 : static constexpr std::string_view Format_900("! <Surface Convection Parameters>, Surface Name, Outside Model Assignment, Outside "
4541 : "Area [m2], Outside Perimeter [m], Outside Height "
4542 : "[m], Inside Model Assignment, Inside Height [m], Inside Perimeter Envelope [m], Inside "
4543 : "Hydraulic Diameter [m], Window Wall Ratio, "
4544 : "Window Location, Near Radiant {{Yes/No}}, Has Active HVAC {{Yes/No}}\n");
4545 140 : print(state.files.eio, Format_900); // header
4546 21991 : for (int SurfLoop : state.dataSurface->AllSurfaceListReportOrder) {
4547 21851 : if (!Surface(SurfLoop).HeatTransSurf) {
4548 371 : continue;
4549 : }
4550 :
4551 : static constexpr std::string_view Format_901(
4552 : "Surface Convection Parameters,{},{},{:.2R},{:.2R},{:.2R},{},{:.2R},{:.2R},{:.2R},{:.2R},{},{},{}\n");
4553 236280 : print(state.files.eio,
4554 : Format_901,
4555 21480 : Surface(SurfLoop).Name,
4556 21480 : state.dataSurface->SurfExtConvCoeffIndex(SurfLoop),
4557 21480 : state.dataSurface->SurfOutConvFaceArea(SurfLoop),
4558 21480 : state.dataSurface->SurfOutConvFacePerimeter(SurfLoop),
4559 21480 : state.dataSurface->SurfOutConvFaceHeight(SurfLoop),
4560 21480 : state.dataSurface->SurfIntConvCoeffIndex(SurfLoop),
4561 21480 : state.dataSurface->SurfIntConvZoneWallHeight(SurfLoop),
4562 21480 : state.dataSurface->SurfIntConvZonePerimLength(SurfLoop),
4563 21480 : state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfLoop),
4564 21480 : state.dataSurface->SurfIntConvWindowWallRatio(SurfLoop),
4565 21480 : state.dataSurface->SurfIntConvWindowLocation(SurfLoop),
4566 42960 : state.dataSurface->SurfIntConvSurfGetsRadiantHeat(SurfLoop) ? "Yes" : "No",
4567 42960 : state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfLoop) ? "Yes" : "No");
4568 :
4569 : // [m] length of perimeter zone's exterior wall | [m] hydraulic diameter, usually 4 times the zone floor area div by
4570 : // perimeter | [-] area of windows over area of exterior wall for zone | relative location of window in zone for
4571 : // interior Hc models
4572 : }
4573 :
4574 : // if display advanced reports also dump meta group data used for convection geometry
4575 140 : if (state.dataGlobal->DisplayAdvancedReportVariables) {
4576 : static constexpr std::string_view Format_8000(
4577 : "! <Building Convection Parameters:North Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4578 2 : print(state.files.eio, Format_8000); // header for north facade
4579 : static constexpr std::string_view Format_8001(
4580 : "Building Convection Parameters:North Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4581 2 : print(state.files.eio,
4582 : Format_8001,
4583 : NorthFacade.Perimeter,
4584 : NorthFacade.Height,
4585 : NorthFacade.Xmin,
4586 : NorthFacade.Xmax,
4587 : NorthFacade.Ymin,
4588 : NorthFacade.Ymax,
4589 : NorthFacade.Zmin,
4590 : NorthFacade.Zmax);
4591 : static constexpr std::string_view Format_8100(
4592 : "! <Building Convection Parameters:Northeast Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4593 2 : print(state.files.eio, Format_8100); // header for northeast facade
4594 : static constexpr std::string_view Format_8101(
4595 : "Building Convection Parameters:Northeast Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4596 2 : print(state.files.eio,
4597 : Format_8101,
4598 : NorthEastFacade.Perimeter,
4599 : NorthEastFacade.Height,
4600 : NorthEastFacade.Xmin,
4601 : NorthEastFacade.Xmax,
4602 : NorthEastFacade.Ymin,
4603 : NorthEastFacade.Ymax,
4604 : NorthEastFacade.Zmin,
4605 : NorthEastFacade.Zmax);
4606 : static constexpr std::string_view Format_8200(
4607 : "! <Building Convection Parameters:East Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4608 2 : print(state.files.eio, Format_8200); // header for east facade
4609 : static constexpr std::string_view Format_8201(
4610 : "Building Convection Parameters:East Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4611 2 : print(state.files.eio,
4612 : Format_8201,
4613 : EastFacade.Perimeter,
4614 : EastFacade.Height,
4615 : EastFacade.Xmin,
4616 : EastFacade.Xmax,
4617 : EastFacade.Ymin,
4618 : EastFacade.Ymax,
4619 : EastFacade.Zmin,
4620 : EastFacade.Zmax);
4621 :
4622 : static constexpr std::string_view Format_8300(
4623 : "! <Building Convection Parameters:Southeast Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4624 2 : print(state.files.eio, Format_8300); // header for southeast facade
4625 : static constexpr std::string_view Format_8301(
4626 : "Building Convection Parameters:Southeast Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4627 2 : print(state.files.eio,
4628 : Format_8301,
4629 : SouthEastFacade.Perimeter,
4630 : SouthEastFacade.Height,
4631 : SouthEastFacade.Xmin,
4632 : SouthEastFacade.Xmax,
4633 : SouthEastFacade.Ymin,
4634 : SouthEastFacade.Ymax,
4635 : SouthEastFacade.Zmin,
4636 : SouthEastFacade.Zmax);
4637 :
4638 : static constexpr std::string_view Format_8400(
4639 : "! <Building Convection Parameters:South Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4640 2 : print(state.files.eio, Format_8400); // header for south facade
4641 : static constexpr std::string_view Format_8401(
4642 : "Building Convection Parameters:South Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4643 2 : print(state.files.eio,
4644 : Format_8401,
4645 : SouthFacade.Perimeter,
4646 : SouthFacade.Height,
4647 : SouthFacade.Xmin,
4648 : SouthFacade.Xmax,
4649 : SouthFacade.Ymin,
4650 : SouthFacade.Ymax,
4651 : SouthFacade.Zmin,
4652 : SouthFacade.Zmax);
4653 : static constexpr std::string_view Format_8500(
4654 : "! <Building Convection Parameters:Southwest Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4655 2 : print(state.files.eio, Format_8500); // header for southwest facade
4656 : static constexpr std::string_view Format_8501(
4657 : "Building Convection Parameters:Southwest Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4658 2 : print(state.files.eio,
4659 : Format_8501,
4660 : SouthWestFacade.Perimeter,
4661 : SouthWestFacade.Height,
4662 : SouthWestFacade.Xmin,
4663 : SouthWestFacade.Xmax,
4664 : SouthWestFacade.Ymin,
4665 : SouthWestFacade.Ymax,
4666 : SouthWestFacade.Zmin,
4667 : SouthWestFacade.Zmax);
4668 : static constexpr std::string_view Format_8600(
4669 : "! <Building Convection Parameters:West Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4670 2 : print(state.files.eio, Format_8600); // header for west facade
4671 : static constexpr std::string_view Format_8601(
4672 : "Building Convection Parameters:West Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4673 2 : print(state.files.eio,
4674 : Format_8601,
4675 : WestFacade.Perimeter,
4676 : WestFacade.Height,
4677 : WestFacade.Xmin,
4678 : WestFacade.Xmax,
4679 : WestFacade.Ymin,
4680 : WestFacade.Ymax,
4681 : WestFacade.Zmin,
4682 : WestFacade.Zmax);
4683 : static constexpr std::string_view Format_8700(
4684 : "! <Building Convection Parameters:Northwest Facade>, Perimeter, Height, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax \n");
4685 2 : print(state.files.eio, Format_8700); // header for northwest facade
4686 : static constexpr std::string_view Format_8701(
4687 : "Building Convection Parameters:NorthwWest Facade, {:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}\n");
4688 2 : print(state.files.eio,
4689 : Format_8701,
4690 : NorthWestFacade.Perimeter,
4691 : NorthWestFacade.Height,
4692 : NorthWestFacade.Xmin,
4693 : NorthWestFacade.Xmax,
4694 : NorthWestFacade.Ymin,
4695 : NorthWestFacade.Ymax,
4696 : NorthWestFacade.Zmin,
4697 : NorthWestFacade.Zmax);
4698 : static constexpr std::string_view Format_8800(
4699 : "! <Building Convection Parameters:Roof>, Area [m2], Perimeter [m], Height [m], Tilt [deg], Azimuth [deg]\n");
4700 2 : print(state.files.eio, Format_8800); // header for roof
4701 : static constexpr std::string_view Format_8801("Building Convection Parameters:Roof,{:.2R},{:.2R},{:.2R},{:.2R},{:.2R}");
4702 2 : print(state.files.eio, Format_8801, RoofGeo.Area, RoofGeo.Perimeter, RoofGeo.Height, RoofGeo.Tilt, RoofGeo.Azimuth);
4703 : }
4704 : }
4705 771 : }
4706 :
4707 769 : void SetupAdaptiveConvectionRadiantSurfaceData(EnergyPlusData &state)
4708 : {
4709 :
4710 : // SUBROUTINE INFORMATION:
4711 : // AUTHOR Brent Griffith
4712 : // DATE WRITTEN Sept 2011
4713 : // MODIFIED na
4714 : // RE-ENGINEERED na
4715 :
4716 : // PURPOSE OF THIS SUBROUTINE:
4717 : // identify Zones that have active radiant elements for convection model classifications
4718 :
4719 : // METHODOLOGY EMPLOYED:
4720 : // Need to fill in values for ZoneEquipConfig%InWallActiveElement, ZoneEquipConfig%InCeilingActiveElement
4721 : // and ZoneEquipConfig(ZoneNum)%InFloorActiveElement.
4722 :
4723 : // Using/Aliasing
4724 : using namespace DataZoneEquipment;
4725 :
4726 769 : auto &Surface(state.dataSurface->Surface);
4727 :
4728 5571 : for (int ZoneLoop = 1; ZoneLoop <= state.dataGlobal->NumOfZones; ++ZoneLoop) {
4729 4802 : state.dataConvectionCoefficient->ActiveWallCount = 0;
4730 4802 : state.dataConvectionCoefficient->ActiveWallArea = 0.0;
4731 4802 : state.dataConvectionCoefficient->ActiveCeilingCount = 0;
4732 4802 : state.dataConvectionCoefficient->ActiveCeilingArea = 0.0;
4733 4802 : state.dataConvectionCoefficient->ActiveFloorCount = 0;
4734 4802 : state.dataConvectionCoefficient->ActiveFloorArea = 0.0;
4735 :
4736 9608 : for (int spaceNum : state.dataHeatBal->Zone(ZoneLoop).spaceIndexes) {
4737 4806 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
4738 46874 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
4739 42068 : if (!state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfLoop)) continue;
4740 95 : if (Surface(SurfLoop).Class == SurfaceClass::Wall || Surface(SurfLoop).Class == SurfaceClass::Door) {
4741 9 : ++state.dataConvectionCoefficient->ActiveWallCount;
4742 9 : state.dataConvectionCoefficient->ActiveWallArea += Surface(SurfLoop).Area;
4743 86 : } else if (Surface(SurfLoop).Class == SurfaceClass::Roof) {
4744 10 : ++state.dataConvectionCoefficient->ActiveCeilingCount;
4745 10 : state.dataConvectionCoefficient->ActiveCeilingArea += Surface(SurfLoop).Area;
4746 76 : } else if (Surface(SurfLoop).Class == SurfaceClass::Floor) {
4747 76 : ++state.dataConvectionCoefficient->ActiveFloorCount;
4748 76 : state.dataConvectionCoefficient->ActiveFloorArea += Surface(SurfLoop).Area;
4749 : }
4750 : }
4751 : } // surface loop
4752 :
4753 4802 : if ((state.dataConvectionCoefficient->ActiveWallCount > 0) && (state.dataConvectionCoefficient->ActiveWallArea > 0.0)) {
4754 2 : state.dataZoneEquip->ZoneEquipConfig(ZoneLoop).InWallActiveElement = true;
4755 : }
4756 4802 : if ((state.dataConvectionCoefficient->ActiveCeilingCount > 0) && (state.dataConvectionCoefficient->ActiveCeilingArea > 0.0)) {
4757 10 : state.dataZoneEquip->ZoneEquipConfig(ZoneLoop).InCeilingActiveElement = true;
4758 : }
4759 4802 : if ((state.dataConvectionCoefficient->ActiveFloorCount > 0) && (state.dataConvectionCoefficient->ActiveFloorArea > 0)) {
4760 76 : state.dataZoneEquip->ZoneEquipConfig(ZoneLoop).InFloorActiveElement = true;
4761 : }
4762 : } // zone loop
4763 769 : }
4764 :
4765 567084 : void ManageInsideAdaptiveConvectionAlgo(EnergyPlusData &state,
4766 : int const SurfNum) // surface number for which coefficients are being calculated
4767 : {
4768 :
4769 : // SUBROUTINE INFORMATION:
4770 : // AUTHOR Brent Griffith
4771 : // DATE WRITTEN Aug 2010
4772 : // MODIFIED na
4773 : // RE-ENGINEERED na
4774 :
4775 : // PURPOSE OF THIS SUBROUTINE:
4776 : // This subroutine manages the calculation of interior convection coefficient for a surface.
4777 :
4778 : // METHODOLOGY EMPLOYED:
4779 : // This routine implements the Adaptive Convection Algorithm developed by IB-M 2000 and IB-M 2002
4780 : // - first calls a large routine, DynamicIntConvSurfaceClassification, that has most of the complex logic
4781 : // - then calls a straightforward routine that maps the classification to model equation
4782 : // - then calls a routine with a large case statement that calls model equations.
4783 :
4784 : // USE STATEMENTS:
4785 :
4786 : // this next call sets up the flow regime and assigns a classification to surface
4787 : // TODO: candidate for rework to do zone level calcs once rather than for each surface
4788 567084 : DynamicIntConvSurfaceClassification(state, SurfNum);
4789 :
4790 : // simple worker routine takes surface classification and fills in model to use (IntConvHcModelEq) for that surface
4791 567084 : MapIntConvClassificationToHcModels(state, SurfNum);
4792 :
4793 567084 : EvaluateIntHcModels(state, SurfNum, state.dataSurface->SurfIntConvHcModelEq(SurfNum), state.dataHeatBalSurf->SurfHConvInt(SurfNum));
4794 567084 : }
4795 :
4796 311205 : void ManageOutsideAdaptiveConvectionAlgo(EnergyPlusData &state,
4797 : int const SurfNum, // surface number for which coefficients are being calculated
4798 : Real64 &Hc // result for Hc Outside face, becomes HExt.
4799 : )
4800 : {
4801 :
4802 : // SUBROUTINE INFORMATION:
4803 : // AUTHOR Brent Griffith
4804 : // DATE WRITTEN Aug 2010
4805 : // MODIFIED na
4806 : // RE-ENGINEERED na
4807 :
4808 : // PURPOSE OF THIS SUBROUTINE:
4809 : // This subroutine calculates the convection coefficient for the outside face of a surface
4810 :
4811 : // METHODOLOGY EMPLOYED:
4812 : // This routine implements an adaptive structure and classification system for outdoor
4813 : // It calls a series of separable worker routines
4814 :
4815 311205 : DynamicExtConvSurfaceClassification(state, SurfNum);
4816 :
4817 311205 : MapExtConvClassificationToHcModels(state, SurfNum);
4818 :
4819 311205 : EvaluateExtHcModels(state, SurfNum, state.dataSurface->SurfOutConvHnModelEq(SurfNum), state.dataSurface->SurfOutConvHfModelEq(SurfNum), Hc);
4820 311205 : }
4821 :
4822 567084 : void EvaluateIntHcModels(EnergyPlusData &state,
4823 : int const SurfNum,
4824 : int const ConvModelEquationNum,
4825 : Real64 &Hc // calculated Hc value
4826 : )
4827 : {
4828 :
4829 : // SUBROUTINE INFORMATION:
4830 : // AUTHOR Brent Griffith
4831 : // DATE WRITTEN Aug 2010
4832 :
4833 : // PURPOSE OF THIS SUBROUTINE:
4834 : // central case statement for calling inside convection models
4835 :
4836 : // METHODOLOGY EMPLOYED:
4837 : // - fills value for Hc by calling the appropriate convection model, usually as a function.
4838 : // preparation of argument values for the function calls is contained in each Case block (repeats)
4839 : // - also updates the reference air temperature type for use in the surface heat balance calcs
4840 :
4841 567084 : Real64 tmpHc = 0.0;
4842 :
4843 567084 : auto const &thisSurface = state.dataSurface->Surface(SurfNum);
4844 567084 : int const ZoneNum = thisSurface.Zone;
4845 567084 : Real64 const Tsurface = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum);
4846 567084 : Real64 const Tzone = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
4847 :
4848 567084 : auto &HnFn = state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in;
4849 : // now call appropriate function to calculate Hc
4850 567084 : switch (ConvModelEquationNum) {
4851 :
4852 0 : case ConvectionConstants::HcInt_UserCurve:
4853 0 : CalcUserDefinedInsideHcModel(state, SurfNum, state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum), tmpHc);
4854 0 : break;
4855 0 : case ConvectionConstants::HcInt_ASHRAEVerticalWall:
4856 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4857 0 : HnFn = [](double Tsurf, double Tamb, double, double, double) -> double { return CalcASHRAEVerticalWall(Tsurf - Tamb); };
4858 : } else {
4859 0 : tmpHc = CalcASHRAEVerticalWall((Tsurface - Tzone));
4860 : }
4861 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4862 0 : break;
4863 24921 : case ConvectionConstants::HcInt_WaltonUnstableHorizontalOrTilt:
4864 24921 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4865 0 : HnFn = [](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
4866 0 : return CalcWaltonUnstableHorizontalOrTilt(Tsurf - Tamb, cosTilt);
4867 0 : };
4868 : } else {
4869 24921 : tmpHc = CalcWaltonUnstableHorizontalOrTilt((Tsurface - Tzone), thisSurface.CosTilt); // TODO verify CosTilt in vs out
4870 : }
4871 24921 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4872 24921 : break;
4873 7479 : case ConvectionConstants::HcInt_WaltonStableHorizontalOrTilt:
4874 7479 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4875 0 : HnFn = [](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
4876 0 : return CalcWaltonStableHorizontalOrTilt(Tsurf - Tamb, cosTilt);
4877 0 : };
4878 : } else {
4879 7479 : tmpHc = CalcWaltonStableHorizontalOrTilt((Tsurface - Tzone), thisSurface.CosTilt); // TODO verify CosTilt in vs out
4880 : }
4881 7479 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4882 7479 : break;
4883 0 : case ConvectionConstants::HcInt_FisherPedersenCeilDiffuserFloor: {
4884 0 : Real64 AirChangeRate = CalcCeilingDiffuserACH(state, ZoneNum);
4885 0 : Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg;
4886 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4887 :
4888 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
4889 0 : return CalcFisherPedersenCeilDiffuserFloor(state, AirChangeRate, Tsurf, Tamb, cosTilt, AirHumRat, thisSurface.Height);
4890 0 : };
4891 : } else {
4892 0 : tmpHc = CalcFisherPedersenCeilDiffuserFloor(state,
4893 : AirChangeRate,
4894 : Tsurface,
4895 : Tzone,
4896 0 : thisSurface.CosTilt,
4897 : AirHumRat,
4898 0 : thisSurface.Height,
4899 0 : state.dataConstruction->Construct(thisSurface.Construction).TypeIsWindow);
4900 : }
4901 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4902 0 : break;
4903 : }
4904 0 : case ConvectionConstants::HcInt_FisherPedersenCeilDiffuserCeiling: {
4905 0 : Real64 AirChangeRate = CalcCeilingDiffuserACH(state, ZoneNum);
4906 0 : Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg;
4907 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4908 :
4909 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
4910 0 : return CalcFisherPedersenCeilDiffuserCeiling(state, AirChangeRate, Tsurf, Tamb, cosTilt, AirHumRat, thisSurface.Height);
4911 0 : };
4912 : } else {
4913 0 : tmpHc = CalcFisherPedersenCeilDiffuserCeiling(state,
4914 : AirChangeRate,
4915 : Tsurface,
4916 : Tzone,
4917 0 : thisSurface.CosTilt,
4918 : AirHumRat,
4919 0 : thisSurface.Height,
4920 0 : state.dataConstruction->Construct(thisSurface.Construction).TypeIsWindow);
4921 : }
4922 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4923 0 : break;
4924 : }
4925 0 : case ConvectionConstants::HcInt_FisherPedersenCeilDiffuserWalls: {
4926 0 : Real64 AirChangeRate = CalcCeilingDiffuserACH(state, ZoneNum);
4927 0 : Real64 AirHumRat = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).ZoneAirHumRatAvg;
4928 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4929 :
4930 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
4931 0 : return CalcFisherPedersenCeilDiffuserWalls(state, AirChangeRate, Tsurf, Tamb, cosTilt, AirHumRat, thisSurface.Height);
4932 0 : };
4933 : } else {
4934 0 : tmpHc = CalcFisherPedersenCeilDiffuserWalls(state,
4935 : AirChangeRate,
4936 : Tsurface,
4937 : Tzone,
4938 0 : thisSurface.CosTilt,
4939 : AirHumRat,
4940 0 : thisSurface.Height,
4941 0 : state.dataConstruction->Construct(thisSurface.Construction).TypeIsWindow);
4942 : }
4943 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4944 0 : HnFn = [=](double, double, double, double, double) -> double { return tmpHc; };
4945 : }
4946 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4947 0 : break;
4948 : }
4949 77852 : case ConvectionConstants::HcInt_AlamdariHammondStableHorizontal:
4950 77852 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4951 3593 : Real64 HorizHydrDiam = state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum);
4952 11529 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double {
4953 7936 : return CalcAlamdariHammondStableHorizontal(Tsurf - Tamb, HorizHydrDiam);
4954 7186 : };
4955 : } else {
4956 74259 : tmpHc = CalcAlamdariHammondStableHorizontal(state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum), SurfNum);
4957 : }
4958 77852 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4959 77852 : break;
4960 0 : case ConvectionConstants::HcInt_AlamdariHammondVerticalWall:
4961 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4962 0 : Real64 WallHeight = state.dataSurface->SurfIntConvZoneWallHeight(SurfNum);
4963 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double {
4964 0 : return CalcAlamdariHammondVerticalWall(Tsurf - Tamb, WallHeight);
4965 0 : };
4966 : } else {
4967 0 : tmpHc = CalcAlamdariHammondVerticalWall(state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneWallHeight(SurfNum), SurfNum);
4968 : }
4969 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4970 0 : break;
4971 121976 : case ConvectionConstants::HcInt_AlamdariHammondUnstableHorizontal:
4972 121976 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4973 18014 : Real64 HorizHydrDiam = state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum);
4974 32966 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double {
4975 14952 : return CalcAlamdariHammondStableHorizontal(Tsurf - Tamb, HorizHydrDiam);
4976 36028 : };
4977 : } else {
4978 103962 : tmpHc =
4979 103962 : CalcAlamdariHammondUnstableHorizontal(state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum), SurfNum);
4980 : }
4981 121976 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4982 121976 : break;
4983 0 : case ConvectionConstants::HcInt_KhalifaEq3WallAwayFromHeat:
4984 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4985 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcKhalifaEq3WallAwayFromHeat(Tsurf - Tamb); };
4986 : } else {
4987 0 : tmpHc = CalcKhalifaEq3WallAwayFromHeat((Tsurface - Tzone));
4988 : }
4989 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4990 0 : break;
4991 0 : case ConvectionConstants::HcInt_KhalifaEq4CeilingAwayFromHeat:
4992 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
4993 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcKhalifaEq4CeilingAwayFromHeat(Tsurf - Tamb); };
4994 : } else {
4995 0 : tmpHc = CalcKhalifaEq4CeilingAwayFromHeat((Tsurface - Tzone));
4996 : }
4997 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
4998 0 : break;
4999 0 : case ConvectionConstants::HcInt_KhalifaEq5WallNearHeat:
5000 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5001 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcKhalifaEq5WallsNearHeat(Tsurf - Tamb); };
5002 : } else {
5003 0 : tmpHc = CalcKhalifaEq5WallsNearHeat((Tsurface - Tzone));
5004 : }
5005 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5006 0 : break;
5007 0 : case ConvectionConstants::HcInt_KhalifaEq6NonHeatedWalls:
5008 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5009 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcKhalifaEq6NonHeatedWalls(Tsurf - Tamb); };
5010 : } else {
5011 0 : tmpHc = CalcKhalifaEq6NonHeatedWalls((Tsurface - Tzone));
5012 : }
5013 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5014 0 : break;
5015 0 : case ConvectionConstants::HcInt_KhalifaEq7Ceiling:
5016 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5017 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcKhalifaEq7Ceiling(Tsurf - Tamb); };
5018 : } else {
5019 0 : tmpHc = CalcKhalifaEq7Ceiling((Tsurface - Tzone));
5020 : }
5021 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5022 0 : break;
5023 0 : case ConvectionConstants::HcInt_AwbiHattonHeatedFloor:
5024 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5025 0 : Real64 HorizHydrDiam = state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum);
5026 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double {
5027 0 : return CalcAwbiHattonHeatedFloor(Tsurf - Tamb, HorizHydrDiam);
5028 0 : };
5029 : } else {
5030 0 : tmpHc = CalcAwbiHattonHeatedFloor((Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum));
5031 : }
5032 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5033 0 : break;
5034 0 : case ConvectionConstants::HcInt_AwbiHattonHeatedWall:
5035 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5036 0 : Real64 HorizHydrDiam = state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum);
5037 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcAwbiHattonHeatedWall(Tsurf - Tamb, HorizHydrDiam); };
5038 : } else {
5039 0 : tmpHc = CalcAwbiHattonHeatedWall((Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum));
5040 : }
5041 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5042 0 : break;
5043 0 : case ConvectionConstants::HcInt_BeausoleilMorrisonMixedAssistingWall:
5044 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5045 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
5046 0 : return CalcBeausoleilMorrisonMixedAssistedWall(Tsurf - Tamb,
5047 0 : state.dataSurface->SurfIntConvZoneWallHeight(SurfNum),
5048 : Tsurf,
5049 0 : CalcZoneSupplyAirTemp(state, ZoneNum),
5050 0 : CalcZoneSystemACH(state, ZoneNum));
5051 0 : };
5052 : } else {
5053 0 : tmpHc = CalcBeausoleilMorrisonMixedAssistedWall(
5054 0 : state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneWallHeight(SurfNum), Tsurface, ZoneNum);
5055 : }
5056 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5057 0 : break;
5058 0 : case ConvectionConstants::HcInt_BeausoleilMorrisonMixedOppossingWall:
5059 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5060 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
5061 0 : return CalcBeausoleilMorrisonMixedOpposingWall(Tsurf - Tamb,
5062 0 : state.dataSurface->SurfIntConvZoneWallHeight(SurfNum),
5063 : Tsurf,
5064 0 : CalcZoneSupplyAirTemp(state, ZoneNum),
5065 0 : CalcZoneSystemACH(state, ZoneNum));
5066 0 : };
5067 : } else {
5068 0 : tmpHc = CalcBeausoleilMorrisonMixedOpposingWall(
5069 0 : state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneWallHeight(SurfNum), Tsurface, ZoneNum);
5070 : }
5071 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5072 0 : break;
5073 0 : case ConvectionConstants::HcInt_BeausoleilMorrisonMixedStableCeiling:
5074 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5075 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
5076 0 : return CalcBeausoleilMorrisonMixedStableCeiling(Tsurf - Tamb,
5077 0 : state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum),
5078 : Tsurf,
5079 0 : CalcZoneSupplyAirTemp(state, ZoneNum),
5080 0 : CalcZoneSystemACH(state, ZoneNum));
5081 0 : };
5082 : } else {
5083 0 : tmpHc = CalcBeausoleilMorrisonMixedStableCeiling(
5084 0 : state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum), Tsurface, ZoneNum);
5085 : }
5086 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5087 0 : break;
5088 0 : case ConvectionConstants::HcInt_BeausoleilMorrisonMixedUnstableCeiling:
5089 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5090 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
5091 0 : return CalcBeausoleilMorrisonMixedUnstableCeiling(Tsurf - Tamb,
5092 0 : state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum),
5093 : Tsurf,
5094 0 : CalcZoneSupplyAirTemp(state, ZoneNum),
5095 0 : CalcZoneSystemACH(state, ZoneNum));
5096 0 : };
5097 : } else {
5098 0 : tmpHc = CalcBeausoleilMorrisonMixedUnstableCeiling(
5099 0 : state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum), Tsurface, ZoneNum);
5100 : }
5101 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5102 0 : break;
5103 0 : case ConvectionConstants::HcInt_BeausoleilMorrisonMixedStableFloor:
5104 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5105 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
5106 0 : return CalcBeausoleilMorrisonMixedStableFloor(Tsurf - Tamb,
5107 0 : state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum),
5108 : Tsurf,
5109 0 : CalcZoneSupplyAirTemp(state, ZoneNum),
5110 0 : CalcZoneSystemACH(state, ZoneNum));
5111 0 : };
5112 : } else {
5113 0 : tmpHc = CalcBeausoleilMorrisonMixedStableFloor(
5114 0 : state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum), Tsurface, ZoneNum);
5115 : }
5116 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5117 0 : break;
5118 0 : case ConvectionConstants::HcInt_BeausoleilMorrisonMixedUnstableFloor:
5119 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5120 0 : HnFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
5121 0 : return CalcBeausoleilMorrisonMixedUnstableFloor(Tsurf - Tamb,
5122 0 : state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum),
5123 : Tsurf,
5124 0 : CalcZoneSupplyAirTemp(state, ZoneNum),
5125 0 : CalcZoneSystemACH(state, ZoneNum));
5126 0 : };
5127 : } else {
5128 0 : tmpHc = CalcBeausoleilMorrisonMixedUnstableFloor(
5129 0 : state, (Tsurface - Tzone), state.dataSurface->SurfIntConvZoneHorizHydrDiam(SurfNum), Tsurface, ZoneNum);
5130 : }
5131 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5132 0 : break;
5133 164756 : case ConvectionConstants::HcInt_FohannoPolidoriVerticalWall:
5134 164756 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5135 5428 : Real64 QdotConvection = -state.dataHeatBalSurf->SurfQdotConvInPerArea(SurfNum);
5136 5428 : Real64 WallHeight = state.dataSurface->SurfIntConvZoneWallHeight(SurfNum);
5137 10498 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double {
5138 10140 : return CalcFohannoPolidoriVerticalWall(Tsurf - Tamb,
5139 5070 : WallHeight,
5140 : Tsurf - DataGlobalConstants::KelvinConv, // Kiva already uses Kelvin, but algorithm expects C
5141 10140 : QdotConvection);
5142 10856 : };
5143 : } else {
5144 477984 : tmpHc = CallCalcFohannoPolidoriVerticalWall(state,
5145 : (Tsurface - Tzone),
5146 159328 : state.dataSurface->SurfIntConvZoneWallHeight(SurfNum),
5147 : Tsurface,
5148 159328 : -state.dataHeatBalSurf->SurfQdotConvInPerArea(SurfNum),
5149 : SurfNum);
5150 : }
5151 164756 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5152 164756 : break;
5153 0 : case ConvectionConstants::HcInt_KaradagChilledCeiling:
5154 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5155 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcKaradagChilledCeiling(Tsurf - Tamb); };
5156 : } else {
5157 0 : tmpHc = CalcKaradagChilledCeiling((Tsurface - Tzone));
5158 : }
5159 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5160 0 : break;
5161 170100 : case ConvectionConstants::HcInt_ISO15099Windows:
5162 170100 : CalcISO15099WindowIntConvCoeff(state, SurfNum, Tsurface, Tzone);
5163 170100 : tmpHc = state.dataHeatBalSurf->SurfHConvInt(SurfNum);
5164 170100 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5165 170100 : break;
5166 0 : case ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserWindow: {
5167 0 : tmpHc = CalcGoldsteinNovoselacCeilingDiffuserWindow(state,
5168 0 : state.dataSurface->SurfIntConvZonePerimLength(SurfNum),
5169 0 : state.dataSurface->SurfIntConvWindowWallRatio(SurfNum),
5170 0 : state.dataSurface->SurfIntConvWindowLocation(SurfNum),
5171 : ZoneNum);
5172 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5173 0 : HnFn = [=](double, double, double, double, double) -> double { return tmpHc; };
5174 : }
5175 0 : if (state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber > 0) {
5176 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneSupplyAirTemp;
5177 : } else {
5178 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5179 : }
5180 0 : break;
5181 : }
5182 0 : case ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserWalls: {
5183 0 : tmpHc = CalcGoldsteinNovoselacCeilingDiffuserWall(
5184 0 : state, state.dataSurface->SurfIntConvZonePerimLength(SurfNum), state.dataSurface->SurfIntConvWindowLocation(SurfNum), ZoneNum);
5185 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5186 0 : HnFn = [=](double, double, double, double, double) -> double { return tmpHc; };
5187 : }
5188 0 : if (state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber > 0) {
5189 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneSupplyAirTemp;
5190 : } else {
5191 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5192 : }
5193 0 : break;
5194 : }
5195 0 : case ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserFloor: {
5196 0 : tmpHc = CalcGoldsteinNovoselacCeilingDiffuserFloor(state.dataSurface->SurfIntConvZonePerimLength(SurfNum), ZoneNum);
5197 0 : if (thisSurface.ExtBoundCond == DataSurfaces::KivaFoundation) {
5198 0 : HnFn = [=](double, double, double, double, double) -> double { return tmpHc; };
5199 : }
5200 0 : if (state.dataHeatBal->Zone(ZoneNum).SystemZoneNodeNumber > 0) {
5201 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneSupplyAirTemp;
5202 : } else {
5203 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
5204 : }
5205 0 : break;
5206 : }
5207 : }
5208 :
5209 567084 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
5210 :
5211 567084 : if (tmpHc < ConvectionConstants::AdaptiveHcInsideLowLimit) tmpHc = ConvectionConstants::AdaptiveHcInsideLowLimit;
5212 :
5213 567084 : Hc = tmpHc;
5214 567084 : }
5215 :
5216 311205 : void EvaluateExtHcModels(EnergyPlusData &state, int const SurfNum, int const NaturalConvModelEqNum, int const ForcedConvModelEqNum, Real64 &Hc)
5217 : {
5218 :
5219 : // SUBROUTINE INFORMATION:
5220 : // AUTHOR Brent Griffith
5221 : // DATE WRITTEN Aug 2010
5222 : // MODIFIED na
5223 : // RE-ENGINEERED na
5224 :
5225 : // PURPOSE OF THIS SUBROUTINE:
5226 : // central case statement for evaluating exterior specific convection models
5227 :
5228 : // METHODOLOGY EMPLOYED:
5229 : // separated out long case statement for selecting models.
5230 :
5231 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5232 311205 : Real64 Hf(0.0); // the forced, or wind driven portion of film coefficient
5233 311205 : Real64 Hn(0.0); // the natural, or buoyancy driven portion of film coefficient
5234 : Real64 SurfWindSpeed;
5235 : Real64 SurfWindDir;
5236 : Real64 HydraulicDiameter;
5237 :
5238 : // Kiva callback functions
5239 622410 : Kiva::ForcedConvectionTerm HfTermFn;
5240 622410 : Kiva::ConvectionAlgorithm HfFn(KIVA_CONST_CONV(0.0));
5241 622410 : Kiva::ConvectionAlgorithm HnFn(KIVA_CONST_CONV(0.0));
5242 :
5243 311205 : auto &Surface(state.dataSurface->Surface);
5244 311205 : auto &SurfQdotConvOutRepPerArea(state.dataHeatBalSurf->SurfQdotConvOutPerArea);
5245 311205 : Real64 SurfOutTemp = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfNum);
5246 :
5247 : // first call Hn models
5248 311205 : switch (NaturalConvModelEqNum) {
5249 0 : case ConvectionConstants::HcExt_None:
5250 0 : Hn = 0.0;
5251 0 : HnFn = KIVA_CONST_CONV(0.0);
5252 0 : break;
5253 0 : case ConvectionConstants::HcExt_UserCurve:
5254 0 : CalcUserDefinedOutsideHcModel(state, SurfNum, state.dataSurface->SurfOutConvHnUserCurveIndex(SurfNum), Hn);
5255 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5256 0 : HnFn = [=, &state](double Tsurf, double Tamb, double HfTerm, double Roughness, double CosTilt) -> double {
5257 : // Remove Hfterm since this is only used for the natural convection portion
5258 0 : return state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out(Tsurf, Tamb, HfTerm, Roughness, CosTilt) - HfTerm;
5259 0 : };
5260 : }
5261 0 : break;
5262 257874 : case ConvectionConstants::HcExt_NaturalASHRAEVerticalWall:
5263 257874 : Hn = CalcASHRAEVerticalWall((SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)));
5264 258686 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcASHRAEVerticalWall(Tsurf - Tamb); };
5265 257874 : break;
5266 32007 : case ConvectionConstants::HcExt_NaturalWaltonUnstableHorizontalOrTilt:
5267 32007 : Hn = CalcWaltonUnstableHorizontalOrTilt((SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)),
5268 32007 : Surface(SurfNum).CosTilt); // TODO verify CosTilt in vs out
5269 61123 : HnFn = [=](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
5270 29116 : return CalcWaltonUnstableHorizontalOrTilt(Tsurf - Tamb, cosTilt);
5271 32007 : };
5272 32007 : break;
5273 21324 : case ConvectionConstants::HcExt_NaturalWaltonStableHorizontalOrTilt:
5274 21324 : Hn = CalcWaltonStableHorizontalOrTilt((SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)),
5275 21324 : Surface(SurfNum).CosTilt); // TODO verify CosTilt in vs out
5276 21324 : HnFn = [=](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
5277 0 : return CalcWaltonStableHorizontalOrTilt(Tsurf - Tamb, cosTilt);
5278 21324 : };
5279 21324 : break;
5280 0 : case ConvectionConstants::HcExt_AlamdariHammondVerticalWall: {
5281 0 : Real64 FaceHeight = state.dataSurface->SurfOutConvFaceHeight(SurfNum);
5282 0 : Hn = CalcAlamdariHammondVerticalWall(state, (SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)), FaceHeight, SurfNum);
5283 0 : HnFn = [=](double Tsurf, double Tamb, double, double, double) -> double { return CalcAlamdariHammondVerticalWall(Tsurf - Tamb, FaceHeight); };
5284 0 : break;
5285 : }
5286 0 : case ConvectionConstants::HcExt_FohannoPolidoriVerticalWall:
5287 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5288 : // Not compatible with Kiva (Exterior surfaces in Kiva are not currently reported. Also need to add cell-level convection.)
5289 0 : ShowFatalError(state, "Fohanno Polidori convection model not applicable for foundation surface =" + Surface(SurfNum).Name);
5290 : }
5291 0 : Hn = CallCalcFohannoPolidoriVerticalWall(state,
5292 0 : (SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)),
5293 0 : state.dataSurface->SurfOutConvFaceHeight(SurfNum),
5294 : SurfOutTemp,
5295 0 : -SurfQdotConvOutRepPerArea(SurfNum),
5296 : SurfNum);
5297 0 : break;
5298 0 : case ConvectionConstants::HcExt_AlamdariHammondStableHorizontal:
5299 0 : if (state.dataSurface->SurfOutConvFacePerimeter(SurfNum) > 0.0) {
5300 0 : HydraulicDiameter = 4.0 * state.dataSurface->SurfOutConvFaceArea(SurfNum) / state.dataSurface->SurfOutConvFacePerimeter(SurfNum);
5301 : } else {
5302 0 : HydraulicDiameter = std::sqrt(state.dataSurface->SurfOutConvFaceArea(SurfNum));
5303 : }
5304 0 : Hn = CalcAlamdariHammondStableHorizontal(state, (SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)), HydraulicDiameter, SurfNum);
5305 0 : break;
5306 0 : case ConvectionConstants::HcExt_AlamdariHammondUnstableHorizontal:
5307 0 : if (state.dataSurface->SurfOutConvFacePerimeter(SurfNum) > 0.0) {
5308 0 : HydraulicDiameter = 4.0 * state.dataSurface->SurfOutConvFaceArea(SurfNum) / state.dataSurface->SurfOutConvFacePerimeter(SurfNum);
5309 : } else {
5310 0 : HydraulicDiameter = std::sqrt(state.dataSurface->SurfOutConvFaceArea(SurfNum));
5311 : }
5312 0 : Hn = CalcAlamdariHammondUnstableHorizontal(state, (SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)), HydraulicDiameter, SurfNum);
5313 0 : break;
5314 : }
5315 :
5316 311205 : if (!Surface(SurfNum).ExtWind) {
5317 29040 : SurfWindSpeed = 0.0; // No wind exposure
5318 282165 : } else if (Surface(SurfNum).Class == SurfaceClass::Window && state.dataSurface->SurfWinShadingFlag(SurfNum) == WinShadingType::ExtShade) {
5319 0 : SurfWindSpeed = 0.0; // Assume zero wind speed at outside glass surface of window with exterior shade
5320 : } else {
5321 282165 : SurfWindSpeed = state.dataSurface->SurfOutWindSpeed(SurfNum);
5322 : }
5323 :
5324 : DataSurfaces::SurfaceRoughness Roughness =
5325 311205 : state.dataMaterial->Material(state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1)).Roughness;
5326 :
5327 311205 : switch (ForcedConvModelEqNum) {
5328 0 : case ConvectionConstants::HcExt_None:
5329 0 : Hf = 0.0;
5330 0 : HfTermFn = KIVA_HF_DEF;
5331 0 : HfFn = KIVA_CONST_CONV(0.0);
5332 0 : break;
5333 0 : case ConvectionConstants::HcExt_UserCurve:
5334 0 : CalcUserDefinedOutsideHcModel(state, SurfNum, state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum), Hf);
5335 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5336 0 : HfTermFn = state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f;
5337 0 : HnFn = state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out;
5338 : }
5339 0 : break;
5340 184908 : case ConvectionConstants::HcExt_SparrowWindward:
5341 554724 : Hf = CalcSparrowWindward(state,
5342 : Roughness,
5343 184908 : state.dataSurface->SurfOutConvFacePerimeter(SurfNum),
5344 184908 : state.dataSurface->SurfOutConvFaceArea(SurfNum),
5345 : SurfWindSpeed,
5346 : SurfNum);
5347 :
5348 184908 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5349 : // Assume very large area for grade (relative to perimeter).
5350 32400 : constexpr double area = 9999999.;
5351 32400 : constexpr double perim = 1.;
5352 32400 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcSparrowWindward(Roughness, perim, area, windSpeed); };
5353 : } else {
5354 152508 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5355 3381 : auto &fnd = state.dataSurfaceGeometry->kivaManager.surfaceMap[SurfNum].get_instance(0).first->foundation;
5356 3381 : const double length = fnd.netPerimeter;
5357 3381 : const double height = fnd.wall.heightAboveGrade;
5358 3381 : const double area = length * height;
5359 3381 : const double perim = 2.0 * (length + height);
5360 3449 : HfTermFn = [=](double, double, double, double windSpeed) -> double {
5361 : // Average windward and leeward since all walls use same algorithm
5362 68 : double windwardHf = CalcSparrowWindward(Roughness, perim, area, windSpeed);
5363 68 : double leewardHf = CalcSparrowLeeward(Roughness, perim, area, windSpeed);
5364 68 : return (windwardHf + leewardHf) / 2.0;
5365 6762 : };
5366 : }
5367 : }
5368 185720 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5369 184908 : break;
5370 72966 : case ConvectionConstants::HcExt_SparrowLeeward:
5371 218898 : Hf = CalcSparrowLeeward(state,
5372 : Roughness,
5373 72966 : state.dataSurface->SurfOutConvFacePerimeter(SurfNum),
5374 72966 : state.dataSurface->SurfOutConvFaceArea(SurfNum),
5375 : SurfWindSpeed,
5376 : SurfNum);
5377 72966 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5378 : // Assume very large area for grade (relative to perimeter).
5379 0 : constexpr double area = 9999999.;
5380 0 : constexpr double perim = 1.;
5381 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcSparrowLeeward(Roughness, perim, area, windSpeed); };
5382 : } else {
5383 72966 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5384 2031 : auto &fnd = state.dataSurfaceGeometry->kivaManager.surfaceMap[SurfNum].get_instance(0).first->foundation;
5385 2031 : const double length = fnd.netPerimeter;
5386 2031 : const double height = fnd.wall.heightAboveGrade;
5387 2031 : const double area = length * height;
5388 2031 : const double perim = 2.0 * (length + height);
5389 2031 : HfTermFn = [=](double, double, double, double windSpeed) -> double {
5390 : // Average windward and leeward since all walls use same algorithm
5391 0 : double windwardHf = CalcSparrowWindward(Roughness, perim, area, windSpeed);
5392 0 : double leewardHf = CalcSparrowLeeward(Roughness, perim, area, windSpeed);
5393 0 : return (windwardHf + leewardHf) / 2.0;
5394 4062 : };
5395 : }
5396 : }
5397 72966 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5398 72966 : break;
5399 0 : case ConvectionConstants::HcExt_MoWiTTWindward:
5400 0 : Hf = CalcMoWITTWindward(SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum), SurfWindSpeed);
5401 0 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5402 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcMoWITTForcedWindward(windSpeed); };
5403 : } else {
5404 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double {
5405 : // Average windward and leeward since all walls use same algorithm
5406 0 : double windwardHf = CalcMoWITTForcedWindward(windSpeed);
5407 0 : double leewardHf = CalcMoWITTForcedLeeward(windSpeed);
5408 0 : return (windwardHf + leewardHf) / 2.0;
5409 0 : };
5410 : }
5411 0 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5412 0 : break;
5413 0 : case ConvectionConstants::HcExt_MoWiTTLeeward:
5414 0 : Hf = CalcMoWITTLeeward((SurfOutTemp - state.dataSurface->SurfOutDryBulbTemp(SurfNum)), SurfWindSpeed);
5415 0 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5416 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcMoWITTForcedLeeward(windSpeed); };
5417 : } else {
5418 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double {
5419 : // Average windward and leeward since all walls use same algorithm
5420 0 : double windwardHf = CalcMoWITTForcedWindward(windSpeed);
5421 0 : double leewardHf = CalcMoWITTForcedLeeward(windSpeed);
5422 0 : return (windwardHf + leewardHf) / 2.0;
5423 0 : };
5424 : }
5425 0 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5426 0 : break;
5427 0 : case ConvectionConstants::HcExt_DOE2Windward:
5428 0 : Hf = CalcDOE2Windward(SurfOutTemp, state.dataSurface->SurfOutDryBulbTemp(SurfNum), Surface(SurfNum).CosTilt, SurfWindSpeed, Roughness);
5429 0 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5430 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcMoWITTForcedWindward(windSpeed); };
5431 : } else {
5432 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double {
5433 : // Average windward and leeward since all walls use same algorithm
5434 0 : double windwardHf = CalcMoWITTForcedWindward(windSpeed);
5435 0 : double leewardHf = CalcMoWITTForcedLeeward(windSpeed);
5436 0 : return (windwardHf + leewardHf) / 2.0;
5437 0 : };
5438 : }
5439 0 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5440 0 : break;
5441 0 : case ConvectionConstants::HcExt_DOE2Leeward:
5442 0 : Hf = CalcDOE2Leeward(SurfOutTemp, state.dataSurface->SurfOutDryBulbTemp(SurfNum), Surface(SurfNum).CosTilt, SurfWindSpeed, Roughness);
5443 0 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5444 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcMoWITTForcedWindward(windSpeed); };
5445 : } else {
5446 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double {
5447 : // Average windward and leeward since all walls use same algorithm
5448 0 : double windwardHf = CalcMoWITTForcedWindward(windSpeed);
5449 0 : double leewardHf = CalcMoWITTForcedLeeward(windSpeed);
5450 0 : return (windwardHf + leewardHf) / 2.0;
5451 0 : };
5452 : }
5453 0 : HfFn = [=](double Tsurf, double Tamb, double hfTerm, double, double cosTilt) -> double {
5454 0 : return CalcDOE2Forced(Tsurf, Tamb, cosTilt, hfTerm, Roughness);
5455 0 : };
5456 0 : break;
5457 0 : case ConvectionConstants::HcExt_NusseltJurges:
5458 0 : Hf = CalcNusseltJurges(SurfWindSpeed);
5459 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcNusseltJurges(windSpeed); };
5460 0 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5461 0 : break;
5462 0 : case ConvectionConstants::HcExt_McAdams:
5463 0 : Hf = CalcMcAdams(SurfWindSpeed);
5464 0 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return CalcMcAdams(windSpeed); };
5465 0 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5466 0 : break;
5467 0 : case ConvectionConstants::HcExt_Mitchell:
5468 0 : Hf = CalcMitchell(state, SurfWindSpeed, state.dataConvectionCoefficient->CubeRootOfOverallBuildingVolume, SurfNum);
5469 0 : HfTermFn = [&](double, double, double, double windSpeed) -> double {
5470 0 : return CalcMitchell(windSpeed, state.dataConvectionCoefficient->CubeRootOfOverallBuildingVolume);
5471 0 : };
5472 0 : HfFn = [](double, double, double HfTerm, double, double) -> double { return HfTerm; };
5473 0 : break;
5474 53331 : case ConvectionConstants::HcExt_ClearRoof:
5475 53331 : SurfWindDir = state.dataSurface->SurfOutWindDir(SurfNum);
5476 159993 : Hf = CalcClearRoof(state,
5477 : SurfNum,
5478 : SurfOutTemp,
5479 53331 : state.dataSurface->SurfOutDryBulbTemp(SurfNum),
5480 : SurfWindSpeed,
5481 : SurfWindDir,
5482 53331 : state.dataSurface->SurfOutConvFaceArea(SurfNum),
5483 53331 : state.dataSurface->SurfOutConvFacePerimeter(SurfNum));
5484 54623 : HfTermFn = [=](double, double, double, double windSpeed) -> double { return windSpeed; };
5485 53331 : if (Surface(SurfNum).Class == SurfaceClass::Floor) { // used for exterior grade
5486 : // Assume very large area for grade (relative to perimeter).
5487 23628 : constexpr double area = 9999999.;
5488 23628 : constexpr double perim = 1.;
5489 81860 : HfFn = [=, &state](double Tsurf, double Tamb, double hfTerm, double, double) -> double {
5490 58232 : return CalcClearRoof(state, Tsurf, Tamb, hfTerm, area, perim, Roughness);
5491 47256 : };
5492 : } else {
5493 29703 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5494 0 : auto &fnd = state.dataSurfaceGeometry->kivaManager.surfaceMap[SurfNum].get_instance(0).first->foundation;
5495 0 : const double length = fnd.netPerimeter;
5496 0 : const double height = fnd.wall.heightAboveGrade;
5497 0 : const double area = length * height;
5498 0 : const double perim = 2.0 * (length + height);
5499 0 : HfFn = [=, &state](double Tsurf, double Tamb, double hfTerm, double, double) -> double {
5500 0 : return CalcClearRoof(state, Tsurf, Tamb, hfTerm, area, perim, Roughness);
5501 0 : };
5502 : }
5503 : }
5504 53331 : break;
5505 0 : case ConvectionConstants::HcExt_BlockenWindward:
5506 0 : Hf = CalcBlockenWindward(state, state.dataEnvrn->WindSpeed, state.dataEnvrn->WindDir, Surface(SurfNum).Azimuth, SurfNum);
5507 : // Not compatible with Kiva (doesn't use weather station windspeed)
5508 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5509 0 : ShowFatalError(state, "Blocken Windward convection model not applicable for foundation surface =" + Surface(SurfNum).Name);
5510 : }
5511 0 : break;
5512 0 : case ConvectionConstants::HcExt_EmmelVertical:
5513 0 : Hf = CalcEmmelVertical(state.dataEnvrn->WindSpeed, state.dataEnvrn->WindDir, Surface(SurfNum).Azimuth);
5514 : // Not compatible with Kiva (doesn't use weather station windspeed)
5515 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5516 0 : ShowFatalError(state, "Emmel Vertical convection model not applicable for foundation surface =" + Surface(SurfNum).Name);
5517 : }
5518 0 : break;
5519 0 : case ConvectionConstants::HcExt_EmmelRoof:
5520 0 : Hf = CalcEmmelRoof(state.dataEnvrn->WindSpeed, state.dataEnvrn->WindDir, state.dataConvectionCoefficient->RoofLongAxisOutwardAzimuth);
5521 : // Not compatible with Kiva (doesn't use weather station windspeed)
5522 0 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5523 0 : ShowFatalError(state, "Emmel Roof convection model not applicable for foundation surface =" + Surface(SurfNum).Name);
5524 : }
5525 0 : break;
5526 : }
5527 :
5528 311205 : Hc = Hf + Hn;
5529 :
5530 311205 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5531 29040 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = HfTermFn;
5532 58080 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out =
5533 184376 : [=](double Tsurf, double Tamb, double HfTerm, double Roughness, double cosTilt) -> double {
5534 29928 : Real64 HcExt = HfFn(Tsurf, Tamb, HfTerm, Roughness, cosTilt) + HnFn(Tsurf, Tamb, HfTerm, Roughness, cosTilt);
5535 29928 : if (HcExt < ConvectionConstants::AdaptiveHcOutsideLowLimit) HcExt = ConvectionConstants::AdaptiveHcOutsideLowLimit;
5536 29928 : return HcExt;
5537 87120 : };
5538 29040 : Hc = 0.0; // Not used in Kiva
5539 : }
5540 :
5541 311205 : if (Hc < ConvectionConstants::AdaptiveHcOutsideLowLimit) Hc = ConvectionConstants::AdaptiveHcOutsideLowLimit;
5542 311205 : }
5543 :
5544 311205 : void DynamicExtConvSurfaceClassification(EnergyPlusData &state, int const SurfNum) // surface number
5545 : {
5546 :
5547 : // SUBROUTINE INFORMATION:
5548 : // AUTHOR B. Griffith
5549 : // DATE WRITTEN August 2010
5550 : // MODIFIED na
5551 : // RE-ENGINEERED na
5552 :
5553 : // METHODOLOGY EMPLOYED:
5554 : // Decide surface classification based on wind and buoyancy, class, orientation
5555 :
5556 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5557 311205 : Real64 DeltaTemp(0.0);
5558 : Real64 surfWindDir;
5559 :
5560 311205 : auto &Surface(state.dataSurface->Surface);
5561 :
5562 311205 : surfWindDir = state.dataSurface->SurfOutWindDir(SurfNum);
5563 :
5564 646038 : if (Surface(SurfNum).Class == SurfaceClass::Roof ||
5565 337530 : (Surface(SurfNum).Class == SurfaceClass::Floor && Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) // Applies to exterior grade
5566 : ) {
5567 53331 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
5568 23628 : DeltaTemp = state.dataSurfaceGeometry->kivaManager.surfaceMap[SurfNum].results.Tconv - state.dataSurface->SurfOutDryBulbTemp(SurfNum);
5569 : } else {
5570 29703 : DeltaTemp = state.dataHeatBalSurf->SurfOutsideTempHist(1)(SurfNum) - state.dataSurface->SurfOutDryBulbTemp(SurfNum);
5571 : }
5572 :
5573 53331 : if (DeltaTemp < 0.0) {
5574 21324 : state.dataSurface->SurfOutConvClassification(SurfNum) = ConvectionConstants::OutConvClass::RoofStable;
5575 : } else {
5576 32007 : state.dataSurface->SurfOutConvClassification(SurfNum) = ConvectionConstants::OutConvClass::RoofUnstable;
5577 : }
5578 :
5579 : } else {
5580 :
5581 257874 : if (Windward(Surface(SurfNum).CosTilt, Surface(SurfNum).Azimuth, surfWindDir)) {
5582 184908 : state.dataSurface->SurfOutConvClassification(SurfNum) = ConvectionConstants::OutConvClass::WindwardVertWall;
5583 : } else {
5584 72966 : state.dataSurface->SurfOutConvClassification(SurfNum) = ConvectionConstants::OutConvClass::LeewardVertWall;
5585 : }
5586 : }
5587 311205 : }
5588 :
5589 311205 : void MapExtConvClassificationToHcModels(EnergyPlusData &state, int const SurfNum) // surface number
5590 : {
5591 :
5592 : // SUBROUTINE INFORMATION:
5593 : // AUTHOR Brent Griffith
5594 : // DATE WRITTEN Aug 2010
5595 : // MODIFIED na
5596 : // RE-ENGINEERED na
5597 :
5598 311205 : switch (state.dataSurface->SurfOutConvClassification(SurfNum)) {
5599 184908 : case ConvectionConstants::OutConvClass::WindwardVertWall:
5600 184908 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum;
5601 184908 : if (state.dataSurface->SurfOutConvHfModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5602 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5603 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardUserCurveNum;
5604 : }
5605 184908 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum;
5606 184908 : if (state.dataSurface->SurfOutConvHnModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5607 0 : state.dataSurface->SurfOutConvHnUserCurveIndex(SurfNum) =
5608 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallUserCurveNum;
5609 : }
5610 184908 : break;
5611 72966 : case ConvectionConstants::OutConvClass::LeewardVertWall:
5612 72966 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum;
5613 72966 : if (state.dataSurface->SurfOutConvHfModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5614 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5615 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardUserCurveNum;
5616 : }
5617 72966 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum;
5618 72966 : if (state.dataSurface->SurfOutConvHnModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5619 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5620 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallUserCurveNum;
5621 : }
5622 72966 : break;
5623 21324 : case ConvectionConstants::OutConvClass::RoofStable:
5624 21324 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum;
5625 21324 : if (state.dataSurface->SurfOutConvHfModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5626 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5627 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofUserCurveNum;
5628 : }
5629 21324 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum;
5630 21324 : if (state.dataSurface->SurfOutConvHnModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5631 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5632 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizUserCurveNum;
5633 : }
5634 21324 : break;
5635 32007 : case ConvectionConstants::OutConvClass::RoofUnstable:
5636 32007 : state.dataSurface->SurfOutConvHfModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum;
5637 32007 : if (state.dataSurface->SurfOutConvHfModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5638 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5639 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofUserCurveNum;
5640 : }
5641 32007 : state.dataSurface->SurfOutConvHnModelEq(SurfNum) = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum;
5642 32007 : if (state.dataSurface->SurfOutConvHnModelEq(SurfNum) == ConvectionConstants::HcExt_UserCurve) {
5643 0 : state.dataSurface->SurfOutConvHfUserCurveIndex(SurfNum) =
5644 0 : state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizUserCurveNum;
5645 : }
5646 32007 : break;
5647 0 : default:
5648 0 : ShowSevereError(state,
5649 0 : format("MapExtConvClassificationToHcModels: caught unknown outdoor surface classification: {}",
5650 0 : state.dataSurface->SurfOutConvClassification(SurfNum)));
5651 : }
5652 :
5653 : // Set report var after surface has been classified
5654 311205 : state.dataSurface->SurfOutConvClassificationRpt(SurfNum) =
5655 311205 : ConvectionConstants::OutConvClassReportVals[static_cast<int>(state.dataSurface->SurfOutConvClassification(SurfNum))];
5656 311205 : }
5657 :
5658 567084 : void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNum) // surface number
5659 : {
5660 :
5661 : // SUBROUTINE INFORMATION:
5662 : // AUTHOR Brent Griffith
5663 : // DATE WRITTEN Aug 2010
5664 : // MODIFIED na
5665 : // RE-ENGINEERED na
5666 :
5667 : // PURPOSE OF THIS SUBROUTINE:
5668 : // collects dynamic updates needed for adaptive convection algorithm
5669 :
5670 : // METHODOLOGY EMPLOYED:
5671 : // Decide flow regime to set IntConvClassification
5672 : // done by zone using the following rules
5673 :
5674 : // Using zone flow regime, and surface's characteristics assign IntConvHcModelEq
5675 :
5676 : // Using/Aliasing
5677 : using namespace DataZoneEquipment;
5678 : using Psychrometrics::PsyRhoAirFnPbTdbW;
5679 : using Psychrometrics::PsyWFnTdpPb;
5680 :
5681 : // SUBROUTINE PARAMETER DEFINITIONS:
5682 567084 : Real64 constexpr g(9.81); // gravity constant (m/s**2)
5683 567084 : Real64 constexpr v(15.89e-6); // kinematic viscosity (m**2/s) for air at 300 K
5684 567084 : Real64 constexpr ActiveDelTempThreshold(1.5); // deg C, temperature difference for surfaces to be considered "active"
5685 :
5686 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
5687 567084 : int ZoneNum(0);
5688 567084 : int PriorityEquipOn(0);
5689 567084 : constexpr int MaxZoneEquipmentOn{11};
5690 567084 : constexpr int MaxZoneEquipmentIdx{MaxZoneEquipmentOn - 1};
5691 567084 : std::array<int, MaxZoneEquipmentOn> HeatingPriorityStack{};
5692 567084 : std::array<int, MaxZoneEquipmentOn> CoolingPriorityStack{};
5693 567084 : std::array<InConvFlowRegime, MaxZoneEquipmentOn> FlowRegimeStack{};
5694 567084 : FlowRegimeStack.fill(InConvFlowRegime::Invalid);
5695 567084 : int EquipNum(0);
5696 567084 : int ZoneNode(0);
5697 567084 : int EquipOnCount(0);
5698 567084 : int EquipOnLoop(0);
5699 567084 : int thisZoneInletNode(0);
5700 567084 : InConvFlowRegime FinalFlowRegime(InConvFlowRegime::Invalid);
5701 567084 : Real64 Tmin(std::numeric_limits<float>::max()); // temporary min surf temp
5702 567084 : Real64 Tmax(std::numeric_limits<float>::min()); // temporary max surf temp
5703 567084 : Real64 GrH(0.0); // Grashof number for zone height H
5704 567084 : Real64 Re(0.0); // Reynolds number for zone air system flow
5705 567084 : Real64 Ri(0.0); // Richardson Number, Gr/Re**2 for determining mixed regime
5706 567084 : Real64 AirDensity(0.0); // temporary zone air density
5707 567084 : Real64 DeltaTemp(0.0); // temporary temperature difference (Tsurf - Tair)
5708 :
5709 567084 : auto &Zone(state.dataHeatBal->Zone);
5710 567084 : auto &Surface(state.dataSurface->Surface);
5711 :
5712 567084 : EquipOnCount = 0;
5713 567084 : ZoneNum = Surface(SurfNum).Zone;
5714 567084 : ZoneNode = Zone(ZoneNum).SystemZoneNodeNumber;
5715 :
5716 : // HVAC connections
5717 567084 : if (!Zone(ZoneNum).IsControlled) { // no HVAC control
5718 113454 : FlowRegimeStack[0] = InConvFlowRegime::A3;
5719 : } else { // is controlled, lets see by how and if that means is currently active
5720 :
5721 1814520 : if (!(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex > 0) || state.dataGlobal->SysSizingCalc ||
5722 1138470 : state.dataGlobal->ZoneSizingCalc || !state.dataZoneEquip->ZoneEquipSimulatedOnce) {
5723 222420 : FlowRegimeStack[0] = InConvFlowRegime::A3;
5724 : } else {
5725 :
5726 462420 : for (EquipNum = 1;
5727 462420 : EquipNum <= state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).NumOfEquipTypes;
5728 : ++EquipNum) {
5729 :
5730 231210 : switch (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipTypeEnum(EquipNum)) {
5731 231210 : case DataZoneEquipment::ZoneEquip::AirDistUnit:
5732 : case DataZoneEquipment::ZoneEquip::PurchasedAir:
5733 462420 : if (!(allocated(state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5734 231210 : .EquipData(EquipNum)
5735 : .OutletNodeNums)))
5736 1386 : continue;
5737 : // get inlet node, not zone node if possible
5738 459648 : thisZoneInletNode = state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5739 229824 : .EquipData(EquipNum)
5740 229824 : .OutletNodeNums(1);
5741 229824 : if (thisZoneInletNode > 0) {
5742 229824 : if (state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate > 0.0) {
5743 191325 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5744 191325 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::C;
5745 191325 : HeatingPriorityStack[EquipOnCount] =
5746 191325 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5747 191325 : .HeatingPriority(EquipNum);
5748 191325 : CoolingPriorityStack[EquipOnCount] =
5749 191325 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5750 191325 : .CoolingPriority(EquipNum);
5751 : }
5752 : } else {
5753 0 : if (state.dataLoopNodes->Node(ZoneNode).MassFlowRate > 0.0) {
5754 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5755 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::C;
5756 0 : HeatingPriorityStack[EquipOnCount] =
5757 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5758 0 : .HeatingPriority(EquipNum);
5759 0 : CoolingPriorityStack[EquipOnCount] =
5760 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5761 0 : .CoolingPriority(EquipNum);
5762 : }
5763 : }
5764 229824 : break;
5765 0 : case DataZoneEquipment::ZoneEquip::WindowAC:
5766 : case DataZoneEquipment::ZoneEquip::PkgTermHPAirToAir:
5767 : case DataZoneEquipment::ZoneEquip::PkgTermACAirToAir:
5768 : case DataZoneEquipment::ZoneEquip::ZoneDXDehumidifier:
5769 : case DataZoneEquipment::ZoneEquip::PkgTermHPWaterToAir:
5770 : case DataZoneEquipment::ZoneEquip::FanCoil4Pipe:
5771 : case DataZoneEquipment::ZoneEquip::UnitVentilator:
5772 : case DataZoneEquipment::ZoneEquip::UnitHeater:
5773 : case DataZoneEquipment::ZoneEquip::OutdoorAirUnit:
5774 0 : if (!(allocated(state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5775 0 : .EquipData(EquipNum)
5776 : .OutletNodeNums)))
5777 0 : continue;
5778 0 : thisZoneInletNode = state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5779 0 : .EquipData(EquipNum)
5780 0 : .OutletNodeNums(1);
5781 0 : if (thisZoneInletNode > 0) {
5782 0 : if (state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate > 0.0) {
5783 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5784 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::D;
5785 0 : HeatingPriorityStack[EquipOnCount] =
5786 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5787 0 : .HeatingPriority(EquipNum);
5788 0 : CoolingPriorityStack[EquipOnCount] =
5789 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5790 0 : .CoolingPriority(EquipNum);
5791 : }
5792 : } else {
5793 0 : if (state.dataLoopNodes->Node(ZoneNode).MassFlowRate > 0.0) {
5794 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5795 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::D;
5796 0 : HeatingPriorityStack[EquipOnCount] =
5797 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5798 0 : .HeatingPriority(EquipNum);
5799 0 : CoolingPriorityStack[EquipOnCount] =
5800 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5801 0 : .CoolingPriority(EquipNum);
5802 : }
5803 : }
5804 0 : break;
5805 0 : case DataZoneEquipment::ZoneEquip::CoolingPanel:
5806 : case DataZoneEquipment::ZoneEquip::BBSteam:
5807 : case DataZoneEquipment::ZoneEquip::BBWaterConvective:
5808 : case DataZoneEquipment::ZoneEquip::BBElectricConvective:
5809 : case DataZoneEquipment::ZoneEquip::BBWater:
5810 0 : if (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipData(EquipNum).ON) {
5811 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5812 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::B;
5813 0 : HeatingPriorityStack[EquipOnCount] =
5814 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5815 0 : .HeatingPriority(EquipNum);
5816 0 : CoolingPriorityStack[EquipOnCount] =
5817 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5818 0 : .CoolingPriority(EquipNum);
5819 : }
5820 0 : break;
5821 0 : case DataZoneEquipment::ZoneEquip::BBElectric:
5822 : case DataZoneEquipment::ZoneEquip::HiTempRadiant:
5823 0 : if (state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).EquipData(EquipNum).ON) {
5824 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5825 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::B;
5826 0 : HeatingPriorityStack[EquipOnCount] =
5827 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5828 0 : .HeatingPriority(EquipNum);
5829 0 : CoolingPriorityStack[EquipOnCount] =
5830 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5831 0 : .CoolingPriority(EquipNum);
5832 : }
5833 0 : break;
5834 0 : case DataZoneEquipment::ZoneEquip::VentilatedSlab:
5835 : case DataZoneEquipment::ZoneEquip::LoTempRadiant:
5836 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InFloorActiveElement) {
5837 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
5838 0 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
5839 0 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
5840 0 : if (!state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfLoop)) continue;
5841 0 : if (Surface(SurfLoop).Class == SurfaceClass::Floor) {
5842 0 : DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) -
5843 0 : state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
5844 0 : if (DeltaTemp > ActiveDelTempThreshold) { // assume heating with floor
5845 : // system ON is not enough because floor surfaces can continue to heat because of thermal capacity
5846 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5847 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::A1;
5848 0 : HeatingPriorityStack[EquipOnCount] =
5849 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5850 0 : .HeatingPriority(EquipNum);
5851 0 : CoolingPriorityStack[EquipOnCount] =
5852 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5853 0 : .CoolingPriority(EquipNum);
5854 0 : break;
5855 : }
5856 : }
5857 : }
5858 : }
5859 : }
5860 :
5861 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InCeilingActiveElement) {
5862 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
5863 0 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
5864 0 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
5865 0 : if (!state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfLoop)) continue;
5866 0 : if (Surface(SurfLoop).Class == SurfaceClass::Roof) {
5867 0 : DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) -
5868 0 : state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
5869 0 : if (DeltaTemp < ActiveDelTempThreshold) { // assume cooling with ceiling
5870 : // system ON is not enough because surfaces can continue to cool because of thermal capacity
5871 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5872 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::A1;
5873 0 : HeatingPriorityStack[EquipOnCount] =
5874 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5875 0 : .HeatingPriority(EquipNum);
5876 0 : CoolingPriorityStack[EquipOnCount] =
5877 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5878 0 : .CoolingPriority(EquipNum);
5879 0 : break;
5880 : }
5881 : }
5882 : }
5883 : }
5884 : }
5885 :
5886 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).InWallActiveElement) {
5887 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
5888 0 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
5889 0 : for (int SurfLoop = thisSpace.HTSurfaceFirst; SurfLoop <= thisSpace.HTSurfaceLast; ++SurfLoop) {
5890 0 : if (!state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfLoop)) continue;
5891 0 : if (Surface(SurfLoop).Class == SurfaceClass::Wall || Surface(SurfLoop).Class == SurfaceClass::Door) {
5892 0 : DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) -
5893 0 : state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
5894 0 : if (DeltaTemp > ActiveDelTempThreshold) { // assume heating with wall panel
5895 : // system ON is not enough because surfaces can continue to heat because of thermal capacity
5896 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5897 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::A2;
5898 0 : HeatingPriorityStack[EquipOnCount] =
5899 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5900 0 : .HeatingPriority(EquipNum);
5901 0 : CoolingPriorityStack[EquipOnCount] =
5902 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5903 0 : .CoolingPriority(EquipNum);
5904 : } else { // not heating, no special models wall cooling so use simple buoyancy
5905 0 : EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx);
5906 0 : FlowRegimeStack[EquipOnCount] = InConvFlowRegime::A3;
5907 0 : HeatingPriorityStack[EquipOnCount] =
5908 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5909 0 : .HeatingPriority(EquipNum);
5910 0 : CoolingPriorityStack[EquipOnCount] =
5911 0 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
5912 0 : .CoolingPriority(EquipNum);
5913 : }
5914 : }
5915 : }
5916 : }
5917 : }
5918 : default:; // nothing
5919 : }
5920 :
5921 : } // loop over equipment for this zone
5922 : }
5923 : }
5924 :
5925 : // now select which equipment type is dominant compared to all those that are ON
5926 567084 : if (EquipOnCount > 0) {
5927 191325 : if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadPredictedRate >= 0.0) { // heating load
5928 101881 : PriorityEquipOn = 1;
5929 203762 : for (EquipOnLoop = 1; EquipOnLoop <= EquipOnCount; ++EquipOnLoop) {
5930 : // assume highest priority/first sim order is dominant for flow regime
5931 101881 : if (HeatingPriorityStack[EquipOnLoop] < HeatingPriorityStack[PriorityEquipOn]) {
5932 0 : PriorityEquipOn = EquipOnLoop;
5933 : }
5934 : }
5935 89444 : } else if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).ZoneSNLoadPredictedRate < 0.0) { // cooling load
5936 89444 : PriorityEquipOn = 1;
5937 178888 : for (EquipOnLoop = 1; EquipOnLoop <= EquipOnCount; ++EquipOnLoop) {
5938 : // assume highest priority/first sim order is dominant for flow regime
5939 89444 : if (CoolingPriorityStack[EquipOnLoop] < CoolingPriorityStack[PriorityEquipOn]) {
5940 0 : PriorityEquipOn = EquipOnLoop;
5941 : }
5942 : }
5943 : }
5944 191325 : FinalFlowRegime = FlowRegimeStack[PriorityEquipOn];
5945 : } else {
5946 : // no equipment on, so simple buoyancy flow regime
5947 375759 : FinalFlowRegime = InConvFlowRegime::A3;
5948 : }
5949 :
5950 : // now if flow regimes C or D, then check for Mixed regime or very low flow rates
5951 567084 : if ((FinalFlowRegime == InConvFlowRegime::C) || (FinalFlowRegime == InConvFlowRegime::D)) {
5952 :
5953 : // Calculate Grashof, Reynolds, and Richardson numbers for the zone
5954 : // Grashof for zone air based on largest delta T between surfaces and zone height
5955 382650 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
5956 191325 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
5957 2405040 : for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
5958 2213715 : Real64 SurfTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum);
5959 2213715 : if (SurfTemp < Tmin)
5960 640730 : Tmin = SurfTemp;
5961 1572985 : else if (SurfTemp > Tmax)
5962 511513 : Tmax = SurfTemp;
5963 : }
5964 : }
5965 382650 : GrH = (g * (Tmax - Tmin) * pow_3(Zone(ZoneNum).CeilingHeight)) /
5966 191325 : ((state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT + DataGlobalConstants::KelvinConv) * pow_2(v));
5967 :
5968 : // Reynolds number = Vdot supply / v * cube root of zone volume (Goldstein and Noveselac 2010)
5969 191325 : if (state.dataLoopNodes->Node(ZoneNode).MassFlowRate > 0.0) {
5970 765300 : AirDensity = PsyRhoAirFnPbTdbW(state,
5971 191325 : state.dataEnvrn->OutBaroPress,
5972 191325 : state.dataLoopNodes->Node(ZoneNode).Temp,
5973 382650 : PsyWFnTdpPb(state, state.dataLoopNodes->Node(ZoneNode).Temp, state.dataEnvrn->OutBaroPress));
5974 191325 : Re = state.dataLoopNodes->Node(ZoneNode).MassFlowRate / (v * AirDensity * std::pow(Zone(ZoneNum).Volume, ConvectionConstants::OneThird));
5975 : } else {
5976 0 : Re = 0.0;
5977 : }
5978 :
5979 191325 : if (Re > 0.0) {
5980 191325 : Ri = GrH / pow_2(Re); // Richardson Number
5981 191325 : if (Ri > 10.0) { // natural convection expected
5982 191325 : FinalFlowRegime = InConvFlowRegime::A3;
5983 0 : } else if (Ri < 0.1) { // forced
5984 : // no change, already a forced regime
5985 : } else { // mixed
5986 0 : FinalFlowRegime = InConvFlowRegime::E;
5987 : }
5988 : } else { // natural convection expected
5989 0 : FinalFlowRegime = InConvFlowRegime::A3;
5990 : }
5991 : }
5992 :
5993 : static constexpr std::array<std::array<ConvectionConstants::InConvClass, (int)ConvSurfDeltaT::Num>,
5994 : (int)ConvectionConstants::SurfConvOrientation::Num>
5995 : A1{{
5996 : {ConvectionConstants::InConvClass::A1_StableHoriz, // HorizontalDown, Positive
5997 : ConvectionConstants::InConvClass::A1_StableHoriz, // HorizontalDown, Zero
5998 : ConvectionConstants::InConvClass::A1_UnstableHoriz}, // HorizontalDown, Negative
5999 : {ConvectionConstants::InConvClass::A1_StableTilted, // TiltedDownward, Positive
6000 : ConvectionConstants::InConvClass::A1_StableTilted, // TiltedDownward, Zero
6001 : ConvectionConstants::InConvClass::A1_UnstableTilted}, // TiltedDownward, Negative
6002 : {ConvectionConstants::InConvClass::A1_VertWalls, // Vertical, Positive
6003 : ConvectionConstants::InConvClass::A1_VertWalls, // Vertical, Zero
6004 : ConvectionConstants::InConvClass::A1_VertWalls}, // Vertical, Negative
6005 : {ConvectionConstants::InConvClass::A1_UnstableTilted, // TiltedUpward, Positive
6006 : ConvectionConstants::InConvClass::A1_StableTilted, // TiltedUpward, Zero
6007 : ConvectionConstants::InConvClass::A1_StableTilted}, // TiltedUpward, Negative
6008 : {ConvectionConstants::InConvClass::A1_UnstableHoriz, // HorizontalUp, Positive
6009 : ConvectionConstants::InConvClass::A1_StableHoriz, // HorizontalUp, Zero
6010 : ConvectionConstants::InConvClass::A1_StableHoriz} // HorizontalUp, Negative
6011 : }};
6012 :
6013 : static constexpr std::array<std::array<ConvectionConstants::InConvClass, (int)ConvSurfDeltaT::Num>,
6014 : (int)ConvectionConstants::SurfConvOrientation::Num>
6015 : A2{{
6016 : {ConvectionConstants::InConvClass::A2_StableHoriz, // HorizontalDown, Positive
6017 : ConvectionConstants::InConvClass::A2_StableHoriz, // HorizontalDown, Zero
6018 : ConvectionConstants::InConvClass::A2_UnstableHoriz}, // HorizontalDown, Negative
6019 : {ConvectionConstants::InConvClass::A2_StableTilted, // TiltedDownward, Positive
6020 : ConvectionConstants::InConvClass::A2_StableTilted, // TiltedDownward, Zero
6021 : ConvectionConstants::InConvClass::A2_UnstableTilted}, // TiltedDownward, Negative
6022 : {ConvectionConstants::InConvClass::A2_VertWallsNonHeated, // Vertical, Positive
6023 : ConvectionConstants::InConvClass::A2_VertWallsNonHeated, // Vertical, Zero
6024 : ConvectionConstants::InConvClass::A2_VertWallsNonHeated}, // Vertical, Negative
6025 : {ConvectionConstants::InConvClass::A2_UnstableTilted, // TiltedUpward, Positive
6026 : ConvectionConstants::InConvClass::A2_StableTilted, // TiltedUpward, Zero
6027 : ConvectionConstants::InConvClass::A2_StableTilted}, // TiltedUpward, Negative
6028 : {ConvectionConstants::InConvClass::A2_UnstableHoriz, // HorizontalUp, Positive
6029 : ConvectionConstants::InConvClass::A2_StableHoriz, // HorizontalUp, Zero
6030 : ConvectionConstants::InConvClass::A2_StableHoriz} // HorizontalUp, Negative
6031 : }};
6032 :
6033 : static constexpr std::array<std::array<ConvectionConstants::InConvClass, (int)ConvSurfDeltaT::Num>,
6034 : (int)ConvectionConstants::SurfConvOrientation::Num>
6035 : A3{{
6036 : {ConvectionConstants::InConvClass::A3_StableHoriz, // HorizontalDown, Positive
6037 : ConvectionConstants::InConvClass::A3_StableHoriz, // HorizontalDown, Zero
6038 : ConvectionConstants::InConvClass::A3_UnstableHoriz}, // HorizontalDown, Negative
6039 : {ConvectionConstants::InConvClass::A3_StableTilted, // TiltedDownward, Positive
6040 : ConvectionConstants::InConvClass::A3_StableTilted, // TiltedDownward, Zero
6041 : ConvectionConstants::InConvClass::A3_UnstableTilted}, // TiltedDownward, Negative
6042 : {ConvectionConstants::InConvClass::A3_VertWalls, // Vertical, Positive
6043 : ConvectionConstants::InConvClass::A3_VertWalls, // Vertical, Zero
6044 : ConvectionConstants::InConvClass::A3_VertWalls}, // Vertical, Negative
6045 : {ConvectionConstants::InConvClass::A3_UnstableTilted, // TiltedUpward, Positive
6046 : ConvectionConstants::InConvClass::A3_StableTilted, // TiltedUpward, Zero
6047 : ConvectionConstants::InConvClass::A3_StableTilted}, // TiltedUpward, Negative
6048 : {ConvectionConstants::InConvClass::A3_UnstableHoriz, // HorizontalUp, Positive
6049 : ConvectionConstants::InConvClass::A3_StableHoriz, // HorizontalUp, Zero
6050 : ConvectionConstants::InConvClass::A3_StableHoriz} // HorizontalUp, Negative
6051 : }};
6052 :
6053 : static constexpr std::array<std::array<ConvectionConstants::InConvClass, (int)ConvSurfDeltaT::Num>,
6054 : (int)ConvectionConstants::SurfConvOrientation::Num>
6055 : B{{
6056 : {ConvectionConstants::InConvClass::B_StableHoriz, // HorizontalDown, Positive
6057 : ConvectionConstants::InConvClass::B_StableHoriz, // HorizontalDown, Zero
6058 : ConvectionConstants::InConvClass::B_UnstableHoriz}, // HorizontalDown, Negative
6059 : {ConvectionConstants::InConvClass::B_StableTilted, // TiltedDownward, Positive
6060 : ConvectionConstants::InConvClass::B_StableTilted, // TiltedDownward, Zero
6061 : ConvectionConstants::InConvClass::B_UnstableTilted}, // TiltedDownward, Negative
6062 : {ConvectionConstants::InConvClass::B_VertWalls, // Vertical, Positive
6063 : ConvectionConstants::InConvClass::B_VertWalls, // Vertical, Zero
6064 : ConvectionConstants::InConvClass::B_VertWalls}, // Vertical, Negative
6065 : {ConvectionConstants::InConvClass::B_UnstableTilted, // TiltedUpward, Positive
6066 : ConvectionConstants::InConvClass::B_StableTilted, // TiltedUpward, Zero
6067 : ConvectionConstants::InConvClass::B_StableTilted}, // TiltedUpward, Negative
6068 : {ConvectionConstants::InConvClass::B_UnstableHoriz, // HorizontalUp, Positive
6069 : ConvectionConstants::InConvClass::B_StableHoriz, // HorizontalUp, Zero
6070 : ConvectionConstants::InConvClass::B_StableHoriz} // HorizontalUp, Negative
6071 : }};
6072 :
6073 : static constexpr std::array<std::array<ConvectionConstants::InConvClass, (int)ConvSurfDeltaT::Num>,
6074 : (int)ConvectionConstants::SurfConvOrientation::Num>
6075 : D{{
6076 : {ConvectionConstants::InConvClass::D_StableHoriz, // HorizontalDown, Positive
6077 : ConvectionConstants::InConvClass::D_StableHoriz, // HorizontalDown, Zero
6078 : ConvectionConstants::InConvClass::D_UnstableHoriz}, // HorizontalDown, Negative
6079 : {ConvectionConstants::InConvClass::D_StableTilted, // TiltedDownward, Positive
6080 : ConvectionConstants::InConvClass::D_StableTilted, // TiltedDownward, Zero
6081 : ConvectionConstants::InConvClass::D_UnstableTilted}, // TiltedDownward, Negative
6082 : {ConvectionConstants::InConvClass::D_Walls, // Vertical, Positive
6083 : ConvectionConstants::InConvClass::D_Walls, // Vertical, Zero
6084 : ConvectionConstants::InConvClass::D_Walls}, // Vertical, Negative
6085 : {ConvectionConstants::InConvClass::D_UnstableTilted, // TiltedUpward, Positive
6086 : ConvectionConstants::InConvClass::D_StableTilted, // TiltedUpward, Zero
6087 : ConvectionConstants::InConvClass::D_StableTilted}, // TiltedUpward, Negative
6088 : {ConvectionConstants::InConvClass::D_UnstableHoriz, // HorizontalUp, Positive
6089 : ConvectionConstants::InConvClass::D_StableHoriz, // HorizontalUp, Zero
6090 : ConvectionConstants::InConvClass::D_StableHoriz} // HorizontalUp, Negative
6091 : }};
6092 :
6093 567084 : auto DeltaTempLambda = [](Real64 surfTemp, Real64 airTemp) {
6094 567084 : Real64 deltaT = surfTemp - airTemp;
6095 567084 : if (deltaT > 0.0) {
6096 279218 : return (int)ConvSurfDeltaT::Positive;
6097 287866 : } else if (deltaT < 0.0) {
6098 286446 : return (int)ConvSurfDeltaT::Negative;
6099 : } else {
6100 1420 : return (int)ConvSurfDeltaT::Zero;
6101 : }
6102 : };
6103 :
6104 : // now finish out specific model eq for this surface
6105 :
6106 : int iDeltaTemp =
6107 567084 : DeltaTempLambda(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT);
6108 567084 : int iConvOrient = int(Surface(SurfNum).ConvOrientation);
6109 :
6110 567084 : switch (FinalFlowRegime) {
6111 0 : case InConvFlowRegime::A1:
6112 :
6113 0 : switch (Surface(SurfNum).Class) {
6114 0 : case SurfaceClass::Wall:
6115 : case SurfaceClass::Door:
6116 : case SurfaceClass::IntMass:
6117 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = A1[iConvOrient][iDeltaTemp];
6118 0 : break;
6119 0 : case SurfaceClass::Roof:
6120 0 : if (state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfNum)) {
6121 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::A1_ChilledCeil;
6122 : } else {
6123 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = A1[iConvOrient][iDeltaTemp];
6124 : }
6125 0 : break;
6126 0 : case SurfaceClass::Floor:
6127 0 : if (state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfNum)) {
6128 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::A1_HeatedFloor;
6129 : } else {
6130 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = A1[iConvOrient][iDeltaTemp];
6131 : }
6132 0 : break;
6133 0 : case SurfaceClass::Window:
6134 : case SurfaceClass::GlassDoor:
6135 : case SurfaceClass::TDD_Diffuser:
6136 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::A1_Windows;
6137 0 : break;
6138 0 : default:
6139 0 : assert(false);
6140 : }
6141 :
6142 0 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6143 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for A1 surface named" + Surface(SurfNum).Name);
6144 : }
6145 :
6146 0 : break;
6147 :
6148 0 : case InConvFlowRegime::A2:
6149 :
6150 0 : switch (Surface(SurfNum).Class) {
6151 0 : case SurfaceClass::Roof:
6152 : case SurfaceClass::Floor:
6153 : case SurfaceClass::IntMass:
6154 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = A2[iConvOrient][iDeltaTemp];
6155 0 : break;
6156 0 : case SurfaceClass::Wall:
6157 : case SurfaceClass::Door:
6158 0 : if (state.dataSurface->SurfIntConvSurfHasActiveInIt(SurfNum)) {
6159 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::A2_HeatedVerticalWall;
6160 : } else {
6161 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = A2[iConvOrient][iDeltaTemp];
6162 : }
6163 0 : break;
6164 0 : case SurfaceClass::Window:
6165 : case SurfaceClass::GlassDoor:
6166 : case SurfaceClass::TDD_Diffuser:
6167 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::A2_Windows;
6168 0 : break;
6169 0 : default:
6170 0 : assert(false);
6171 : }
6172 :
6173 0 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6174 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for A2 surface named" + Surface(SurfNum).Name);
6175 : }
6176 :
6177 0 : break;
6178 :
6179 567084 : case InConvFlowRegime::A3:
6180 :
6181 567084 : switch (Surface(SurfNum).Class) {
6182 356484 : case SurfaceClass::Wall:
6183 : case SurfaceClass::Door:
6184 : case SurfaceClass::Roof:
6185 : case SurfaceClass::Floor:
6186 356484 : state.dataSurface->SurfIntConvClassification(SurfNum) = A3[iConvOrient][iDeltaTemp];
6187 356484 : break;
6188 40500 : case SurfaceClass::IntMass:
6189 : // assume horizontal upwards
6190 40500 : state.dataSurface->SurfIntConvClassification(SurfNum) = A3[int(ConvectionConstants::SurfConvOrientation::HorizontalUp)][iDeltaTemp];
6191 40500 : break;
6192 170100 : case SurfaceClass::Window:
6193 : case SurfaceClass::GlassDoor:
6194 : case SurfaceClass::TDD_Diffuser:
6195 170100 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::A3_Windows;
6196 170100 : break;
6197 0 : default:
6198 0 : assert(false);
6199 : }
6200 :
6201 567084 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6202 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for A3 surface named" + Surface(SurfNum).Name);
6203 : }
6204 :
6205 567084 : break;
6206 :
6207 0 : case InConvFlowRegime::B:
6208 :
6209 0 : switch (Surface(SurfNum).Class) {
6210 0 : case SurfaceClass::Wall:
6211 : case SurfaceClass::Door:
6212 0 : if (state.dataSurface->SurfIntConvSurfGetsRadiantHeat(SurfNum)) {
6213 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::B_VertWallsNearHeat;
6214 : } else {
6215 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = B[iConvOrient][iDeltaTemp];
6216 : }
6217 0 : break;
6218 0 : case SurfaceClass::Roof:
6219 : case SurfaceClass::Floor:
6220 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = B[iConvOrient][iDeltaTemp];
6221 0 : break;
6222 0 : case SurfaceClass::Window:
6223 : case SurfaceClass::GlassDoor:
6224 : case SurfaceClass::TDD_Diffuser:
6225 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::B_Windows;
6226 0 : break;
6227 0 : case SurfaceClass::IntMass:
6228 : // assume horizontal upwards
6229 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = B[int(ConvectionConstants::SurfConvOrientation::HorizontalUp)][iDeltaTemp];
6230 0 : break;
6231 0 : default:
6232 0 : assert(false);
6233 : }
6234 :
6235 0 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6236 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for B surface named" + Surface(SurfNum).Name);
6237 : }
6238 0 : break;
6239 :
6240 0 : case InConvFlowRegime::C:
6241 :
6242 0 : switch (Surface(SurfNum).Class) {
6243 0 : case SurfaceClass::Wall:
6244 : case SurfaceClass::Door:
6245 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::C_Walls;
6246 0 : break;
6247 0 : case SurfaceClass::Roof:
6248 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::C_Ceiling;
6249 0 : break;
6250 0 : case SurfaceClass::Floor:
6251 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::C_Floor;
6252 0 : break;
6253 0 : case SurfaceClass::Window:
6254 : case SurfaceClass::GlassDoor:
6255 : case SurfaceClass::TDD_Diffuser:
6256 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::C_Windows;
6257 0 : break;
6258 0 : case SurfaceClass::IntMass:
6259 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::C_Floor;
6260 0 : break;
6261 0 : default:
6262 0 : assert(false);
6263 : }
6264 :
6265 0 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6266 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for C surface named" + Surface(SurfNum).Name);
6267 : }
6268 :
6269 0 : break;
6270 :
6271 0 : case InConvFlowRegime::D:
6272 :
6273 0 : switch (Surface(SurfNum).Class) {
6274 0 : case SurfaceClass::Wall:
6275 : case SurfaceClass::Door:
6276 : case SurfaceClass::Roof:
6277 : case SurfaceClass::Floor:
6278 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = D[iConvOrient][iDeltaTemp];
6279 0 : break;
6280 0 : case SurfaceClass::Window:
6281 : case SurfaceClass::GlassDoor:
6282 : case SurfaceClass::TDD_Diffuser:
6283 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::D_Windows;
6284 0 : break;
6285 0 : case SurfaceClass::IntMass:
6286 : // assume horizontal upwards.
6287 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = D[int(ConvectionConstants::SurfConvOrientation::HorizontalUp)][iDeltaTemp];
6288 0 : break;
6289 0 : default:
6290 0 : assert(false);
6291 : }
6292 :
6293 0 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6294 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for D surface named" + Surface(SurfNum).Name);
6295 : }
6296 :
6297 0 : break;
6298 :
6299 0 : case InConvFlowRegime::E:
6300 :
6301 : {
6302 0 : Real64 deltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
6303 :
6304 0 : switch (Surface(SurfNum).Class) {
6305 0 : case SurfaceClass::Wall:
6306 : case SurfaceClass::Door:
6307 0 : switch (FlowRegimeStack[PriorityEquipOn]) {
6308 0 : case InConvFlowRegime::C:
6309 : // assume forced flow is down along wall (ceiling diffuser)
6310 0 : if (deltaTemp > 0.0) { // surface is hotter so plume upwards and forces oppose
6311 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_OpposFlowWalls;
6312 : } else { // surface is cooler so plume down and forces assist
6313 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_AssistFlowWalls;
6314 : }
6315 0 : break;
6316 0 : case InConvFlowRegime::D:
6317 : // assume forced flow is upward along wall (perimeter zone HVAC with fan)
6318 0 : if (deltaTemp > 0.0) { // surface is hotter so plume up and forces assist
6319 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_AssistFlowWalls;
6320 : } else { // surface is cooler so plume downward and forces oppose
6321 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_OpposFlowWalls;
6322 : }
6323 0 : break;
6324 0 : default:
6325 0 : assert(false);
6326 : }
6327 :
6328 0 : break;
6329 :
6330 0 : case SurfaceClass::Roof:
6331 0 : if (deltaTemp > 0.0) { // surface is hotter so stable
6332 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_StableCeiling;
6333 : } else {
6334 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_UnstableCeiling;
6335 : }
6336 0 : break;
6337 0 : case SurfaceClass::Floor:
6338 0 : if (deltaTemp > 0.0) { // surface is hotter so unstable
6339 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_UnstableFloor;
6340 : } else {
6341 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_StableFloor;
6342 : }
6343 0 : break;
6344 0 : case SurfaceClass::Window:
6345 : case SurfaceClass::GlassDoor:
6346 : case SurfaceClass::TDD_Diffuser:
6347 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_Windows;
6348 0 : break;
6349 0 : case SurfaceClass::IntMass:
6350 0 : if (deltaTemp > 0.0) {
6351 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_UnstableFloor;
6352 : } else {
6353 0 : state.dataSurface->SurfIntConvClassification(SurfNum) = ConvectionConstants::InConvClass::E_StableFloor;
6354 : }
6355 0 : break;
6356 0 : default:
6357 0 : assert(false);
6358 : }
6359 :
6360 0 : if (state.dataSurface->SurfIntConvClassification(SurfNum) == ConvectionConstants::InConvClass::Invalid) {
6361 0 : ShowSevereError(state, "DynamicIntConvSurfaceClassification: failed to resolve Hc model for E surface named " + Surface(SurfNum).Name);
6362 : }
6363 :
6364 0 : break;
6365 : }
6366 :
6367 0 : default:
6368 0 : ShowSevereError(state,
6369 0 : "DynamicIntConvSurfaceClassification: failed to determine zone flow regime for surface named " + Surface(SurfNum).Name);
6370 : }
6371 :
6372 : // Set report var after surface has been classified
6373 567084 : state.dataSurface->SurfIntConvClassificationRpt(SurfNum) =
6374 567084 : ConvectionConstants::InConvClassReportVals[static_cast<int>(state.dataSurface->SurfIntConvClassification(SurfNum))];
6375 567084 : }
6376 :
6377 567084 : void MapIntConvClassificationToHcModels(EnergyPlusData &state, int const SurfNum) // surface pointer index
6378 : {
6379 :
6380 : // SUBROUTINE INFORMATION:
6381 : // AUTHOR Brent Griffith
6382 : // DATE WRITTEN Aug 2010
6383 : // MODIFIED na
6384 : // RE-ENGINEERED na
6385 :
6386 : // PURPOSE OF THIS SUBROUTINE:
6387 : // Map Hc model equation data from central structure to surface structure
6388 :
6389 : // METHODOLOGY EMPLOYED:
6390 : // Long case statement depends on surface classification determined in DynamicIntConvSurfaceClassification
6391 : // then simply map data stored in InsideFaceAdaptiveConvectionAlgo into the surface's structure
6392 : // if model type is user-defined, also store the index to the user curve to be used.
6393 :
6394 567084 : switch (state.dataSurface->SurfIntConvClassification(SurfNum)) {
6395 0 : case ConvectionConstants::InConvClass::A1_VertWalls:
6396 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6397 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum;
6398 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6399 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6400 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallUserCurveNum;
6401 : }
6402 0 : break;
6403 0 : case ConvectionConstants::InConvClass::A1_StableHoriz:
6404 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6405 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum;
6406 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6407 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6408 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizUserCurveNum;
6409 : }
6410 0 : break;
6411 0 : case ConvectionConstants::InConvClass::A1_UnstableHoriz:
6412 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6413 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum;
6414 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6415 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6416 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizUserCurveNum;
6417 : }
6418 0 : break;
6419 0 : case ConvectionConstants::InConvClass::A1_HeatedFloor:
6420 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6421 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum;
6422 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6423 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6424 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorUserCurveNum;
6425 : }
6426 0 : break;
6427 0 : case ConvectionConstants::InConvClass::A1_ChilledCeil:
6428 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6429 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum;
6430 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6431 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6432 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingUserCurveNum;
6433 : }
6434 0 : break;
6435 0 : case ConvectionConstants::InConvClass::A1_StableTilted:
6436 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6437 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum;
6438 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6439 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6440 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedUserCurveNum;
6441 : }
6442 0 : break;
6443 0 : case ConvectionConstants::InConvClass::A1_UnstableTilted:
6444 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6445 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum;
6446 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6447 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6448 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedUserCurveNum;
6449 : }
6450 0 : break;
6451 0 : case ConvectionConstants::InConvClass::A1_Windows:
6452 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6453 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum;
6454 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6455 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6456 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsUserCurveNum;
6457 : }
6458 0 : break;
6459 0 : case ConvectionConstants::InConvClass::A2_VertWallsNonHeated:
6460 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6461 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum;
6462 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6463 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6464 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallUserCurveNum;
6465 : }
6466 0 : break;
6467 0 : case ConvectionConstants::InConvClass::A2_HeatedVerticalWall:
6468 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6469 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum;
6470 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6471 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6472 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallUserCurveNum;
6473 : }
6474 0 : break;
6475 0 : case ConvectionConstants::InConvClass::A2_StableHoriz:
6476 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6477 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum;
6478 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6479 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6480 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizUserCurveNum;
6481 : }
6482 0 : break;
6483 0 : case ConvectionConstants::InConvClass::A2_UnstableHoriz:
6484 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6485 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum;
6486 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6487 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6488 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizUserCurveNum;
6489 : }
6490 0 : break;
6491 0 : case ConvectionConstants::InConvClass::A2_StableTilted:
6492 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6493 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum;
6494 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6495 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6496 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedUserCurveNum;
6497 : }
6498 0 : break;
6499 0 : case ConvectionConstants::InConvClass::A2_UnstableTilted:
6500 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6501 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum;
6502 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6503 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6504 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedUserCurveNum;
6505 : }
6506 0 : break;
6507 0 : case ConvectionConstants::InConvClass::A2_Windows:
6508 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6509 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum;
6510 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6511 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6512 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsUserCurveNum;
6513 : }
6514 0 : break;
6515 164756 : case ConvectionConstants::InConvClass::A3_VertWalls:
6516 164756 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyVertWallEqNum;
6517 164756 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6518 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6519 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyVertWallUserCurveNum;
6520 : }
6521 164756 : break;
6522 77852 : case ConvectionConstants::InConvClass::A3_StableHoriz:
6523 77852 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6524 77852 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyStableHorizEqNum;
6525 77852 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6526 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6527 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyStableHorizUserCurveNum;
6528 : }
6529 77852 : break;
6530 121976 : case ConvectionConstants::InConvClass::A3_UnstableHoriz:
6531 121976 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6532 121976 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyUnstableHorizEqNum;
6533 121976 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6534 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6535 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyUnstableHorizUserCurveNum;
6536 : }
6537 121976 : break;
6538 7479 : case ConvectionConstants::InConvClass::A3_StableTilted:
6539 7479 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6540 7479 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyStableTiltedEqNum;
6541 7479 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6542 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6543 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyStableTiltedUserCurveNum;
6544 : }
6545 7479 : break;
6546 24921 : case ConvectionConstants::InConvClass::A3_UnstableTilted:
6547 24921 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6548 24921 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyUnstableTiltedEqNum;
6549 24921 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6550 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6551 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyUnstableTiltedUserCurveNum;
6552 : }
6553 24921 : break;
6554 170100 : case ConvectionConstants::InConvClass::A3_Windows:
6555 170100 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyWindowsEqNum;
6556 170100 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6557 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6558 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBuoyWindowsUserCurveNum;
6559 : }
6560 170100 : break;
6561 0 : case ConvectionConstants::InConvClass::B_VertWalls:
6562 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6563 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum;
6564 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6565 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6566 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallUserCurveNum;
6567 : }
6568 0 : break;
6569 0 : case ConvectionConstants::InConvClass::B_VertWallsNearHeat:
6570 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6571 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum;
6572 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6573 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6574 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterUserCurveNum;
6575 : }
6576 0 : break;
6577 0 : case ConvectionConstants::InConvClass::B_StableHoriz:
6578 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6579 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum;
6580 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6581 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6582 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizUserCurveNum;
6583 : }
6584 0 : break;
6585 0 : case ConvectionConstants::InConvClass::B_UnstableHoriz:
6586 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6587 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum;
6588 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6589 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6590 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizUserCurveNum;
6591 : }
6592 0 : break;
6593 0 : case ConvectionConstants::InConvClass::B_StableTilted:
6594 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6595 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum;
6596 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6597 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6598 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedUserCurveNum;
6599 : }
6600 0 : break;
6601 0 : case ConvectionConstants::InConvClass::B_UnstableTilted:
6602 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6603 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum;
6604 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6605 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6606 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedUserCurveNum;
6607 : }
6608 0 : break;
6609 0 : case ConvectionConstants::InConvClass::B_Windows:
6610 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6611 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum;
6612 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6613 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6614 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsUserCurveNum;
6615 : }
6616 0 : break;
6617 0 : case ConvectionConstants::InConvClass::C_Walls:
6618 0 : if ((state.dataSurface->SurfIntConvZonePerimLength(SurfNum) == 0.0) &&
6619 0 : (state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum ==
6620 : ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserWalls)) {
6621 : // no perimeter, Goldstein Novolselac model not good so revert to fisher pedersen model
6622 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = ConvectionConstants::HcInt_FisherPedersenCeilDiffuserWalls;
6623 : } else {
6624 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum;
6625 : }
6626 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6627 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6628 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallUserCurveNum;
6629 : }
6630 0 : break;
6631 0 : case ConvectionConstants::InConvClass::C_Ceiling:
6632 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum;
6633 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6634 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6635 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingUserCurveNum;
6636 : }
6637 0 : break;
6638 0 : case ConvectionConstants::InConvClass::C_Floor:
6639 0 : if ((state.dataSurface->SurfIntConvZonePerimLength(SurfNum) == 0.0) &&
6640 0 : (state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum ==
6641 : ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserFloor)) {
6642 : // no perimeter, Goldstein Novolselac model not good so revert to fisher pedersen model
6643 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = ConvectionConstants::HcInt_FisherPedersenCeilDiffuserFloor;
6644 : } else {
6645 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum;
6646 : }
6647 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6648 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6649 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorUserCurveNum;
6650 : }
6651 0 : break;
6652 0 : case ConvectionConstants::InConvClass::C_Windows:
6653 0 : if ((state.dataSurface->SurfIntConvZonePerimLength(SurfNum) == 0.0) &&
6654 0 : (state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum ==
6655 : ConvectionConstants::HcInt_GoldsteinNovoselacCeilingDiffuserWindow)) {
6656 : // no perimeter, Goldstein Novolselac model not good so revert to ISO15099
6657 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = ConvectionConstants::HcInt_ISO15099Windows;
6658 : } else {
6659 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6660 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum;
6661 : }
6662 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6663 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6664 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsUserCurveNum;
6665 : }
6666 0 : break;
6667 0 : case ConvectionConstants::InConvClass::D_Walls:
6668 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum;
6669 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6670 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6671 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallUserCurveNum;
6672 : }
6673 0 : break;
6674 0 : case ConvectionConstants::InConvClass::D_StableHoriz:
6675 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6676 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum;
6677 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6678 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6679 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizUserCurveNum;
6680 : }
6681 0 : break;
6682 0 : case ConvectionConstants::InConvClass::D_UnstableHoriz:
6683 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6684 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum;
6685 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6686 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6687 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizUserCurveNum;
6688 : }
6689 0 : break;
6690 0 : case ConvectionConstants::InConvClass::D_StableTilted:
6691 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6692 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum;
6693 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6694 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6695 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedUserCurveNum;
6696 : }
6697 0 : break;
6698 0 : case ConvectionConstants::InConvClass::D_UnstableTilted:
6699 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6700 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum;
6701 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6702 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6703 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedUserCurveNum;
6704 : }
6705 0 : break;
6706 0 : case ConvectionConstants::InConvClass::D_Windows:
6707 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum;
6708 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6709 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6710 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsUserCurveNum;
6711 : }
6712 0 : break;
6713 0 : case ConvectionConstants::InConvClass::E_AssistFlowWalls:
6714 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6715 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBuoyAssistingFlowWallEqNum;
6716 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6717 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6718 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBuoyAssistingFlowWallUserCurveNum;
6719 : }
6720 0 : break;
6721 0 : case ConvectionConstants::InConvClass::E_OpposFlowWalls:
6722 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6723 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBuoyOpposingFlowWallEqNum;
6724 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6725 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6726 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBuoyOpposingFlowWallUserCurveNum;
6727 : }
6728 0 : break;
6729 0 : case ConvectionConstants::InConvClass::E_StableFloor:
6730 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum;
6731 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6732 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6733 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorUserCurveNum;
6734 : }
6735 0 : break;
6736 0 : case ConvectionConstants::InConvClass::E_UnstableFloor:
6737 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum;
6738 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6739 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6740 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorUserCurveNum;
6741 : }
6742 0 : break;
6743 0 : case ConvectionConstants::InConvClass::E_StableCeiling:
6744 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum;
6745 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6746 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6747 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingUserCurveNum;
6748 : }
6749 0 : break;
6750 0 : case ConvectionConstants::InConvClass::E_UnstableCeiling:
6751 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) =
6752 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum;
6753 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6754 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6755 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingUserCurveNum;
6756 : }
6757 0 : break;
6758 0 : case ConvectionConstants::InConvClass::E_Windows:
6759 0 : state.dataSurface->SurfIntConvHcModelEq(SurfNum) = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum;
6760 0 : if (state.dataSurface->SurfIntConvHcModelEq(SurfNum) == ConvectionConstants::HcInt_UserCurve) {
6761 0 : state.dataSurface->SurfIntConvHcUserCurveIndex(SurfNum) =
6762 0 : state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsUserCurveNum;
6763 : }
6764 0 : break;
6765 0 : default:
6766 0 : assert(false);
6767 : }
6768 567084 : }
6769 :
6770 8100 : void CalcUserDefinedInsideHcModel(EnergyPlusData &state, int const SurfNum, int const UserCurveNum, Real64 &Hc)
6771 : {
6772 :
6773 : // SUBROUTINE INFORMATION:
6774 : // AUTHOR Brent Griffith
6775 : // DATE WRITTEN Aug 2010
6776 : // MODIFIED na
6777 : // RE-ENGINEERED na
6778 :
6779 : // PURPOSE OF THIS SUBROUTINE:
6780 : // calculate user-defined convection correlations for inside face
6781 :
6782 : // METHODOLOGY EMPLOYED:
6783 : // call curve objects to evaluate user's model equation
6784 : // prepare independent parameters for x values
6785 :
6786 : // Using/Aliasing
6787 : using namespace DataZoneEquipment;
6788 : using Curve::CurveValue;
6789 : using Psychrometrics::PsyRhoAirFnPbTdbW;
6790 : using Psychrometrics::PsyWFnTdpPb;
6791 :
6792 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
6793 : Real64 tmpAirTemp;
6794 : Real64 SupplyAirTemp;
6795 : Real64 AirChangeRate;
6796 : int ZoneNum;
6797 : int ZoneNode;
6798 : int EquipNum;
6799 : Real64 SumMdotTemp;
6800 : Real64 SumMdot;
6801 : Real64 AirDensity;
6802 : int thisZoneInletNode;
6803 :
6804 8100 : auto &Zone(state.dataHeatBal->Zone);
6805 8100 : auto &Surface(state.dataSurface->Surface);
6806 :
6807 8100 : ZoneNum = Surface(SurfNum).Zone;
6808 8100 : SumMdotTemp = 0.0;
6809 8100 : SumMdot = 0.0;
6810 8100 : SupplyAirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
6811 8100 : if (Zone(ZoneNum).IsControlled) {
6812 8100 : ZoneNode = Zone(ZoneNum).SystemZoneNodeNumber;
6813 32400 : AirDensity = PsyRhoAirFnPbTdbW(state,
6814 8100 : state.dataEnvrn->OutBaroPress,
6815 8100 : state.dataLoopNodes->Node(ZoneNode).Temp,
6816 16200 : PsyWFnTdpPb(state, state.dataLoopNodes->Node(ZoneNode).Temp, state.dataEnvrn->OutBaroPress));
6817 8100 : AirChangeRate = (state.dataLoopNodes->Node(ZoneNode).MassFlowRate * DataGlobalConstants::SecInHour) / (AirDensity * Zone(ZoneNum).Volume);
6818 8100 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex > 0) {
6819 16200 : for (EquipNum = 1;
6820 16200 : EquipNum <= state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex).NumOfEquipTypes;
6821 : ++EquipNum) {
6822 16200 : if (allocated(state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
6823 8100 : .EquipData(EquipNum)
6824 : .OutletNodeNums)) {
6825 8064 : thisZoneInletNode = state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ZoneNum).EquipListIndex)
6826 4032 : .EquipData(EquipNum)
6827 4032 : .OutletNodeNums(1);
6828 4032 : if ((thisZoneInletNode > 0) && (state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate > 0.0)) {
6829 3119 : SumMdotTemp += state.dataLoopNodes->Node(thisZoneInletNode).MassFlowRate * state.dataLoopNodes->Node(thisZoneInletNode).Temp;
6830 : }
6831 : }
6832 : }
6833 : }
6834 8100 : if (SumMdot > 0.0) {
6835 0 : SupplyAirTemp = SumMdotTemp / SumMdot; // mass flow weighted inlet temperature
6836 : }
6837 : }
6838 :
6839 8100 : auto &UserCurve = state.dataConvectionCoefficient->HcInsideUserCurve(UserCurveNum);
6840 :
6841 8100 : switch (UserCurve.ReferenceTempType) {
6842 8100 : case ConvectionConstants::RefTemp::MeanAirTemp:
6843 8100 : tmpAirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT;
6844 8100 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp;
6845 8100 : break;
6846 0 : case ConvectionConstants::RefTemp::AdjacentAirTemp:
6847 0 : tmpAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum);
6848 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
6849 0 : break;
6850 0 : case ConvectionConstants::RefTemp::SupplyAirTemp:
6851 0 : tmpAirTemp = SupplyAirTemp;
6852 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneSupplyAirTemp;
6853 0 : break;
6854 0 : default:
6855 0 : assert(false);
6856 : }
6857 :
6858 8100 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
6859 :
6860 8100 : Real64 HcFnTempDiff(0.0), HcFnTempDiffDivHeight(0.0), HcFnACH(0.0), HcFnACHDivPerimLength(0.0);
6861 16200 : Kiva::ConvectionAlgorithm HcFnTempDiffFn(KIVA_CONST_CONV(0.0)), HcFnTempDiffDivHeightFn(KIVA_CONST_CONV(0.0));
6862 8100 : if (UserCurve.HcFnTempDiffCurveNum > 0) {
6863 8100 : HcFnTempDiff =
6864 16200 : CurveValue(state, UserCurve.HcFnTempDiffCurveNum, std::abs(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - tmpAirTemp));
6865 8100 : HcFnTempDiffFn = [&](double Tsurf, double Tamb, double, double, double) -> double {
6866 0 : return CurveValue(state, UserCurve.HcFnTempDiffCurveNum, std::abs(Tsurf - Tamb));
6867 16200 : };
6868 : }
6869 :
6870 8100 : if (UserCurve.HcFnTempDiffDivHeightCurveNum > 0) {
6871 0 : HcFnTempDiffDivHeight = CurveValue(
6872 : state,
6873 : UserCurve.HcFnTempDiffDivHeightCurveNum,
6874 0 : (std::abs(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - tmpAirTemp) / state.dataSurface->SurfIntConvZoneWallHeight(SurfNum)));
6875 0 : HcFnTempDiffDivHeightFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
6876 0 : return CurveValue(
6877 0 : state, UserCurve.HcFnTempDiffDivHeightCurveNum, std::abs(Tsurf - Tamb) / state.dataSurface->SurfIntConvZoneWallHeight(SurfNum));
6878 0 : };
6879 : }
6880 :
6881 8100 : if (UserCurve.HcFnACHCurveNum > 0) {
6882 0 : HcFnACH = CurveValue(state, UserCurve.HcFnACHCurveNum, AirChangeRate);
6883 : }
6884 :
6885 8100 : if (UserCurve.HcFnACHDivPerimLengthCurveNum > 0) {
6886 0 : HcFnACHDivPerimLength =
6887 0 : CurveValue(state, UserCurve.HcFnACHDivPerimLengthCurveNum, (AirChangeRate / state.dataSurface->SurfIntConvZonePerimLength(SurfNum)));
6888 : }
6889 :
6890 8100 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
6891 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in =
6892 0 : [=](double Tsurf, double Tamb, double HfTerm, double Roughness, double CosTilt) -> double {
6893 0 : return HcFnTempDiffFn(Tsurf, Tamb, HfTerm, Roughness, CosTilt) + HcFnTempDiffDivHeightFn(Tsurf, Tamb, HfTerm, Roughness, CosTilt) +
6894 0 : HcFnACH + HcFnACHDivPerimLength;
6895 0 : };
6896 0 : Hc = 0.0;
6897 : } else {
6898 8100 : Hc = HcFnTempDiff + HcFnTempDiffDivHeight + HcFnACH + HcFnACHDivPerimLength;
6899 : }
6900 8100 : }
6901 :
6902 8100 : void CalcUserDefinedOutsideHcModel(EnergyPlusData &state, int const SurfNum, int const UserCurveNum, Real64 &H)
6903 : {
6904 :
6905 : // SUBROUTINE INFORMATION:
6906 : // AUTHOR Brent Griffith
6907 : // DATE WRITTEN Aug 2010
6908 : // MODIFIED na
6909 : // RE-ENGINEERED na
6910 :
6911 : // PURPOSE OF THIS SUBROUTINE:
6912 : // calculate user-defined convection correlations for outside face
6913 :
6914 : // METHODOLOGY EMPLOYED:
6915 : // call curve objects to evaluate user's model equation
6916 : // prepare independent parameters for x values
6917 :
6918 : // Using/Aliasing
6919 : using Curve::CurveValue;
6920 :
6921 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
6922 : Real64 windVel;
6923 : Real64 Theta;
6924 : Real64 ThetaRad;
6925 :
6926 8100 : auto &UserCurve = state.dataConvectionCoefficient->HcOutsideUserCurve(UserCurveNum);
6927 8100 : auto &Surface(state.dataSurface->Surface);
6928 :
6929 8100 : switch (UserCurve.WindSpeedType) {
6930 0 : case ConvectionConstants::RefWind::WeatherFile:
6931 0 : windVel = state.dataEnvrn->WindSpeed;
6932 0 : break;
6933 8100 : case ConvectionConstants::RefWind::AtZ:
6934 8100 : windVel = state.dataSurface->SurfOutWindSpeed(SurfNum);
6935 8100 : break;
6936 0 : case ConvectionConstants::RefWind::ParallelComp:
6937 : // WindSpeed , WindDir, surface Azimuth
6938 0 : Theta = CalcWindSurfaceTheta(state.dataEnvrn->WindDir, Surface(SurfNum).Azimuth);
6939 0 : ThetaRad = Theta * DataGlobalConstants::DegToRadians;
6940 0 : break;
6941 0 : case ConvectionConstants::RefWind::ParallelCompAtZ:
6942 : // Surface WindSpeed , Surface WindDir, surface Azimuth
6943 0 : Theta = CalcWindSurfaceTheta(state.dataSurface->SurfOutWindDir(SurfNum), Surface(SurfNum).Azimuth);
6944 0 : ThetaRad = Theta * DataGlobalConstants::DegToRadians;
6945 0 : windVel = std::cos(ThetaRad) * state.dataSurface->SurfOutWindSpeed(SurfNum);
6946 0 : break;
6947 0 : default:
6948 0 : assert(false);
6949 : }
6950 :
6951 16200 : Kiva::ForcedConvectionTerm HfFnWindSpeedFn(KIVA_HF_DEF);
6952 16200 : Kiva::ConvectionAlgorithm HnFnTempDiffFn(KIVA_CONST_CONV(0.0)), HnFnTempDiffDivHeightFn(KIVA_CONST_CONV(0.0));
6953 :
6954 8100 : Real64 HfFnWindSpeed(0.0), HnFnTempDiff(0.0), HnFnTempDiffDivHeight(0.0);
6955 8100 : if (UserCurve.HfFnWindSpeedCurveNum > 0) {
6956 8100 : HfFnWindSpeed = CurveValue(state, UserCurve.HfFnWindSpeedCurveNum, windVel);
6957 8100 : HfFnWindSpeedFn = [&](double, double, double, double windSpeed) -> double {
6958 0 : return CurveValue(state, UserCurve.HfFnWindSpeedCurveNum, windSpeed);
6959 16200 : };
6960 : }
6961 :
6962 8100 : if (UserCurve.HnFnTempDiffCurveNum > 0) {
6963 0 : HnFnTempDiff = CurveValue(state,
6964 : UserCurve.HnFnTempDiffCurveNum,
6965 0 : std::abs(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - state.dataSurface->SurfOutDryBulbTemp(SurfNum)));
6966 0 : HnFnTempDiffFn = [&](double Tsurf, double Tamb, double, double, double) -> double {
6967 0 : return CurveValue(state, UserCurve.HnFnTempDiffCurveNum, std::abs(Tsurf - Tamb));
6968 0 : };
6969 : }
6970 :
6971 8100 : if (UserCurve.HnFnTempDiffDivHeightCurveNum > 0) {
6972 0 : if (state.dataSurface->SurfOutConvFaceHeight(SurfNum) > 0.0) {
6973 0 : HnFnTempDiffDivHeight =
6974 0 : CurveValue(state,
6975 : UserCurve.HnFnTempDiffDivHeightCurveNum,
6976 0 : ((std::abs(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - state.dataSurface->SurfOutDryBulbTemp(SurfNum))) /
6977 0 : state.dataSurface->SurfOutConvFaceHeight(SurfNum)));
6978 0 : HnFnTempDiffDivHeightFn = [=, &state](double Tsurf, double Tamb, double, double, double) -> double {
6979 0 : return CurveValue(
6980 0 : state, UserCurve.HnFnTempDiffDivHeightCurveNum, ((std::abs(Tsurf - Tamb)) / state.dataSurface->SurfOutConvFaceHeight(SurfNum)));
6981 0 : };
6982 : }
6983 : }
6984 :
6985 8100 : if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
6986 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].f = HfFnWindSpeedFn;
6987 0 : state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].out =
6988 0 : [=](double Tsurf, double Tamb, double HfTerm, double Roughness, double CosTilt) -> double {
6989 0 : return HnFnTempDiffFn(Tsurf, Tamb, HfTerm, Roughness, CosTilt) + HnFnTempDiffDivHeightFn(Tsurf, Tamb, HfTerm, Roughness, CosTilt) +
6990 0 : HfTerm;
6991 0 : };
6992 : }
6993 8100 : H = HfFnWindSpeed + HnFnTempDiff + HnFnTempDiffDivHeight;
6994 8100 : }
6995 :
6996 : //** Begin catalog of Hc equation functions. **** !*************************************************
6997 :
6998 189111 : Real64 CalcFisherPedersenCeilDiffuserFloor(EnergyPlusData &state,
6999 : Real64 const ACH, // [1/hr] air system air change rate
7000 : Real64 const Tsurf,
7001 : Real64 const Tair,
7002 : Real64 const cosTilt,
7003 : Real64 const humRat,
7004 : Real64 const height,
7005 : bool const isWindow)
7006 : {
7007 :
7008 : // AUTHOR: Brent Griffith (Aug 2010)
7009 : // PURPOSE OF THIS FUNCTION: Calculate the model equation by Fisher and Pedersen for floors with ceiling diffusers
7010 : // REFERENCE: Fisher, D.E. and C.O. Pedersen, Convective Heat Transfer in Building Energy and Thermal Load Calculations,
7011 : // ASHRAE Transactions, vol. 103, Pt. 2, 1997, p.13
7012 :
7013 : Real64 Hforced;
7014 :
7015 189111 : if (ACH >= 3.0) {
7016 84722 : Hforced = 3.873 + 0.082 * std::pow(ACH, 0.98);
7017 84722 : return Hforced;
7018 : } else { // Revert to purely natural convection
7019 104389 : Hforced = 4.11365377688938; // Value of Hforced when ACH=3
7020 104389 : return CalcFisherPedersenCeilDiffuserNatConv(state, Hforced, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow);
7021 : }
7022 : }
7023 :
7024 200763 : Real64 CalcFisherPedersenCeilDiffuserCeiling(EnergyPlusData &state,
7025 : Real64 const ACH, // [1/hr] air system air change rate
7026 : Real64 const Tsurf,
7027 : Real64 const Tair,
7028 : Real64 const cosTilt,
7029 : Real64 const humRat,
7030 : Real64 const height,
7031 : bool const isWindow)
7032 : {
7033 :
7034 : // AUTHOR: Brent Griffith (Aug 2010)
7035 : // PURPOSE OF THIS FUNCTION: Calculate the model equation by Fisher and Pedersen for floors with ceiling diffusers
7036 : // REFERENCE: Fisher, D.E. and C.O. Pedersen, Convective Heat Transfer in Building Energy and Thermal Load Calculations,
7037 : // ASHRAE Transactions, vol. 103, Pt. 2, 1997, p.13
7038 :
7039 : Real64 Hforced;
7040 :
7041 200763 : if (ACH >= 3.0) {
7042 90131 : Hforced = 2.234 + 4.099 * std::pow(ACH, 0.503);
7043 90131 : return Hforced;
7044 : } else { // Revert to purely natural convection
7045 110632 : Hforced = 9.35711423763866; // Value of Hforced when ACH=3
7046 110632 : return CalcFisherPedersenCeilDiffuserNatConv(state, Hforced, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow);
7047 : }
7048 : }
7049 :
7050 1525038 : Real64 CalcFisherPedersenCeilDiffuserWalls(EnergyPlusData &state,
7051 : Real64 const ACH, // [1/hr] air system air change rate
7052 : Real64 const Tsurf,
7053 : Real64 const Tair,
7054 : Real64 const cosTilt,
7055 : Real64 const humRat,
7056 : Real64 const height,
7057 : bool const isWindow)
7058 : {
7059 :
7060 : // AUTHOR: Brent Griffith (Aug 2010)
7061 : // PURPOSE OF THIS FUNCTION: Calculate the model equation by Fisher and Pedersen for floors with ceiling diffusers
7062 : // REFERENCE: Fisher, D.E. and C.O. Pedersen, Convective Heat Transfer in Building Energy and Thermal Load Calculations,
7063 : // ASHRAE Transactions, vol. 103, Pt. 2, 1997, p.13
7064 :
7065 : Real64 Hforced;
7066 :
7067 1525038 : if (ACH >= 3.0) {
7068 683842 : Hforced = 1.208 + 1.012 * std::pow(ACH, 0.604);
7069 683842 : return Hforced;
7070 : } else { // Revert to purely natural convection
7071 841196 : Hforced = 3.17299636062606; // Value of Hforced when ACH=3
7072 841196 : return CalcFisherPedersenCeilDiffuserNatConv(state, Hforced, ACH, Tsurf, Tair, cosTilt, humRat, height, isWindow);
7073 : }
7074 : }
7075 :
7076 1056217 : Real64 CalcFisherPedersenCeilDiffuserNatConv(EnergyPlusData &state,
7077 : Real64 const Hforced,
7078 : Real64 const ACH,
7079 : Real64 const Tsurf,
7080 : Real64 const Tair,
7081 : Real64 const cosTilt,
7082 : Real64 const humRat,
7083 : Real64 const height,
7084 : bool const isWindow)
7085 : {
7086 :
7087 : Real64 Hnatural;
7088 :
7089 1056217 : if (isWindow) { // Unlikely for a floor, but okay...
7090 306069 : Real64 const tilt = acos(cosTilt); // outward facing tilt
7091 306069 : Real64 const sinTilt = sin(tilt);
7092 306069 : Hnatural = CalcISO15099WindowIntConvCoeff(state, Tsurf, Tair, humRat, height, tilt, sinTilt);
7093 : } else {
7094 750148 : Hnatural = CalcASHRAETARPNatural(Tsurf, Tair, -cosTilt); // negative cosTilt because interior of surface
7095 : }
7096 1056217 : if (ACH <= 0.5) {
7097 911667 : return Hnatural;
7098 : } else {
7099 144550 : return Hnatural + ((Hforced - Hnatural) * ((ACH - 0.5) / 2.5)); // range for interpolation goes from ACH=0.5 to ACH=3.0 or a range of 2.5
7100 : }
7101 : }
7102 :
7103 103962 : Real64 CalcAlamdariHammondUnstableHorizontal(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7104 : Real64 const HydraulicDiameter // [m] characteristic size, = (4 * area) / perimeter
7105 : )
7106 : {
7107 :
7108 : // FUNCTION INFORMATION:
7109 : // AUTHOR Brent Griffith
7110 : // DATE WRITTEN Jul 2010
7111 : // MODIFIED na
7112 : // RE-ENGINEERED na
7113 :
7114 : // PURPOSE OF THIS FUNCTION:
7115 : // Calculate model equation for Alamdari and Hammond
7116 : // This function only for the Unstable heat flow direction for horizontal surfaces
7117 :
7118 : // METHODOLOGY EMPLOYED:
7119 : // isolate function for equation.
7120 :
7121 : // REFERENCES:
7122 : // Alamdari, F. and G.P. Hammond. 1983. Improved data correlations
7123 : // for buoyancy-driven convection in rooms. Building Services Engineering
7124 : // Research & Technology. Vol. 4, No. 3.
7125 :
7126 103962 : return std::pow(pow_6(1.4 * std::pow(std::abs(DeltaTemp) / HydraulicDiameter, ConvectionConstants::OneFourth)) + (1.63 * pow_2(DeltaTemp)),
7127 103962 : ConvectionConstants::OneSixth); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7128 : }
7129 :
7130 103962 : Real64 CalcAlamdariHammondUnstableHorizontal(EnergyPlusData &state,
7131 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7132 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7133 : int const SurfNum // for messages
7134 : )
7135 : {
7136 : Real64 Hn; // function result
7137 :
7138 103962 : if (HydraulicDiameter > 0.0) {
7139 103962 : Hn = CalcAlamdariHammondUnstableHorizontal(DeltaTemp, HydraulicDiameter);
7140 : } else {
7141 0 : Hn = 9.999;
7142 0 : if (state.dataConvectionCoefficient->AHUnstableHorizontalErrorIDX == 0) {
7143 0 : ShowSevereMessage(state, "CalcAlamdariHammondUnstableHorizontal: Convection model not evaluated (would divide by zero)");
7144 0 : ShowContinueError(state,
7145 0 : "Effective hydraulic diameter is zero, convection model not applicable for surface =" +
7146 0 : state.dataSurface->Surface(SurfNum).Name);
7147 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7148 : }
7149 0 : ShowRecurringSevereErrorAtEnd(
7150 : state,
7151 : "CalcAlamdariHammondUnstableHorizontal: Convection model not evaluated because zero hydraulic diameter and set to 9.999 [W/m2-K]",
7152 0 : state.dataConvectionCoefficient->AHUnstableHorizontalErrorIDX);
7153 : }
7154 :
7155 103962 : return Hn;
7156 : }
7157 :
7158 97147 : Real64 CalcAlamdariHammondStableHorizontal(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7159 : Real64 const HydraulicDiameter // [m] characteristic size, = (4 * area) / perimeter
7160 : )
7161 : {
7162 :
7163 : // FUNCTION INFORMATION:
7164 : // AUTHOR Brent Griffith
7165 : // DATE WRITTEN Jul 2010
7166 : // MODIFIED na
7167 : // RE-ENGINEERED na
7168 :
7169 : // PURPOSE OF THIS FUNCTION:
7170 : // Calculate model equation for Alamdari and Hammond
7171 : // This function only for the Stable heat flow direction for horizontal surfaces
7172 :
7173 : // METHODOLOGY EMPLOYED:
7174 : // isolate function for equation.
7175 :
7176 : // REFERENCES:
7177 : // Alamdari, F. and G.P. Hammond. 1983. Improved data correlations
7178 : // for buoyancy-driven convection in rooms. Building Services Engineering
7179 : // Research & Technology. Vol. 4, No. 3.
7180 :
7181 97147 : return 0.6 * std::pow(std::abs(DeltaTemp) / pow_2(HydraulicDiameter), ConvectionConstants::OneFifth);
7182 : }
7183 :
7184 74259 : Real64 CalcAlamdariHammondStableHorizontal(EnergyPlusData &state,
7185 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7186 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7187 : int const SurfNum // for messages
7188 : )
7189 : {
7190 :
7191 : Real64 Hn; // function result, natural convection Hc value
7192 :
7193 74259 : if (HydraulicDiameter > 0.0) {
7194 74259 : Hn = CalcAlamdariHammondStableHorizontal(DeltaTemp, HydraulicDiameter);
7195 : } else {
7196 0 : Hn = 9.999;
7197 0 : if (state.dataConvectionCoefficient->AHStableHorizontalErrorIDX == 0) {
7198 0 : ShowSevereMessage(state, "CalcAlamdariHammondStableHorizontal: Convection model not evaluated (would divide by zero)");
7199 0 : ShowContinueError(state,
7200 0 : "Effective hydraulic diameter is zero, convection model not applicable for surface =" +
7201 0 : state.dataSurface->Surface(SurfNum).Name);
7202 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7203 : }
7204 0 : ShowRecurringSevereErrorAtEnd(
7205 : state,
7206 : "CalcAlamdariHammondStableHorizontal: Convection model not evaluated because zero hydraulic diameter and set to 9.999 [W/m2-K]",
7207 0 : state.dataConvectionCoefficient->AHStableHorizontalErrorIDX);
7208 : }
7209 :
7210 74259 : return Hn;
7211 : }
7212 :
7213 0 : Real64 CalcAlamdariHammondVerticalWall(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7214 : Real64 const Height)
7215 : {
7216 :
7217 : // FUNCTION INFORMATION:
7218 : // AUTHOR Brent Griffith
7219 : // DATE WRITTEN Jul 2010
7220 : // MODIFIED na
7221 : // RE-ENGINEERED na
7222 :
7223 : // PURPOSE OF THIS FUNCTION:
7224 : // Calculate model equation for Alamdari and Hammond
7225 : // This function only for the vertical wall surfaces
7226 :
7227 : // METHODOLOGY EMPLOYED:
7228 : // isolate function for equation.
7229 :
7230 : // REFERENCES:
7231 : // Alamdari, F. and G.P. Hammond. 1983. Improved data correlations
7232 : // for buoyancy-driven convection in rooms. Building Services Engineering
7233 : // Research & Technology. Vol. 4, No. 3.
7234 :
7235 0 : return std::pow(pow_6(1.5 * std::pow(std::abs(DeltaTemp) / Height, ConvectionConstants::OneFourth)) + (1.23 * pow_2(DeltaTemp)),
7236 0 : ConvectionConstants::OneSixth); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7237 : }
7238 :
7239 0 : Real64 CalcAlamdariHammondVerticalWall(EnergyPlusData &state,
7240 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7241 : Real64 const Height, // [m] characteristic size, = zone height
7242 : int const SurfNum // for messages
7243 : )
7244 : {
7245 : // Return value
7246 : Real64 Hn; // function result, natural convection Hc value
7247 :
7248 0 : if (Height > 0.0) {
7249 0 : Hn = CalcAlamdariHammondVerticalWall(DeltaTemp, Height);
7250 : } else {
7251 0 : Hn = 9.999;
7252 0 : if (state.dataConvectionCoefficient->AHVerticalWallErrorIDX == 0) {
7253 0 : ShowSevereMessage(state, "CalcAlamdariHammondVerticalWall: Convection model not evaluated (would divide by zero)");
7254 0 : ShowContinueError(state,
7255 0 : "Effective hydraulic diameter is zero, convection model not applicable for surface =" +
7256 0 : state.dataSurface->Surface(SurfNum).Name);
7257 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7258 : }
7259 0 : ShowRecurringSevereErrorAtEnd(
7260 : state,
7261 : "CalcAlamdariHammondVerticalWall: Convection model not evaluated because zero hydraulic diameter and set to 9.999 [W/m2-K]",
7262 0 : state.dataConvectionCoefficient->AHVerticalWallErrorIDX);
7263 : }
7264 :
7265 0 : return Hn;
7266 : }
7267 :
7268 0 : Real64 CalcKhalifaEq3WallAwayFromHeat(Real64 const DeltaTemp) // [C] temperature difference between surface and air
7269 : {
7270 :
7271 : // FUNCTION INFORMATION:
7272 : // AUTHOR Brent Griffith
7273 : // DATE WRITTEN Jul 2010
7274 : // MODIFIED na
7275 : // RE-ENGINEERED na
7276 :
7277 : // PURPOSE OF THIS FUNCTION:
7278 : // Calculate model equation for Khalifa's Eq 3 for Walls Away From Heat
7279 :
7280 : // METHODOLOGY EMPLOYED:
7281 : // isolate function for equation.
7282 :
7283 : // REFERENCES:
7284 : // Khalifa AJN. 1989 Heat transfer processes in buildings. Ph.D. Thesis,
7285 : // University of Wales College of Cardiff, Cardiff, UK.
7286 : // Equations actually from Beausoleil-Morrison 2000 who referenced Khalifa
7287 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7288 : // air flow modeling within dynamic whole-building simulations.
7289 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7290 :
7291 : // Return value
7292 : Real64 Hc; // function result
7293 :
7294 0 : Hc = 2.07 * std::pow(std::abs(DeltaTemp), 0.23);
7295 :
7296 0 : return Hc;
7297 : }
7298 :
7299 0 : Real64 CalcKhalifaEq4CeilingAwayFromHeat(Real64 const DeltaTemp) // [C] temperature difference between surface and air
7300 : {
7301 :
7302 : // FUNCTION INFORMATION:
7303 : // AUTHOR Brent Griffith
7304 : // DATE WRITTEN Jul 2010
7305 : // MODIFIED na
7306 : // RE-ENGINEERED na
7307 :
7308 : // PURPOSE OF THIS FUNCTION:
7309 : // Calculate model equation for Khalifa's Eq 4 for Ceilings Away From Heat
7310 :
7311 : // METHODOLOGY EMPLOYED:
7312 : // isolate function for equation.
7313 :
7314 : // REFERENCES:
7315 : // Khalifa AJN. 1989 Heat transfer processes in buildings. Ph.D. Thesis,
7316 : // University of Wales College of Cardiff, Cardiff, UK.
7317 : // Equations actually from Beausoleil-Morrison 2000 who referenced Khalifa
7318 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7319 : // air flow modeling within dynamic whole-building simulations.
7320 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7321 :
7322 : // Return value
7323 : Real64 Hc; // function result
7324 :
7325 0 : Hc = 2.72 * std::pow(std::abs(DeltaTemp), 0.13);
7326 :
7327 0 : return Hc;
7328 : }
7329 :
7330 0 : Real64 CalcKhalifaEq5WallsNearHeat(Real64 const DeltaTemp) // [C] temperature difference between surface and air
7331 : {
7332 :
7333 : // FUNCTION INFORMATION:
7334 : // AUTHOR Brent Griffith
7335 : // DATE WRITTEN Jul 2010
7336 : // MODIFIED na
7337 : // RE-ENGINEERED na
7338 :
7339 : // PURPOSE OF THIS FUNCTION:
7340 : // Calculate model equation for Khalifa's Eq 5 for Walls near the heater
7341 :
7342 : // METHODOLOGY EMPLOYED:
7343 : // isolate function for equation.
7344 :
7345 : // REFERENCES:
7346 : // Khalifa AJN. 1989 Heat transfer processes in buildings. Ph.D. Thesis,
7347 : // University of Wales College of Cardiff, Cardiff, UK.
7348 : // Equations actually from Beausoleil-Morrison 2000 who referenced Khalifa
7349 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7350 : // air flow modeling within dynamic whole-building simulations.
7351 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7352 :
7353 : // Return value
7354 : Real64 Hc; // function result
7355 :
7356 0 : Hc = 1.98 * std::pow(std::abs(DeltaTemp), 0.32);
7357 :
7358 0 : return Hc;
7359 : }
7360 :
7361 0 : Real64 CalcKhalifaEq6NonHeatedWalls(Real64 const DeltaTemp) // [C] temperature difference between surface and air
7362 : {
7363 :
7364 : // FUNCTION INFORMATION:
7365 : // AUTHOR Brent Griffith
7366 : // DATE WRITTEN Jul 2010
7367 : // MODIFIED na
7368 : // RE-ENGINEERED na
7369 :
7370 : // PURPOSE OF THIS FUNCTION:
7371 : // Calculate model equation for Khalifa's Eq 6 for non-heated walls
7372 :
7373 : // METHODOLOGY EMPLOYED:
7374 : // isolate function for equation.
7375 :
7376 : // REFERENCES:
7377 : // Khalifa AJN. 1989 Heat transfer processes in buildings. Ph.D. Thesis,
7378 : // University of Wales College of Cardiff, Cardiff, UK.
7379 : // Equations actually from Beausoleil-Morrison 2000 who referenced Khalifa
7380 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7381 : // air flow modeling within dynamic whole-building simulations.
7382 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7383 :
7384 : // Return value
7385 : Real64 Hc; // function result
7386 :
7387 0 : Hc = 2.30 * std::pow(std::abs(DeltaTemp), 0.24);
7388 :
7389 0 : return Hc;
7390 : }
7391 :
7392 0 : Real64 CalcKhalifaEq7Ceiling(Real64 const DeltaTemp) // [C] temperature difference between surface and air
7393 : {
7394 :
7395 : // FUNCTION INFORMATION:
7396 : // AUTHOR Brent Griffith
7397 : // DATE WRITTEN Jul 2010
7398 : // MODIFIED na
7399 : // RE-ENGINEERED na
7400 :
7401 : // PURPOSE OF THIS FUNCTION:
7402 : // Calculate model equation for Khalifa's Eq 7 for ceilings
7403 :
7404 : // METHODOLOGY EMPLOYED:
7405 : // isolate function for equation.
7406 :
7407 : // REFERENCES:
7408 : // Khalifa AJN. 1989 Heat transfer processes in buildings. Ph.D. Thesis,
7409 : // University of Wales College of Cardiff, Cardiff, UK.
7410 : // Equations actually from Beausoleil-Morrison 2000 who referenced Khalifa
7411 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7412 : // air flow modeling within dynamic whole-building simulations.
7413 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7414 :
7415 : // Return value
7416 : Real64 Hc; // function result
7417 :
7418 0 : Hc = 3.10 * std::pow(std::abs(DeltaTemp), 0.17);
7419 :
7420 0 : return Hc;
7421 : }
7422 :
7423 0 : Real64 CalcAwbiHattonHeatedFloor(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7424 : Real64 const HydraulicDiameter // [m] characteristic size, = (4 * area) / perimeter
7425 : )
7426 : {
7427 :
7428 : // FUNCTION INFORMATION:
7429 : // AUTHOR Brent Griffith
7430 : // DATE WRITTEN Jul 2010
7431 : // MODIFIED na
7432 : // RE-ENGINEERED na
7433 :
7434 : // PURPOSE OF THIS FUNCTION:
7435 : // Calculate model equation for Awbi and Hatton for heated floors
7436 :
7437 : // METHODOLOGY EMPLOYED:
7438 : // isolate function for equation.
7439 : // apply numerical protection for low values of hydraulic diameter
7440 :
7441 : // REFERENCES:
7442 : // Awbi, H.B. and A. Hatton. 1999. Natural convection from heated room surfaces.
7443 : // Energy and Buildings 30 (1999) 233-244.
7444 : // This function is for equation 15 in the reference
7445 :
7446 : // Return value
7447 : Real64 Hc; // function result
7448 :
7449 0 : Real64 const pow_fac(2.175 / std::pow(1.0, 0.076));
7450 :
7451 0 : if (HydraulicDiameter > 1.0) {
7452 0 : Hc = 2.175 * std::pow(std::abs(DeltaTemp), 0.308) / std::pow(HydraulicDiameter, 0.076);
7453 : } else {
7454 0 : Hc = pow_fac * std::pow(std::abs(DeltaTemp), 0.308);
7455 : }
7456 :
7457 0 : return Hc;
7458 : }
7459 :
7460 0 : Real64 CalcAwbiHattonHeatedWall(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7461 : Real64 const HydraulicDiameter // [m] characteristic size, = (4 * area) / perimeter
7462 : )
7463 : {
7464 :
7465 : // FUNCTION INFORMATION:
7466 : // AUTHOR Brent Griffith
7467 : // DATE WRITTEN Jul 2010
7468 : // MODIFIED na
7469 : // RE-ENGINEERED na
7470 :
7471 : // PURPOSE OF THIS FUNCTION:
7472 : // Calculate model equation for Awbi and Hatton for heated walls
7473 :
7474 : // METHODOLOGY EMPLOYED:
7475 : // isolate function for equation.
7476 :
7477 : // REFERENCES:
7478 : // Awbi, H.B. and A. Hatton. 1999. Natural convection from heated room surfaces.
7479 : // Energy and Buildings 30 (1999) 233-244.
7480 : // This function is for equation 12 in the reference
7481 :
7482 : // Return value
7483 : Real64 Hc; // function result
7484 :
7485 0 : if (HydraulicDiameter > 1.0) {
7486 0 : Hc = 1.823 * std::pow(std::abs(DeltaTemp), 0.293) / std::pow(HydraulicDiameter, 0.121);
7487 : } else {
7488 0 : Hc = 1.823 * std::pow(std::abs(DeltaTemp), 0.293) / std::pow(1.0, 0.121);
7489 : }
7490 :
7491 0 : return Hc;
7492 : }
7493 :
7494 0 : Real64 CalcBeausoleilMorrisonMixedAssistedWall(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7495 : Real64 const Height, // [m] characteristic size
7496 : Real64 const SurfTemp, // [C] surface temperature
7497 : Real64 const SupplyAirTemp, // [C] temperature of supply air into zone
7498 : Real64 const AirChangeRate // [ACH] [1/hour] supply air ACH for zone
7499 : )
7500 : {
7501 :
7502 : // FUNCTION INFORMATION:
7503 : // AUTHOR Brent Griffith
7504 : // DATE WRITTEN Jul 2010
7505 : // MODIFIED na
7506 : // RE-ENGINEERED na
7507 :
7508 : // PURPOSE OF THIS FUNCTION:
7509 : // Calculate model equation Beausoleil-Morrison's mixed flow regime
7510 : // with mechanical and buoyancy forces assisting each other along a Wall
7511 :
7512 : // METHODOLOGY EMPLOYED:
7513 : // isolate function for equation.
7514 :
7515 : // REFERENCES:
7516 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7517 : // air flow modeling within dynamic whole-building simulations.
7518 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7519 :
7520 : Real64 cofpow =
7521 0 : std::sqrt(pow_6(1.5 * std::pow(std::abs(DeltaTemp) / Height, ConvectionConstants::OneFourth)) +
7522 0 : std::pow(1.23 * pow_2(DeltaTemp), ConvectionConstants::OneSixth)) +
7523 0 : pow_3(((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) *
7524 0 : (-0.199 + 0.190 * std::pow(AirChangeRate,
7525 0 : 0.8))); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7526 0 : Real64 Hc = std::pow(std::abs(cofpow),
7527 0 : ConvectionConstants::OneThird); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7528 0 : if (cofpow < 0.0) {
7529 0 : Hc = -Hc;
7530 : }
7531 0 : return Hc;
7532 : }
7533 :
7534 0 : Real64 CalcBeausoleilMorrisonMixedAssistedWall(EnergyPlusData &state,
7535 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7536 : Real64 const Height, // [m] characteristic size
7537 : Real64 const SurfTemp, // [C] surface temperature
7538 : int const ZoneNum // index of zone for messaging
7539 : )
7540 : {
7541 0 : auto &Zone(state.dataHeatBal->Zone);
7542 :
7543 0 : if ((std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff) && (Height != 0.0)) {
7544 0 : Real64 SupplyAirTemp = CalcZoneSupplyAirTemp(state, ZoneNum);
7545 0 : Real64 AirChangeRate = CalcZoneSystemACH(state, ZoneNum);
7546 0 : return CalcBeausoleilMorrisonMixedAssistedWall(DeltaTemp, Height, SurfTemp, SupplyAirTemp, AirChangeRate);
7547 : } else {
7548 0 : if (Height == 0.0) {
7549 0 : if (state.dataConvectionCoefficient->BMMixedAssistedWallErrorIDX2 == 0) {
7550 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedAssistedWall: Convection model not evaluated (would divide by zero)");
7551 0 : ShowContinueError(state, "Effective height is zero, convection model not applicable for zone named =" + Zone(ZoneNum).Name);
7552 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7553 : }
7554 :
7555 0 : ShowRecurringWarningErrorAtEnd(state,
7556 : "CalcBeausoleilMorrisonMixedAssistedWall: Convection model not evaluated because of zero height "
7557 : "and set to 9.999 [W/m2-K]",
7558 0 : state.dataConvectionCoefficient->BMMixedAssistedWallErrorIDX2);
7559 : }
7560 0 : if (DeltaTemp == 0.0 && !state.dataGlobal->WarmupFlag) {
7561 0 : if (state.dataConvectionCoefficient->BMMixedAssistedWallErrorIDX1 == 0) {
7562 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedAssistedWall: Convection model not evaluated (would divide by zero)");
7563 0 : ShowContinueError(state, "The temperature difference between surface and air is zero");
7564 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
7565 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7566 : }
7567 :
7568 0 : ShowRecurringWarningErrorAtEnd(state,
7569 : "CalcBeausoleilMorrisonMixedAssistedWall: Convection model not evaluated because of zero temperature "
7570 : "difference and set to 9.999 [W/m2-K]",
7571 0 : state.dataConvectionCoefficient->BMMixedAssistedWallErrorIDX1);
7572 : }
7573 0 : return 9.999;
7574 : }
7575 : }
7576 :
7577 0 : Real64 CalcBeausoleilMorrisonMixedOpposingWall(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7578 : Real64 const Height, // [m] characteristic size
7579 : Real64 const SurfTemp, // [C] surface temperature
7580 : Real64 const SupplyAirTemp, // [C] temperature of supply air into zone
7581 : Real64 const AirChangeRate // [ACH] [1/hour] supply air ACH for zone
7582 : )
7583 : {
7584 :
7585 : // FUNCTION INFORMATION:
7586 : // AUTHOR Brent Griffith
7587 : // DATE WRITTEN Jul 2010
7588 : // MODIFIED na
7589 : // RE-ENGINEERED na
7590 :
7591 : // PURPOSE OF THIS FUNCTION:
7592 : // Calculate model equation Beausoleil-Morrison's mixed flow regime
7593 : // with mechanical and buoyancy forces opposing each other along a Wall
7594 :
7595 : // METHODOLOGY EMPLOYED:
7596 : // isolate function for equation.
7597 :
7598 : // REFERENCES:
7599 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7600 : // air flow modeling within dynamic whole-building simulations.
7601 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7602 :
7603 : Real64 HcTmp1;
7604 : Real64 HcTmp2;
7605 : Real64 HcTmp3;
7606 : Real64 cofpow;
7607 :
7608 0 : if (Height != 0.0) {
7609 0 : cofpow = std::sqrt(pow_6(1.5 * std::pow(std::abs(DeltaTemp) / Height, ConvectionConstants::OneFourth)) +
7610 0 : std::pow(1.23 * pow_2(DeltaTemp), ConvectionConstants::OneSixth)) -
7611 0 : pow_3(((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) *
7612 0 : (-0.199 + 0.190 * std::pow(AirChangeRate,
7613 : 0.8))); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7614 0 : HcTmp1 = std::pow(std::abs(cofpow),
7615 : ConvectionConstants::OneThird); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7616 0 : if (cofpow < 0.0) {
7617 0 : HcTmp1 = -HcTmp1;
7618 : }
7619 :
7620 0 : HcTmp2 =
7621 0 : 0.8 * std::pow(pow_6(1.5 * std::pow(std::abs(DeltaTemp) / Height, ConvectionConstants::OneFourth)) + (1.23 * pow_2(DeltaTemp)),
7622 : ConvectionConstants::OneSixth); // Tuned pow_6( std::pow( std::abs( DeltaTemp ), OneThird ) ) changed to pow_2( DeltaTemp )
7623 : } else {
7624 0 : HcTmp1 = 9.999;
7625 0 : HcTmp2 = 9.999;
7626 : }
7627 0 : HcTmp3 = 0.8 * ((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) * (-0.199 + 0.190 * std::pow(AirChangeRate, 0.8));
7628 :
7629 0 : return max(max(HcTmp1, HcTmp2), HcTmp3);
7630 : }
7631 :
7632 0 : Real64 CalcBeausoleilMorrisonMixedOpposingWall(EnergyPlusData &state,
7633 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7634 : Real64 const Height, // [m] characteristic size
7635 : Real64 const SurfTemp, // [C] surface temperature
7636 : int const ZoneNum // index of zone for messaging
7637 : )
7638 : {
7639 0 : auto &Zone(state.dataHeatBal->Zone);
7640 :
7641 0 : if (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff) { // protect divide by zero
7642 :
7643 0 : if (Height == 0.0) {
7644 0 : if (state.dataConvectionCoefficient->BMMixedOpposingWallErrorIDX2 == 0) {
7645 0 : ShowSevereMessage(state, "CalcBeausoleilMorrisonMixedOpposingWall: Convection model not evaluated (would divide by zero)");
7646 0 : ShowContinueError(state, "Effective height is zero, convection model not applicable for zone named =" + Zone(ZoneNum).Name);
7647 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7648 : }
7649 :
7650 0 : ShowRecurringSevereErrorAtEnd(
7651 : state,
7652 : "CalcBeausoleilMorrisonMixedOpposingWall: Convection model not evaluated because of zero height and set to 9.999 [W/m2-K]",
7653 0 : state.dataConvectionCoefficient->BMMixedOpposingWallErrorIDX2);
7654 : }
7655 0 : Real64 SupplyAirTemp = CalcZoneSupplyAirTemp(state, ZoneNum);
7656 0 : Real64 AirChangeRate = CalcZoneSystemACH(state, ZoneNum);
7657 0 : return CalcBeausoleilMorrisonMixedOpposingWall(DeltaTemp, Height, SurfTemp, SupplyAirTemp, AirChangeRate);
7658 :
7659 : } else {
7660 0 : if (!state.dataGlobal->WarmupFlag) {
7661 0 : if (state.dataConvectionCoefficient->BMMixedOpposingWallErrorIDX1 == 0) {
7662 0 : ShowSevereMessage(state, "CalcBeausoleilMorrisonMixedOpposingWall: Convection model not evaluated (would divide by zero)");
7663 0 : ShowContinueError(state, "The temperature difference between surface and air is zero");
7664 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
7665 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7666 : }
7667 :
7668 0 : ShowRecurringSevereErrorAtEnd(state,
7669 : "CalcBeausoleilMorrisonMixedOpposingWall: Convection model not evaluated because of zero temperature "
7670 : "difference and set to 9.999 [W/m2-K]",
7671 0 : state.dataConvectionCoefficient->BMMixedOpposingWallErrorIDX1);
7672 : }
7673 0 : return 9.999;
7674 : }
7675 : }
7676 :
7677 0 : Real64 CalcBeausoleilMorrisonMixedStableFloor(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7678 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7679 : Real64 const SurfTemp, // [C] surface temperature
7680 : Real64 const SupplyAirTemp, // [C] temperature of supply air into zone
7681 : Real64 const AirChangeRate // [ACH] [1/hour] supply air ACH for zone
7682 : )
7683 : {
7684 :
7685 : // FUNCTION INFORMATION:
7686 : // AUTHOR Brent Griffith
7687 : // DATE WRITTEN Jul 2010
7688 : // MODIFIED na
7689 : // RE-ENGINEERED na
7690 :
7691 : // PURPOSE OF THIS FUNCTION:
7692 : // Calculate model equation Beausoleil-Morrison's mixed flow regime
7693 : // with mechanical and buoyancy forces acting on an thermally stable floor
7694 :
7695 : // METHODOLOGY EMPLOYED:
7696 : // isolate function for equation.
7697 :
7698 : // REFERENCES:
7699 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7700 : // air flow modeling within dynamic whole-building simulations.
7701 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7702 :
7703 0 : Real64 cofpow = pow_3(0.6 * std::pow(std::abs(DeltaTemp) / HydraulicDiameter, ConvectionConstants::OneFifth)) +
7704 0 : pow_3(((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) * (0.159 + 0.116 * std::pow(AirChangeRate, 0.8)));
7705 0 : Real64 Hc = std::pow(std::abs(cofpow), ConvectionConstants::OneThird);
7706 0 : if (cofpow < 0.0) {
7707 0 : Hc = -Hc;
7708 : }
7709 0 : return Hc;
7710 : }
7711 :
7712 0 : Real64 CalcBeausoleilMorrisonMixedStableFloor(EnergyPlusData &state,
7713 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7714 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7715 : Real64 const SurfTemp, // [C] surface temperature
7716 : int const ZoneNum // index of zone for messaging
7717 : )
7718 : {
7719 0 : auto &Zone(state.dataHeatBal->Zone);
7720 :
7721 0 : if ((HydraulicDiameter != 0.0) && (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff)) {
7722 0 : Real64 SupplyAirTemp = CalcZoneSupplyAirTemp(state, ZoneNum);
7723 0 : Real64 AirChangeRate = CalcZoneSystemACH(state, ZoneNum);
7724 0 : return CalcBeausoleilMorrisonMixedStableFloor(DeltaTemp, HydraulicDiameter, SurfTemp, SupplyAirTemp, AirChangeRate);
7725 : } else {
7726 0 : if (HydraulicDiameter == 0.0) {
7727 0 : if (state.dataConvectionCoefficient->BMMixedStableFloorErrorIDX1 == 0) {
7728 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedStableFloor: Convection model not evaluated (would divide by zero)");
7729 0 : ShowContinueError(state,
7730 0 : "Effective hydraulic diameter is zero, convection model not applicable for zone named =" + Zone(ZoneNum).Name);
7731 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7732 : }
7733 :
7734 0 : ShowRecurringWarningErrorAtEnd(
7735 : state,
7736 : "CalcBeausoleilMorrisonMixedStableFloor: Convection model not evaluated because effective hydraulic diameter is zero "
7737 : "and set to 9.999 [W/m2-K]",
7738 0 : state.dataConvectionCoefficient->BMMixedStableFloorErrorIDX1);
7739 : }
7740 0 : if (DeltaTemp == 0.0 && !state.dataGlobal->WarmupFlag) {
7741 0 : if (state.dataConvectionCoefficient->BMMixedStableFloorErrorIDX2 == 0) {
7742 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedStableFloor: Convection model not evaluated (would divide by zero)");
7743 0 : ShowContinueError(state, "The temperature difference between surface and air is zero");
7744 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
7745 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7746 : }
7747 :
7748 0 : ShowRecurringWarningErrorAtEnd(state,
7749 : "CalcBeausoleilMorrisonMixedStableFloor: Convection model not evaluated because of zero temperature "
7750 : "difference and set to 9.999 [W/m2-K]",
7751 0 : state.dataConvectionCoefficient->BMMixedStableFloorErrorIDX2);
7752 : }
7753 0 : return 9.999;
7754 : }
7755 : }
7756 :
7757 0 : Real64 CalcBeausoleilMorrisonMixedUnstableFloor(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7758 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7759 : Real64 const SurfTemp, // [C] surface temperature
7760 : Real64 const SupplyAirTemp, // [C] temperature of supply air into zone
7761 : Real64 const AirChangeRate // [ACH] [1/hour] supply air ACH for zone
7762 : )
7763 : {
7764 :
7765 : // FUNCTION INFORMATION:
7766 : // AUTHOR Brent Griffith
7767 : // DATE WRITTEN Jul 2010
7768 : // MODIFIED na
7769 : // RE-ENGINEERED na
7770 :
7771 : // PURPOSE OF THIS FUNCTION:
7772 : // Calculate model equation Beausoleil-Morrison's mixed flow regime
7773 : // with mechanical and buoyancy forces acting on an thermally unstable floor
7774 :
7775 : // METHODOLOGY EMPLOYED:
7776 : // isolate function for equation.
7777 :
7778 : // REFERENCES:
7779 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7780 : // air flow modeling within dynamic whole-building simulations.
7781 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7782 :
7783 0 : Real64 cofpow = std::sqrt(pow_6(1.4 * std::pow(std::abs(DeltaTemp) / HydraulicDiameter, ConvectionConstants::OneFourth)) +
7784 0 : pow_6(1.63 * std::pow(std::abs(DeltaTemp), ConvectionConstants::OneThird))) +
7785 0 : pow_3(((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) * (0.159 + 0.116 * std::pow(AirChangeRate, 0.8)));
7786 0 : Real64 Hc = std::pow(std::abs(cofpow), ConvectionConstants::OneThird);
7787 0 : if (cofpow < 0.0) {
7788 0 : Hc = -Hc;
7789 : }
7790 :
7791 0 : return Hc;
7792 : }
7793 :
7794 0 : Real64 CalcBeausoleilMorrisonMixedUnstableFloor(EnergyPlusData &state,
7795 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7796 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7797 : Real64 const SurfTemp, // [C] surface temperature
7798 : int const ZoneNum // index of zone for messaging
7799 : )
7800 : {
7801 0 : auto &Zone(state.dataHeatBal->Zone);
7802 :
7803 0 : if ((HydraulicDiameter != 0.0) && (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff)) {
7804 0 : Real64 SupplyAirTemp = CalcZoneSupplyAirTemp(state, ZoneNum);
7805 0 : Real64 AirChangeRate = CalcZoneSystemACH(state, ZoneNum);
7806 0 : return CalcBeausoleilMorrisonMixedUnstableFloor(DeltaTemp, HydraulicDiameter, SurfTemp, SupplyAirTemp, AirChangeRate);
7807 : } else {
7808 0 : if (HydraulicDiameter == 0.0) {
7809 0 : if (state.dataConvectionCoefficient->BMMixedUnstableFloorErrorIDX1 == 0) {
7810 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedUnstableFloor: Convection model not evaluated (would divide by zero)");
7811 0 : ShowContinueError(state,
7812 0 : "Effective hydraulic diameter is zero, convection model not applicable for zone named =" + Zone(ZoneNum).Name);
7813 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7814 : }
7815 :
7816 0 : ShowRecurringWarningErrorAtEnd(
7817 : state,
7818 : "CalcBeausoleilMorrisonMixedUnstableFloor: Convection model not evaluated because effective hydraulic diameter is zero "
7819 : "and set to 9.999 [W/m2-K]",
7820 0 : state.dataConvectionCoefficient->BMMixedUnstableFloorErrorIDX1);
7821 : }
7822 :
7823 0 : if (DeltaTemp == 0.0 && !state.dataGlobal->WarmupFlag) {
7824 0 : if (state.dataConvectionCoefficient->BMMixedUnstableFloorErrorIDX2 == 0) {
7825 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedUnstableFloor: Convection model not evaluated (would divide by zero)");
7826 0 : ShowContinueError(state, "The temperature difference between surface and air is zero");
7827 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
7828 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7829 : }
7830 :
7831 0 : ShowRecurringWarningErrorAtEnd(state,
7832 : "CalcBeausoleilMorrisonMixedUnstableFloor: Convection model not evaluated because of zero temperature "
7833 : "difference and set to 9.999 [W/m2-K]",
7834 0 : state.dataConvectionCoefficient->BMMixedUnstableFloorErrorIDX2);
7835 : }
7836 0 : return 9.999;
7837 : }
7838 : }
7839 :
7840 0 : Real64 CalcBeausoleilMorrisonMixedStableCeiling(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7841 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7842 : Real64 const SurfTemp, // [C] surface temperature
7843 : Real64 const SupplyAirTemp, // [C] temperature of supply air into zone
7844 : Real64 const AirChangeRate // [ACH] [1/hour] supply air ACH for zone
7845 : )
7846 : {
7847 :
7848 : // FUNCTION INFORMATION:
7849 : // AUTHOR Brent Griffith
7850 : // DATE WRITTEN Jul 2010
7851 : // MODIFIED na
7852 : // RE-ENGINEERED na
7853 :
7854 : // PURPOSE OF THIS FUNCTION:
7855 : // Calculate model equation Beausoleil-Morrison's mixed flow regime
7856 : // with mechanical and buoyancy forces acting on a thermally stable ceiling
7857 :
7858 : // METHODOLOGY EMPLOYED:
7859 : // isolate function for equation.
7860 :
7861 : // REFERENCES:
7862 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7863 : // air flow modeling within dynamic whole-building simulations.
7864 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7865 :
7866 0 : Real64 cofpow = pow_3(0.6 * std::pow(std::abs(DeltaTemp) / HydraulicDiameter, ConvectionConstants::OneFifth)) +
7867 0 : pow_3(((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) * (-0.166 + 0.484 * std::pow(AirChangeRate, 0.8)));
7868 0 : Real64 Hc = std::pow(std::abs(cofpow), ConvectionConstants::OneThird);
7869 0 : if (cofpow < 0.0) {
7870 0 : Hc = -Hc;
7871 : }
7872 0 : return Hc;
7873 : }
7874 :
7875 0 : Real64 CalcBeausoleilMorrisonMixedStableCeiling(EnergyPlusData &state,
7876 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7877 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7878 : Real64 const SurfTemp, // [C] surface temperature
7879 : int const ZoneNum // index of zone for messaging
7880 : )
7881 : {
7882 0 : auto &Zone(state.dataHeatBal->Zone);
7883 :
7884 0 : if ((HydraulicDiameter != 0.0) && (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff)) {
7885 0 : Real64 SupplyAirTemp = CalcZoneSupplyAirTemp(state, ZoneNum);
7886 0 : Real64 AirChangeRate = CalcZoneSystemACH(state, ZoneNum);
7887 0 : return CalcBeausoleilMorrisonMixedStableCeiling(DeltaTemp, HydraulicDiameter, SurfTemp, SupplyAirTemp, AirChangeRate);
7888 : } else {
7889 0 : if (HydraulicDiameter == 0.0) {
7890 0 : if (state.dataConvectionCoefficient->BMMixedStableCeilingErrorIDX1 == 0) {
7891 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedStableCeiling: Convection model not evaluated (would divide by zero)");
7892 0 : ShowContinueError(state,
7893 0 : "Effective hydraulic diameter is zero, convection model not applicable for zone named =" + Zone(ZoneNum).Name);
7894 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7895 : }
7896 :
7897 0 : ShowRecurringWarningErrorAtEnd(
7898 : state,
7899 : "CalcBeausoleilMorrisonMixedStableCeiling: Convection model not evaluated because effective hydraulic diameter is zero "
7900 : "and set to 9.999 [W/m2-K]",
7901 0 : state.dataConvectionCoefficient->BMMixedStableCeilingErrorIDX1);
7902 : }
7903 0 : if (DeltaTemp == 0.0 && !state.dataGlobal->WarmupFlag) {
7904 0 : if (state.dataConvectionCoefficient->BMMixedStableCeilingErrorIDX2 == 0) {
7905 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedStableCeiling: Convection model not evaluated (would divide by zero)");
7906 0 : ShowContinueError(state, "The temperature difference between surface and air is zero");
7907 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
7908 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7909 : }
7910 :
7911 0 : ShowRecurringWarningErrorAtEnd(state,
7912 : "CalcBeausoleilMorrisonMixedStableCeiling: Convection model not evaluated because of zero temperature "
7913 : "difference and set to 9.999 [W/m2-K]",
7914 0 : state.dataConvectionCoefficient->BMMixedStableCeilingErrorIDX2);
7915 : }
7916 0 : return 9.999;
7917 : }
7918 : }
7919 :
7920 0 : Real64 CalcBeausoleilMorrisonMixedUnstableCeiling(Real64 const DeltaTemp, // [C] temperature difference between surface and air
7921 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7922 : Real64 const SurfTemp, // [C] surface temperature
7923 : Real64 const SupplyAirTemp, // [C] temperature of supply air into zone
7924 : Real64 const AirChangeRate // [ACH] [1/hour] supply air ACH for zone
7925 : )
7926 : {
7927 :
7928 : // FUNCTION INFORMATION:
7929 : // AUTHOR Brent Griffith
7930 : // DATE WRITTEN Jul 2010
7931 : // MODIFIED na
7932 : // RE-ENGINEERED na
7933 :
7934 : // PURPOSE OF THIS FUNCTION:
7935 : // Calculate model equation Beausoleil-Morrison's mixed flow regime
7936 : // with mechanical and buoyancy forces acting on a thermally unstable ceiling
7937 :
7938 : // METHODOLOGY EMPLOYED:
7939 : // isolate function for equation.
7940 :
7941 : // REFERENCES:
7942 : // Beausoleil-Morrison, I. 2000. The adaptive coupling of heat and
7943 : // air flow modeling within dynamic whole-building simulations.
7944 : // PhD. Thesis. University of Strathclyde, Glasgow, UK.
7945 :
7946 0 : Real64 cofpow = std::sqrt(pow_6(1.4 * std::pow(std::abs(DeltaTemp) / HydraulicDiameter, ConvectionConstants::OneFourth)) +
7947 0 : pow_6(1.63 * std::pow(std::abs(DeltaTemp), ConvectionConstants::OneThird))) +
7948 0 : pow_3(((SurfTemp - SupplyAirTemp) / std::abs(DeltaTemp)) * (-0.166 + 0.484 * std::pow(AirChangeRate, 0.8)));
7949 0 : Real64 Hc = std::pow(std::abs(cofpow), ConvectionConstants::OneThird);
7950 0 : if (cofpow < 0.0) {
7951 0 : Hc = -Hc;
7952 : }
7953 0 : return Hc;
7954 : }
7955 :
7956 0 : Real64 CalcBeausoleilMorrisonMixedUnstableCeiling(EnergyPlusData &state,
7957 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
7958 : Real64 const HydraulicDiameter, // [m] characteristic size, = (4 * area) / perimeter
7959 : Real64 const SurfTemp, // [C] surface temperature
7960 : int const ZoneNum // index of zone for messaging
7961 : )
7962 : {
7963 0 : auto &Zone(state.dataHeatBal->Zone);
7964 :
7965 0 : if ((HydraulicDiameter != 0.0) && (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff)) {
7966 0 : Real64 SupplyAirTemp = CalcZoneSupplyAirTemp(state, ZoneNum);
7967 0 : Real64 AirChangeRate = CalcZoneSystemACH(state, ZoneNum);
7968 0 : return CalcBeausoleilMorrisonMixedUnstableCeiling(DeltaTemp, HydraulicDiameter, SurfTemp, SupplyAirTemp, AirChangeRate);
7969 : } else {
7970 0 : if (HydraulicDiameter == 0.0) {
7971 0 : if (state.dataConvectionCoefficient->BMMixedUnstableCeilingErrorIDX1 == 0) {
7972 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedUnstableCeiling: Convection model not evaluated (would divide by zero)");
7973 0 : ShowContinueError(state,
7974 0 : "Effective hydraulic diameter is zero, convection model not applicable for zone named =" + Zone(ZoneNum).Name);
7975 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7976 : }
7977 :
7978 0 : ShowRecurringWarningErrorAtEnd(
7979 : state,
7980 : "CalcBeausoleilMorrisonMixedUnstableCeiling: Convection model not evaluated because effective hydraulic diameter is zero "
7981 : "and set to 9.999 [W/m2-K]",
7982 0 : state.dataConvectionCoefficient->BMMixedUnstableCeilingErrorIDX1);
7983 : }
7984 0 : if (DeltaTemp == 0.0 && !state.dataGlobal->WarmupFlag) {
7985 0 : if (state.dataConvectionCoefficient->BMMixedUnstableCeilingErrorIDX2 == 0) {
7986 0 : ShowWarningMessage(state, "CalcBeausoleilMorrisonMixedUnstableCeiling: Convection model not evaluated (would divide by zero)");
7987 0 : ShowContinueError(state, "The temperature difference between surface and air is zero");
7988 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
7989 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
7990 : }
7991 :
7992 0 : ShowRecurringWarningErrorAtEnd(state,
7993 : "CalcBeausoleilMorrisonMixedUnstableCeiling: Convection model not evaluated because of zero "
7994 : "temperature difference and set to 9.999 [W/m2-K]",
7995 0 : state.dataConvectionCoefficient->BMMixedUnstableCeilingErrorIDX2);
7996 : }
7997 0 : return 9.999;
7998 : }
7999 : }
8000 :
8001 164398 : Real64 CalcFohannoPolidoriVerticalWall(Real64 const DeltaTemp, // [C] temperature difference between surface and air
8002 : Real64 const Height, // [m] characteristic size, height of zone
8003 : Real64 const SurfTemp, // [C] surface temperature
8004 : Real64 const QdotConv // [W/m2] heat flux rate for rayleigh #
8005 : )
8006 : {
8007 :
8008 : // FUNCTION INFORMATION:
8009 : // AUTHOR Brent Griffith
8010 : // DATE WRITTEN Jul 2010
8011 : // MODIFIED na
8012 : // RE-ENGINEERED na
8013 :
8014 : // PURPOSE OF THIS FUNCTION:
8015 : // Calculate model equation for natural convection
8016 :
8017 : // METHODOLOGY EMPLOYED:
8018 : // isolate function for equation.
8019 :
8020 : // REFERENCES:
8021 : // Fohanno, S., and G. Polidori. 2006. Modelling of natural convective heat transfer
8022 : // at an internal surface. Energy and Buildings 38 (2006) 548 - 553
8023 :
8024 : // FUNCTION PARAMETER DEFINITIONS:
8025 164398 : Real64 constexpr g(9.81); // gravity constant (m/s**2)
8026 164398 : Real64 constexpr v(15.89e-6); // kinematic viscosity (m**2/s) for air at 300 K
8027 164398 : Real64 constexpr k(0.0263); // thermal conductivity (W/m K) for air at 300 K
8028 164398 : Real64 constexpr Pr(0.71); // Prandtl number for air at ?
8029 :
8030 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
8031 164398 : Real64 RaH(0.0);
8032 164398 : Real64 BetaFilm(0.0);
8033 :
8034 164398 : BetaFilm = 1.0 / (DataGlobalConstants::KelvinConv + SurfTemp + 0.5 * DeltaTemp); // TODO check sign on DeltaTemp
8035 164398 : RaH = (g * BetaFilm * QdotConv * pow_4(Height) * Pr) / (k * pow_2(v));
8036 :
8037 164398 : if (RaH <= 6.3e09) {
8038 76859 : return 1.332 * std::pow(std::abs(DeltaTemp) / Height, ConvectionConstants::OneFourth);
8039 : } else {
8040 87539 : return 1.235 * std::exp(0.0467 * Height) * std::pow(std::abs(DeltaTemp), 0.316);
8041 : }
8042 : }
8043 :
8044 159328 : Real64 CallCalcFohannoPolidoriVerticalWall(EnergyPlusData &state,
8045 : Real64 const DeltaTemp, // [C] temperature difference between surface and air
8046 : Real64 const Height, // [m] characteristic size, height of zone
8047 : Real64 const SurfTemp, // [C] surface temperature
8048 : Real64 const QdotConv, // [W/m2] heat flux rate for rayleigh #
8049 : int const SurfNum // for messages
8050 : )
8051 : {
8052 :
8053 159328 : if (Height > 0.0) {
8054 159328 : return CalcFohannoPolidoriVerticalWall(DeltaTemp, Height, SurfTemp, QdotConv);
8055 : } else {
8056 : // bad value for Height, but we have little info to identify calling culprit
8057 0 : if (state.dataConvectionCoefficient->CalcFohannoPolidoriVerticalWallErrorIDX == 0) {
8058 0 : ShowSevereMessage(state, "CalcFohannoPolidoriVerticalWall: Convection model not evaluated (would divide by zero)");
8059 0 : ShowContinueError(
8060 0 : state, "Effective surface height is zero, convection model not applicable for surface =" + state.dataSurface->Surface(SurfNum).Name);
8061 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8062 : }
8063 0 : ShowRecurringSevereErrorAtEnd(state,
8064 : "CalcFohannoPolidoriVerticalWall: Convection model not evaluated because zero height and set to 9.999 [W/m2-K]",
8065 0 : state.dataConvectionCoefficient->CalcFohannoPolidoriVerticalWallErrorIDX);
8066 0 : return 9.999;
8067 : }
8068 : }
8069 :
8070 0 : Real64 CalcKaradagChilledCeiling(Real64 const DeltaTemp) // [C] temperature difference between surface and air
8071 : {
8072 :
8073 : // FUNCTION INFORMATION:
8074 : // AUTHOR Brent Griffith
8075 : // DATE WRITTEN Jul 2010
8076 : // MODIFIED na
8077 : // RE-ENGINEERED na
8078 :
8079 : // PURPOSE OF THIS FUNCTION:
8080 : // Calculate model equation for natural convection developed by Karadag for chilled ceilings
8081 :
8082 : // METHODOLOGY EMPLOYED:
8083 : // isolate function for equation.
8084 :
8085 : // REFERENCES:
8086 : // Karadag, R. 2009. New approach relevant to total heat transfer coefficient
8087 : // including the effect of radiation and convection at the ceiling in a cooled
8088 : // ceiling room. Applied Thermal Engineering 29 (2009) 1561-1565
8089 : // This function is for equation 8 in the reference
8090 :
8091 : // Return value
8092 : Real64 Hn; // function result, natural convection coefficient
8093 :
8094 0 : Hn = 3.1 * std::pow(std::abs(DeltaTemp), 0.22);
8095 :
8096 0 : return Hn;
8097 : }
8098 :
8099 0 : Real64 CalcGoldsteinNovoselacCeilingDiffuserWindow(Real64 const AirSystemFlowRate, // [m3/s] air system flow rate
8100 : Real64 const ZoneExtPerimLength, // [m] length of zone perimeter with exterior walls
8101 : Real64 const WindWallRatio, // [ ] fraction of window area to wall area for zone
8102 : ConvectionConstants::InConvWinLoc const WindowLocationType // index for location types
8103 : )
8104 : {
8105 :
8106 : // FUNCTION INFORMATION:
8107 : // AUTHOR Brent Griffith
8108 : // DATE WRITTEN Aug 2010
8109 : // MODIFIED na
8110 : // RE-ENGINEERED na
8111 :
8112 : // PURPOSE OF THIS FUNCTION:
8113 : // Calculate model equation for windows in zones with slot diffusers on them
8114 : // developed by Novoselac for RP-1416
8115 :
8116 : // METHODOLOGY EMPLOYED:
8117 : // isolate function for equation.
8118 :
8119 : // REFERENCES:
8120 : // Goldstien, K. and A. Novoselac. 2010. Convective Heat Transfer in Rooms
8121 : // With Ceiling Slot Diffusers (RP-1416). HVAC&R Research Journal TBD
8122 :
8123 0 : if (ZoneExtPerimLength > 0.0) {
8124 0 : if (WindWallRatio <= 0.5) {
8125 :
8126 0 : switch (WindowLocationType) {
8127 0 : case ConvectionConstants::InConvWinLoc::UpperPartOfExteriorWall:
8128 : case ConvectionConstants::InConvWinLoc::LargePartOfExteriorWall:
8129 : case ConvectionConstants::InConvWinLoc::NotSet:
8130 0 : return 0.117 * std::pow(AirSystemFlowRate / ZoneExtPerimLength, 0.8);
8131 0 : case ConvectionConstants::InConvWinLoc::LowerPartOfExteriorWall:
8132 0 : return 0.093 * std::pow(AirSystemFlowRate / ZoneExtPerimLength, 0.8);
8133 0 : default:
8134 : // shouldn't come
8135 0 : return 9.999;
8136 : }
8137 :
8138 : } else {
8139 0 : return 0.103 * std::pow(AirSystemFlowRate / ZoneExtPerimLength, 0.8);
8140 : }
8141 : } else {
8142 0 : return 9.999;
8143 : }
8144 : }
8145 :
8146 0 : Real64 CalcGoldsteinNovoselacCeilingDiffuserWindow(EnergyPlusData &state,
8147 : Real64 const ZoneExtPerimLength, // [m] length of zone perimeter with exterior walls
8148 : Real64 const WindWallRatio, // [ ] fraction of window area to wall area for zone
8149 : ConvectionConstants::InConvWinLoc const WindowLocationType, // index for location types
8150 : int const ZoneNum // for messages
8151 : )
8152 : {
8153 0 : auto &Zone(state.dataHeatBal->Zone);
8154 :
8155 0 : Real64 AirSystemFlowRate = CalcZoneSystemVolFlowRate(state, ZoneNum);
8156 :
8157 0 : if (ZoneExtPerimLength > 0.0) {
8158 0 : if (WindWallRatio <= 0.5) {
8159 :
8160 0 : if (!BITF_TEST_ANY(BITF(WindowLocationType),
8161 : BITF(ConvectionConstants::InConvWinLoc::UpperPartOfExteriorWall) |
8162 : BITF(ConvectionConstants::InConvWinLoc::LowerPartOfExteriorWall) |
8163 : BITF(ConvectionConstants::InConvWinLoc::LargePartOfExteriorWall) |
8164 : BITF(ConvectionConstants::InConvWinLoc::NotSet))) {
8165 0 : if (state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWindowErrorIDX1 == 0) {
8166 0 : ShowSevereMessage(state,
8167 : "CalcGoldsteinNovoselacCeilingDiffuserWindow: Convection model not evaluated (bad relative window location)");
8168 0 : ShowContinueError(state, format("Value for window location = {}", WindowLocationType));
8169 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
8170 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8171 : }
8172 0 : ShowRecurringSevereErrorAtEnd(state,
8173 : "CalcGoldsteinNovoselacCeilingDiffuserWindow: Convection model not evaluated because bad window "
8174 : "location and set to 9.999 [W/m2-K]",
8175 0 : state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWindowErrorIDX1);
8176 : }
8177 : }
8178 : } else {
8179 0 : if (state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWindowErrorIDX2 == 0) {
8180 0 : ShowSevereMessage(state,
8181 : "CalcGoldsteinNovoselacCeilingDiffuserWindow: Convection model not evaluated (zero zone exterior perimeter length)");
8182 0 : ShowContinueError(state, format("Value for zone exterior perimeter length = {:.5R}", ZoneExtPerimLength));
8183 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
8184 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8185 : }
8186 0 : ShowRecurringSevereErrorAtEnd(state,
8187 : "CalcGoldsteinNovoselacCeilingDiffuserWindow: Convection model not evaluated because bad perimeter "
8188 : "length and set to 9.999 [W/m2-K]",
8189 0 : state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWindowErrorIDX2);
8190 : }
8191 0 : return CalcGoldsteinNovoselacCeilingDiffuserWindow(AirSystemFlowRate, ZoneExtPerimLength, WindWallRatio, WindowLocationType);
8192 : }
8193 :
8194 0 : Real64 CalcGoldsteinNovoselacCeilingDiffuserWall(Real64 const AirSystemFlowRate, // [m3/s] air system flow rate
8195 : Real64 const ZoneExtPerimLength, // [m] length of zone perimeter with exterior walls
8196 : ConvectionConstants::InConvWinLoc const WindowLocationType // index for location types
8197 : )
8198 : {
8199 :
8200 : // FUNCTION INFORMATION:
8201 : // AUTHOR Brent Griffith
8202 : // DATE WRITTEN Aug 2010
8203 : // MODIFIED na
8204 : // RE-ENGINEERED na
8205 :
8206 : // PURPOSE OF THIS FUNCTION:
8207 : // Calculate model equation for exterior walls in zones with slot diffusers on them
8208 : // developed by Novoselac for RP-1416
8209 :
8210 : // METHODOLOGY EMPLOYED:
8211 : // isolate function for equation.
8212 :
8213 : // REFERENCES:
8214 : // Goldstien, K. and A. Novoselac. 2010. Convective Heat Transfer in Rooms
8215 : // With Ceiling Slot Diffusers (RP-1416). HVAC&R Research Journal TBD
8216 :
8217 0 : if (ZoneExtPerimLength > 0.0) {
8218 :
8219 0 : switch (WindowLocationType) {
8220 0 : case ConvectionConstants::InConvWinLoc::WindowAboveThis:
8221 : case ConvectionConstants::InConvWinLoc::NotSet:
8222 0 : return 0.063 * std::pow(AirSystemFlowRate / ZoneExtPerimLength, 0.8);
8223 0 : case ConvectionConstants::InConvWinLoc::WindowBelowThis:
8224 0 : return 0.093 * std::pow(AirSystemFlowRate / ZoneExtPerimLength, 0.8);
8225 0 : default:
8226 0 : return 9.999;
8227 : }
8228 : } else {
8229 0 : return 9.999;
8230 : }
8231 : }
8232 :
8233 0 : Real64 CalcGoldsteinNovoselacCeilingDiffuserWall(EnergyPlusData &state,
8234 : Real64 const ZoneExtPerimLength, // [m] length of zone perimeter with exterior walls
8235 : ConvectionConstants::InConvWinLoc const WindowLocationType, // index for location types
8236 : int const ZoneNum // for messages
8237 : )
8238 : {
8239 0 : auto &Zone(state.dataHeatBal->Zone);
8240 :
8241 0 : Real64 AirSystemFlowRate = CalcZoneSystemVolFlowRate(state, ZoneNum);
8242 :
8243 0 : if (ZoneExtPerimLength > 0.0) {
8244 0 : if (!BITF_TEST_ANY(BITF(WindowLocationType),
8245 : BITF(ConvectionConstants::InConvWinLoc::WindowAboveThis) | BITF(ConvectionConstants::InConvWinLoc::WindowBelowThis) |
8246 : BITF(ConvectionConstants::InConvWinLoc::NotSet))) {
8247 0 : if (state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWallErrorIDX1 == 0) {
8248 0 : ShowSevereMessage(state, "CalcGoldsteinNovoselacCeilingDiffuserWall: Convection model not evaluated (bad relative window location)");
8249 0 : ShowContinueError(state, format("Value for window location = {}", WindowLocationType));
8250 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
8251 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8252 : }
8253 0 : ShowRecurringSevereErrorAtEnd(state,
8254 : "CalcGoldsteinNovoselacCeilingDiffuserWall: Convection model not evaluated because bad window "
8255 : "location and set to 9.999 [W/m2-K]",
8256 0 : state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWallErrorIDX1);
8257 : }
8258 : } else {
8259 0 : if (state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWallErrorIDX2 == 0) {
8260 0 : ShowSevereMessage(state,
8261 : "CalcGoldsteinNovoselacCeilingDiffuserWall: Convection model not evaluated (zero zone exterior perimeter length)");
8262 0 : ShowContinueError(state, format("Value for zone exterior perimeter length = {:.5R}", ZoneExtPerimLength));
8263 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
8264 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8265 : }
8266 0 : ShowRecurringSevereErrorAtEnd(state,
8267 : "CalcGoldsteinNovoselacCeilingDiffuserWall: Convection model not evaluated because bad perimeter "
8268 : "length and set to 9.999 [W/m2-K]",
8269 0 : state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserWallErrorIDX2);
8270 : }
8271 0 : return CalcGoldsteinNovoselacCeilingDiffuserWall(AirSystemFlowRate, ZoneExtPerimLength, WindowLocationType);
8272 : }
8273 :
8274 0 : Real64 CalcGoldsteinNovoselacCeilingDiffuserFloor(Real64 const AirSystemFlowRate, // [m3/s] air system flow rate
8275 : Real64 const ZoneExtPerimLength // [m] length of zone perimeter with exterior walls
8276 : )
8277 : {
8278 :
8279 : // FUNCTION INFORMATION:
8280 : // AUTHOR Brent Griffith
8281 : // DATE WRITTEN Aug 2010
8282 : // MODIFIED na
8283 : // RE-ENGINEERED na
8284 :
8285 : // PURPOSE OF THIS FUNCTION:
8286 : // Calculate model equation for floors in zones with slot diffusers on them
8287 : // developed by Novoselac for RP-1416
8288 :
8289 : // METHODOLOGY EMPLOYED:
8290 : // isolate function for equation.
8291 :
8292 : // REFERENCES:
8293 : // Goldstien, K. and A. Novoselac. 2010. Convective Heat Transfer in Rooms
8294 : // With Ceiling Slot Diffusers (RP-1416). HVAC&R Research Journal TBD
8295 :
8296 0 : if (ZoneExtPerimLength > 0.0) {
8297 0 : return 0.048 * std::pow(AirSystemFlowRate / ZoneExtPerimLength, 0.8);
8298 : } else {
8299 0 : return 9.999; // safe but noticeable
8300 : }
8301 : }
8302 :
8303 0 : Real64 CalcGoldsteinNovoselacCeilingDiffuserFloor(EnergyPlusData &state,
8304 : Real64 const ZoneExtPerimLength, // [m] length of zone perimeter with exterior walls
8305 : int const ZoneNum // for messages
8306 : )
8307 : {
8308 0 : auto &Zone(state.dataHeatBal->Zone);
8309 :
8310 0 : Real64 AirSystemFlowRate = CalcZoneSystemVolFlowRate(state, ZoneNum);
8311 :
8312 0 : if (ZoneExtPerimLength <= 0.0) {
8313 0 : if (state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserFloorErrorIDX == 0) {
8314 0 : ShowSevereMessage(state,
8315 : "CalcGoldsteinNovoselacCeilingDiffuserFloor: Convection model not evaluated (zero zone exterior perimeter length)");
8316 0 : ShowContinueError(state, format("Value for zone exterior perimeter length = {:.5R}", ZoneExtPerimLength));
8317 0 : ShowContinueError(state, "Occurs for zone named = " + Zone(ZoneNum).Name);
8318 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8319 : }
8320 0 : ShowRecurringSevereErrorAtEnd(state,
8321 : "CalcGoldsteinNovoselacCeilingDiffuserFloor: Convection model not evaluated because bad perimeter "
8322 : "length and set to 9.999 [W/m2-K]",
8323 0 : state.dataConvectionCoefficient->CalcGoldsteinNovoselacCeilingDiffuserFloorErrorIDX);
8324 : }
8325 0 : return CalcGoldsteinNovoselacCeilingDiffuserFloor(AirSystemFlowRate, ZoneExtPerimLength);
8326 : }
8327 :
8328 : Real64
8329 6436619 : CalcSparrowWindward(DataSurfaces::SurfaceRoughness const RoughnessIndex, Real64 const FacePerimeter, Real64 const FaceArea, Real64 const WindAtZ)
8330 : {
8331 :
8332 : // FUNCTION INFORMATION:
8333 : // AUTHOR Brent Griffith
8334 : // DATE WRITTEN Aug 2010
8335 : // MODIFIED na
8336 : // RE-ENGINEERED na
8337 :
8338 : // PURPOSE OF THIS FUNCTION:
8339 : // Calculate Sparrow Hf for windward surfaces
8340 :
8341 : // METHODOLOGY EMPLOYED:
8342 : // encapsulate equation as a function
8343 :
8344 : // REFERENCES:
8345 :
8346 : // 1. TARP Reference Manual, "Surface Outside Heat Balances", pp 71ff
8347 : // 2. Sparrow, E. M., J. W. Ramsey, and E. A. Mass. 1979. Effect of finite
8348 : // width on heat transfer and fluid flow about an inclined rectangular plate.
8349 : // Journal of Heat Transfer 101: 204.
8350 : // 3. McClellan, T.M. 1996. Investigation of a heat balance cooling load
8351 : // procedure with a detailed study of outside heat transfer parameters.
8352 : // M.S. Thesis, Department of Mechanical and Industrial Engineering,
8353 : // University of Illinois at Urbana-Champaign.
8354 :
8355 6436619 : return 2.537 * RoughnessMultiplier[static_cast<int>(RoughnessIndex)] * std::sqrt(FacePerimeter * WindAtZ / FaceArea);
8356 : }
8357 :
8358 : Real64
8359 2147472 : CalcSparrowLeeward(DataSurfaces::SurfaceRoughness const RoughnessIndex, Real64 const FacePerimeter, Real64 const FaceArea, Real64 const WindAtZ)
8360 : {
8361 :
8362 : // FUNCTION INFORMATION:
8363 : // AUTHOR Brent Griffith
8364 : // DATE WRITTEN Aug 2010
8365 : // MODIFIED na
8366 : // RE-ENGINEERED na
8367 :
8368 : // PURPOSE OF THIS FUNCTION:
8369 : // Calculate Sparrow Hf for leeward surfaces
8370 :
8371 : // METHODOLOGY EMPLOYED:
8372 : // encapsulate equation as a function
8373 :
8374 : // REFERENCES:
8375 :
8376 : // 1. TARP Reference Manual, "Surface Outside Heat Balances", pp 71ff
8377 : // 2. Sparrow, E. M., J. W. Ramsey, and E. A. Mass. 1979. Effect of finite
8378 : // width on heat transfer and fluid flow about an inclined rectangular plate.
8379 : // Journal of Heat Transfer 101: 204.
8380 : // 3. McClellan, T.M. 1996. Investigation of a heat balance cooling load
8381 : // procedure with a detailed study of outside heat transfer parameters.
8382 : // M.S. Thesis, Department of Mechanical and Industrial Engineering,
8383 : // University of Illinois at Urbana-Champaign.
8384 :
8385 2147472 : return 0.5 * CalcSparrowWindward(RoughnessIndex, FacePerimeter, FaceArea, WindAtZ);
8386 : }
8387 :
8388 184908 : Real64 CalcSparrowWindward(EnergyPlusData &state,
8389 : DataSurfaces::SurfaceRoughness const RoughnessIndex,
8390 : Real64 const FacePerimeter,
8391 : Real64 const FaceArea,
8392 : Real64 const WindAtZ,
8393 : int const SurfNum)
8394 : {
8395 184908 : auto &Surface(state.dataSurface->Surface);
8396 :
8397 184908 : if (FaceArea > 0.0) {
8398 181527 : return CalcSparrowWindward(RoughnessIndex, FacePerimeter, FaceArea, WindAtZ);
8399 :
8400 : } else {
8401 3381 : if (state.dataConvectionCoefficient->CalcSparrowWindwardErrorIDX == 0) {
8402 1 : ShowSevereMessage(state, "CalcSparrowWindward: Convection model not evaluated (bad face area)");
8403 1 : ShowContinueError(state, format("Value for effective face area = {:.5R}", FaceArea));
8404 1 : ShowContinueError(state, "Occurs for surface named = " + Surface(SurfNum).Name);
8405 1 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8406 : }
8407 6762 : ShowRecurringSevereErrorAtEnd(state,
8408 : "CalcSparrowWindward: Convection model not evaluated because bad face area and set to 9.999 [W/m2-k]",
8409 3381 : state.dataConvectionCoefficient->CalcSparrowWindwardErrorIDX);
8410 3381 : return 9.999; // safe but noticeable
8411 : }
8412 : }
8413 :
8414 72966 : Real64 CalcSparrowLeeward(EnergyPlusData &state,
8415 : DataSurfaces::SurfaceRoughness const RoughnessIndex,
8416 : Real64 const FacePerimeter,
8417 : Real64 const FaceArea,
8418 : Real64 const WindAtZ,
8419 : int const SurfNum)
8420 : {
8421 72966 : auto &Surface(state.dataSurface->Surface);
8422 :
8423 72966 : if (FaceArea > 0.0) {
8424 70935 : return CalcSparrowLeeward(RoughnessIndex, FacePerimeter, FaceArea, WindAtZ);
8425 : } else {
8426 2031 : if (state.dataConvectionCoefficient->CalcSparrowLeewardErrorIDX == 0) {
8427 1 : ShowSevereMessage(state, "CalcSparrowLeeward: Convection model not evaluated (bad face area)");
8428 1 : ShowContinueError(state, format("Value for effective face area = {:.5R}", FaceArea));
8429 1 : ShowContinueError(state, "Occurs for surface named = " + Surface(SurfNum).Name);
8430 1 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8431 : }
8432 4062 : ShowRecurringSevereErrorAtEnd(state,
8433 : "CalcSparrowLeeward: Convection model not evaluated because bad face area and set to 9.999 [W/m2-k]",
8434 2031 : state.dataConvectionCoefficient->CalcSparrowLeewardErrorIDX);
8435 :
8436 2031 : return 9.999; // safe but noticeable
8437 : }
8438 : }
8439 :
8440 16236 : Real64 CalcMoWITTNatural(Real64 DeltaTemp)
8441 : {
8442 16236 : Real64 constexpr temp_fac(0.84);
8443 16236 : return temp_fac * std::pow(std::abs(DeltaTemp), 1.0 / 3.0);
8444 : }
8445 :
8446 32955016 : Real64 CalcMoWITTForcedWindward(Real64 const WindAtZ)
8447 : {
8448 32955016 : Real64 constexpr wind_fac(3.26); // = a, Constant, W/(m2K(m/s)^b)
8449 32955016 : Real64 constexpr wind_exp(0.89); // = b
8450 32955016 : return wind_fac * std::pow(WindAtZ, wind_exp);
8451 : }
8452 :
8453 15547986 : Real64 CalcMoWITTForcedLeeward(Real64 const WindAtZ)
8454 : {
8455 15547986 : Real64 constexpr wind_fac(3.55); // = a, Constant, W/(m2K(m/s)^b)
8456 15547986 : Real64 constexpr wind_exp(0.617); // = b
8457 15547986 : return wind_fac * std::pow(WindAtZ, wind_exp);
8458 : }
8459 :
8460 8118 : Real64 CalcMoWITTWindward(Real64 const DeltaTemp, Real64 const WindAtZ)
8461 : {
8462 :
8463 : // FUNCTION INFORMATION:
8464 : // AUTHOR Brent Griffith
8465 : // DATE WRITTEN Aug 2010
8466 : // MODIFIED na
8467 : // RE-ENGINEERED na
8468 :
8469 : // PURPOSE OF THIS FUNCTION:
8470 : // calculate MoWITT Hc equation for windward surfaces
8471 :
8472 : // METHODOLOGY EMPLOYED:
8473 : // encapsulate model equation in a function
8474 :
8475 : // REFERENCES:
8476 : // Yazdanian, M. and J.H. Klems. 1994. Measurement of the exterior convective
8477 : // film coefficient for windows in low-rise buildings.
8478 : // ASHRAE Transactions 100(1): 1087.
8479 :
8480 8118 : Real64 Hn = CalcMoWITTNatural(DeltaTemp);
8481 8118 : Real64 Hf = CalcMoWITTForcedWindward(WindAtZ);
8482 8118 : return std::sqrt(pow_2(Hn) + pow_2(Hf));
8483 : }
8484 :
8485 8118 : Real64 CalcMoWITTLeeward(Real64 const DeltaTemp, Real64 const WindAtZ)
8486 : {
8487 :
8488 : // FUNCTION INFORMATION:
8489 : // AUTHOR Brent Griffith
8490 : // DATE WRITTEN Aug 2010
8491 : // MODIFIED na
8492 : // RE-ENGINEERED na
8493 :
8494 : // PURPOSE OF THIS FUNCTION:
8495 : // calculate MoWITT Hc equation for leeward surfaces
8496 :
8497 : // METHODOLOGY EMPLOYED:
8498 : // encapsulate model equation in a function
8499 :
8500 : // REFERENCES:
8501 : // Yazdanian, M. and J.H. Klems. 1994. Measurement of the exterior convective
8502 : // film coefficient for windows in low-rise buildings.
8503 : // ASHRAE Transactions 100(1): 1087.
8504 :
8505 8118 : Real64 Hn = CalcMoWITTNatural(DeltaTemp);
8506 8118 : Real64 Hf = CalcMoWITTForcedLeeward(WindAtZ);
8507 8118 : return std::sqrt(pow_2(Hn) + pow_2(Hf));
8508 : }
8509 :
8510 48551254 : Real64 CalcDOE2Forced(Real64 const SurfaceTemp,
8511 : Real64 const AirTemp,
8512 : Real64 const CosineTilt,
8513 : Real64 const HfSmooth,
8514 : DataSurfaces::SurfaceRoughness const RoughnessIndex)
8515 : {
8516 : // This allows costly HfSmooth to be calculated independently (avoids excessive use of std::pow() in Kiva)
8517 48551254 : Real64 Hn = CalcASHRAETARPNatural(SurfaceTemp, AirTemp, CosineTilt);
8518 48551254 : Real64 HcSmooth = std::sqrt(pow_2(Hn) + pow_2(HfSmooth));
8519 48551254 : return RoughnessMultiplier[static_cast<int>(RoughnessIndex)] * (HcSmooth - Hn);
8520 : }
8521 :
8522 32943554 : Real64 CalcDOE2Windward(Real64 const SurfaceTemp,
8523 : Real64 const AirTemp,
8524 : Real64 const CosineTilt,
8525 : Real64 const WindAtZ,
8526 : DataSurfaces::SurfaceRoughness const RoughnessIndex)
8527 : {
8528 : // FUNCTION INFORMATION:
8529 : // AUTHOR Brent Griffith
8530 : // DATE WRITTEN Aug 2010
8531 : // MODIFIED na
8532 : // RE-ENGINEERED na
8533 :
8534 : // PURPOSE OF THIS FUNCTION:
8535 : // calculate DOE-2 Hf equation for windward surfaces
8536 :
8537 : // METHODOLOGY EMPLOYED:
8538 : // encapsulate model equation in a function
8539 :
8540 : // REFERENCES:
8541 : // Lawrence Berkeley Laboratory. 1994. DOE2.1E-053 source code.
8542 : // Yazdanian, M. and J.H. Klems. 1994. Measurement of the exterior convective
8543 : // film coefficient for windows in low-rise buildings.
8544 : // ASHRAE Transactions 100(1): 1087.
8545 32943554 : Real64 HfSmooth = CalcMoWITTForcedWindward(WindAtZ);
8546 :
8547 32943554 : return CalcDOE2Forced(SurfaceTemp, AirTemp, CosineTilt, HfSmooth, RoughnessIndex);
8548 : }
8549 :
8550 15539528 : Real64 CalcDOE2Leeward(Real64 const SurfaceTemp,
8551 : Real64 const AirTemp,
8552 : Real64 const CosineTilt,
8553 : Real64 const WindAtZ,
8554 : DataSurfaces::SurfaceRoughness const RoughnessIndex)
8555 : {
8556 : // FUNCTION INFORMATION:
8557 : // AUTHOR Brent Griffith
8558 : // DATE WRITTEN Aug 2010
8559 : // MODIFIED na
8560 : // RE-ENGINEERED na
8561 :
8562 : // PURPOSE OF THIS FUNCTION:
8563 : // calculate DOE-2 Hf equation for leeward surfaces
8564 :
8565 : // METHODOLOGY EMPLOYED:
8566 : // encapsulate model equation in a function
8567 :
8568 : // REFERENCES:
8569 : // Lawrence Berkeley Laboratory. 1994. DOE2.1E-053 source code.
8570 : // Yazdanian, M. and J.H. Klems. 1994. Measurement of the exterior convective
8571 : // film coefficient for windows in low-rise buildings.
8572 : // ASHRAE Transactions 100(1): 1087.
8573 :
8574 15539528 : Real64 HfSmooth = CalcMoWITTForcedLeeward(WindAtZ);
8575 :
8576 15539528 : return CalcDOE2Forced(SurfaceTemp, AirTemp, CosineTilt, HfSmooth, RoughnessIndex);
8577 : }
8578 :
8579 0 : Real64 CalcNusseltJurges(Real64 const WindAtZ)
8580 : {
8581 :
8582 : // FUNCTION INFORMATION:
8583 : // AUTHOR Brent Griffith
8584 : // DATE WRITTEN Aug 2010
8585 : // MODIFIED na
8586 : // RE-ENGINEERED na
8587 :
8588 : // PURPOSE OF THIS FUNCTION:
8589 : // calculate model equation for forced convection using Nusselt Jurges correlation
8590 : // model is attributed to Nusselt and Jurges but the equation is recast in current units
8591 : // by Palyvos
8592 :
8593 : // METHODOLOGY EMPLOYED:
8594 : // encapsulate the model equation in a function
8595 :
8596 : // REFERENCES:
8597 : // 1. Nusselt, W., W. Jurges. 1922. Die Kuhlung einer ebenen Wand durch einen Luftstrom
8598 : // (The cooling of a plane wall by an air flow). Gesundheits Ingenieur 52, Heft, 45, Jargang.
8599 : // 2. Palyvos, J.A., 2008. A survey of wind convection coefficient correlations for building
8600 : // envelope energy systems' modeling. Applied Thermal Engineering 28 (2008) 801-808. Elsevier.
8601 :
8602 : // Return value
8603 : Real64 Hc;
8604 :
8605 0 : Hc = 5.8 + 3.94 * WindAtZ;
8606 :
8607 0 : return Hc;
8608 : }
8609 :
8610 0 : Real64 CalcMcAdams(Real64 const WindAtZ)
8611 : {
8612 :
8613 : // FUNCTION INFORMATION:
8614 : // AUTHOR Brent Griffith
8615 : // DATE WRITTEN Aug 2010
8616 : // MODIFIED na
8617 : // RE-ENGINEERED na
8618 :
8619 : // PURPOSE OF THIS FUNCTION:
8620 : // calculate model equation for forced convection using McAdams correlation
8621 : // model is attributed to McAdams but the equation is as recast in current units
8622 : // by Palyvos
8623 :
8624 : // METHODOLOGY EMPLOYED:
8625 : // encapsulate the model equation in a function
8626 :
8627 : // REFERENCES:
8628 : // 1. McAdams, W.H., 1954. Heat Transmission, third ed., McGraw-Hill, New York.
8629 : // 2. Palyvos, J.A., 2008. A survey of wind convection coefficient correlations for building
8630 : // envelope energy systems' modeling. Applied Thermal Engineering 28 (2008) 801-808. Elsevier.
8631 :
8632 : // Return value
8633 : Real64 Hc;
8634 :
8635 0 : Hc = 5.8 + 3.8 * WindAtZ;
8636 :
8637 0 : return Hc;
8638 : }
8639 :
8640 0 : Real64 CalcMitchell(Real64 const WindAtZ, Real64 const LengthScale)
8641 : {
8642 :
8643 : // FUNCTION INFORMATION:
8644 : // AUTHOR Brent Griffith
8645 : // DATE WRITTEN Aug 2010
8646 : // MODIFIED na
8647 : // RE-ENGINEERED na
8648 :
8649 : // PURPOSE OF THIS FUNCTION:
8650 : // calculate model equation for forced convection using Mitchell correlation
8651 : // model is attributed to Mitchell but the equation is as recast in current units
8652 : // by Palyvos
8653 :
8654 : // METHODOLOGY EMPLOYED:
8655 : // encapsulate the model equation in a function
8656 :
8657 : // REFERENCES:
8658 : // 1. Mitchell, J.W., 1976. Heat transfer from spheres and other animal forms. Biophy. J. 16 (1976) 561
8659 : // 2. Palyvos, J.A., 2008. A survey of wind convection coefficient correlations for building
8660 : // envelope energy systems' modeling. Applied Thermal Engineering 28 (2008) 801-808. Elsevier.
8661 :
8662 0 : return 8.6 * std::pow(WindAtZ, 0.6) / std::pow(LengthScale, 0.4);
8663 : }
8664 :
8665 0 : Real64 CalcMitchell(EnergyPlusData &state, Real64 const WindAtZ, Real64 const LengthScale, int const SurfNum)
8666 : {
8667 0 : if (LengthScale > 0.0) {
8668 0 : return CalcMitchell(WindAtZ, LengthScale);
8669 : } else {
8670 0 : if (state.dataConvectionCoefficient->CalcMitchellErrorIDX == 0) {
8671 0 : ShowSevereMessage(state, "CalcMitchell: Convection model not evaluated (bad length scale)");
8672 0 : ShowContinueError(state, format("Value for effective length scale = {:.5R}", LengthScale));
8673 0 : ShowContinueError(state, "Occurs for surface named = " + state.dataSurface->Surface(SurfNum).Name);
8674 0 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8675 : }
8676 0 : ShowRecurringSevereErrorAtEnd(state,
8677 : "CalcMitchell: Convection model not evaluated because bad length scale and set to 9.999 [W/m2-k]",
8678 0 : state.dataConvectionCoefficient->CalcMitchellErrorIDX);
8679 0 : return 9.999; // safe but noticeable
8680 : }
8681 : }
8682 :
8683 0 : Real64 CalcWindSurfaceTheta(Real64 const WindDir, Real64 const SurfAzimuth)
8684 : {
8685 : // Computes the angle theta between the wind direction and the surface azimuth
8686 : // Should always be a value between 0-180 deg
8687 :
8688 0 : Real64 windDir = std::fmod(WindDir, 360);
8689 0 : Real64 surfAzi = std::fmod(SurfAzimuth, 360);
8690 0 : Real64 theta = std::abs(windDir - surfAzi);
8691 0 : if (theta > 180) {
8692 0 : return abs(theta - 360);
8693 : } else {
8694 0 : return theta;
8695 : }
8696 : }
8697 :
8698 0 : Real64 CalcBlockenWindward(EnergyPlusData &state,
8699 : Real64 const WindAt10m,
8700 : Real64 const WindDir, // Wind direction measured clockwise from geographic North
8701 : Real64 const SurfAzimuth, // or Facing, Direction the surface outward normal faces (degrees)
8702 : int const SurfNum)
8703 : {
8704 :
8705 : // FUNCTION INFORMATION:
8706 : // AUTHOR Brent Griffith
8707 : // DATE WRITTEN Aug 2010
8708 : // MODIFIED na
8709 : // RE-ENGINEERED na
8710 :
8711 : // PURPOSE OF THIS FUNCTION:
8712 : // calculate model equation for forced convection using Blocken correlation
8713 :
8714 : // METHODOLOGY EMPLOYED:
8715 : // encapsulate model in function
8716 :
8717 : // REFERENCES:
8718 : // Blocken, B., T. Defraeye, D. Derome, J. Carmeliet. 2009.
8719 : // High-Resolution CFD Simulations for Forced Convection
8720 : // Heat Transfer Coefficients at the Facade of a Low-Rise Building.
8721 : // Building and Environment 44 (2009) 2396 - 2412.
8722 :
8723 0 : Real64 Theta = CalcWindSurfaceTheta(WindDir, SurfAzimuth); // angle between wind and surface azimuth
8724 :
8725 0 : if (Theta <= 11.25) {
8726 0 : return 4.6 * std::pow(WindAt10m, 0.89);
8727 0 : } else if (Theta <= 33.75) {
8728 0 : return 5.0 * std::pow(WindAt10m, 0.8);
8729 0 : } else if (Theta <= 56.25) {
8730 0 : return 4.6 * std::pow(WindAt10m, 0.84);
8731 0 : } else if (Theta <= 100.0) {
8732 0 : return 4.5 * std::pow(WindAt10m, 0.81);
8733 : } else {
8734 0 : if (state.dataConvectionCoefficient->CalcBlockenWindwardErrorIDX == 0) {
8735 0 : ShowSevereMessage(state, "CalcBlockenWindward: Convection model wind angle calculation suspect (developer issue)");
8736 0 : ShowContinueError(state, format("Value for theta angle = {:.5R}", Theta));
8737 0 : ShowContinueError(state, "Occurs for surface named = " + state.dataSurface->Surface(SurfNum).Name);
8738 0 : ShowContinueError(state, "Convection model uses EmmelVertical correlation and the simulation continues");
8739 : }
8740 0 : ShowRecurringSevereErrorAtEnd(state,
8741 : "CalcBlockenWindward: Convection model wind angle calculation suspect.",
8742 0 : state.dataConvectionCoefficient->CalcBlockenWindwardErrorIDX);
8743 0 : return CalcEmmelVertical(WindAt10m, WindDir, SurfAzimuth);
8744 : }
8745 : }
8746 :
8747 0 : Real64 CalcEmmelVertical(Real64 const WindAt10m,
8748 : Real64 const WindDir, // Wind direction measured clockwise from geographic North
8749 : Real64 const SurfAzimuth) // or Facing, Direction the surface outward normal faces (degrees)
8750 : {
8751 :
8752 : // FUNCTION INFORMATION:
8753 : // AUTHOR Brent Griffith
8754 : // DATE WRITTEN Aug 2010
8755 : // MODIFIED na
8756 : // RE-ENGINEERED na
8757 :
8758 : // PURPOSE OF THIS FUNCTION:
8759 : // calculate model equation for forced convection using Emmel correlation
8760 : // for vertical walls
8761 :
8762 : // METHODOLOGY EMPLOYED:
8763 : // encapsulate model in function
8764 :
8765 : // REFERENCES:
8766 : // Emmel, M.G., M.O. Abadie, N. Mendes. 2007. New external convective
8767 : // heat transfer coefficient correlations for isolated low-rise buildings.
8768 : // Energy and Buildings 39 (2007) 335- 342
8769 :
8770 0 : Real64 Theta = CalcWindSurfaceTheta(WindDir, SurfAzimuth); // angle between wind and surface azimuth
8771 :
8772 0 : if (Theta <= 22.5) {
8773 0 : return 5.15 * std::pow(WindAt10m, 0.81);
8774 0 : } else if (Theta <= 67.5) {
8775 0 : return 3.34 * std::pow(WindAt10m, 0.84);
8776 0 : } else if (Theta <= 112.5) {
8777 0 : return 4.78 * std::pow(WindAt10m, 0.71);
8778 0 : } else if (Theta <= 157.5) {
8779 0 : return 4.05 * std::pow(WindAt10m, 0.77);
8780 : } else {
8781 0 : return 3.54 * std::pow(WindAt10m, 0.76);
8782 : }
8783 : }
8784 :
8785 0 : Real64 CalcEmmelRoof(Real64 const WindAt10m,
8786 : Real64 const WindDir, // Wind direction measured clockwise from geographic North
8787 : Real64 const LongAxisOutwardAzimuth) // or Facing, Direction the surface outward normal faces (degrees)
8788 : {
8789 :
8790 : // FUNCTION INFORMATION:
8791 : // AUTHOR Brent Griffith
8792 : // DATE WRITTEN Aug 2010
8793 : // MODIFIED na
8794 : // RE-ENGINEERED na
8795 :
8796 : // PURPOSE OF THIS FUNCTION:
8797 : // calculate model equation for forced convection using Emmel correlation
8798 : // for horizontal roofs
8799 :
8800 : // METHODOLOGY EMPLOYED:
8801 : // encapsulate model in function
8802 :
8803 : // REFERENCES:
8804 : // Emmel, M.G., M.O. Abadie, N. Mendes. 2007. New external convective
8805 : // heat transfer coefficient correlations for isolated low-rise buildings.
8806 : // Energy and Buildings 39 (2007) 335- 342
8807 :
8808 0 : Real64 Theta = CalcWindSurfaceTheta(WindDir, LongAxisOutwardAzimuth); // angle between wind and surface azimuth
8809 :
8810 0 : if (Theta <= 22.5) {
8811 0 : return 5.11 * std::pow(WindAt10m, 0.78);
8812 0 : } else if (Theta <= 67.5) {
8813 0 : return 4.60 * std::pow(WindAt10m, 0.79);
8814 0 : } else if (Theta <= 112.5) {
8815 0 : return 3.67 * std::pow(WindAt10m, 0.85);
8816 0 : } else if (Theta <= 157.5) {
8817 0 : return 4.60 * std::pow(WindAt10m, 0.79);
8818 : } else {
8819 0 : return 5.11 * std::pow(WindAt10m, 0.78);
8820 : }
8821 : }
8822 :
8823 58819 : Real64 CalcClearRoof(EnergyPlusData &state,
8824 : Real64 const SurfTemp,
8825 : Real64 const AirTemp,
8826 : Real64 const WindAtZ,
8827 : Real64 const RoofArea,
8828 : Real64 const RoofPerimeter,
8829 : DataSurfaces::SurfaceRoughness const RoughnessIndex)
8830 : {
8831 : // Using/Aliasing
8832 : using Psychrometrics::PsyRhoAirFnPbTdbW;
8833 :
8834 : // FUNCTION PARAMETER DEFINITIONS:
8835 58819 : Real64 constexpr g(9.81); // gravity constant (m/s**2)
8836 58819 : Real64 constexpr v(15.89e-6); // kinematic viscosity (m**2/s) for air at 300 K
8837 58819 : Real64 constexpr k(0.0263); // thermal conductivity (W/m K) for air at 300 K
8838 58819 : Real64 constexpr Pr(0.71); // Prandtl number for air at ?
8839 :
8840 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
8841 : Real64 DeltaTemp;
8842 : Real64 Ln;
8843 : Real64 RaLn; // Rayleigh number
8844 : Real64 GrLn; // Grashof number
8845 : Real64 AirDensity;
8846 : Real64 Rex; // Reynolds number
8847 : Real64 x; // distance to roof edge toward wind direction
8848 : Real64 eta;
8849 117638 : Array1D<Real64> RfARR(6);
8850 : Real64 BetaFilm;
8851 :
8852 : // find x, don't know x. avoid time consuming geometry algorithm
8853 58819 : x = std::sqrt(RoofArea) / 2.0; // quick simplification, geometry routines to develop
8854 :
8855 58819 : if (RoofPerimeter > 0.0) {
8856 58819 : Ln = RoofArea / RoofPerimeter;
8857 : } else {
8858 0 : Ln = std::sqrt(RoofArea);
8859 : }
8860 58819 : DeltaTemp = SurfTemp - AirTemp;
8861 58819 : BetaFilm = 1.0 / (DataGlobalConstants::KelvinConv + SurfTemp + 0.5 * DeltaTemp);
8862 58819 : AirDensity = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, AirTemp, state.dataEnvrn->OutHumRat);
8863 :
8864 58819 : GrLn = g * pow_2(AirDensity) * pow_3(Ln) * std::abs(DeltaTemp) * BetaFilm / pow_2(v);
8865 58819 : RaLn = GrLn * Pr;
8866 :
8867 58819 : Rex = WindAtZ * AirDensity * x / v;
8868 :
8869 58819 : Real64 Rf = RoughnessMultiplier[static_cast<int>(RoughnessIndex)];
8870 58819 : if (Rex > 0.1) { // avoid zero and crazy small denominators
8871 58317 : Real64 tmp = std::log(1.0 + GrLn / pow_2(Rex));
8872 58317 : eta = tmp / (1.0 + tmp);
8873 : } else {
8874 502 : eta = 1.0; // forced convection gone because no wind
8875 : }
8876 :
8877 58819 : return eta * (k / Ln) * 0.15 * std::pow(RaLn, ConvectionConstants::OneThird) +
8878 117638 : (k / x) * Rf * 0.0296 * std::pow(Rex, ConvectionConstants::FourFifths) * std::pow(Pr, ConvectionConstants::OneThird);
8879 : }
8880 :
8881 53331 : Real64 CalcClearRoof(EnergyPlusData &state,
8882 : int const SurfNum,
8883 : Real64 const SurfTemp,
8884 : Real64 const AirTemp,
8885 : Real64 const WindAtZ,
8886 : [[maybe_unused]] Real64 const WindDirect, // Wind direction measured clockwise from geographic North
8887 : Real64 const RoofArea,
8888 : Real64 const RoofPerimeter)
8889 : {
8890 53331 : auto &Surface(state.dataSurface->Surface);
8891 :
8892 : Real64 x; // distance to roof edge toward wind direction
8893 :
8894 : DataSurfaces::SurfaceRoughness const RoughnessIndex =
8895 53331 : state.dataMaterial->Material(state.dataConstruction->Construct(Surface(SurfNum).Construction).LayerPoint(1)).Roughness;
8896 : // find x, don't know x. avoid time consuming geometry algorithm
8897 53331 : x = std::sqrt(RoofArea) / 2.0; // quick simplification, geometry routines to develop
8898 :
8899 53331 : if (x > 0.0) {
8900 29703 : return CalcClearRoof(state, SurfTemp, AirTemp, WindAtZ, RoofArea, RoofPerimeter, RoughnessIndex);
8901 : } else {
8902 23628 : if (state.dataConvectionCoefficient->CalcClearRoofErrorIDX == 0) {
8903 3 : ShowSevereMessage(state, "CalcClearRoof: Convection model not evaluated (bad value for distance to roof edge)");
8904 3 : ShowContinueError(state, format("Value for distance to roof edge ={:.3R}", x));
8905 3 : ShowContinueError(state, "Occurs for surface named = " + Surface(SurfNum).Name);
8906 3 : ShowContinueError(state, "Convection surface heat transfer coefficient set to 9.999 [W/m2-K] and the simulation continues");
8907 : }
8908 47256 : ShowRecurringSevereErrorAtEnd(
8909 : state,
8910 : "CalcClearRoof: Convection model not evaluated because bad value for distance to roof edge and set to 9.999 [W/m2-k]",
8911 23628 : state.dataConvectionCoefficient->CalcClearRoofErrorIDX);
8912 23628 : return 9.9999; // safe but noticeable
8913 : }
8914 : }
8915 :
8916 7884 : void CalcASTMC1340ConvCoeff(EnergyPlusData &state,
8917 : int const SurfNum, // surface number for which coefficients are being calculated
8918 : Real64 const SurfaceTemperature, // Temperature of surface for evaluation of HcIn
8919 : Real64 const ZoneMeanAirTemperature // Mean Air Temperature of Zone
8920 : )
8921 : {
8922 7884 : auto &Surface(state.dataSurface->Surface);
8923 :
8924 7884 : int ZoneNum = Surface(SurfNum).Zone;
8925 7884 : Real64 Volume = state.dataHeatBal->Zone(ZoneNum).Volume; // Volume of the zone in m3
8926 7884 : Real64 Vair = std::pow(Volume, ConvectionConstants::OneThird) * CalcZoneSystemACH(state, ZoneNum) / 3600;
8927 :
8928 7884 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) =
8929 7884 : CalcASTMC1340ConvCoeff(state, SurfNum, SurfaceTemperature, ZoneMeanAirTemperature, Vair, Surface(SurfNum).Tilt);
8930 :
8931 : // Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems)
8932 7884 : if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit)
8933 23 : state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit;
8934 7884 : }
8935 :
8936 7884 : Real64 CalcASTMC1340ConvCoeff(EnergyPlusData &state, int const SurfNum, Real64 const Tsurf, Real64 const Tair, Real64 const Vair, Real64 const Tilt)
8937 : {
8938 : // FUNCTION INFORMATION:
8939 : // AUTHOR Dareum Nam
8940 : // DATE WRITTEN Feb 2021
8941 : // MODIFIED na
8942 : // RE-ENGINEERED na
8943 :
8944 : // PURPOSE OF THIS FUNCTION:
8945 : // Calculate the inside convection coefficient for attic zones containing radiant barriers
8946 :
8947 : // REFERENCES:
8948 : // 1. ASTM C1340: Standard Practice for Estimation of Heat Gain or Loss Through Ceilings Under Attics
8949 : // Containing Radiant Barriers by Use of a Computer Program
8950 : // 2. Fontanini, A. D., Aguilar, J. L. C., Mitchell, M. S., Kosny, J., Merket, N., DeGraw, J. W., & Lee, E. (2018).
8951 : // Predicting the performance of radiant technologies in attics: Reducing the discrepancies between attic specific
8952 : // and whole-building energy models. Energy and Buildings, 169, 69-83.
8953 :
8954 : // Return Value
8955 : Real64 h; // Combined convection coefficient
8956 :
8957 : Real64 Nun; // Nusselt number for natural convection
8958 : Real64 Nuf; // Nusselt number for forced convection
8959 : Real64 hn; // Natural convection coefficient
8960 : Real64 hf; // Forced convection coefficient
8961 : Real64 Grc; // Critical Grashof number
8962 : Real64 DeltaTemp; // Temperature difference between TSurf and Tair
8963 : Real64 L; // Characteristic length: the length along the heat flow direction
8964 : // (the square root of surface area for floors and ceilings, average height for gables and walls, and length of pitched roof
8965 : // from soffit to ridge)
8966 : Real64 v; // The velocity of the air stream in m/s, (for interior surfaces)
8967 : // Surface Outside Face Outdoor Air Wind Speed (for exterior surfaces)
8968 : Real64 Pr; // Prandtl number
8969 : Real64 beta_SI; // Volume coefficient of expansion of air, 1/K
8970 : Real64 rho_SI; // Density of air, kg/m3
8971 : Real64 cp_SI; // Specific heat of air, J/kg.k
8972 : Real64 dv;
8973 : Real64 visc; // Kinematic viscosity of air, m2/s
8974 : Real64 k_SI_n;
8975 : Real64 k_SI_d;
8976 : Real64 k_SI; // Thermal conductivity of air, W/m.K
8977 : Real64 Ra; // Rayleigh number
8978 : Real64 Re; // Reynolds number
8979 7884 : constexpr Real64 g = DataGlobalConstants::GravityConstant; // Acceleration of gravity, m/s2
8980 :
8981 7884 : auto &Surface(state.dataSurface->Surface);
8982 :
8983 7884 : if (Tilt == 0 || Tilt == 180) { // Horizontal surface
8984 876 : L = std::sqrt(Surface(SurfNum).Area);
8985 : } else {
8986 7008 : L = Surface(SurfNum).Height;
8987 : }
8988 :
8989 7884 : if (Surface(SurfNum).ExtBoundCond == 0) {
8990 7008 : v = state.dataSurface->SurfOutWindSpeed(SurfNum);
8991 : } else {
8992 876 : v = Vair;
8993 : }
8994 :
8995 7884 : Pr = 0.7880 - (2.631 * std::pow(10, -4) * (Tair + 273.15));
8996 7884 : beta_SI = 1 / (Tair + 273.15);
8997 7884 : rho_SI = (22.0493 / (Tair + 273.15)) * 16;
8998 7884 : cp_SI = 0.068559 * (3.4763 + (1.066 * std::pow(10, -4) * (Tair + 273.15))) * 4186.8;
8999 7884 : dv = (241.9 * std::pow(10, -7)) * (145.8 * (Tair + 273.15) * std::pow((Tair + 273.15), 0.5)) / ((Tair + 273.15) + 110.4);
9000 7884 : visc = dv * (0.45359237 / (0.3048 * 3600)) / rho_SI;
9001 7884 : k_SI_n = (0.6325 * std::pow(10, -5) * std::pow((Tair + 273.15), 0.5) * 241.77);
9002 7884 : k_SI_d = (1.0 + (245.4 * std::pow(10, (-12 / (Tair + 273.15)))) / (Tair + 273.15));
9003 7884 : k_SI = 1.730735 * (k_SI_n / k_SI_d);
9004 :
9005 : // Calculation of DeltaTemp
9006 7884 : DeltaTemp = Tsurf - Tair;
9007 :
9008 7884 : Ra = std::abs(g * beta_SI * rho_SI * cp_SI * DeltaTemp * (L * L * L)) / (visc * k_SI);
9009 7884 : Re = (v * L) / visc;
9010 :
9011 : // Natural convection (Nun)
9012 7884 : if (Tilt == 0) { // Horizontal surface: Roof
9013 0 : if (DeltaTemp > 0) { // heat flow down
9014 0 : Nun = 0.58 * std::pow(Ra, 0.2);
9015 0 : } else if (Ra < 8000000) { // heat flow up
9016 0 : Nun = 0.54 * std::pow(Ra, 0.25);
9017 : } else {
9018 0 : Nun = 0.15 * std::pow(Ra, ConvectionConstants::OneThird);
9019 : }
9020 7884 : } else if (Tilt > 0 && Tilt < 90) { // Tilted roof
9021 7008 : if (DeltaTemp > 0) { // heat flow down
9022 679 : if (Tilt < 2) {
9023 0 : Nun = 0.58 * std::pow(Ra, 0.2);
9024 : } else {
9025 679 : Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * DataGlobalConstants::DegToRadians)), 0.25);
9026 : }
9027 : } else { // heat flow up
9028 2825 : if (Tilt < 15) {
9029 0 : Grc = 1000000;
9030 2825 : } else if (Tilt <= 75.0) {
9031 2825 : Grc = std::pow(10, Tilt / (1.1870 + (0.0870 * Tilt)));
9032 : } else {
9033 0 : Grc = 5000000000;
9034 : }
9035 2825 : if ((Ra / Pr) <= Grc) {
9036 24 : Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * 3.14159 / 180)), 0.25);
9037 : } else {
9038 5602 : Nun = 0.14 * (std::pow(Ra, ConvectionConstants::OneThird) - std::pow(Grc * Pr, ConvectionConstants::OneThird)) +
9039 2801 : 0.56 * std::pow(Grc * Pr * (std::sin(Tilt * DataGlobalConstants::DegToRadians)), 0.25);
9040 : }
9041 : }
9042 4380 : } else if (Tilt == 180) { // Horizontal surface: Floor
9043 876 : if (DeltaTemp <= 0) { // heat flow down
9044 205 : Nun = 0.58 * std::pow(Ra, 0.2);
9045 671 : } else if (Ra < 8000000) { // heat flow up
9046 0 : Nun = 0.54 * std::pow(Ra, 0.25);
9047 : } else {
9048 671 : Nun = 0.15 * std::pow(Ra, ConvectionConstants::OneThird);
9049 : }
9050 3504 : } else if (Tilt > 90 && Tilt < 180) { // Tilted Floor
9051 0 : if (DeltaTemp <= 0) { // heat flow down
9052 0 : if (Tilt > 178) {
9053 0 : Nun = 0.58 * std::pow(Ra, 0.2);
9054 : } else {
9055 0 : Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * DataGlobalConstants::DegToRadians)), 0.25);
9056 : }
9057 : } else { // heat flow up
9058 0 : if (Tilt > 165) {
9059 0 : Grc = 1000000;
9060 0 : } else if (Tilt <= 105.0) {
9061 0 : Grc = std::pow(10, Tilt / (1.1870 + (0.0870 * Tilt)));
9062 : } else {
9063 0 : Grc = 5000000000;
9064 : }
9065 0 : if ((Ra / Pr) <= Grc) {
9066 0 : Nun = 0.56 * std::pow(Ra * (std::sin(Tilt * DataGlobalConstants::DegToRadians)), 0.25);
9067 : } else {
9068 0 : Nun = 0.14 * (std::pow(Ra, ConvectionConstants::OneThird) - std::pow(Grc * Pr, ConvectionConstants::OneThird)) +
9069 0 : 0.56 * std::pow(Grc * Pr * (std::sin(Tilt * DataGlobalConstants::DegToRadians)), 0.25);
9070 : }
9071 : }
9072 : } else { // Vertical wall (Tilt = 90)
9073 3504 : if (Ra < 1000000000) {
9074 124 : Nun = 0.59 * std::pow(Ra, 0.25);
9075 : } else {
9076 3380 : Nun = 0.10 * std::pow(Ra, ConvectionConstants::OneThird);
9077 : }
9078 : }
9079 :
9080 : // Forced convection (Nuf)
9081 7884 : if (Re < 500000) {
9082 5924 : Nuf = 0.664 * std::pow(Pr, ConvectionConstants::OneThird) * std::pow(Re, 0.5);
9083 : } else {
9084 1960 : Nuf = std::pow(Pr, ConvectionConstants::OneThird) * ((0.037 * std::pow(Re, 0.8)) - 850);
9085 : }
9086 :
9087 : // Combined convection coefficient
9088 7884 : hf = Nuf * k_SI / L;
9089 7884 : hn = Nun * k_SI / L;
9090 7884 : h = std::pow((std::pow(hf, 3) + std::pow(hn, 3)), ConvectionConstants::OneThird);
9091 :
9092 7884 : return h;
9093 : }
9094 :
9095 44779 : ConvectionConstants::SurfConvOrientation GetSurfConvOrientation(Real64 const Tilt)
9096 : {
9097 44779 : if (Tilt < 5.0) {
9098 6349 : return ConvectionConstants::SurfConvOrientation::HorizontalDown;
9099 38430 : } else if ((Tilt >= 5.0) && (Tilt < 85.0)) {
9100 277 : return ConvectionConstants::SurfConvOrientation::TiltedDownward;
9101 38153 : } else if ((Tilt >= 85.0) && (Tilt < 95.0)) {
9102 30266 : return ConvectionConstants::SurfConvOrientation::Vertical;
9103 7887 : } else if ((Tilt >= 95.0) && (Tilt < 175.0)) {
9104 12 : return ConvectionConstants::SurfConvOrientation::TiltedUpward;
9105 7875 : } else if (Tilt >= 175.0) {
9106 7875 : return ConvectionConstants::SurfConvOrientation::HorizontalUp;
9107 : } else {
9108 0 : return ConvectionConstants::SurfConvOrientation::Invalid;
9109 : }
9110 : }
9111 2313 : } // namespace EnergyPlus::ConvectionCoefficients
|