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 WaterThermalTanks_hh_INCLUDED
49 : #define WaterThermalTanks_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.fwd.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
57 : #include <EnergyPlus/DataGlobalConstants.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 : #include <EnergyPlus/FluidProperties.hh>
60 : #include <EnergyPlus/Plant/Enums.hh>
61 : #include <EnergyPlus/Plant/PlantLocation.hh>
62 : #include <EnergyPlus/PlantComponent.hh>
63 : #include <EnergyPlus/VariableSpeedCoils.hh>
64 :
65 : namespace EnergyPlus {
66 :
67 : // Forward declarations
68 : struct EnergyPlusData;
69 :
70 : namespace WaterThermalTanks {
71 :
72 : enum class WTTAmbientTemp
73 : {
74 : Invalid = -1,
75 : Schedule, // ambient temperature around tank (or HPWH inlet air) is scheduled
76 : TempZone, // tank is located in a zone or HPWH inlet air is zone air only
77 : OutsideAir, // tank is located outdoors or HPWH inlet air is outdoor air only
78 : ZoneAndOA, // applicable to HPWH only, inlet air is mixture of OA and zone air
79 : Num,
80 : };
81 :
82 : constexpr std::array<std::string_view, static_cast<int>(WTTAmbientTemp::Num)> HPWHAmbientTempNamesUC{
83 : "SCHEDULE", "ZONEAIRONLY", "OUTDOORAIRONLY", "ZONEANDOUTDOORAIR"};
84 :
85 : constexpr std::array<std::string_view, static_cast<int>(WTTAmbientTemp::Num) - 1> TankAmbientTempNamesUC{
86 : "SCHEDULE",
87 : "ZONE",
88 : "OUTDOORS",
89 : };
90 :
91 : enum class CrankcaseHeaterControlTemp
92 : {
93 : Invalid = -1,
94 : Schedule, // temperature controlling compressor crankcase heater is scheduled
95 : Zone, // temperature controlling compressor crankcase heater is zone air
96 : Outdoors, // temperature controlling compressor crankcase heater is outdoor air
97 : Num
98 : };
99 :
100 : constexpr std::array<std::string_view, static_cast<int>(CrankcaseHeaterControlTemp::Num)> CrankcaseHeaterControlTempNamesUC{
101 : "SCHEDULE",
102 : "ZONE",
103 : "OUTDOORS",
104 : };
105 :
106 : enum class TankShape
107 : {
108 : Invalid = -1,
109 : VertCylinder, // tank shape is a vertical cylinder
110 : HorizCylinder, // tank shape is a horizontal cylinder
111 : Other, // tank shape has an arbitrary perimeter shape
112 : Num
113 : };
114 :
115 : constexpr std::array<std::string_view, static_cast<int>(TankShape::Num)> TankShapeNamesUC{
116 : "VERTICALCYLINDER",
117 : "HORIZONTALCYLINDER",
118 : "OTHER",
119 : };
120 :
121 : enum class HeaterControlMode
122 : {
123 : Invalid = -1,
124 : Cycle,
125 : Modulate,
126 : Num
127 : };
128 :
129 : constexpr std::array<std::string_view, static_cast<int>(HeaterControlMode::Num)> HeaterControlModeNamesUC{"CYCLE", "MODULATE"};
130 :
131 : enum class PriorityControlMode // For Stratified Water Heaters, this controls how the two heating elements work together
132 : {
133 : Invalid = -1,
134 : MasterSlave, // water heater only, master-slave priority control of heater elements
135 : Simultaneous, // water heater only, simultaneous control of heater elements
136 : Num
137 : };
138 :
139 : constexpr std::array<std::string_view, static_cast<int>(PriorityControlMode::Num)> PriorityControlModeNamesUC{"MASTERSLAVE", "SIMULTANEOUS"};
140 :
141 : enum class InletPositionMode
142 : {
143 : Invalid = -1,
144 : Fixed, // water heater only, inlet water always enters at the user-specified height
145 : Seeking, // water heater only, inlet water seeks out the node with the closest temperature
146 : Num
147 : };
148 :
149 : constexpr std::array<std::string_view, static_cast<int>(InletPositionMode::Num)> InletPositionModeNamesUC{"FIXED", "SEEKING"};
150 :
151 : // reclaim heat object types for Coil:WaterHeating:Desuperheater object
152 : enum class ReclaimHeatObjectType
153 : {
154 : Invalid = -1,
155 : CoilCoolingDX, // reclaim heating source is new DX Cooling coil
156 : CompressorRackRefrigeratedCase, // reclaim heating source is refrigerated case compressor rack
157 : DXCooling, // reclaim heating source is DX cooling coil
158 : DXMultiSpeed, // reclaim heating source is DX multispeed coil
159 : DXMultiMode, // reclaim heating source is DX multimode coil
160 : CondenserRefrigeration, // reclaim heating source is detailed refrigeration system condenser
161 : DXVariableCooling, // reclaim heating source is Variable Speed DX cooling coil
162 : AirWaterHeatPumpEQ, // reclaim heating source is Water to air heat pump cooling coil
163 : AirWaterHeatPumpVSEQ, // reclaim heating source is Water to air heat pump variable speed cooling coil
164 : Num
165 : };
166 :
167 : enum class WaterHeaterSide
168 : {
169 : Invalid = -1,
170 : Use, // Indicates Use side of water heater
171 : Source, // Indicates Source side of water heater
172 : Num
173 : };
174 :
175 : enum class SizingMode
176 : {
177 : Invalid = -1,
178 : PeakDraw,
179 : ResidentialMin,
180 : PerPerson,
181 : PerFloorArea,
182 : PerUnit,
183 : PerSolarColArea,
184 : Num
185 : };
186 :
187 : enum class SourceSideControl
188 : {
189 : Invalid = -1,
190 : StorageTank,
191 : IndirectHeatPrimarySetpoint,
192 : IndirectHeatAltSetpoint,
193 : Num
194 : };
195 :
196 : constexpr std::array<std::string_view, static_cast<int>(SourceSideControl::Num)> SourceSideControlNamesUC{
197 : "STORAGETANK", "INDIRECTHEATPRIMARYSETPOINT", "INDIRECTHEATALTERNATESETPOINT"};
198 :
199 : enum class FlowMode
200 : {
201 : Invalid = -1,
202 : PassingFlowThru,
203 : MaybeRequestingFlow,
204 : ThrottlingFlow,
205 : Num
206 : };
207 :
208 : enum class TankOperatingMode
209 : {
210 : Invalid = -1,
211 : Heating, // heating source is on, source will not turn off until setpoint temp is reached
212 : Floating, // heating source is off, source will not turn on until cut-in temp is reached
213 : Venting, // tank temp is above maximum temperature and water is venting
214 : Cooling, // cooling source is on, source will not turn off until setpoint temp is reached
215 : Num
216 : };
217 :
218 : struct StratifiedNodeData
219 : {
220 : // Members
221 : Real64 Mass; // All nodes have the same mass (kg)
222 : Real64 OnCycLossCoeff;
223 : Real64 OffCycLossCoeff;
224 : Real64 Temp;
225 : Real64 SavedTemp;
226 : Real64 NewTemp;
227 : Real64 TempSum;
228 : Real64 TempAvg; // Average node temperature over the time step (C)
229 : Real64 CondCoeffUp;
230 : Real64 CondCoeffDn;
231 : Real64 OffCycParaLoad; // Heat delivered to the tank from off-cycle parasitic sources
232 : Real64 OnCycParaLoad;
233 : Real64 UseMassFlowRate;
234 : Real64 SourceMassFlowRate;
235 : Real64 MassFlowFromUpper; // Mass flow rate into this node from node above
236 : Real64 MassFlowFromLower; // Mass flow rate into this node from node below
237 : Real64 MassFlowToUpper; // Mass flow rate from this node to node above
238 : Real64 MassFlowToLower; // Mass flow rate from this node to node below
239 : // Report Variables
240 : Real64 Volume;
241 : Real64 Height; // Node height from top to bottom (like a thickness)
242 : Real64 MaxCapacity; // For reporting
243 : int Inlets;
244 : int Outlets;
245 : Real64 HPWHWrappedCondenserHeatingFrac; // fraction of the heat from a wrapped condenser that enters into this node, should add up to 1.
246 :
247 : // Default Constructor
248 146 : StratifiedNodeData()
249 146 : : Mass(0.0), OnCycLossCoeff(0.0), OffCycLossCoeff(0.0), Temp(0.0), SavedTemp(0.0), NewTemp(0.0), TempSum(0.0), TempAvg(0.0),
250 146 : CondCoeffUp(0.0), CondCoeffDn(0.0), OffCycParaLoad(0.0), OnCycParaLoad(0.0), UseMassFlowRate(0.0), SourceMassFlowRate(0.0),
251 146 : MassFlowFromUpper(0.0), MassFlowFromLower(0.0), MassFlowToUpper(0.0), MassFlowToLower(0.0), Volume(0.0), Height(0.0), MaxCapacity(0.0),
252 146 : Inlets(0), Outlets(0), HPWHWrappedCondenserHeatingFrac(0.0)
253 : {
254 146 : }
255 : };
256 :
257 : struct WaterHeaterSizingData
258 : {
259 : // Members
260 : // input data
261 : SizingMode DesignMode; // what sizing method to use
262 : Real64 TankDrawTime; // in hours, time storage can meet peak demand
263 : Real64 RecoveryTime; // time for tank to recover
264 : Real64 NominalVolForSizingDemandSideFlow; // nominal tank size to use in sizing demand side connections
265 : int NumberOfBedrooms;
266 : Real64 NumberOfBathrooms;
267 : Real64 TankCapacityPerPerson;
268 : Real64 RecoveryCapacityPerPerson;
269 : Real64 TankCapacityPerArea;
270 : Real64 RecoveryCapacityPerArea;
271 : Real64 NumberOfUnits;
272 : Real64 TankCapacityPerUnit;
273 : Real64 RecoveryCapacityPerUnit;
274 : Real64 TankCapacityPerCollectorArea;
275 : Real64 HeightAspectRatio;
276 : // data from elsewhere in E+
277 : Real64 PeakDemand;
278 : Real64 PeakNumberOfPeople;
279 : Real64 TotalFloorArea;
280 : Real64 TotalSolarCollectorArea;
281 :
282 : // Default Constructor
283 34 : WaterHeaterSizingData()
284 34 : : DesignMode(SizingMode::Invalid), TankDrawTime(0.0), RecoveryTime(0.0), NominalVolForSizingDemandSideFlow(0.0), NumberOfBedrooms(0),
285 34 : NumberOfBathrooms(0.0), TankCapacityPerPerson(0.0), RecoveryCapacityPerPerson(0.0), TankCapacityPerArea(0.0),
286 34 : RecoveryCapacityPerArea(0.0), NumberOfUnits(0.0), TankCapacityPerUnit(0.0), RecoveryCapacityPerUnit(0.0),
287 34 : TankCapacityPerCollectorArea(0.0), HeightAspectRatio(0.0), PeakDemand(0.0), PeakNumberOfPeople(0.0), TotalFloorArea(0.0),
288 34 : TotalSolarCollectorArea(0.0)
289 : {
290 34 : }
291 : };
292 :
293 : struct HeatPumpWaterHeaterData : PlantComponent
294 : {
295 : // Members
296 : std::string Name; // Name of heat pump water heater
297 : std::string Type; // Type of water heater (HEAT PUMP:WATER HEATER)
298 : DataPlant::PlantEquipmentType HPWHType; // integer parameter for heat pump water heater
299 : std::string TankName; // Name of tank associated with heat pump water heater
300 : std::string TankType; // Type of water heater (MIXED or STRATIFIED) used with heat pump
301 : DataPlant::PlantEquipmentType HPWHTankType; // Parameter for tank type (MIXED or STRATIFIED)
302 : bool StandAlone; // Flag for operation with no plant connections (no use nodes)
303 : Sched::Schedule *availSched = nullptr; // Availability Schedule
304 : Sched::Schedule *setptTempSched = nullptr; // Setpoint Temperature Schedule
305 : Real64 DeadBandTempDiff; // Dead band temperature difference (cut-in temperature)
306 : Real64 Capacity; // Heat Pump rated capacity (W)
307 : Real64 BackupElementCapacity; // Tank backup element capacity (W)
308 : Real64 BackupElementEfficiency; // Tank backup element efficiency
309 : Real64 WHOnCycParaLoad; // tank's on-cycle parasitic load (W), disable for rating
310 : Real64 WHOffCycParaLoad; // tank's off-cycle parasitic load (W), disable for rating
311 : Real64 WHOnCycParaFracToTank; // tank's on-cycle parasitic frac to tank, disable for rating
312 : Real64 WHOffCycParaFracToTank; // tank's off-cycle parasitic frac to tank, disable for rating
313 : int WHPLFCurve; // tank part-load fraction curve index, used for rating procedure
314 : Real64 OperatingAirFlowRate; // Operating volumetric air flow rate (m3/s)
315 : Real64 OperatingAirMassFlowRate; // Operating air mass flow rate (kg/s)
316 : Real64 OperatingWaterFlowRate; // Operating volumetric water flow rate (m3/s)
317 : Real64 COP; // Heat Pump coefficient of performance (W/W)
318 : Real64 SHR; // Heat Pump air-side coil sensible heat ratio
319 : Real64 RatedInletDBTemp; // Rated evaporator inlet air dry-bulb temperature (C)
320 : Real64 RatedInletWBTemp; // Rated evaporator inlet air wet-bulb temperature (C)
321 : Real64 RatedInletWaterTemp; // Rated condenser inlet water temperature (C)
322 : bool FoundTank; // Found storage tank flag associated with HP water heater
323 : int HeatPumpAirInletNode; // HP air inlet node (for zone, zone/outdoor or scheduled)
324 : int HeatPumpAirOutletNode; // HP air outlet node (for zone, zone/outdoor or scheduled)
325 : int OutsideAirNode; // outdoor air node (for outdoor or zone/outdoor air unit only)
326 : int ExhaustAirNode; // Exhaust air node (for outdoor or zone/outdoor air unit only)
327 : int CondWaterInletNode; // Condenser water inlet node
328 : int CondWaterOutletNode; // Condenser water outlet node
329 : int WHUseInletNode; // Water heater tank use side inlet node
330 : int WHUseOutletNode; // Water heater tank use side outlet node
331 : int WHUseSidePlantLoopNum; // if not zero, then this water heater is on plant loop #
332 : std::string DXCoilType; // Type of DX coil (Coil:DX:HeatPumpWaterHeater)
333 : std::string DXCoilName; // Name of DX coil
334 : int DXCoilNum; // Index of DX coil
335 : int DXCoilTypeNum; // Type Number of DX coil
336 : int DXCoilAirInletNode; // Inlet air node number of DX coil
337 : int DXCoilPLFFPLR; // Index to HPWH's DX Coil PLF as a function of PLR curve
338 : HVAC::FanType fanType; // Integer type of fan (3 = Fan:OnOff)
339 : std::string FanName; // Name of Fan
340 : std::string FanInletNode_str; // Fan inlet node name
341 : std::string FanOutletNode_str; // Fan outlet node name
342 : int FanNum; // Index of Fan
343 : HVAC::FanPlace fanPlace; // Location of Fan
344 : int FanOutletNode; // Outlet node of heat pump water heater fan
345 : int WaterHeaterTankNum; // Index of Water Heater Tank
346 : Sched::Schedule *outletAirSplitterSched = nullptr; // air-side outlet air splitter schedule
347 : Sched::Schedule *inletAirMixerSched = nullptr; // air-side inlet air mixer schedule
348 : TankOperatingMode Mode = TankOperatingMode::Floating; // HP mode (0 = float, 1 = heating [-1 = venting na for HP])
349 : TankOperatingMode SaveMode = TankOperatingMode::Floating; // HP mode on first iteration
350 : TankOperatingMode SaveWHMode = TankOperatingMode::Floating; // mode of water heater tank element (backup element)
351 : Real64 Power; // HP power used for reporting
352 : Real64 Energy; // HP energy used for reporting
353 : Real64 HeatingPLR; // HP PLR used for reporting
354 : Real64 SetPointTemp; // set point or cut-out temperature [C]
355 : Real64 MinAirTempForHPOperation; // HP does not operate below this ambient temperature
356 : Real64 MaxAirTempForHPOperation; // HP does not operate above this ambient temperature
357 : int InletAirMixerNode; // Inlet air mixer node number of HP water heater
358 : int OutletAirSplitterNode; // Outlet air splitter node number of HP water heater
359 : Real64 SourceMassFlowRate; // Maximum mass flow rate on the source side (kg/s)
360 : WTTAmbientTemp InletAirConfiguration; // Identifies source of HPWH inlet air
361 : Sched::Schedule *ambientTempSched = nullptr; // Schedule for ambient air temp at HPWH inlet
362 : Sched::Schedule *ambientRHSched = nullptr; // Schedule for ambient air RH at HPWH inlet
363 : int AmbientTempZone; // Index of ambient zone for ambient air at HPWH inlet
364 : CrankcaseHeaterControlTemp CrankcaseTempIndicator; // Indicator for HPWH compressor/crankcase heater location
365 : Sched::Schedule *crankcaseTempSched = nullptr; // Schedule for crankcase heater
366 : int CrankcaseTempZone; // Index of zone where compressor/crankcase heater is located
367 : Real64 OffCycParaLoad; // Rate for off-cycle parasitic load (W)
368 : Real64 OnCycParaLoad; // Rate for on-cycle parasitic load (W)
369 : WTTAmbientTemp ParasiticTempIndicator; // Indicator for HPWH parasitic heat rejection location
370 : Real64 OffCycParaFuelRate; // Electric consumption rate for off-cycle parasitic load (W)
371 : Real64 OnCycParaFuelRate; // Electric consumption rate for on-cycle parasitic load (W)
372 : Real64 OffCycParaFuelEnergy; // Electric energy consumption for off-cycle parasitic load (J)
373 : Real64 OnCycParaFuelEnergy; // Electric energy consumption for on-cycle parasitic load (J)
374 : bool AirFlowRateAutoSized; // Used to report air flow autosize info in Init
375 : bool WaterFlowRateAutoSized; // Used to report water flow autosize info in Init
376 : int HPSetPointError; // Used when temperature SP's in tank and HP are reversed
377 : int HPSetPointErrIndex1; // Index to recurring error for tank/HP set point temp
378 : int IterLimitErrIndex1; // Index for recurring iteration limit warning messages
379 : int IterLimitExceededNum1; // Counter for recurring iteration limit warning messages
380 : int RegulaFalsiFailedIndex1; // Index for recurring RegulaFalsi failed warning messages
381 : int RegulaFalsiFailedNum1; // Counter for recurring RegulaFalsi failed warning messages
382 : int IterLimitErrIndex2; // Index for recurring iteration limit warning messages
383 : int IterLimitExceededNum2; // Counter for recurring iteration limit warning messages
384 : int RegulaFalsiFailedIndex2; // Index for recurring RegulaFalsi failed warning messages
385 : int RegulaFalsiFailedNum2; // Counter for recurring RegulaFalsi failed warning messages
386 : bool FirstTimeThroughFlag; // Flag for saving water heater status
387 : bool ShowSetPointWarning; // Warn when set point is greater than max tank temp limit
388 : Real64 HPWaterHeaterSensibleCapacity; // sensible capacity delivered when HPWH is attached to a zone (W)
389 : Real64 HPWaterHeaterLatentCapacity; // latent capacity delivered when HPWH is attached to a zone (kg/s)
390 : Real64 WrappedCondenserBottomLocation; // Location of the bottom of the wrapped condenser.
391 : Real64 WrappedCondenserTopLocation; // Location of the top of the wrapped condenser.
392 : Real64 ControlSensor1Height; // location from bottom of tank of control sensor 1
393 : int ControlSensor1Node; // Node number of control sensor 1
394 : Real64 ControlSensor1Weight; // weight of control sensor 1
395 : Real64 ControlSensor2Height; // location from bottom of tank of control sensor 2
396 : int ControlSensor2Node; // Node number of control sensor 2
397 : Real64 ControlSensor2Weight; // weight of control sensor 2
398 : Real64 ControlTempAvg; // Measured control temperature for the heat pump, average over timestep, for reporting
399 : Real64 ControlTempFinal; // Measured control temperature at the end of the timestep, for reporting
400 : bool AllowHeatingElementAndHeatPumpToRunAtSameTime; // if false, if the heating element kicks on, it will recover with that before turning the
401 : // heat pump back on.
402 : // variables for variable-speed HPWH
403 : int NumofSpeed; // number of speeds for VS HPWH
404 : Array1D<Real64> HPWHAirVolFlowRate; // air volume flow rate during heating operation
405 : Array1D<Real64> HPWHAirMassFlowRate; // air mass flow rate during heating operation
406 : Array1D<Real64> HPWHWaterVolFlowRate; // water volume flow rate during heating operation
407 : Array1D<Real64> HPWHWaterMassFlowRate; // water mass flow rate during heating operation
408 : Array1D<Real64> MSAirSpeedRatio; // air speed ratio in heating mode
409 : Array1D<Real64> MSWaterSpeedRatio; // water speed ratio in heating mode
410 : bool bIsIHP; // whether the HP is a part of Integrated Heat Pump
411 : bool MyOneTimeFlagHP; // first pass log
412 : bool MyTwoTimeFlagHP; // second pass do input check
413 : std::string CoilInletNode_str; // Used to set up comp set
414 : std::string CoilOutletNode_str; // Used to set up comp set
415 : bool CheckHPWHEquipName;
416 :
417 : std::string InletNodeName1;
418 : std::string OutletNodeName1;
419 : std::string InletNodeName2;
420 : std::string OutletNodeName2;
421 :
422 : bool myOneTimeInitFlag;
423 :
424 : // end of variables for variable-speed HPWH
425 0 : ~HeatPumpWaterHeaterData() = default;
426 :
427 : // Default Constructor
428 18 : HeatPumpWaterHeaterData()
429 54 : : HPWHType(DataPlant::PlantEquipmentType::Invalid), HPWHTankType(DataPlant::PlantEquipmentType::Invalid), StandAlone(false),
430 18 : DeadBandTempDiff(0.0), Capacity(0.0), BackupElementCapacity(0.0), BackupElementEfficiency(0.0), WHOnCycParaLoad(0.0),
431 18 : WHOffCycParaLoad(0.0), WHOnCycParaFracToTank(0.0), WHOffCycParaFracToTank(0.0), WHPLFCurve(0), OperatingAirFlowRate(0.0),
432 18 : OperatingAirMassFlowRate(0.0), OperatingWaterFlowRate(0.0), COP(0.0), SHR(0.0), RatedInletDBTemp(0.0), RatedInletWBTemp(0.0),
433 18 : RatedInletWaterTemp(0.0), FoundTank(false), HeatPumpAirInletNode(0), HeatPumpAirOutletNode(0), OutsideAirNode(0), ExhaustAirNode(0),
434 36 : CondWaterInletNode(0), CondWaterOutletNode(0), WHUseInletNode(0), WHUseOutletNode(0), WHUseSidePlantLoopNum(0), DXCoilNum(0),
435 36 : DXCoilTypeNum(0), DXCoilAirInletNode(0), DXCoilPLFFPLR(0), fanType(HVAC::FanType::Invalid), FanNum(0),
436 18 : fanPlace(HVAC::FanPlace::Invalid), FanOutletNode(0), WaterHeaterTankNum(0), Power(0.0), Energy(0.0), HeatingPLR(0.0), SetPointTemp(0.0),
437 18 : MinAirTempForHPOperation(5.0), MaxAirTempForHPOperation(48.8888888889), InletAirMixerNode(0), OutletAirSplitterNode(0),
438 18 : SourceMassFlowRate(0.0), InletAirConfiguration(WTTAmbientTemp::OutsideAir), AmbientTempZone(0),
439 18 : CrankcaseTempIndicator(CrankcaseHeaterControlTemp::Schedule), CrankcaseTempZone(0), OffCycParaLoad(0.0), OnCycParaLoad(0.0),
440 18 : ParasiticTempIndicator(WTTAmbientTemp::OutsideAir), OffCycParaFuelRate(0.0), OnCycParaFuelRate(0.0), OffCycParaFuelEnergy(0.0),
441 18 : OnCycParaFuelEnergy(0.0), AirFlowRateAutoSized(false), WaterFlowRateAutoSized(false), HPSetPointError(0), HPSetPointErrIndex1(0),
442 18 : IterLimitErrIndex1(0), IterLimitExceededNum1(0), RegulaFalsiFailedIndex1(0), RegulaFalsiFailedNum1(0), IterLimitErrIndex2(0),
443 18 : IterLimitExceededNum2(0), RegulaFalsiFailedIndex2(0), RegulaFalsiFailedNum2(0), FirstTimeThroughFlag(true), ShowSetPointWarning(true),
444 18 : HPWaterHeaterSensibleCapacity(0.0), HPWaterHeaterLatentCapacity(0.0), WrappedCondenserBottomLocation(0.0),
445 18 : WrappedCondenserTopLocation(0.0), ControlSensor1Height(-1.0), ControlSensor1Node(1), ControlSensor1Weight(1.0),
446 18 : ControlSensor2Height(-1.0), ControlSensor2Node(2), ControlSensor2Weight(0.0), ControlTempAvg(0.0), ControlTempFinal(0.0),
447 18 : AllowHeatingElementAndHeatPumpToRunAtSameTime(true), NumofSpeed(0), HPWHAirVolFlowRate(HVAC::MaxSpeedLevels, 0.0),
448 18 : HPWHAirMassFlowRate(HVAC::MaxSpeedLevels, 0.0), HPWHWaterVolFlowRate(HVAC::MaxSpeedLevels, 0.0),
449 18 : HPWHWaterMassFlowRate(HVAC::MaxSpeedLevels, 0.0), MSAirSpeedRatio(HVAC::MaxSpeedLevels, 0.0),
450 18 : MSWaterSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), MyOneTimeFlagHP(true), MyTwoTimeFlagHP(true), CheckHPWHEquipName(true),
451 36 : myOneTimeInitFlag(true)
452 : {
453 18 : }
454 :
455 : static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
456 :
457 : void
458 : simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override;
459 :
460 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
461 :
462 : void getDesignCapacities(EnergyPlusData &state,
463 : [[maybe_unused]] const PlantLocation &calledFromLocation,
464 : Real64 &MaxLoad,
465 : Real64 &MinLoad,
466 : Real64 &OptLoad) override;
467 :
468 : void oneTimeInit(EnergyPlusData &state) override;
469 : };
470 :
471 : struct WaterThermalTankData : PlantComponent
472 : {
473 : // Members
474 : std::string Name; // Name of water heater
475 : std::string Type; // Type of water heater (MIXED or STRATIFIED)
476 : DataPlant::PlantEquipmentType WaterThermalTankType; // integer parameter for water heater(if part of an HPWH,then=HPWH)
477 : bool IsChilledWaterTank; // logical flag, true if for chilled water, false if for hot water
478 : std::string EndUseSubcategoryName; // User-defined end-use subcategory name
479 : bool Init; // Flag for initialization: TRUE means do the init
480 : bool StandAlone; // Flag for operation with no plant connections (no source or use)
481 : Real64 Volume; // Tank volume (m3)
482 : bool VolumeWasAutoSized; // true if tank volume was autosize on input
483 : Real64 Mass; // Total mass of fluid in the tank (kg)
484 : Real64 TimeElapsed; // Fraction of the current hour that has elapsed (h)
485 : // Saved in order to identify the beginning of a new system time
486 : WTTAmbientTemp AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR)
487 : Sched::Schedule *ambientTempSched = nullptr; // Schedule
488 : int AmbientTempZone; // Number of ambient zone around tank
489 : int AmbientTempOutsideAirNode; // Number of outside air node
490 : Real64 AmbientTemp; // Ambient temperature around tank (C)
491 : Real64 AmbientZoneGain; // Internal gain to zone from tank losses (W)
492 : Real64 LossCoeff; // Overall tank heat loss coefficient, UA (W/K)
493 : Real64 OffCycLossCoeff; // Off-cycle overall tank heat loss coefficient, UA (W/K)
494 : Real64 OffCycLossFracToZone; // Fraction of off-cycle losses added to zone
495 : Real64 OnCycLossCoeff; // On-cycle overall tank heat loss coefficient, UA (W/K)
496 : Real64 OnCycLossFracToZone; // Fraction of on-cycle losses added to zone
497 : TankOperatingMode Mode = TankOperatingMode::Floating; // Indicator for current operating mode
498 : TankOperatingMode SavedMode = TankOperatingMode::Floating; // Mode indicator saved from previous time step
499 : HeaterControlMode ControlType; // Indicator for Heater Control type
500 : PriorityControlMode StratifiedControlMode; // Indicator for Stratified Water Heaters Priority Control Type
501 : Constant::eFuel FuelType; // Fuel type
502 : Real64 MaxCapacity; // Maximum capacity of auxiliary heater 1 (W)
503 : bool MaxCapacityWasAutoSized; // true if heater 1 capacity was autosized on input
504 : Real64 MinCapacity; // Minimum capacity of auxiliary heater 1 (W)
505 : Real64 Efficiency; // Thermal efficiency of auxiliary heater 1 ()
506 : int PLFCurve; // Part load factor curve as a function of part load ratio
507 : Sched::Schedule *setptTempSched = nullptr; // Schedule
508 : Real64 SetPointTemp; // Setpoint temperature of auxiliary heater 1 (C)
509 : Real64 DeadBandDeltaTemp; // Deadband temperature difference of auxiliary heater 1 (deltaC)
510 : Real64 TankTempLimit; // Maximum tank temperature limit before venting (C)
511 : Real64 IgnitionDelay; // Time delay before heater is allowed to turn on (s)
512 : Real64 OffCycParaLoad; // Rate for off-cycle parasitic load (W)
513 : Constant::eFuel OffCycParaFuelType; // Fuel type for off-cycle parasitic load
514 : Real64 OffCycParaFracToTank; // Fraction of off-cycle parasitic energy ending up in tank (W)
515 : Real64 OnCycParaLoad; // Rate for on-cycle parasitic load (W)
516 : Constant::eFuel OnCycParaFuelType; // Fuel type for on-cycle parasitic load
517 : Real64 OnCycParaFracToTank; // Fraction of on-cycle parasitic energy ending up in tank (W)
518 : DataPlant::FlowLock UseCurrentFlowLock; // current flow lock setting on use side
519 : int UseInletNode; // Inlet node on the use side; colder water returning to a hottank
520 : Real64 UseInletTemp; // Use side inlet temperature (C)
521 : int UseOutletNode; // Outlet node on the use side; hot tank water
522 : Real64 UseOutletTemp; // Use side outlet temperature (C)
523 : Real64 UseMassFlowRate; // Mass flow rate on the use side (kg/s)
524 : Real64 UseEffectiveness; // Heat transfer effectiveness on use side ()
525 : Real64 PlantUseMassFlowRateMax; // Plant demand-side max flow request on use side (kg/s)
526 : Real64 SavedUseOutletTemp; // Use side outlet temp saved for demand-side flow control (C)
527 : Real64 UseDesignVolFlowRate; // Use side plant volume flow rate (input data, autosizable) m3/s
528 : bool UseDesignVolFlowRateWasAutoSized; // true if use flow rate was autosize on input
529 : DataBranchAirLoopPlant::ControlType UseBranchControlType; // Use side plant branch control type e.g active, passive, bypass
530 : int UseSidePlantSizNum; // index in plant sizing that the use side is on
531 : bool UseSideSeries;
532 : Sched::Schedule *useSideAvailSched = nullptr; // use side availability schedule
533 : Real64 UseSideLoadRequested; // hold MyLoad request from plant management.
534 : PlantLocation UseSidePlantLoc;
535 : int SourceInletNode; // Inlet node for the source side; hot water from supply
536 : Real64 SourceInletTemp; // Source side inlet temperature (C)
537 : int SourceOutletNode; // Outlet node for the source side; colder tank water
538 : Real64 SourceOutletTemp; // Source side outlet temperature (C)
539 : Real64 SourceMassFlowRate; // Mass flow rate on the source side (kg/s)
540 : Real64 SourceEffectiveness; // Heat transfer effectiveness on source side ()
541 : Real64 PlantSourceMassFlowRateMax; // Plant demand-side max flow request on source side (kg/s)
542 : Real64 SavedSourceOutletTemp; // Source side outlet temp saved for demand-side flow control (C)
543 : Real64 SourceDesignVolFlowRate; // Source side plant volume flow rate (input, autosizable) m3/s
544 : bool SourceDesignVolFlowRateWasAutoSized; // true if source flow rate was autosize on input
545 : DataBranchAirLoopPlant::ControlType SourceBranchControlType; // source side plant branch control type e.g active, passive, bypass
546 : int SourceSidePlantSizNum; // index in plant sizing that the source side is on
547 : bool SourceSideSeries;
548 : Sched::Schedule *sourceSideAvailSched = nullptr; // source side availability schedule.
549 : PlantLocation SrcSidePlantLoc;
550 : SourceSideControl SourceSideControlMode; // flag for how source side flow is controlled
551 : Sched::Schedule *sourceSideAltSetpointSched = nullptr; // schedule of alternate temperature setpoint values
552 : Real64 SizingRecoveryTime; // sizing parameter for autosizing indirect water heaters (hr)
553 : Real64 MassFlowRateMax; // Maximum flow rate for scheduled DHW (kg/s)
554 : Real64 VolFlowRateMin; // Minimum flow rate for heater ignition (kg/s)
555 : Real64 MassFlowRateMin; // Minimum mass flow rate for heater ignition (kg/s)
556 : Sched::Schedule *flowRateSched = nullptr; // Schedule
557 : Sched::Schedule *useInletTempSched = nullptr; // Cold water supply temperature schedule
558 : Real64 TankTemp; // Temperature of tank fluid (average, if stratified) (C)
559 : Real64 SavedTankTemp; // Tank temp that is carried from time step to time step (C)
560 : Real64 TankTempAvg; // Average tank temperature over the time step (C)
561 : // Stratified variables (in addition to the above)
562 : Real64 Height; // Height of tank (m)
563 : bool HeightWasAutoSized; // true if the height of tank was autosize on input
564 : Real64 Perimeter; // Perimeter of tank (m), only used for OTHER shape
565 : TankShape Shape; // Tank shape: VERTICAL CYLINDER, HORIZONTAL CYLINDER, or OTHER
566 : Real64 HeaterHeight1;
567 : int HeaterNode1;
568 : bool HeaterOn1;
569 : bool SavedHeaterOn1;
570 : Real64 HeaterHeight2;
571 : int HeaterNode2;
572 : bool HeaterOn2;
573 : bool SavedHeaterOn2;
574 : Real64 AdditionalCond; // Additional destratification conductivity (W/m K)
575 : Real64 SetPointTemp2; // Setpoint temperature of auxiliary heater 2 (C)
576 : Sched::Schedule *setptTemp2Sched = nullptr;
577 : Real64 DeadBandDeltaTemp2;
578 : Real64 MaxCapacity2;
579 : Real64 OffCycParaHeight;
580 : Real64 OnCycParaHeight;
581 : Real64 SkinLossCoeff;
582 : Real64 SkinLossFracToZone;
583 : Real64 OffCycFlueLossCoeff;
584 : Real64 OffCycFlueLossFracToZone;
585 : Real64 UseInletHeight; // Height of use side inlet (m)
586 : Real64 UseOutletHeight; // Height of use side outlet (m)
587 : bool UseOutletHeightWasAutoSized; // true if use outlet height was autosize on input
588 : Real64 SourceInletHeight; // Height of source side inlet (m)
589 : bool SourceInletHeightWasAutoSized; // true if source inlet height was autosize on input
590 : Real64 SourceOutletHeight; // Height of source side outlet (m)
591 : int UseInletStratNode; // Use-side inlet node number
592 : int UseOutletStratNode; // Use-side outlet node number
593 : int SourceInletStratNode; // Source-side inlet node number
594 : int SourceOutletStratNode; // Source-side outlet node number
595 : InletPositionMode InletMode; // Inlet position mode: 1 = FIXED; 2 = SEEKING
596 : Real64 InversionMixingRate;
597 : Array1D<Real64> AdditionalLossCoeff; // Loss coefficient added to the skin loss coefficient (W/m2-K)
598 : int Nodes; // Number of nodes
599 : Array1D<StratifiedNodeData> Node; // Array of node data
600 : // Report variables
601 : Real64 VolFlowRate; // Scheduled DHW demand (m3/s)
602 : Real64 VolumeConsumed; // Volume of DHW consumed (m3)
603 : Real64 UnmetRate; // Energy demand to heat tank water to setpoint (W)
604 : Real64 LossRate; // Energy demand to support heat losses due to ambient temp (W)
605 : Real64 FlueLossRate; // Heat loss rate to flue (W)
606 : Real64 UseRate; // Energy demand to heat the Use Side water to tank temp (W)
607 : Real64 TotalDemandRate; // Total demand rate (sum of all above rates) (W)
608 : Real64 SourceRate; // Energy supplied by the source side to help heat the tank (W)
609 : Real64 HeaterRate; // The energy the water heater burner puts into the water (W)
610 : Real64 HeaterRate1; // The energy heater 1 puts into the water (W)
611 : Real64 HeaterRate2; // The energy heater 2 puts into the water (W)
612 : Real64 FuelRate; // The fuel consumption rate for the water heater burner (W)
613 : Real64 FuelRate1; // The fuel consumption rate for heater 1 (W)
614 : Real64 FuelRate2; // The fuel consumption rate for heater 2 (W)
615 : Real64 VentRate; // Heat recovery energy lost due to setpoint temp (W)
616 : Real64 OffCycParaFuelRate; // Fuel consumption rate for off-cycle parasitic load (W)
617 : Real64 OffCycParaRateToTank; // Heat rate to tank for off-cycle parasitic load (W)
618 : Real64 OnCycParaFuelRate; // Fuel consumption rate for on-cycle parasitic load (W)
619 : Real64 OnCycParaRateToTank; // Heat rate to tank for on-cycle parasitic load (W)
620 : Real64 NetHeatTransferRate; // Net heat transfer rate to/from tank (W)
621 : int CycleOnCount; // Number of times heater cycles on in the current time step
622 : int CycleOnCount1; // Number of times heater 1 cycles on in the current time step
623 : int CycleOnCount2; // Number of times heater 2 cycles on in the current time step
624 : Real64 RuntimeFraction; // Runtime fraction, fraction of timestep that any heater is running
625 : Real64 RuntimeFraction1; // Runtime fraction, fraction of timestep that heater 1 is running
626 : Real64 RuntimeFraction2; // Runtime fraction, fraction of timestep that heater 2 is running
627 : Real64 PartLoadRatio; // Part load ratio, fraction of maximum heater capacity
628 : Real64 UnmetEnergy; // Energy to heat tank water to setpoint (J)
629 : Real64 LossEnergy; // Energy to support heat losses due to ambient temp (J)
630 : Real64 FlueLossEnergy; // Energy to support heat losses to the flue (J)
631 : Real64 UseEnergy; // Energy to heat the use side water to tank temp (J)
632 : Real64 TotalDemandEnergy; // Total energy demand (sum of all above energies) (J)
633 : Real64 SourceEnergy; // Energy supplied by the source side to help heat the tank (J)
634 : Real64 HeaterEnergy; // The energy the water heater burner puts into the water (J)
635 : Real64 HeaterEnergy1; // The energy heater 1 puts into the water (J)
636 : Real64 HeaterEnergy2; // The energy heater 2 puts into the water (J)
637 : Real64 FuelEnergy; // The fuel consumption energy for the water heater burner (J)
638 : Real64 FuelEnergy1; // The fuel consumption energy for heater 1 (J)
639 : Real64 FuelEnergy2; // The fuel consumption energy for heater 2 (J)
640 : Real64 VentEnergy; // Heat recovery energy lost due to setpoint temp (J)
641 : Real64 OffCycParaFuelEnergy; // Fuel consumption energy for off-cycle parasitic load (J)
642 : Real64 OffCycParaEnergyToTank; // Energy to tank for off-cycle parasitic load (J)
643 : Real64 OnCycParaFuelEnergy; // Fuel consumption energy for on-cycle parasitic load (J)
644 : Real64 OnCycParaEnergyToTank; // Energy to tank for on-cycle parasitic load (J)
645 : Real64 NetHeatTransferEnergy; // Net heat transfer energy to/from tank (J)
646 : bool FirstRecoveryDone; // Flag to indicate when first recovery to the setpoint is done
647 : Real64 FirstRecoveryFuel; // Fuel energy needed for first recovery to the setpoint (J)
648 : int HeatPumpNum; // Index to heat pump water heater
649 : int DesuperheaterNum; // Index to desuperheating coil
650 : bool ShowSetPointWarning; // Warn when set point is greater than max tank temp limit
651 : int MaxCycleErrorIndex; // recurring error index
652 : int FreezingErrorIndex; // recurring error index for freeze conditions
653 : WaterHeaterSizingData Sizing; // ancillary data for autosizing
654 :
655 : Fluid::GlycolProps *water = nullptr; // Water properties
656 :
657 : bool MyOneTimeFlagWH; // first pass log
658 : bool MyTwoTimeFlagWH; // second pass do input check
659 : bool MyEnvrnFlag;
660 : bool WarmupFlag;
661 : bool SetLoopIndexFlag;
662 : bool AlreadyReported;
663 : bool AlreadyRated;
664 : bool MyHPSizeFlag;
665 : bool CheckWTTEquipName;
666 :
667 : std::string InletNodeName1;
668 : std::string OutletNodeName1;
669 : std::string InletNodeName2;
670 : std::string OutletNodeName2;
671 :
672 : bool myOneTimeInitFlag;
673 : bool scanPlantLoopsFlag;
674 :
675 : int callerLoopNum;
676 : int waterIndex;
677 :
678 1 : ~WaterThermalTankData() = default;
679 :
680 : // Default Constructor
681 34 : WaterThermalTankData()
682 102 : : WaterThermalTankType(DataPlant::PlantEquipmentType::Invalid), IsChilledWaterTank(false), Init(true), StandAlone(false), Volume(0.0),
683 34 : VolumeWasAutoSized(false), Mass(0.0), TimeElapsed(0.0), AmbientTempIndicator(WTTAmbientTemp::OutsideAir), AmbientTempZone(0),
684 34 : AmbientTempOutsideAirNode(0), AmbientTemp(0.0), AmbientZoneGain(0.0), LossCoeff(0.0), OffCycLossCoeff(0.0), OffCycLossFracToZone(0.0),
685 34 : OnCycLossCoeff(0.0), OnCycLossFracToZone(0.0), ControlType(HeaterControlMode::Cycle),
686 34 : StratifiedControlMode(PriorityControlMode::Invalid), MaxCapacity(0.0), MaxCapacityWasAutoSized(false), MinCapacity(0.0),
687 34 : Efficiency(0.0), PLFCurve(0), SetPointTemp(0.0), DeadBandDeltaTemp(0.0), TankTempLimit(0.0), IgnitionDelay(0.0), OffCycParaLoad(0.0),
688 34 : OffCycParaFracToTank(0.0), OnCycParaLoad(0.0), OnCycParaFracToTank(0.0), UseCurrentFlowLock(DataPlant::FlowLock::Unlocked),
689 34 : UseInletNode(0), UseInletTemp(0.0), UseOutletNode(0), UseOutletTemp(0.0), UseMassFlowRate(0.0), UseEffectiveness(0.0),
690 34 : PlantUseMassFlowRateMax(0.0), SavedUseOutletTemp(0.0), UseDesignVolFlowRate(0.0), UseDesignVolFlowRateWasAutoSized(false),
691 34 : UseBranchControlType(DataBranchAirLoopPlant::ControlType::Passive), UseSidePlantSizNum(0), UseSideSeries(true),
692 68 : UseSideLoadRequested(0.0), UseSidePlantLoc{}, SourceInletNode(0), SourceInletTemp(0.0), SourceOutletNode(0), SourceOutletTemp(0.0),
693 34 : SourceMassFlowRate(0.0), SourceEffectiveness(0.0), PlantSourceMassFlowRateMax(0.0), SavedSourceOutletTemp(0.0),
694 34 : SourceDesignVolFlowRate(0.0), SourceDesignVolFlowRateWasAutoSized(false),
695 34 : SourceBranchControlType(DataBranchAirLoopPlant::ControlType::Passive), SourceSidePlantSizNum(0),
696 68 : SourceSideSeries(true), SrcSidePlantLoc{}, SourceSideControlMode(SourceSideControl::IndirectHeatAltSetpoint), SizingRecoveryTime(0.0),
697 34 : MassFlowRateMax(0.0), VolFlowRateMin(0.0), MassFlowRateMin(0.0), TankTemp(0.0), SavedTankTemp(0.0), TankTempAvg(0.0), Height(0.0),
698 34 : HeightWasAutoSized(false), Perimeter(0.0), Shape(TankShape::VertCylinder), HeaterHeight1(0.0), HeaterNode1(0), HeaterOn1(false),
699 34 : SavedHeaterOn1(false), HeaterHeight2(0.0), HeaterNode2(0), HeaterOn2(false), SavedHeaterOn2(false), AdditionalCond(0.0),
700 34 : SetPointTemp2(0.0), DeadBandDeltaTemp2(0.0), MaxCapacity2(0.0), OffCycParaHeight(0.0), OnCycParaHeight(0.0), SkinLossCoeff(0.0),
701 34 : SkinLossFracToZone(0.0), OffCycFlueLossCoeff(0.0), OffCycFlueLossFracToZone(0.0), UseInletHeight(0.0), UseOutletHeight(0.0),
702 34 : UseOutletHeightWasAutoSized(false), SourceInletHeight(0.0), SourceInletHeightWasAutoSized(false), SourceOutletHeight(0.0),
703 34 : UseInletStratNode(0), UseOutletStratNode(0), SourceInletStratNode(0), SourceOutletStratNode(0), InletMode(InletPositionMode::Fixed),
704 102 : InversionMixingRate(0.0), Nodes(0), VolFlowRate(0.0), VolumeConsumed(0.0), UnmetRate(0.0), LossRate(0.0), FlueLossRate(0.0),
705 34 : UseRate(0.0), TotalDemandRate(0.0), SourceRate(0.0), HeaterRate(0.0), HeaterRate1(0.0), HeaterRate2(0.0), FuelRate(0.0), FuelRate1(0.0),
706 34 : FuelRate2(0.0), VentRate(0.0), OffCycParaFuelRate(0.0), OffCycParaRateToTank(0.0), OnCycParaFuelRate(0.0), OnCycParaRateToTank(0.0),
707 34 : NetHeatTransferRate(0.0), CycleOnCount(0), CycleOnCount1(0), CycleOnCount2(0), RuntimeFraction(0.0), RuntimeFraction1(0.0),
708 34 : RuntimeFraction2(0.0), PartLoadRatio(0.0), UnmetEnergy(0.0), LossEnergy(0.0), FlueLossEnergy(0.0), UseEnergy(0.0),
709 34 : TotalDemandEnergy(0.0), SourceEnergy(0.0), HeaterEnergy(0.0), HeaterEnergy1(0.0), HeaterEnergy2(0.0), FuelEnergy(0.0), FuelEnergy1(0.0),
710 34 : FuelEnergy2(0.0), VentEnergy(0.0), OffCycParaFuelEnergy(0.0), OffCycParaEnergyToTank(0.0), OnCycParaFuelEnergy(0.0),
711 34 : OnCycParaEnergyToTank(0.0), NetHeatTransferEnergy(0.0), FirstRecoveryDone(false), FirstRecoveryFuel(0.0), HeatPumpNum(0),
712 68 : DesuperheaterNum(0), ShowSetPointWarning(true), MaxCycleErrorIndex(0), FreezingErrorIndex(0), MyOneTimeFlagWH(true),
713 34 : MyTwoTimeFlagWH(true), MyEnvrnFlag(true), WarmupFlag(false), SetLoopIndexFlag(true), AlreadyReported(false), AlreadyRated(false),
714 34 : MyHPSizeFlag(true), CheckWTTEquipName(true), myOneTimeInitFlag(true), scanPlantLoopsFlag(true), callerLoopNum(0), waterIndex(1)
715 : {
716 34 : }
717 :
718 : static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
719 :
720 : void setupOutputVars(EnergyPlusData &state);
721 :
722 : void setupZoneInternalGains(EnergyPlusData &state);
723 :
724 : void setupChilledWaterTankOutputVars(EnergyPlusData &state);
725 :
726 : void setupWaterHeaterOutputVars(EnergyPlusData &state);
727 :
728 : void
729 : simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override;
730 :
731 : Real64 PartLoadFactor(EnergyPlusData &state, Real64 PartLoadRatio_loc);
732 :
733 : void CalcNodeMassFlows(InletPositionMode inletMode);
734 :
735 : void SetupStratifiedNodes(EnergyPlusData &state);
736 :
737 : void initialize(EnergyPlusData &state, bool FirstHVACIteration);
738 :
739 : bool SourceHeatNeed(EnergyPlusData &state, Real64 OutletTemp, Real64 DeadBandTemp, Real64 SetPointTemp_loc);
740 :
741 : void SizeDemandSidePlantConnections(EnergyPlusData &state);
742 :
743 : void SizeTankForSupplySide(EnergyPlusData &state);
744 :
745 : void SizeTankForDemandSide(EnergyPlusData &state);
746 :
747 : void MinePlantStructForInfo(EnergyPlusData &state);
748 :
749 : void SizeSupplySidePlantConnections(EnergyPlusData &state, const int loopNum);
750 :
751 : void CalcWaterThermalTank(EnergyPlusData &state);
752 :
753 : void SizeStandAloneWaterHeater(EnergyPlusData &state);
754 :
755 : void UpdateWaterThermalTank(EnergyPlusData &state);
756 :
757 : void ReportWaterThermalTank(EnergyPlusData &state);
758 :
759 : void CalcWaterThermalTankStratified(EnergyPlusData &state); // Water Heater being simulated
760 :
761 : void CalcWaterThermalTankMixed(EnergyPlusData &state); // Water Heater being simulated
762 :
763 : void CalcStandardRatings(EnergyPlusData &state);
764 :
765 : void ReportCWTankInits(EnergyPlusData &state);
766 :
767 : Real64 GetHPWHSensedTankTemp(EnergyPlusData &state);
768 :
769 : Real64 FindStratifiedTankSensedTemp(EnergyPlusData &state, bool UseAverage = false);
770 :
771 : Real64 getDeadBandTemp();
772 :
773 : Real64 PlantMassFlowRatesFunc(EnergyPlusData &state,
774 : int InNodeNum,
775 : bool FirstHVACIteration,
776 : WaterHeaterSide WaterThermalTankSide,
777 : DataPlant::LoopSideLocation PlantLoopSide,
778 : bool PlumbedInSeries, // !unused1208
779 : DataBranchAirLoopPlant::ControlType BranchControlType,
780 : Real64 OutletTemp,
781 : Real64 DeadBandTemp,
782 : Real64 SetPointTemp_loc);
783 :
784 : static Real64 CalcTimeNeeded(Real64 Ti, // Initial tank temperature (C)
785 : Real64 Tf, // Final tank temperature (C)
786 : Real64 Ta, // Ambient environment temperature (C)
787 : Real64 T1, // Temperature of flow 1 (C)
788 : Real64 T2, // Temperature of flow 2 (C)
789 : Real64 m, // Mass of tank fluid (kg)
790 : Real64 Cp, // Specific heat of fluid (J/kg deltaC)
791 : Real64 m1, // Mass flow rate 1 (kg/s)
792 : Real64 m2, // Mass flow rate 2 (kg/s)
793 : Real64 UA, // Heat loss coefficient to ambient environment (W/deltaC)
794 : Real64 Q // Net heating rate for non-temp dependent sources, i.e. heater and parasitics (W)
795 : );
796 :
797 : static Real64 CalcTankTemp(Real64 Ti, // Initial tank temperature (C)
798 : Real64 Ta, // Ambient environment temperature (C)
799 : Real64 T1, // Temperature of flow 1 (C)
800 : Real64 T2, // Temperature of flow 2 (C)
801 : Real64 m, // Mass of tank fluid (kg)
802 : Real64 Cp, // Specific heat of fluid (J/kg deltaC)
803 : Real64 m1, // Mass flow rate 1 (kg/s)
804 : Real64 m2, // Mass flow rate 2 (kg/s)
805 : Real64 UA, // Heat loss coefficient to ambient environment (W/deltaC)
806 : Real64 Q, // Net heating rate for non-temp dependent sources, i.e. heater and parasitics (W)
807 : Real64 t // Time elapsed from Ti to Tf (s)
808 : );
809 :
810 : static Real64 CalcTempIntegral(Real64 Ti, // Initial tank temperature (C)
811 : Real64 Tf, // Final tank temperature (C)
812 : Real64 Ta, // Ambient environment temperature (C)
813 : Real64 T1, // Temperature of flow 1 (C)
814 : Real64 T2, // Temperature of flow 2 (C)
815 : Real64 m, // Mass of tank fluid (kg)
816 : Real64 Cp, // Specific heat of fluid (J/kg deltaC)
817 : Real64 m1, // Mass flow rate 1 (kg/s)
818 : Real64 m2, // Mass flow rate 2 (kg/s)
819 : Real64 UA, // Heat loss coefficient to ambient environment (W/deltaC)
820 : Real64 Q, // Net heating rate for non-temp dependent sources, i.e. heater and parasitics (W)
821 : Real64 t // Time elapsed from Ti to Tf (s)
822 : );
823 :
824 : static void CalcMixedTankSourceSideHeatTransferRate(Real64 HPWHCondenserDeltaT, // input, The temperature difference (C) across the heat pump,
825 : // zero if there is no heat pump or if the heat pump is off
826 : Real64 SourceInletTemp, // input, Source inlet temperature (C)
827 : Real64 Cp, // Specific heat of fluid (J/kg deltaC)
828 : Real64 SetPointTemp, // input, Mixed tank set point temperature
829 : Real64 &SourceMassFlowRate, // source mass flow rate (kg/s)
830 : Real64 &Qheatpump, // heat transfer rate from heat pump
831 : Real64 &Qsource // steady state heat transfer rate from a constant source side flow
832 : );
833 :
834 : void CalcDesuperheaterWaterHeater(EnergyPlusData &state, bool FirstHVACIteration);
835 :
836 : Real64 PLRResidualWaterThermalTank(EnergyPlusData &state,
837 : Real64 HPPartLoadRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
838 : Array1D<Real64> const &Par // par(1) = HP set point temperature [C]
839 : );
840 :
841 : void CalcHeatPumpWaterHeater(EnergyPlusData &state, bool FirstHVACIteration);
842 :
843 : void ConvergeSingleSpeedHPWHCoilAndTank(EnergyPlusData &state, Real64 partLoadRatio);
844 :
845 : void SetVSHPWHFlowRates(EnergyPlusData &state,
846 : HeatPumpWaterHeaterData &HPWH,
847 : int SpeedNum,
848 : Real64 SpeedRatio,
849 : Real64 WaterDens,
850 : Real64 &MdotWater, // water flow rate
851 : bool FirstHVACIteration // TRUE if First iteration of simulation
852 : );
853 :
854 : Real64 PLRResidualHPWH(EnergyPlusData &state, Real64 HPPartLoadRatio, Real64 desTankTemp, TankOperatingMode mode, Real64 mDotWater);
855 :
856 : Real64 PLRResidualIterSpeed(EnergyPlusData &state,
857 : Real64 SpeedRatio, // speed ratio between two speed levels
858 : int HPNum,
859 : int SpeedNum,
860 : int HPWaterInletNode,
861 : int HPWaterOutletNode,
862 : Real64 RhoWater,
863 : Real64 desTankTemp,
864 : TankOperatingMode mode,
865 : bool FirstHVACIteration);
866 :
867 : static void ValidatePLFCurve(EnergyPlusData &state, int CurveIndex, bool &IsValid);
868 :
869 : void onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
870 :
871 : void getDesignCapacities(EnergyPlusData &state,
872 : [[maybe_unused]] const PlantLocation &calledFromLocation,
873 : Real64 &MaxLoad,
874 : Real64 &MinLoad,
875 : Real64 &OptLoad) override;
876 :
877 : void oneTimeInit(EnergyPlusData &state) override;
878 :
879 : void setBackupElementCapacity(EnergyPlusData &state);
880 : };
881 :
882 : struct WaterHeaterDesuperheaterData
883 : {
884 : // Members
885 : std::string Name; // Name of heat pump water heater desuperheater
886 : std::string Type; // Type of water heater desuperheating coil
887 : int InsuffTemperatureWarn; // Used for recurring error count on low source temperature
888 : Sched::Schedule *availSched = nullptr; // Availability Schedule
889 : Sched::Schedule *setptTempSched = nullptr; // Setpoint Temperature Schedule
890 : Real64 DeadBandTempDiff; // Dead band temperature difference (cut-in temperature)
891 : Real64 HeatReclaimRecoveryEff; // recovery efficiency of desuperheater (0.3 max)
892 : int WaterInletNode; // Desuperheater water inlet node
893 : int WaterOutletNode; // Desuperheater water outlet node
894 : Real64 RatedInletWaterTemp; // Inlet water temp at rated heat reclaim recovery eff (C)
895 : Real64 RatedOutdoorAirTemp; // Outdoor air temp at rated heat reclaim recovery eff (C)
896 : Real64 MaxInletWaterTemp; // Max water temp for heat reclaim recovery (C)
897 : std::string TankType; // Type of water heater (MIXED or STRATIFIED)
898 : DataPlant::PlantEquipmentType TankTypeNum; // Parameter for tank type (MIXED or STRATIFIED)
899 : std::string TankName; // Name of tank associated with desuperheater
900 : int TankNum;
901 : bool StandAlone; // Flag for operation with no plant connections (no use nodes)
902 : std::string HeatingSourceType; // Type of heating source (DX coil or refrigerated rack)
903 : std::string HeatingSourceName; // Name of heating source
904 : Real64 HeaterRate; // Report variable for desuperheater heating rate [W]
905 : Real64 HeaterEnergy; // Report variable for desuperheater heating energy [J]
906 : Real64 PumpPower; // Report variable for water circulation pump power [W]
907 : Real64 PumpEnergy; // Report variable for water circulation pump energy [J]
908 : Real64 PumpElecPower; // Nominal power input to the water circulation pump [W]
909 : Real64 PumpFracToWater; // Nominal power fraction to water for the water circulation pump
910 : Real64 OperatingWaterFlowRate; // Operating volumetric water flow rate (m3/s)
911 : int HEffFTemp; // Heating capacity as a function of temperature curve index
912 : Real64 HEffFTempOutput; // report variable for HEffFTemp curve
913 : Real64 SetPointTemp; // set point or cut-out temperature [C]
914 : int WaterHeaterTankNum; // Index of Water Heater Tank
915 : Real64 DesuperheaterPLR; // part load ratio of desuperheater
916 : Real64 OnCycParaLoad; // Rate for on-cycle parasitic load (W)
917 : Real64 OffCycParaLoad; // Rate for off-cycle parasitic load (W)
918 : Real64 OnCycParaFuelEnergy; // Electric energy consumption for on-cycle parasitic load (J)
919 : Real64 OnCycParaFuelRate; // Electric consumption rate for on-cycle parasitic load (W)
920 : Real64 OffCycParaFuelEnergy; // Electric energy consumption for off-cycle parasitic load (J)
921 : Real64 OffCycParaFuelRate; // Electric consumption rate for off-cycle parasitic load (W)
922 : TankOperatingMode Mode = TankOperatingMode::Floating; // mode
923 : TankOperatingMode SaveMode = TankOperatingMode::Floating; // desuperheater mode on first iteration
924 : TankOperatingMode SaveWHMode = TankOperatingMode::Floating; // mode of water heater tank element (backup element)
925 : Real64 BackupElementCapacity; // Tank backup element capacity (W)
926 : Real64 DXSysPLR; // runtime fraction of desuperheater heating coil
927 : int ReclaimHeatingSourceIndexNum; // Index to reclaim heating source (condenser) of a specific type
928 : ReclaimHeatObjectType ReclaimHeatingSource; // The source for the Desuperheater Heating Coil
929 : int SetPointError; // Used when temp SP in tank and desuperheater are reversed
930 : int SetPointErrIndex1; // Index to recurring error for tank/desuperheater set point temp
931 : int IterLimitErrIndex1; // Index for recurring iteration limit warning messages
932 : int IterLimitExceededNum1; // Counter for recurring iteration limit warning messages
933 : int RegulaFalsiFailedIndex1; // Index for recurring RegulaFalsi failed warning messages
934 : int RegulaFalsiFailedNum1; // Counter for recurring RegulaFalsi failed warning messages
935 : int IterLimitErrIndex2; // Index for recurring iteration limit warning messages
936 : int IterLimitExceededNum2; // Counter for recurring iteration limit warning messages
937 : int RegulaFalsiFailedIndex2; // Index for recurring RegulaFalsi failed warning messages
938 : int RegulaFalsiFailedNum2; // Counter for recurring RegulaFalsi failed warning messages
939 : bool FirstTimeThroughFlag; // Flag for saving water heater status
940 : bool ValidSourceType;
941 :
942 : std::string InletNodeName1;
943 : std::string OutletNodeName1;
944 : std::string InletNodeName2;
945 : std::string OutletNodeName2;
946 :
947 : // Default Constructor
948 7 : WaterHeaterDesuperheaterData()
949 14 : : InsuffTemperatureWarn(0), DeadBandTempDiff(0.0), HeatReclaimRecoveryEff(0.0), WaterInletNode(0), WaterOutletNode(0),
950 14 : RatedInletWaterTemp(0.0), RatedOutdoorAirTemp(0.0), MaxInletWaterTemp(0.0), TankTypeNum(DataPlant::PlantEquipmentType::Invalid),
951 14 : TankNum(0), StandAlone(false), HeaterRate(0.0), HeaterEnergy(0.0), PumpPower(0.0), PumpEnergy(0.0), PumpElecPower(0.0),
952 7 : PumpFracToWater(0.0), OperatingWaterFlowRate(0.0), HEffFTemp(0), HEffFTempOutput(0.0), SetPointTemp(0.0), WaterHeaterTankNum(0),
953 7 : DesuperheaterPLR(0.0), OnCycParaLoad(0.0), OffCycParaLoad(0.0), OnCycParaFuelEnergy(0.0), OnCycParaFuelRate(0.0),
954 7 : OffCycParaFuelEnergy(0.0), OffCycParaFuelRate(0.0), BackupElementCapacity(0.0), DXSysPLR(0.0), ReclaimHeatingSourceIndexNum(0),
955 7 : ReclaimHeatingSource(ReclaimHeatObjectType::DXCooling), SetPointError(0), SetPointErrIndex1(0), IterLimitErrIndex1(0),
956 7 : IterLimitExceededNum1(0), RegulaFalsiFailedIndex1(0), RegulaFalsiFailedNum1(0), IterLimitErrIndex2(0), IterLimitExceededNum2(0),
957 7 : RegulaFalsiFailedIndex2(0), RegulaFalsiFailedNum2(0), FirstTimeThroughFlag(true), ValidSourceType(false)
958 : {
959 7 : }
960 : };
961 :
962 : // Functions
963 :
964 : void SimulateWaterHeaterStandAlone(EnergyPlusData &state, int WaterHeaterNum, bool FirstHVACIteration);
965 :
966 : void SimHeatPumpWaterHeater(EnergyPlusData &state,
967 : std::string_view CompName,
968 : bool FirstHVACIteration,
969 : Real64 &SensLoadMet, // sensible load met by this equipment and sent to zone, W
970 : Real64 &LatLoadMet, // net latent load met and sent to zone (kg/s), dehumid = negative
971 : int &CompIndex);
972 :
973 : bool getDesuperHtrInput(EnergyPlusData &state);
974 :
975 : bool getHPWaterHeaterInput(EnergyPlusData &state);
976 :
977 : bool getWaterHeaterMixedInputs(EnergyPlusData &state);
978 :
979 : bool getWaterHeaterStratifiedInput(EnergyPlusData &state);
980 :
981 : bool getWaterTankMixedInput(EnergyPlusData &state);
982 :
983 : bool getWaterTankStratifiedInput(EnergyPlusData &state);
984 :
985 : bool GetWaterThermalTankInput(EnergyPlusData &state);
986 :
987 : void CalcWaterThermalTankZoneGains(EnergyPlusData &state);
988 :
989 : int getTankIDX(EnergyPlusData &state, std::string_view CompName, int &CompIndex);
990 :
991 : int getHPTankIDX(EnergyPlusData &state, std::string_view CompName, int &CompIndex);
992 :
993 : bool GetHeatPumpWaterHeaterNodeNumber(EnergyPlusData &state, int NodeNumber);
994 :
995 : int getHeatPumpWaterHeaterIndex(EnergyPlusData &state, std::string_view CompName);
996 :
997 : } // namespace WaterThermalTanks
998 :
999 : struct WaterThermalTanksData : BaseGlobalStruct
1000 : {
1001 : int numChilledWaterMixed = 0; // number of mixed chilled water tanks
1002 : int numChilledWaterStratified = 0; // number of stratified chilled water tanks
1003 : int numWaterHeaterMixed = 0; // number of mixed water heaters
1004 : int numWaterHeaterStratified = 0; // number of stratified water heaters
1005 : int numWaterThermalTank = 0; // total number of water thermal tanks, hot and cold (MIXED + STRATIFIED)
1006 : int numWaterHeaterDesuperheater = 0; // number of desuperheater heating coils
1007 : int numHeatPumpWaterHeater = 0; // number of heat pump water heaters
1008 : int numWaterHeaterSizing = 0; // Number of sizing/design objects for water heaters.
1009 :
1010 : Real64 hpPartLoadRatio = 0.0; // part load ratio of HPWH
1011 : Real64 mixerInletAirSchedule = 0.0; // output of inlet air mixer node schedule
1012 : Real64 mdotAir = 0.0; // mass flow rate of evaporator air, kg/s
1013 :
1014 : Array1D<WaterThermalTanks::WaterThermalTankData> WaterThermalTank;
1015 : Array1D<WaterThermalTanks::HeatPumpWaterHeaterData> HPWaterHeater;
1016 : Array1D<WaterThermalTanks::WaterHeaterDesuperheaterData> WaterHeaterDesuperheater;
1017 : std::unordered_map<std::string, std::string> UniqueWaterThermalTankNames;
1018 :
1019 : bool getWaterThermalTankInputFlag = true; // Calls to Water Heater from multiple places in code
1020 : bool calcWaterThermalTankZoneGainsMyEnvrnFlag = true;
1021 :
1022 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
1023 : {
1024 2126 : }
1025 :
1026 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
1027 : {
1028 1152 : }
1029 :
1030 2100 : void clear_state() override
1031 : {
1032 2100 : new (this) WaterThermalTanksData();
1033 2100 : }
1034 : };
1035 :
1036 : } // namespace EnergyPlus
1037 :
1038 : #endif
|