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 UnitHeater_hh_INCLUDED
49 : #define UnitHeater_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 UnitHeater {
66 :
67 : enum class HCoilType
68 : {
69 : Invalid = -1,
70 : Electric,
71 : Gas,
72 : WaterHeatingCoil,
73 : SteamCoil,
74 : Num
75 : };
76 :
77 : static constexpr std::array<std::string_view, static_cast<int>(HCoilType::Num)> HCoilTypeNamesUC{
78 : "COIL:HEATING:ELECTRIC",
79 : "COIL:HEATING:FUEL",
80 : "COIL:HEATING:WATER",
81 : "COIL:HEATING:STEAM",
82 : };
83 :
84 140 : struct UnitHeaterData
85 : {
86 : // Members
87 : // Input data
88 : std::string Name; // name of unit
89 : std::string SchedName; // availability schedule
90 : int SchedPtr; // index to schedule
91 : int AirInNode; // inlet air node number
92 : int AirOutNode; // outlet air node number
93 : int FanType_Num; // Fan type number (see DataHVACGlobals)
94 : std::string FanType; // type of fan
95 : std::string FanName; // name of fan
96 : int Fan_Index;
97 : int FanSchedPtr; // index to fan operating mode schedule
98 : int FanAvailSchedPtr; // index to fan availability schedule
99 : int ControlCompTypeNum;
100 : int CompErrIndex;
101 : Real64 MaxAirVolFlow; // m3/s
102 : Real64 MaxAirMassFlow; // kg/s
103 : std::string FanOperatesDuringNoHeating; // Indicates whether fan operates or not during no heating
104 : int FanOutletNode; // outlet node number for fan exit
105 : // (assumes fan is upstream of heating coil)
106 : int OpMode; // mode of operation; 1=cycling fan, cycling coil, 2=continuous fan, cycling coil
107 : HCoilType Type; // type of heating coil (water, gas, electric, etc.)
108 : std::string HCoilTypeCh; // actual object name
109 : std::string HCoilName; // name of heating coil
110 : int HCoil_Index;
111 : DataPlant::PlantEquipmentType HeatingCoilType;
112 : int HCoil_FluidIndex;
113 : Real64 MaxVolHotWaterFlow; // m3/s
114 : Real64 MaxVolHotSteamFlow; // m3/s
115 : Real64 MaxHotWaterFlow; // kg/s
116 : Real64 MaxHotSteamFlow; // m3/s
117 : Real64 MinVolHotWaterFlow; // m3/s
118 : Real64 MinVolHotSteamFlow; // m3/s
119 : Real64 MinHotWaterFlow; // kg/s
120 : Real64 MinHotSteamFlow; // kg/s
121 : int HotControlNode; // hot water control node, inlet of coil
122 : Real64 HotControlOffset; // control tolerance
123 : int HotCoilOutNodeNum; // outlet of coil
124 : PlantLocation HWplantLoc; // Location of plant component for hot plant coil
125 : Real64 PartLoadFrac; // part load fraction for the unit
126 : // Report data
127 : Real64 HeatPower; // unit heating output in watts
128 : Real64 HeatEnergy; // unit heating output in J
129 : Real64 ElecPower;
130 : Real64 ElecEnergy;
131 : std::string AvailManagerListName; // Name of an availability manager list object
132 : int AvailStatus;
133 : bool FanOffNoHeating; // True when fan is on during no heating load
134 : Real64 FanPartLoadRatio; // fan part-load ratio for time step
135 : int ZonePtr; // pointer to a zone served by a unit heater
136 : int HVACSizingIndex; // index of a HVACSizing object for a unit heater
137 : bool FirstPass; // detects first time through for resetting sizing data
138 :
139 : // Default Constructor
140 77 : UnitHeaterData()
141 77 : : SchedPtr(0), AirInNode(0), AirOutNode(0), FanType_Num(0), Fan_Index(0), FanSchedPtr(0), FanAvailSchedPtr(0), ControlCompTypeNum(0),
142 : CompErrIndex(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), FanOutletNode(0), OpMode(0), HCoil_Index(0),
143 : HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), HCoil_FluidIndex(0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0),
144 : MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0),
145 : MinHotSteamFlow(0.0), HotControlNode(0), HotControlOffset(0.0), HotCoilOutNodeNum(0), HWplantLoc{}, PartLoadFrac(0.0), HeatPower(0.0),
146 : HeatEnergy(0.0), ElecPower(0.0), ElecEnergy(0.0), AvailStatus(0), FanOffNoHeating(false), FanPartLoadRatio(0.0), ZonePtr(0),
147 77 : HVACSizingIndex(0), FirstPass(true)
148 : {
149 77 : }
150 : };
151 :
152 140 : struct UnitHeatNumericFieldData
153 : {
154 : // Members
155 : Array1D_string FieldNames;
156 :
157 : // Default Constructor
158 77 : UnitHeatNumericFieldData()
159 77 : {
160 77 : }
161 : };
162 :
163 : void SimUnitHeater(EnergyPlusData &state,
164 : std::string_view CompName, // name of the fan coil unit
165 : int const ZoneNum, // number of zone being served
166 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
167 : Real64 &PowerMet, // Sensible power supplied (W)
168 : Real64 &LatOutputProvided, // Latent add/removal supplied by window AC (kg/s), dehumid = negative
169 : int &CompIndex);
170 :
171 : void GetUnitHeaterInput(EnergyPlusData &state);
172 :
173 : void InitUnitHeater(EnergyPlusData &state,
174 : int const UnitHeatNum, // index for the current unit heater
175 : int const ZoneNum, // number of zone being served
176 : bool const FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
177 : );
178 :
179 : void SizeUnitHeater(EnergyPlusData &state, int const UnitHeatNum);
180 :
181 : void CalcUnitHeater(EnergyPlusData &state,
182 : int &UnitHeatNum, // number of the current fan coil unit being simulated
183 : int const ZoneNum, // number of zone being served
184 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
185 : Real64 &PowerMet, // Sensible power supplied (W)
186 : Real64 &LatOutputProvided // Latent power supplied (kg/s), negative = dehumidification
187 : );
188 :
189 : void CalcUnitHeaterComponents(EnergyPlusData &state,
190 : int const UnitHeatNum, // Unit index in unit heater array
191 : bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
192 : Real64 &LoadMet, // load met by unit (watts)
193 : Optional_int_const OpMode = _, // fan operating mode
194 : Optional<Real64 const> PartLoadRatio = _ // part-load ratio
195 : );
196 :
197 : // SUBROUTINE UpdateUnitHeater
198 :
199 : // No update routine needed in this module since all of the updates happen on
200 : // the Node derived type directly and these updates are done by other routines.
201 :
202 : // END SUBROUTINE UpdateUnitHeater
203 :
204 : void ReportUnitHeater(EnergyPlusData &state, int const UnitHeatNum); // Unit index in unit heater array
205 :
206 : } // namespace UnitHeater
207 :
208 771 : struct UnitHeatersData : BaseGlobalStruct
209 : {
210 :
211 : // MODULE PARAMETER DEFINITIONS
212 : std::string const cMO_UnitHeater = "ZoneHVAC:UnitHeater";
213 :
214 : // Character parameters for outside air control types:
215 :
216 : bool HCoilOn; // TRUE if the heating coil (gas or electric especially) should be running
217 : int NumOfUnitHeats; // Number of unit heaters in the input file
218 : Real64 QZnReq; // heating or cooling needed by zone [watts]
219 : Array1D_bool MySizeFlag;
220 : Array1D_bool CheckEquipName;
221 :
222 : bool InitUnitHeaterOneTimeFlag = true;
223 : bool GetUnitHeaterInputFlag = true;
224 : bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
225 : bool SetMassFlowRateToZero = false; // TRUE when mass flow rates need to be set to zero
226 :
227 : // Object Data
228 : EPVector<UnitHeater::UnitHeaterData> UnitHeat;
229 : EPVector<UnitHeater::UnitHeatNumericFieldData> UnitHeatNumericFields;
230 :
231 : Array1D_bool MyEnvrnFlag;
232 : Array1D_bool MyPlantScanFlag;
233 : Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers
234 :
235 : int RefrigIndex = 0;
236 :
237 0 : void clear_state() override
238 : {
239 0 : this->HCoilOn = false;
240 0 : this->NumOfUnitHeats = 0;
241 0 : this->QZnReq = 0.0;
242 0 : this->MySizeFlag.deallocate();
243 0 : this->CheckEquipName.deallocate();
244 0 : this->UnitHeat.deallocate();
245 0 : this->UnitHeatNumericFields.deallocate();
246 0 : this->InitUnitHeaterOneTimeFlag = true;
247 0 : this->GetUnitHeaterInputFlag = true;
248 0 : this->ZoneEquipmentListChecked = false;
249 0 : this->SetMassFlowRateToZero = false;
250 0 : this->MyEnvrnFlag.deallocate();
251 0 : this->MyPlantScanFlag.deallocate();
252 0 : this->MyZoneEqFlag.deallocate();
253 0 : this->RefrigIndex = 0;
254 0 : }
255 :
256 : // Default Constructor
257 771 : UnitHeatersData() = default;
258 : };
259 :
260 : } // namespace EnergyPlus
261 :
262 : #endif
|