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