Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, 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 90 : 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; // used in Steam...
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 12 : OAEquipList()
164 12 : : Type(CompType::Invalid), ComponentIndex(0), CoilAirInletNode(0), CoilAirOutletNode(0), CoilWaterInletNode(0), CoilWaterOutletNode(0),
165 : CoilType(DataPlant::PlantEquipmentType::Invalid), plantLoc{}, FluidIndex(0), MaxVolWaterFlow(0.0), MaxWaterMassFlow(0.0),
166 12 : MinVolWaterFlow(0.0), MinWaterMassFlow(0.0), FirstPass(true)
167 : {
168 12 : }
169 : };
170 :
171 26 : struct OAUnitData
172 : {
173 : // Members
174 : // Input data
175 : std::string Name; // name of unit
176 : std::string SchedName; // availability schedule
177 : int SchedPtr; // index to schedule
178 : std::string ZoneName; // Name of zone the system is serving
179 : int ZonePtr; // Point to this zone in the Zone derived type
180 : int ZoneNodeNum; // index of zone air node in node structure
181 : std::string UnitControlType; // Control type for the system
182 : // (Neutral and setpoint temperatrue)
183 : OAUnitCtrlType controlType; // Unit Control type indicator
184 : int AirInletNode; // inlet air node number
185 : int AirOutletNode; // outlet air node number
186 : std::string SFanName; // name of supply fan
187 : int SFan_Index; // index in fan structure
188 : int SFanType; // type of fan in cFanTypes
189 : int SFanAvailSchedPtr; // supply fan availability sched from fan object
190 : int FanPlace; // fan placement; blow through and draw through
191 : Real64 FanCorTemp; // correction temperature
192 : bool FanEffect; // .TRUE. if unit has a fan type of draw through
193 : int SFanOutletNode; // supply fan outlet node number
194 : std::string ExtFanName; // name of exhaust fan
195 : int ExtFan_Index; // index in fan structure
196 : int ExtFanType; // type of fan in cFanTypes
197 : int ExtFanAvailSchedPtr; // exhaust fan availability sched from fan object
198 : bool ExtFan; // true if there is an exhaust fan
199 : std::string OutAirSchedName; // schedule of fraction for outside air (all controls)
200 : int OutAirSchedPtr; // index to schedule
201 : int OutsideAirNode; // outside air node number
202 : Real64 OutAirVolFlow; // m3/s
203 : Real64 OutAirMassFlow; // kg/s
204 : Real64 ExtAirVolFlow; // m3/s
205 : Real64 ExtAirMassFlow; // kg/s
206 : std::string ExtAirSchedName; // schedule of fraction for exhaust air
207 : int ExtOutAirSchedPtr; // index to schedule
208 : Real64 SMaxAirMassFlow; // kg/s
209 : Real64 EMaxAirMassFlow; // kg/s
210 : Real64 SFanMaxAirVolFlow; // m3/s
211 : Real64 EFanMaxAirVolFlow; // m3/s
212 : std::string HiCtrlTempSched; // Schedule name for the High Control Air temperature
213 : int HiCtrlTempSchedPtr; // Schedule index for the High Control Air temperature
214 : std::string LoCtrlTempSched; // Schedule name for the Low Control Air temperature
215 : int LoCtrlTempSchedPtr; // Schedule index for the Low Control Air temperature
216 : Operation OperatingMode; // operating condition( NeutralMode, HeatingMode, CoolingMode)
217 : int ControlCompTypeNum;
218 : int CompErrIndex;
219 : Real64 AirMassFlow; // kg/s
220 : bool FlowError; // flow error flag
221 : int NumComponents;
222 : std::string ComponentListName;
223 : Real64 CompOutSetTemp; // component outlet setpoint temperature
224 : int AvailStatus;
225 : std::string AvailManagerListName; // Name of an availability manager list object
226 : Array1D<OAEquipList> OAEquip;
227 : // Report data
228 : Real64 TotCoolingRate; // Rate of total cooling delivered to the zone [W]
229 : Real64 TotCoolingEnergy; // Total cooling energy delivered by the OAU supply air to the zone [J]
230 : Real64 SensCoolingRate; // Rate of sensible cooling delivered to the zone [W]
231 : Real64 SensCoolingEnergy; // Sensible cooling energy delivered by the OAU supply air to the zone [J]
232 : Real64 LatCoolingRate; // Rate of latent cooling delivered to the zone [W]
233 : Real64 LatCoolingEnergy; // Latent cooling energy delivered by the OAU supply air to the zone [J]
234 : Real64 ElecFanRate; // Total electric use rate (power) for supply/exhaust fans [W]
235 : Real64 ElecFanEnergy; // Electric energy use for supply fan and exhaust fan [J]
236 : Real64 SensHeatingEnergy; // sensible heating energy delivered by the ERV supply air to the zone [J]
237 : Real64 SensHeatingRate; // rate of sensible heating delivered to the zone [W]
238 : Real64 LatHeatingEnergy; // latent heating energy delivered by the ERV supply air to the zone [J]
239 : Real64 LatHeatingRate; // rate of latent heating delivered to the zone [W]
240 : Real64 TotHeatingEnergy; // total heating energy delivered by the ERV supply air to the zone [J]
241 : Real64 TotHeatingRate; // rate of total heating delivered to the zone [W]
242 : bool FirstPass; // detects first time through for resetting sizing data
243 :
244 : // Default Constructor
245 2 : OAUnitData()
246 2 : : SchedPtr(0), ZonePtr(0), ZoneNodeNum(0), controlType(OAUnitCtrlType::Invalid), AirInletNode(0), AirOutletNode(0), SFan_Index(0),
247 : SFanType(0), SFanAvailSchedPtr(0), FanPlace(0), FanCorTemp(0.0), FanEffect(false), SFanOutletNode(0), ExtFan_Index(0), ExtFanType(0),
248 : ExtFanAvailSchedPtr(0), ExtFan(false), OutAirSchedPtr(0), OutsideAirNode(0), OutAirVolFlow(0.0), OutAirMassFlow(0.0),
249 : ExtAirVolFlow(0.0), ExtAirMassFlow(0.0), ExtOutAirSchedPtr(0), SMaxAirMassFlow(0.0), EMaxAirMassFlow(0.0), SFanMaxAirVolFlow(0.0),
250 : EFanMaxAirVolFlow(0.0), HiCtrlTempSchedPtr(0), LoCtrlTempSchedPtr(0), OperatingMode(Operation::Invalid), ControlCompTypeNum(0),
251 : CompErrIndex(0), AirMassFlow(0.0), FlowError(false), NumComponents(0), CompOutSetTemp(0.0), AvailStatus(0), TotCoolingRate(0.0),
252 : TotCoolingEnergy(0.0), SensCoolingRate(0.0), SensCoolingEnergy(0.0), LatCoolingRate(0.0), LatCoolingEnergy(0.0), ElecFanRate(0.0),
253 : ElecFanEnergy(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0), LatHeatingEnergy(0.0), LatHeatingRate(0.0), TotHeatingEnergy(0.0),
254 2 : TotHeatingRate(0.0), FirstPass(true)
255 : {
256 2 : }
257 : };
258 :
259 : void SimOutdoorAirUnit(EnergyPlusData &state,
260 : std::string_view CompName, // name of the outdoor air unit
261 : int ZoneNum, // number of zone being served
262 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
263 : Real64 &PowerMet, // Sensible power supplied (W)
264 : Real64 &LatOutputProvided, // Latent add/removal supplied by window AC (kg/s), dehumid = negative
265 : int &CompIndex);
266 :
267 : void GetOutdoorAirUnitInputs(EnergyPlusData &state);
268 :
269 : void InitOutdoorAirUnit(EnergyPlusData &state,
270 : int OAUnitNum, // index for the current outdoor air unit
271 : int ZoneNum, // number of zone being served
272 : bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
273 : );
274 :
275 : void SizeOutdoorAirUnit(EnergyPlusData &state, int OAUnitNum);
276 :
277 : void CalcOutdoorAirUnit(EnergyPlusData &state,
278 : int &OAUnitNum, // number of the current unit being simulated
279 : int ZoneNum, // number of zone being served
280 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
281 : Real64 &PowerMet, // power supplied
282 : Real64 &LatOutputProvided // Latent power supplied (kg/s), negative = dehumidification
283 : );
284 :
285 : void SimZoneOutAirUnitComps(EnergyPlusData &state, int OAUnitNum, bool FirstHVACIteration);
286 :
287 : void SimOutdoorAirEquipComps(EnergyPlusData &state,
288 : int OAUnitNum, // actual outdoor air unit num
289 : std::string_view EquipType, // the component type
290 : std::string const &EquipName, // the component Name
291 : int EquipNum,
292 : CompType CompTypeNum, // Component Type -- Integerized for this module
293 : bool FirstHVACIteration,
294 : int &CompIndex,
295 : bool Sim // if TRUE, simulate component
296 : );
297 :
298 : void CalcOAUnitCoilComps(EnergyPlusData &state,
299 : int CompNum, // actual outdoor air unit num
300 : bool FirstHVACIteration,
301 : int EquipIndex, // Component Type -- Integerized for this module
302 : Real64 &LoadMet);
303 :
304 : void ReportOutdoorAirUnit(EnergyPlusData &state,
305 : int OAUnitNum); // Index for the outdoor air unit under consideration within the derived types
306 :
307 : int GetOutdoorAirUnitOutAirNode(EnergyPlusData &state, int OAUnitNum);
308 :
309 : int GetOutdoorAirUnitZoneInletNode(EnergyPlusData &state, int OAUnitNum);
310 :
311 : int GetOutdoorAirUnitReturnAirNode(EnergyPlusData &state, int OAUnitNum);
312 : } // namespace OutdoorAirUnit
313 :
314 1542 : struct OutdoorAirUnitData : BaseGlobalStruct
315 : {
316 : int NumOfOAUnits = 0; // Number of outdoor air unit in the input file
317 : Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the zone outdoor air unit
318 : Array1D_bool MyOneTimeErrorFlag;
319 : bool GetOutdoorAirUnitInputFlag = true; // Flag set to make sure you get input once
320 : Array1D_bool MySizeFlag;
321 : Array1D_bool CheckEquipName;
322 : Array1D<OutdoorAirUnit::OAUnitData> OutAirUnit;
323 : bool MyOneTimeFlag = true;
324 : bool ZoneEquipmentListChecked = false;
325 : std::unordered_set<std::string> SupplyFanUniqueNames;
326 : std::unordered_set<std::string> ExhaustFanUniqueNames;
327 : std::unordered_set<std::string> ComponentListUniqueNames;
328 : Array1D_bool MyEnvrnFlag;
329 : Array1D_bool MyPlantScanFlag;
330 : Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers
331 : bool HeatActive = false;
332 : bool CoolActive = false;
333 :
334 0 : void clear_state() override
335 : {
336 0 : *this = OutdoorAirUnitData();
337 0 : }
338 : };
339 :
340 : } // namespace EnergyPlus
341 :
342 : // namespace EnergyPlus
343 :
344 : #endif
|