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 ZonePlenum_hh_INCLUDED
49 : #define ZonePlenum_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/DataZoneEquipment.hh>
59 : #include <EnergyPlus/EPVector.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 :
62 : namespace EnergyPlus {
63 :
64 : // Forward declarations
65 : struct EnergyPlusData;
66 :
67 : namespace ZonePlenum {
68 :
69 : struct ZoneReturnPlenumConditions
70 : {
71 : std::string ZonePlenumName;
72 : std::string ZoneName;
73 : std::string ZoneNodeName;
74 : Real64 ZoneTemp = 0.0;
75 : Real64 ZoneHumRat = 0.0;
76 : Real64 ZoneEnthalpy = 0.0;
77 : Real64 OutletTemp = 0.0;
78 : Real64 OutletHumRat = 0.0;
79 : Real64 OutletEnthalpy = 0.0;
80 : Real64 OutletPressure = 0.0;
81 : int ZoneNodeNum = 0;
82 : int ActualZoneNum = 0;
83 : int OutletNode = 0;
84 : Real64 OutletMassFlowRate = 0.0; // MassFlow through the ZonePlenum being Simulated [kg/Sec]
85 : Real64 OutletMassFlowRateMaxAvail = 0.0; // [kg/Sec]
86 : Real64 OutletMassFlowRateMinAvail = 0.0; // [kg/Sec]
87 : int NumInducedNodes = 0;
88 : Array1D_int InducedNode;
89 : Array1D<Real64> InducedMassFlowRate;
90 : Array1D<Real64> InducedMassFlowRateMaxAvail;
91 : Array1D<Real64> InducedMassFlowRateMinAvail;
92 : Array1D<Real64> InducedTemp;
93 : Array1D<Real64> InducedHumRat;
94 : Array1D<Real64> InducedEnthalpy;
95 : Array1D<Real64> InducedPressure;
96 : Array1D<Real64> InducedCO2;
97 : Array1D<Real64> InducedGenContam;
98 : bool InitFlag = false;
99 : int NumInletNodes = 0;
100 : Array1D_int InletNode;
101 : Array1D<Real64> InletMassFlowRate;
102 : Array1D<Real64> InletMassFlowRateMaxAvail;
103 : Array1D<Real64> InletMassFlowRateMinAvail;
104 : Array1D<Real64> InletTemp;
105 : Array1D<Real64> InletHumRat;
106 : Array1D<Real64> InletEnthalpy;
107 : Array1D<Real64> InletPressure;
108 : Array1D_int ADUIndex; // index to AirDistUnit leaking to this plenum
109 : int NumADUs; // number of ADU's that can leak to this plenum
110 : Array1D_int ZoneEqNum; // list of zone equip config indices for this plenum
111 : bool checkEquipName = true;
112 : };
113 :
114 : struct ZoneSupplyPlenumConditions
115 : {
116 : std::string ZonePlenumName;
117 : std::string ZoneName;
118 : std::string ZoneNodeName;
119 : Real64 ZoneTemp = 0.0;
120 : Real64 ZoneHumRat = 0.0;
121 : Real64 ZoneEnthalpy = 0.0;
122 : Real64 InletTemp = 0.0;
123 : Real64 InletHumRat = 0.0;
124 : Real64 InletEnthalpy = 0.0;
125 : Real64 InletPressure = 0.0;
126 : int ZoneNodeNum = 0;
127 : int ActualZoneNum = 0;
128 : int InletNode = 0;
129 : Real64 InletMassFlowRate = 0.0; // MassFlow through the ZonePlenum being Simulated [kg/Sec]
130 : Real64 InletMassFlowRateMaxAvail = 0.0; // [kg/Sec]
131 : Real64 InletMassFlowRateMinAvail = 0.0; // [kg/Sec]
132 : bool InitFlag = false;
133 : int NumOutletNodes = 0;
134 : Array1D_int OutletNode;
135 : Array1D<Real64> OutletMassFlowRate;
136 : Array1D<Real64> OutletMassFlowRateMaxAvail;
137 : Array1D<Real64> OutletMassFlowRateMinAvail;
138 : Array1D<Real64> OutletTemp;
139 : Array1D<Real64> OutletHumRat;
140 : Array1D<Real64> OutletEnthalpy;
141 : Array1D<Real64> OutletPressure;
142 : bool checkEquipName = true;
143 : };
144 :
145 : void SimAirZonePlenum(EnergyPlusData &state,
146 : std::string_view CompName,
147 : DataZoneEquipment::AirLoopHVACZone iCompType,
148 : int &CompIndex,
149 : ObjexxFCL::Optional_bool_const FirstHVACIteration = _, // Autodesk:OPTIONAL Used without PRESENT check
150 : ObjexxFCL::Optional_bool_const FirstCall = _, // Autodesk:OPTIONAL Used without PRESENT check
151 : ObjexxFCL::Optional_bool PlenumInletChanged = _ // Autodesk:OPTIONAL Used without PRESENT check
152 : );
153 :
154 : void GetZonePlenumInput(EnergyPlusData &state);
155 :
156 : void InitAirZoneReturnPlenum(EnergyPlusData &state, int ZonePlenumNum);
157 :
158 : void InitAirZoneSupplyPlenum(EnergyPlusData &state, int ZonePlenumNum, bool FirstHVACIteration, bool FirstCall);
159 :
160 : void CalcAirZoneReturnPlenum(EnergyPlusData &state, int ZonePlenumNum);
161 :
162 : void CalcAirZoneSupplyPlenum(EnergyPlusData &state, int ZonePlenumNum, bool FirstCall);
163 :
164 : void UpdateAirZoneReturnPlenum(EnergyPlusData &state, int ZonePlenumNum);
165 :
166 : void UpdateAirZoneSupplyPlenum(EnergyPlusData &state, int ZonePlenumNum, bool &PlenumInletChanged, bool FirstCall);
167 :
168 : int GetReturnPlenumIndex(EnergyPlusData &state, int ExNodeNum);
169 :
170 : void GetReturnPlenumName(EnergyPlusData &state, int ReturnPlenumIndex, std::string &ReturnPlenumName);
171 :
172 : int getReturnPlenumIndexFromInletNode(EnergyPlusData &state, int InNodeNum);
173 :
174 : bool ValidateInducedNode(EnergyPlusData &state, int InduceNodeNum, int NumReturnNodes, Array1D<int> const &ReturnNode);
175 :
176 : } // namespace ZonePlenum
177 :
178 : struct ZonePlenumData : BaseGlobalStruct
179 : {
180 :
181 : bool GetInputFlag = true; // Flag set to make sure you get input once
182 : int NumZoneReturnPlenums = 0; // The Number of ZoneReturnPlenums found in the Input
183 : int NumZoneSupplyPlenums = 0; // The Number of ZoneSupplyPlenums found in the Input
184 :
185 : // these should be removed from state and just made individual flags on each plenum
186 : // however, this will require going into a few functions and changing them from looping over all plenums to only operating on the current plenum
187 : // this is the right step, but will possibly cause diffs, so pushing this for later.
188 : bool InitAirZoneReturnPlenumEnvrnFlag = true;
189 : bool InitAirZoneReturnPlenumOneTimeFlag = true;
190 : bool MyEnvrnFlag = true;
191 :
192 : EPVector<ZonePlenum::ZoneReturnPlenumConditions> ZoneRetPlenCond;
193 : EPVector<ZonePlenum::ZoneSupplyPlenumConditions> ZoneSupPlenCond;
194 :
195 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
196 : {
197 796 : }
198 :
199 0 : void clear_state() override
200 : {
201 0 : new (this) ZonePlenumData();
202 0 : }
203 : };
204 :
205 : } // namespace EnergyPlus
206 :
207 : #endif
|