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