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