Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, 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 ENERGYPLUS_UNITARYSYSTEM_HH
49 : #define ENERGYPLUS_UNITARYSYSTEM_HH
50 :
51 : // C++ headers
52 : #include <string>
53 : #include <vector>
54 :
55 : // EnergyPlus headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataHVACGlobals.hh>
58 : #include <EnergyPlus/DataHVACSystems.hh>
59 : #include <EnergyPlus/DataHeatBalance.hh>
60 : #include <EnergyPlus/DataZoneEquipment.hh>
61 : #include <EnergyPlus/PackagedThermalStorageCoil.hh>
62 : #include <EnergyPlus/Plant/PlantLocation.hh>
63 : #include <EnergyPlus/SimAirServingZones.hh>
64 :
65 : namespace EnergyPlus {
66 :
67 : // Forward declarations
68 : struct EnergyPlusData;
69 :
70 : namespace UnitarySystems {
71 :
72 : // Supply Air Sizing Option
73 : int constexpr None = 1;
74 : int constexpr SupplyAirFlowRate = 2;
75 : int constexpr FlowPerFloorArea = 3;
76 : int constexpr FractionOfAutoSizedCoolingValue = 4;
77 : int constexpr FractionOfAutoSizedHeatingValue = 5;
78 : int constexpr FlowPerCoolingCapacity = 6;
79 : int constexpr FlowPerHeatingCapacity = 7;
80 :
81 : // Last mode of operation
82 : int constexpr CoolingMode = 1; // last compressor operating mode was in cooling
83 : int constexpr HeatingMode = 2; // last compressor operating mode was in heating
84 : int constexpr NoCoolHeat = 3; // last operating mode was no cooling or heating
85 :
86 : struct UnitarySysInputSpec
87 : {
88 : // system_type is not an object input but the actual type of object (e.g., UnitarySystem, CoilSystem:Cooling:DX, etc.).
89 : // Each specific getInput sets this string accordingly so that processInputSpec knows the object type
90 : // that will be used in warnings and reporting. This is a work in progress.
91 : std::string system_type;
92 :
93 : // object input fields
94 : std::string name;
95 : std::string control_type;
96 : std::string controlling_zone_or_thermostat_location;
97 : std::string dehumidification_control_type;
98 : std::string availability_schedule_name;
99 : std::string air_inlet_node_name;
100 : std::string air_outlet_node_name;
101 : std::string supply_fan_object_type;
102 : std::string supply_fan_name;
103 : std::string fan_placement;
104 : std::string supply_air_fan_operating_mode_schedule_name;
105 : std::string heating_coil_object_type;
106 : std::string heating_coil_name;
107 : Real64 dx_heating_coil_sizing_ratio = 1.0;
108 : std::string cooling_coil_object_type;
109 : std::string cooling_coil_name;
110 : std::string use_doas_dx_cooling_coil;
111 : Real64 minimum_supply_air_temperature = 2.0;
112 : std::string latent_load_control;
113 : std::string supplemental_heating_coil_object_type;
114 : std::string supplemental_heating_coil_name;
115 : std::string cooling_supply_air_flow_rate_method;
116 : Real64 cooling_supply_air_flow_rate = -999.0;
117 : Real64 cooling_supply_air_flow_rate_per_floor_area = -999.0;
118 : Real64 cooling_fraction_of_autosized_cooling_supply_air_flow_rate = -999.0;
119 : Real64 cooling_supply_air_flow_rate_per_unit_of_capacity = -999.0;
120 : std::string heating_supply_air_flow_rate_method;
121 : Real64 heating_supply_air_flow_rate = -999.0;
122 : Real64 heating_supply_air_flow_rate_per_floor_area = -999.0;
123 : Real64 heating_fraction_of_autosized_heating_supply_air_flow_rate = -999.0;
124 : Real64 heating_supply_air_flow_rate_per_unit_of_capacity = -999.0;
125 : std::string no_load_supply_air_flow_rate_method;
126 : Real64 no_load_supply_air_flow_rate = -999.0;
127 : std::string no_load_supply_air_flow_rate_low_speed;
128 : Real64 no_load_supply_air_flow_rate_per_floor_area = -999.0;
129 : Real64 no_load_fraction_of_autosized_cooling_supply_air_flow_rate = -999.0;
130 : Real64 no_load_fraction_of_autosized_heating_supply_air_flow_rate = -999.0;
131 : Real64 no_load_supply_air_flow_rate_per_unit_of_capacity_during_cooling_operation = -999.0;
132 : Real64 no_load_supply_air_flow_rate_per_unit_of_capacity_during_heating_operation = -999.0;
133 : Real64 maximum_supply_air_temperature = 80.0;
134 : Real64 maximum_supply_air_temperature_from_supplemental_heater = 50.0;
135 : Real64 maximum_outdoor_dry_bulb_temperature_for_supplemental_heater_operation = 21.0;
136 : std::string outdoor_dry_bulb_temperature_sensor_node_name;
137 : std::string heat_pump_coil_water_flow_mode;
138 : Real64 ancillary_on_cycle_electric_power = 0.0;
139 : Real64 ancillary_off_cycle_electric_power = 0.0;
140 : Real64 design_heat_recovery_water_flow_rate = 0.0;
141 : Real64 maximum_temperature_for_heat_recovery = 80.0;
142 : std::string heat_recovery_water_inlet_node_name;
143 : std::string heat_recovery_water_outlet_node_name;
144 : std::string design_specification_multispeed_object_type;
145 : std::string design_specification_multispeed_object_name;
146 :
147 : // inputs required by non-UnitarySystem parent objects
148 : std::string dx_cooling_coil_system_sensor_node_name;
149 : std::string oa_mixer_type;
150 : std::string oa_mixer_name;
151 : std::string avail_manager_list_name;
152 : std::string design_spec_zonehvac_sizing_object_name;
153 : Real64 cooling_oa_flow_rate = 0.0;
154 : Real64 heating_oa_flow_rate = 0.0;
155 : Real64 no_load_oa_flow_rate = 0.0;
156 : Real64 heat_conv_tol = 0.001;
157 : Real64 cool_conv_tol = 0.001;
158 :
159 2268 : UnitarySysInputSpec() = default;
160 3581 : ~UnitarySysInputSpec() = default;
161 : };
162 :
163 : struct DesignSpecMSHP
164 : {
165 :
166 : public:
167 : std::string name;
168 : static DesignSpecMSHP *factory(EnergyPlusData &state, HVAC::UnitarySysType type, std::string const &objectName);
169 : int numOfSpeedHeating = 0;
170 : int numOfSpeedCooling = 0;
171 : Real64 noLoadAirFlowRateRatio = 1.0;
172 : std::vector<Real64> coolingVolFlowRatio; // The ratio of flow to max for this speed
173 : std::vector<Real64> heatingVolFlowRatio; // The ratio of flow to max for this speed
174 :
175 : // private:
176 : HVAC::UnitarySysType m_type = HVAC::UnitarySysType::Invalid;
177 : bool m_SingleModeFlag = false;
178 :
179 : static void getDesignSpecMSHP(EnergyPlusData &state);
180 : static void getDesignSpecMSHPdata([[maybe_unused]] EnergyPlusData &state, bool errorsFound);
181 :
182 187 : DesignSpecMSHP() = default;
183 313 : ~DesignSpecMSHP() = default;
184 : };
185 :
186 : struct UnitarySys : HVACSystemData
187 : {
188 :
189 : enum class UnitarySysCtrlType : int
190 : {
191 : Invalid = -1,
192 : None,
193 : Load,
194 : Setpoint,
195 : CCMASHRAE,
196 : Num
197 : };
198 :
199 : enum class DehumCtrlType : int
200 : {
201 : Invalid = -1,
202 : None,
203 : CoolReheat,
204 : Multimode,
205 : Num
206 : };
207 :
208 : // Airflow control for constant fan mode
209 : enum class UseCompFlow
210 : {
211 : Invalid = -1,
212 : On, // set compressor OFF air flow rate equal to compressor ON air flow rate
213 : Off, // set compressor OFF air flow rate equal to user defined value
214 : Num
215 : };
216 :
217 : // Parent models simulated using UnitarySystem source code
218 : enum class SysType
219 : {
220 : Invalid = -1,
221 : Unitary, // AirloopHVAC:UnitarySystem
222 : CoilCoolingDX, // CoilSystem:Cooling:DX
223 : CoilCoolingWater, // CoilSystem:Cooling:Water
224 : PackagedAC, // ZoneHVAC:PackagedTerminalAirConditioner
225 : PackagedHP, // ZoneHVAC:PackagedTerminalHeatPump
226 : PackagedWSHP, // ZoneHVAC:WaterToAirHeatPump
227 : Num,
228 : };
229 :
230 : UnitarySysInputSpec input_specs;
231 : int m_UnitarySysNum = -1;
232 : SysType m_sysType = SysType::Invalid;
233 : bool m_ThisSysInputShouldBeGotten = true;
234 : int m_SysAvailSchedPtr = 0; // Pointer to the availability schedule
235 : UnitarySysCtrlType m_ControlType = UnitarySysCtrlType::None;
236 : DehumCtrlType m_DehumidControlType_Num = DehumCtrlType::None;
237 : bool m_Humidistat = false;
238 : bool m_ValidASHRAECoolCoil = false;
239 : bool m_ValidASHRAEHeatCoil = false;
240 : bool m_SimASHRAEModel = false; // flag denoting that ASHRAE model (SZVAV) should be used
241 : bool m_setFaultModelInput = true;
242 : int m_FanIndex = 0;
243 : HVAC::FanPlace m_FanPlace = HVAC::FanPlace::Invalid;
244 : int m_FanOpModeSchedPtr = 0;
245 : bool m_FanExists = false;
246 : HVAC::FanType m_FanType = HVAC::FanType::Invalid;
247 : bool m_RequestAutoSize = false;
248 : Real64 m_ActualFanVolFlowRate = 0.0;
249 : Real64 m_DesignFanVolFlowRate = 0.0;
250 : Real64 m_DesignMassFlowRate = 0.0;
251 : int m_FanAvailSchedPtr = 0;
252 : HVAC::FanOp m_FanOpMode = HVAC::FanOp::Invalid;
253 : int m_ATMixerIndex = 0;
254 : int m_ATMixerPriNode = 0;
255 : int m_ATMixerSecNode = 0;
256 : bool m_AirLoopEquipment = true; // ?
257 : int m_ZoneInletNode = 0;
258 : int m_ZoneSequenceCoolingNum = 0;
259 : int m_ZoneSequenceHeatingNum = 0;
260 : bool m_HeatCoilExists = false;
261 : Real64 m_HeatingSizingRatio = 1.0;
262 : int m_HeatingCoilType_Num = 0;
263 : bool m_DXHeatingCoil = false;
264 : int m_HeatingCoilIndex = 0;
265 : int m_HeatingCoilAvailSchPtr = 0;
266 : Real64 m_DesignHeatingCapacity = 0.0;
267 : Real64 m_MaxHeatAirVolFlow = 0.0;
268 : int m_NumOfSpeedHeating = 0;
269 : int m_NumOfSpeedSuppHeating = 0;
270 : bool m_MultiSpeedHeatingCoil = false;
271 : bool m_VarSpeedHeatingCoil = false;
272 : int HeatCtrlNode = 0;
273 : bool m_CoolCoilExists = false;
274 : int m_CoolingCoilType_Num = 0;
275 : int m_NumOfSpeedCooling = 0;
276 : int m_CoolingCoilAvailSchPtr = 0;
277 : Real64 m_DesignCoolingCapacity = 0.0;
278 : Real64 m_MaxCoolAirVolFlow = 0.0;
279 : int m_CondenserNodeNum = 0;
280 : DataHeatBalance::RefrigCondenserType m_CondenserType = DataHeatBalance::RefrigCondenserType::Invalid;
281 : int m_CoolingCoilIndex = 0;
282 : bool m_HeatPump = false;
283 : int m_ActualDXCoilIndexForHXAssisted = 0;
284 : bool m_DiscreteSpeedCoolingCoil = false;
285 : bool m_ContSpeedCoolingCoil = false;
286 : int CoolCtrlNode = 0;
287 : HVAC::WaterFlow m_WaterCyclingMode = HVAC::WaterFlow::Invalid;
288 : bool m_ISHundredPercentDOASDXCoil = false;
289 : bool m_RunOnSensibleLoad = false;
290 : bool m_RunOnLatentLoad = false;
291 : bool m_RunOnLatentOnlyWithSensible = false;
292 : HVAC::CoilMode m_DehumidificationMode = HVAC::CoilMode::Normal; // Only explicitly initialized if something other than Normal
293 : int m_SuppHeatCoilType_Num = 0;
294 : bool m_SuppCoilExists = false;
295 : Real64 m_DesignSuppHeatingCapacity = 0.0;
296 : int m_SuppCoilAirInletNode = 0;
297 : int SuppCoilOutletNodeNum = 0;
298 : int m_SuppCoilFluidInletNode = 0;
299 : Real64 m_MaxSuppCoilFluidFlow = 0.0;
300 : int m_SuppHeatCoilIndex = 0;
301 : int SuppCtrlNode = 0;
302 : Real64 m_SupHeaterLoad = 0.0;
303 : int m_CoolingSAFMethod = 0;
304 : int m_HeatingSAFMethod = 0;
305 : int m_NoCoolHeatSAFMethod = 0;
306 : int m_CoolingCapMethod = 0;
307 : int m_HeatingCapMethod = 0;
308 : Real64 m_MaxNoCoolHeatAirVolFlow = 0.0;
309 : UseCompFlow m_AirFlowControl = UseCompFlow::Invalid;
310 : bool m_CoolingCoilUpstream = true;
311 : Real64 m_MaxOATSuppHeat = 0.0;
312 : Real64 m_MinOATCompressorCooling = 0.0;
313 : Real64 m_MinOATCompressorHeating = 0.0;
314 : Real64 m_AncillaryOnPower = 0.0;
315 : Real64 m_AncillaryOffPower = 0.0;
316 : Real64 m_DesignHRWaterVolumeFlow = 0.0;
317 : Real64 m_MaxHROutletWaterTemp = 0.0;
318 : bool m_HeatRecActive = false;
319 : int m_HeatRecoveryInletNodeNum = 0;
320 : int m_HeatRecoveryOutletNodeNum = 0;
321 : int m_DesignSpecMSHPIndex = -1;
322 : Real64 m_NoLoadAirFlowRateRatio = 1.0;
323 : bool m_useNoLoadLowSpeedAirFlow = true;
324 : int m_SingleMode = 0;
325 : bool m_MultiOrVarSpeedHeatCoil = false;
326 : bool m_MultiOrVarSpeedCoolCoil = false;
327 : Real64 m_PartLoadFrac = 0.0;
328 : Real64 m_CoolingPartLoadFrac = 0.0;
329 : Real64 m_HeatingPartLoadFrac = 0.0;
330 : Real64 m_SuppHeatPartLoadFrac = 0.0;
331 : Real64 m_HeatCompPartLoadRatio = 0.0;
332 : Real64 m_CoolCompPartLoadRatio = 0.0;
333 : Real64 m_SpeedRatio = 0.0;
334 : Real64 m_CycRatio = 0.0;
335 :
336 : bool m_MyEnvrnFlag = true;
337 : bool m_MyEnvrnFlag2 = true;
338 : bool m_MyPlantScanFlag = true;
339 : bool m_MySuppCoilPlantScanFlag = true;
340 : bool m_MySetPointCheckFlag = true;
341 : bool m_MySizingCheckFlag = true;
342 : bool m_InitHeatPump = false; // Heat pump initialization flag (for error reporting)
343 : PlantLocation m_HRPlantLoc;
344 : PlantLocation m_SuppCoilPlantLoc;
345 : int m_SuppCoilFluidOutletNodeNum = 0;
346 :
347 : Real64 m_CompPartLoadRatio = 0.0;
348 : Real64 m_CoolingCoilSensDemand = 0.0;
349 : Real64 m_CoolingCoilLatentDemand = 0.0;
350 : Real64 m_HeatingCoilSensDemand = 0.0;
351 : Real64 m_SenLoadLoss = 0.0;
352 : Real64 m_LatLoadLoss = 0.0;
353 : Real64 m_DesignHeatRecMassFlowRate = 0.0;
354 : Real64 m_HeatRecoveryMassFlowRate = 0.0;
355 : Real64 m_HeatRecoveryRate = 0.0;
356 : Real64 m_HeatRecoveryEnergy = 0.0;
357 : Real64 m_HeatRecoveryInletTemp = 0.0;
358 : Real64 m_HeatRecoveryOutletTemp = 0.0;
359 :
360 : int m_IterationCounter = 0;
361 :
362 : Real64 m_DesiredOutletTemp = 0.0;
363 : Real64 m_DesiredOutletHumRat = 0.0;
364 : int m_FrostControlStatus = 0;
365 :
366 : Real64 m_CoolingCycRatio = 0.0;
367 : Real64 m_CoolingSpeedRatio = 0.0;
368 : int m_CoolingSpeedNum = 0;
369 :
370 : int m_EconoSpeedNum = 0;
371 : Real64 m_EconoPartLoadRatio = 0;
372 : Real64 m_LowSpeedEconOutput = 0;
373 : Real64 m_LowSpeedEconRuntime = 0;
374 :
375 : Real64 m_HeatingCycRatio = 0.0;
376 : Real64 m_HeatingSpeedRatio = 0.0;
377 : int m_HeatingSpeedNum = 0;
378 : int m_SpeedNum = 0;
379 : Real64 m_SuppHeatingCycRatio = 0.0;
380 : Real64 m_SuppHeatingSpeedRatio = 0.0;
381 : int m_SuppHeatingSpeedNum = 0;
382 :
383 : bool m_EMSOverrideCoilSpeedNumOn = false;
384 : Real64 m_EMSOverrideCoilSpeedNumValue = 0.0;
385 : bool m_EMSOverrideSuppCoilSpeedNumOn = false;
386 : Real64 m_EMSOverrideSuppCoilSpeedNumValue = 0.0;
387 : int m_CoilSpeedErrIdx = 0;
388 :
389 : Real64 m_DehumidInducedHeatingDemandRate = 0.0;
390 :
391 : Real64 m_TotalAuxElecPower = 0.0;
392 : Real64 m_HeatingAuxElecConsumption = 0.0;
393 : Real64 m_CoolingAuxElecConsumption = 0.0;
394 : Real64 m_ElecPower = 0.0;
395 : Real64 m_ElecPowerConsumption = 0.0;
396 :
397 : int m_LastMode = 0;
398 : bool m_FirstPass = true;
399 :
400 : Real64 m_TotCoolEnergyRate = 0.0;
401 : Real64 m_TotCoolEnergy = 0.0;
402 : Real64 m_SensCoolEnergyRate = 0.0;
403 : Real64 m_SensCoolEnergy = 0.0;
404 : Real64 m_LatCoolEnergyRate = 0.0;
405 : Real64 m_LatCoolEnergy = 0.0;
406 : Real64 m_TotHeatEnergyRate = 0.0;
407 : Real64 m_TotHeatEnergy = 0.0;
408 : Real64 m_SensHeatEnergyRate = 0.0;
409 : Real64 m_SensHeatEnergy = 0.0;
410 : Real64 m_LatHeatEnergyRate = 0.0;
411 : Real64 m_LatHeatEnergy = 0.0;
412 :
413 : bool m_DesignFanVolFlowRateEMSOverrideOn = false; // If true, then EMS is calling to override autosize fan flow
414 : bool m_MaxHeatAirVolFlowEMSOverrideOn = false; // If true, then EMS is calling to override autosize fan flow
415 : bool m_MaxCoolAirVolFlowEMSOverrideOn = false; // If true, then EMS is calling to override autosize fan flow
416 : bool m_MaxNoCoolHeatAirVolFlowEMSOverrideOn = false; // If true, then EMS is calling to override autosize fan flow
417 : Real64 m_DesignFanVolFlowRateEMSOverrideValue = 0.0; // EMS value for override of fan flow rate autosize [m3/s]
418 : Real64 m_MaxHeatAirVolFlowEMSOverrideValue = 0.0; // EMS value for override of fan flow rate autosize [m3/s]
419 : Real64 m_MaxCoolAirVolFlowEMSOverrideValue = 0.0; // EMS value for override of fan flow rate autosize [m3/s]
420 : Real64 m_MaxNoCoolHeatAirVolFlowEMSOverrideValue = 0.0; // EMS value for override of fan flow rate autosize [m3/s]
421 : bool m_EMSOverrideSensZoneLoadRequest = false; // If true, then EMS is calling to override zone load
422 : bool m_EMSOverrideMoistZoneLoadRequest = false; // If true, then EMS is calling to override zone load
423 : Real64 m_EMSSensibleZoneLoadValue = 0.0; // Value EMS is directing to use
424 : Real64 m_EMSMoistureZoneLoadValue = 0.0; // Value EMS is directing to use
425 : // Staged thermostat control
426 : int m_StageNum = 0; // Stage number specified by staged thermostat
427 : bool m_Staged = false; // Using Staged thermostat
428 :
429 : Real64 m_HeatingFanSpeedRatio = 0.0;
430 : Real64 m_CoolingFanSpeedRatio = 0.0;
431 : Real64 m_NoHeatCoolSpeedRatio = 0.0;
432 : bool m_MyFanFlag = true;
433 : bool m_MyCheckFlag = true;
434 : Real64 m_SensibleLoadMet = 0.0;
435 : Real64 m_LatentLoadMet = 0.0;
436 : bool m_MyStagedFlag = false;
437 : Real64 m_SensibleLoadPredicted = 0.0;
438 : Real64 m_MoistureLoadPredicted = 0.0;
439 :
440 : // Fault model of coil SAT sensor
441 : bool m_FaultyCoilSATFlag = false; // True if the coil has SAT sensor fault
442 : int m_FaultyCoilSATIndex = 0; // Index of the fault object corresponding to the coil
443 : Real64 m_FaultyCoilSATOffset = 0.0; // Coil SAT sensor offset
444 :
445 : PackagedThermalStorageCoil::PTSCOperatingMode m_TESOpMode = PackagedThermalStorageCoil::PTSCOperatingMode::Invalid;
446 : bool m_initLoadBasedControlAirLoopPass = false;
447 : int m_airLoopPassCounter = 0;
448 : int m_airLoopReturnCounter = 0;
449 : bool m_FanCompNotSetYet = true;
450 : bool m_CoolCompNotSetYet = true;
451 : bool m_HeatCompNotSetYet = true;
452 : bool m_SuppCompNotSetYet = true;
453 : bool m_OKToPrintSizing = false;
454 : bool m_IsDXCoil = true;
455 : Real64 m_SmallLoadTolerance = 5.0; // watts
456 : bool m_TemperatureOffsetControlActive = false; // true if water-side economizer coil is active
457 : Real64 m_minAirToWaterTempOffset = 0.0; // coil entering air to entering water temp offset
458 :
459 : int m_HRcoolCoilFluidInletNode = 0;
460 : int m_HRcoolCoilAirInNode = 0;
461 : Real64 m_minWaterLoopTempForHR = 0.0; // water coil heat recovery loops
462 : bool m_waterSideEconomizerFlag = false; // user input to enable lockout with economizer
463 : bool m_WaterHRPlantLoopModel = false; // signifies water heat recovery loop for this CoilSystem
464 : std::array<int, 4> m_OAMixerNodes{0, 0, 0, 0};
465 : Real64 m_CoolOutAirVolFlow = 0.0;
466 : Real64 m_CoolOutAirMassFlow = 0.0;
467 : Real64 m_HeatOutAirVolFlow = 0.0;
468 : Real64 m_HeatOutAirMassFlow = 0.0;
469 : Real64 m_NoCoolHeatOutAirVolFlow = 0.0;
470 : Real64 m_NoCoolHeatOutAirMassFlow = 0.0;
471 : Real64 m_HeatConvTol = 0.001;
472 : Real64 m_CoolConvTol = 0.001;
473 : int m_HVACSizingIndex = -1;
474 : Avail::Status m_AvailStatus = Avail::Status::NoAction;
475 : bool m_IsZoneEquipment = false;
476 : bool m_ZoneCompFlag = true;
477 : std::string m_AvailManagerListName;
478 : int m_EquipCompNum = 0; // 1-based index of this parent type for specific equipment type processing
479 :
480 : public:
481 : // SZVAV variables
482 : DataZoneEquipment::ZoneEquipType zoneEquipType = DataZoneEquipment::ZoneEquipType::Invalid;
483 : SimAirServingZones::CompType AirloopEqType = SimAirServingZones::CompType::Invalid;
484 : int MaxIterIndex = 0;
485 : int RegulaFalsiFailedIndex = 0;
486 : int NodeNumOfControlledZone = 0;
487 : Real64 FanPartLoadRatio = 0.0;
488 : Real64 CoolCoilWaterFlowRatio = 0.0;
489 : Real64 HeatCoilWaterFlowRatio = 0.0;
490 : int ControlZoneNum = 0; // index of unit in ZoneEquipConfig
491 : int AirInNode = 0; // Parent inlet air node number
492 : int AirOutNode = 0; // Parent outlet air node number
493 : Real64 MaxCoolAirMassFlow = 0.0; // Maximum coil air mass flow for cooling [kg/s]
494 : Real64 MaxHeatAirMassFlow = 0.0; // Maximum coil air mass flow for heating [kg/s]
495 : Real64 MaxNoCoolHeatAirMassFlow = 0.0; // Maximum coil air mass flow for no cooling or heating [kg/s]
496 : Real64 DesignMinOutletTemp = 0.0; // DOAS DX Cooling or SZVAV coil outlet air minimum temperature [C]
497 : Real64 DesignMaxOutletTemp = 0.0; // Maximum supply air temperature from heating coil [C]
498 : Real64 LowSpeedCoolFanRatio = 0.0; // cooling mode ratio of low speed fan flow to full flow rate
499 : Real64 LowSpeedHeatFanRatio = 0.0; // heating mode ratio of low speed fan flow to full flow rate
500 : Real64 MaxCoolCoilFluidFlow = 0.0; // Maximum cooling coil fluid flow for chilled water coil
501 : Real64 MaxHeatCoilFluidFlow = 0.0; // Maximum heating coil fluid flow for hot water or steam coil
502 : int CoolCoilInletNodeNum = 0; // Cooling coil air inlet node number
503 : int CoolCoilOutletNodeNum = 0; // Cooling coil air outlet node number
504 : int CoolCoilFluidOutletNodeNum = 0; // Cooling coil fluid outlet node number (from Plant Loop data)
505 : PlantLocation CoolCoilPlantLoc; // Location of the cooling coil in the plant loop
506 : int CoolCoilFluidInletNode = 0; // Cooling coil fluid inlet node
507 : PlantLocation HeatCoilPlantLoc; // Location of the heating coil in the plant loop
508 : int HeatCoilFluidInletNode = 0; // Heating coil fluid inlet node
509 : int HeatCoilFluidOutletNodeNum = 0; // Heating coil fluid outlet node number (from Plant Loop data)
510 : int HeatCoilInletNodeNum = 0; // Heating coil air inlet node number
511 : int HeatCoilOutletNodeNum = 0; // Heating coil air outlet node number
512 : bool ATMixerExists = false; // true if AT mixer is connected to Unitary System
513 : HVAC::MixerType ATMixerType = HVAC::MixerType::Invalid; // type of AT mixer, inlet-side or supply-side
514 : int ATMixerOutNode = 0; // AT mixer outlet node number
515 : Real64 ControlZoneMassFlowFrac = 0.0; // fraction of air flow to the control zone
516 : DesignSpecMSHP *m_CompPointerMSHP = nullptr;
517 : std::string Name;
518 : std::string UnitType;
519 : Real64 LoadSHR = 0.0; // Load sensible heat ratio with humidity control
520 : Real64 CoilSHR = 0.0; // Load sensible heat ratio with humidity control
521 : int temperatureOffsetControlStatus = 0; // water side economizer status flag, also report variable
522 : int OAMixerIndex = -1; // index to zone equipment OA mixer
523 : int OASysIndex = -1; // index to OA system
524 : int OAControllerIndex = -1; // index to OA controller
525 : HVAC::EconomizerStagingType OAControllerEconomizerStagingType =
526 : HVAC::EconomizerStagingType::InterlockedWithMechanicalCooling; // economizer staging operation type
527 : bool OAMixerExists = false; // true if OA mixer is connected to inlet of UnitarySystem
528 :
529 : // private:
530 : // private members not initialized in constructor
531 : std::string m_FanName;
532 : std::string m_ATMixerName;
533 : std::string m_HeatingCoilName;
534 : std::string m_HeatingCoilTypeName;
535 : std::string m_CoolingCoilName;
536 : std::string m_SuppHeatCoilName;
537 : std::string m_SuppHeatCoilTypeName;
538 : std::string m_DesignSpecMultispeedHPType;
539 : std::string m_DesignSpecMultispeedHPName;
540 : std::vector<Real64> m_CoolVolumeFlowRate;
541 : std::vector<Real64> m_CoolMassFlowRate;
542 : std::vector<Real64> m_MSCoolingSpeedRatio;
543 : std::vector<Real64> m_HeatVolumeFlowRate;
544 : std::vector<Real64> m_HeatMassFlowRate;
545 : std::vector<Real64> m_MSHeatingSpeedRatio;
546 : std::vector<Real64> m_HeatingVolFlowRatio;
547 : std::vector<int> m_IterationMode; // array of operating mode each iteration
548 : std::vector<Real64> FullOutput; // Full output for different speed
549 : std::vector<Real64> FullLatOutput; // Full latent output for different speed
550 : std::vector<Real64> SpeedSHR; // SHR at different speed
551 :
552 : struct WarnMessages
553 : {
554 : // Warning message variables
555 : int m_HXAssistedSensPLRIter = 0; // used in HX Assisted calculations
556 : int m_HXAssistedSensPLRIterIndex = 0; // used in HX Assisted calculations
557 : int m_HXAssistedSensPLRFail = 0; // used in HX Assisted calculations
558 : int m_HXAssistedSensPLRFailIndex = 0; // used in HX Assisted calculations
559 : int m_HXAssistedSensPLRFail2 = 0; // used in HX Assisted calculations
560 : int m_HXAssistedSensPLRFailIndex2 = 0; // used in HX Assisted calculations
561 : int m_HXAssistedLatPLRIter = 0; // used in HX Assisted calculations
562 : int m_HXAssistedLatPLRIterIndex = 0; // used in HX Assisted calculations
563 : int m_HXAssistedLatPLRFail = 0; // used in HX Assisted calculations
564 : int m_HXAssistedLatPLRFailIndex = 0; // used in HX Assisted calculations
565 : int m_HXAssistedCRLatPLRIter = 0; // used in HX Assisted calculations
566 : int m_HXAssistedCRLatPLRIterIndex = 0; // used in HX Assisted calculations
567 : int m_HXAssistedCRLatPLRFail = 0; // used in HX Assisted calculations
568 : int m_HXAssistedCRLatPLRFailIndex = 0; // used in HX Assisted calculations
569 : int m_HXAssistedCRLatPLRFail2 = 0; // used in HX Assisted calculations
570 : int m_HXAssistedCRLatPLRFailIndex2 = 0; // used in HX Assisted calculations
571 : int m_SensPLRIter = 0; // used in cool coil calculations
572 : int m_SensPLRIterIndex = 0; // used in cool coil calculations
573 : int m_SensPLRFail = 0; // used in cool coil calculations
574 : int m_SensPLRFailIndex = 0; // used in cool coil calculations
575 : int m_LatPLRIter = 0; // used in cool coil calculations
576 : int m_LatPLRIterIndex = 0; // used in cool coil calculations
577 : int m_LatPLRFail = 0; // used in cool coil calculations
578 : int m_LatPLRFailIndex = 0; // used in cool coil calculations
579 : int m_HeatCoilSensPLRIter = 0; // used in heat coil calculations
580 : int m_HeatCoilSensPLRIterIndex = 0; // used in heat coil calculations
581 : int m_HeatCoilSensPLRFail = 0; // used in heat coil calculations
582 : int m_HeatCoilSensPLRFailIndex = 0; // used in heat coil calculations
583 : int m_SuppHeatCoilSensPLRIter = 0; // used in supp heat coil calculations
584 : int m_SuppHeatCoilSensPLRIterIndex = 0; // used in supp heat coil calculations
585 : int m_SuppHeatCoilSensPLRFail = 0; // used in supp heat coil calculations
586 : int m_SuppHeatCoilSensPLRFailIndex = 0; // used in supp heat coil calculations
587 : int m_LatMaxIterIndex = 0; // used in PLR calculations for moisture load
588 : int m_LatRegulaFalsiFailedIndex = 0; // used in PLR calculations for moisture load
589 : };
590 : WarnMessages warnIndex;
591 :
592 : static void getUnitarySystemInput(EnergyPlusData &state, std::string_view Name, bool const ZoneEquipment, int const ZoneOAUnitNum);
593 :
594 : void processInputSpec(EnergyPlusData &state,
595 : const UnitarySysInputSpec &input_data,
596 : int sysNum,
597 : bool &errorsFound,
598 : bool const ZoneEquipment,
599 : int const ZoneOAUnitNum);
600 :
601 : void setSystemParams(EnergyPlusData &state, Real64 &TotalFloorAreaOnAirLoop, const std::string &thisObjectName);
602 :
603 : static Real64 calcUnitarySystemLoadResidual(EnergyPlusData &state,
604 : Real64 const PartLoadRatio, // DX cooling coil part load ratio
605 : int UnitarySysNum,
606 : bool FirstHVACIteration,
607 : // par 3 not used?
608 : HVAC::CompressorOp compressorOp,
609 : Real64 LoadToBeMet,
610 : Real64 coolHeatFlag, // make bool?
611 : Real64 SensibleLoad,
612 : Real64 OnOffAirFlowRatio,
613 : bool HXUnitOn,
614 : // par 10 not used
615 : int AirLoopNum);
616 :
617 : static Real64 DXCoilVarSpeedResidual(EnergyPlusData &state,
618 : Real64 SpeedRatio, // compressor speed ratio (1.0 is max, 0.0 is min)
619 : int CoilIndex,
620 : Real64 DesOutTemp,
621 : int UnitarySysNum,
622 : Real64 CycRatio,
623 : int SpeedNum,
624 : HVAC::FanOp const fanOp,
625 : HVAC::CompressorOp CompressorOp);
626 :
627 : static Real64 heatingCoilVarSpeedResidual(EnergyPlusData &state,
628 : Real64 SpeedRatio, // compressor speed ratio (1.0 is max, 0.0 is min)
629 : int CoilIndex,
630 : Real64 DesOutTemp,
631 : int UnitarySysNum,
632 : Real64 CycRatio,
633 : int SpeedNum,
634 : HVAC::FanOp const fanOp,
635 : HVAC::CompressorOp compressorOp,
636 : bool SuppHeat);
637 :
638 : static Real64 DXCoilVarSpeedHumRatResidual(EnergyPlusData &state,
639 : Real64 SpeedRatio, // compressor speed ratio (1.0 is max, 0.0 is min)
640 : int CoilIndex,
641 : Real64 DesOutHumRat,
642 : int UnitarySysNum,
643 : Real64 CycRatio,
644 : int SpeedNum,
645 : HVAC::FanOp const fanOp,
646 : HVAC::CompressorOp CompressorOp);
647 :
648 : static Real64 DXCoilCyclingResidual(EnergyPlusData &state,
649 : Real64 CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
650 : int CoilIndex,
651 : Real64 DesOutTemp,
652 : int UnitarySysNum,
653 : Real64 SpeedRatio,
654 : int SpeedNum,
655 : HVAC::FanOp const fanOp,
656 : HVAC::CompressorOp compressorOp,
657 : int AirloopNum,
658 : bool FirstHVACIteration);
659 :
660 : static Real64 DXCoilCyclingHumRatResidual(EnergyPlusData &state,
661 : Real64 CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
662 : int CoilIndex,
663 : Real64 DesOutHumRat,
664 : int UnitarySysNum,
665 : Real64 SpeedRatio,
666 : int SpeedNum,
667 : HVAC::FanOp const fanOp,
668 : HVAC::CompressorOp CompressorOp);
669 :
670 : static Real64 heatingCoilVarSpeedCycResidual(EnergyPlusData &state,
671 : Real64 CycRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
672 : int CoilIndex,
673 : Real64 DesOutTemp,
674 : int UnitarySysNum,
675 : Real64 SpeedRatio,
676 : int SpeedNum,
677 : HVAC::FanOp const fanOp,
678 : HVAC::CompressorOp compressorOp,
679 : bool SuppHeat);
680 :
681 : static Real64 gasElecHeatingCoilResidual(EnergyPlusData &state,
682 : Real64 PartLoadFrac, // Compressor cycling ratio (1.0 is continuous, 0.0 is off)
683 : int UnitarySysNum,
684 : bool FirstHVACIteration,
685 : Real64 desTemp,
686 : bool SuppHeatingCoilFlag,
687 : HVAC::FanOp fanOp,
688 : Real64 HeatingLoadArg);
689 :
690 : static Real64 coolWatertoAirHPTempResidual(EnergyPlusData &state,
691 : Real64 PartLoadRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
692 : int UnitarySysNum,
693 : bool FirstHVACIteration,
694 : Real64 DesOutTemp,
695 : Real64 ReqOutput);
696 :
697 : void initUnitarySystems(EnergyPlusData &state, int AirLoopNum, bool FirstHVACIteration, Real64 const OAUCoilOutTemp);
698 :
699 : bool checkNodeSetPoint(EnergyPlusData &state,
700 : int const AirLoopNum, // number of the current air loop being simulated
701 : int const ControlNode, // Node to test for set point
702 : int const CoilType, // True if cooling coil, then test for HumRatMax set point
703 : Real64 const OAUCoilOutTemp // the coil inlet temperature of OutdoorAirUnit
704 : );
705 :
706 : void frostControlSetPointLimit(EnergyPlusData &state,
707 : Real64 &TempSetPoint, // temperature setpoint of the sensor node
708 : Real64 &HumRatSetPoint, // humidity ratio setpoint of the sensor node
709 : Real64 const BaroPress, // baromtric pressure, Pa [N/m^2]
710 : Real64 const TfrostControl, // minimum temperature limit for forst control
711 : int const ControlMode // temperature or humidity control mode
712 : );
713 :
714 : void reportUnitarySystem(EnergyPlusData &state, int const AirLoopNum);
715 :
716 : void unitarySystemHeatRecovery(EnergyPlusData &state);
717 :
718 : void controlUnitarySystemtoSP(EnergyPlusData &state,
719 : int const AirLoopNum, // Primary air loop number
720 : bool const FirstHVACIteration, // True when first HVAC iteration
721 : HVAC::CompressorOp &CompressorOn, // compressor on/off control
722 : Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
723 : bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
724 : Real64 &sysOutputProvided, // sensible output at supply air node
725 : Real64 &latOutputProvided // latent output at supply air node
726 : );
727 :
728 : void controlUnitarySystemtoLoad(EnergyPlusData &state,
729 : int const AirLoopNum, // Primary air loop number
730 : bool const FirstHVACIteration, // True when first HVAC iteration
731 : HVAC::CompressorOp &CompressorOn, // Determines if compressor is on or off
732 : Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
733 : bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
734 : Real64 &sysOutputProvied, // system sensible output at supply air node
735 : Real64 &latOutputProvided // system latent output at supply air node
736 : );
737 :
738 : void updateUnitarySystemControl(EnergyPlusData &state,
739 : int const AirLoopNum, // number of the current air loop being simulated
740 : int const OutNode, // coil outlet node number
741 : int const ControlNode, // control node number
742 : Real64 &OnOffAirFlowRatio,
743 : bool const FirstHVACIteration,
744 : Real64 const OAUCoilOutletTemp, // "ONLY" for zoneHVAC:OutdoorAirUnit
745 : Real64 &ZoneLoad,
746 : Real64 const MaxOutletTemp // limits heating coil outlet temp [C]
747 : );
748 : void controlUnitarySystemOutputEMS(EnergyPlusData &state,
749 : int const AirLoopNum, // Index to air loop
750 : bool const FirstHVACIteration, // True when first HVAC iteration
751 : Real64 &OnOffAirFlowRatio, // ratio of heating PLR to cooling PLR (is this correct?)
752 : Real64 const ZoneLoad,
753 : Real64 &FullSensibleOutput,
754 : bool &HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
755 : HVAC::CompressorOp CompressorOn);
756 :
757 : void controlUnitarySystemOutput(EnergyPlusData &state,
758 : int const AirLoopNum, // Index to air loop
759 : bool const FirstHVACIteration, // True when first HVAC iteration
760 : Real64 &OnOffAirFlowRatio, // ratio of heating PLR to cooling PLR (is this correct?)
761 : Real64 const ZoneLoad,
762 : Real64 &FullSensibleOutput,
763 : bool &HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
764 : HVAC::CompressorOp CompressorOn);
765 :
766 : void initLoadBasedControl(EnergyPlusData &state,
767 : int const AirLoopNum, // number of the current air loop being simulated
768 : bool const FirstHVACIteration,
769 : Real64 &OnOffAirFlowRatio,
770 : Real64 &ZoneLoad);
771 :
772 : void setOnOffMassFlowRate(EnergyPlusData &state,
773 : Real64 &OnOffAirFlowRatio, // ratio of coil on to coil off air flow rate
774 : Real64 const PartLoadRatio // coil part-load ratio
775 : );
776 :
777 : void setAverageAirFlow(EnergyPlusData &state,
778 : Real64 const PartLoadRatio, // unit part load ratio
779 : Real64 &OnOffAirFlowRatio // ratio of compressor ON airflow to AVERAGE airflow over timestep
780 : );
781 :
782 : void calcMultiStageSuppCoilStageByLoad(EnergyPlusData &state, Real64 const SuppHeatload, bool const FirstHVACIteration);
783 :
784 : void calculateCapacity(EnergyPlusData &state,
785 : Real64 &SensOutput, // sensible output of AirloopHVAC:UnitarySystem
786 : Real64 &LatOutput // latent output of AirloopHVAC:UnitarySystem
787 : );
788 :
789 : void calcUnitaryCoolingSystem(EnergyPlusData &state,
790 : int const AirLoopNum, // index to air loop
791 : bool const FirstHVACIteration, // True when first HVAC iteration
792 : Real64 const PartLoadRatio, // coil operating part-load ratio
793 : HVAC::CompressorOp CompressorOn, // compressor control (0=off, 1=on)
794 : Real64 const OnOffAirFlowRatio,
795 : Real64 const CoilCoolHeatRat, // ratio of cooling to heating PLR for cycling fan RH control
796 : bool const HXUnitOn // Flag to control HX for HXAssisted Cooling Coil
797 : );
798 :
799 : void calcUnitaryHeatingSystem(EnergyPlusData &state,
800 : int const AirLoopNum, // index to air loop
801 : bool const FirstHVACIteration, // True when first HVAC iteration
802 : Real64 const PartLoadRatio, // coil operating part-load ratio
803 : HVAC::CompressorOp CompressorOn, // comrpressor control (0=off, 1=on)
804 : Real64 const OnOffAirFlowRatio, // ratio of on to off flow rate
805 : Real64 HeatCoilLoad // adjusted heating coil load if outlet temp exceeds max (W)
806 : );
807 :
808 : void calcUnitarySuppHeatingSystem(EnergyPlusData &state,
809 : bool const FirstHVACIteration, // True when first HVAC iteration
810 : Real64 const SuppCoilLoad // adjusted supp coil load when outlet temp exceeds max (W)
811 : );
812 :
813 : void setEMSSuppCoilStagePLR(EnergyPlusData &state);
814 :
815 : void calcUnitarySuppSystemToSP(EnergyPlusData &state, bool const FirstHVACIteration // True when first HVAC iteration
816 : );
817 :
818 : void controlCoolingSystemToSP(EnergyPlusData &PartLoadFrac,
819 : int const AirLoopNum, // index to air loop
820 : bool const FirstHVACIteration, // First HVAC iteration flag
821 : bool &HXUnitOn, // flag to enable heat exchanger heat recovery
822 : HVAC::CompressorOp &CompressorOp // compressor on/off control
823 : );
824 :
825 : void controlHeatingSystemToSP(EnergyPlusData &maxPartLoadFrac,
826 : int const AirLoopNum, // index to air loop
827 : bool const FirstHVACIteration, // First HVAC iteration flag
828 : HVAC::CompressorOp &compressorOp, // compressor on/off control
829 : Real64 &HeatCoilLoad // load met by heating coil
830 : );
831 :
832 : void controlSuppHeatSystemToSP(EnergyPlusData &state,
833 : int const AirLoopNum, // index to air loop
834 : bool const FirstHVACIteration // First HVAC iteration flag
835 : );
836 :
837 : void simMultiSpeedCoils(EnergyPlusData &state,
838 : int const AirLoopNum, // Index to air loop
839 : bool const FirstHVACIteration, // True when first HVAC iteration
840 : HVAC::CompressorOp &CompressorOn, // compressor on/off control
841 : bool const SensibleLoad,
842 : bool const LatentLoad,
843 : Real64 const PartLoadFrac,
844 : int const CoilType,
845 : int const SpeedNumber);
846 :
847 : void calcPassiveSystem(EnergyPlusData &state,
848 : int const AirLoopNum, // Index to air loop
849 : bool const FirstHVACIteration // True when first HVAC iteration
850 : );
851 :
852 : void setSpeedVariables(EnergyPlusData &state,
853 : bool const SensibleLoad, // True when meeting a sensible load (not a moisture load)
854 : Real64 const PartLoadRatio // operating PLR
855 : );
856 :
857 : public:
858 : static void
859 : getUnitarySystemInputData(EnergyPlusData &state, std::string_view Name, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound);
860 :
861 : static void
862 : getDXCoilSystemData(EnergyPlusData &state, std::string_view Name, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound);
863 :
864 : static void getCoilWaterSystemInputData(
865 : EnergyPlusData &state, std::string_view CoilSysName, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound);
866 :
867 : static void getPackagedTerminalUnitData(
868 : EnergyPlusData &state, std::string_view Name, bool const ZoneEquipment, int const ZoneOAUnitNum, bool &errorsFound);
869 :
870 : static void allocateUnitarySys(EnergyPlusData &state);
871 :
872 : static HVACSystemData *factory(
873 : EnergyPlusData &state, HVAC::UnitarySysType const type, std::string const &objectName, bool const ZoneEquipment, int const ZoneOAUnitNum);
874 :
875 : void calcUnitarySystemToLoad(EnergyPlusData &state,
876 : int const AirLoopNum, // index to air loop
877 : bool const FirstHVACIteration, // True when first HVAC iteration
878 : Real64 const CoolPLR, // operating cooling part-load ratio []
879 : Real64 const HeatPLR, // operating cooling part-load ratio []
880 : Real64 &OnOffAirFlowRatio, // ratio of heating PLR to cooling PLR (is this correct?)
881 : Real64 &SensOutput, // sensible capacity (W)
882 : Real64 &LatOutput, // latent capacity (W)
883 : bool HXUnitOn, // Flag to control HX for HXAssisted Cooling Coil
884 : Real64 HeatCoilLoad, // Adjusted load to heating coil when SAT exceeds max limit (W)
885 : Real64 SuppCoilLoad, // Adjusted load to supp heating coil when SAT exceeds max limit (W)
886 : HVAC::CompressorOp const CompressorOn // Determines if compressor is on or off
887 : );
888 :
889 : static void checkUnitarySysCoilInOASysExists(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum);
890 :
891 : static void getUnitarySysHeatCoolCoil(EnergyPlusData &state,
892 : std::string_view UnitarySysName, // Name of Unitary System object
893 : bool &CoolingCoil, // Cooling coil exists
894 : bool &HeatingCoil, // Heating coil exists
895 : int const ZoneOAUnitNum // index to zone OA unit
896 : );
897 :
898 : static Real64 calcUnitarySystemWaterFlowResidual(EnergyPlusData &state,
899 : Real64 const PartLoadRatio, // coil part load ratio
900 : int UnitarySysNum,
901 : bool FirstHVACIteration,
902 : Real64 QZnReq,
903 : int AirControlNode,
904 : Real64 OnOffAirFlowRat,
905 : int AirLoopNum,
906 : int WaterControlNode,
907 : Real64 highWaterMdot,
908 : Real64 lowSpeedRatio,
909 : Real64 airMdot,
910 : Real64 par13_SATempTarget,
911 : Real64 systemMaxAirFlowRate,
912 : Real64 par15_LoadType,
913 : Real64 par16_IterationMethod);
914 :
915 : void simulate(EnergyPlusData &state,
916 : std::string_view Name,
917 : bool const firstHVACIteration,
918 : int AirLoopNum,
919 : int &CompIndex,
920 : bool &HeatActive,
921 : bool &CoolActive,
922 : int const OAUnitNum, // If the system is an equipment of OutdoorAirUnit
923 : Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
924 : bool const ZoneEquipment, // TRUE if called as zone equipment
925 : Real64 &sysOutputProvided, // sensible output at supply air node
926 : Real64 &latOutputProvided // latent output at supply air node
927 : ) override;
928 :
929 : Real64 getFanDeltaTemp(EnergyPlusData &state, bool const firstHVACIteration, Real64 const massFlowRate, Real64 const airFlowRatio);
930 :
931 : void setEconomizerStagingOperationSpeed(EnergyPlusData &state, bool const firstHVACIteration, Real64 const zoneLoad);
932 :
933 : void calcMixedTempAirSPforEconomizerStagingOperation(EnergyPlusData &state,
934 : int const airLoopNum,
935 : bool const firstHVACIteration,
936 : Real64 const zoneLoad);
937 :
938 : void manageEconomizerStagingOperation(EnergyPlusData &state, int const airLoopNum, bool const firstHVACIteration, Real64 const zoneLoad);
939 :
940 : void sizeSystem(EnergyPlusData &state, bool const FirstHVACIteration, int const AirLoopNum) override;
941 : int getAirInNode(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum, bool &errFlag) override;
942 : int getAirOutNode(EnergyPlusData &state, std::string_view UnitarySysName, int const ZoneOAUnitNum, bool &errFlag) override;
943 : int getAirOutletNode() override;
944 : int getMixerOANode() override;
945 : int getMixerMixNode() override;
946 : int getMixerRetNode() override;
947 : int getEquipIndex() override;
948 :
949 2268 : UnitarySys() = default;
950 3581 : ~UnitarySys() = default;
951 : };
952 :
953 : int getDesignSpecMSHPIndex(EnergyPlusData &state, std::string_view objectName);
954 : int getUnitarySystemIndex(EnergyPlusData &state, std::string_view objectName);
955 : bool getUnitarySystemNodeNumber(EnergyPlusData &state, int const nodeNumber);
956 :
957 : bool searchZoneInletNodes(EnergyPlusData &state, int nodeToFind, int &ZoneEquipConfigIndex, int &InletNodeIndex);
958 : bool searchZoneInletNodesByEquipmentIndex(EnergyPlusData &state, int nodeToFind, int zoneEquipmentIndex);
959 : bool searchZoneInletNodeAirLoopNum(EnergyPlusData &state, int airLoopNumToFind, int ZoneEquipConfigIndex, int &InletNodeIndex);
960 : bool searchExhaustNodes(EnergyPlusData &state, const int nodeToFind, int &ZoneEquipConfigIndex, int &ExhaustNodeIndex);
961 : bool searchTotalComponents(EnergyPlusData &state,
962 : SimAirServingZones::CompType compTypeToFind,
963 : std::string_view objectNameToFind,
964 : int &compIndex,
965 : int &branchIndex,
966 : int &airLoopIndex);
967 : void setupAllOutputVars(EnergyPlusData &state, int const numAllSystemTypes);
968 : void isWaterCoilHeatRecoveryType(EnergyPlusData const &state, int const waterCoilNodeNum, bool &nodeNotFound);
969 :
970 : int
971 : getZoneEqIndex(EnergyPlusData &state, std::string const &UnitarySysName, DataZoneEquipment::ZoneEquipType zoneEquipType, int const OAUnitNum = 0);
972 :
973 : } // namespace UnitarySystems
974 : struct UnitarySystemsData : BaseGlobalStruct
975 : {
976 :
977 : // MODULE PARAMETER DEFINITIONS
978 : int numUnitarySystems = 0;
979 : bool economizerFlag = false; // holds air loop economizer status
980 : bool SuppHeatingCoilFlag = false; // set to TRUE when simulating supplemental heating coil
981 : bool HeatingLoad = false; // True when zone needs heating
982 : bool CoolingLoad = false; // True when zone needs cooling
983 : Real64 MoistureLoad = 0.0; // Dehumidification Load (W)
984 : Real64 CompOnMassFlow = 0.0; // Supply air mass flow rate w/ compressor ON [kg/s]
985 : Real64 CompOffMassFlow = 0.0; // Supply air mass flow rate w/ compressor OFF [kg/s]
986 : Real64 OACompOnMassFlow = 0.0; // OA mass flow rate w/ compressor ON [kg/s]
987 : Real64 OACompOffMassFlow = 0.0; // OA mass flow rate w/ compressor OFF [kg/s]
988 :
989 : Real64 CompOnFlowRatio = 0.0; // fan flow ratio when coil on
990 : Real64 CompOffFlowRatio = 0.0; // fan flow ratio when coil off
991 : Real64 FanSpeedRatio = 0.0; // ratio of air flow ratio passed to fan object
992 : Real64 CoolHeatPLRRat = 1.0; // ratio of cooling to heating PLR, used for cycling fan RH control
993 : Real64 OnOffAirFlowRatioSave = 0.0; // Saves the OnOffAirFlowRatio calculated in RegulaFalsi calls.
994 : Real64 QToCoolSetPt = 0.0; // load to cooling set point {W}
995 : Real64 QToHeatSetPt = 0.0; // load to heating set point {W}
996 : Real64 m_massFlow1 = 0.0; // Mass flow rate in operating mode 1 (Compressor On) [kg/s]
997 : Real64 m_massFlow2 = 0.0; // Mass flow rate in operating mode 2 (Compressor Off) [kg/s]
998 : Real64 m_runTimeFraction1 = 0.0; // Fan runtime fraction in operating mode 1 (Compressor On)
999 : Real64 m_runTimeFraction2 = 0.0; // Fan runtime fraction in operating mode 2 (Compressor Off)
1000 :
1001 : bool initUnitarySystemsErrFlag = false;
1002 : bool initUnitarySystemsErrorsFound = false;
1003 : bool initLoadBasedControlFlowFracFlagReady = true;
1004 : Real64 initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = 0.0;
1005 : Real64 initUnitarySystemsQActual = 0.0;
1006 :
1007 : bool getInputOnceFlag = true;
1008 : bool getMSHPInputOnceFlag = true;
1009 :
1010 : std::vector<UnitarySystems::UnitarySys> unitarySys;
1011 : std::vector<UnitarySystems::DesignSpecMSHP> designSpecMSHP;
1012 :
1013 : bool getInputFlag = true;
1014 : bool setupOutputOnce = true;
1015 :
1016 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
1017 : {
1018 796 : }
1019 :
1020 0 : void clear_state() override
1021 : {
1022 0 : numUnitarySystems = 0;
1023 0 : HeatingLoad = false;
1024 0 : CoolingLoad = false;
1025 0 : MoistureLoad = 0.0;
1026 0 : SuppHeatingCoilFlag = false;
1027 0 : CompOnMassFlow = 0.0;
1028 0 : CompOffMassFlow = 0.0;
1029 0 : CompOnFlowRatio = 0.0;
1030 0 : CompOffFlowRatio = 0.0;
1031 0 : OACompOnMassFlow = 0.0;
1032 0 : OACompOffMassFlow = 0.0;
1033 0 : FanSpeedRatio = 0.0;
1034 0 : CoolHeatPLRRat = 1.0;
1035 0 : OnOffAirFlowRatioSave = 0.0;
1036 0 : QToCoolSetPt = 0.0;
1037 0 : QToHeatSetPt = 0.0;
1038 0 : m_massFlow1 = 0.0;
1039 0 : m_massFlow2 = 0.0;
1040 0 : m_runTimeFraction1 = 0.0;
1041 0 : m_runTimeFraction2 = 0.0;
1042 :
1043 0 : initUnitarySystemsErrFlag = false;
1044 0 : initUnitarySystemsErrorsFound = false;
1045 0 : initLoadBasedControlFlowFracFlagReady = true;
1046 0 : initLoadBasedControlCntrlZoneTerminalUnitMassFlowRateMax = 0.0;
1047 0 : initUnitarySystemsQActual = 0.0;
1048 0 : getMSHPInputOnceFlag = true;
1049 0 : getInputOnceFlag = true;
1050 0 : setupOutputOnce = true;
1051 0 : unitarySys.clear();
1052 0 : if (designSpecMSHP.size() > 0) designSpecMSHP.clear();
1053 0 : getInputFlag = true;
1054 0 : }
1055 :
1056 : // Default Constructor
1057 796 : UnitarySystemsData() = default;
1058 : };
1059 : } // namespace EnergyPlus
1060 : #endif // ENERGYPLUS_UNITARYSYSTEM_HH
|