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 DataContaminantBalance_hh_INCLUDED
49 : #define DataContaminantBalance_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/ScheduleManager.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace DataContaminantBalance {
66 :
67 : struct ContaminantData
68 : {
69 : // Members
70 : bool SimulateContaminants = false; // A logical flag to determine whether any contaminants are simulated or not
71 : bool CO2Simulation = false; // CO2 simulation flag
72 : Sched::Schedule *CO2OutdoorSched = nullptr; // CO2 outdoor level schedule
73 : bool GenericContamSimulation = false; // Generic contaminant simulation flag
74 : Sched::Schedule *genericOutdoorSched = nullptr; // Generic contaminant outdoor level schedule
75 : };
76 :
77 : struct ZoneContControls
78 : {
79 : // Members
80 : std::string Name; // Name of the contaminant controller
81 : std::string ZoneName; // Name of the zone
82 : int ActualZoneNum = 0;
83 : Sched::Schedule *availSched = nullptr; // Availability schedule
84 : Sched::Schedule *setptSched = nullptr; // Setpoint schedule
85 : bool EMSOverrideCO2SetPointOn = false; // EMS is calling to override CO2 setpoint
86 : Real64 EMSOverrideCO2SetPointValue = 0.0; // value EMS is directing to use for CO2 setpoint
87 : int NumOfZones = 0; // Number of controlled zones in the same airloop
88 : Array1D_int ControlZoneNum; // Controlled zone number
89 : Sched::Schedule *zoneMinCO2Sched = nullptr; // Minimum CO2 concentration schedule
90 : Sched::Schedule *zoneMaxCO2Sched = nullptr; // Maximum CO2 concentration schedule
91 :
92 : Sched::Schedule *zoneContamControllerSched = nullptr; // Index for this schedule
93 : Sched::Schedule *genericContamAvailSched = nullptr; // Availability Schedule name for generic contamiant
94 : Sched::Schedule *genericContamSetptSched = nullptr; // Schedule which determines the generic contaminant setpoint
95 : bool EMSOverrideGCSetPointOn = false; // EMS is calling to override generic contaminant setpoint
96 : Real64 EMSOverrideGCSetPointValue = 0.0; // value EMS is directing to use for generic contaminant setpoint
97 : };
98 :
99 : struct ZoneSystemContaminantDemandData // Contaminent loads to be met (kg air per second)
100 : {
101 : // Members
102 : Real64 OutputRequiredToCO2SP = 0.0; // Load required to meet CO2 setpoint
103 : Real64 RemainingOutputReqToCO2SP = 0.0; // Remaining load required to meet CO2 setpoint
104 : Real64 OutputRequiredToGCSP = 0.0; // Load required to meet generic contaminant setpoint
105 : Real64 RemainingOutputReqToGCSP = 0.0; // Remaining load required to meet generic contaminant setpoint
106 : };
107 :
108 : struct ZoneContamGenericDataConstant
109 : {
110 : // Members
111 : std::string Name; // Name of the constant generic contaminant source and sink
112 : std::string ZoneName; // Name of the zone
113 : int ActualZoneNum = 0; // Zone number
114 : Real64 GenerateRate = 0.0; // Generic contaminant design generation rate [m3/s]
115 : Sched::Schedule *generateRateSched = nullptr; // Generic contaminant design generation rate schedule pointer
116 : Real64 RemovalCoef = 0.0; // Generic contaminant design removal coefficient [m3/s]
117 : Sched::Schedule *removalCoefSched = nullptr; // Generic contaminant design removal coefficient schedule pointer
118 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
119 : };
120 :
121 : struct ZoneContamGenericDataPDriven
122 : {
123 : // Members
124 : std::string Name; // Name of the pressure driven generic contaminant source and sink
125 : std::string SurfName; // Name of the surface
126 : int SurfNum = 0; // Surface number
127 : Real64 GenRateCoef = 0.0; // Generic contaminant design generation rate coefficeint [m3/s]
128 : Sched::Schedule *generateRateCoefSched = nullptr; // Generic contaminant design generation rate schedule
129 : Real64 Expo = 0.0; // Generic contaminant exponent []
130 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
131 : };
132 :
133 : struct ZoneContamGenericDataCutoff
134 : {
135 : // Members
136 : std::string Name; // Name of the cutoff generic contaminant source and sink
137 : std::string ZoneName; // Name of the zone
138 : int ActualZoneNum = 0; // Zone number
139 : Real64 GenerateRate = 0.0; // Generic contaminant design generation rate [m3/s]
140 : Sched::Schedule *generateRateSched = nullptr; // Generic contaminant design generation rate schedule pointer
141 : Real64 CutoffValue = 0.0; // Cutoff value [ppm]
142 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
143 : };
144 :
145 : struct ZoneContamGenericDataDecay
146 : {
147 : // Members
148 : std::string Name; // Name of the decay generic contaminant source and sink
149 : std::string ZoneName; // Name of the zone
150 : int ActualZoneNum = 0; // Zone number
151 : Real64 InitEmitRate = 0.0; // Generic contaminant design generation rate [m3/s]
152 : Sched::Schedule *emitRateSched = nullptr; // Generic contaminant emission rate schedule pointer
153 : Real64 Time = 0.0; // Time since the styart of emission [s]
154 : Real64 DelayTime = 0.0; // Delay time constant [s]
155 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
156 : };
157 :
158 : struct ZoneContamGenericDataBLDiff
159 : {
160 : // Members
161 : std::string Name; // Name of the boundary layer diffusion generic contaminant source
162 : // and sink
163 : std::string SurfName; // Name of the surface
164 : int SurfNum = 0; // Surface number
165 : Real64 TransCoef = 0.0; // Generic contaminant mass transfer coefficeint [m/s]
166 : Sched::Schedule *transCoefSched = nullptr; // Generic contaminant mass transfer coefficeint schedule pointer
167 : Real64 HenryCoef = 0.0; // Generic contaminant Henry adsorption constant or
168 : // partition coefficient []
169 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
170 : };
171 :
172 : struct ZoneContamGenericDataDVS
173 : {
174 : // Members
175 : std::string Name; // Name of the deposition velocity generic contaminant sink
176 : std::string SurfName; // Name of the surface
177 : int SurfNum = 0; // Surface number
178 : Real64 DepoVelo = 0.0; // Generic contaminant deposition velocity [m/s]
179 : Sched::Schedule *depoVeloSched = nullptr; // Generic contaminant deposition velocity sink schedule pointer
180 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
181 : };
182 :
183 : struct ZoneContamGenericDataDRS
184 : {
185 : // Members
186 : std::string Name; // Name of the deposition rate generic contaminant sink
187 : std::string ZoneName; // Name of the zone
188 : int ActualZoneNum = 0; // Zone number
189 : Real64 DepoRate = 0.0; // Generic contaminant deposition rate [m/s]
190 : Sched::Schedule *depoRateSched = nullptr; // Generic contaminant deposition rate sink schedule
191 : Real64 GenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
192 : };
193 :
194 : } // namespace DataContaminantBalance
195 :
196 : struct ContaminantBalanceData : BaseGlobalStruct
197 : {
198 : Array1D<Real64> ZoneCO2SetPoint;
199 : Array1D<Real64> CO2PredictedRate;
200 :
201 : Array1D<Real64> ZoneCO2Gain; // CO2 gain from each Zone (People, equipment)
202 : Array1D<Real64> ZoneCO2GainFromPeople; // CO2 gain from each Zone (From People only)
203 : Array1D<Real64> ZoneCO2GainExceptPeople; // Added for hybrid model, CO2 gain from each Zone (except People)
204 :
205 : // Zone Air Contaminant conditions variables
206 : Array1D<Real64> ZoneAirCO2Avg; // AIR CO2 averaged over the zone time step
207 : Array1D<Real64> ZoneAirCO2; // AIR CO2
208 : Array1D<Real64> CO2ZoneTimeMinus1; // CO2 history terms for 3rd order derivative
209 : Array1D<Real64> CO2ZoneTimeMinus2; // Time Minus 2 Zone Time Steps Term
210 : Array1D<Real64> CO2ZoneTimeMinus3; // Time Minus 3 Zone Time Steps Term
211 : Array1D<Real64> CO2ZoneTimeMinus4; // Time Minus 4 Zone Time Steps Term
212 : Array1D<Real64> DSCO2ZoneTimeMinus1; // DownStepped CO2 history terms for 3rd order derivative
213 : Array1D<Real64> DSCO2ZoneTimeMinus2; // DownStepped Time Minus 2 Zone Time Steps Term
214 : Array1D<Real64> DSCO2ZoneTimeMinus3; // DownStepped Time Minus 3 Zone Time Steps Term
215 : Array1D<Real64> DSCO2ZoneTimeMinus4; // DownStepped Time Minus 4 Zone Time Steps Term
216 :
217 : Array1D<Real64> ZoneAirCO2Temp; // Temp zone air CO2 at time plus 1
218 : Array1D<Real64> CO2ZoneTimeMinus1Temp; // Zone air CO2 at previous timestep
219 : Array1D<Real64> CO2ZoneTimeMinus2Temp; // Zone air CO2 at timestep T-2
220 : Array1D<Real64> CO2ZoneTimeMinus3Temp; // Zone air CO2 at timestep T-3
221 : Array1D<Real64> ZoneAirCO2Old; // Last Time Steps Zone AIR Humidity Ratio
222 :
223 : Array1D<Real64> ZoneCO2MX; // TEMPORARY ZONE CO2 TO TEST CONVERGENCE in Exact and Euler method
224 : Array1D<Real64> ZoneCO2M2; // TEMPORARY ZONE CO2 at timestep t-2 in Exact and Euler method
225 : Array1D<Real64> ZoneCO21; // Zone CO2 at the previous time step used in Exact and Euler method
226 :
227 : Array1D<Real64> CONTRAT; // Zone CO2 at the previous time step used in Exact and Euler method
228 : Array1D<Real64> MixingMassFlowCO2; // Mixing MASS FLOW * CO2
229 : Real64 OutdoorCO2 = 0.0; // Outdoor CO2 level
230 :
231 : Array1D<Real64> ZoneAirDensityCO; // Mixing MASS FLOW * CO2
232 : Array1D<Real64> AZ;
233 : Array1D<Real64> BZ;
234 : Array1D<Real64> CZ;
235 :
236 : Array1D<Real64> ZoneGCSetPoint;
237 : Array1D<Real64> GCPredictedRate;
238 :
239 : Array1D<Real64> ZoneGCGain; // Generic contaminant gain from each Zone (People, equipment)
240 :
241 : // Zone Air Contaminant conditions variables
242 : Array1D<Real64> ZoneAirGCAvg; // AIR generic contaminant averaged over the zone time step
243 : Array1D<Real64> ZoneAirGC; // AIR generic contaminant
244 : Array1D<Real64> GCZoneTimeMinus1; // Generic contaminant history terms for 3rd order derivative
245 : Array1D<Real64> GCZoneTimeMinus2; // Time Minus 2 Zone Time Steps Term
246 : Array1D<Real64> GCZoneTimeMinus3; // Time Minus 3 Zone Time Steps Term
247 : Array1D<Real64> GCZoneTimeMinus4; // Time Minus 4 Zone Time Steps Term
248 : Array1D<Real64> DSGCZoneTimeMinus1; // DownStepped generic contaminant history terms for 3rd order
249 : // derivative
250 : Array1D<Real64> DSGCZoneTimeMinus2; // DownStepped Time Minus 2 Zone Time Steps Term
251 : Array1D<Real64> DSGCZoneTimeMinus3; // DownStepped Time Minus 3 Zone Time Steps Term
252 : Array1D<Real64> DSGCZoneTimeMinus4; // DownStepped Time Minus 4 Zone Time Steps Term
253 :
254 : Array1D<Real64> ZoneAirGCTemp; // Temp zone air generic contaminant at time plus 1
255 : Array1D<Real64> GCZoneTimeMinus1Temp; // Zone air generic contaminant at previous timestep
256 : Array1D<Real64> GCZoneTimeMinus2Temp; // Zone air generic contaminant at timestep T-2
257 : Array1D<Real64> GCZoneTimeMinus3Temp; // Zone air generic contaminant at timestep T-3
258 : Array1D<Real64> ZoneAirGCOld; // Last Time Steps Zone AIR generic contaminant
259 :
260 : Array1D<Real64> ZoneGCMX; // TEMPORARY ZONE CO2 TO TEST CONVERGENCE in Exact and Euler method
261 : Array1D<Real64> ZoneGCM2; // TEMPORARY ZONE CO2 at timestep t-2 in Exact and Euler method
262 : Array1D<Real64> ZoneGC1; // Zone CO2 at the previous time step used in Exact and Euler method
263 :
264 : Array1D<Real64> CONTRATGC; // Zone generic contaminant at the previous time step used in
265 : // Exact and Euler method
266 :
267 : Array1D<Real64> MixingMassFlowGC; // Mixing MASS FLOW * generic contaminant
268 :
269 : Real64 OutdoorGC = 0.0; // Outdoor generic contaminant level
270 :
271 : Array1D<Real64> ZoneAirDensityGC; // Mixing MASS FLOW * generic contaminant
272 : Array1D<Real64> AZGC;
273 : Array1D<Real64> BZGC;
274 : Array1D<Real64> CZGC;
275 :
276 : Array1D<DataContaminantBalance::ZoneSystemContaminantDemandData> ZoneSysContDemand;
277 : DataContaminantBalance::ContaminantData
278 : Contaminant; // A logical flag to determine whether any contaminants are simulated or not | CO2 simulation flag | CO2 outdoor
279 : // level schedule pointer | Generic contaminant simulation flag | Generic contaminant outdoor level schedule pointer
280 : Array1D<DataContaminantBalance::ZoneContControls> ContaminantControlledZone;
281 : Array1D<DataContaminantBalance::ZoneContamGenericDataConstant> ZoneContamGenericConstant;
282 : Array1D<DataContaminantBalance::ZoneContamGenericDataPDriven> ZoneContamGenericPDriven;
283 : Array1D<DataContaminantBalance::ZoneContamGenericDataCutoff> ZoneContamGenericCutoff;
284 : Array1D<DataContaminantBalance::ZoneContamGenericDataDecay> ZoneContamGenericDecay;
285 : Array1D<DataContaminantBalance::ZoneContamGenericDataBLDiff> ZoneContamGenericBLDiff;
286 : Array1D<DataContaminantBalance::ZoneContamGenericDataDVS> ZoneContamGenericDVS;
287 : Array1D<DataContaminantBalance::ZoneContamGenericDataDRS> ZoneContamGenericDRS;
288 :
289 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
290 : {
291 2126 : }
292 :
293 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
294 : {
295 1152 : }
296 :
297 2100 : void clear_state() override
298 : {
299 2100 : new (this) ContaminantBalanceData();
300 2100 : }
301 : };
302 :
303 : } // namespace EnergyPlus
304 :
305 : #endif
|