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 HeatRecovery_hh_INCLUDED
49 : #define HeatRecovery_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Optional.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 :
59 : namespace EnergyPlus {
60 :
61 : // Forward declarations
62 : struct EnergyPlusData;
63 :
64 : namespace HeatRecovery {
65 :
66 : enum class HXConfiguration
67 : {
68 : Invalid = -1,
69 : CounterFlow,
70 : ParallelFlow,
71 : CrossFlowBothUnmixed,
72 : CrossFlowOther,
73 : Num
74 : };
75 :
76 : enum class HXConfigurationType
77 : {
78 : Invalid = -1,
79 : Plate,
80 : Rotary,
81 : Num
82 : };
83 :
84 : enum class FrostControlOption
85 : {
86 : Invalid = -1,
87 : None,
88 : ExhaustOnly,
89 : ExhaustAirRecirculation,
90 : MinimumExhaustTemperature,
91 : Num
92 : };
93 :
94 : // invalid and num are not used for this internal enum class, but if I leave them out, the custom_check script complains
95 : // I'm not sure whether to leave them in unused, or add them to the exception list in the script
96 : // leaving them for now.
97 : enum class CalculateNTUBoundsErrors
98 : {
99 : Invalid = -1,
100 : NoError,
101 : MassFlowRatio,
102 : NominalEffectiveness1,
103 : NominalEffectiveness2,
104 : Quantity,
105 : NominalEffectiveness3,
106 : Num
107 : };
108 :
109 : struct HeatExchCond
110 : {
111 : std::string Name; // name of component
112 : HVAC::HXType type = HVAC::HXType::Invalid;
113 : std::string HeatExchPerfName; // Desiccant balanced heat exchanger performance data name
114 : Sched::Schedule *availSched = nullptr; // schedule // availability ?
115 : HXConfiguration FlowArr = HXConfiguration::Invalid; // flow Arrangement:
116 : bool EconoLockOut = false;
117 : Real64 hARatio = 0.0; // ratio of supply side h*A to secondary side h*A
118 : Real64 NomSupAirVolFlow = 0.0; // nominal supply air volume flow rate (m3/s)
119 : Real64 NomSupAirInTemp = 0.0; // nominal supply air inlet temperature (C)
120 : Real64 NomSupAirOutTemp = 0.0; // nominal supply air outlet temperature (C)
121 : Real64 NomSecAirVolFlow = 0.0; // nominal secondary air volume flow rate (m3/s)
122 : Real64 NomSecAirInTemp = 0.0; // nominal secondary air inlet temperature (C)
123 : Real64 NomElecPower = 0.0; // nominal electric power consumption [W]
124 : // values describing nominal condition (derived from input parameters)
125 : Real64 UA0 = 0.0; // (Uavg*A) at nominal condition
126 : Real64 mTSup0 = 0.0; // product mDot*Tabs, supply air, nominal cond.
127 : Real64 mTSec0 = 0.0; // product mDot*Tabs, exhaust air, nominal cond
128 : Real64 NomSupAirMassFlow = 0.0; // nominal supply air mass flow rate (kg/s)
129 : Real64 NomSecAirMassFlow = 0.0; // nominal secondary air mass flow rate (kg/s)
130 : // Nodes
131 : int SupInletNode = 0; // supply air inlet node number
132 : int SupOutletNode = 0; // supply air outlet node number
133 : int SecInletNode = 0; // secondary air inlet node number
134 : int SecOutletNode = 0; // secondary air outlet node number
135 : // inlet conditions
136 : Real64 SupInTemp = 0.0; // supply air inlet temperature (C)
137 : Real64 SupInHumRat = 0.0; // supply air inlet humidity ratio (kg water/kg dry air)
138 : Real64 SupInEnth = 0.0; // supply air inlet enthalpy (J/kg)
139 : Real64 SupInMassFlow = 0.0; // supply air inlet mass flow rate (kg/s)
140 : Real64 SecInTemp = 0.0; // secondary air inlet temperature (C)
141 : Real64 SecInHumRat = 0.0; // secondary air inlet humidity ratio (kg water/kg dry air)
142 : Real64 SecInEnth = 0.0; // secondary air inlet enthalpy (J/kg)
143 : Real64 SecInMassFlow = 0.0; // secondary air inlet mass flow rate (kg/s)
144 : // balanced desiccant inputs
145 : int PerfDataIndex = 0; // Performance data index allocating performance data number to heat exchanger
146 : Real64 FaceArea = 0.0; // face area of balanced desiccant heat exchangers to determine face velocity [m2]
147 : // generic hx performance inputs
148 : Real64 HeatEffectSensible100 = 0.0; // heating sensible effectiveness at 100% rated air flow
149 : Real64 HeatEffectLatent100 = 0.0; // heating latent effectiveness at 100% rated air flow
150 : Real64 CoolEffectSensible100 = 0.0; // cooling sensible effectiveness at 100% rated air flow
151 : Real64 CoolEffectLatent100 = 0.0; // cooling latent effectiveness at 100% rated air flow
152 : int HeatEffectSensibleCurveIndex = 0; // heating sensible effectiveness multiplier curve to HeatEffectSensible100
153 : int HeatEffectLatentCurveIndex = 0; // heating latent effectiveness multiplier curve to HeatEffectLatent100
154 : int CoolEffectSensibleCurveIndex = 0; // cooling sensible effectiveness multiplier curve to CoolEffectSensible100
155 : int CoolEffectLatentCurveIndex = 0; // cooling latent effectiveness multiplier curve to CoolEffectLatent100
156 : // 1 = None, 2 = Bypass, 3 = Stop Rotary HX Rotation
157 : HXConfigurationType ExchConfig = HXConfigurationType::Invalid; // parameter equivalent of HX configuration, plate or rotary
158 : // frost control parameters
159 : FrostControlOption FrostControlType = FrostControlOption::Invalid; // type of frost control used if any
160 : Real64 ThresholdTemperature = 0.0; // threshold temperature for frost control
161 : Real64 InitialDefrostTime = 0.0; // initial defrost time
162 : Real64 RateofDefrostTimeIncrease = 0.0; // rate of change of defrost time
163 : Real64 DefrostFraction = 0.0; // fraction of time HX is in frost control mode
164 : bool ControlToTemperatureSetPoint = false; // temperature control flag for generic HX
165 : // outlet conditions
166 : Real64 SupOutTemp = 0.0; // supply air outlet temperature (C)
167 : Real64 SupOutHumRat = 0.0; // supply air outlet humidity ratio (kg water/kg dry air)
168 : Real64 SupOutEnth = 0.0; // supply air outlet enthalpy (J/kg)
169 : Real64 SupOutMassFlow = 0.0; // supply air outlet mass flow rate (kg/s)
170 : Real64 SecOutTemp = 0.0; // secondary air outlet temperature (C)
171 : Real64 SecOutHumRat = 0.0; // secondary air outlet humidity ratio (kg water/kg dry air)
172 : Real64 SecOutEnth = 0.0; // secondary air outlet enthalpy (J/kg)
173 : Real64 SecOutMassFlow = 0.0; // secondary air outlet mass flow rate (kg/s)
174 : // report values
175 : Real64 SensHeatingRate = 0.0; // rate of sensible heat being added to the supply (primary) air [W]
176 : Real64 SensHeatingEnergy = 0.0; // sensible heat added to the supply (primary) air [J]
177 : Real64 LatHeatingRate = 0.0; // rate of latent heat being added to the supply (primary) air [W]
178 : Real64 LatHeatingEnergy = 0.0; // latent heat added to the supply (primary) air [J]
179 : Real64 TotHeatingRate = 0.0; // rate of total heat being added to the supply (primary) air [W]
180 : Real64 TotHeatingEnergy = 0.0; // total heat added to the supply (primary) air [J]
181 : Real64 SensCoolingRate = 0.0; // rate of sensible heat being removed from the supply (primary) air [W]
182 : Real64 SensCoolingEnergy = 0.0; // sensible heat removed from the supply (primary) air [J]
183 : Real64 LatCoolingRate = 0.0; // rate of latent heat being removed from the supply (primary) air [W]
184 : Real64 LatCoolingEnergy = 0.0; // latent heat removed from the supply (primary) air [J]
185 : Real64 TotCoolingRate = 0.0; // rate of total heat being removed from the supply (primary) air [W]
186 : Real64 TotCoolingEnergy = 0.0; // total heat removed from the supply (primary) air [J]
187 : Real64 ElecUseEnergy = 0.0; // electricity consumption [J]
188 : Real64 ElecUseRate = 0.0; // electricity consumption rate [W]
189 : Real64 SensEffectiveness = 0.0; // heat exchanger sensible effectiveness [-]
190 : Real64 LatEffectiveness = 0.0; // heat exchanger latent effectiveness [-]
191 : Real64 SupBypassMassFlow = 0.0; // supply air mass flow rate bypassing the heat exchanger [kg/s]
192 : Real64 SecBypassMassFlow = 0.0; // secondary air mass flow rate bypassing the heat exchanger [kg/s]
193 : int LowFlowErrCount = 0; // Counter for recurring warning message
194 : int LowFlowErrIndex = 0; // Index to recurring warning message
195 : int UnBalancedErrCount = 0; // Counter for recurring warning message
196 : int UnBalancedErrIndex = 0; // Index to recurring warning message
197 : bool myEnvrnFlag = true; // one-time-init flag
198 : bool SensEffectivenessFlag = false; // flag for error message when sensible effectiveness is negative
199 : bool LatEffectivenessFlag = false; // flag for error message when latent effectiveness is negative
200 : Array1D_string NumericFieldNames;
201 : bool MySetPointTest = true;
202 : bool MySizeFlag = true;
203 :
204 : void initialize(EnergyPlusData &state, int CompanionCoilIndex, int CompanionCoilType_Num);
205 :
206 : void size(EnergyPlusData &state);
207 :
208 : void CalcAirToAirPlateHeatExch(EnergyPlusData &state,
209 : bool HXUnitOn, // flag to simulate heat exchager heat recovery
210 : ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys
211 : ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _ // high humidity control flag passed by airloop or OA sys
212 : );
213 :
214 : void CalcAirToAirGenericHeatExch(EnergyPlusData &state,
215 : bool HXUnitOn, // flag to simulate heat exchanger heat recovery
216 : bool FirstHVACIteration, // first HVAC iteration flag
217 : HVAC::FanOp const fanOp, // Supply air fan operating mode (1=cycling, 2=constant)
218 : ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys
219 : ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _, // high humidity control flag passed by airloop or OA sys
220 : ObjexxFCL::Optional<Real64 const> HXPartLoadRatio = _ //
221 : );
222 :
223 : void
224 : CalcDesiccantBalancedHeatExch(EnergyPlusData &state,
225 : bool HXUnitOn, // flag to simulate heat exchager heat recovery
226 : bool FirstHVACIteration, // First HVAC iteration flag
227 : HVAC::FanOp const fanOp, // Supply air fan operating mode (1=cycling, 2=constant)
228 : Real64 PartLoadRatio, // Part load ratio requested of DX compressor
229 : int CompanionCoilIndex, // index of companion cooling coil
230 : int CompanionCoilType, // type of cooling coil
231 : bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles
232 : ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys
233 : ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _ // high humidity control flag passed by airloop or OA sys
234 : );
235 :
236 : void FrostControl(EnergyPlusData &state);
237 :
238 : void UpdateHeatRecovery(EnergyPlusData &state);
239 :
240 : void ReportHeatRecovery(EnergyPlusData &state);
241 :
242 : void CheckModelBoundsTempEq(EnergyPlusData &state,
243 : Real64 &T_RegenInTemp, // current regen inlet temperature (C) for regen outlet temp eqn
244 : Real64 &T_RegenInHumRat, // current regen inlet hum rat for regen outlet temp eqn
245 : Real64 &T_ProcInTemp, // current process inlet temperature (C) for regen outlet temp eqn
246 : Real64 &T_ProcInHumRat, // current process inlet hum rat for regen outlet temp eqn
247 : Real64 &T_FaceVel, // current process and regen face velocity (m/s)
248 : bool FirstHVACIteration // First HVAC iteration flag
249 : ) const;
250 :
251 : void CheckModelBoundsHumRatEq(EnergyPlusData &state,
252 : Real64 &H_RegenInTemp, // current regen inlet temperature (C) for regen outlet hum rat eqn
253 : Real64 &H_RegenInHumRat, // current regen inlet hum rat for regen outlet hum rat eqn
254 : Real64 &H_ProcInTemp, // current process inlet temperature (C) for regen outlet hum rat eqn
255 : Real64 &H_ProcInHumRat, // current process inlet hum rat for regen outlet hum rat eqn
256 : Real64 &H_FaceVel, // current process and regen face velocity (m/s)
257 : bool FirstHVACIteration // First HVAC iteration flag
258 : ) const;
259 :
260 : void CheckModelBoundOutput_Temp(EnergyPlusData &state,
261 : Real64 RegenInTemp, // current regen inlet temp passed to eqn
262 : Real64 &RegenOutTemp, // current regen outlet temp from eqn
263 : bool FirstHVACIteration // First HVAC iteration flag
264 : ) const;
265 :
266 : void CheckModelBoundOutput_HumRat(EnergyPlusData &state,
267 : Real64 RegenInHumRat, // current regen inlet hum rat passed to eqn
268 : Real64 &RegenOutHumRat, // current regen outlet hum rat from eqn
269 : bool FirstHVACIteration // First HVAC iteration flag
270 : ) const;
271 :
272 : void CheckModelBoundsRH_TempEq(EnergyPlusData &state,
273 : Real64 T_RegenInTemp, // current regen inlet temperature passed to eqn
274 : Real64 T_RegenInHumRat, // current regen inlet hum rat passed to eqn
275 : Real64 T_ProcInTemp, // current process inlet temperature passed to eqn
276 : Real64 T_ProcInHumRat, // current regen outlet hum rat from eqn
277 : bool FirstHVACIteration // first HVAC iteration flag
278 : ) const;
279 :
280 : void CheckModelBoundsRH_HumRatEq(EnergyPlusData &state,
281 : Real64 H_RegenInTemp, // current regen inlet temperature passed to eqn
282 : Real64 H_RegenInHumRat, // current regen inlet hum rat passed to eqn
283 : Real64 H_ProcInTemp, // current process inlet temperature passed to eqn
284 : Real64 H_ProcInHumRat, // current process inlet hum rat passed to eqn
285 : bool FirstHVACIteration // first HVAC iteration flag
286 : ) const;
287 :
288 : void CheckForBalancedFlow(EnergyPlusData &state,
289 : Real64 ProcessInMassFlow, // current process inlet air mass flow rate (m3/s)
290 : Real64 RegenInMassFlow, // current regeneration inlet air mass flow rate (m3/s)
291 : bool FirstHVACIteration // first HVAC iteration flag
292 : ) const;
293 : };
294 :
295 : struct ErrorTracker
296 : {
297 : bool print = false; // - flag to print error message
298 : int index = 0; // - index to recurring error struct
299 : int count = 0; // - counter if limits are exceeded
300 : std::string buffer1; // - buffer for warn mess on following timestep
301 : std::string buffer2; // - buffer for warn mess on following timestep
302 : std::string buffer3; // - buffer for warn mess on following timestep
303 : Real64 last = 0.0; // - last value
304 : };
305 :
306 : struct BalancedDesDehumPerfData
307 : {
308 : std::string Name; // unique name of balanced desiccant performance data type object
309 : std::string PerfType; // Type of performance data set
310 : Real64 NomSupAirVolFlow = 0.0; // nominal supply air volumetric flow rate m^3/s
311 : Real64 NomProcAirFaceVel = 0.0; // nominal process air face velocity m/s
312 : Real64 NomElecPower = 0.0; // nominal electric power consumption [W]
313 :
314 : std::array<Real64, 8> B = {0}; // regeneration outlet temperature equation coefficients and limits
315 : // index 0: constant coefficient for outlet regeneration temperature equation
316 : // index 1: regen inlet humidity ratio coefficient for outlet regen temperature equation
317 : // index 2: regen inlet temp coefficient for outlet regen temperature equation
318 : // index 3: (regen in humrat/regen in temp) coefficient for outlet regen temp eq
319 : // index 4: process inlet humidity ratio coefficient for outlet regen temp equation
320 : // index 5: process inlet temp coefficient for outlet regen temp equation
321 : // index 6: (process in humrat/proc in temp) coefficient for outlet regen temp eq
322 : // index 7: process, regen face velocity coefficient for outlet regen temp eq
323 :
324 : Real64 T_MinRegenAirInTemp = 0.0; // min allowable regen inlet air temperature [C]
325 : Real64 T_MaxRegenAirInTemp = 0.0; // max allowable regen inlet air temperature [C]
326 : Real64 T_MinRegenAirInHumRat = 0.0; // min allowable regen inlet air humidity ratio [kg water / kg air]
327 : Real64 T_MaxRegenAirInHumRat = 0.0; // max allowable regen inlet air humidity ratio [kg water / kg air]
328 : Real64 T_MinProcAirInTemp = 0.0; // min allowable process inlet air temperature [C]
329 : Real64 T_MaxProcAirInTemp = 0.0; // max allowable process inlet air temperature [C]
330 : Real64 T_MinProcAirInHumRat = 0.0; // min allowable process inlet air humidity ratio [kg water/kg air]
331 : Real64 T_MaxProcAirInHumRat = 0.0; // max allowable process inlet air humidity ratio [kg water/kg air]
332 : Real64 T_MinFaceVel = 0.0; // min allowable process, regen face velocity [m/s]
333 : Real64 T_MaxFaceVel = 0.0; // max allowable process, regen face velocity [m/s]
334 : Real64 MinRegenAirOutTemp = 0.0; // min allowable regen outlet air temperature [C]
335 : Real64 MaxRegenAirOutTemp = 0.0; // max allowable regen outlet air temperature [C]
336 : Real64 T_MinRegenAirInRelHum = 0.0; // min allowable regen inlet air relative humidity [%]
337 : Real64 T_MaxRegenAirInRelHum = 0.0; // max allowable regen inlet air relative humidity [%]
338 : Real64 T_MinProcAirInRelHum = 0.0; // min allowable process inlet air relative humidity [%]
339 : Real64 T_MaxProcAirInRelHum = 0.0; // max allowable process inlet air relative humidity [%]
340 :
341 : std::array<Real64, 8> C = {0}; // regeneration outlet humidity ratio equation coefficients and limits
342 : // index 0: constant coefficient for outlet regen humidity ratio equation
343 : // index 1: regen inlet humidity ratio coefficient for outlet regen humidity ratio eq
344 : // index 2: regen inlet temp coefficient for outlet regen humidity ratio equation
345 : // index 3: (regen in humrat/regen in temp) coefficient for outlet regen humidity ratio eq
346 : // index 4: process inlet humidity ratio coefficient for outlet regen humidity ratio eq
347 : // index 5: process inlet temp coefficient for outlet regen humidity ratio eq
348 : // index 6: (proc in humrat/proc in temp) coefficient for outlet regen humidity ratio eq
349 : // index 7: process, regen face velocity coefficient for outlet regen humidity ratio eq
350 :
351 : Real64 H_MinRegenAirInTemp = 0.0; // min allowable regen inlet air temperature [C]
352 : Real64 H_MaxRegenAirInTemp = 0.0; // max allowable regen inlet air temperature [C]
353 : Real64 H_MinRegenAirInHumRat = 0.0; // min allowable regen inlet air humidity ratio [kg water / kg air]
354 : Real64 H_MaxRegenAirInHumRat = 0.0; // max allowable regen inlet air humidity ratio [kg water / kg air]
355 : Real64 H_MinProcAirInTemp = 0.0; // min allowable process inlet air temperature [C]
356 : Real64 H_MaxProcAirInTemp = 0.0; // max allowable process inlet air temperature [C]
357 : Real64 H_MinProcAirInHumRat = 0.0; // min allowable process inlet air humidity ratio [kg water/kg air]
358 : Real64 H_MaxProcAirInHumRat = 0.0; // max allowable process inlet air humidity ratio [kg water/kg air]
359 : Real64 H_MinFaceVel = 0.0; // min allowable process, regen face velocity [m/s]
360 : Real64 H_MaxFaceVel = 0.0; // max allowable process, regen face velocity [m/s]
361 : Real64 MinRegenAirOutHumRat = 0.0; // min allowable regen outlet air temperature [C]
362 : Real64 MaxRegenAirOutHumRat = 0.0; // max allowable regen outlet air temperature [C]
363 : Real64 H_MinRegenAirInRelHum = 0.0; // min allowable regen inlet air relative humidity [%]
364 : Real64 H_MaxRegenAirInRelHum = 0.0; // max allowable regen inlet air relative humidity [%]
365 : Real64 H_MinProcAirInRelHum = 0.0; // min allowable process inlet air relative humidity [%]
366 : Real64 H_MaxProcAirInRelHum = 0.0; // max allowable process inlet air relative humidity [%]
367 :
368 : // for model bound checking
369 : ErrorTracker regenInRelHumTempErr; // regen inlet relative humidity for temperature equation
370 : ErrorTracker procInRelHumTempErr; // process inlet relative humidity for temperature equation
371 : ErrorTracker regenInRelHumHumRatErr; // regen inlet relative humidity for humidity ratio equation
372 : ErrorTracker procInRelHumHumRatErr; // process inlet relative humidity for humidity ratio equation
373 : ErrorTracker regenOutHumRatFailedErr; // regen outlet hum rat variables used when regen outlet humidity ratio is below regen inlet humrat,
374 : // verify coefficients warning issued
375 : ErrorTracker imbalancedFlowErr; // used when regen and process mass flow rates are not equal to within 2%
376 : ErrorTracker T_RegenInTempError; // regen outlet temp eqn
377 : ErrorTracker T_RegenInHumRatError; //- T_RegenInhumidity ratio = Regen inlet humidity ratio
378 : ErrorTracker T_ProcInTempError; //- T_ProcInTemp = Process inlet temperature
379 : ErrorTracker T_ProcInHumRatError; //- T_ProcInhumidity ratio = Process inlet humidity ratio
380 : ErrorTracker T_FaceVelError; //- T_FaceVel = Process and regen face velocity
381 : ErrorTracker regenOutTempError; //- T_RegenOutTemp = Regen outlet temperature
382 : ErrorTracker regenOutTempFailedError;
383 : ErrorTracker H_RegenInTempError; // regen outlet humidity ratio variables
384 : ErrorTracker H_RegenInHumRatError; //- H_RegenInhumidity ratio = Regen inlet humidity ratio
385 : ErrorTracker H_ProcInTempError; //- H_ProcInTemp = Process inlet temperature
386 : ErrorTracker H_ProcInHumRatError; //- H_ProcInhumidity ratio = Process inlet humidity ratio
387 : ErrorTracker H_FaceVelError; //- H_FaceVel = Process and regen face velocity
388 : ErrorTracker regenOutHumRatError; //- H_RegenOutTemp = Regen outlet temperature
389 :
390 : Array1D_string NumericFieldNames;
391 : };
392 :
393 : void SimHeatRecovery(EnergyPlusData &state,
394 : std::string_view CompName, // name of the heat exchanger unit
395 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
396 : int &CompIndex, // Pointer to Component
397 : HVAC::FanOp const fanOp, // Supply air fan operating mode
398 : ObjexxFCL::Optional<Real64 const> HXPartLoadRatio = _, // Part load ratio requested of DX compressor
399 : ObjexxFCL::Optional_bool_const HXUnitEnable = _, // Flag to operate heat exchanger
400 : ObjexxFCL::Optional_int_const CompanionCoilIndex = _, // index of companion cooling coil
401 : ObjexxFCL::Optional_bool_const RegenInletIsOANode = _, // flag to determine if supply inlet is OA node, if so air flow cycles
402 : ObjexxFCL::Optional_bool_const EconomizerFlag = _, // economizer operation flag passed by airloop or OA sys
403 : ObjexxFCL::Optional_bool_const HighHumCtrlFlag = _, // high humidity control flag passed by airloop or OA sys
404 : ObjexxFCL::Optional_int_const CompanionCoilType_Num = _ // cooling coil type of coil
405 : );
406 :
407 : void GetHeatRecoveryInput(EnergyPlusData &state);
408 :
409 : Real64 SafeDiv(Real64 a, Real64 b);
410 :
411 : Real64 CalculateEpsFromNTUandZ(EnergyPlusData &state,
412 : Real64 NTU, // number of transfer units
413 : Real64 Z, // capacity rate ratio
414 : HXConfiguration FlowArr // flow arrangement
415 : );
416 :
417 : void CalculateNTUfromEpsAndZ(EnergyPlusData &state,
418 : Real64 &NTU, // number of transfer units
419 : CalculateNTUBoundsErrors &Err, // error indicator
420 : Real64 Z, // capacity rate ratio
421 : HXConfiguration FlowArr, // flow arrangement
422 : Real64 Eps // heat exchanger effectiveness
423 : );
424 :
425 : Real64 GetNTUforCrossFlowBothUnmixed(EnergyPlusData &state,
426 : Real64 Eps, // heat exchanger effectiveness
427 : Real64 Z // capacity rate ratio
428 : );
429 :
430 : int GetSupplyInletNode(EnergyPlusData &state,
431 : std::string const &HXName, // must match HX names for the ExchCond type
432 : bool &ErrorsFound // set to true if problem
433 : );
434 :
435 : int GetSupplyOutletNode(EnergyPlusData &state,
436 : std::string const &HXName, // must match HX names for the ExchCond type
437 : bool &ErrorsFound // set to true if problem
438 : );
439 :
440 : int GetSecondaryInletNode(EnergyPlusData &state,
441 : std::string const &HXName, // must match HX names for the ExchCond type
442 : bool &ErrorsFound // set to true if problem
443 : );
444 :
445 : int GetSecondaryOutletNode(EnergyPlusData &state,
446 : std::string const &HXName, // must match HX names for the ExchCond type
447 : bool &ErrorsFound // set to true if problem
448 : );
449 :
450 : Real64 GetSupplyAirFlowRate(EnergyPlusData &state,
451 : std::string const &HXName, // must match HX names for the ExchCond type
452 : bool &ErrorsFound // set to true if problem
453 : );
454 :
455 : HVAC::HXType GetHeatExchangerObjectTypeNum(EnergyPlusData &state,
456 : std::string const &HXName, // must match HX names for the ExchCond type
457 : bool &ErrorsFound // set to true if problem
458 : );
459 :
460 : } // namespace HeatRecovery
461 :
462 : struct ErrorTracker2
463 : {
464 : std::string OutputChar; // character string for warning messages
465 : std::string OutputCharLo; // character string for warning messages
466 : std::string OutputCharHi; // character string for warning messages
467 : std::string CharValue; // character string for warning messages
468 : Real64 TimeStepSysLast = 0.0; // last system time step (used to check for downshifting)
469 : Real64 CurrentEndTime = 0.0; // end time of time step for current simulation time step
470 : Real64 CurrentEndTimeLast = 0.0; // end time of time step for last simulation time step
471 : };
472 :
473 : struct HeatRecoveryData : BaseGlobalStruct
474 : {
475 :
476 : int NumHeatExchangers = 0; // number of heat exchangers
477 : Real64 FullLoadOutAirTemp = 0.0; // Used with desiccant HX empirical model, water coils use inlet node condition
478 : // DX coils use DXCoilFullLoadOutAirTemp when coil is ON otherwise inlet node
479 : Real64 FullLoadOutAirHumRat = 0.0; // Used with desiccant HX empirical model, water coils use inlet node condition
480 : // DX coils use DXCoilFullLoadOutAirHumRat when coil is ON otherwise inlet node
481 : bool GetInputFlag = true; // First time, input is "gotten"
482 : bool CalledFromParentObject = true; // Indicates that HX is called from parent object (this object is not on a branch)
483 : Array1D_bool CheckEquipName;
484 : ErrorTracker2 error1;
485 : ErrorTracker2 error2;
486 : ErrorTracker2 error3;
487 : ErrorTracker2 error4;
488 : ErrorTracker2 error5;
489 : ErrorTracker2 error6;
490 : ErrorTracker2 error7;
491 : std::string OutputCharProc; // character string for warning messages
492 : std::string OutputCharRegen; // character string for warning messages
493 : Real64 TimeStepSysLast7 = 0.0; // last system time step (used to check for downshifting)
494 : Real64 CurrentEndTime7 = 0.0; // end time of time step for current simulation time step
495 : Real64 CurrentEndTimeLast7 = 0.0; // end time of time step for last simulation time step
496 : Real64 RegenInletRH = 0.0; // Regeneration inlet air relative humidity
497 : Real64 ProcInletRH = 0.0; // Process inlet air relative humidity
498 : Real64 RegenInletRH2 = 0.0; // Regeneration inlet air relative humidity
499 : Real64 ProcInletRH2 = 0.0; // Process inlet air relative humidity
500 :
501 : std::unordered_map<std::string, std::string> HeatExchangerUniqueNames;
502 : Array1D<HeatRecovery::HeatExchCond> ExchCond;
503 : Array1D<HeatRecovery::BalancedDesDehumPerfData> BalDesDehumPerfData;
504 :
505 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
506 : {
507 2126 : }
508 :
509 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
510 : {
511 1152 : }
512 :
513 2100 : void clear_state() override
514 : {
515 2100 : new (this) HeatRecoveryData();
516 2100 : }
517 : };
518 :
519 : } // namespace EnergyPlus
520 :
521 : #endif
|