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