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 OutdoorAirUnit_hh_INCLUDED
49 : #define OutdoorAirUnit_hh_INCLUDED
50 :
51 : #include <unordered_set>
52 :
53 : // ObjexxFCL Headers
54 : #include <ObjexxFCL/Array1D.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/Data/BaseData.hh>
58 : #include <EnergyPlus/DataGlobals.hh>
59 : #include <EnergyPlus/DataHVACSystems.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 : #include <EnergyPlus/Plant/Enums.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : // Forward declarations
66 : struct EnergyPlusData;
67 :
68 : namespace OutdoorAirUnit {
69 :
70 : enum class CompType : int
71 : {
72 : Invalid = -1,
73 : WaterCoil_Cooling, // "COIL:COOLING:WATER",
74 : WaterCoil_SimpleHeat, // "COIL:HEATING:WATER",
75 : SteamCoil_AirHeat, // "COIL:HEATING:STEAM",
76 : Coil_ElectricHeat, // "COIL:HEATING:ELECTRIC",
77 : WaterCoil_DetailedCool, // "COIL:COOLING:WATER:DETAILEDGEOMETRY",
78 : WaterCoil_CoolingHXAsst, // "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED",
79 : Coil_GasHeat, // "COIL:HEATING:FUEL",
80 : DXSystem, // "COILSYSTEM:COOLING:DX",
81 : HeatXchngrFP, // "HEATEXCHANGER:AIRTOAIR:FLATPLATE",
82 : HeatXchngrSL, // "HEATEXCHANGER:AIRTOAIR:SENSIBLEANDLATENT",
83 : Desiccant, // "DEHUMIDIFIER:DESICCANT:NOFANS",
84 : DXHeatPumpSystem, // "COILSYSTEM:HEATING:DX",
85 : UnitarySystemModel, // "AIRLOOPHVAC:UNITARYSYSTEM",
86 : Num
87 : };
88 :
89 : static constexpr std::array<std::string_view, static_cast<int>(CompType::Num)> CompTypeNames{
90 : "Coil:Cooling:Water",
91 : "Coil:Heating:Water",
92 : "Coil:Heating:Steam",
93 : "Coil:Heating:Electric",
94 : "Coil:Cooling:Water:DetailedGeometry",
95 : "CoilSystem:Cooling:Water:HeatExchangerAssisted",
96 : "Coil:Heating:Fuel",
97 : "CoilSystem:Cooling:DX",
98 : "HeatExchanger:AirToAir:FlatPlate",
99 : "HeatExchanger:AirToAir:SensibleAndLatent",
100 : "Dehumidifier:Desiccant:NoFans",
101 : "CoilSystem:Heating:DX",
102 : "AirLoopHVAC:UnitarySystem",
103 : };
104 :
105 : static constexpr std::array<std::string_view, static_cast<int>(CompType::Num)> CompTypeNamesUC{
106 :
107 : "COIL:COOLING:WATER",
108 : "COIL:HEATING:WATER",
109 : "COIL:HEATING:STEAM",
110 : "COIL:HEATING:ELECTRIC",
111 : "COIL:COOLING:WATER:DETAILEDGEOMETRY",
112 : "COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED",
113 : "COIL:HEATING:FUEL",
114 : "COILSYSTEM:COOLING:DX",
115 : "HEATEXCHANGER:AIRTOAIR:FLATPLATE",
116 : "HEATEXCHANGER:AIRTOAIR:SENSIBLEANDLATENT",
117 : "DEHUMIDIFIER:DESICCANT:NOFANS",
118 : "COILSYSTEM:HEATING:DX",
119 : "AIRLOOPHVAC:UNITARYSYSTEM",
120 : };
121 :
122 : enum class OAUnitCtrlType
123 : {
124 : Invalid = -1,
125 : Neutral,
126 : Unconditioned,
127 : Temperature,
128 : Num
129 : };
130 :
131 : enum class Operation
132 : {
133 : Invalid = -1,
134 : HeatingMode, // normal heating coil operation
135 : CoolingMode, // normal cooling coil operation
136 : NeutralMode, // signal coil shouldn't run
137 : Num
138 : };
139 :
140 : struct OAEquipList
141 : {
142 : // Members
143 : // Equipment List Data
144 : std::string ComponentName;
145 : CompType Type; // Parameterized Component Types this module can address
146 : int ComponentIndex; // Which one in list -- updated by routines called from here
147 : HVACSystemData *compPointer = nullptr;
148 : int CoilAirInletNode;
149 : int CoilAirOutletNode;
150 : int CoilWaterInletNode;
151 : int CoilWaterOutletNode;
152 : DataPlant::PlantEquipmentType CoilType;
153 : PlantLocation plantLoc;
154 : int FluidIndex = 0;
155 : Real64 MaxVolWaterFlow;
156 : Real64 MaxWaterMassFlow;
157 : Real64 MinVolWaterFlow;
158 : Real64 MinWaterMassFlow;
159 : bool FirstPass;
160 : // End Of Equipment list data
161 :
162 : // Default Constructor
163 4 : OAEquipList()
164 8 : : Type(CompType::Invalid), ComponentIndex(0), CoilAirInletNode(0), CoilAirOutletNode(0), CoilWaterInletNode(0), CoilWaterOutletNode(0),
165 8 : CoilType(DataPlant::PlantEquipmentType::Invalid), plantLoc{}, MaxVolWaterFlow(0.0), MaxWaterMassFlow(0.0), MinVolWaterFlow(0.0),
166 4 : MinWaterMassFlow(0.0), FirstPass(true)
167 : {
168 4 : }
169 : };
170 :
171 : struct OAUnitData
172 : {
173 : // Members
174 : // Input data
175 : std::string Name; // name of unit
176 : Sched::Schedule *availSched = nullptr; // availability
177 : std::string ZoneName; // Name of zone the system is serving
178 : int ZonePtr; // Point to this zone in the Zone derived type
179 : int ZoneNodeNum; // index of zone air node in node structure
180 : std::string UnitControlType; // Control type for the system
181 : // (Neutral and setpoint temperatrue)
182 : OAUnitCtrlType controlType; // Unit Control type indicator
183 : int AirInletNode; // inlet air node number
184 : int AirOutletNode; // outlet air node number
185 : std::string SFanName; // name of supply fan
186 : int SFan_Index; // index in fan structure
187 : HVAC::FanType supFanType; // type of fan in cFanTypes
188 : Sched::Schedule *supFanAvailSched = nullptr; // supply fan availability sched from fan object
189 : HVAC::FanPlace supFanPlace; // fan placement; blow through and draw through
190 : Real64 FanCorTemp; // correction temperature
191 : bool FanEffect; // .TRUE. if unit has a fan type of draw through
192 : int SFanOutletNode; // supply fan outlet node number
193 : std::string ExtFanName; // name of exhaust fan
194 : int ExtFan_Index; // index in fan structure
195 : HVAC::FanType extFanType; // type of fan in cFanTypes
196 : Sched::Schedule *extFanAvailSched = nullptr; // exhaust fan availability sched from fan object
197 : bool ExtFan; // true if there is an exhaust fan
198 : Sched::Schedule *outAirSched = nullptr; // schedule of fraction for outside air (all controls)
199 : int OutsideAirNode; // outside air node number
200 : Real64 OutAirVolFlow; // m3/s
201 : Real64 OutAirMassFlow; // kg/s
202 : Real64 ExtAirVolFlow; // m3/s
203 : Real64 ExtAirMassFlow; // kg/s
204 : Sched::Schedule *extAirSched = nullptr; // schedule of fraction for exhaust air
205 : Real64 SMaxAirMassFlow; // kg/s
206 : Real64 EMaxAirMassFlow; // kg/s
207 : Real64 SFanMaxAirVolFlow; // m3/s
208 : Real64 EFanMaxAirVolFlow; // m3/s
209 : Sched::Schedule *hiCtrlTempSched = nullptr; // Schedule name for the High Control Air temperature
210 : Sched::Schedule *loCtrlTempSched = nullptr; // Schedule name for the Low Control Air temperature
211 : Operation OperatingMode; // operating condition( NeutralMode, HeatingMode, CoolingMode)
212 : int ControlCompTypeNum;
213 : int CompErrIndex;
214 : Real64 AirMassFlow; // kg/s
215 : bool FlowError; // flow error flag
216 : int NumComponents;
217 : std::string ComponentListName;
218 : Real64 CompOutSetTemp; // component outlet setpoint temperature
219 : Avail::Status availStatus = Avail::Status::NoAction;
220 : std::string AvailManagerListName; // Name of an availability manager list object
221 : Array1D<OAEquipList> OAEquip;
222 : // Report data
223 : Real64 TotCoolingRate; // Rate of total cooling delivered to the zone [W]
224 : Real64 TotCoolingEnergy; // Total cooling energy delivered by the OAU supply air to the zone [J]
225 : Real64 SensCoolingRate; // Rate of sensible cooling delivered to the zone [W]
226 : Real64 SensCoolingEnergy; // Sensible cooling energy delivered by the OAU supply air to the zone [J]
227 : Real64 LatCoolingRate; // Rate of latent cooling delivered to the zone [W]
228 : Real64 LatCoolingEnergy; // Latent cooling energy delivered by the OAU supply air to the zone [J]
229 : Real64 ElecFanRate; // Total electric use rate (power) for supply/exhaust fans [W]
230 : Real64 ElecFanEnergy; // Electric energy use for supply fan and exhaust fan [J]
231 : Real64 SensHeatingEnergy; // sensible heating energy delivered by the ERV supply air to the zone [J]
232 : Real64 SensHeatingRate; // rate of sensible heating delivered to the zone [W]
233 : Real64 LatHeatingEnergy; // latent heating energy delivered by the ERV supply air to the zone [J]
234 : Real64 LatHeatingRate; // rate of latent heating delivered to the zone [W]
235 : Real64 TotHeatingEnergy; // total heating energy delivered by the ERV supply air to the zone [J]
236 : Real64 TotHeatingRate; // rate of total heating delivered to the zone [W]
237 : bool FirstPass; // detects first time through for resetting sizing data
238 :
239 : // Default Constructor
240 5 : OAUnitData()
241 20 : : ZonePtr(0), ZoneNodeNum(0), controlType(OAUnitCtrlType::Invalid), AirInletNode(0), AirOutletNode(0), SFan_Index(0),
242 5 : supFanType(HVAC::FanType::Invalid), supFanPlace(HVAC::FanPlace::Invalid), FanCorTemp(0.0), FanEffect(false), SFanOutletNode(0),
243 5 : ExtFan_Index(0), extFanType(HVAC::FanType::Invalid), ExtFan(false), OutsideAirNode(0), OutAirVolFlow(0.0), OutAirMassFlow(0.0),
244 5 : ExtAirVolFlow(0.0), ExtAirMassFlow(0.0), SMaxAirMassFlow(0.0), EMaxAirMassFlow(0.0), SFanMaxAirVolFlow(0.0), EFanMaxAirVolFlow(0.0),
245 5 : OperatingMode(Operation::Invalid), ControlCompTypeNum(0), CompErrIndex(0), AirMassFlow(0.0), FlowError(false), NumComponents(0),
246 10 : CompOutSetTemp(0.0), TotCoolingRate(0.0), TotCoolingEnergy(0.0), SensCoolingRate(0.0), SensCoolingEnergy(0.0), LatCoolingRate(0.0),
247 5 : LatCoolingEnergy(0.0), ElecFanRate(0.0), ElecFanEnergy(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0), LatHeatingEnergy(0.0),
248 5 : LatHeatingRate(0.0), TotHeatingEnergy(0.0), TotHeatingRate(0.0), FirstPass(true)
249 : {
250 5 : }
251 : };
252 :
253 : void SimOutdoorAirUnit(EnergyPlusData &state,
254 : std::string_view CompName, // name of the outdoor air unit
255 : int ZoneNum, // number of zone being served
256 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
257 : Real64 &PowerMet, // Sensible power supplied (W)
258 : Real64 &LatOutputProvided, // Latent add/removal supplied by window AC (kg/s), dehumid = negative
259 : int &CompIndex);
260 :
261 : void GetOutdoorAirUnitInputs(EnergyPlusData &state);
262 :
263 : void InitOutdoorAirUnit(EnergyPlusData &state,
264 : int OAUnitNum, // index for the current outdoor air unit
265 : int ZoneNum, // number of zone being served
266 : bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
267 : );
268 :
269 : void SizeOutdoorAirUnit(EnergyPlusData &state, int OAUnitNum);
270 :
271 : void CalcOutdoorAirUnit(EnergyPlusData &state,
272 : int &OAUnitNum, // number of the current unit being simulated
273 : int ZoneNum, // number of zone being served
274 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
275 : Real64 &PowerMet, // power supplied
276 : Real64 &LatOutputProvided // Latent power supplied (kg/s), negative = dehumidification
277 : );
278 :
279 : void SimZoneOutAirUnitComps(EnergyPlusData &state, int OAUnitNum, bool FirstHVACIteration);
280 :
281 : void SimOutdoorAirEquipComps(EnergyPlusData &state,
282 : int OAUnitNum, // actual outdoor air unit num
283 : std::string_view EquipType, // the component type
284 : std::string const &EquipName, // the component Name
285 : int EquipNum,
286 : CompType CompTypeNum, // Component Type -- Integerized for this module
287 : bool FirstHVACIteration,
288 : int &CompIndex,
289 : bool Sim // if TRUE, simulate component
290 : );
291 :
292 : void CalcOAUnitCoilComps(EnergyPlusData &state,
293 : int CompNum, // actual outdoor air unit num
294 : bool FirstHVACIteration,
295 : int EquipIndex, // Component Type -- Integerized for this module
296 : Real64 &LoadMet);
297 :
298 : void ReportOutdoorAirUnit(EnergyPlusData &state,
299 : int OAUnitNum); // Index for the outdoor air unit under consideration within the derived types
300 :
301 : int GetOutdoorAirUnitOutAirNode(EnergyPlusData &state, int OAUnitNum);
302 :
303 : int GetOutdoorAirUnitZoneInletNode(EnergyPlusData &state, int OAUnitNum);
304 :
305 : int GetOutdoorAirUnitReturnAirNode(EnergyPlusData &state, int OAUnitNum);
306 :
307 : int getOutdoorAirUnitEqIndex(EnergyPlusData &state, std::string_view EquipName);
308 : } // namespace OutdoorAirUnit
309 :
310 : struct OutdoorAirUnitData : BaseGlobalStruct
311 : {
312 : int NumOfOAUnits = 0; // Number of outdoor air unit in the input file
313 : Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the zone outdoor air unit
314 : Array1D_bool MyOneTimeErrorFlag;
315 : bool GetOutdoorAirUnitInputFlag = true; // Flag set to make sure you get input once
316 : Array1D_bool MySizeFlag;
317 : Array1D_bool CheckEquipName;
318 : Array1D<OutdoorAirUnit::OAUnitData> OutAirUnit;
319 : bool MyOneTimeFlag = true;
320 : bool ZoneEquipmentListChecked = false;
321 : std::unordered_set<std::string> SupplyFanUniqueNames;
322 : std::unordered_set<std::string> ExhaustFanUniqueNames;
323 : std::unordered_set<std::string> ComponentListUniqueNames;
324 : Array1D_bool MyEnvrnFlag;
325 : Array1D_bool MyPlantScanFlag;
326 : Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers
327 : bool HeatActive = false;
328 : bool CoolActive = false;
329 :
330 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
331 : {
332 2126 : }
333 :
334 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
335 : {
336 1152 : }
337 :
338 2100 : void clear_state() override
339 : {
340 2100 : new (this) OutdoorAirUnitData();
341 2100 : }
342 : };
343 :
344 : } // namespace EnergyPlus
345 :
346 : // namespace EnergyPlus
347 :
348 : #endif
|