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