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 HVACSingleDuctInduc_hh_INCLUDED
49 : #define HVACSingleDuctInduc_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/Plant/Enums.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace HVACSingleDuctInduc {
66 :
67 : enum class SingleDuct_CV
68 : {
69 : Invalid = -1,
70 : TwoPipeInduc,
71 : FourPipeInduc,
72 : Num
73 : };
74 :
75 : struct IndUnitData
76 : {
77 : // Members
78 : // input data
79 : std::string Name; // name of unit
80 : std::string UnitType; // type of unit
81 : SingleDuct_CV UnitType_Num; // index to type of unit
82 : Sched::Schedule *availSched = nullptr; // index to schedule
83 : Real64 MaxTotAirVolFlow; // m3/s (autosizable)
84 : Real64 MaxTotAirMassFlow; // kg/s
85 : Real64 InducRatio; // ratio of induced air flow to primary air flow
86 : int PriAirInNode; // unit primary air inlet node number
87 : int SecAirInNode; // unit induced air inlet node number
88 : int OutAirNode; // unit air outlet node number
89 : int HWControlNode; // hot water control node
90 : int CWControlNode; // cold water control node
91 : std::string HCoilType; // type of heating coil component
92 : std::string HCoil; // name of heating coil component
93 : int HCoil_Num; // index to this coil
94 : DataPlant::PlantEquipmentType HeatingCoilType;
95 : Real64 MaxVolHotWaterFlow; // m3/s (autosizable)
96 : Real64 MaxHotWaterFlow; // kg/s
97 : Real64 MinVolHotWaterFlow; // m3/s
98 : Real64 MinHotWaterFlow; // kg/s
99 : Real64 HotControlOffset; // control tolerance
100 : PlantLocation HWPlantLoc; // index for plant location for hot water coil
101 : int HWCoilFailNum1; // index for errors
102 : int HWCoilFailNum2; // index for errors
103 : std::string CCoilType; // type of cooling coil component
104 : std::string CCoil; // name of cooling coil component
105 : int CCoil_Num; // index to this coil
106 : DataPlant::PlantEquipmentType CoolingCoilType;
107 : Real64 MaxVolColdWaterFlow; // m3/s (autosizable)
108 : Real64 MaxColdWaterFlow; // kg/s
109 : Real64 MinVolColdWaterFlow; // m3/s
110 : Real64 MinColdWaterFlow; // kg/s
111 : Real64 ColdControlOffset; // control tolerance
112 : PlantLocation CWPlantLoc; // index for plant component for chilled water coil
113 : int CWCoilFailNum1; // index for errors
114 : int CWCoilFailNum2; // index for errors
115 : std::string MixerName; // name of air mixer component
116 : int Mixer_Num; // index to this mixer
117 : Real64 MaxPriAirMassFlow; // kg/s
118 : Real64 MaxSecAirMassFlow; // kg/s
119 : int ADUNum; // index of corresponding air distribution unit
120 : Real64 DesCoolingLoad; // used for reporting during coil sizing
121 : Real64 DesHeatingLoad; // used for reporting during coil sizing
122 : int CtrlZoneNum; // Pointer to CtrlZone data structure
123 : int CtrlZoneInNodeIndex; // which controlled zone inlet node number corresponds with this unit
124 : int AirLoopNum; // index to airloop that this terminal unit is connected to
125 : Real64 OutdoorAirFlowRate; // zone outdoor air volume flow rate
126 :
127 : // Default Constructor
128 3 : IndUnitData()
129 6 : : UnitType_Num(SingleDuct_CV::Invalid), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0), InducRatio(2.5), PriAirInNode(0), SecAirInNode(0),
130 6 : OutAirNode(0), HWControlNode(0), CWControlNode(0), HCoil_Num(0), HeatingCoilType(DataPlant::PlantEquipmentType::Invalid),
131 3 : MaxVolHotWaterFlow(0.0), MaxHotWaterFlow(0.0), MinVolHotWaterFlow(0.0), MinHotWaterFlow(0.0), HotControlOffset(0.0), HWPlantLoc{},
132 6 : HWCoilFailNum1(0), HWCoilFailNum2(0), CCoil_Num(0), CoolingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolColdWaterFlow(0.0),
133 3 : MaxColdWaterFlow(0.0), MinVolColdWaterFlow(0.0), MinColdWaterFlow(0.0), ColdControlOffset(0.0), CWPlantLoc{}, CWCoilFailNum1(0),
134 6 : CWCoilFailNum2(0), Mixer_Num(0), MaxPriAirMassFlow(0.0), MaxSecAirMassFlow(0.0), ADUNum(0), DesCoolingLoad(0.0), DesHeatingLoad(0.0),
135 9 : CtrlZoneNum(0), CtrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0)
136 : {
137 3 : }
138 : void ReportIndUnit(EnergyPlusData &state);
139 : void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
140 : void reportTerminalUnit(EnergyPlusData &state);
141 : };
142 :
143 : void SimIndUnit(EnergyPlusData &state,
144 : std::string_view CompName, // name of the terminal unit
145 : bool const FirstHVACIteration, // TRUE if first HVAC iteration in time step
146 : int const ZoneNum, // index of zone served by the terminal unit
147 : int const ZoneNodeNum, // zone node number of zone served by the terminal unit
148 : int &CompIndex // which terminal unit in data structure
149 : );
150 :
151 : void GetIndUnits(EnergyPlusData &state);
152 :
153 : void InitIndUnit(EnergyPlusData &state,
154 : int const IUNum, // number of the current induction unit being simulated
155 : bool const FirstHVACIteration // TRUE if first air loop solution this HVAC step
156 : );
157 :
158 : void SizeIndUnit(EnergyPlusData &state, int const IUNum);
159 :
160 : void SimFourPipeIndUnit(EnergyPlusData &state,
161 : int const IUNum, // number of the current unit being simulated
162 : int const ZoneNum, // number of zone being served
163 : int const ZoneNodeNum, // zone node number
164 : bool const FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
165 : );
166 :
167 : void CalcFourPipeIndUnit(EnergyPlusData &state,
168 : int const IUNum, // Unit index
169 : bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
170 : int const ZoneNode, // zone node number
171 : Real64 const HWFlow, // hot water flow (kg/s)
172 : Real64 const CWFlow, // cold water flow (kg/s)
173 : Real64 &LoadMet // load met by unit (watts)
174 : );
175 :
176 : bool FourPipeInductionUnitHasMixer(EnergyPlusData &state, std::string_view CompName); // component (mixer) name
177 :
178 : } // namespace HVACSingleDuctInduc
179 :
180 : struct HVACSingleDuctInducData : BaseGlobalStruct
181 : {
182 : int NumIndUnits = 0;
183 : int NumFourPipes = 0;
184 : Array1D_bool CheckEquipName;
185 : bool GetIUInputFlag = true; // First time, input is "gotten"
186 : bool MyOneTimeFlag = true;
187 : Array1D_bool MyEnvrnFlag;
188 : Array1D_bool MySizeFlag;
189 : Array1D_bool MyPlantScanFlag;
190 : Array1D_bool MyAirDistInitFlag;
191 : Array1D<HVACSingleDuctInduc::IndUnitData> IndUnit;
192 : bool ZoneEquipmentListChecked = false;
193 :
194 2128 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
195 : {
196 2128 : }
197 :
198 1153 : void init_state([[maybe_unused]] EnergyPlusData &state) override
199 : {
200 1153 : }
201 :
202 2102 : void clear_state() override
203 : {
204 2102 : this->NumIndUnits = 0;
205 2102 : this->IndUnit.deallocate();
206 2102 : this->GetIUInputFlag = true;
207 2102 : this->NumFourPipes = 0;
208 2102 : this->MyOneTimeFlag = true;
209 2102 : this->MyEnvrnFlag.deallocate();
210 2102 : this->MySizeFlag.deallocate();
211 2102 : this->MyPlantScanFlag.deallocate();
212 2102 : this->MyAirDistInitFlag.deallocate();
213 2102 : this->CheckEquipName.deallocate();
214 2102 : this->ZoneEquipmentListChecked = false;
215 2102 : }
216 : };
217 :
218 : } // namespace EnergyPlus
219 :
220 : #endif
|