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 DesiccantDehumidifiers_hh_INCLUDED
49 : #define DesiccantDehumidifiers_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/DataGlobals.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 : #include <EnergyPlus/Plant/Enums.hh>
60 : #include <EnergyPlus/Plant/PlantLocation.hh>
61 :
62 : namespace EnergyPlus {
63 :
64 : // Forward declarations
65 : struct EnergyPlusData;
66 :
67 : namespace DesiccantDehumidifiers {
68 :
69 : enum class DesicDehumType // Desiccant dehumidifier type
70 : {
71 : Invalid = -1,
72 : Solid,
73 : Generic,
74 : Num
75 : };
76 :
77 : enum class DesicDehumCtrlType
78 : {
79 : Invalid = -1,
80 : FixedHumratBypass, // FIXED LEAVING HUMRAT SETPOINT:BYPASS
81 : NodeHumratBypass, // NODE LEAVING HUMRAT SETPOINT:BYPASS
82 : Num
83 : };
84 :
85 : enum class Selection
86 : {
87 : Invalid = -1,
88 : No, // Condenser waste heat NOT reclaimed for desiccant regeneration
89 : Yes, // Condenser waste heat reclaimed for desiccant regeneration
90 : Num
91 : };
92 :
93 : enum class PerformanceModel
94 : {
95 : Invalid = -1,
96 : Default,
97 : UserCurves,
98 : Num
99 : };
100 :
101 : // Desiccant heat exchanger type
102 : int constexpr BalancedHX(1); // HeatExchanger:Desiccant:BalancedFlow = 1
103 :
104 : struct DesiccantDehumidifierData
105 : {
106 : // Members
107 : // User Input data
108 : std::string Name; // unique name of component
109 : std::string Sched; // name of availability schedule
110 : std::string RegenCoilType; // type of regen coil
111 : std::string RegenCoilName; // name of regen coil
112 : std::string RegenFanName; // name of regen fan
113 : PerformanceModel PerformanceModel_Num; // type of performance model, default or user curves
114 : int ProcAirInNode; // process air inlet node of dehumidifier
115 : int ProcAirOutNode; // process air outlet node of dehumidifier
116 : int RegenAirInNode; // regen air inlet node of dehumidifier
117 : // (initially set to conditions entering regen heating coil)
118 : int RegenAirOutNode; // regen air outlet node of dehumidifier
119 : int RegenFanInNode; // regen fan inlet node
120 : DesicDehumCtrlType controlType; // type of controls
121 : Real64 HumRatSet; // humidity ratio setpoint [kg water / kg air]
122 : Real64 NomProcAirVolFlow; // nominal process air flow rate [m3/s]
123 : Real64 NomProcAirVel; // nominal process air velocity [m/s]
124 : Real64 NomRotorPower; // rotor power consumption at full output [W]
125 : int RegenCoilIndex; // Index for regen coil
126 : int RegenFanIndex; // Index for regen fan
127 : HVAC::FanType regenFanType; // Fan type number (see DataHVACGlobals)
128 : int ProcDryBulbCurvefTW; // number of process leaving dry bulb f(edb,ew) curve
129 : int ProcDryBulbCurvefV; // number of process leaving dry bulb f(v) curve
130 : int ProcHumRatCurvefTW; // number of process leaving humidity ratio f(edb,ew) curve
131 : int ProcHumRatCurvefV; // number of process leaving humidity ratio f(v) curve
132 : int RegenEnergyCurvefTW; // number of regen energy f(edb,ew) curve
133 : int RegenEnergyCurvefV; // number of regen energy f(v) curve
134 : int RegenVelCurvefTW; // number of regen velocity f(edb,ew) curve
135 : int RegenVelCurvefV; // number of regen velocity f(v) curve
136 : Real64 NomRegenTemp; // nominal regen temperature for regen energy curve [C]
137 : // Possible future inputs, hardwired for now depending on which performance model is in use, unit off if out of bounds
138 : Real64 MinProcAirInTemp; // min allowable process inlet air temperature [C]
139 : Real64 MaxProcAirInTemp; // max allowable process inlet air temperature [C]
140 : Real64 MinProcAirInHumRat; // min allowable process inlet air humidity ratio [kg water / kg air]
141 : Real64 MaxProcAirInHumRat; // max allowable process inlet air humidity ratio [kg water / kg air]
142 : // Internal Data
143 : Sched::Schedule *availSched = nullptr; // availability schedule
144 : Real64 NomProcAirMassFlow; // nominal process air mass flow rate [kg/s]
145 : Real64 NomRegenAirMassFlow; // nominal regeneration air mass flow rate [kg/s]
146 : Real64 ProcAirInTemp; // process inlet air temperature [C]
147 : Real64 ProcAirInHumRat; // process inlet air humidity ratio [kg water / kg air]
148 : Real64 ProcAirInEnthalpy; // process inlet air specific enthalpy [J/kg]
149 : Real64 ProcAirInMassFlowRate; // process inlet air mass flow rate [kg/s]
150 : Real64 ProcAirOutTemp; // process outlet air temperature [C]
151 : Real64 ProcAirOutHumRat; // process outlet air humidity ratio [kg water / kg air]
152 : Real64 ProcAirOutEnthalpy; // process outlet air specific enthalpy [J/kg]
153 : Real64 ProcAirOutMassFlowRate; // process outlet air mass flow rate [kg/s]
154 : Real64 RegenAirInTemp; // regen inlet air temperature [C]
155 : Real64 RegenAirInHumRat; // regen inlet air humidity ratio [kg water / kg air]
156 : Real64 RegenAirInEnthalpy; // regen inlet air specific enthalpy [J/kg]
157 : Real64 RegenAirInMassFlowRate; // regen inlet air mass flow rate [kg/s]
158 : Real64 RegenAirVel; // regen air velocity [m/s]
159 : std::string DehumType; // Type of desiccant dehumidifier
160 : DesicDehumType DehumTypeCode; // Type of desiccant dehumidifier, integer code
161 : Real64 WaterRemove; // water removed [kg]
162 : Real64 WaterRemoveRate; // water removal rate [kg/s]
163 : Real64 SpecRegenEnergy; // specific regen energy [J/kg of water removed]
164 : Real64 QRegen; // regen energy rate requested from regen coil [W]
165 : Real64 RegenEnergy; // regen energy requested from regen coil [J]
166 : Real64 ElecUseEnergy; // electricity consumption [J]
167 : Real64 ElecUseRate; // electricity consumption rate [W]
168 : Real64 PartLoad; // fraction of dehumidification capacity required to meet setpoint
169 : int RegenCapErrorIndex1; // recurring error message index for insufficient regen coil capacity
170 : int RegenCapErrorIndex2; // recurring error message index for insufficient regen coil capacity
171 : int RegenCapErrorIndex3; // recurring error message index for insufficient regen coil capacity
172 : int RegenCapErrorIndex4; // recurring error message index for insufficient regen coil capacity
173 : int RegenFanErrorIndex1; // recurring error message index for incorrect regen fan flow
174 : int RegenFanErrorIndex2; // recurring error message index for incorrect regen fan flow
175 : int RegenFanErrorIndex3; // recurring error message index for incorrect regen fan flow
176 : int RegenFanErrorIndex4; // recurring error message index for incorrect regen fan flow
177 : // structure elements unique to generic desiccant dehumidifier
178 : std::string HXType; // type of desiccant heat exchanger
179 : std::string HXName; // name of desiccant heat exchanger
180 : int HXTypeNum; // parameter number of desiccant heat exchanger
181 : std::string ExhaustFanCurveObject; // exhaust fan curve object
182 : std::string CoolingCoilType; // type of cooling coil used with desiccant heat exchanger
183 : std::string CoolingCoilName; // name of cooling coil used with desiccant heat exchanger
184 : int coolingCoil_TypeNum; // type of cooling coil, DataHVACGlobals coil type constants
185 : Selection Preheat; // determine condenser waste heat usage for pre heating regen air
186 : Real64 RegenSetPointTemp; // heating set-point for regeneration air [C]
187 : Real64 ExhaustFanMaxVolFlowRate; // exhaust fan maximum allowable air flow rate [m3/s]
188 : Real64 ExhaustFanMaxMassFlowRate; // exhaust fan maximum allowable air mass flow rate [kg/s]
189 : Real64 ExhaustFanMaxPower; // exhaust fan maximum allowable power [W]
190 : Real64 ExhaustFanPower; // exhaust fan power for reporting [W]
191 : Real64 ExhaustFanElecConsumption; // exhaust fan electric consumption for reporting [J]
192 : Real64 CompanionCoilCapacity; // DX coil capacity for dehumidifier companion cooling coil [W]
193 : HVAC::FanPlace regenFanPlace; // placement of the fan used for regeneration air flow
194 : int ControlNodeNum; // node number of control node
195 : int ExhaustFanCurveIndex; // exhaust fan curve object index
196 : int CompIndex; // index of HX component to call simheatrecovery
197 : int CoolingCoilOutletNode; // node number of cooling coil outlet node
198 : int RegenFanOutNode; // fan outlet node number mined from regen fan object
199 : int RegenCoilInletNode; // regen heating coil inlet node number mined from regen heater object
200 : int RegenCoilOutletNode; // regen heating coil outlet node number mined from regen heater object
201 : int HXProcInNode; // process inlet node num mined from desiccant heat exchanger object
202 : int HXProcOutNode; // process outlet node num mined from desiccant heat exchanger object
203 : int HXRegenInNode; // regen inlet node number mined from desiccant heat exchanger object
204 : int HXRegenOutNode; // regen outlet node number mined from desiccant heat exchanger object
205 : int CondenserInletNode; // regen outlet node number mined from desiccant heat exchanger object
206 : int DXCoilIndex; // DX Coil index mined from coil object
207 : int ErrCount; // error count
208 : int ErrIndex1; // error index
209 : Selection CoilUpstreamOfProcessSide; // used to determine if process inlet is pre-cooled
210 : bool RegenInletIsOutsideAirNode; // regen inlet is connected to an outside air node
211 : int RegenCoilType_Num; // type number of regen coil
212 : int CoilControlNode; // heating coil hot water or steam inlet node
213 : int CoilOutletNode; // outlet node for water coil
214 : PlantLocation plantLoc; // plant loop component location for water heating coil
215 : int HotWaterCoilMaxIterIndex; // Index to recurring warning message
216 : int HotWaterCoilMaxIterIndex2; // Index to recurring warning message
217 : Real64 MaxCoilFluidFlow; // hot water or steam mass flow rate regen. heating coil [kg/s]
218 : Real64 RegenCoilCapacity; // hot water or steam coil operating capacity [W]
219 :
220 : // Default Constructor
221 7 : DesiccantDehumidifierData()
222 14 : : PerformanceModel_Num(PerformanceModel::Invalid), ProcAirInNode(0), ProcAirOutNode(0), RegenAirInNode(0), RegenAirOutNode(0),
223 7 : RegenFanInNode(0), controlType(DesicDehumCtrlType::Invalid), HumRatSet(0.0), NomProcAirVolFlow(0.0), NomProcAirVel(0.0),
224 7 : NomRotorPower(0.0), RegenCoilIndex(0), RegenFanIndex(0), regenFanType(HVAC::FanType::Invalid), ProcDryBulbCurvefTW(0),
225 7 : ProcDryBulbCurvefV(0), ProcHumRatCurvefTW(0), ProcHumRatCurvefV(0), RegenEnergyCurvefTW(0), RegenEnergyCurvefV(0), RegenVelCurvefTW(0),
226 7 : RegenVelCurvefV(0), NomRegenTemp(121.0), MinProcAirInTemp(-73.3), MaxProcAirInTemp(65.6), MinProcAirInHumRat(0.0),
227 7 : MaxProcAirInHumRat(0.21273), NomProcAirMassFlow(0.0), NomRegenAirMassFlow(0.0), ProcAirInTemp(0.0), ProcAirInHumRat(0.0),
228 7 : ProcAirInEnthalpy(0.0), ProcAirInMassFlowRate(0.0), ProcAirOutTemp(0.0), ProcAirOutHumRat(0.0), ProcAirOutEnthalpy(0.0),
229 7 : ProcAirOutMassFlowRate(0.0), RegenAirInTemp(0.0), RegenAirInHumRat(0.0), RegenAirInEnthalpy(0.0), RegenAirInMassFlowRate(0.0),
230 14 : RegenAirVel(0.0), DehumTypeCode(DesicDehumType::Invalid), WaterRemove(0.0), WaterRemoveRate(0.0), SpecRegenEnergy(0.0), QRegen(0.0),
231 7 : RegenEnergy(0.0), ElecUseEnergy(0.0), ElecUseRate(0.0), PartLoad(0.0), RegenCapErrorIndex1(0), RegenCapErrorIndex2(0),
232 7 : RegenCapErrorIndex3(0), RegenCapErrorIndex4(0), RegenFanErrorIndex1(0), RegenFanErrorIndex2(0), RegenFanErrorIndex3(0),
233 21 : RegenFanErrorIndex4(0), HXTypeNum(0), coolingCoil_TypeNum(0), Preheat(Selection::Invalid), RegenSetPointTemp(0.0),
234 7 : ExhaustFanMaxVolFlowRate(0.0), ExhaustFanMaxMassFlowRate(0.0), ExhaustFanMaxPower(0.0), ExhaustFanPower(0.0),
235 7 : ExhaustFanElecConsumption(0.0), CompanionCoilCapacity(0.0), regenFanPlace(HVAC::FanPlace::Invalid), ControlNodeNum(0),
236 7 : ExhaustFanCurveIndex(0), CompIndex(0), CoolingCoilOutletNode(0), RegenFanOutNode(0), RegenCoilInletNode(0), RegenCoilOutletNode(0),
237 7 : HXProcInNode(0), HXProcOutNode(0), HXRegenInNode(0), HXRegenOutNode(0), CondenserInletNode(0), DXCoilIndex(0), ErrCount(0),
238 7 : ErrIndex1(0), CoilUpstreamOfProcessSide(Selection::Invalid), RegenInletIsOutsideAirNode(false), RegenCoilType_Num(0),
239 14 : CoilControlNode(0), CoilOutletNode(0), HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), MaxCoilFluidFlow(0.0),
240 7 : RegenCoilCapacity(0.0)
241 : {
242 7 : }
243 : };
244 :
245 : // Functions
246 :
247 : void SimDesiccantDehumidifier(EnergyPlusData &state,
248 : std::string const &CompName, // name of the dehumidifier unit
249 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
250 : int &CompIndex);
251 :
252 : void GetDesiccantDehumidifierInput(EnergyPlusData &state);
253 :
254 : void InitDesiccantDehumidifier(EnergyPlusData &state,
255 : int DesicDehumNum, // number of the current dehumidifier being simulated
256 : bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
257 : );
258 :
259 : void ControlDesiccantDehumidifier(EnergyPlusData &state,
260 : int DesicDehumNum, // number of the current dehumidifier being simulated
261 : Real64 &HumRatNeeded, // process air leaving humidity ratio set by controller [kg water/kg air]
262 : bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep !unused1208
263 : );
264 :
265 : void CalcSolidDesiccantDehumidifier(EnergyPlusData &state,
266 : int DesicDehumNum, // number of the current dehumidifier being simulated
267 : Real64 HumRatNeeded, // process air leaving humidity ratio set by controller [kgWater/kgDryAir]
268 : bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
269 : );
270 :
271 : void CalcGenericDesiccantDehumidifier(EnergyPlusData &state,
272 : int DesicDehumNum, // number of the current dehumidifier being simulated
273 : Real64 HumRatNeeded, // process air leaving humidity ratio set by controller [kg water/kg air]
274 : bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
275 : );
276 :
277 : void UpdateDesiccantDehumidifier(EnergyPlusData &state, int DesicDehumNum); // number of the current dehumidifier being simulated
278 :
279 : void ReportDesiccantDehumidifier(EnergyPlusData &state, int DesicDehumNum); // number of the current dehumidifier being simulated
280 :
281 : void CalcNonDXHeatingCoils(EnergyPlusData &state,
282 : int DesicDehumNum, // Desiccant dehumidifier unit index
283 : bool FirstHVACIteration, // flag for first HVAC iteration in the time step
284 : Real64 RegenCoilLoad, // heating coil load to be met (Watts)
285 : ObjexxFCL::Optional<Real64> RegenCoilLoadmet = _ // heating load met
286 : );
287 :
288 : int GetProcAirInletNodeNum(EnergyPlusData &state, std::string const &DesicDehumName, bool &ErrorsFound);
289 :
290 : int GetProcAirOutletNodeNum(EnergyPlusData &state, std::string const &DesicDehumName, bool &ErrorsFound);
291 :
292 : } // namespace DesiccantDehumidifiers
293 :
294 : struct DesiccantDehumidifiersData : BaseGlobalStruct
295 : {
296 :
297 : int NumDesicDehums = 0; // number of desiccant dehumidifiers of all types
298 : int NumSolidDesicDehums = 0; // number of solid desiccant dehumidifiers
299 : int NumGenericDesicDehums = 0; // number of generic desiccant dehumidifiers
300 : bool GetInputDesiccantDehumidifier = true; // First time, input is "gotten"
301 : bool InitDesiccantDehumidifierOneTimeFlag = true;
302 : bool MySetPointCheckFlag = true; // I think this actually needs to be a vector or a member variable on the struct, not just a single bool
303 : Array1D<DesiccantDehumidifiers::DesiccantDehumidifierData> DesicDehum;
304 : std::unordered_map<std::string, std::string> UniqueDesicDehumNames;
305 :
306 : Array1D_bool MyEnvrnFlag;
307 : Array1D_bool MyPlantScanFlag; // Used for init plant component for heating coils
308 : Real64 QRegen = 0.0; // required coil load passed to sim heating coil routine (W)
309 :
310 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
311 : {
312 2126 : }
313 :
314 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
315 : {
316 1152 : }
317 :
318 2100 : void clear_state() override
319 : {
320 2100 : new (this) DesiccantDehumidifiersData();
321 2100 : }
322 : };
323 :
324 : } // namespace EnergyPlus
325 :
326 : #endif
|