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 UnitVentilator_hh_INCLUDED
49 : #define UnitVentilator_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Optional.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/EPVector.hh>
59 : #include <EnergyPlus/EnergyPlus.hh>
60 : #include <EnergyPlus/FluidProperties.hh>
61 : #include <EnergyPlus/Plant/Enums.hh>
62 : #include <EnergyPlus/Plant/PlantLocation.hh>
63 : #include <EnergyPlus/SystemAvailabilityManager.hh>
64 :
65 : namespace EnergyPlus {
66 :
67 : // Forward declarations
68 : struct EnergyPlusData;
69 :
70 : namespace UnitVentilator {
71 :
72 : enum class CoilsUsed
73 : {
74 : Invalid = -1,
75 : None,
76 : Both,
77 : Heating,
78 : Cooling,
79 : Num
80 : };
81 : enum class HeatCoilType
82 : {
83 : Invalid = -1,
84 : Electric,
85 : Gas,
86 : Water,
87 : Steam,
88 : Num
89 : };
90 : enum class CoolCoilType
91 : {
92 : Invalid = -1,
93 : Water,
94 : Detailed,
95 : HXAssisted,
96 : Num
97 : };
98 : enum class OAControl
99 : {
100 : Invalid = -1,
101 : VariablePercent,
102 : FixedTemperature,
103 : FixedAmount,
104 : Num
105 : };
106 :
107 : struct UnitVentilatorData
108 : {
109 : std::string Name; // name of unit
110 : Sched::Schedule *availSched = nullptr;
111 : int AirInNode = 0; // inlet air node number
112 : int AirOutNode = 0; // outlet air node number
113 : int FanOutletNode = 0; // outlet node number for fan exit
114 : // (assumes fan is upstream of heating coil)
115 : HVAC::FanType fanType = HVAC::FanType::Invalid; // Fan type number (see DataHVACGlobals)
116 : std::string FanName; // name of fan
117 : int Fan_Index = 0;
118 : Sched::Schedule *fanOpModeSched = nullptr; // index to fan operating mode schedule
119 : Sched::Schedule *fanAvailSched = nullptr;
120 : HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling coil, 2=continuous fan, cycling coil
121 : int ControlCompTypeNum = 0;
122 : int CompErrIndex = 0;
123 : Real64 MaxAirVolFlow = 0.0; // m3/s
124 : Real64 MaxAirMassFlow = 0.0; // kg/s
125 : OAControl OAControlType = OAControl::Invalid; // type of control; options are VARIABLE PERCENT and FIXED TEMPERATURE
126 : Sched::Schedule *minOASched = nullptr;
127 : Sched::Schedule *maxOASched = nullptr;
128 : Sched::Schedule *tempSched = nullptr;
129 : int OutsideAirNode = 0; // outside air node number
130 : int AirReliefNode = 0; // relief air node number
131 : int OAMixerOutNode = 0; // outlet node after the outside air mixer (inlet to coils if present)
132 : Real64 OutAirVolFlow = 0.0; // m3/s
133 : Real64 OutAirMassFlow = 0.0; // kg/s
134 : Real64 MinOutAirVolFlow = 0.0; // m3/s
135 : Real64 MinOutAirMassFlow = 0.0; // kg/s
136 : CoilsUsed CoilOption = CoilsUsed::Invalid; // type of coil option; options are BOTH, HEATING, COOLING, AND NONE
137 : bool HCoilPresent = false; // .TRUE. if unit ventilator has a heating coil
138 : HeatCoilType HCoilType = HeatCoilType::Invalid; // type of heating coil (water, gas, electric, etc.)
139 : std::string HCoilName; // name of heating coil
140 : std::string HCoilTypeCh; // type of heating coil character string (same as type on idf file).
141 : int HCoil_Index = 0;
142 : DataPlant::PlantEquipmentType HeatingCoilType = DataPlant::PlantEquipmentType::Invalid;
143 :
144 : Fluid::RefrigProps *HCoil_fluid = nullptr;
145 : Sched::Schedule *hCoilSched = nullptr;
146 :
147 : Real64 HCoilSchedValue = 0.0;
148 : Real64 MaxVolHotWaterFlow = 0.0; // m3/s
149 : Real64 MaxVolHotSteamFlow = 0.0; // m3/s
150 : Real64 MaxHotWaterFlow = 0.0; // kg/s
151 : Real64 MaxHotSteamFlow = 0.0;
152 : Real64 MinHotSteamFlow = 0.0;
153 : Real64 MinVolHotWaterFlow = 0.0; // m3/s
154 : Real64 MinVolHotSteamFlow = 0.0; // m3/s
155 : Real64 MinHotWaterFlow = 0.0; // kg/s
156 : int HotControlNode = 0; // hot water control node
157 : int HotCoilOutNodeNum = 0; // outlet of coil
158 : Real64 HotControlOffset = 0.0; // control tolerance
159 : PlantLocation HWplantLoc; // index for plant location for hot water coil
160 : bool CCoilPresent = false; // .TRUE. if unit ventilator has a cooling coil
161 : std::string CCoilName; // name of cooling coil
162 : std::string CCoilTypeCh; // type of cooling coil as character string (same as on idf file)
163 : int CCoil_Index = 0;
164 : std::string CCoilPlantName; // name of cooling coil for plant
165 : std::string CCoilPlantType; // type of cooling coil for plant
166 : DataPlant::PlantEquipmentType CoolingCoilType = DataPlant::PlantEquipmentType::Invalid;
167 : CoolCoilType CCoilType = CoolCoilType::Invalid;
168 : Sched::Schedule *cCoilSched = nullptr;
169 : Real64 CCoilSchedValue = 0.0;
170 : Real64 MaxVolColdWaterFlow = 0.0; // m3/s
171 : Real64 MaxColdWaterFlow = 0.0; // kg/s
172 : Real64 MinVolColdWaterFlow = 0.0; // m3/s
173 : Real64 MinColdWaterFlow = 0.0; // kg/s
174 : int ColdControlNode = 0; // chilled water control node
175 : int ColdCoilOutNodeNum = 0; // chilled water coil out node
176 : Real64 ColdControlOffset = 0.0; // control tolerance
177 : PlantLocation CWPlantLoc; // index for plant component for chilled water coil
178 : // Report data
179 : Real64 HeatPower = 0.0; // unit heating output in watts
180 : Real64 HeatEnergy = 0.0; // unit heating output in J
181 : Real64 TotCoolPower = 0.0;
182 : Real64 TotCoolEnergy = 0.0;
183 : Real64 SensCoolPower = 0.0;
184 : Real64 SensCoolEnergy = 0.0;
185 : Real64 ElecPower = 0.0;
186 : Real64 ElecEnergy = 0.0;
187 : std::string AvailManagerListName; // Name of an availability manager list object
188 : Avail::Status availStatus = Avail::Status::NoAction;
189 : Real64 FanPartLoadRatio = 0.0; // fan part-load ratio for time step
190 : Real64 PartLoadFrac = 0.0; // unit ventilator part-load ratio for time step
191 : int ZonePtr = 0; // pointer to a zone served by a unit ventilator
192 : int HVACSizingIndex = 0; // index of a HVACSizing object for a unit ventilator
193 : bool ATMixerExists = false; // True if there is an ATMixer
194 : std::string ATMixerName; // name of air mixer
195 : int ATMixerIndex = 0; // index to the air mixer
196 : HVAC::MixerType ATMixerType = HVAC::MixerType::Invalid; // 1 = inlet side mixer, 2 = supply side mixer
197 : int ATMixerPriNode = 0; // primary inlet air node number for the mixer
198 : int ATMixerSecNode = 0; // secondary air inlet node number for the mixer
199 : int ATMixerOutNode = 0; // outlet air node number for the mixer
200 : bool FirstPass = true; // detects first time through for resetting sizing data
201 :
202 7 : UnitVentilatorData() = default;
203 14 : ~UnitVentilatorData()
204 : {
205 14 : }
206 : };
207 :
208 : struct UnitVentNumericFieldData
209 : {
210 : // Members
211 : Array1D_string FieldNames;
212 :
213 3 : UnitVentNumericFieldData() = default;
214 6 : ~UnitVentNumericFieldData()
215 : {
216 6 : }
217 : };
218 :
219 : void SimUnitVentilator(EnergyPlusData &state,
220 : std::string_view CompName, // name of the fan coil unit
221 : int const ZoneNum, // number of zone being served
222 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
223 : Real64 &PowerMet, // Sensible power supplied (W)
224 : Real64 &LatOutputProvided, // Latent add/removal supplied by window AC (kg/s), dehumid = negative
225 : int &CompIndex);
226 :
227 : void GetUnitVentilatorInput(EnergyPlusData &state);
228 :
229 : void InitUnitVentilator(EnergyPlusData &state,
230 : int const UnitVentNum, // index for the current unit ventilator
231 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
232 : int const ZoneNum // number of zone being served
233 : );
234 :
235 : void SizeUnitVentilator(EnergyPlusData &state, int const UnitVentNum);
236 :
237 : void CalcUnitVentilator(EnergyPlusData &state,
238 : int &UnitVentNum, // number of the current fan coil unit being simulated
239 : int const ZoneNum, // number of zone being served
240 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
241 : Real64 &PowerMet, // Sensible power supplied (W)
242 : Real64 &LatOutputProvided // Latent power supplied (kg/s), negative = dehumidification
243 : );
244 :
245 : void CalcUnitVentilatorComponents(EnergyPlusData &state,
246 : int const UnitVentNum, // Unit index in unit ventilator array
247 : bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
248 : Real64 &LoadMet, // load met by unit (watts)
249 : ObjexxFCL::Optional<HVAC::FanOp const> fanOp = HVAC::FanOp::Continuous, // Fan Type
250 : ObjexxFCL::Optional<Real64 const> PartLoadFrac = 1.0 // Part Load Ratio of coil and fan
251 : );
252 :
253 : void SimUnitVentOAMixer(EnergyPlusData &state,
254 : int const UnitVentNum, // Unit index in unit ventilator array
255 : HVAC::FanOp const fanOp // unit ventilator fan operating mode
256 : );
257 :
258 : void ReportUnitVentilator(EnergyPlusData &state, int const UnitVentNum); // Unit index in unit ventilator array
259 :
260 : int GetUnitVentilatorOutAirNode(EnergyPlusData &state, int const UnitVentNum);
261 :
262 : int GetUnitVentilatorZoneInletAirNode(EnergyPlusData &state, int const UnitVentNum);
263 :
264 : int GetUnitVentilatorMixedAirNode(EnergyPlusData &state, int const UnitVentNum);
265 :
266 : int GetUnitVentilatorReturnAirNode(EnergyPlusData &state, int const UnitVentNum);
267 :
268 : int getUnitVentilatorIndex(EnergyPlusData &state, std::string_view CompName);
269 :
270 : Real64 SetOAMassFlowRateForCoolingVariablePercent(EnergyPlusData &state,
271 : int const UnitVentNum, // Unit Ventilator index number
272 : Real64 const MinOAFrac, // Minimum Outside Air Fraction
273 : Real64 const MassFlowRate, // Design Outside Air Mass Flow Rate
274 : Real64 const MaxOAFrac, // Maximum Outside Air Fraction
275 : Real64 const Tinlet, // Inlet Temperature to Unit or Zone Temperature
276 : Real64 const Toutdoor // Outdoor Air Temperature
277 : );
278 :
279 : void CalcMdotCCoilCycFan(EnergyPlusData &state,
280 : Real64 &mdot, // mass flow rate
281 : Real64 &QCoilReq, // Remaining cooling coil load
282 : Real64 const QZnReq, // Zone load to setpoint
283 : int const UnitVentNum, // Unit Ventilator index
284 : Real64 const PartLoadRatio // Part load ratio for unit ventilator
285 : );
286 :
287 : } // namespace UnitVentilator
288 :
289 : struct UnitVentilatorsData : BaseGlobalStruct
290 : {
291 :
292 : // Current Module Unit type
293 : std::string const cMO_UnitVentilator = "ZoneHVAC:UnitVentilator";
294 :
295 : bool HCoilOn = false; // TRUE if the heating coil = gas or electric especially) should be running
296 : int NumOfUnitVents = 0; // Number of unit ventilators in the input file
297 : Real64 OAMassFlowRate = 0.0; // Outside air mass flow rate for the unit ventilator
298 : Real64 QZnReq = 0.0; // heating or cooling needed by zone [watts]
299 : Array1D_bool MySizeFlag;
300 : bool GetUnitVentilatorInputFlag = true; // First time, input is "gotten"
301 : Array1D_bool CheckEquipName;
302 :
303 : EPVector<UnitVentilator::UnitVentilatorData> UnitVent;
304 : EPVector<UnitVentilator::UnitVentNumericFieldData> UnitVentNumericFields;
305 :
306 : bool MyOneTimeFlag = true;
307 : bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
308 :
309 : Array1D_bool MyEnvrnFlag;
310 : Array1D_bool MyPlantScanFlag;
311 : Array1D_bool MyZoneEqFlag;
312 :
313 : int ATMixOutNode = 0; // outlet node of ATM Mixer
314 : int ATMixerPriNode = 0; // primary air node of ATM Mixer
315 : int ZoneNode = 0; // zone node
316 :
317 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
318 : {
319 2126 : }
320 :
321 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
322 : {
323 1152 : }
324 :
325 2101 : void clear_state() override
326 : {
327 2101 : this->HCoilOn = false;
328 2101 : this->NumOfUnitVents = 0;
329 2101 : this->OAMassFlowRate = 0.0;
330 2101 : this->QZnReq = 0.0;
331 2101 : this->GetUnitVentilatorInputFlag = true;
332 2101 : this->MySizeFlag.deallocate();
333 2101 : this->CheckEquipName.deallocate();
334 2101 : this->UnitVent.deallocate();
335 2101 : this->UnitVentNumericFields.deallocate();
336 2101 : this->MyOneTimeFlag = true;
337 2101 : this->ZoneEquipmentListChecked = false;
338 2101 : this->MyEnvrnFlag.deallocate();
339 2101 : this->MyPlantScanFlag.deallocate();
340 2101 : this->MyZoneEqFlag.deallocate();
341 2101 : this->ATMixOutNode = 0;
342 2101 : this->ATMixerPriNode = 0;
343 2101 : this->ZoneNode = 0;
344 2101 : }
345 :
346 : // Default Constructor
347 6387 : UnitVentilatorsData() = default;
348 4210 : ~UnitVentilatorsData()
349 4210 : {
350 4210 : }
351 : };
352 : } // namespace EnergyPlus
353 :
354 : #endif
|