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 DataAirSystems_hh_INCLUDED
49 : #define DataAirSystems_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/DataHVACGlobals.hh>
58 : #include <EnergyPlus/DataHVACSystems.hh>
59 : #include <EnergyPlus/EnergyPlus.hh>
60 : #include <EnergyPlus/Plant/DataPlant.hh>
61 : #include <EnergyPlus/SimAirServingZones.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : // Forward declarations
66 : struct EnergyPlusData;
67 :
68 : namespace DataAirSystems {
69 :
70 : // Using/Aliasing
71 : using DataPlant::SubcomponentData;
72 : using OutputProcessor::MeterData;
73 :
74 : // Data
75 : // MODULE PARAMETER DEFINITIONS:
76 : // DERIVED TYPE DEFINITIONS
77 :
78 : // DefinePrimaryAirSystem contains the data for a primary air HVAC system
79 :
80 : // The ConnectionPoint derived type is used to link quickly between loops at connection points
81 : // and avoids the need for repetitive searches.
82 :
83 : // INTERFACE BLOCK SPECIFICATIONS
84 : // None
85 :
86 : // MODULE VARIABLE DECLARATIONS
87 : // For each type of air path, define an array of DefineAirPaths
88 :
89 : // Temporary arrays
90 :
91 : // Types
92 : struct AirLoopCompData // data for an individual component
93 : {
94 : // Members
95 : std::string TypeOf; // The 'keyWord' identifying component type
96 : std::string Name; // Component name
97 : SimAirServingZones::CompType CompType_Num = SimAirServingZones::CompType::Invalid; // Numeric designator for CompType (TypeOf)
98 : int CompIndex = 0; // Component Index in whatever is using this component
99 : HVACSystemData *compPointer = nullptr; // pointer to HVAC system
100 : int FlowCtrl = 0; // Component flow control (ACTIVE/PASSIVE)
101 : bool ON = true; // When true, the designated component or operation scheme is available
102 : bool Parent = false; // When true, the designated component is made up of sub-components
103 : std::string NodeNameIn; // Component inlet node name
104 : std::string NodeNameOut; // Component outlet node name
105 : int NodeNumIn = 0; // Component inlet node number
106 : int NodeNumOut = 0; // Component outlet node number
107 : bool MeteredVarsFound = false;
108 : int NumMeteredVars = 0;
109 : int NumSubComps = 0;
110 : int EnergyTransComp = 0; // 1=EnergyTransfer, 0=No EnergyTransfer Flag needed for reporting
111 : Real64 Capacity = 0.0; // ventilation load factor
112 : int OpMode = 0;
113 : Real64 TotPlantSupplyElec = 0.0;
114 : Real64 PlantSupplyElecEff = 0.0;
115 : Real64 PeakPlantSupplyElecEff = 0.0;
116 : Real64 TotPlantSupplyGas = 0.0;
117 : Real64 PlantSupplyGasEff = 0.0;
118 : Real64 PeakPlantSupplyGasEff = 0.0;
119 : Real64 TotPlantSupplyPurch = 0.0;
120 : Real64 PlantSupplyPurchEff = 0.0;
121 : Real64 PeakPlantSupplyPurchEff = 0.0;
122 : Real64 TotPlantSupplyOther = 0.0;
123 : Real64 PlantSupplyOtherEff = 0.0;
124 : Real64 PeakPlantSupplyOtherEff = 0.0;
125 : int AirSysToPlantPtr = 0; // =0 No plant loop connection, >0 index to AirSysToPlant array
126 : Array1D<MeterData> MeteredVar; // Index of energy output report data
127 : Array1D<SubcomponentData> SubComp; // Component list
128 : };
129 :
130 : struct AirLoopBranchData // a branch is a sequence of components
131 : {
132 : // Members
133 : std::string Name; // Name of the branch
134 : std::string ControlType; // Control type for the branch (not used)
135 : int TotalComponents = 0; // Total number of high level components on the branch
136 : Array1D_int FirstCompIndex; // Gives the component index in AllComp that corresponds to Comp
137 : Array1D_int LastCompIndex; // Gives comp index in AllComp that corresponds to last subcomponent
138 : int NodeNumIn = 0; // Branch inlet node number
139 : int NodeNumOut = 0; // Branch outlet node number
140 : HVAC::AirDuctType DuctType = HVAC::AirDuctType::Invalid; // 1=main, 2=cooling, 3=heating, 4=other
141 : Array1D<AirLoopCompData> Comp; // Component list--high level components
142 : // This list would include children, grandchildren, etc.
143 : int TotalNodes = 0; // total number of nodes on branch
144 : Array1D_int NodeNum; // node list (numbers)
145 : };
146 :
147 : struct AirLoopSplitterData // a splitter joins 1 inlet branch to multiple outlet branches
148 : {
149 : // Members
150 : bool Exists = false; // True if there is a splitter (only 1 allowed per loop)
151 : std::string Name; // Name of the Splitter
152 : int NodeNumIn = 0; // Node number for the inlet to the splitter
153 : int BranchNumIn = 0; // Reference number for branch connected to splitter inlet
154 : std::string NodeNameIn; // Node name for the inlet to the splitter
155 : int TotalOutletNodes = 0; // Number of outlet nodes for the splitter
156 : Array1D_int NodeNumOut; // Node numbers for the outlets to the splitter
157 : Array1D_int BranchNumOut; // Reference numbers for branches connected to splitter outlet
158 : Array1D_string NodeNameOut; // Node names for the outlets to the splitter
159 : };
160 :
161 : struct AirLoopMixerData // a mixer joins multiple inlet branches to a single outlet branch
162 : {
163 : // Members
164 : bool Exists = false; // True if there is a Mixer (only 1 allowed per loop)
165 : std::string Name; // Name of the Mixer
166 : int NodeNumOut = 0; // Node number for the outlet to the mixer
167 : int BranchNumOut = 0; // Reference number for branch connected to mixer outlet
168 : std::string NodeNameOut; // Node name for the outlet to the mixer
169 : int TotalInletNodes = 0; // Number of inlet nodes for the mixer
170 : Array1D_int NodeNumIn; // Node numbers for the inlets to the mixer
171 : Array1D_int BranchNumIn; // Reference numbers for branches connected to mixer inlet
172 : Array1D_string NodeNameIn; // Node names for the inlets to the mixer
173 : };
174 :
175 : struct DefinePrimaryAirSystem // There is an array of these for each primary air system
176 : {
177 : // Members
178 : std::string Name; // name of the system
179 : Real64 DesignVolFlowRate; // the design total supply air flow rate (m3/s)
180 : Real64 DesignReturnFlowFraction = 1.0; // the design return flow rate as a fraction of supply flow assuming no exhaust (0 to 1)
181 : int NumControllers = 0; // number of controllers on this air path
182 : Array1D_string ControllerName; // name of each controller on this system
183 : Array1D_string ControllerType; // type of each controller on this system
184 : Array1D_int ControllerIndex;
185 : Array1D_bool CanBeLockedOutByEcono; // true if controller inactive
186 : // when the economizer is active
187 : int NumBranches = 0; // number of branches making up this system
188 : Array1D<AirLoopBranchData> Branch; // data for each branch
189 : AirLoopSplitterData Splitter; // Data for splitter (if any)
190 : AirLoopMixerData Mixer; // Data for mixer (if any)
191 : Array1D_bool ControlConverged; // Convergence Parameter for controllers
192 : int NumOutletBranches = 0;
193 : std::array<int, 3> OutletBranchNum = {0}; // branch numbers of system outlets
194 : int NumInletBranches = 0;
195 : std::array<int, 3> InletBranchNum = {0}; // branch number of system inlets
196 : bool CentralHeatCoilExists = true; // true if there are central heating coils
197 : bool CentralCoolCoilExists = true; // true if there are central cooling coils
198 : bool OASysExists = false; // true if there is an Outside Air Sys
199 : bool isAllOA = false; // true if there is no return path and the main branch inlet is an outdoor air node
200 : int OASysInletNodeNum = 0; // node number of return air inlet to OA sys
201 : int OASysOutletNodeNum = 0; // node number of mixed air outlet of OA sys
202 : int OAMixOAInNodeNum = 0; // node number of the OA stream inlet to the
203 : // OA mixer component.
204 : bool RABExists = false; // true if there is a RAB
205 : int RABMixInNode = 0; // node num of RAB mixer inlet
206 : int SupMixInNode = 0; // node num of supply air inlet to mixer
207 : int MixOutNode = 0; // outlet node of mixer
208 : int RABSplitOutNode = 0; // node num of RAB splitter outlet
209 : int OtherSplitOutNode = 0; // node num of nonRAB splitter outlet
210 : int NumOACoolCoils = 0; // number of cooling coils in the outside air system
211 : int NumOAHeatCoils = 0; // number of heating coils in the outside air system
212 : int NumOAHXs = 0; // number of heat exchangers in the outside air system
213 : bool SizeAirloopCoil = true; // simulates air loop coils before calling controllers
214 : HVAC::FanType supFanType = HVAC::FanType::Invalid; // indicates which type of fan model to call for supply fan, legacy or new OO
215 : int supFanNum = 0; // index of the supply fan in the Fan data structure when model type is StructArrayLegacyFanModels
216 : HVAC::FanPlace supFanPlace = HVAC::FanPlace::Invalid; // location of fan relative to coil
217 : HVAC::FanType retFanType = HVAC::FanType::Invalid; // indicates which type of fan model to call for return fan, legacy or new OO
218 : int retFanNum = 0; // index of the return fan in the Fan data structure when model type is StructArrayLegacyFanModels
219 : Real64 FanDesCoolLoad = 0.0; // design fan heat gain for the air loop [W]
220 : bool EconomizerStagingCheckFlag = false; // flag to indicate that the applicability of the selected economizer staging operation mode is valid
221 : };
222 :
223 : struct ConnectionPoint
224 : {
225 : // Members
226 : int LoopType = 0;
227 : int LoopNum = 0;
228 : int BranchNum = 0;
229 : int CompNum = 0;
230 : };
231 :
232 : struct ConnectZoneComp
233 : {
234 : // Members
235 : int ZoneEqListNum = 0;
236 : int ZoneEqCompNum = 0;
237 : int PlantLoopType = 0;
238 : int PlantLoopNum = 0;
239 : int PlantLoopBranch = 0;
240 : int PlantLoopComp = 0;
241 : int FirstDemandSidePtr = 0;
242 : int LastDemandSidePtr = 0;
243 : };
244 :
245 : struct ConnectZoneSubComp
246 : {
247 : // Members
248 : int ZoneEqListNum = 0;
249 : int ZoneEqCompNum = 0;
250 : int ZoneEqSubCompNum = 0;
251 : int PlantLoopType = 0;
252 : int PlantLoopNum = 0;
253 : int PlantLoopBranch = 0;
254 : int PlantLoopComp = 0;
255 : int FirstDemandSidePtr = 0;
256 : int LastDemandSidePtr = 0;
257 : };
258 :
259 : struct ConnectZoneSubSubComp
260 : {
261 : // Members
262 : int ZoneEqListNum = 0;
263 : int ZoneEqCompNum = 0;
264 : int ZoneEqSubCompNum = 0;
265 : int ZoneEqSubSubCompNum = 0;
266 : int PlantLoopType = 0;
267 : int PlantLoopNum = 0;
268 : int PlantLoopBranch = 0;
269 : int PlantLoopComp = 0;
270 : int FirstDemandSidePtr = 0;
271 : int LastDemandSidePtr = 0;
272 : };
273 :
274 : struct ConnectAirSysComp
275 : {
276 : // Members
277 : int AirLoopNum = 0;
278 : int AirLoopBranch = 0;
279 : int AirLoopComp = 0;
280 : int PlantLoopType = 0;
281 : int PlantLoopNum = 0;
282 : int PlantLoopBranch = 0;
283 : int PlantLoopComp = 0;
284 : int FirstDemandSidePtr = 0;
285 : int LastDemandSidePtr = 0;
286 : };
287 :
288 : struct ConnectAirSysSubComp
289 : {
290 : // Members
291 : int AirLoopNum = 0;
292 : int AirLoopBranch = 0;
293 : int AirLoopComp = 0;
294 : int AirLoopSubComp = 0;
295 : int PlantLoopType = 0;
296 : int PlantLoopNum = 0;
297 : int PlantLoopBranch = 0;
298 : int PlantLoopComp = 0;
299 : int FirstDemandSidePtr = 0;
300 : int LastDemandSidePtr = 0;
301 : };
302 :
303 : struct ConnectAirSysSubSubComp
304 : {
305 : // Members
306 : int AirLoopNum = 0;
307 : int AirLoopBranch = 0;
308 : int AirLoopComp = 0;
309 : int AirLoopSubComp = 0;
310 : int AirLoopSubSubComp = 0;
311 : int PlantLoopType = 0;
312 : int PlantLoopNum = 0;
313 : int PlantLoopBranch = 0;
314 : int PlantLoopComp = 0;
315 : int FirstDemandSidePtr = 0;
316 : int LastDemandSidePtr = 0;
317 : };
318 :
319 : Real64 calcFanDesignHeatGain(EnergyPlusData &state, int dataFanIndex, Real64 desVolFlow);
320 :
321 : } // namespace DataAirSystems
322 :
323 : struct AirSystemsData : BaseGlobalStruct
324 : {
325 :
326 : EPVector<DataAirSystems::DefinePrimaryAirSystem> PrimaryAirSystems;
327 : Array1D<DataAirSystems::ConnectionPoint> DemandSideConnect; // Connections between loops
328 : Array1D<DataAirSystems::ConnectZoneComp> ZoneCompToPlant; // Connections between loops
329 : Array1D<DataAirSystems::ConnectZoneSubComp> ZoneSubCompToPlant; // Connections between loops
330 : Array1D<DataAirSystems::ConnectZoneSubSubComp> ZoneSubSubCompToPlant; // Connections between loops
331 : Array1D<DataAirSystems::ConnectAirSysComp> AirSysCompToPlant; // Connections between loops
332 : Array1D<DataAirSystems::ConnectAirSysSubComp> AirSysSubCompToPlant; // Connections between loops
333 : Array1D<DataAirSystems::ConnectAirSysSubSubComp> AirSysSubSubCompToPlant; // Connections between loops
334 :
335 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
336 : {
337 796 : }
338 :
339 0 : void clear_state() override
340 : {
341 0 : new (this) AirSystemsData();
342 0 : }
343 : };
344 :
345 : } // namespace EnergyPlus
346 :
347 : #endif
|