Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, 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 : #ifndef DataRoomAirModel_hh_INCLUDED
49 : #define DataRoomAirModel_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Array2D.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/DataHeatBalance.hh>
59 : #include <EnergyPlus/DataZoneEquipment.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 :
62 : namespace EnergyPlus {
63 :
64 : namespace RoomAir {
65 :
66 : constexpr std::string_view cUserDefinedControlObject("RoomAir:TemperaturePattern:UserDefined");
67 : constexpr std::string_view cTempPatternConstGradientObject("RoomAir:TemperaturePattern:ConstantGradient");
68 : constexpr std::string_view cTempPatternTwoGradientObject("RoomAir:TemperaturePattern:TwoGradient");
69 : constexpr std::string_view cTempPatternNDHeightObject("RoomAir:TemperaturePattern:NondimensionalHeight");
70 : constexpr std::string_view cTempPatternSurfMapObject("RoomAir:TemperaturePattern:SurfaceMapping");
71 :
72 : // Parameters to indicate room air model selected
73 : enum class RoomAirModel : int
74 : {
75 : Invalid = -1,
76 : UserDefined, // user defined patterns
77 : Mixing, // mixing air model
78 : DispVent1Node, // Mundt nodal model
79 : DispVent3Node, // UCSD Displacement Ventilation model
80 : CrossVent, // UCSD-CV
81 : UFADInt, // UCSD UFAD interior zone model
82 : UFADExt, // UCSD UFAD exterior zone model
83 : AirflowNetwork, // RoomAirModel_AirflowNetwork interior zone model
84 : Num
85 : };
86 :
87 : extern const std::array<std::string_view, (int)RoomAirModel::Num> roomAirModelNames;
88 : extern const std::array<std::string_view, (int)RoomAirModel::Num> roomAirModelNamesUC;
89 :
90 : // Parameters to indicate air temperature coupling scheme
91 : enum class CouplingScheme
92 : {
93 : Invalid = -1,
94 : Direct,
95 : Indirect,
96 : Num
97 : };
98 :
99 : // Parameters to indicate type of air node, which is dependent on air models
100 : enum class AirNodeType
101 : {
102 : Invalid = -1,
103 : Inlet, // air node at inlet (for Mundt and Rees&Haves Models)
104 : Floor, // air node at floor (for Mundt and Rees&Haves Models)
105 : Control, // air node at control point (for Mundt Model)
106 : Ceiling, // air node at ceiling (for Mundt Model)
107 : Mundt, // air node for vertical walls (for Mundt Model)
108 : Return, // air node for return (for Mundt and Rees&Haves Models)
109 : AFN, // air node for airflow network based room air model
110 : Plume, // air node for plume load (for Rees&Haves Model)
111 : Rees, // air node for vertical walls (for Rees&Haves Model)
112 : Num
113 : };
114 :
115 : extern const std::array<std::string_view, (int)AirNodeType::Num> airNodeTypeNamesUC;
116 :
117 : // user-defined pattern two gradient interpolation modes
118 : enum class UserDefinedPatternMode
119 : {
120 : Invalid = -1,
121 : OutdoorDryBulb, // by outdoor air bulb.
122 : SensibleCooling, // by sensible cooling load
123 : SensibleHeating, // by sensible heating load
124 : ZoneAirTemp, // by zone air temperature
125 : DeltaOutdoorZone, // by difference between zone and outdoor
126 : Num
127 : };
128 :
129 : extern const std::array<std::string_view, (int)UserDefinedPatternMode::Num> userDefinedPatternModeNamesUC;
130 :
131 : // user defined temperature pattern types
132 : enum class UserDefinedPatternType
133 : {
134 : Invalid = -1,
135 : ConstGradTemp, // constant gradient in vertical direction
136 : TwoGradInterp, // two gradient interpolation
137 : NonDimenHeight, // non-dimensionalized height
138 : SurfMapTemp, // arbitrary surface mappings
139 : Num
140 : };
141 :
142 : extern const std::array<std::string_view, (int)UserDefinedPatternType::Num> userDefinedPatternNamesUC;
143 :
144 : // parameters to indicate diffuser type
145 : enum class Diffuser
146 : {
147 : Invalid = -1,
148 : Swirl,
149 : VarArea,
150 : DisplVent,
151 : LinBarGrille,
152 : Custom,
153 : Num
154 : };
155 :
156 : extern const std::array<std::string_view, (int)Diffuser::Num> diffuserNamesUC;
157 :
158 : enum class Comfort
159 : {
160 : Invalid = -1,
161 : Jet,
162 : Recirculation,
163 : Num
164 : };
165 :
166 : extern const std::array<std::string_view, (int)Comfort::Num> comfortNamesUC;
167 :
168 : struct AirModelData
169 : {
170 : // Members
171 : std::string Name = "";
172 : std::string ZoneName = "";
173 : int ZonePtr = 0; // Pointer to the zone number for this statement
174 : RoomAirModel AirModel = RoomAirModel::Mixing;
175 : CouplingScheme TempCoupleScheme = CouplingScheme::Direct;
176 : bool SimAirModel = false; // FALSE if Mixing air model is currently used and
177 : // TRUE if other air models are currently used
178 : };
179 :
180 : struct AirNodeData
181 : {
182 : // Members
183 : std::string Name = ""; // name
184 : std::string ZoneName = "";
185 : int ZonePtr = 0; // Pointer to the zone number for this statement
186 : AirNodeType ClassType = AirNodeType::Invalid; // depending on type of model
187 : Real64 Height = 0.0; // height
188 : Real64 ZoneVolumeFraction = 0.0; // portion of zone air volume associated with this node
189 : Array1D_bool SurfMask; // limit of 60 surfaces at current sizing
190 : bool IsZone = false; // TRUE if this node is zone node
191 : };
192 :
193 : struct DispVentData
194 : {
195 : // Members
196 : std::string ZoneName = ""; // Name of zone
197 : int ZonePtr = 0; // Pointer to the zone number for this statement
198 : Sched::Schedule *gainsSched = nullptr; // Schedule for internal gain fraction to occupied zone
199 : Real64 NumPlumesPerOcc = 0.0; // Effective number of plumes per occupant
200 : Real64 ThermostatHeight = 0.0; // Height of thermostat/ temperature control sensor
201 : Real64 ComfortHeight = 0.0; // Height at which air temperature is measured for comfort purposes
202 : Real64 TempTrigger = 0.0; // Minimum temperature difference between TOC TMX for stratification
203 : };
204 :
205 : struct CrossVentData
206 : {
207 : // Members
208 : std::string ZoneName = ""; // Name of zone
209 : int ZonePtr = 0; // Pointer to the zone number for this statement
210 : Sched::Schedule *gainsSched = nullptr; // Schedule for internal gain fraction to occupied zone
211 : Comfort VforComfort = Comfort::Invalid; // Use Recirculation or Jet velocity and temperatures
212 : // for comfort models
213 : };
214 :
215 : struct CrossVentFlow
216 : {
217 : // Members
218 : int FlowFlag = 0; // Equal to 1 if the opening has inflow, else equal to 0.
219 : Real64 Width = 0.0; // Width of the opening [m]
220 : Real64 Area = 0.0; // Area of the opening [m2]
221 : Real64 Fin = 0.0; // Inflow volume flux through the opening [m3/s]
222 : Real64 Uin = 0.0; // Inflow air velocity through the opening [m/s]
223 : Real64 Vjet = 0.0; // Average maximum jet velocity for the opening [m/s]
224 : Real64 Yjet = 0.0; // Y in "Y = aX + b" formula
225 : Real64 Ujet = 0.0; // Volume average jet region velocity [m/s]
226 : Real64 Yrec = 0.0; // Y in "Y = aX + b" formula
227 : Real64 Urec = 0.0; // Area-averaged velocity in the y-z plane with maximum flow [m/s]
228 : Real64 YQrec = 0.0; // Y in "Y = aX + b" formula
229 : Real64 Qrec = 0.0; // Total flow rate for the recirculation regions in the plane of maximum flow [m3/s]
230 : };
231 :
232 : struct CrossDispVentParameters
233 : {
234 : // Members
235 : Real64 Width = 0.0;
236 : Real64 Height = 0.0;
237 : int Shadow = 0;
238 : Real64 Zmin = 0.0;
239 : Real64 Zmax = 0.0;
240 : };
241 :
242 : struct UFADData
243 : {
244 : // Members
245 : std::string ZoneName = ""; // Name of zone
246 : int ZonePtr = 0; // Pointer to the zone number for this statement
247 : int ZoneEquipPtr = 0; // Pointer to zone equip for this UFAD zone
248 : Real64 DiffusersPerZone = 0.0; // Number of diffusers in this zone
249 : Real64 PowerPerPlume = 0.0; // Power in each plume [W]
250 : Real64 DiffArea = 0.0; // Effective area of a diffuser [m2]
251 : Real64 DiffAngle = 0.0; // angle between diffuser slots and vertical (degrees)
252 : Real64 HeatSrcHeight = 0.0; // height of heat source above floor [m]
253 : Real64 ThermostatHeight = 0.0; // Height of thermostat/ temperature control sensor [m]
254 : Real64 ComfortHeight = 0.0; // Height at which air temperature is measured for
255 : // comfort purposes [m]
256 : Real64 TempTrigger = 0.0; // Minimum temperature difference between TOC TMX
257 : // for stratification [deltaC]
258 : Diffuser DiffuserType = Diffuser::Invalid; // 1=Swirl, 2=variable area, 3=displacement, 4=linear bar grille, 5=custom
259 : Real64 TransHeight = 0.0; // user specified transition height [m]
260 : bool CalcTransHeight = false; // flag to calc trans height or use user specified input
261 : Real64 A_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2
262 : Real64 B_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2
263 : Real64 C_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2
264 : Real64 D_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2
265 : Real64 E_Kc = 0.0; // Coefficient A in Formula Kc = A*Gamma**B + C + D*Gamma + E*Gamma**2
266 : Real64 WinWidth = 0.0; // sum of widths of exterior windows in zone
267 : Real64 NumExtWin = 0.0; // number of exterior windows in the zone
268 : bool ShadeDown = false; // signals shade up or down
269 : };
270 :
271 : struct SurfMapPattern // nested structure in RoomAirPattern
272 : {
273 : // Members
274 : // user variables
275 : Array1D_string SurfName; // user defined name
276 : Array1D<Real64> DeltaTai; // (Tai - MAT ) offset from mean air temp
277 : int NumSurfs = 0; // number of surfaces in this pattern
278 : // calculated and from elsewhere
279 : Array1D_int SurfID; // index in HB surface structure array
280 : };
281 :
282 : struct ConstGradPattern // nested structure in RoomAirPattern
283 : {
284 : // Members
285 : // user variables
286 : std::string Name = ""; // name
287 : Real64 Gradient = 0.0; // value of vertical gradient [C/m]
288 : };
289 :
290 : struct TwoVertGradInterpolPattern // nested structure in RoomAirPattern
291 : {
292 : // Members
293 : // user variables
294 : std::string Name = ""; // name
295 : Real64 TstatHeight = 0.0; // Height of thermostat/ temperature control sensor
296 : Real64 TleavingHeight = 0.0; // height of return air node where leaving zone
297 : Real64 TexhaustHeight = 0.0; // height of exhaust air node where leaving zone
298 : Real64 LowGradient = 0.0; // lower value of vertical gradient [C/m]
299 : Real64 HiGradient = 0.0; // upper value of vertical gradient [C/m]
300 : UserDefinedPatternMode InterpolationMode = UserDefinedPatternMode::Invalid; // control for interpolation mode
301 : Real64 UpperBoundTempScale = 0.0; // temperature value for HiGradient
302 : Real64 LowerBoundTempScale = 0.0; // temperature value for LowGradient
303 : Real64 UpperBoundHeatRateScale = 0.0; // load value for HiGradient
304 : Real64 LowerBoundHeatRateScale = 0.0; // load value for lowGradient
305 : };
306 :
307 : struct TempVsHeightPattern // to be used as nested structure in RoomAirPattern
308 : {
309 : // Members
310 : Array1D<Real64> ZetaPatrn; // non dimensional height from floor,
311 : Array1D<Real64> DeltaTaiPatrn; // Tai- MAT (TODO, check sign)
312 : };
313 :
314 : struct TemperaturePattern // RoomAirPattern
315 : {
316 : // Members
317 : std::string Name = ""; // unique identifier
318 : int PatrnID = 0; // control ID for referencing in Schedules
319 : UserDefinedPatternType PatternMode = UserDefinedPatternType::Invalid; // Control for what type of calcs in this pattern
320 : ConstGradPattern GradPatrn; // Constant gradient pattern
321 : TwoVertGradInterpolPattern TwoGradPatrn; // Two gradient interpolation pattern
322 : TempVsHeightPattern VertPatrn; // Vertical gradient profile pattern
323 : SurfMapPattern MapPatrn; // Generic Surface map pattern
324 : Real64 DeltaTstat = 0.0; // (Tstat - MAT) offset deg C
325 : Real64 DeltaTleaving = 0.0; // (Tleaving - MAT) deg C
326 : Real64 DeltaTexhaust = 0.0; // (Texhaust - MAT) deg C
327 : };
328 :
329 : struct SurfaceAssocNested
330 : {
331 : // Members
332 : std::string Name = ""; // unique identifier
333 : int SurfID = 0; // id in HB surface structs
334 : Real64 TadjacentAir = 23.0; // place to put resulting temperature value
335 : Real64 Zeta = 0.0; // non-dimensional height in zone ot
336 : };
337 :
338 : struct AirPatternInfobyZone // becomes AirPatternZoneInfo
339 : {
340 : // Members
341 : // user variables
342 : bool IsUsed = false; // .TRUE. if user-defined patterns used in zone
343 : std::string Name = ""; // Name
344 : std::string ZoneName = ""; // Zone name in building
345 : int ZoneID = 0; // Index of Zone in Heat Balance
346 : Sched::Schedule *availSched = nullptr; // availability schedule
347 : Sched::Schedule *patternSched = nullptr; // pattern selecting schedule
348 : // calculated and from elsewhere
349 : Real64 ZoneHeight = 0.0; // in meters, from Zone%CeilingHeight
350 : int ZoneNodeID = 0; // index in Node array for this zone
351 : Array1D_int ExhaustAirNodeID; // indexes in Node array
352 : // Is 23.0 a constexpr somewhere
353 : Real64 TairMean = 23.0; // comes from MAT
354 : Real64 Tstat = 23.0; // temperature for thermostat
355 : Real64 Tleaving = 23.0; // temperature for return air node
356 : Real64 Texhaust = 23.0; // temperature for exhaust air node
357 : Array1D<SurfaceAssocNested> Surf; // nested struct w/ surface info
358 : int totNumSurfs = 0; // total surfs for this zone
359 : int firstSurfID = 0; // Index of first surface
360 : // report
361 : Real64 Gradient = 0.0; // result for modeled gradient if using two-gradient interpolation
362 : };
363 :
364 : struct AFNLinkInfoNested // becomes link
365 : {
366 : // Members
367 : // user variables
368 : int AFNSimuID = 0; // point to this linkage in AirflowNetworkLinkSimu structure
369 : int AFNDataID = 0; // point to this linkage in AirflowNetworkLinkageData structure
370 : int AFNReportID = 0; // point to this linkage in AirflowNetworkLinkReport structure
371 : Real64 MdotIn = 0.0; // mass flow rate of air into control volume(neg means leaving control volume) (kg / s)
372 : Real64 TempIn = 0.0; // drybulb temperature of air into control volume
373 : Real64 HumRatIn = 0.0; // humidity ratio of air into control volume
374 : };
375 :
376 : struct AFNNodeInternalGains // becomes IntGain
377 : {
378 : // Members
379 : // user variables
380 : DataHeatBalance::IntGainType type = DataHeatBalance::IntGainType::Invalid; // Internal type
381 : std::string Name = ""; // Intenral gain name
382 : bool UseRoomAirModelTempForGains = false; // TRUE if user inputs temp for gains
383 : bool FractionCheck = false; // TRUE if a fraction of internal gain for each object is checked
384 : };
385 :
386 : struct AFNHVAC // becomes HVAC
387 : {
388 : // Members
389 : // user variables
390 : std::string Name = ""; // HVAC system name
391 : std::string ObjectTypeName = ""; // HVAC object type name
392 : std::string SupplyNodeName = ""; // HVAC system supply node name
393 : std::string ReturnNodeName = ""; // HVAC system return node name
394 : DataZoneEquipment::ZoneEquipType zoneEquipType = DataZoneEquipment::ZoneEquipType::Invalid; // HVAC type num
395 : Real64 SupplyFraction = 0.0; // Supply flow fraction
396 : Real64 ReturnFraction = 0.0; // Return flow fraction
397 : int EquipConfigIndex = 0; // HVAC equipment configuration index
398 : int SupNodeNum = 0; // HVAC supply node number
399 : int RetNodeNum = 0; // HVAC return node number
400 : int CompIndex = 0; // Component index
401 : };
402 :
403 : struct AFNAirNodeNested // becomes Node
404 : {
405 : // Members
406 : // user variables
407 : std::string Name = ""; // name of the node itself
408 : Real64 ZoneVolumeFraction = 0.0; // Zone volume fraction applied to this specific node
409 : std::string NodeSurfListName = ""; // name of nodes' adjacent surface list
410 : bool HasSurfacesAssigned = false; // True if this node has surfaces assigned
411 : Array1D<bool> SurfMask; // Sized to num of surfs in Zone, true if surface is associated with this node
412 : std::string NodeIntGainsListName = ""; // name of node's internal gains list
413 : bool HasIntGainsAssigned = false; // True if this node has internal gain assigned
414 : int NumIntGains = 0; // Number of matching internal gain objects for all spaces in the zone
415 : Array1D<int> intGainsDeviceSpaces; // index pointers to space struct
416 : Array1D<int> IntGainsDeviceIndices; // index pointers to internal gains struct
417 : Array1D<Real64> IntGainsFractions; // gain fractions to this node
418 : Array1D<AFNNodeInternalGains> IntGain; // Internal gain struct
419 : std::string NodeHVACListName = ""; // name of node's HVAC list
420 : bool HasHVACAssigned = false; // True if HVAC systems are assigned to this node
421 : int NumHVACs = 0; // Number of HVAC systems
422 : Array1D<AFNHVAC> HVAC; // HVAC struct
423 : int AFNNodeID = 0; // pointer to AirflowNetworkNodeData structure
424 : int NumOfAirflowLinks = 0; // Number of intra zone links
425 : Array1D<AFNLinkInfoNested> Link; // Linkage struct
426 : Real64 AirVolume = 0.0; // air volume in control volume associated with this node(m3 / s)
427 : Real64 RhoAir = 0.0; // current density of air for nodal control volume
428 : Real64 CpAir = 0.0; // current heat capacity of air for nodal control volume
429 :
430 : Real64 AirTemp = 0.0; // node air temperature
431 : std::array<Real64, 4> AirTempX = {0.0, 0.0, 0.0, 0.0}; // node air temperature at t minus X zone timestep
432 : std::array<Real64, 4> AirTempDSX = {0.0, 0.0, 0.0, 0.0}; // node air temperature at t minus X system timestep
433 : Real64 AirTempT1 = 0.0; // node air temperature at the previous time step used in Exact and Euler method
434 : Real64 AirTempTX = 0.0; // temporary node air temperature to test convergence used in Exact and Euler method
435 : Real64 AirTempT2 = 0.0; // node air temperature at time step t-2 used in Exact and Euler method
436 :
437 : Real64 HumRat = 0.0; // node air humidity ratio
438 : std::array<Real64, 4> HumRatX = {0.0, 0.0, 0.0, 0.0}; // node air humidity ratio at t minus X zone timestep
439 : std::array<Real64, 4> HumRatDSX = {0.0, 0.0, 0.0, 0.0}; // node air humidity ratio at t minus 1 system timestep
440 : Real64 HumRatT1 = 0.0; // node air humidity ratio at the previous time step used in Exact and Euler method
441 : Real64 HumRatTX = 0.0; // temporary node air humidity ratio to test convergence used in Exact and Euler method
442 : Real64 HumRatT2 = 0.0; // node air humidity ratio at time step t-2 used in Exact and Euler method
443 :
444 : Real64 RelHumidity = 0.0; // node air relative humidity
445 :
446 : // sensible heat balance terms for node
447 : Real64 SumIntSensibleGain = 0.0; // rate of heat gain from internal sensible gains(after fraction)
448 : Real64 SumHA = 0.0; // sum of Hc * Area for surfaces associated with this node(surface convection sensible gain term)
449 : Real64 SumHATsurf = 0.0; // sum of Hc * Area * Temp for surfaces associated with this node for convective heat transfer
450 : Real64 SumHATref = 0.0; // sum of Hc * Area * Temp for surfaces associated with this node for radiation exchange
451 : Real64 SumLinkMCp = 0.0; // sum of mdor*Cp for incoming airflows for this node derived from the AirflowNetwork model
452 : Real64 SumLinkMCpT = 0.0; // sum of mdor*Cp*T for incoming airflows and source temperature for this node derived from the AirflowNetwork model
453 : Real64 SumSysMCp = 0.0; // sum of mdor*Cp for incoming supply airflows for this node
454 : Real64 SumSysMCpT = 0.0; // sum of mdor*Cp*T for incoming supply airflows and temperature for this node
455 : Real64 SumSysM = 0.0; // sum of mdot for incoming supply airflows for this node
456 : Real64 SumSysMW = 0.0; // sum of mdot*W for incoming supply airflows and temperature for this node
457 : Real64 NonAirSystemResponse = 0.0; // sum of convective system load
458 : Real64 SysDepZoneLoadsLagged = 0.0; // sum of system lagged load
459 : Real64 SysDepZoneLoadsLaggedOld = 0.0; // sum of system lagged load
460 : Real64 AirCap = 0.0; // Air storage term for energy balalce at each node
461 : Real64 AirHumRat = 0.0; // Air storage term for moisture balalce at each node
462 : // latent moisture balance terms for node
463 : Real64 SumIntLatentGain = 0.0; // rate of heat gain form internal latent gains(after fraction)
464 : Real64 SumHmAW = 0.0; // sum of AREA*Moist CONVECTION COEFF*INSIDE Humidity Ratio
465 : Real64 SumHmARa = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air
466 : Real64 SumHmARaW = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air* Inside Humidity Ratio
467 : Real64 SumLinkM = 0.0; // sum of mdor for incoming airflows for this node derived from the AirflowNetwork model
468 : Real64 SumLinkMW =
469 : 0.0; // sum of mdor*Cp*T for incoming airflows and source humidity ratio for this node derived from the AirflowNetwork model
470 : };
471 :
472 : struct AFNInfoByZone // becomes RoomAirflowNetworkZoneInfo
473 : {
474 : // Members
475 : // user variables
476 : bool IsUsed = false; // true. if RoomAirflowNetwork model used in zone
477 : std::string Name = ""; // Name
478 : std::string ZoneName = ""; // Zone name in building
479 : int ZoneID = 0; // Index of Zone in Heat Balance
480 : int ActualZoneID = 0; // Index of controlled zones in ZoneCOnfigure
481 : Sched::Schedule *availSched = nullptr; // index of availability schedule
482 : int ControlAirNodeID = 0; // index of roomair node that is HVAC control sensor location
483 : int NumOfAirNodes = 0; // Number of air nodes
484 : Array1D<AFNAirNodeNested> Node; // Node struct
485 : int ZoneNodeID = 0; // index in system Node array for this zone
486 : Real64 TairMean = 0.0; // comes from MAT
487 : Real64 Tstat = 0.0; // temperature for thermostat
488 : Real64 Tleaving = 0.0; // temperature for return air node
489 : Real64 Texhaust = 0.0; // temperature for exhaust air node
490 : int totNumSurfs = 0; // total surfs for this zone
491 : int firstSurfID = 0; // Index of first surface
492 : };
493 :
494 : struct BegEnd
495 : {
496 : int beg = 0;
497 : int end = 0;
498 : };
499 : } // namespace RoomAir
500 :
501 : struct RoomAirModelData : BaseGlobalStruct
502 : {
503 : bool GetAirModelData = true; // Used to "get" all air model data
504 : bool MyOneTimeFlag = true;
505 : Array1D_bool MyEnvrnFlag;
506 :
507 : bool anyNonMixingRoomAirModel = false; // True if any zone RoomAirModelType is not Mixing
508 : int TotNumOfAirNodes = 0;
509 : int TotNumOfRoomAFNNodes = 0;
510 : Array1D_int TotNumOfZoneAirNodes;
511 : Array1D<Real64> ConvectiveFloorSplit;
512 : Array1D<Real64> InfiltratFloorSplit;
513 : // UCSD
514 : int TotDispVent3Node = 0; // Total number of UCSDDV zones
515 : Array1D<Real64> DispVent3NodeHcIn;
516 : Array1D_bool IsZoneDispVent3Node; // Is the air model for the zone UCSDDV?
517 : Array1D<Real64> ZTOC; // Temperature of occupied (lower) zone
518 : Array1D<Real64> AvgTempGrad; // vertical Average Temperature Gradient in the room
519 : Array1D<Real64> ZTMX; // Temperature of the mixing(upper) layer
520 : Array1D<Real64> MaxTempGrad; // maximum Average Temperature Gradient in the room
521 : Array1D<Real64> HVACAirTemp; // HVAC system temperature (DEG C)
522 : Array1D<Real64> HVACMassFlow; // HVAC system mass flow rate (KG/S)
523 : Array1D<Real64> ZTFloor;
524 : Array1D<Real64> HeightTransition;
525 : Array1D<Real64> FracMinFlow;
526 : Array1D_int ZoneDispVent3NodeMixedFlag;
527 : Array1D<Real64> ZoneDispVent3NodeMixedFlagRep;
528 : Array1D_bool ZoneAirSystemON;
529 : Array1D<Real64> TCMF; // comfort temperature
530 : Array1D<Real64> ZoneCeilingHeight1;
531 : Array1D<Real64> ZoneCeilingHeight2;
532 : Array1D<Real64> MATFloor; // [C] floor level mean air temp
533 : EPVector<std::array<Real64, 4>> XMATFloor; // [C] floor level mean air temp at t minus X zone time step
534 : EPVector<std::array<Real64, 4>> DSXMATFloor; // [C] floor level mean air temp at t minus X system time step
535 : Array1D<Real64> MATOC; // [C] occupied mean air temp
536 : EPVector<std::array<Real64, 4>> XMATOC; // [C] occupied mean air temp at t minus X zone time step
537 : EPVector<std::array<Real64, 4>> DSXMATOC; // [C] occupied mean air temp at t minus X system time step
538 : Array1D<Real64> MATMX; // [C] mixed (upper) mean air temp
539 : EPVector<std::array<Real64, 4>> XMATMX; // [C] mixed (upper) mean air temp at t minus X zone time step
540 : EPVector<std::array<Real64, 4>> DSXMATMX; // [C] mixed mean air temp at t minus X system time step
541 : EPVector<std::array<Real64, 3>> ZTMFloor; // [C] difference equation's Floor air temp at t minus X
542 : EPVector<std::array<Real64, 3>> ZTMOC; // [C] difference equation's Occupied air temp at t minus X
543 : EPVector<std::array<Real64, 3>> ZTMMX; // [C] difference equation's Mixed air temp at t minus X
544 : Array1D<Real64> AIRRATFloor;
545 : Array1D<Real64> AIRRATOC;
546 : Array1D<Real64> AIRRATMX;
547 : // Euler and Exact solution algorithms
548 : Array1D<Real64> Zone1Floor; // [C] difference equation's Floor air temp at previous dt
549 : Array1D<Real64> ZoneMXFloor; // [C] difference equation's Floor air temp at t minus 1
550 : Array1D<Real64> ZoneM2Floor; // [C] difference equation's Floor air temp at t minus 2
551 : Array1D<Real64> Zone1OC; // [C] difference equation's Occupied air temp at previous dt
552 : Array1D<Real64> ZoneMXOC; // [C] difference equation's Occupied air temp at t minus 1
553 : Array1D<Real64> ZoneM2OC; // [C] difference equation's Occupied air temp at t minus 2
554 : Array1D<Real64> Zone1MX; // [C] difference equation's Mixed air temp at previous dt
555 : Array1D<Real64> ZoneMXMX; // [C] difference equation's Mixed air temp at t minus 1
556 : Array1D<Real64> ZoneM2MX; // [C] difference equation's Mixed air temp at t minus 2
557 :
558 : // UCSD-Shared
559 : // The Eplus surface numbers will be stored in the arrays Apos according to the
560 : // type of surface. The PosZ_Wall array has dimension 2 times the Number of Zones and
561 : // for each zone it has 2 positions: the start and end positions in the Apos_Wall array
562 : // for that specific zone.
563 : Array1D_int APos_Wall;
564 : Array1D_int APos_Floor;
565 : Array1D_int APos_Ceiling;
566 : EPVector<RoomAir::BegEnd> PosZ_Wall;
567 : EPVector<RoomAir::BegEnd> PosZ_Floor;
568 : EPVector<RoomAir::BegEnd> PosZ_Ceiling;
569 : Array1D_int APos_Window;
570 : Array1D_int APos_Door;
571 : Array1D_int APos_Internal;
572 : EPVector<RoomAir::BegEnd> PosZ_Window;
573 : EPVector<RoomAir::BegEnd> PosZ_Door;
574 : EPVector<RoomAir::BegEnd> PosZ_Internal;
575 : // Convection coefficients for the various surfaces
576 : Array1D<Real64> HCeiling;
577 : Array1D<Real64> HWall;
578 : Array1D<Real64> HFloor;
579 : Array1D<Real64> HInternal;
580 : Array1D<Real64> HWindow;
581 : Array1D<Real64> HDoor;
582 :
583 : // UCSD-CV
584 : int TotCrossVent = 0; // Total number of UCSDDV zones
585 : int CrossVentNumAFNSurfaces = 0; // total number of AirFlowNetwork surfaces.
586 : Array1D<Real64> CrossVentHcIn;
587 : Array1D_bool IsZoneCrossVent; // Is the air model for the zone UCSDDV?
588 : Array1D<Real64> ZoneCrossVentIsMixing; // Zone set to CV is actually using a mixing model
589 : Array1D<Real64> ZTJET; // Jet Temperatures
590 : Array1D<Real64> ZTREC; // Recirculation Temperatures
591 : Array1D<Real64> RoomOutflowTemp; // Temperature of air flowing out of the room
592 : Array1D<Real64> JetRecAreaRatio;
593 : Array1D<Real64> Urec; // Recirculation region average velocity
594 : Array1D<Real64> Ujet; // Jet region average velocity
595 : Array1D<Real64> Qrec; // Recirculation zone total flow rate
596 : Array1D<Real64> Qtot; // Total volumetric inflow rate through all active aperatures [m3/s]
597 : Array1D<Real64> RecInflowRatio; // Ratio of the recirculation volumetric flow rate to the total inflow flow rate []
598 : Array1D<Real64> Uhc;
599 : Array1D<Real64> Ain; // Inflow aperture area
600 : Array1D<Real64> Droom; // CV Zone average length
601 : Array1D<Real64> Dstar; // CV Zone average length, wind direction corrected
602 : Array1D<Real64> Tin; // Inflow air temperature
603 : Array1D<Real64> TotArea; // Sum of the areas of all apertures in the zone
604 : Array2D_int AFNSurfaceCrossVent; // table for AirflowNetwork surfaces organization
605 : // Interzone surfaces counts twice.
606 : Array1D<Real64> Rfr; // Ration between inflow and recirculation air flows
607 : Array1D<Real64> ZoneCrossVentHasREC; // Airflow pattern is C = 0, CR(1)
608 : bool UCSDModelUsed = false;
609 : bool DispVent1NodeModelUsed = false;
610 : // UCSD-UF
611 : int TotUFADInt = 0; // total number of UCSDUI zones
612 : int TotUFADExt = 0; // total number of UCSDUE zones
613 : Array1D_bool IsZoneUFAD; // controls program flow, for interior or exterior UFAD model
614 : Array1D_int ZoneUFADPtr;
615 : Array1D<Real64> UFADHcIn;
616 : Array1D_int ZoneUFADMixedFlag;
617 : Array1D<Real64> ZoneUFADMixedFlagRep;
618 : Array1D<Real64> ZoneUFADGamma;
619 : Array1D<Real64> ZoneUFADPowInPlumes; // [W]
620 : Array1D<Real64> ZoneUFADPowInPlumesfromWindows; // [W]
621 : Array1D<Real64> Phi; // dimensionless measure of occupied subzone temperature
622 : // END UCSD
623 : // Begin NREL User-defined patterns
624 : int numTempDistContrldZones = 0; // count of zones with user-defined patterns
625 : int NumAirTempPatterns = 0; // count of all different patterns in input file
626 : int NumConstantGradient = 0; // count of constant gradient patterns in input
627 : int NumTwoGradientInterp = 0; // count of two gradient interp patterns in input
628 : int NumNonDimensionalHeight = 0; // count of ND height profile patterns in input
629 : int NumSurfaceMapping = 0; // count of generic surface map patterns in input
630 : bool UserDefinedUsed = false; // true if user-defined model used anywhere
631 : // End User-defined patterns
632 :
633 : // RoomAirflowNetwork
634 : int NumOfRoomAFNControl = 0; // count of RoomAirSettings:AirflowNetwork
635 :
636 : // Object Data
637 : EPVector<RoomAir::AirModelData> AirModel;
638 : EPVector<RoomAir::AirNodeData> AirNode;
639 : EPVector<RoomAir::DispVentData> ZoneDispVent3Node; // UCSD
640 : EPVector<RoomAir::CrossVentData> ZoneCrossVent;
641 : EPVector<RoomAir::UFADData> ZoneUFAD;
642 : Array2D<RoomAir::CrossVentFlow> CrossVentJetRecFlows; // Jet and recirculation zone flows and properties
643 : EPVector<RoomAir::CrossDispVentParameters> SurfParametersCrossDispVent; // Surface parameters
644 : EPVector<RoomAir::TemperaturePattern> AirPattern; // user defined patterns ,various types
645 : EPVector<RoomAir::AirPatternInfobyZone> AirPatternZoneInfo; // added zone information for user defined patterns
646 : EPVector<RoomAir::AFNInfoByZone> AFNZoneInfo; // added zone info
647 :
648 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
649 : {
650 2126 : }
651 :
652 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
653 : {
654 1152 : }
655 :
656 2100 : void clear_state() override
657 : {
658 2100 : anyNonMixingRoomAirModel = false;
659 2100 : TotNumOfAirNodes = 0;
660 2100 : TotNumOfRoomAFNNodes = 0;
661 2100 : TotNumOfZoneAirNodes.clear();
662 2100 : ConvectiveFloorSplit.clear();
663 2100 : InfiltratFloorSplit.clear();
664 : // UCSD
665 2100 : APos_Wall.clear();
666 2100 : APos_Floor.clear();
667 2100 : APos_Ceiling.clear();
668 2100 : PosZ_Wall.clear();
669 2100 : PosZ_Floor.clear();
670 2100 : PosZ_Ceiling.clear();
671 2100 : APos_Window.clear();
672 2100 : APos_Door.clear();
673 2100 : APos_Internal.clear();
674 2100 : PosZ_Window.clear();
675 2100 : PosZ_Door.clear();
676 2100 : PosZ_Internal.clear();
677 : // Convection coeficients for the various surfaces
678 2100 : HCeiling.clear();
679 2100 : HWall.clear();
680 2100 : HFloor.clear();
681 2100 : HInternal.clear();
682 2100 : HWindow.clear();
683 2100 : HDoor.clear();
684 :
685 2100 : TotDispVent3Node = 0; // Total number of UCSDDV zones
686 2100 : DispVent3NodeHcIn.clear();
687 2100 : IsZoneDispVent3Node.clear(); // Is the air model for the zone UCSDDV?
688 2100 : ZTOC.clear(); // Temperature of occupied (lower) zone
689 2100 : AvgTempGrad.clear(); // vertical Average Temperature Gradient in the room
690 2100 : ZTMX.clear(); // Temperature of the mixing(upper) layer
691 2100 : MaxTempGrad.clear(); // maximum Average Temperature Gradient in the room
692 2100 : HVACAirTemp.clear(); // HVAC system temperature (DEG C)
693 2100 : HVACMassFlow.clear(); // HVAC system mass flow rate (KG/S)
694 2100 : ZTFloor.clear();
695 2100 : HeightTransition.clear();
696 2100 : FracMinFlow.clear();
697 2100 : ZoneDispVent3NodeMixedFlag.clear();
698 2100 : ZoneDispVent3NodeMixedFlagRep.clear();
699 2100 : ZoneAirSystemON.clear();
700 2100 : TCMF.clear(); // comfort temperature
701 2100 : ZoneCeilingHeight1.clear();
702 2100 : ZoneCeilingHeight2.clear();
703 2100 : MATFloor.clear(); // [C] floor level mean air temp
704 2100 : XMATFloor.clear(); // [C] floor level mean air temp at t minus 1 zone time step
705 2100 : DSXMATFloor.clear(); // [C] floor level mean air temp at t minus 1 system time step
706 2100 : MATOC.clear(); // [C] occupied mean air temp
707 2100 : XMATOC.clear(); // [C] occupied mean air temp at t minus 1 zone time step
708 2100 : DSXMATOC.clear(); // [C] occupied mean air temp at t minus 1 system time step
709 2100 : MATMX.clear(); // [C] mixed (upper) mean air temp
710 2100 : XMATMX.clear(); // [C] mixed (upper) mean air temp at t minus 1 zone time step
711 2100 : DSXMATMX.clear(); // [C] mixed mean air temp at t minus 1 system time step
712 2100 : ZTMFloor.clear(); // [C] difference equation's Floor air temp at t minus 1
713 2100 : ZTMOC.clear(); // [C] difference equation's Occupied air temp at t minus 1
714 2100 : ZTMMX.clear(); // [C] difference equation's Mixed air temp at t minus 1
715 2100 : AIRRATFloor.clear();
716 2100 : AIRRATOC.clear();
717 2100 : AIRRATMX.clear();
718 : // Euler and Exact solution algorithms
719 2100 : Zone1Floor.clear(); // [C] difference equation's Floor air temp at previous dt
720 2100 : ZoneMXFloor.clear(); // [C] difference equation's Floor air temp at t minus 1
721 2100 : ZoneM2Floor.clear(); // [C] difference equation's Floor air temp at t minus 2
722 2100 : Zone1OC.clear(); // [C] difference equation's Occupied air temp at previous dt
723 2100 : ZoneMXOC.clear(); // [C] difference equation's Occupied air temp at t minus 1
724 2100 : ZoneM2OC.clear(); // [C] difference equation's Occupied air temp at t minus 2
725 2100 : Zone1MX.clear(); // [C] difference equation's Mixed air temp at previous dt
726 2100 : ZoneMXMX.clear(); // [C] difference equation's Mixed air temp at t minus 1
727 2100 : ZoneM2MX.clear(); // [C] difference equation's Mixed air temp at t minus 2
728 : // UCSD-CV
729 2100 : TotCrossVent = 0; // Total number of UCSDDV zones
730 2100 : CrossVentNumAFNSurfaces = 0; // total number of AirFlowNetwork surfaces.
731 2100 : CrossVentHcIn.clear();
732 2100 : IsZoneCrossVent.clear(); // Is the air model for the zone UCSDDV?
733 2100 : ZoneCrossVentIsMixing.clear(); // Zone set to CV is actually using a mixing model
734 2100 : ZTJET.clear(); // Jet Temperatures
735 2100 : ZTREC.clear(); // Recirculation Temperatures
736 2100 : RoomOutflowTemp.clear(); // Temperature of air flowing out of the room
737 2100 : JetRecAreaRatio.clear();
738 2100 : Urec.clear(); // Recirculation region average velocity
739 2100 : Ujet.clear(); // Jet region average velocity
740 2100 : Qrec.clear(); // Recirculation zone total flow rate
741 2100 : Qtot.clear(); // Total volumetric inflow rate through all active aperatures [m3/s]
742 2100 : RecInflowRatio.clear(); // Ratio of the recirculation volumetric flow rate to the total inflow flow rate []
743 2100 : Uhc.clear();
744 2100 : Ain.clear(); // Inflow aperture area
745 2100 : Droom.clear(); // CV Zone average length
746 2100 : Dstar.clear(); // CV Zone average length, wind direction corrected
747 2100 : Tin.clear(); // Inflow air temperature
748 2100 : TotArea.clear(); // Sum of the areas of all apertures in the zone
749 2100 : AFNSurfaceCrossVent.clear(); // table for AirflowNetwork surfaces organization
750 : // Interzone surfaces counts twice.
751 2100 : Rfr.clear(); // Ration between inflow and recirculation air flows
752 2100 : ZoneCrossVentHasREC.clear(); // Airflow pattern is C = 0, CR(1)
753 2100 : UCSDModelUsed = false;
754 2100 : DispVent1NodeModelUsed = false;
755 : // UCSD-UF
756 2100 : TotUFADInt = 0; // total number of UCSDUI zones
757 2100 : TotUFADExt = 0; // total number of UCSDUE zones
758 2100 : IsZoneUFAD.clear(); // controls program flow, for interior or exterior UFAD model
759 2100 : ZoneUFADPtr.clear();
760 2100 : UFADHcIn.clear();
761 2100 : ZoneUFADMixedFlag.clear();
762 2100 : ZoneUFADMixedFlagRep.clear();
763 2100 : ZoneUFADGamma.clear();
764 2100 : ZoneUFADPowInPlumes.clear(); // [W]
765 2100 : ZoneUFADPowInPlumesfromWindows.clear(); // [W]
766 2100 : Phi.clear(); // dimensionless measure of occupied subzone temperature
767 : // END UCSD
768 : // Begin NREL User-defined patterns
769 2100 : numTempDistContrldZones = 0; // count of zones with user-defined patterns
770 2100 : NumAirTempPatterns = 0; // count of all different patterns in input file
771 2100 : NumConstantGradient = 0; // count of constant gradient patterns in input
772 2100 : NumTwoGradientInterp = 0; // count of two gradient interp patterns in input
773 2100 : NumNonDimensionalHeight = 0; // count of ND height profile patterns in input
774 2100 : NumSurfaceMapping = 0; // count of generic surface map patterns in input
775 2100 : UserDefinedUsed = false; // true if user-defined model used anywhere
776 : // End User-defined patterns
777 :
778 : // RoomAirflowNetwork
779 2100 : NumOfRoomAFNControl = 0; // count of RoomAirSettings:AirflowNetwork
780 :
781 : // Object Data
782 2100 : AirModel.clear();
783 2100 : AirNode.clear();
784 2100 : ZoneDispVent3Node.clear(); // UCSD
785 2100 : ZoneCrossVent.clear();
786 2100 : ZoneUFAD.clear();
787 2100 : CrossVentJetRecFlows.clear(); // Jet and recirculation zone flows and properties
788 2100 : SurfParametersCrossDispVent.clear(); // Surface parameters
789 2100 : AirPattern.clear(); // user defined patterns ,various types
790 2100 : AirPatternZoneInfo.clear(); // added zone information for user defined patterns
791 2100 : AFNZoneInfo.clear(); // added zone info
792 2100 : }
793 : };
794 :
795 : } // namespace EnergyPlus
796 :
797 : #endif
|