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 WaterToAirHeatPumpSimple_hh_INCLUDED
49 : #define WaterToAirHeatPumpSimple_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/DataHVACGlobals.hh>
59 : #include <EnergyPlus/EnergyPlus.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace Curve {
67 : struct Curve;
68 : }
69 :
70 : namespace WaterToAirHeatPumpSimple {
71 :
72 : enum class WatertoAirHP
73 : {
74 : Invalid = -1,
75 : Heating,
76 : Cooling,
77 : Num
78 : };
79 :
80 : struct SimpleWatertoAirHPConditions
81 : {
82 : // Members
83 : std::string Name; // Name of the Water to Air Heat pump
84 : WatertoAirHP WAHPType = WatertoAirHP::Invalid; // Type of WatertoAirHP ie. Heating or Cooling
85 : DataPlant::PlantEquipmentType WAHPPlantType = DataPlant::PlantEquipmentType::Invalid; // type of component in plant
86 : bool SimFlag = false; // Heat Pump Simulation Flag
87 : Real64 AirVolFlowRate = 0.0; // Air Volumetric Flow Rate[m3/s]
88 : Real64 AirMassFlowRate = 0.0; // Air Mass Flow Rate[kg/s]
89 : Real64 InletAirDBTemp = 0.0; // Inlet Air Dry Bulb Temperature [C]
90 : Real64 InletAirHumRat = 0.0; // Inlet Air Humidity Ratio [kg/kg]
91 : Real64 InletAirEnthalpy = 0.0; // Inlet Air Enthalpy [J/kg]
92 : Real64 OutletAirDBTemp = 0.0; // Outlet Air Dry Bulb Temperature [C]
93 : Real64 OutletAirHumRat = 0.0; // Outlet Air Humidity Ratio [kg/kg]
94 : Real64 OutletAirEnthalpy = 0.0; // Outlet Air Enthalpy [J/kg]
95 : Real64 WaterVolFlowRate = 0.0; // Water Volumetric Flow Rate [m3/s]
96 : Real64 WaterMassFlowRate = 0.0; // Water Mass Flow Rate [kg/s]
97 : Real64 DesignWaterMassFlowRate = 0.0;
98 : Real64 InletWaterTemp = 0.0; // Inlet Water Temperature [C]
99 : Real64 InletWaterEnthalpy = 0.0; // Inlet Water Enthalpy [J/kg]
100 : Real64 OutletWaterTemp = 0.0; // Outlet Water Temperature [C]
101 : Real64 OutletWaterEnthalpy = 0.0; // Outlet Water Enthalpy [J/kg]
102 : Real64 Power = 0.0; // Power Consumption [W]
103 : Real64 QLoadTotal = 0.0; // Load Side Total Heat Transfer Rate [W]
104 : Real64 QLoadTotalReport = 0.0; // Load side total heat transfer rate for reporting[W]
105 : Real64 QSensible = 0.0; // Sensible Load Side Heat Transfer Rate [W]
106 : Real64 QLatent = 0.0; // Latent Load Side Heat Transfer Rate [W]
107 : Real64 QSource = 0.0; // Source Side Heat Transfer Rate [W]
108 : Real64 Energy = 0.0; // Energy Consumption [J]
109 : Real64 EnergyLoadTotal = 0.0; // Load Side Total Heat Transferred [J]
110 : Real64 EnergySensible = 0.0; // Sensible Load Side Heat Transferred [J]
111 : Real64 EnergyLatent = 0.0; // Latent Load Side Heat Transferred [J]
112 : Real64 EnergySource = 0.0; // Source Side Heat Transferred [J]
113 : Real64 COP = 0.0; // Heat Pump Coefficient of Performance [-]
114 : Real64 RunFrac = 0.0; // Duty Factor
115 : Real64 PartLoadRatio = 0.0; // Part Load Ratio
116 : Real64 RatedWaterVolFlowRate = 0.0; // Rated Water Volumetric Flow Rate [m3/s]
117 : Real64 RatedAirVolFlowRate = 0.0; // Rated Air Volumetric Flow Rate [m3/s]
118 : Real64 RatedCapHeat = 0.0; // Rated Heating Capacity [W]
119 : Real64 RatedCapHeatAtRatedCdts = 0.0; // Rated Heating Capacity at Rated Conditions [W]
120 : Real64 RatedCapCoolAtRatedCdts = 0.0; // Rated Cooling Capacity at Rated Conditions [W]
121 : Real64 RatedCapCoolSensDesAtRatedCdts = 0.0; // Rated Sensible Capacity at Rated Conditions [W]
122 : Real64 RatedPowerHeat = 0.0; // Rated Heating Power Consumption [W]
123 : Real64 RatedPowerHeatAtRatedCdts = 0.0; // Rated Heating Power Consumption at Rated Conditions[W]
124 : Real64 RatedCOPHeatAtRatedCdts = 0.0; // Rated Heating COP at Rated Conditions [W/w]
125 : Real64 RatedCapCoolTotal = 0.0; // Rated Total Cooling Capacity [W]
126 : Real64 RatedCapCoolSens = 0.0; // Rated Sensible Cooling Capacity [W]
127 : Real64 RatedPowerCool = 0.0; // Rated Cooling Power Consumption[W]
128 : Real64 RatedPowerCoolAtRatedCdts = 0.0; // Rated Cooling Power Consumption at Rated Conditions [W]
129 : Real64 RatedCOPCoolAtRatedCdts = 0.0; // Rated Cooling COP at Rated Conditions [W/W]
130 : Real64 RatedEntWaterTemp = 0.0; // Rated Entering Water Temperature [C]
131 : Real64 RatedEntAirWetbulbTemp = 0.0; // Rated Entering Air Wetbulb Temperature [C]
132 : Real64 RatedEntAirDrybulbTemp = 0.0; // Rated Entering Air Drybulb Temperature [C]
133 : Real64 RatioRatedHeatRatedTotCoolCap = 0.0; // Ratio of Rated Heating Capacity to Rated Cooling Capacity [-]
134 : Curve::Curve *HeatCapCurve = nullptr; // Index of the heating capacity performance curve
135 : Curve::Curve *HeatPowCurve = nullptr; // Index of the heating power consumption curve
136 : Curve::Curve *TotalCoolCapCurve = nullptr; // Index of the Total Cooling capacity performance curve
137 : Curve::Curve *SensCoolCapCurve = nullptr; // Index of the Sensible Cooling capacity performance curve
138 : Curve::Curve *CoolPowCurve = nullptr; // Index of the Cooling power consumption curve
139 : Curve::Curve *PLFCurve = nullptr; // Index of the Part Load Factor curve
140 : int AirInletNodeNum = 0; // Node Number of the Air Inlet
141 : int AirOutletNodeNum = 0; // Node Number of the Air Outlet
142 : int WaterInletNodeNum = 0; // Node Number of the Water Onlet
143 : int WaterOutletNodeNum = 0; // Node Number of the Water Outlet
144 : PlantLocation plantLoc;
145 : HVAC::WaterFlow WaterCyclingMode = HVAC::WaterFlow::Invalid; // Heat Pump Coil water flow mode; See definitions in DataHVACGlobals,
146 : // 1=water cycling, 2=water constant, 3=water constant on demand (old mode)
147 : int LastOperatingMode = 0; // type of coil calling for water flow, either heating or cooling,
148 : // start it at 1 so there will be water flow from the start,
149 : // even if there is no load.
150 : // Gets updated only during the first iteration of each timestep
151 : bool WaterFlowMode = false; // whether the water flow through the coil is called
152 : // because there is a load on the coil, or not.
153 : // Gets updated each iteration
154 : // set by parent object and "pushed" to this structure in SetSimpleWSHPData subroutine
155 : int CompanionCoolingCoilNum = 0; // Heating coil companion cooling coil index
156 : int CompanionHeatingCoilNum = 0; // Cooling coil companion heating coil index
157 : Real64 Twet_Rated = 0.0; // Nominal Time for Condensate Removal to Begin [s]
158 : Real64 Gamma_Rated = 0.0; // Ratio of Initial Moisture Evaporation Rate
159 : // and Steady-state Latent Capacity
160 : Real64 MaxONOFFCyclesperHour = 0.0; // Maximum cycling rate of heat pump [cycles/hr]
161 : Real64 LatentCapacityTimeConstant = 0.0; // Latent capcacity time constant [s]
162 : Real64 FanDelayTime = 0.0; // Fan delay time, time delay for the HP's fan to
163 : bool reportCoilFinalSizes = true; // one time report of sizes to coil report
164 : };
165 :
166 : void SimWatertoAirHPSimple(EnergyPlusData &state,
167 : std::string_view CompName, // Coil Name
168 : int &CompIndex, // Index for Component name
169 : Real64 const SensLoad, // Sensible demand load [W]
170 : Real64 const LatentLoad, // Latent demand load [W]
171 : HVAC::FanOp const fanOp, // Continuous fan OR cycling compressor
172 : HVAC::CompressorOp compressorOp,
173 : Real64 const PartLoadRatio,
174 : bool const FirstHVACIteration,
175 : Real64 const OnOffAirFlowRat = 1.0 // ratio of comp on to comp off air flow rate
176 : );
177 :
178 : // MODULE SUBROUTINES:
179 : //*************************************************************************
180 :
181 : void GetSimpleWatertoAirHPInput(EnergyPlusData &state);
182 :
183 : // Beginning Initialization Section of the Module
184 : //******************************************************************************
185 :
186 : void InitSimpleWatertoAirHP(EnergyPlusData &state,
187 : int const HPNum, // Current HPNum under simulation
188 : Real64 const SensLoad, // Control zone sensible load[W]
189 : Real64 const LatentLoad, // Control zone latent load[W]
190 : HVAC::FanOp const fanOp, // fan operating mode
191 : Real64 const OnOffAirFlowRatio, // ratio of compressor on flow to average flow over time step
192 : bool const FirstHVACIteration // Iteration flag
193 : );
194 :
195 : void SizeHVACWaterToAir(EnergyPlusData &state, int const HPNum);
196 :
197 : void CalcHPCoolingSimple(EnergyPlusData &state,
198 : int const HPNum, // Heat Pump Number
199 : HVAC::FanOp const fanOp, // Fan/Compressor cycling scheme indicator
200 : Real64 const SensDemand, // Cooling Sensible Demand [W] !unused1208
201 : Real64 const LatentDemand, // Cooling Latent Demand [W]
202 : HVAC::CompressorOp compressorOp, // compressor operation flag
203 : Real64 const PartLoadRatio, // compressor part load ratio
204 : Real64 const OnOffAirFlowRatio // ratio of compressor on flow to average flow over time step
205 : );
206 :
207 : void CalcHPHeatingSimple(EnergyPlusData &state,
208 : int const HPNum, // Heat Pump Number
209 : HVAC::FanOp const fanOp, // Fan/Compressor cycling scheme indicator
210 : Real64 const SensDemand, // Cooling Sensible Demand [W] !unused1208
211 : HVAC::CompressorOp compressorOp, // compressor operation flag
212 : Real64 const PartLoadRatio, // compressor part load ratio
213 : Real64 const OnOffAirFlowRatio // ratio of compressor on flow to average flow over time step
214 : );
215 :
216 : void UpdateSimpleWatertoAirHP(EnergyPlusData &state, int const HPNum);
217 :
218 : // End of Update subroutines for the WatertoAirHP Module
219 : // *****************************************************************************
220 :
221 : Real64 CalcEffectiveSHR(EnergyPlusData &state,
222 : int const HPNum, // Index number for cooling coil
223 : Real64 const SHRss, // Steady-state sensible heat ratio
224 : HVAC::FanOp const fanOp, // Fan/compressor cycling scheme indicator
225 : Real64 const RTF, // Compressor run-time fraction
226 : Real64 const QLatRated, // Rated latent capacity
227 : Real64 const QLatActual, // Actual latent capacity
228 : Real64 const EnteringDB, // Entering air dry-bulb temperature
229 : Real64 const EnteringWB // Entering air wet-bulb temperature
230 : );
231 :
232 : int GetCoilIndex(EnergyPlusData &state,
233 : std::string const &CoilType, // must match coil types in this module
234 : std::string const &CoilName, // must match coil names for the coil type
235 : bool &ErrorsFound // set to true if problem
236 : );
237 :
238 : Real64 GetCoilCapacity(EnergyPlusData &state,
239 : std::string const &CoilType, // must match coil types in this module
240 : std::string const &CoilName, // must match coil names for the coil type
241 : bool &ErrorsFound // set to true if problem
242 : );
243 :
244 : Real64 GetCoilAirFlowRate(EnergyPlusData &state,
245 : std::string const &CoilType, // must match coil types in this module
246 : std::string const &CoilName, // must match coil names for the coil type
247 : bool &ErrorsFound // set to true if problem
248 : );
249 :
250 : int GetCoilInletNode(EnergyPlusData &state,
251 : std::string const &CoilType, // must match coil types in this module
252 : std::string const &CoilName, // must match coil names for the coil type
253 : bool &ErrorsFound // set to true if problem
254 : );
255 :
256 : int GetCoilOutletNode(EnergyPlusData &state,
257 : std::string const &CoilType, // must match coil types in this module
258 : std::string const &CoilName, // must match coil names for the coil type
259 : bool &ErrorsFound // set to true if problem
260 : );
261 :
262 : void SetSimpleWSHPData(EnergyPlusData &state,
263 : int const SimpleWSHPNum, // Number of OA Controller
264 : bool &ErrorsFound, // Set to true if certain errors found
265 : HVAC::WaterFlow const waterCyclingMode, // the coil water flow mode (cycling, constant or constantondemand)
266 : ObjexxFCL::Optional_int CompanionCoolingCoilNum = _, // Index to cooling coil for heating coil = SimpleWSHPNum
267 : ObjexxFCL::Optional_int CompanionHeatingCoilNum = _ // Index to heating coil for cooling coil = SimpleWSHPNum
268 : );
269 :
270 : void CheckSimpleWAHPRatedCurvesOutputs(EnergyPlusData &state,
271 : std::string const &CoilName // must match coil names for the coil type
272 : );
273 :
274 : } // namespace WaterToAirHeatPumpSimple
275 :
276 : struct WaterToAirHeatPumpSimpleData : BaseGlobalStruct
277 : {
278 :
279 : Real64 const CelsiustoKelvin; // Conversion from Celsius to Kelvin
280 :
281 : int NumWatertoAirHPs; // The Number of Water to Air Heat Pumps found in the Input
282 : // INTEGER :: WaterIndex = 0 ! Water index
283 : // INTEGER :: Count = 0
284 : int AirflowErrPointer;
285 : bool GetCoilsInputFlag; // Flag set to make sure you get input once
286 : Array1D_bool MySizeFlag;
287 : Array1D_bool SimpleHPTimeStepFlag; // determines whether the previous operating mode for the coil and it's partner has been initialized
288 :
289 : Real64 SourceSideMassFlowRate; // Source Side Mass flow rate [Kg/s]
290 : Real64 SourceSideInletTemp; // Source Side Inlet Temperature [C]
291 : Real64 SourceSideInletEnth; // Source Side Inlet Enthalpy [J/kg]
292 : Real64 LoadSideInletDBTemp; // Load Side Inlet Dry Bulb Temp [C]
293 : Real64 LoadSideInletWBTemp; // Load Side Inlet Wet Bulb Temp [C]
294 : Real64 LoadSideInletHumRat; // Load Side Outlet Humidity ratio
295 : Real64 LoadSideInletEnth; // Load Side Inlet Enthalpy [J/kg]
296 : Real64 LoadSideOutletDBTemp; // Load Side Outlet Dry Bulb Temp [C]
297 : Real64 LoadSideOutletHumRat; // Load Side Outlet Humidity ratio
298 : Real64 QLatRated; // Latent Capacity [W] rated at entering air conditions [Tdb=26.7C Twb=19.4C]
299 : Real64 QLatActual; // Actual Latent Capacity [W]
300 : Real64 Winput; // Power Consumption [W]
301 : bool MyOneTimeFlag = true; // one time allocation flag
302 : bool firstTime = true;
303 :
304 : Array1D<WaterToAirHeatPumpSimple::SimpleWatertoAirHPConditions> SimpleWatertoAirHP;
305 :
306 : Array1D_bool MyEnvrnFlag; // used for initializations each begin environment flag
307 : Array1D_bool MyPlantScanFlag;
308 :
309 : Real64 LoadSideInletDBTemp_Init = 0; // rated conditions
310 : Real64 LoadSideInletWBTemp_Init = 0; // rated conditions
311 : Real64 LoadSideInletHumRat_Init = 0; // rated conditions
312 : Real64 LoadSideInletEnth_Init = 0; // rated conditions
313 : Real64 CpAir_Init = 0; // rated conditions
314 :
315 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
316 : {
317 2126 : }
318 :
319 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
320 : {
321 1152 : }
322 :
323 2100 : void clear_state() override
324 : {
325 2100 : this->NumWatertoAirHPs = 0;
326 2100 : this->AirflowErrPointer = 0;
327 2100 : this->MyOneTimeFlag = true;
328 2100 : this->GetCoilsInputFlag = true;
329 2100 : this->MySizeFlag.clear();
330 2100 : this->SimpleHPTimeStepFlag.clear();
331 2100 : this->SimpleWatertoAirHP.deallocate();
332 2100 : this->firstTime = true;
333 2100 : this->MyEnvrnFlag.deallocate();
334 2100 : this->MyPlantScanFlag.deallocate();
335 2100 : this->LoadSideInletDBTemp_Init = 0;
336 2100 : this->LoadSideInletWBTemp_Init = 0;
337 2100 : this->LoadSideInletHumRat_Init = 0;
338 2100 : this->LoadSideInletEnth_Init = 0;
339 2100 : this->CpAir_Init = 0;
340 2100 : }
341 :
342 : // Default Constructor
343 2129 : WaterToAirHeatPumpSimpleData()
344 6387 : : CelsiustoKelvin(Constant::Kelvin), NumWatertoAirHPs(0), AirflowErrPointer(0), GetCoilsInputFlag(true), SourceSideMassFlowRate(0.0),
345 2129 : SourceSideInletTemp(0.0), SourceSideInletEnth(0.0), LoadSideInletDBTemp(0.0), LoadSideInletWBTemp(0.0), LoadSideInletHumRat(0.0),
346 2129 : LoadSideInletEnth(0.0), LoadSideOutletDBTemp(0.0), LoadSideOutletHumRat(0.0), QLatRated(0.0), QLatActual(0.0), Winput(0.0),
347 2129 : MyOneTimeFlag(true), firstTime(true)
348 : {
349 2129 : }
350 : };
351 :
352 : } // namespace EnergyPlus
353 :
354 : #endif
|