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 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 : 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 LatentCapacityTimeConstant; // Latent capacity 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 : int PLFCurveIndex = 0; // Index of the Part Load Factor curve
136 : Real64 HighPressCutoff; // High Pressure Cut-off [Pa]
137 : Real64 LowPressCutoff; // Low Pressure Cut-off [Pa]
138 : CompressorType compressorType; // Type of Compressor ie. Reciprocating,Rotary or Scroll
139 : int AirInletNodeNum; // air side coil inlet node number
140 : int AirOutletNodeNum; // air side coil outlet node number
141 : int WaterInletNodeNum; // water side coil inlet node number
142 : int WaterOutletNodeNum; // water side coil outlet node number
143 : int LowPressClgError; // count for low pressure errors (cooling)
144 : int HighPressClgError; // count for high pressure errors (cooling)
145 : int LowPressHtgError; // count for low pressure errors (heating)
146 : int HighPressHtgError; // count for high pressure errors (heating)
147 : PlantLocation plantLoc;
148 :
149 : // Default Constructor
150 6 : WatertoAirHPEquipConditions()
151 18 : : WAHPType(DataPlant::PlantEquipmentType::Invalid), SimFlag(false), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0),
152 6 : InletAirDBTemp(0.0), InletAirHumRat(0.0), OutletAirDBTemp(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0),
153 6 : InletWaterTemp(0.0), OutletWaterTemp(0.0), InletWaterMassFlowRate(0.0), OutletWaterMassFlowRate(0.0), DesignWaterMassFlowRate(0.0),
154 6 : DesignWaterVolFlowRate(0.0), InletWaterEnthalpy(0.0), OutletWaterEnthalpy(0.0), Power(0.0), Energy(0.0), QSensible(0.0), QLatent(0.0),
155 6 : QSource(0.0), EnergySensible(0.0), EnergyLatent(0.0), EnergySource(0.0), RunFrac(0.0), PartLoadRatio(0.0), HeatingCapacity(0.0),
156 6 : CoolingCapacity(0.0), QLoadTotal(0.0), EnergyLoadTotal(0.0), Twet_Rated(0.0), Gamma_Rated(0.0), MaxONOFFCyclesperHour(0.0),
157 6 : LatentCapacityTimeConstant(0.0), FanDelayTime(0.0), SourceSideUACoeff(0.0), LoadSideTotalUACoeff(0.0), LoadSideOutsideUACoeff(0.0),
158 6 : CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), PowerLosses(0.0), LossFactor(0.0),
159 6 : RefVolFlowRate(0.0), VolumeRatio(0.0), LeakRateCoeff(0.0), SourceSideHTR1(0.0), SourceSideHTR2(0.0), HighPressCutoff(0.0),
160 6 : LowPressCutoff(0.0), compressorType(CompressorType::Invalid), AirInletNodeNum(0), AirOutletNodeNum(0), WaterInletNodeNum(0),
161 6 : WaterOutletNodeNum(0), LowPressClgError(0), HighPressClgError(0), LowPressHtgError(0), HighPressHtgError(0), plantLoc{}
162 : {
163 6 : }
164 : };
165 :
166 : // Functions
167 :
168 : void SimWatertoAirHP(EnergyPlusData &state,
169 : std::string_view CompName, // component name
170 : int &CompIndex, // Index for Component name
171 : Real64 const DesignAirflow, // design air flow rate
172 : HVAC::FanOp const fanOp, // cycling scheme--either continuous fan/cycling compressor or
173 : bool const FirstHVACIteration, // first iteration flag
174 : bool const InitFlag, // initialization flag used to suppress property routine errors
175 : Real64 const SensLoad, // sensible load
176 : Real64 const LatentLoad, // latent load
177 : HVAC::CompressorOp compressorOp,
178 : Real64 const PartLoadRatio);
179 :
180 : void GetWatertoAirHPInput(EnergyPlusData &state);
181 :
182 : void InitWatertoAirHP(EnergyPlusData &state,
183 : int const HPNum, // index to main heat pump data structure
184 : bool const InitFlag,
185 : Real64 const SensLoad,
186 : Real64 const LatentLoad,
187 : Real64 const DesignAirFlow,
188 : Real64 const PartLoadRatio);
189 :
190 : void CalcWatertoAirHPCooling(EnergyPlusData &state,
191 : int const HPNum, // heat pump number
192 : HVAC::FanOp const fanOp, // fan/compressor cycling scheme indicator
193 : bool const FirstHVACIteration, // first iteration flag
194 : bool const InitFlag, // suppress property errors if true
195 : Real64 const SensDemand,
196 : HVAC::CompressorOp compressorOp,
197 : Real64 const PartLoadRatio);
198 :
199 : void CalcWatertoAirHPHeating(EnergyPlusData &state,
200 : int const HPNum, // heat pump number
201 : HVAC::FanOp const fanOp, // fan/compressor cycling scheme indicator
202 : bool const FirstHVACIteration, // first iteration flag
203 : bool const InitFlag, // first iteration flag
204 : Real64 const SensDemand,
205 : HVAC::CompressorOp compressorOp,
206 : Real64 const PartLoadRatio);
207 :
208 : void UpdateWatertoAirHP(EnergyPlusData &state, int const HPNum);
209 :
210 : Real64 CalcEffectiveSHR(EnergyPlusData &state,
211 : int const HPNum, // Index number for cooling coil
212 : Real64 const SHRss, // Steady-state sensible heat ratio
213 : HVAC::FanOp const fanOp, // fan/compressor cycling scheme indicator
214 : Real64 const RTF, // Compressor run-time fraction
215 : Real64 const QLatRated, // Rated latent capacity
216 : Real64 const QLatActual, // Actual latent capacity
217 : Real64 const EnteringDB, // Entering air dry-bulb temperature
218 : Real64 const EnteringWB // Entering air wet-bulb temperature
219 : );
220 :
221 : Real64 DegradF(EnergyPlusData &state,
222 : std::string &FluidName, // Name of glycol used in source side
223 : Real64 &Temp, // Temperature of the fluid
224 : int &FluidIndex // Index number for the fluid
225 : );
226 :
227 : int GetCoilIndex(EnergyPlusData &state,
228 : std::string const &CoilType, // must match coil types in this module
229 : std::string const &CoilName, // must match coil names for the coil type
230 : bool &ErrorsFound // set to true if problem
231 : );
232 :
233 : Real64 GetCoilCapacity(EnergyPlusData &state,
234 : std::string const &CoilType, // must match coil types in this module
235 : std::string const &CoilName, // must match coil names for the coil type
236 : bool &ErrorsFound // set to true if problem
237 : );
238 :
239 : int GetCoilInletNode(EnergyPlusData &state,
240 : std::string const &CoilType, // must match coil types in this module
241 : std::string const &CoilName, // must match coil names for the coil type
242 : bool &ErrorsFound // set to true if problem
243 : );
244 :
245 : int GetCoilOutletNode(EnergyPlusData &state,
246 : std::string const &CoilType, // must match coil types in this module
247 : std::string const &CoilName, // must match coil names for the coil type
248 : bool &ErrorsFound // set to true if problem
249 : );
250 :
251 : } // namespace WaterToAirHeatPump
252 :
253 : struct WaterToAirHeatPumpData : BaseGlobalStruct
254 : {
255 :
256 : int NumWatertoAirHPs; // The Number of Water to Air Heat Pumps found in the Input
257 : Array1D_bool CheckEquipName;
258 :
259 : int RefrigIndex; // Refrigerant index
260 : int WaterIndex; // Water index
261 : bool GetCoilsInputFlag; // Flag set to make sure you get input once
262 : bool MyOneTimeFlag;
263 : bool firstTime;
264 :
265 : Array1D<WaterToAirHeatPump::WatertoAirHPEquipConditions> WatertoAirHP;
266 :
267 : Real64 initialQSource = 0.0; // Guess Source Side Heat Transfer Rate [W]
268 : Real64 initialQLoad = 0.0; // Guess Load Side Heat Transfer rate [W]
269 :
270 : Array1D_bool MyPlantScanFlag;
271 : Array1D_bool MyEnvrnFlag;
272 :
273 : Real64 initialQSource_calc = 0.0; // Guess Source Side Heat Transfer Rate [W]
274 : Real64 initialQLoadTotal_calc = 0.0; // Guess Load Side Heat Transfer rate [W]
275 :
276 : Real64 CompSuctionTemp = 0.0; // Temperature of the Refrigerant Entering the Compressor [C]
277 :
278 : Real64 LoadSideInletDBTemp_Init = 0.0; // rated conditions
279 : Real64 LoadSideInletHumRat_Init = 0.0; // rated conditions
280 : Real64 LoadSideAirInletEnth_Init = 0.0; // rated conditions
281 :
282 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
283 : {
284 796 : }
285 :
286 0 : void clear_state() override
287 : {
288 0 : this->NumWatertoAirHPs = 0;
289 0 : this->CheckEquipName.clear();
290 0 : this->RefrigIndex = 0;
291 0 : this->WaterIndex = 0;
292 0 : this->GetCoilsInputFlag = true;
293 0 : this->MyOneTimeFlag = true;
294 0 : this->firstTime = true;
295 0 : this->WatertoAirHP.clear();
296 0 : this->initialQSource = 0.0;
297 0 : this->initialQLoad = 0.0;
298 0 : this->MyPlantScanFlag.deallocate();
299 0 : this->MyEnvrnFlag.deallocate();
300 0 : this->initialQSource_calc = 0.0;
301 0 : this->initialQLoadTotal_calc = 0.0;
302 0 : this->CompSuctionTemp = 0.0;
303 0 : this->LoadSideInletDBTemp_Init = 0.0;
304 0 : this->LoadSideInletHumRat_Init = 0.0;
305 0 : this->LoadSideAirInletEnth_Init = 0.0;
306 0 : }
307 :
308 : // Default Constructor
309 796 : WaterToAirHeatPumpData() : NumWatertoAirHPs(0), RefrigIndex(0), WaterIndex(0), GetCoilsInputFlag(true), MyOneTimeFlag(true), firstTime(true)
310 : {
311 796 : }
312 : };
313 :
314 : } // namespace EnergyPlus
315 :
316 : #endif
|