Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, 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 566 : 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 AirInletNodeNum = 0; // Node Number of the Air Inlet
136 : int AirOutletNodeNum = 0; // Node Number of the Air Outlet
137 : int WaterInletNodeNum = 0; // Node Number of the Water Onlet
138 : int WaterOutletNodeNum = 0; // Node Number of the Water Outlet
139 : PlantLocation plantLoc;
140 : int WaterCyclingMode = 0; // Heat Pump Coil water flow mode; See definitions in DataHVACGlobals,
141 : // 1=water cycling, 2=water constant, 3=water constant on demand (old mode)
142 : int LastOperatingMode = DataHVACGlobals::WaterCycling; // type of coil calling for water flow, either heating or cooling,
143 : // start it at 1 so there will be water flow from the start,
144 : // even if there is no load.
145 : // Gets updated only during the first iteration of each timestep
146 : bool WaterFlowMode = false; // whether the water flow through the coil is called
147 : // because there is a load on the coil, or not.
148 : // Gets updated each iteration
149 : // set by parent object and "pushed" to this structure in SetSimpleWSHPData subroutine
150 : int CompanionCoolingCoilNum = 0; // Heating coil companion cooling coil index
151 : int CompanionHeatingCoilNum = 0; // Cooling coil companion heating coil index
152 : Real64 Twet_Rated = 0.0; // Nominal Time for Condensate Removal to Begin [s]
153 : Real64 Gamma_Rated = 0.0; // Ratio of Initial Moisture Evaporation Rate
154 : // and Steady-state Latent Capacity
155 : Real64 MaxONOFFCyclesperHour = 0.0; // Maximum cycling rate of heat pump [cycles/hr]
156 : Real64 HPTimeConstant = 0.0; // Heat pump time constant [s]
157 : Real64 FanDelayTime = 0.0; // Fan delay time, time delay for the HP's fan to
158 : bool reportCoilFinalSizes = true; // one time report of sizes to coil report
159 : };
160 :
161 : void SimWatertoAirHPSimple(EnergyPlusData &state,
162 : std::string_view CompName, // Coil Name
163 : int &CompIndex, // Index for Component name
164 : Real64 const SensLoad, // Sensible demand load [W]
165 : Real64 const LatentLoad, // Latent demand load [W]
166 : int const CyclingScheme, // Continuous fan OR cycling compressor
167 : Real64 const RuntimeFrac, // Compressor run time fraction or
168 : Real64 &MaxONOFFCyclesperHour, // Maximum cycling rate of heat pump [cycles/hr]
169 : Real64 &HPTimeConstant, // Heat pump time constant [s]
170 : Real64 &FanDelayTime, // Fan delay time, time delay for the HP's fan to
171 : DataHVACGlobals::CompressorOperation CompressorOp,
172 : Real64 const PartLoadRatio,
173 : bool const FirstHVACIteration,
174 : Optional<Real64 const> OnOffAirFlowRat = _ // ratio of comp on to comp off air flow rate
175 : );
176 :
177 : // MODULE SUBROUTINES:
178 : //*************************************************************************
179 :
180 : void GetSimpleWatertoAirHPInput(EnergyPlusData &state);
181 :
182 : // Beginning Initialization Section of the Module
183 : //******************************************************************************
184 :
185 : void InitSimpleWatertoAirHP(EnergyPlusData &state,
186 : int const HPNum, // Current HPNum under simulation
187 : Real64 const MaxONOFFCyclesperHour, // Maximum cycling rate of heat pump [cycles/hr]
188 : Real64 const HPTimeConstant, // Heat pump time constant [s]
189 : Real64 const FanDelayTime, // Fan delay time, time delay for the HP's fan to
190 : Real64 const SensLoad, // Control zone sensible load[W]
191 : Real64 const LatentLoad, // Control zone latent load[W]
192 : int const CyclingScheme, // fan operating mode
193 : Real64 const OnOffAirFlowRatio, // ratio of compressor on flow to average flow over time step
194 : bool const FirstHVACIteration // Iteration flag
195 : );
196 :
197 : void SizeHVACWaterToAir(EnergyPlusData &state, int const HPNum);
198 :
199 : void CalcHPCoolingSimple(EnergyPlusData &state,
200 : int const HPNum, // Heat Pump Number
201 : int const CyclingScheme, // Fan/Compressor cycling scheme indicator
202 : Real64 const RuntimeFrac, // Runtime Fraction of compressor or percent on time (on-time/cycle time)
203 : Real64 const SensDemand, // Cooling Sensible Demand [W] !unused1208
204 : Real64 const LatentDemand, // Cooling Latent Demand [W]
205 : DataHVACGlobals::CompressorOperation CompressorOp, // compressor operation flag
206 : Real64 const PartLoadRatio, // compressor part load ratio
207 : Real64 const OnOffAirFlowRatio // ratio of compressor on flow to average flow over time step
208 : );
209 :
210 : void CalcHPHeatingSimple(EnergyPlusData &state,
211 : int const HPNum, // Heat Pump Number
212 : int const CyclingScheme, // Fan/Compressor cycling scheme indicator
213 : Real64 const RuntimeFrac, // Runtime Fraction of compressor
214 : Real64 const SensDemand, // Cooling Sensible Demand [W] !unused1208
215 : DataHVACGlobals::CompressorOperation CompressorOp, // compressor operation flag
216 : Real64 const PartLoadRatio, // compressor part load ratio
217 : Real64 const OnOffAirFlowRatio // ratio of compressor on flow to average flow over time step
218 : );
219 :
220 : void UpdateSimpleWatertoAirHP(EnergyPlusData &state, int const HPNum);
221 :
222 : // End of Update subroutines for the WatertoAirHP Module
223 : // *****************************************************************************
224 :
225 : Real64 CalcEffectiveSHR(EnergyPlusData &state,
226 : int const HPNum, // Index number for cooling coil
227 : Real64 const SHRss, // Steady-state sensible heat ratio
228 : int const CyclingScheme, // Fan/compressor cycling scheme indicator
229 : Real64 const RTF, // Compressor run-time fraction
230 : Real64 const QLatRated, // Rated latent capacity
231 : Real64 const QLatActual, // Actual latent capacity
232 : Real64 const EnteringDB, // Entering air dry-bulb temperature
233 : Real64 const EnteringWB // Entering air wet-bulb temperature
234 : );
235 :
236 : int GetCoilIndex(EnergyPlusData &state,
237 : std::string const &CoilType, // must match coil types in this module
238 : std::string const &CoilName, // must match coil names for the coil type
239 : bool &ErrorsFound // set to true if problem
240 : );
241 :
242 : Real64 GetCoilCapacity(EnergyPlusData &state,
243 : std::string const &CoilType, // must match coil types in this module
244 : std::string const &CoilName, // must match coil names for the coil type
245 : bool &ErrorsFound // set to true if problem
246 : );
247 :
248 : Real64 GetCoilAirFlowRate(EnergyPlusData &state,
249 : std::string const &CoilType, // must match coil types in this module
250 : std::string const &CoilName, // must match coil names for the coil type
251 : bool &ErrorsFound // set to true if problem
252 : );
253 :
254 : int GetCoilInletNode(EnergyPlusData &state,
255 : std::string const &CoilType, // must match coil types in this module
256 : std::string const &CoilName, // must match coil names for the coil type
257 : bool &ErrorsFound // set to true if problem
258 : );
259 :
260 : int GetCoilOutletNode(EnergyPlusData &state,
261 : std::string const &CoilType, // must match coil types in this module
262 : std::string const &CoilName, // must match coil names for the coil type
263 : bool &ErrorsFound // set to true if problem
264 : );
265 :
266 : void SetSimpleWSHPData(EnergyPlusData &state,
267 : int const SimpleWSHPNum, // Number of OA Controller
268 : bool &ErrorsFound, // Set to true if certain errors found
269 : int const WaterCyclingMode, // the coil water flow mode (cycling, constant or constantondemand)
270 : Optional_int CompanionCoolingCoilNum = _, // Index to cooling coil for heating coil = SimpleWSHPNum
271 : Optional_int CompanionHeatingCoilNum = _ // Index to heating coil for cooling coil = SimpleWSHPNum
272 : );
273 :
274 : void CheckSimpleWAHPRatedCurvesOutputs(EnergyPlusData &state,
275 : std::string const &CoilName // must match coil names for the coil type
276 : );
277 :
278 : } // namespace WaterToAirHeatPumpSimple
279 :
280 771 : struct WaterToAirHeatPumpSimpleData : BaseGlobalStruct
281 : {
282 :
283 : Real64 const CelsiustoKelvin; // Conversion from Celsius to Kelvin
284 :
285 : int NumWatertoAirHPs; // The Number of Water to Air Heat Pumps found in the Input
286 : // INTEGER :: WaterIndex = 0 ! Water index
287 : // INTEGER :: Count = 0
288 : int AirflowErrPointer;
289 : bool GetCoilsInputFlag; // Flag set to make sure you get input once
290 : Array1D_bool MySizeFlag;
291 : Array1D_bool SimpleHPTimeStepFlag; // determines whether the previous operating mode for the coil and it's partner has been initialized
292 :
293 : Real64 SourceSideMassFlowRate; // Source Side Mass flow rate [Kg/s]
294 : Real64 SourceSideInletTemp; // Source Side Inlet Temperature [C]
295 : Real64 SourceSideInletEnth; // Source Side Inlet Enthalpy [J/kg]
296 : Real64 LoadSideInletDBTemp; // Load Side Inlet Dry Bulb Temp [C]
297 : Real64 LoadSideInletWBTemp; // Load Side Inlet Wet Bulb Temp [C]
298 : Real64 LoadSideInletHumRat; // Load Side Outlet Humidity ratio
299 : Real64 LoadSideInletEnth; // Load Side Inlet Enthalpy [J/kg]
300 : Real64 LoadSideOutletDBTemp; // Load Side Outlet Dry Bulb Temp [C]
301 : Real64 LoadSideOutletHumRat; // Load Side Outlet Humidity ratio
302 : Real64 QLatRated; // Latent Capacity [W] rated at entering air conditions [Tdb=26.7C Twb=19.4C]
303 : Real64 QLatActual; // Actual Latent Capacity [W]
304 : Real64 Winput; // Power Consumption [W]
305 : bool MyOneTimeFlag = true; // one time allocation flag
306 : bool firstTime = true;
307 :
308 : Array1D<WaterToAirHeatPumpSimple::SimpleWatertoAirHPConditions> SimpleWatertoAirHP;
309 :
310 : Array1D_bool MyEnvrnFlag; // used for initializations each begin environment flag
311 : Array1D_bool MyPlantScanFlag;
312 :
313 : Real64 LoadSideInletDBTemp_Init = 0; // rated conditions
314 : Real64 LoadSideInletWBTemp_Init = 0; // rated conditions
315 : Real64 LoadSideInletHumRat_Init = 0; // rated conditions
316 : Real64 LoadSideInletEnth_Init = 0; // rated conditions
317 : Real64 CpAir_Init = 0; // rated conditions
318 :
319 0 : void clear_state() override
320 : {
321 0 : this->NumWatertoAirHPs = 0;
322 0 : this->AirflowErrPointer = 0;
323 0 : this->MyOneTimeFlag = true;
324 0 : this->GetCoilsInputFlag = true;
325 0 : this->MySizeFlag.clear();
326 0 : this->SimpleHPTimeStepFlag.clear();
327 0 : this->SimpleWatertoAirHP.deallocate();
328 0 : this->firstTime = true;
329 0 : this->MyEnvrnFlag.deallocate();
330 0 : this->MyPlantScanFlag.deallocate();
331 0 : this->LoadSideInletDBTemp_Init = 0;
332 0 : this->LoadSideInletWBTemp_Init = 0;
333 0 : this->LoadSideInletHumRat_Init = 0;
334 0 : this->LoadSideInletEnth_Init = 0;
335 0 : this->CpAir_Init = 0;
336 0 : }
337 :
338 : // Default Constructor
339 771 : WaterToAirHeatPumpSimpleData()
340 771 : : CelsiustoKelvin(DataGlobalConstants::KelvinConv), NumWatertoAirHPs(0), AirflowErrPointer(0), GetCoilsInputFlag(true),
341 : SourceSideMassFlowRate(0.0), SourceSideInletTemp(0.0), SourceSideInletEnth(0.0), LoadSideInletDBTemp(0.0), LoadSideInletWBTemp(0.0),
342 : LoadSideInletHumRat(0.0), LoadSideInletEnth(0.0), LoadSideOutletDBTemp(0.0), LoadSideOutletHumRat(0.0), QLatRated(0.0), QLatActual(0.0),
343 771 : Winput(0.0), MyOneTimeFlag(true), firstTime(true)
344 : {
345 771 : }
346 : };
347 :
348 : } // namespace EnergyPlus
349 :
350 : #endif
|