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 DataZoneEquipment_hh_INCLUDED
49 : #define DataZoneEquipment_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <unordered_set>
53 :
54 : // ObjexxFCL Headers
55 : #include <ObjexxFCL/Array1D.hh>
56 : #include <ObjexxFCL/Optional.hh>
57 :
58 : // EnergyPlus Headers
59 : #include <EnergyPlus/Data/BaseData.hh>
60 : #include <EnergyPlus/DataGlobals.hh>
61 : #include <EnergyPlus/DataHVACSystems.hh>
62 : #include <EnergyPlus/DataLoopNode.hh>
63 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
64 : #include <EnergyPlus/EnergyPlus.hh>
65 : #include <EnergyPlus/ExhaustAirSystemManager.hh>
66 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
67 : #include <EnergyPlus/OutputProcessor.hh>
68 : #include <EnergyPlus/SystemAvailabilityManager.hh>
69 : #include <EnergyPlus/SystemReports.hh>
70 :
71 : namespace EnergyPlus {
72 :
73 : // Forward declarations
74 : struct EnergyPlusData;
75 :
76 : namespace DataZoneEquipment {
77 :
78 : // Using/Aliasing
79 : // Data
80 : // -only module should be available to other modules and routines.
81 : // Thus, all variables in this module must be PUBLIC.
82 :
83 : // MODULE PARAMETER DEFINITIONS:
84 : enum class AirNodeType
85 : {
86 : Invalid = -1,
87 : PathInlet,
88 : CompInlet,
89 : Intermediate,
90 : Outlet,
91 : Num
92 : };
93 :
94 : enum class AirLoopHVACZone
95 : {
96 : Invalid = -1,
97 : Splitter,
98 : SupplyPlenum,
99 : Mixer,
100 : ReturnPlenum,
101 : Num
102 : };
103 :
104 : constexpr std::array<std::string_view, static_cast<int>(AirLoopHVACZone::Num)> AirLoopHVACTypeNamesCC = {
105 : "AirLoopHVAC:ZoneSplitter", "AirLoopHVAC:SupplyPlenum", "AirLoopHVAC:ZoneMixer", "AirLoopHVAC:ReturnPlenum"};
106 :
107 : constexpr std::array<std::string_view, static_cast<int>(AirLoopHVACZone::Num)> AirLoopHVACTypeNamesUC = {
108 : "AIRLOOPHVAC:ZONESPLITTER", "AIRLOOPHVAC:SUPPLYPLENUM", "AIRLOOPHVAC:ZONEMIXER", "AIRLOOPHVAC:RETURNPLENUM"};
109 :
110 : // Start zone equip objects
111 : // list units that are valid for zone system availability managers first
112 : enum ZoneEquipType
113 : {
114 : Invalid = -1,
115 : DUMMY,
116 : FourPipeFanCoil,
117 : PackagedTerminalHeatPump,
118 : PackagedTerminalAirConditioner,
119 : PackagedTerminalHeatPumpWaterToAir,
120 : WindowAirConditioner,
121 : UnitHeater,
122 : UnitVentilator,
123 : EnergyRecoveryVentilator,
124 : VentilatedSlab,
125 : OutdoorAirUnit,
126 : VariableRefrigerantFlowTerminal,
127 : PurchasedAir,
128 : EvaporativeCooler,
129 : HybridEvaporativeCooler, // last zone equipment type to use zone availability manager. The above list must not change or
130 : // NumValidSysAvailZoneComponents must also change.
131 : AirDistributionUnit,
132 : BaseboardConvectiveWater,
133 : BaseboardConvectiveElectric,
134 : BaseboardSteam,
135 : BaseboardWater,
136 : BaseboardElectric,
137 : HighTemperatureRadiant,
138 : LowTemperatureRadiantConstFlow,
139 : LowTemperatureRadiantVarFlow,
140 : LowTemperatureRadiantElectric,
141 : ExhaustFan,
142 : HeatExchanger,
143 : HeatPumpWaterHeaterPumpedCondenser,
144 : HeatPumpWaterHeaterWrappedCondenser,
145 : DehumidifierDX,
146 : RefrigerationChillerSet,
147 : UserDefinedHVACForcedAir,
148 : CoolingPanel,
149 : UnitarySystem,
150 : AirTerminalDualDuctConstantVolume,
151 : AirTerminalDualDuctVAV,
152 : AirTerminalSingleDuctConstantVolumeReheat,
153 : AirTerminalSingleDuctConstantVolumeNoReheat,
154 : AirTerminalSingleDuctVAVReheat,
155 : AirTerminalSingleDuctVAVNoReheat,
156 : AirTerminalSingleDuctSeriesPIUReheat,
157 : AirTerminalSingleDuctParallelPIUReheat,
158 : AirTerminalSingleDuctCAVFourPipeInduction,
159 : AirTerminalSingleDuctVAVReheatVariableSpeedFan,
160 : AirTerminalSingleDuctVAVHeatAndCoolReheat,
161 : AirTerminalSingleDuctVAVHeatAndCoolNoReheat,
162 : AirTerminalSingleDuctConstantVolumeCooledBeam,
163 : AirTerminalDualDuctVAVOutdoorAir,
164 : AirLoopHVACReturnAir,
165 : Num
166 : };
167 :
168 : extern const std::array<std::string_view, static_cast<int>(ZoneEquipType::Num)> zoneEquipTypeNamesUC;
169 :
170 : constexpr int NumValidSysAvailZoneComponents(14);
171 : extern Array1D_string const cValidSysAvailManagerCompTypes;
172 :
173 : // Per Person Ventilation Rate Mode
174 : enum class PerPersonVentRateMode
175 : {
176 : Invalid = -1,
177 : DCVByCurrentLevel,
178 : ByDesignLevel,
179 : Num
180 : };
181 :
182 : enum class LoadDist
183 : {
184 : Invalid = -1,
185 : Sequential,
186 : Uniform,
187 : UniformPLR,
188 : SequentialUniformPLR,
189 : Num
190 : };
191 :
192 : enum class LightReturnExhaustConfig : int
193 : {
194 : Invalid = -1,
195 : NoExhast = 0, // No exhaust node
196 : Single = 1, // One to one configuration
197 : Multi = 2, // Multiple return node referred
198 : Shared = 3, // Shared exhaust node
199 : Num
200 : };
201 :
202 : enum class ZoneEquipTstatControl
203 : {
204 : Invalid = -1,
205 : SingleSpace,
206 : Maximum,
207 : Ideal,
208 : Num
209 : };
210 :
211 : enum class SpaceEquipSizingBasis
212 : {
213 : Invalid = -1,
214 : DesignCoolingLoad,
215 : DesignHeatingLoad,
216 : FloorArea,
217 : Volume,
218 : PerimeterLength,
219 : Num
220 : };
221 :
222 : struct SubSubEquipmentData // data for an individual component
223 : {
224 : // Members
225 : std::string TypeOf; // The 'keyWord' identifying component type
226 : std::string Name; // Component name
227 : int EquipIndex; // Component Index for routines
228 : bool ON; // When true, the designated component or operation scheme is available
229 : int InletNodeNum;
230 : int OutletNodeNum;
231 : int NumMeteredVars;
232 : Array1D<OutputProcessor::MeterData> MeteredVar; // Index of energy output report data
233 : int EnergyTransComp; // 1=EnergyTransfer, 0=No EnergyTransfer Flag needed for reporting
234 : int ZoneEqToPlantPtr; // 0=No plant loop connection, >=0 index to ZoneEqToPlant array
235 : int OpMode;
236 : Real64 Capacity;
237 : Real64 Efficiency;
238 : Real64 TotPlantSupplyElec;
239 : Real64 TotPlantSupplyGas;
240 : Real64 TotPlantSupplyPurch;
241 :
242 : // Default Constructor
243 23 : SubSubEquipmentData()
244 69 : : EquipIndex(0), ON(true), InletNodeNum(0), OutletNodeNum(0), NumMeteredVars(0), EnergyTransComp(0), ZoneEqToPlantPtr(0), OpMode(0),
245 23 : Capacity(0.0), Efficiency(0.0), TotPlantSupplyElec(0.0), TotPlantSupplyGas(0.0), TotPlantSupplyPurch(0.0)
246 : {
247 23 : }
248 : };
249 :
250 : struct SubEquipmentData // data for an individual component
251 : {
252 : // Members
253 : bool Parent; // When true, the designated component is made up of sub-components
254 : int NumSubSubEquip;
255 : std::string TypeOf; // The 'keyWord' identifying component type
256 : std::string Name; // Component name
257 : int EquipIndex; // Component Index for routines
258 : bool ON; // When true, the designated component or operation scheme is available
259 : int InletNodeNum;
260 : int OutletNodeNum;
261 : int NumMeteredVars;
262 : Array1D<OutputProcessor::MeterData> MeteredVar; // Index of energy output report data
263 : Array1D<SubSubEquipmentData> SubSubEquipData; // Component list
264 : int EnergyTransComp; // 1=EnergyTransfer, 0=No EnergyTransfer Flag needed for reporting
265 : int ZoneEqToPlantPtr; // 0=No plant loop connection, >0 index to ZoneEqToPlant array
266 : int OpMode;
267 : Real64 Capacity;
268 : Real64 Efficiency;
269 : Real64 TotPlantSupplyElec;
270 : Real64 TotPlantSupplyGas;
271 : Real64 TotPlantSupplyPurch;
272 :
273 : // Default Constructor
274 90 : SubEquipmentData()
275 270 : : Parent(false), NumSubSubEquip(0), EquipIndex(0), ON(true), InletNodeNum(0), OutletNodeNum(0), NumMeteredVars(0), EnergyTransComp(0),
276 90 : ZoneEqToPlantPtr(0), OpMode(0), Capacity(0.0), Efficiency(0.0), TotPlantSupplyElec(0.0), TotPlantSupplyGas(0.0),
277 90 : TotPlantSupplyPurch(0.0)
278 : {
279 90 : }
280 : };
281 :
282 : struct AirIn
283 : {
284 : // Members
285 : int InNode; // Air distribution unit inlet node
286 : int OutNode; // Air distribution unit Outlet node
287 : bool SupplyAirPathExists;
288 : int AirLoopNum = 0; // airloop number serving this ADU
289 : int MainBranchIndex; // airloop branch index (not the actual branch index)
290 : int SupplyBranchIndex; // airloop branch index (not the actual branch index)
291 : int AirDistUnitIndex; // equipment number in EquipList
292 : int TermUnitSizingIndex; // Pointer to TermUnitSizing and TermUnitFinalZoneSizing data for this terminal unit
293 : int SupplyAirPathIndex; // Pointer to SupplyAirPath serving this terminal unit
294 : int SupplyAirPathOutNodeIndex; // Pointer to SupplyAirPath OutletNode serving this terminal unit
295 : Array1D<SubSubEquipmentData> Coil;
296 :
297 : // Default Constructor
298 729 : AirIn()
299 729 : : InNode(0), OutNode(0), SupplyAirPathExists(false), MainBranchIndex(0), SupplyBranchIndex(0), AirDistUnitIndex(0),
300 729 : TermUnitSizingIndex(0), SupplyAirPathIndex(0)
301 : {
302 729 : }
303 : };
304 :
305 : struct EquipConfiguration
306 : {
307 : // Members
308 : std::string ZoneName;
309 : std::string EquipListName;
310 : int EquipListIndex;
311 : std::string ControlListName;
312 : int ZoneNode;
313 : int NumInletNodes; // number of inlet nodes
314 : int NumExhaustNodes; // number of exhaust nodes
315 : int NumReturnNodes; // number of return air nodes
316 : int NumReturnFlowBasisNodes; // number of return air flow basis nodes
317 : Sched::Schedule *returnFlowFracSched = nullptr; // return air flow fraction schedule pointer
318 : bool FlowError; // flow error flag
319 : Array1D_int InletNode; // zone supply air inlet nodes
320 : Array1D_int InletNodeAirLoopNum; // air loop number connected to this inlet node (0 if not an airloop node)
321 : Array1D_int InletNodeADUNum; // AirDistUnit connected to this inlet node (0 if not an ADU node, could be zone equip or direct air)
322 : Array1D_int ExhaustNode; // zone air exhaust nodes
323 : Array1D_int ReturnNode; // zone return air nodes (node numbers)
324 : Array1D_int ReturnNodeAirLoopNum; // air loop number connected to this return node
325 : Array1D_int ReturnNodeRetPathNum; // ReturnPath number connected to this return node
326 : Array1D_int ReturnNodeRetPathCompNum; // ReturnPath component number connected to this return node
327 : Array1D_int
328 : ReturnNodeInletNum; // zone supply air inlet index that matched this return node (same zone, same airloop) - not the inlet node number
329 : Array1D_bool FixedReturnFlow; // true if return node is fixed and cannot be adjusted in CalcZoneReturnFlows
330 : Array1D_int ReturnNodePlenumNum; // number of the return plenum attached to this return node (zero if none)
331 : Array1D_int ReturnFlowBasisNode; // return air flow basis nodes
332 : Array1D_int ReturnNodeExhaustNodeNum; // Exhaust node number flow to a corrsponding return node due to light heat gain
333 : Array1D<LightReturnExhaustConfig>
334 : SharedExhaustNode; // Exhaust node number shared by return nodes 0 No exhaust; 1 No share; > 1 shared; -1 use the exhaust node value
335 : Array1D_int returnNodeSpaceMixerIndex; // index to SpaceHVAC:ZoneReturnMixer that feeds this return node (-1 if there is none)
336 :
337 : bool ZonalSystemOnly; // TRUE if served by a zonal system (only)
338 : bool IsControlled; // True when this is a controlled zone.
339 : Real64 ZoneExh; // zone exhaust (unbalanced+balanced) mass flow rate [kg/s]
340 : Real64 ZoneExhBalanced; // balanced zone exhaust mass flow rate [kg/s]
341 : Real64 PlenumMassFlow; // zone air mass flow rate induced from plenum [kg/s]
342 : Real64 ExcessZoneExh; // excess zone exhaust to be balanced by other zones (only used when !ZoneAirMassFlow.EnforceZoneMassBalance) [kg/s]
343 : Real64 TotAvailAirLoopOA; // total airloop OA available for systems serving this zone (used to apportion excess exhaust) [kg/s}
344 : Real64 TotInletAirMassFlowRate; // total inlet node mass flow rate [kg/s]
345 : Real64 TotExhaustAirMassFlowRate; // total exhaust node mass flow rate [kg/s]
346 : // AirDistUnitCool and AirDistUnitHeat
347 : // do not correspond with the AIR DISTRIBUTION UNIT object in the zone equipment list.
348 : // AirDistUnitCool/AirDistUnitHeat, may represent a DIRECT AIR object,
349 : // or the cold/hot side of AIR DISTRIBUTION
350 : // UNIT object. That is both AirDistUnitHeat and AirDistUnitCool are required to describe a dual
351 : // duct AIR DISTRIBUTION object in the ZoneEquipList.
352 : Array1D<AirIn> AirDistUnitHeat; // dimensioned to number of zone inlet nodes
353 : Array1D<AirIn> AirDistUnitCool; // dimensioned to number of zone inlet nodes.
354 : bool InFloorActiveElement; // Convection adapation, true if zone has in-floor HVAC
355 : bool InWallActiveElement; // Convection adapation, true if zone has in-wall HVAC
356 : bool InCeilingActiveElement; // Convection adapation,
357 : // true when zone has in-ceiling HVAC
358 : bool ZoneHasAirLoopWithOASys; // true if zone is served by one or more airloops with an outdoor air system
359 : int ZoneAirDistributionIndex; // index to DesignSpecification:ZoneAirDistribution object
360 : int ZoneDesignSpecOAIndex; // index to DesignSpecification:OutdoorAir object
361 : Real64 AirLoopDesSupply; // air lood design supply air flow rate [kg/s]
362 :
363 : // Default Constructor
364 676 : EquipConfiguration()
365 1352 : : ZoneName("Uncontrolled Zone"), EquipListIndex(0), ZoneNode(0), NumInletNodes(0), NumExhaustNodes(0), NumReturnNodes(0),
366 1352 : NumReturnFlowBasisNodes(0), FlowError(false), ZonalSystemOnly(false), IsControlled(false), ZoneExh(0.0), ZoneExhBalanced(0.0),
367 676 : PlenumMassFlow(0.0), ExcessZoneExh(0.0), TotAvailAirLoopOA(0.0), TotInletAirMassFlowRate(0.0), TotExhaustAirMassFlowRate(0.0),
368 676 : InFloorActiveElement(false), InWallActiveElement(false), InCeilingActiveElement(false), ZoneHasAirLoopWithOASys(false),
369 676 : ZoneAirDistributionIndex(0), ZoneDesignSpecOAIndex(0), AirLoopDesSupply(0.0)
370 : {
371 676 : }
372 :
373 : void setTotalInletFlows(EnergyPlusData &state);
374 :
375 : void beginEnvirnInit(EnergyPlusData &state);
376 :
377 : void hvacTimeStepInit(EnergyPlusData &state, bool FirstHVACIteration);
378 :
379 : void calcReturnFlows(EnergyPlusData &state,
380 : Real64 &ExpTotalReturnMassFlow, // Expected total return air mass flow rate
381 : Real64 &FinalTotalReturnMassFlow // Final total return air mass flow rate
382 : );
383 : };
384 :
385 : struct EquipmentData // data for an individual component
386 : {
387 : // Members
388 : bool Parent; // When true, the designated component is made up of sub-components
389 : int NumSubEquip;
390 : std::string TypeOf; // The 'keyWord' identifying component type
391 : std::string Name; // Component name
392 : bool ON; // When true, the designated component or operation scheme is available
393 : int NumInlets;
394 : int NumOutlets;
395 : Array1D_int InletNodeNums;
396 : Array1D_int OutletNodeNums;
397 : int NumMeteredVars;
398 : Array1D<OutputProcessor::MeterData> MeteredVar; // Index of energy output report data
399 : Array1D<SubEquipmentData> SubEquipData; // Component list
400 : int EnergyTransComp; // 1=EnergyTransfer, 0=No EnergyTransfer Flag needed for reporting
401 : int ZoneEqToPlantPtr; // 0=No plant loop connection, >0 index to ZoneEqToPlant array
402 : Real64 TotPlantSupplyElec;
403 : Real64 TotPlantSupplyGas;
404 : Real64 TotPlantSupplyPurch;
405 : int OpMode;
406 :
407 : // Default Constructor
408 405 : EquipmentData()
409 1620 : : Parent(false), NumSubEquip(0), ON(true), NumInlets(0), NumOutlets(0), NumMeteredVars(0), EnergyTransComp(0), ZoneEqToPlantPtr(0),
410 405 : TotPlantSupplyElec(0.0), TotPlantSupplyGas(0.0), TotPlantSupplyPurch(0.0), OpMode(0)
411 : {
412 405 : }
413 : };
414 :
415 : struct EquipList
416 : {
417 : // Members
418 : std::string Name; // Name of the equipment list
419 : DataZoneEquipment::LoadDist LoadDistScheme = DataZoneEquipment::LoadDist::Sequential; // load distribution scheme
420 : int NumOfEquipTypes = 0; // Number of items on this list
421 : int NumAvailHeatEquip = 0; // Number of pieces of equipment available for heating
422 : int NumAvailCoolEquip = 0; // Number of pieces of equipment available for cooling
423 : Array1D_string EquipTypeName; // TODO: Convert this from string to enum and remove EquipTypeEnum below
424 : Array1D<DataZoneEquipment::ZoneEquipType> EquipType;
425 : Array1D_string EquipName;
426 : Array1D_int EquipIndex;
427 : EPVector<int> zoneEquipSplitterIndex; // index to SpaceHVAC:ZoneEquipmentSplitter, if any, for this equipment (0 base)
428 : // SystemAvailManagers need to know the index of specific equipment (e.g., PTAC as 1,2,3)
429 : // if UnitarySystem models PTAC, PTHP, UnitarySystems, then the index to a specific UnitarySystem is not the index to the PTAC
430 : std::vector<HVACSystemData *> compPointer;
431 : Array1D_int CoolingPriority;
432 : Array1D_int HeatingPriority;
433 : Array1D<Sched::Schedule *> sequentialCoolingFractionScheds;
434 : Array1D<Sched::Schedule *> sequentialHeatingFractionScheds;
435 : Array1D_int CoolingCapacity; // Current cooling capacity (negative) [W]
436 : Array1D_int HeatingCapacity; // Current heating capacity (positive) [W]
437 : Array1D<EquipmentData> EquipData; // Index of energy output report data
438 :
439 : void getPrioritiesForInletNode(EnergyPlusData &state,
440 : int inletNodeNum, // Zone inlet node number to match
441 : int &coolingPriority, // Cooling priority num for matching equipment
442 : int &heatingPriority // Heating priority num for matching equipment
443 : );
444 :
445 : Real64 SequentialHeatingFraction(EnergyPlusData &state, int equipNum);
446 :
447 : Real64 SequentialCoolingFraction(EnergyPlusData &state, int equipNum);
448 : };
449 :
450 : struct ZoneEquipSplitterMixerSpace
451 : {
452 : int spaceIndex = 0; // Index to a space
453 : Real64 fraction = 0.0; // Fraction of equipment output or flow for this space
454 : int spaceNodeNum = 0; // Space Inlet Node number (zero if not airflow equipment)
455 : };
456 :
457 : struct ZoneEquipmentSplitterMixer
458 : {
459 : std::string Name;
460 : DataLoopNode::ConnectionObjectType spaceEquipType = DataLoopNode::ConnectionObjectType::Invalid;
461 : DataZoneEquipment::SpaceEquipSizingBasis spaceSizingBasis = DataZoneEquipment::SpaceEquipSizingBasis::Invalid;
462 : std::vector<ZoneEquipSplitterMixerSpace> spaces;
463 :
464 : void size(EnergyPlusData &state);
465 : };
466 :
467 : struct ZoneEquipmentSplitter : ZoneEquipmentSplitterMixer
468 : {
469 : DataZoneEquipment::ZoneEquipType zoneEquipType = DataZoneEquipment::ZoneEquipType::Invalid;
470 : std::string zoneEquipName;
471 : int zoneEquipOutletNodeNum = 0;
472 : DataZoneEquipment::ZoneEquipTstatControl tstatControl = DataZoneEquipment::ZoneEquipTstatControl::Invalid;
473 : int controlSpaceIndex = 0; // Index to a space for the thermostat control space
474 : int controlSpaceNumber = 0; // Control space number within the zone equipment splitter list
475 : DataZoneEnergyDemands::ZoneSystemSensibleDemand saveZoneSysSensibleDemand; // Save unadjusted zone sensible loads
476 : DataZoneEnergyDemands::ZoneSystemMoistureDemand saveZoneSysMoistureDemand; // Save unadjusted zone moisture loads
477 :
478 : void distributeOutput(EnergyPlusData &state,
479 : int const zoneNum,
480 : Real64 const sysOutputProvided,
481 : Real64 const latOutputProvided,
482 : Real64 const nonAirSysOutput,
483 : int const equipTypeNum);
484 :
485 : void adjustLoads(EnergyPlusData &state, int zoneNum, int equipTypeNum);
486 : };
487 :
488 : struct ZoneMixer : ZoneEquipmentSplitterMixer
489 : {
490 : int outletNodeNum = 0;
491 :
492 : void setOutletConditions(EnergyPlusData &state);
493 : };
494 :
495 : struct ZoneEquipmentMixer : ZoneMixer
496 : {
497 : void setInletFlows(EnergyPlusData &state);
498 : };
499 :
500 : struct ZoneReturnMixer : ZoneMixer
501 : {
502 : void setInletConditions(EnergyPlusData &state);
503 :
504 : void setInletFlows(EnergyPlusData &state);
505 : };
506 : struct ControlList
507 : {
508 : // Members
509 : std::string Name;
510 : int NumOfControls;
511 : Array1D_string ControlType;
512 : Array1D_string ControlName;
513 :
514 : // Default Constructor
515 : ControlList() : NumOfControls(0)
516 : {
517 : }
518 : };
519 :
520 : struct SupplyAir
521 : {
522 : // Members
523 : std::string Name;
524 : int NumOfComponents;
525 : int InletNodeNum;
526 : Array1D_string ComponentType; // TODO: Convert this from string to enum and remove ComponentTypeEnum below
527 : Array1D<DataZoneEquipment::AirLoopHVACZone> ComponentTypeEnum;
528 : Array1D_string ComponentName;
529 : Array1D_int ComponentIndex;
530 : Array1D_int SplitterIndex;
531 : Array1D_int PlenumIndex;
532 : int NumOutletNodes;
533 : Array1D_int OutletNode;
534 : Array1D_int OutletNodeSupplyPathCompNum; // Index to the supply path ComponentName and ComponentType lists for this outlet node
535 : int NumNodes;
536 : Array1D_int Node;
537 : Array1D<DataZoneEquipment::AirNodeType> NodeType;
538 :
539 : // Default Constructor
540 64 : SupplyAir() : NumOfComponents(0), InletNodeNum(0), NumOutletNodes(0), NumNodes(0)
541 : {
542 64 : }
543 : };
544 :
545 : struct ReturnAir
546 : {
547 : // Members
548 : std::string Name;
549 : int NumOfComponents = 0;
550 : int OutletNodeNum = 0; // Node num of return path outlet
551 : int OutletRetPathCompNum = 0; // Index to return path component number for outlet node
552 : Array1D_string ComponentType; // TODO: Convert this from string to enum and remove ComponentTypeEnum below
553 : Array1D<DataZoneEquipment::AirLoopHVACZone> ComponentTypeEnum;
554 : Array1D_string ComponentName;
555 : Array1D_int ComponentIndex;
556 : };
557 :
558 : void GetZoneEquipmentData(EnergyPlusData &state);
559 :
560 : void processZoneEquipmentInput(EnergyPlusData &state,
561 : std::string_view zoneEqModuleObject,
562 : int const zoneOrSpaceNum,
563 : bool const isSpace,
564 : int &locTermUnitSizingCounter,
565 : int &overallEquipCount,
566 : DataZoneEquipment::EquipConfiguration &thisEquipConfig,
567 : Array1D_string &AlphArray,
568 : Array1D_string &cAlphaFields, // Alpha field names
569 : Array1D_bool &lAlphaBlanks, // Logical array, alpha field input BLANK = .TRUE.
570 : Array1D_int &NodeNums);
571 :
572 : void processZoneEquipSplitterInput(EnergyPlusData &state,
573 : std::string_view zeqSplitterModuleObject,
574 : int const zeqSplitterNum,
575 : int const zoneNum,
576 : InputProcessor::json const objectSchemaProps,
577 : InputProcessor::json const objectFields,
578 : DataZoneEquipment::ZoneEquipmentSplitter &thisZeqSplitter);
579 :
580 : void processZoneEquipMixerInput(EnergyPlusData &state,
581 : std::string_view zeqMixerModuleObject,
582 : int const zoneNum,
583 : InputProcessor::json const objectSchemaProps,
584 : InputProcessor::json const objectFields,
585 : DataZoneEquipment::ZoneEquipmentMixer &thisZeqMixer);
586 :
587 : void processZoneReturnMixerInput(EnergyPlusData &state,
588 : std::string_view zeqMixerModuleObject,
589 : int const zoneNum,
590 : InputProcessor::json const objectSchemaProps,
591 : InputProcessor::json const objectFields,
592 : int mixerIndex);
593 :
594 : bool CheckZoneEquipmentList(EnergyPlusData &state,
595 : std::string_view ComponentType, // Type of component
596 : std::string_view ComponentName, // Name of component
597 : ObjexxFCL::Optional_int CtrlZoneNum = _);
598 :
599 : int GetControlledZoneIndex(EnergyPlusData &state, std::string const &ZoneName); // Zone name to match into Controlled Zone structure
600 :
601 : int FindControlledZoneIndexFromSystemNodeNumberForZone(EnergyPlusData &state,
602 : int TrialZoneNodeNum); // Node number to match into Controlled Zone structure
603 :
604 : int GetSystemNodeNumberForZone(EnergyPlusData &state, int const zoneNum);
605 :
606 : int GetReturnAirNodeForZone(EnergyPlusData &state,
607 : int const zoneNum,
608 : std::string const &NodeName, // Return air node name to match (may be blank)
609 : std::string const &calledFromDescription // String identifying the calling function and object
610 : );
611 :
612 : int GetReturnNumForZone(EnergyPlusData &state,
613 : int const zoneNum,
614 : std::string const &NodeName // Return air node name to match (may be blank)
615 : );
616 :
617 : int GetZoneEquipControlledZoneNum(EnergyPlusData &state, DataZoneEquipment::ZoneEquipType const ZoneEquipType, std::string const &EquipmentName);
618 :
619 : bool VerifyLightsExhaustNodeForZone(EnergyPlusData &state, int const ZoneNum, int const ZoneExhaustNodeNum);
620 :
621 : void CheckSharedExhaust(EnergyPlusData &state);
622 :
623 : void scaleInletFlows(EnergyPlusData &state, int const zoneNodeNum, int const spaceNodeNum, Real64 const frac);
624 :
625 : } // namespace DataZoneEquipment
626 :
627 : struct DataZoneEquipmentData : BaseGlobalStruct
628 : {
629 :
630 : bool GetZoneEquipmentDataErrorsFound = false;
631 : int GetZoneEquipmentDataFound = 0;
632 : int NumSupplyAirPaths = 0;
633 : int NumReturnAirPaths = 0;
634 : int NumExhaustAirSystems = 0;
635 : int NumZoneExhaustControls = 0;
636 : bool ZoneEquipInputsFilled = false;
637 : bool ZoneEquipSimulatedOnce = false;
638 : int NumOfZoneEquipLists = 0;
639 : Array1D<Avail::Status> ZoneEquipAvail;
640 : Array1D<DataZoneEquipment::EquipConfiguration> ZoneEquipConfig;
641 : Array1D<DataZoneEquipment::EquipConfiguration> spaceEquipConfig;
642 : std::unordered_set<std::string> UniqueZoneEquipListNames;
643 : Array1D<DataZoneEquipment::EquipList> ZoneEquipList;
644 : Array1D<DataZoneEquipment::SupplyAir> SupplyAirPath;
645 : Array1D<DataZoneEquipment::ReturnAir> ReturnAirPath;
646 : Array1D<ExhaustAirSystemManager::ExhaustAir> ExhaustAirSystem;
647 : Array1D<ExhaustAirSystemManager::ZoneExhaustControl> ZoneExhaustControlSystem; // 2022-01: maybe a better name?
648 : std::vector<DataZoneEquipment::ZoneEquipmentSplitter> zoneEquipSplitter;
649 : std::vector<DataZoneEquipment::ZoneEquipmentMixer> zoneEquipMixer;
650 : std::vector<DataZoneEquipment::ZoneReturnMixer> zoneReturnMixer;
651 :
652 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
653 : {
654 2126 : }
655 :
656 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
657 : {
658 1152 : }
659 :
660 2100 : void clear_state() override
661 : {
662 2100 : new (this) DataZoneEquipmentData();
663 2100 : }
664 : };
665 :
666 : } // namespace EnergyPlus
667 :
668 : #endif
|