Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #ifndef 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 398 : struct HeatExchCond
110 : {
111 : std::string Name; // name of component
112 : int ExchType = 0; // Integer equivalent to ExchType
113 : std::string HeatExchPerfName; // Desiccant balanced heat exchanger performance data name
114 : int SchedPtr = 0; // index of schedule
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 HeatEffectSensible75 = 0.0; // heating sensible effectiveness at 75% rated air flow
150 : Real64 HeatEffectLatent100 = 0.0; // heating latent effectiveness at 100% rated air flow
151 : Real64 HeatEffectLatent75 = 0.0; // heating latent effectiveness at 75% rated air flow
152 : Real64 CoolEffectSensible100 = 0.0; // cooling sensible effectiveness at 100% rated air flow
153 : Real64 CoolEffectSensible75 = 0.0; // cooling sensible effectiveness at 75% rated air flow
154 : Real64 CoolEffectLatent100 = 0.0; // cooling latent effectiveness at 100% rated air flow
155 : Real64 CoolEffectLatent75 = 0.0; // cooling latent effectiveness at 75% rated air flow
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 : Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys
211 : 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 : int FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant)
218 : Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys
219 : Optional_bool_const HighHumCtrlFlag = _, // high humidity control flag passed by airloop or OA sys
220 : Optional<Real64 const> HXPartLoadRatio = _ //
221 : );
222 :
223 : void CalcDesiccantBalancedHeatExch(EnergyPlusData &state,
224 : bool HXUnitOn, // flag to simulate heat exchager heat recovery
225 : bool FirstHVACIteration, // First HVAC iteration flag
226 : int FanOpMode, // Supply air fan operating mode (1=cycling, 2=constant)
227 : Real64 PartLoadRatio, // Part load ratio requested of DX compressor
228 : int CompanionCoilIndex, // index of companion cooling coil
229 : bool RegenInletIsOANode, // Flag to determine if regen side inlet is OANode, if so this air stream cycles
230 : Optional_bool_const EconomizerFlag = _, // economizer flag pass by air loop or OA sys
231 : Optional_bool_const HighHumCtrlFlag = _ // high humidity control flag passed by airloop or OA sys
232 : );
233 :
234 : void FrostControl(EnergyPlusData &state);
235 :
236 : void UpdateHeatRecovery(EnergyPlusData &state);
237 :
238 : void ReportHeatRecovery(EnergyPlusData &state);
239 :
240 : void CheckModelBoundsTempEq(EnergyPlusData &state,
241 : Real64 &T_RegenInTemp, // current regen inlet temperature (C) for regen outlet temp eqn
242 : Real64 &T_RegenInHumRat, // current regen inlet hum rat for regen outlet temp eqn
243 : Real64 &T_ProcInTemp, // current process inlet temperature (C) for regen outlet temp eqn
244 : Real64 &T_ProcInHumRat, // current process inlet hum rat for regen outlet temp eqn
245 : Real64 &T_FaceVel, // current process and regen face velocity (m/s)
246 : bool FirstHVACIteration // First HVAC iteration flag
247 : ) const;
248 :
249 : void CheckModelBoundsHumRatEq(EnergyPlusData &state,
250 : Real64 &H_RegenInTemp, // current regen inlet temperature (C) for regen outlet hum rat eqn
251 : Real64 &H_RegenInHumRat, // current regen inlet hum rat for regen outlet hum rat eqn
252 : Real64 &H_ProcInTemp, // current process inlet temperature (C) for regen outlet hum rat eqn
253 : Real64 &H_ProcInHumRat, // current process inlet hum rat for regen outlet hum rat eqn
254 : Real64 &H_FaceVel, // current process and regen face velocity (m/s)
255 : bool FirstHVACIteration // First HVAC iteration flag
256 : ) const;
257 :
258 : void CheckModelBoundOutput_Temp(EnergyPlusData &state,
259 : Real64 RegenInTemp, // current regen inlet temp passed to eqn
260 : Real64 &RegenOutTemp, // current regen outlet temp from eqn
261 : bool FirstHVACIteration // First HVAC iteration flag
262 : ) const;
263 :
264 : void CheckModelBoundOutput_HumRat(EnergyPlusData &state,
265 : Real64 RegenInHumRat, // current regen inlet hum rat passed to eqn
266 : Real64 &RegenOutHumRat, // current regen outlet hum rat from eqn
267 : bool FirstHVACIteration // First HVAC iteration flag
268 : ) const;
269 :
270 : void CheckModelBoundsRH_TempEq(EnergyPlusData &state,
271 : Real64 T_RegenInTemp, // current regen inlet temperature passed to eqn
272 : Real64 T_RegenInHumRat, // current regen inlet hum rat passed to eqn
273 : Real64 T_ProcInTemp, // current process inlet temperature passed to eqn
274 : Real64 T_ProcInHumRat, // current regen outlet hum rat from eqn
275 : bool FirstHVACIteration // first HVAC iteration flag
276 : ) const;
277 :
278 : void CheckModelBoundsRH_HumRatEq(EnergyPlusData &state,
279 : Real64 H_RegenInTemp, // current regen inlet temperature passed to eqn
280 : Real64 H_RegenInHumRat, // current regen inlet hum rat passed to eqn
281 : Real64 H_ProcInTemp, // current process inlet temperature passed to eqn
282 : Real64 H_ProcInHumRat, // current process inlet hum rat passed to eqn
283 : bool FirstHVACIteration // first HVAC iteration flag
284 : ) const;
285 :
286 : void CheckForBalancedFlow(EnergyPlusData &state,
287 : Real64 ProcessInMassFlow, // current process inlet air mass flow rate (m3/s)
288 : Real64 RegenInMassFlow, // current regeneration inlet air mass flow rate (m3/s)
289 : bool FirstHVACIteration // first HVAC iteration flag
290 : ) const;
291 : };
292 :
293 456 : struct ErrorTracker
294 : {
295 : bool print = false; // - flag to print error message
296 : int index = 0; // - index to recurring error struct
297 : int count = 0; // - counter if limits are exceeded
298 : std::string buffer1; // - buffer for warn mess on following timestep
299 : std::string buffer2; // - buffer for warn mess on following timestep
300 : std::string buffer3; // - buffer for warn mess on following timestep
301 : Real64 last = 0.0; // - last value
302 : };
303 :
304 24 : struct BalancedDesDehumPerfData
305 : {
306 : std::string Name; // unique name of balanced desiccant performance data type object
307 : std::string PerfType; // Type of performance data set
308 : Real64 NomSupAirVolFlow = 0.0; // nominal supply air volumetric flow rate m^3/s
309 : Real64 NomProcAirFaceVel = 0.0; // nominal process air face velocity m/s
310 : Real64 NomElecPower = 0.0; // nominal electric power consumption [W]
311 :
312 : std::array<Real64, 8> B = {0}; // regeneration outlet temperature equation coefficients and limits
313 : // index 0: constant coefficient for outlet regeneration temperature equation
314 : // index 1: regen inlet humidity ratio coefficient for outlet regen temperature equation
315 : // index 2: regen inlet temp coefficient for outlet regen temperature equation
316 : // index 3: (regen in humrat/regen in temp) coefficient for outlet regen temp eq
317 : // index 4: process inlet humidity ratio coefficient for outlet regen temp equation
318 : // index 5: process inlet temp coefficient for outlet regen temp equation
319 : // index 6: (process in humrat/proc in temp) coefficient for outlet regen temp eq
320 : // index 7: process, regen face velocity coefficient for outlet regen temp eq
321 :
322 : Real64 T_MinRegenAirInTemp = 0.0; // min allowable regen inlet air temperature [C]
323 : Real64 T_MaxRegenAirInTemp = 0.0; // max allowable regen inlet air temperature [C]
324 : Real64 T_MinRegenAirInHumRat = 0.0; // min allowable regen inlet air humidity ratio [kg water / kg air]
325 : Real64 T_MaxRegenAirInHumRat = 0.0; // max allowable regen inlet air humidity ratio [kg water / kg air]
326 : Real64 T_MinProcAirInTemp = 0.0; // min allowable process inlet air temperature [C]
327 : Real64 T_MaxProcAirInTemp = 0.0; // max allowable process inlet air temperature [C]
328 : Real64 T_MinProcAirInHumRat = 0.0; // min allowable process inlet air humidity ratio [kg water/kg air]
329 : Real64 T_MaxProcAirInHumRat = 0.0; // max allowable process inlet air humidity ratio [kg water/kg air]
330 : Real64 T_MinFaceVel = 0.0; // min allowable process, regen face velocity [m/s]
331 : Real64 T_MaxFaceVel = 0.0; // max allowable process, regen face velocity [m/s]
332 : Real64 MinRegenAirOutTemp = 0.0; // min allowable regen outlet air temperature [C]
333 : Real64 MaxRegenAirOutTemp = 0.0; // max allowable regen outlet air temperature [C]
334 : Real64 T_MinRegenAirInRelHum = 0.0; // min allowable regen inlet air relative humidity [%]
335 : Real64 T_MaxRegenAirInRelHum = 0.0; // max allowable regen inlet air relative humidity [%]
336 : Real64 T_MinProcAirInRelHum = 0.0; // min allowable process inlet air relative humidity [%]
337 : Real64 T_MaxProcAirInRelHum = 0.0; // max allowable process inlet air relative humidity [%]
338 :
339 : std::array<Real64, 8> C = {0}; // regeneration outlet humidity ratio equation coefficients and limits
340 : // index 0: constant coefficient for outlet regen humidity ratio equation
341 : // index 1: regen inlet humidity ratio coefficient for outlet regen humidity ratio eq
342 : // index 2: regen inlet temp coefficient for outlet regen humidity ratio equation
343 : // index 3: (regen in humrat/regen in temp) coefficient for outlet regen humidity ratio eq
344 : // index 4: process inlet humidity ratio coefficient for outlet regen humidity ratio eq
345 : // index 5: process inlet temp coefficient for outlet regen humidity ratio eq
346 : // index 6: (proc in humrat/proc in temp) coefficient for outlet regen humidity ratio eq
347 : // index 7: process, regen face velocity coefficient for outlet regen humidity ratio eq
348 :
349 : Real64 H_MinRegenAirInTemp = 0.0; // min allowable regen inlet air temperature [C]
350 : Real64 H_MaxRegenAirInTemp = 0.0; // max allowable regen inlet air temperature [C]
351 : Real64 H_MinRegenAirInHumRat = 0.0; // min allowable regen inlet air humidity ratio [kg water / kg air]
352 : Real64 H_MaxRegenAirInHumRat = 0.0; // max allowable regen inlet air humidity ratio [kg water / kg air]
353 : Real64 H_MinProcAirInTemp = 0.0; // min allowable process inlet air temperature [C]
354 : Real64 H_MaxProcAirInTemp = 0.0; // max allowable process inlet air temperature [C]
355 : Real64 H_MinProcAirInHumRat = 0.0; // min allowable process inlet air humidity ratio [kg water/kg air]
356 : Real64 H_MaxProcAirInHumRat = 0.0; // max allowable process inlet air humidity ratio [kg water/kg air]
357 : Real64 H_MinFaceVel = 0.0; // min allowable process, regen face velocity [m/s]
358 : Real64 H_MaxFaceVel = 0.0; // max allowable process, regen face velocity [m/s]
359 : Real64 MinRegenAirOutHumRat = 0.0; // min allowable regen outlet air temperature [C]
360 : Real64 MaxRegenAirOutHumRat = 0.0; // max allowable regen outlet air temperature [C]
361 : Real64 H_MinRegenAirInRelHum = 0.0; // min allowable regen inlet air relative humidity [%]
362 : Real64 H_MaxRegenAirInRelHum = 0.0; // max allowable regen inlet air relative humidity [%]
363 : Real64 H_MinProcAirInRelHum = 0.0; // min allowable process inlet air relative humidity [%]
364 : Real64 H_MaxProcAirInRelHum = 0.0; // max allowable process inlet air relative humidity [%]
365 :
366 : // for model bound checking
367 : ErrorTracker regenInRelHumTempErr; // regen inlet relative humidity for temperature equation
368 : ErrorTracker procInRelHumTempErr; // process inlet relative humidity for temperature equation
369 : ErrorTracker regenInRelHumHumRatErr; // regen inlet relative humidity for humidity ratio equation
370 : ErrorTracker procInRelHumHumRatErr; // process inlet relative humidity for humidity ratio equation
371 : ErrorTracker regenOutHumRatFailedErr; // regen outlet hum rat variables used when regen outlet humidity ratio is below regen inlet humrat,
372 : // verify coefficients warning issued
373 : ErrorTracker imbalancedFlowErr; // used when regen and process mass flow rates are not equal to within 2%
374 : ErrorTracker T_RegenInTempError; // regen outlet temp eqn
375 : ErrorTracker T_RegenInHumRatError; //- T_RegenInhumidity ratio = Regen inlet humidity ratio
376 : ErrorTracker T_ProcInTempError; //- T_ProcInTemp = Process inlet temperature
377 : ErrorTracker T_ProcInHumRatError; //- T_ProcInhumidity ratio = Process inlet humidity ratio
378 : ErrorTracker T_FaceVelError; //- T_FaceVel = Process and regen face velocity
379 : ErrorTracker regenOutTempError; //- T_RegenOutTemp = Regen outlet temperature
380 : ErrorTracker regenOutTempFailedError;
381 : ErrorTracker H_RegenInTempError; // regen outlet humidity ratio variables
382 : ErrorTracker H_RegenInHumRatError; //- H_RegenInhumidity ratio = Regen inlet humidity ratio
383 : ErrorTracker H_ProcInTempError; //- H_ProcInTemp = Process inlet temperature
384 : ErrorTracker H_ProcInHumRatError; //- H_ProcInhumidity ratio = Process inlet humidity ratio
385 : ErrorTracker H_FaceVelError; //- H_FaceVel = Process and regen face velocity
386 : ErrorTracker regenOutHumRatError; //- H_RegenOutTemp = Regen outlet temperature
387 :
388 : Array1D_string NumericFieldNames;
389 : };
390 :
391 : void SimHeatRecovery(EnergyPlusData &state,
392 : std::string_view CompName, // name of the heat exchanger unit
393 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
394 : int &CompIndex, // Pointer to Component
395 : int FanOpMode, // Supply air fan operating mode
396 : Optional<Real64 const> HXPartLoadRatio = _, // Part load ratio requested of DX compressor
397 : Optional_bool_const HXUnitEnable = _, // Flag to operate heat exchanger
398 : Optional_int_const CompanionCoilIndex = _, // index of companion cooling coil
399 : Optional_bool_const RegenInletIsOANode = _, // flag to determine if supply inlet is OA node, if so air flow cycles
400 : Optional_bool_const EconomizerFlag = _, // economizer operation flag passed by airloop or OA sys
401 : Optional_bool_const HighHumCtrlFlag = _, // high humidity control flag passed by airloop or OA sys
402 : Optional_int_const CompanionCoilType_Num = _ // cooling coil type of coil
403 : );
404 :
405 : void GetHeatRecoveryInput(EnergyPlusData &state);
406 :
407 : Real64 SafeDiv(Real64 a, Real64 b);
408 :
409 : Real64 CalculateEpsFromNTUandZ(EnergyPlusData &state,
410 : Real64 NTU, // number of transfer units
411 : Real64 Z, // capacity rate ratio
412 : HXConfiguration FlowArr // flow arrangement
413 : );
414 :
415 : void CalculateNTUfromEpsAndZ(EnergyPlusData &state,
416 : Real64 &NTU, // number of transfer units
417 : CalculateNTUBoundsErrors &Err, // error indicator
418 : Real64 Z, // capacity rate ratio
419 : HXConfiguration FlowArr, // flow arrangement
420 : Real64 Eps // heat exchanger effectiveness
421 : );
422 :
423 : Real64 GetNTUforCrossFlowBothUnmixed(EnergyPlusData &state,
424 : Real64 Eps, // heat exchanger effectiveness
425 : Real64 Z // capacity rate ratio
426 : );
427 :
428 : int GetSupplyInletNode(EnergyPlusData &state,
429 : std::string const &HXName, // must match HX names for the ExchCond type
430 : bool &ErrorsFound // set to true if problem
431 : );
432 :
433 : int GetSupplyOutletNode(EnergyPlusData &state,
434 : std::string const &HXName, // must match HX names for the ExchCond type
435 : bool &ErrorsFound // set to true if problem
436 : );
437 :
438 : int GetSecondaryInletNode(EnergyPlusData &state,
439 : std::string const &HXName, // must match HX names for the ExchCond type
440 : bool &ErrorsFound // set to true if problem
441 : );
442 :
443 : int GetSecondaryOutletNode(EnergyPlusData &state,
444 : std::string const &HXName, // must match HX names for the ExchCond type
445 : bool &ErrorsFound // set to true if problem
446 : );
447 :
448 : Real64 GetSupplyAirFlowRate(EnergyPlusData &state,
449 : std::string const &HXName, // must match HX names for the ExchCond type
450 : bool &ErrorsFound // set to true if problem
451 : );
452 :
453 : int GetHeatExchangerObjectTypeNum(EnergyPlusData &state,
454 : std::string const &HXName, // must match HX names for the ExchCond type
455 : bool &ErrorsFound // set to true if problem
456 : );
457 :
458 : void SetHeatExchangerData(EnergyPlusData &state,
459 : int HXNum, // Index of HX
460 : bool &ErrorsFound, // Set to true if certain errors found
461 : std::string const &HXName, // Name of HX
462 : Optional<Real64> SupplyAirVolFlow = _, // HX supply air flow rate [m3/s]
463 : Optional<Real64> SecondaryAirVolFlow = _ // HX secondary air flow rate [m3/s]
464 : );
465 :
466 : } // namespace HeatRecovery
467 :
468 9252 : struct ErrorTracker2
469 : {
470 : std::string OutputChar; // character string for warning messages
471 : std::string OutputCharLo; // character string for warning messages
472 : std::string OutputCharHi; // character string for warning messages
473 : std::string CharValue; // character string for warning messages
474 : Real64 TimeStepSysLast = 0.0; // last system time step (used to check for downshifting)
475 : Real64 CurrentEndTime = 0.0; // end time of time step for current simulation time step
476 : Real64 CurrentEndTimeLast = 0.0; // end time of time step for last simulation time step
477 : };
478 :
479 1542 : struct HeatRecoveryData : BaseGlobalStruct
480 : {
481 :
482 : int NumHeatExchangers = 0; // number of heat exchangers
483 : Real64 FullLoadOutAirTemp = 0.0; // Used with desiccant HX empirical model, water coils use inlet node condition
484 : // DX coils use DXCoilFullLoadOutAirTemp when coil is ON otherwise inlet node
485 : Real64 FullLoadOutAirHumRat = 0.0; // Used with desiccant HX empirical model, water coils use inlet node condition
486 : // DX coils use DXCoilFullLoadOutAirHumRat when coil is ON otherwise inlet node
487 : bool GetInputFlag = true; // First time, input is "gotten"
488 : bool CalledFromParentObject = true; // Indicates that HX is called from parent object (this object is not on a branch)
489 : Array1D_bool CheckEquipName;
490 : ErrorTracker2 error1;
491 : ErrorTracker2 error2;
492 : ErrorTracker2 error3;
493 : ErrorTracker2 error4;
494 : ErrorTracker2 error5;
495 : ErrorTracker2 error6;
496 : std::string OutputCharProc; // character string for warning messages
497 : std::string OutputCharRegen; // character string for warning messages
498 : Real64 TimeStepSysLast7 = 0.0; // last system time step (used to check for downshifting)
499 : Real64 CurrentEndTime7 = 0.0; // end time of time step for current simulation time step
500 : Real64 CurrentEndTimeLast7 = 0.0; // end time of time step for last simulation time step
501 : Real64 RegenInletRH = 0.0; // Regeneration inlet air relative humidity
502 : Real64 ProcInletRH = 0.0; // Process inlet air relative humidity
503 : Real64 RegenInletRH2 = 0.0; // Regeneration inlet air relative humidity
504 : Real64 ProcInletRH2 = 0.0; // Process inlet air relative humidity
505 :
506 : std::unordered_map<std::string, std::string> HeatExchangerUniqueNames;
507 : Array1D<HeatRecovery::HeatExchCond> ExchCond;
508 : Array1D<HeatRecovery::BalancedDesDehumPerfData> BalDesDehumPerfData;
509 :
510 0 : void clear_state() override
511 : {
512 0 : *this = HeatRecoveryData();
513 0 : }
514 : };
515 :
516 : } // namespace EnergyPlus
517 :
518 : #endif
|