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 WaterToAirHeatPump_hh_INCLUDED
49 : #define WaterToAirHeatPump_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/FluidProperties.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace WaterToAirHeatPump {
66 :
67 : enum class CompressorType
68 : {
69 : Invalid = -1,
70 : Reciprocating,
71 : Rotary,
72 : Scroll,
73 : Num
74 : };
75 :
76 : struct WatertoAirHPEquipConditions
77 : {
78 : // Members
79 : std::string Name; // Name of the Water to Air Heat pump
80 : std::string WatertoAirHPType; // Type of WatertoAirHP ie. Heating or Cooling
81 : DataPlant::PlantEquipmentType WAHPType; // type of component in plant
82 : std::string Refrigerant; // Refrigerant name
83 : Fluid::RefrigProps *refrig = nullptr;
84 : bool SimFlag;
85 : Real64 InletAirMassFlowRate; // Inlet Air Mass Flow through the Water to Air Heat Pump being Simulated [kg/s]
86 : Real64 OutletAirMassFlowRate; // Outlet Air Mass Flow through the Water to Air Heat Pump being Simulated [kg/s]
87 : Real64 InletAirDBTemp; // Inlet Air Dry Bulb Temperature [C]
88 : Real64 InletAirHumRat; // Inlet Air Humidity Ratio [kg/kg]
89 : Real64 OutletAirDBTemp; // Outlet Air Dry Bulb Temperature [C]
90 : Real64 OutletAirHumRat; // Outlet Air Humidity Ratio [kg/kg]
91 : Real64 InletAirEnthalpy; // Inlet Air Enthalpy [J/kg]
92 : Real64 OutletAirEnthalpy; // Outlet Air Enthalpy [J/kg]
93 : Real64 InletWaterTemp; // Inlet Water Temperature [C]
94 : Real64 OutletWaterTemp; // Outlet Water Temperature [C]
95 : Real64 InletWaterMassFlowRate; // Inlet Water Mass Flow Rate [kg/s]
96 : Real64 OutletWaterMassFlowRate; // Outlet Water Mass Flow Rate [kg/s]
97 : Real64 DesignWaterMassFlowRate; // Design Water Mass Flow Rate [kg/s]
98 : Real64 DesignWaterVolFlowRate; // Design Water Volumetric Flow Rate [m3/s]
99 : Real64 InletWaterEnthalpy; // Inlet Water Enthalpy [J/kg]
100 : Real64 OutletWaterEnthalpy; // Outlet Water Enthalpy [J/kg]
101 : Real64 Power; // Power Consumption [W]
102 : Real64 Energy; // Energy Consumption [J]
103 : Real64 QSensible; // Sensible Load Side Heat Transfer Rate [W]
104 : Real64 QLatent; // Latent Load Side Heat Transfer Rate [W]
105 : Real64 QSource; // Source Side Heat Transfer Rate [W]
106 : Real64 EnergySensible; // Sensible Load Side Heat Transferred [J]
107 : Real64 EnergyLatent; // Latent Load Side Heat Transferred [J]
108 : Real64 EnergySource; // Source Side Heat Transferred [J]
109 : Real64 RunFrac; // Duty Factor
110 : Real64 PartLoadRatio; // Part Load Ratio
111 : Real64 HeatingCapacity; // Nominal Heating Capacity
112 : Real64 CoolingCapacity; // Nominal Cooling Capacity
113 : Real64 QLoadTotal; // Load Side Total Heat Transfer Rate [W]
114 : Real64 EnergyLoadTotal; // Load Side Total Heat Transferred [J]
115 : Real64 Twet_Rated; // Nominal Time for Condensate Removal to Begin [s]
116 : Real64 Gamma_Rated; // Ratio of Initial Moisture Evaporation Rate and Steady-state Latent Capacity
117 : Real64 MaxONOFFCyclesperHour; // Maximum cycling rate of heat pump [cycles/hr]
118 : Real64 LatentCapacityTimeConstant; // Latent capacity time constant [s]
119 : Real64 FanDelayTime; // Fan delay time, time delay for the HP's fan to
120 : // shut off after compressor cycle off [s]
121 : Real64 SourceSideUACoeff; // Source Side Heat Transfer coefficient [W/C]
122 : Real64 LoadSideTotalUACoeff; // Load Side Total Heat Transfer coefficient [W/C]
123 : Real64 LoadSideOutsideUACoeff; // Load Side Outside Heat Transfer coefficient [W/C]
124 : Real64 CompPistonDisp; // Compressor Piston Displacement [m3/s]
125 : Real64 CompClearanceFactor; // Compressor Clearance Factor
126 : Real64 CompSucPressDrop; // Suction Pressure Drop [Pa]
127 : Real64 SuperheatTemp; // Superheat Temperature [C]
128 : Real64 PowerLosses; // Constant Part of the Compressor Power Losses [W]
129 : Real64 LossFactor; // Compressor Power Loss Factor
130 : Real64 RefVolFlowRate; // Refrigerant Volume Flow rate at the beginning
131 : // of the Compression [m3/s]
132 : Real64 VolumeRatio; // Built-in-volume ratio [~]
133 : Real64 LeakRateCoeff; // Coefficient for the relationship between
134 : // Pressure Ratio and Leakage Rate [~]
135 : Real64 SourceSideHTR1; // Source Side Heat Transfer Resistance coefficient 1 [~]
136 : Real64 SourceSideHTR2; // Source Side Heat Transfer Resistance coefficient 2 [k/kW]
137 : int PLFCurveIndex = 0; // Index of the Part Load Factor curve
138 : Real64 HighPressCutoff; // High Pressure Cut-off [Pa]
139 : Real64 LowPressCutoff; // Low Pressure Cut-off [Pa]
140 : CompressorType compressorType; // Type of Compressor ie. Reciprocating,Rotary or Scroll
141 : int AirInletNodeNum; // air side coil inlet node number
142 : int AirOutletNodeNum; // air side coil outlet node number
143 : int WaterInletNodeNum; // water side coil inlet node number
144 : int WaterOutletNodeNum; // water side coil outlet node number
145 : int LowPressClgError; // count for low pressure errors (cooling)
146 : int HighPressClgError; // count for high pressure errors (cooling)
147 : int LowPressHtgError; // count for low pressure errors (heating)
148 : int HighPressHtgError; // count for high pressure errors (heating)
149 : PlantLocation plantLoc;
150 :
151 : // Default Constructor
152 2 : WatertoAirHPEquipConditions()
153 6 : : WAHPType(DataPlant::PlantEquipmentType::Invalid), SimFlag(false), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0),
154 2 : InletAirDBTemp(0.0), InletAirHumRat(0.0), OutletAirDBTemp(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0),
155 2 : InletWaterTemp(0.0), OutletWaterTemp(0.0), InletWaterMassFlowRate(0.0), OutletWaterMassFlowRate(0.0), DesignWaterMassFlowRate(0.0),
156 2 : DesignWaterVolFlowRate(0.0), InletWaterEnthalpy(0.0), OutletWaterEnthalpy(0.0), Power(0.0), Energy(0.0), QSensible(0.0), QLatent(0.0),
157 2 : QSource(0.0), EnergySensible(0.0), EnergyLatent(0.0), EnergySource(0.0), RunFrac(0.0), PartLoadRatio(0.0), HeatingCapacity(0.0),
158 2 : CoolingCapacity(0.0), QLoadTotal(0.0), EnergyLoadTotal(0.0), Twet_Rated(0.0), Gamma_Rated(0.0), MaxONOFFCyclesperHour(0.0),
159 2 : LatentCapacityTimeConstant(0.0), FanDelayTime(0.0), SourceSideUACoeff(0.0), LoadSideTotalUACoeff(0.0), LoadSideOutsideUACoeff(0.0),
160 2 : CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), PowerLosses(0.0), LossFactor(0.0),
161 2 : RefVolFlowRate(0.0), VolumeRatio(0.0), LeakRateCoeff(0.0), SourceSideHTR1(0.0), SourceSideHTR2(0.0), HighPressCutoff(0.0),
162 2 : LowPressCutoff(0.0), compressorType(CompressorType::Invalid), AirInletNodeNum(0), AirOutletNodeNum(0), WaterInletNodeNum(0),
163 2 : WaterOutletNodeNum(0), LowPressClgError(0), HighPressClgError(0), LowPressHtgError(0), HighPressHtgError(0), plantLoc{}
164 : {
165 2 : }
166 : };
167 :
168 : // Functions
169 :
170 : void SimWatertoAirHP(EnergyPlusData &state,
171 : std::string_view CompName, // component name
172 : int &CompIndex, // Index for Component name
173 : Real64 const DesignAirflow, // design air flow rate
174 : HVAC::FanOp const fanOp, // cycling scheme--either continuous fan/cycling compressor or
175 : bool const FirstHVACIteration, // first iteration flag
176 : bool const InitFlag, // initialization flag used to suppress property routine errors
177 : Real64 const SensLoad, // sensible load
178 : Real64 const LatentLoad, // latent load
179 : HVAC::CompressorOp compressorOp,
180 : Real64 const PartLoadRatio);
181 :
182 : void GetWatertoAirHPInput(EnergyPlusData &state);
183 :
184 : void InitWatertoAirHP(EnergyPlusData &state,
185 : int const HPNum, // index to main heat pump data structure
186 : bool const InitFlag,
187 : Real64 const SensLoad,
188 : Real64 const LatentLoad,
189 : Real64 const DesignAirFlow,
190 : Real64 const PartLoadRatio);
191 :
192 : void CalcWatertoAirHPCooling(EnergyPlusData &state,
193 : int const HPNum, // heat pump number
194 : HVAC::FanOp const fanOp, // fan/compressor cycling scheme indicator
195 : bool const FirstHVACIteration, // first iteration flag
196 : bool const InitFlag, // suppress property errors if true
197 : Real64 const SensDemand,
198 : HVAC::CompressorOp compressorOp,
199 : Real64 const PartLoadRatio);
200 :
201 : void CalcWatertoAirHPHeating(EnergyPlusData &state,
202 : int const HPNum, // heat pump number
203 : HVAC::FanOp const fanOp, // fan/compressor cycling scheme indicator
204 : bool const FirstHVACIteration, // first iteration flag
205 : bool const InitFlag, // first iteration flag
206 : Real64 const SensDemand,
207 : HVAC::CompressorOp compressorOp,
208 : Real64 const PartLoadRatio);
209 :
210 : void UpdateWatertoAirHP(EnergyPlusData &state, int const HPNum);
211 :
212 : Real64 CalcEffectiveSHR(EnergyPlusData &state,
213 : int const HPNum, // Index number for cooling coil
214 : Real64 const SHRss, // Steady-state sensible heat ratio
215 : HVAC::FanOp const fanOp, // fan/compressor cycling scheme indicator
216 : Real64 const RTF, // Compressor run-time fraction
217 : Real64 const QLatRated, // Rated latent capacity
218 : Real64 const QLatActual, // Actual latent capacity
219 : Real64 const EnteringDB, // Entering air dry-bulb temperature
220 : Real64 const EnteringWB // Entering air wet-bulb temperature
221 : );
222 :
223 : Real64 DegradF(EnergyPlusData &state,
224 : Fluid::GlycolProps *glycol,
225 : Real64 &Temp // Temperature of the fluid
226 : );
227 :
228 : int GetCoilIndex(EnergyPlusData &state,
229 : std::string const &CoilType, // must match coil types in this module
230 : std::string const &CoilName, // must match coil names for the coil type
231 : bool &ErrorsFound // set to true if problem
232 : );
233 :
234 : Real64 GetCoilCapacity(EnergyPlusData &state,
235 : std::string const &CoilType, // must match coil types in this module
236 : std::string const &CoilName, // must match coil names for the coil type
237 : bool &ErrorsFound // set to true if problem
238 : );
239 :
240 : int GetCoilInletNode(EnergyPlusData &state,
241 : std::string const &CoilType, // must match coil types in this module
242 : std::string const &CoilName, // must match coil names for the coil type
243 : bool &ErrorsFound // set to true if problem
244 : );
245 :
246 : int GetCoilOutletNode(EnergyPlusData &state,
247 : std::string const &CoilType, // must match coil types in this module
248 : std::string const &CoilName, // must match coil names for the coil type
249 : bool &ErrorsFound // set to true if problem
250 : );
251 :
252 : } // namespace WaterToAirHeatPump
253 :
254 : struct WaterToAirHeatPumpData : BaseGlobalStruct
255 : {
256 :
257 : int NumWatertoAirHPs; // The Number of Water to Air Heat Pumps found in the Input
258 : Array1D_bool CheckEquipName;
259 :
260 : bool GetCoilsInputFlag; // Flag set to make sure you get input once
261 : bool MyOneTimeFlag;
262 : bool firstTime;
263 :
264 : Array1D<WaterToAirHeatPump::WatertoAirHPEquipConditions> WatertoAirHP;
265 :
266 : Real64 initialQSource = 0.0; // Guess Source Side Heat Transfer Rate [W]
267 : Real64 initialQLoad = 0.0; // Guess Load Side Heat Transfer rate [W]
268 :
269 : Array1D_bool MyPlantScanFlag;
270 : Array1D_bool MyEnvrnFlag;
271 :
272 : Real64 initialQSource_calc = 0.0; // Guess Source Side Heat Transfer Rate [W]
273 : Real64 initialQLoadTotal_calc = 0.0; // Guess Load Side Heat Transfer rate [W]
274 :
275 : Real64 CompSuctionTemp = 0.0; // Temperature of the Refrigerant Entering the Compressor [C]
276 :
277 : Real64 LoadSideInletDBTemp_Init = 0.0; // rated conditions
278 : Real64 LoadSideInletHumRat_Init = 0.0; // rated conditions
279 : Real64 LoadSideAirInletEnth_Init = 0.0; // rated conditions
280 :
281 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
282 : {
283 2126 : }
284 :
285 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
286 : {
287 1152 : }
288 :
289 2100 : void clear_state() override
290 : {
291 2100 : this->NumWatertoAirHPs = 0;
292 2100 : this->CheckEquipName.clear();
293 2100 : this->GetCoilsInputFlag = true;
294 2100 : this->MyOneTimeFlag = true;
295 2100 : this->firstTime = true;
296 2100 : this->WatertoAirHP.clear();
297 2100 : this->initialQSource = 0.0;
298 2100 : this->initialQLoad = 0.0;
299 2100 : this->MyPlantScanFlag.deallocate();
300 2100 : this->MyEnvrnFlag.deallocate();
301 2100 : this->initialQSource_calc = 0.0;
302 2100 : this->initialQLoadTotal_calc = 0.0;
303 2100 : this->CompSuctionTemp = 0.0;
304 2100 : this->LoadSideInletDBTemp_Init = 0.0;
305 2100 : this->LoadSideInletHumRat_Init = 0.0;
306 2100 : this->LoadSideAirInletEnth_Init = 0.0;
307 2100 : }
308 :
309 : // Default Constructor
310 2129 : WaterToAirHeatPumpData() : NumWatertoAirHPs(0), GetCoilsInputFlag(true), MyOneTimeFlag(true), firstTime(true)
311 : {
312 2129 : }
313 : };
314 :
315 : } // namespace EnergyPlus
316 :
317 : #endif
|