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 HeatingCoils_hh_INCLUDED
49 : #define HeatingCoils_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 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace HeatingCoils {
66 :
67 : // MODULE PARAMETER DEFINITIONS
68 : Real64 constexpr MinAirMassFlow(0.001);
69 :
70 : enum class HeatObjTypes // reclaim heat object types
71 : {
72 : Invalid = -1,
73 : COMPRESSORRACK_REFRIGERATEDCASE,
74 : COIL_DX_COOLING, // single speed DX
75 : COIL_DX_MULTISPEED,
76 : COIL_DX_MULTIMODE,
77 : CONDENSER_REFRIGERATION,
78 : COIL_DX_VARIABLE_COOLING,
79 : COIL_COOLING_DX_NEW, // Coil:Cooling:DX main one-for-all coil
80 : Num
81 : };
82 :
83 : struct HeatingCoilEquipConditions
84 : {
85 : // Members
86 : std::string Name; // Name of the HeatingCoil
87 : std::string HeatingCoilType; // Type of HeatingCoil ie. Heating or Cooling
88 : std::string HeatingCoilModel; // Type of HeatingCoil ie. Simple, Detailed, etc.
89 : int HCoilType_Num = 0;
90 : Constant::eFuel FuelType = Constant::eFuel::Invalid; // Type of fuel used, reference resource type integers
91 : Sched::Schedule *availSched = nullptr; // availability schedule
92 : int InsuffTemperatureWarn = 0; // Used for recurring error message
93 : Real64 InletAirMassFlowRate = 0.0; // MassFlow through the HeatingCoil being Simulated [kg/Sec]
94 : Real64 OutletAirMassFlowRate = 0.0;
95 : Real64 InletAirTemp = 0.0;
96 : Real64 OutletAirTemp = 0.0;
97 : Real64 InletAirHumRat = 0.0;
98 : Real64 OutletAirHumRat = 0.0;
99 : Real64 InletAirEnthalpy = 0.0;
100 : Real64 OutletAirEnthalpy = 0.0;
101 : Real64 HeatingCoilLoad = 0.0; // Total Load on the Coil [J]
102 : Real64 HeatingCoilRate = 0.0; // Total Coil Rate on the Coil [W]
103 : Real64 FuelUseLoad = 0.0; // Fuel Usage of Coil [J]
104 : Real64 ElecUseLoad = 0.0; // Electric Usage of Coil [J]
105 : Real64 FuelUseRate = 0.0; // Fuel Usage of Coil [W]
106 : Real64 ElecUseRate = 0.0; // Electric Usage of Coil [W]
107 : Real64 Efficiency = 0.0; // HeatingCoil Efficiency Value
108 : Real64 NominalCapacity = 0.0; // Nominal Capacity of Coil [W]
109 : Real64 DesiredOutletTemp = 0.0;
110 : Real64 DesiredOutletHumRat = 0.0;
111 : Real64 AvailTemperature = 0.0; // Used in heat recovery test [C]
112 : int AirInletNodeNum = 0;
113 : int AirOutletNodeNum = 0;
114 : int TempSetPointNodeNum = 0; // If applicable this is the node number that the temp setpoint exists.
115 : int Control = 0;
116 : int PLFCurveIndex = 0; // Index for part-load factor curve index for gas heating coil
117 : Real64 ParasiticElecLoad = 0.0; // parasitic electric load associated with the gas heating coil
118 : Real64 ParasiticFuelConsumption = 0.0; // parasitic fuel consumption associated with the gas heating coil (standing pilot light) [J]
119 : Real64 ParasiticFuelRate = 0.0; // avg. parasitic fuel consumption rate with the gas heating coil (standing pilot light) [W]
120 : Real64 ParasiticFuelCapacity = 0.0; // capacity of parasitic fuel consumption rate, input by user [W]
121 : Real64 RTF = 0.0; // Heater runtime fraction, including PLF curve impacts
122 : int RTFErrorIndex = 0; // used in recurring error warnings
123 : int RTFErrorCount = 0; // used in recurring error warnings
124 : int PLFErrorIndex = 0; // used in recurring error warnings
125 : int PLFErrorCount = 0; // used in recurring error warnings
126 : std::string ReclaimHeatingCoilName; // Name of reclaim heating coil
127 : int ReclaimHeatingSourceIndexNum = 0; // Index to reclaim heating source (condenser) of a specific type
128 : HeatObjTypes ReclaimHeatingSource = HeatObjTypes::Invalid; // The source for the Reclaim Heating Coil
129 : int NumOfStages = 0; // Number of speeds
130 : Array1D<Real64> MSNominalCapacity; // Nominal Capacity MS AC Furnace [W]
131 : Array1D<Real64> MSEfficiency; // Efficiency for MS AC Furnace [dimensionless]
132 : Array1D<Real64> MSParasiticElecLoad; // Parasitic elec load MS AC Furnace (gas only) [W]
133 : bool DesiccantRegenerationCoil = false; // true if it is a regeneration air heating coil defined in Desiccant Dehumidifier system
134 : int DesiccantDehumNum = 0; // index to desiccant dehumidifier object
135 : bool FaultyCoilSATFlag = false; // True if the coil has SAT sensor fault
136 : int FaultyCoilSATIndex = 0; // Index of the fault object corresponding to the coil
137 : Real64 FaultyCoilSATOffset = 0.0; // Coil SAT sensor offset
138 : bool reportCoilFinalSizes = true; // one time report of sizes to coil report
139 : int AirLoopNum = 0; // Airloop number
140 : };
141 :
142 : struct HeatingCoilNumericFieldData
143 : {
144 : Array1D_string FieldNames;
145 : };
146 :
147 : void SimulateHeatingCoilComponents(EnergyPlusData &state,
148 : std::string_view CompName,
149 : bool FirstHVACIteration,
150 : ObjexxFCL::Optional<Real64 const> QCoilReq = _, // coil load to be met
151 : ObjexxFCL::Optional_int CompIndex = _,
152 : ObjexxFCL::Optional<Real64> QCoilActual = _, // coil load actually delivered returned to calling component
153 : ObjexxFCL::Optional_bool_const SuppHeat = _, // True if current heating coil is a supplemental heating coil
154 : ObjexxFCL::Optional<HVAC::FanOp const> fanOp = _, // fan operating mode, FanOp::Cycling or FanOp::Continuous
155 : ObjexxFCL::Optional<Real64 const> PartLoadRatio = _, // part-load ratio of heating coil
156 : ObjexxFCL::Optional_int StageNum = _,
157 : ObjexxFCL::Optional<Real64 const> SpeedRatio = _ // Speed ratio of MultiStage heating coil
158 : );
159 :
160 : void GetHeatingCoilInput(EnergyPlusData &state);
161 :
162 : void InitHeatingCoil(EnergyPlusData &state, int CoilNum, bool FirstHVACIteration, Real64 QCoilRequired);
163 :
164 : void SizeHeatingCoil(EnergyPlusData &state, int CoilNum);
165 :
166 : void CalcElectricHeatingCoil(EnergyPlusData &state,
167 : int CoilNum, // index to heating coil
168 : Real64 &QCoilReq,
169 : Real64 &QCoilActual, // coil load actually delivered (W)
170 : HVAC::FanOp const fanOp, // fan operating mode
171 : Real64 PartLoadRatio // part-load ratio of heating coil
172 : );
173 :
174 : void CalcMultiStageElectricHeatingCoil(EnergyPlusData &state,
175 : int const CoilNum, // the number of the electric heating coil to be simulated
176 : Real64 const SpeedRatio, // SpeedRatio varies between 1.0 (maximum speed) and 0.0 (minimum speed)
177 : Real64 const CycRatio, // cycling part load ratio
178 : int const StageNum, // Stage number
179 : HVAC::FanOp const fanOp, // Fan operation mode
180 : Real64 &QCoilActual, // coil load actually delivered (W)
181 : bool const SuppHeat);
182 :
183 : void CalcFuelHeatingCoil(EnergyPlusData &state,
184 : int CoilNum, // index to heating coil
185 : Real64 QCoilReq,
186 : Real64 &QCoilActual, // coil load actually delivered (W)
187 : HVAC::FanOp const fanOp, // fan operating mode
188 : Real64 PartLoadRatio // part-load ratio of heating coil
189 : );
190 :
191 : void CalcMultiStageGasHeatingCoil(EnergyPlusData &state,
192 : int const CoilNum, // the number of the Gas heating coil to be simulated
193 : Real64 const SpeedRatio, // SpeedRatio varies between 1.0 (maximum speed) and 0.0 (minimum speed)
194 : Real64 const CycRatio, // cycling part load ratio
195 : int const StageNum, // Speed number
196 : HVAC::FanOp const fanOp // Fan operation mode
197 : );
198 :
199 : void CalcDesuperheaterHeatingCoil(EnergyPlusData &state,
200 : int CoilNum, // index to desuperheater heating coil
201 : Real64 QCoilReq, // load requested by the simulation for load based control [W]
202 : Real64 &QCoilActual // coil load actually delivered
203 : );
204 :
205 : void UpdateHeatingCoil(EnergyPlusData &state, int CoilNum);
206 :
207 : void ReportHeatingCoil(EnergyPlusData &state, int CoilNum, bool coilIsSuppHeater);
208 :
209 : void GetCoilIndex(EnergyPlusData &state, std::string const &HeatingCoilName, int &HeatingCoilIndex, bool &ErrorsFound);
210 :
211 : void CheckHeatingCoilSchedule(EnergyPlusData &state,
212 : std::string const &CompType, // unused1208
213 : std::string_view CompName,
214 : Real64 &Value,
215 : int &CompIndex);
216 :
217 : Real64 GetCoilCapacity(EnergyPlusData &state,
218 : std::string const &CoilType, // must match coil types in this module
219 : std::string const &CoilName, // must match coil names for the coil type
220 : bool &ErrorsFound // set to true if problem
221 : );
222 :
223 : Sched::Schedule *GetCoilAvailSched(EnergyPlusData &state,
224 : std::string const &CoilType, // must match coil types in this module
225 : std::string const &CoilName, // must match coil names for the coil type
226 : bool &ErrorsFound // set to true if problem
227 : );
228 :
229 : int GetCoilInletNode(EnergyPlusData &state,
230 : std::string_view CoilType, // must match coil types in this module
231 : std::string const &CoilName, // must match coil names for the coil type
232 : bool &ErrorsFound // set to true if problem
233 : );
234 :
235 : int GetCoilOutletNode(EnergyPlusData &state,
236 : std::string_view CoilType, // must match coil types in this module
237 : std::string const &CoilName, // must match coil names for the coil type
238 : bool &ErrorsFound // set to true if problem
239 : );
240 :
241 : int GetHeatReclaimSourceIndex(EnergyPlusData &state,
242 : std::string const &CoilType, // must match coil types in this module
243 : std::string const &CoilName, // must match coil names for the coil type
244 : bool &ErrorsFound // set to true if problem
245 : );
246 :
247 : int GetCoilControlNodeNum(EnergyPlusData &state,
248 : std::string const &CoilType, // must match coil types in this module
249 : std::string const &CoilName, // must match coil names for the coil type
250 : bool &ErrorsFound // set to true if problem
251 : );
252 :
253 : int GetHeatingCoilTypeNum(EnergyPlusData &state,
254 : std::string const &CoilType, // must match coil types in this module
255 : std::string const &CoilName, // must match coil names for the coil type
256 : bool &ErrorsFound // set to true if problem
257 : );
258 :
259 : int GetHeatingCoilIndex(EnergyPlusData &state,
260 : std::string const &CoilType, // must match coil types in this module
261 : std::string const &CoilName, // must match coil names for the coil type
262 : bool &ErrorsFound // set to true if problem
263 : );
264 :
265 : int GetHeatingCoilPLFCurveIndex(EnergyPlusData &state,
266 : std::string const &CoilType, // must match coil types in this module
267 : std::string const &CoilName, // must match coil names for the coil type
268 : bool &ErrorsFound // set to true if problem
269 : );
270 :
271 : int GetHeatingCoilNumberOfStages(EnergyPlusData &state,
272 : std::string const &CoilType, // must match coil types in this module
273 : std::string const &CoilName, // must match coil names for the coil type
274 : bool &ErrorsFound // set to true if problem
275 : );
276 :
277 : // sets data to a coil that is used as a regeneration air heating coil in
278 : // desiccant dehumidification system
279 : void SetHeatingCoilData(EnergyPlusData &state,
280 : int CoilNum, // Number of electric or gas heating Coil
281 : bool &ErrorsFound, // Set to true if certain errors found
282 : ObjexxFCL::Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil
283 : ObjexxFCL::Optional_int DesiccantDehumIndex = _ // Index for the desiccant dehum system where this caoil is used
284 : );
285 :
286 : void SetHeatingCoilAirLoopNumber(EnergyPlusData &state, std::string const &HeatingCoilName, int AirLoopNum, bool &ErrorsFound);
287 :
288 : } // namespace HeatingCoils
289 :
290 : struct HeatingCoilsData : BaseGlobalStruct
291 : {
292 :
293 : int NumDesuperheaterCoil = 0; // Total number of desuperheater heating coil objects in input
294 : int NumElecCoil = 0;
295 : int NumElecCoilMultiStage = 0;
296 : int NumFuelCoil = 0;
297 : int NumGasCoilMultiStage = 0;
298 : int NumHeatingCoils = 0; // The Number of HeatingCoils found in the Input
299 : Array1D_bool MySizeFlag;
300 : Array1D_bool ValidSourceType; // Used to determine if a source for a desuperheater heating coil is valid
301 : bool GetCoilsInputFlag = true; // Flag set to make sure you get input once
302 : bool CoilIsSuppHeater = false; // Flag set to indicate the heating coil is a supplemental heater
303 : Array1D_bool CheckEquipName;
304 : Array1D<HeatingCoils::HeatingCoilEquipConditions> HeatingCoil;
305 : Array1D<HeatingCoils::HeatingCoilNumericFieldData> HeatingCoilNumericFields;
306 : bool MyOneTimeFlag = true; // one time initialization flag
307 : bool InputErrorsFound = false;
308 :
309 : int MaxNums = 0; // Maximum number of numeric input fields
310 : int MaxAlphas = 0; // Maximum number of alpha input fields
311 : int TotalArgs = 0; // Total number of alpha and numeric arguments (max) for a certain object in the input file
312 : int ValidSourceTypeCounter = 0; // Counter used to determine if desuperheater source name is valid
313 : bool HeatingCoilFatalError = false; // used for error checking
314 : Array1D_bool MySPTestFlag; // used for error checking
315 : Array1D_bool ShowSingleWarning; // Used for single warning message for desuperheater coil
316 : Array1D_bool MyEnvrnFlag; // one time environment flag
317 :
318 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
319 : {
320 2126 : }
321 :
322 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
323 : {
324 1152 : }
325 :
326 2100 : void clear_state() override
327 : {
328 2100 : this->NumDesuperheaterCoil = 0;
329 2100 : this->NumElecCoil = 0;
330 2100 : this->NumElecCoilMultiStage = 0;
331 2100 : this->NumFuelCoil = 0;
332 2100 : this->NumGasCoilMultiStage = 0;
333 2100 : this->NumHeatingCoils = 0;
334 2100 : this->MySizeFlag.deallocate();
335 2100 : this->ValidSourceType.deallocate();
336 2100 : this->GetCoilsInputFlag = true;
337 2100 : this->CoilIsSuppHeater = false;
338 2100 : this->CheckEquipName.deallocate();
339 2100 : this->HeatingCoil.deallocate();
340 2100 : this->HeatingCoilNumericFields.deallocate();
341 2100 : this->MyOneTimeFlag = true;
342 2100 : this->InputErrorsFound = false;
343 2100 : this->MaxNums = 0;
344 2100 : this->MaxAlphas = 0;
345 2100 : this->TotalArgs = 0;
346 2100 : this->ValidSourceTypeCounter = 0;
347 2100 : this->HeatingCoilFatalError = false;
348 2100 : this->MySPTestFlag.clear();
349 2100 : this->ShowSingleWarning.clear();
350 2100 : this->MyEnvrnFlag.clear();
351 2100 : }
352 : };
353 :
354 : } // namespace EnergyPlus
355 :
356 : #endif
|