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 DataAirLoop_hh_INCLUDED
49 : #define DataAirLoop_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/DataHVACGlobals.hh>
58 : #include <EnergyPlus/DataHVACSystems.hh>
59 : #include <EnergyPlus/EPVector.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 : #include <EnergyPlus/SimAirServingZones.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : namespace DataAirLoop {
66 :
67 : struct AirLoopZoneEquipConnectData
68 : {
69 : // Members
70 : std::string AirLoopName; // Name of Primary Air System
71 : int NumReturnNodes = 0; // Number of return nodes entering primary air system (currently limited to 1 node)
72 : int NumSupplyNodes = 0; // number of supply nodes exiting primary air system
73 : int NumZonesCooled = 0; // number of zones cooled by this primary air system
74 : int NumZonesHeated = 0; // number of zones heated by this primary air system
75 : Array1D_int ZoneEquipReturnNodeNum; // Zone Equip side return air node numbers (currently limited to 1 node)
76 : Array1D_int ZoneEquipSupplyNodeNum; // Zone equip side supply air node numbers
77 : Array1D_int AirLoopReturnNodeNum; // Air loop side return air node numbers
78 : Array1D_int AirLoopSupplyNodeNum; // Air loop side supply air node numbers
79 : Array1D_int CoolCtrlZoneNums; // Controlled zone numbers of zones cooled by this air loop
80 : Array1D_int HeatCtrlZoneNums; // Controlled zone numbers of zones heated by this air loop
81 : Array1D_int CoolZoneInletNodes; // Zone inlet node numbers of zones cooled by this air loop
82 : Array1D_int HeatZoneInletNodes; // Zone inlet node numbers of zones heated by this air loop
83 : Array1D_int TermUnitCoolInletNodes; // Air terminal unit cooling inlet node numbers for this air loop
84 : Array1D_int TermUnitHeatInletNodes; // Air terminal unit heating inlet node numbers for this air loop
85 : Array1D_int TermUnitCoolSizingIndex; // Air terminal sizing numbers for zones cooled by this air loop
86 : Array1D_int TermUnitHeatSizingIndex; // Air terminal sizing numbers for zones heated by this air loop
87 : Array1D<HVAC::AirDuctType> SupplyDuctType; // 1=main, 2=cooling, 3=heating, 4=other
88 : EPVector<int> SupplyDuctBranchNum; // Supply duct branch number (airloop branchnum, not the actual branch index)
89 : EPVector<int> SupplyAirPathNum; // Supply air path indexes
90 : EPVector<int> ReturnAirPathNum; // Return air path indexes
91 : };
92 :
93 : struct AirLoopOutsideAirConnectData
94 : {
95 : // Members
96 : bool OASysExists = false; // true if there is an Outside Air Sys
97 : int OASysInletNodeNum = 0; // node number of return air inlet to OA sys
98 : int OASysOutletNodeNum = 0; // node number of mixed air outlet of OA sys
99 : };
100 :
101 : struct DefinePriAirSysAvailMgrs
102 : {
103 : // Members
104 : int NumAvailManagers = 0; // number of availability managers for this system
105 : Avail::Status availStatus = Avail::Status::NoAction; // system availability status
106 : int StartTime = 0; // cycle on time (in SimTimeSteps)
107 : int StopTime = 0; // cycle off time (in SimTimeSteps)
108 : Real64 ReqSupplyFrac = 0.0; // required system flow rate (as a fraction)
109 : Array1D<Avail::AvailManagerNTN> availManagers; // type of availability manager
110 : };
111 :
112 : struct AirLooptoZoneData // Derived type for air loop connection to zones on air loop
113 : {
114 : // Members
115 : int NumZones = 0;
116 : Array1D_int Zone;
117 : Array1D_int ActualZoneNumber;
118 : };
119 :
120 : struct AirLoopControlData // Derived type for air control information
121 : {
122 : // Members
123 : std::string OACtrlName; // name of OA controller
124 : int OACtrlNum = 0; // index of OA controller
125 : int OASysNum = 0; // index of OA System
126 : bool CyclingFan = false; // TRUE if currently the air loop supply fan is cycling
127 : bool AnyContFan = false; // TRUE if at any time supply fan is continuous
128 : Sched::Schedule *cycFanSched = nullptr; // schedule indicating whether fan is cycling or continuous in a unitary system
129 : HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // 1=cycling fan cycling compressor; 2=constant fan cycling comptressor
130 : bool UnitarySys = false; // TRUE if a unitary system
131 : bool UnitarySysSimulating = true; // set FALSE for AirloopUnitarySystem after simulating to downstream coils can size independently
132 : bool Simple = false; // TRUE if system has 1 branch and 1 component
133 : bool CanNotLockoutEcono = false; // user input says econo lockout not allowed
134 : bool CanLockoutEconoWithHeating = false; // user input says econo lockout with heating is allowed
135 : bool CanLockoutEconoWithCompressor = false; // user input says econo lockout with compressor is allowed
136 : bool ReqstEconoLockoutWithHeating = false; // there is a request to lockout the economizer due to heating
137 : bool ReqstEconoLockoutWithCompressor = false; // there is a request to lockout the economizer due to compressor operation
138 : bool EconoActive = false; // if true economizer is active
139 : bool HeatRecoveryBypass = false; // if true heat recovery is bypassed (not active)
140 : bool ResimAirLoopFlag = false; // Same as SimAir, will trigger re-sim of air loops
141 : bool HeatRecoveryResimFlag = true; // Used to trigger new air loop sim when HX is used in OA system
142 : bool HeatRecoveryResimFlag2 = false; // Used to trigger new air loop sim when HX is used in OA system
143 : bool CheckHeatRecoveryBypassStatus = false; // determines when heat recovery bypass is set
144 : bool EconomizerFlowLocked = false; // locks economizer flow for custon ERV operation
145 : bool HighHumCtrlActive = false; // if true high humidity control is active
146 : bool EconoLockout = false; // if true the economizer will be locked out (OA flow set to minimum)
147 : bool LoopFlowRateSet = false; // if true then the air loop flow rate should be set using ReqSupplyFrac
148 : bool NightVent = false; // if true then air loop is in night ventilation mode
149 : bool AllowWarmRestartFlag = false; // if true then speculative warm restart is attempted after first HVAC iteration
150 : bool NewFlowRateFlag = false; // true whenever the air mass flow rates have changed since last air loop sim
151 : bool ConvergedFlag = false; // true whenever the air loop sim was converged overall
152 : bool CoolingActiveFlag = false; // true whenever the air loop cooling coil is operating
153 : bool HeatingActiveFlag = false; // true whenever the air loop heating coil is operating
154 : bool OASysComponentsSimulated = false; // - true after OA components have been simulated
155 : Real64 ZoneExhMassFlow = 0.0; // zone exhaust flow rate not accounted for by zone inlet flow
156 : bool AirLoopDCVFlag = true; // TRUE if the air loop has OA Controller specifying a Mechanical controller with DCV
157 : int AirLoopPass = 0; // number of air loop passes during iteration
158 : // - internal flag only
159 : };
160 :
161 : struct AirLoopFlowData // Derived type for air loop flow information
162 : {
163 : // Members
164 : Real64 DesSupply = 0.0; // design supply air mass flow rate for loop [kg/s]
165 : Real64 DesReturnFrac = 1.0; // the design return flow rate as a fraction of supply flow assuming no exhaust (0 to 1)
166 : Real64 SysToZoneDesFlowRatio = 0.0; // System design flow divided by the sum of the zone design flows
167 : Real64 ReqSupplyFrac = 1.0; // required flow (as a fraction of DesSupply) set by a manager
168 : Real64 MinOutAir = 0.0; // minimum outside air mass flow rate [kg/s]
169 : Real64 MaxOutAir = 0.0; // current maximum available outside air mass flow rate [kg/s]
170 : Real64 OAMinFrac = 0.0; // minimum outside air flow fraction this time step
171 : Real64 Previous = 0.0; // Previous mass air flow rate for this loop [kg/s]
172 : Real64 SupFlow = 0.0; // supply air flow rate (includes LeakFlow) [kg/s]
173 : Real64 ZoneRetFlow = 0.0; // return air flow rate at all zone return air nodes (includes RecircFlow, excludes LeakFlow) [kg/s]
174 : Real64 ZoneRetFlowRatio = 1.0; // ratio for adjusting zone return flows for excess zone exhaust
175 : Real64 SysRetFlow = 0.0; // return air flow rate back to central return (excludes RecircFlow, includes LeakFlow) [kg/s]
176 : Real64 RecircFlow = 0.0; // sum of zone plenum recirculated flows [kg/s]
177 : Real64 LeakFlow = 0.0; // sum of air distribution leak flows to return plenum [kg/s]
178 : Real64 ExcessZoneExhFlow = 0.0; // excess zone exhuast flows made up by reduced return flow in other zones on same airloop [kg/s]
179 : Real64 FanPLR = 1.0; // Operating PLR of air loop fan
180 : Real64 OAFrac = 0.0; // fraction of outside air to mixed air mass flow rate
181 : Real64 OAFlow = 0.0; // oa flow rate this time step [kg/s]
182 : bool FlowError = false; // error flag for flow error message
183 : Real64 BypassMassFlow = 0.0; // air loop bypass mass flow NOT entering splitter but included in mixer or plenum
184 : };
185 :
186 : enum class ControllerKind
187 : {
188 : Invalid = -1,
189 : WaterCoil, // Controller:WaterCoil
190 : OutdoorAir, // Controller:OutdoorAir
191 : Num
192 : };
193 :
194 : struct OutsideAirSysProps
195 : {
196 : // Members
197 : std::string Name;
198 : std::string ControllerListName;
199 : std::string ComponentListName;
200 : int ControllerListNum = 0; // index of the Controller List
201 : int NumComponents = 0;
202 : int NumControllers = 0;
203 : int NumSimpleControllers = 0; // number of CONTROLLER:SIMPLE objects in OA Sys controller list
204 : std::string OAControllerName; // OA controller name
205 : int OAControllerIndex = 0; // OA controller index in OAController
206 : Array1D_string ComponentName;
207 : Array1D_string ComponentType;
208 : Array1D<SimAirServingZones::CompType> ComponentTypeEnum; // Parameterized (see above) Component Types this
209 : // module can address
210 : Array1D_int ComponentIndex; // Which one in list -- updated by routines called from here
211 : std::vector<HVACSystemData *> compPointer;
212 : Array1D_string ControllerName;
213 : Array1D_string ControllerType;
214 : EPVector<ControllerKind> controllerTypeEnum; // Controller:OutdoorAir or Controller:WaterCoil
215 : Array1D_int ControllerIndex; // Which one in list -- updated by routines called from here
216 : Array1D_int InletNodeNum; // component inlet node number
217 : Array1D_int OutletNodeNum; // component outlet node number
218 : bool HeatExchangerFlag = false; // True to have a heat exchanger in the equipment list
219 : int AirLoopDOASNum = -1; // AirLoopHVAC:DedicatedOutdoorAirSystem number
220 : };
221 :
222 : struct AirLoopAFNData
223 : {
224 : // Members
225 : HVAC::FanOp LoopFanOperationMode = HVAC::FanOp::Invalid; // OnOff fan operation mode
226 : Real64 LoopSystemOnMassFlowrate = 0.0; // Loop mass flow rate during on cycle using an OnOff fan
227 : Real64 LoopSystemOffMassFlowrate = 0.0; // Loop mass flow rate during off cycle using an OnOff fan
228 : Real64 LoopOnOffFanPartLoadRatio = 0.0; // OnOff fan part load ratio
229 : Real64 LoopCompCycRatio = 0.0; // Loop compressor cycling ratio for multispeed heat pump
230 : Real64 AFNLoopHeatingCoilMaxRTF = 0.0; // Maximum run time fraction for electric or gas heating coil in an HVAC Air Loop
231 : Real64 AFNLoopOnOffFanRTF = 0.0; // OnOff fan run time fraction in an HVAC Air Loop
232 : Real64 AFNLoopDXCoilRTF = 0.0; // OnOff fan run time fraction in an HVAC Air Loop
233 : };
234 :
235 : } // namespace DataAirLoop
236 :
237 : struct DataAirLoopData : BaseGlobalStruct
238 : {
239 :
240 : int NumOASystems = 0; // Number of Outdoor Air Systems
241 : bool AirLoopInputsFilled = false; // Set to TRUE after first pass through air loop
242 : Real64 LoopDXCoilRTF = 0.0; // OnOff fan run time fraction in an HVAC Air Loop
243 :
244 : EPVector<DataAirLoop::AirLoopZoneEquipConnectData> AirToZoneNodeInfo;
245 : EPVector<DataAirLoop::AirLoopOutsideAirConnectData> AirToOANodeInfo;
246 : EPVector<DataAirLoop::DefinePriAirSysAvailMgrs> PriAirSysAvailMgr;
247 : EPVector<DataAirLoop::AirLooptoZoneData> AirLoopZoneInfo;
248 : EPVector<DataAirLoop::AirLoopControlData> AirLoopControlInfo;
249 : EPVector<DataAirLoop::AirLoopFlowData> AirLoopFlow;
250 : EPVector<DataAirLoop::OutsideAirSysProps> OutsideAirSys;
251 : EPVector<DataAirLoop::AirLoopAFNData> AirLoopAFNInfo;
252 :
253 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
254 : {
255 2126 : }
256 :
257 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
258 : {
259 1152 : }
260 :
261 2100 : void clear_state() override
262 : {
263 2100 : new (this) DataAirLoopData();
264 2100 : }
265 : };
266 :
267 : } // namespace EnergyPlus
268 :
269 : #endif
|