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 ZoneTempPredictorCorrector_hh_INCLUDED
49 : #define ZoneTempPredictorCorrector_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <string>
53 : #include <unordered_set>
54 : #include <vector>
55 :
56 : // ObjexxFCL Headers
57 : #include <ObjexxFCL/Array1D.hh>
58 : #include <ObjexxFCL/Array2D.hh>
59 :
60 : // EnergyPlus Headers
61 : #include <EnergyPlus/Data/BaseData.hh>
62 : #include <EnergyPlus/DataGlobals.hh>
63 : #include <EnergyPlus/DataHeatBalFanSys.hh>
64 : #include <EnergyPlus/DataHeatBalance.hh>
65 : #include <EnergyPlus/EnergyPlus.hh>
66 :
67 : namespace EnergyPlus {
68 :
69 : // Forward declarations
70 : struct EnergyPlusData;
71 :
72 : namespace ZoneTempPredictorCorrector {
73 :
74 : struct ZoneTempControl
75 : {
76 : std::string Name; // Name of the zone
77 : std::string TempSchedName; // Name of the schedule which determines the zone temp setpoint
78 : int TempSchedIndex = 0;
79 : std::string HeatTempSetptSchedName;
80 : int HeatTempSchedIndex = 0;
81 : std::string CoolTempSetptSchedName;
82 : int CoolTempSchedIndex = 0;
83 : };
84 :
85 : struct ZoneComfortFangerControl
86 : {
87 : std::string Name; // Name of the zone
88 : std::string PMVSchedName; // Name of the schedule which determines the zone temp setpoint
89 : int PMVSchedIndex = 0; // Index to PMV dual set point schedule
90 : std::string HeatPMVSetptSchedName; // Name of PMV heating set point schedule
91 : int HeatPMVSchedIndex = 0; // Index to PMV heating set point schedule
92 : std::string CoolPMVSetptSchedName; // Name of PMV cooling set point schedule
93 : int CoolPMVSchedIndex = 0; // INdex to PMV cooling set point schedule
94 : };
95 :
96 : struct AdaptiveComfortDailySetPointSchedule
97 : {
98 : bool initialized = false;
99 : Array1D<Real64> ThermalComfortAdaptiveASH55_Upper_90;
100 : Array1D<Real64> ThermalComfortAdaptiveASH55_Upper_80;
101 : Array1D<Real64> ThermalComfortAdaptiveASH55_Central;
102 : Array1D<Real64> ThermalComfortAdaptiveCEN15251_Upper_I;
103 : Array1D<Real64> ThermalComfortAdaptiveCEN15251_Upper_II;
104 : Array1D<Real64> ThermalComfortAdaptiveCEN15251_Upper_III;
105 : Array1D<Real64> ThermalComfortAdaptiveCEN15251_Central;
106 : };
107 :
108 : struct SumHATOutput
109 : {
110 : // Output results from calSumHAT
111 : Real64 sumIntGain = 0.0;
112 : Real64 sumHA = 0.0;
113 : Real64 sumHATsurf = 0.0;
114 : Real64 sumHATref = 0.0;
115 : };
116 :
117 : struct ZoneSpaceHeatBalanceData
118 : {
119 : // This entire struct is re-initialized during the simulation, so no static data may be stored here (e.g. zone or space characteristics)
120 :
121 : // Zone or space air drybulb temperature conditions
122 : Real64 MAT = DataHeatBalance::ZoneInitialTemp; // Mean Air Temperature at end of zone time step [C]
123 : Real64 MRT = DataHeatBalance::ZoneInitialTemp; // Mean Radiant Temperature [C]
124 : Real64 ZTAV = DataHeatBalance::ZoneInitialTemp; // Air Temperature Averaged over the zone time step (during HVAC Time Steps)
125 : Real64 ZT = DataHeatBalance::ZoneInitialTemp; // Air Temperature Averaged over the system time step
126 : Real64 ZTAVComf = DataHeatBalance::ZoneInitialTemp; // Air Temperature Averaged used in thermal comfort models (currently Fanger model only) -
127 : // TODO: lagged? could MAT be used instead?
128 : Real64 XMPT = DataHeatBalance::ZoneInitialTemp; // Air temperature at previous system time step
129 : std::array<Real64, 4> XMAT = {DataHeatBalance::ZoneInitialTemp,
130 : DataHeatBalance::ZoneInitialTemp,
131 : DataHeatBalance::ZoneInitialTemp,
132 : DataHeatBalance::ZoneInitialTemp}; // Temporary air temperature history
133 : std::array<Real64, 4> DSXMAT = {DataHeatBalance::ZoneInitialTemp,
134 : DataHeatBalance::ZoneInitialTemp,
135 : DataHeatBalance::ZoneInitialTemp,
136 : DataHeatBalance::ZoneInitialTemp}; // Down Stepped air temperature history storage
137 : // Exact and Euler solutions
138 : Real64 TMX = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature to test convergence in Exact and Euler method
139 : Real64 TM2 = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature at timestep t-2 in Exact and Euler method
140 : Real64 T1 = 0.0; // Air temperature at the previous time step used in Exact and Euler method
141 :
142 : // Zone or space air moisture conditions
143 : Real64 airHumRat = 0.01; // Air Humidity Ratio
144 : Real64 airHumRatAvg = 0.01; // Air Humidity Ratio averaged over the zone time step
145 : Real64 airHumRatTemp = 0.01; // Temporary air humidity ratio at time plus 1
146 : Real64 airHumRatAvgComf = 0.01; // Air Humidity Ratio averaged over the zone time
147 : // step used in thermal comfort models (currently Fang model only)
148 : // TODO: lagged? could ZoneAirHumRatAvg be used instead?
149 :
150 : std::array<Real64, 4> WPrevZoneTS = {0.0, 0.0, 0.0, 0.0}; // Air Humidity Ratio zone time step history
151 : std::array<Real64, 4> DSWPrevZoneTS = {0.0, 0.0, 0.0, 0.0}; // DownStepped Air Humidity Ratio zone time step history for 3rd order derivative
152 : Real64 WTimeMinusP = 0.0; // Air Humidity Ratio at previous system time step
153 : // Exact and Euler solutions
154 : Real64 WMX = 0.0; // Temporary humidity ratio to test convergence in Exact and Euler method
155 : Real64 WM2 = 0.0; // Temporary humidity ratio at timestep t-2 in Exact and Euler method
156 : Real64 W1 = 0.0; // Zone/space humidity ratio at the previous time step used in Exact and Euler method
157 :
158 : std::array<Real64, 4> ZTM = {
159 : 0.0, 0.0, 0.0, 0.0}; // air temperature at previous 3 zone timesteps (sized to 4 to be compatible with other similar arrays)
160 : std::array<Real64, 4> WPrevZoneTSTemp = {0.0, 0.0, 0.0, 0.0}; // Temporary Air Humidity Ratio zone time step history (4th term not used)
161 :
162 : Real64 SumIntGain = 0.0; // Sum of convective internal gains
163 : Real64 SumHA = 0.0; // Sum of Hc*Area
164 : Real64 SumHATsurf = 0.0; // Sum of Hc*Area*Tsurf
165 : Real64 SumHATref = 0.0; // Sum of Hc*Area*Tref= 0.0; for ceiling diffuser convection correlation
166 : Real64 SumMCp = 0.0; // Sum of MassFlowRate*Cp
167 : Real64 SumMCpT = 0.0; // Sum of MassFlowRate*Cp*T
168 : Real64 SumSysMCp = 0.0; // Sum of air system MassFlowRate*Cp
169 : Real64 SumSysMCpT = 0.0; // Sum of air system MassFlowRate*Cp*T
170 : Real64 SumIntGainExceptPeople = 0.0;
171 :
172 : // Moisture variables to carry info from HB to the Zone Temp Predictor-Corrector for Fan System
173 : Real64 SumHmAW = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*INSIDE Humidity Ratio
174 : Real64 SumHmARa = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air
175 : Real64 SumHmARaW = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air* Inside Humidity Ration
176 : Real64 SumHmARaZ = 0.0;
177 :
178 : Real64 TempDepCoef = 0.0; // Temperature dependent coefficient
179 : Real64 TempIndCoef = 0.0; // Temperature ndependent coefficient
180 : Real64 TempHistoryTerm = 0.0;
181 :
182 : Real64 MCPI = 0.0; // INFILTRATION MASS FLOW * AIR SPECIFIC HEAT
183 : Real64 MCPTI = 0.0; // INFILTRATION MASS FLOW * AIR CP * AIR TEMPERATURE
184 : Real64 MCPV = 0.0; // VENTILATION MASS FLOW * AIR SPECIFIC HEAT
185 : Real64 MCPTV = 0.0; // VENTILATION MASS FLOW * AIR CP * AIR TEMPERATURE
186 : Real64 MCPM = 0.0; // Mixing MASS FLOW * AIR SPECIFIC HEAT
187 : Real64 MCPTM = 0.0; // Mixing MASS FLOW * AIR CP * AIR TEMPERATURE
188 : Real64 MCPE = 0.0; // EARTHTUBE MASS FLOW * AIR SPECIFIC HEAT
189 : Real64 EAMFL = 0.0; // OUTDOOR AIR MASS FLOW for EarthTube
190 : Real64 EAMFLxHumRat = 0.0; // OUTDOOR AIR MASS FLOW * Humidity Ratio for EarthTube (water vapor mass flow)
191 : Real64 MCPTE = 0.0; // EARTHTUBE MASS FLOW * AIR CP * AIR TEMPERATURE
192 : Real64 MCPC = 0.0; // COOLTOWER MASS FLOW * AIR SPECIFIC HEAT
193 : Real64 CTMFL = 0.0; // OUTDOOR AIR MASS FLOW for cooltower
194 : Real64 MCPTC = 0.0; // COOLTOWER MASS FLOW * AIR CP * AIR TEMPERATURE
195 : Real64 ThermChimAMFL = 0.0; // OUTDOOR AIR MASS FLOW for THERMALCHIMNEY
196 : Real64 MCPTThermChim = 0.0; // THERMALCHIMNEY MASS FLOW * AIR SPECIFIC HEAT
197 : Real64 MCPThermChim = 0.0; // THERMALCHIMNEY MASS FLOW * AIR CP * AIR TEMPERATURE
198 : Real64 latentGain = 0.0; // Latent Energy from each Zone (People, equipment)
199 : Real64 latentGainExceptPeople = 0.0; // Added for hybrid model -- Latent Energy from each Zone (equipment)
200 : Real64 OAMFL = 0.0; // OUTDOOR AIR MASS FLOW (kg/s) for infiltration
201 : Real64 VAMFL = 0.0; // OUTDOOR AIR MASS FLOW (kg/s) for ventilation
202 : Real64 NonAirSystemResponse = 0.0; // Convective heat addition rate from non forced air
203 : // equipment such as baseboards plus heat from lights to
204 : Real64 SysDepZoneLoads = 0.0; // Convective heat addition or subtraction rate from sources that
205 : // depend on what is happening with the HVAC system. Such as:
206 : // heat gain from lights to return air when return flow = 0= 0.0; heat gain
207 : // from air flow windows to return air when return air flow = 0= 0.0;
208 : // and heat removed by return air from refrigeration cases when
209 : // return air flow = 0.
210 : Real64 SysDepZoneLoadsLagged = 0.0; // SysDepZoneLoads saved to be added to zone heat balance next
211 : // HVAC time step
212 : Real64 MDotCPOA = 0.0; // Airbalance MASS FLOW * AIR SPECIFIC HEAT used at Air Balance Method = Quadrature in the ZoneAirBalance:OutdoorAir
213 : Real64 MDotOA = 0.0; // Airbalance MASS FLOW rate used at Air Balance Method = Quadrature in the ZoneAirBalance:OutdoorAir
214 : Real64 MixingMAT = DataHeatBalance::ZoneInitialTemp; // Air temperature for mixing
215 : Real64 MixingHumRat = 0.01; // Air humidity ratio for mixing
216 : Real64 MixingMassFlowZone = 0.0; // Mixing MASS FLOW (kg/s)
217 : Real64 MixingMassFlowXHumRat = 0.0; // Mixing MASS FLOW * Humidity Ratio
218 :
219 : Real64 setPointLast = 0.0;
220 : Real64 tempIndLoad = 0.0;
221 : Real64 tempDepLoad = 0.0;
222 : Real64 airRelHum = 0.0; // Zone relative humidity in percent
223 : Real64 AirPowerCap = 0.0; // "air power capacity" Vol*VolMult*rho*Cp/timestep [W/degK]
224 : int hmThermalMassMultErrIndex = 0;
225 :
226 11716 : virtual ~ZoneSpaceHeatBalanceData() = default;
227 :
228 : void beginEnvironmentInit(EnergyPlusData &state);
229 :
230 : void setUpOutputVars(EnergyPlusData &state, std::string_view prefix, std::string const &key);
231 :
232 : void predictSystemLoad(EnergyPlusData &state,
233 : bool shortenTimeStepSys,
234 : bool useZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step
235 : Real64 priorTimeStep, // the old value for timestep length is passed for possible use in interpolating
236 : int zoneNum,
237 : int spaceNum = 0);
238 :
239 : void calcPredictedSystemLoad(EnergyPlusData &state, Real64 RAFNFrac, int zoneNum, int spaceNum = 0);
240 :
241 : void calcZoneOrSpaceSums(EnergyPlusData &state,
242 : bool CorrectorFlag, // Corrector call flag
243 : int zoneNum,
244 : int spaceNum = 0);
245 :
246 : virtual SumHATOutput calcSumHAT(EnergyPlusData &state, int zoneNum, int spaceNum) = 0;
247 :
248 : void updateTemperatures(
249 : EnergyPlusData &state, bool ShortenTimeStepSys, bool UseZoneTimeStepHistory, Real64 PriorTimeStep, int zoneNum, int spaceNum = 0);
250 :
251 : Real64 correctAirTemp(EnergyPlusData &state,
252 : bool useZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step history
253 : int zoneNum,
254 : int spaceNum = 0);
255 :
256 : void correctHumRat(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
257 :
258 : void calcPredictedHumidityRatio(EnergyPlusData &state, Real64 RAFNFrac, int zoneNum, int spaceNum = 0);
259 :
260 : void pushZoneTimestepHistory(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
261 :
262 : void pushSystemTimestepHistory(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
263 :
264 : void revertZoneTimestepHistory(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
265 : };
266 :
267 : struct ZoneHeatBalanceData : ZoneSpaceHeatBalanceData
268 : {
269 : SumHATOutput calcSumHAT(EnergyPlusData &state, int zoneNum, [[maybe_unused]] int spaceNum) override;
270 : };
271 :
272 : struct SpaceHeatBalanceData : ZoneSpaceHeatBalanceData
273 : {
274 : SumHATOutput calcSumHAT(EnergyPlusData &state, int zoneNum, int spaceNum) override;
275 : };
276 :
277 : // Functions
278 :
279 : void ManageZoneAirUpdates(EnergyPlusData &state,
280 : DataHeatBalFanSys::PredictorCorrectorCtrl UpdateType, // Can be iGetZoneSetPoints, iPredictStep, iCorrectStep
281 : Real64 &ZoneTempChange, // Temp change in zone air btw previous and current timestep
282 : bool ShortenTimeStepSys,
283 : bool UseZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step
284 : Real64 PriorTimeStep // the old value for timestep length is passed for possible use in interpolating
285 : );
286 :
287 : void GetZoneAirSetPoints(EnergyPlusData &state);
288 :
289 : void InitZoneAirSetPoints(EnergyPlusData &state);
290 :
291 : void PredictSystemLoads(EnergyPlusData &state,
292 : bool ShortenTimeStepSys,
293 : bool UseZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step
294 : Real64 PriorTimeStep // the old value for timestep length is passed for possible use in interpolating
295 : );
296 :
297 : void CalcZoneAirTempSetPoints(EnergyPlusData &state);
298 :
299 : void CalculateMonthlyRunningAverageDryBulb(EnergyPlusData &state, Array1D<Real64> &runningAverageASH, Array1D<Real64> &runningAverageCEN);
300 :
301 : void
302 : CalculateAdaptiveComfortSetPointSchl(EnergyPlusData &state, Array1D<Real64> const &runningAverageASH, Array1D<Real64> const &runningAverageCEN);
303 :
304 : Real64 correctZoneAirTemps(EnergyPlusData &state,
305 : bool useZoneTimeStepHistory // if true then use zone timestep history, if false use system time step history
306 : );
307 :
308 : void PushZoneTimestepHistories(EnergyPlusData &state);
309 :
310 : void PushSystemTimestepHistories(EnergyPlusData &state);
311 :
312 : void RevertZoneTimestepHistories(EnergyPlusData &state);
313 :
314 : void DownInterpolate4HistoryValues(Real64 OldTimeStep,
315 : Real64 NewTimeStep,
316 : Real64 oldVal0,
317 : Real64 oldVal1,
318 : Real64 oldVal2,
319 : Real64 &newVal0,
320 : Real64 &newVal1,
321 : Real64 &newVal2,
322 : Real64 &newVal3,
323 : Real64 &newVal4);
324 :
325 : Real64
326 : DownInterpolate4HistoryValues(Real64 OldTimeStep, Real64 NewTimeStep, std::array<Real64, 4> const &oldVals, std::array<Real64, 4> &newVals);
327 :
328 : void InverseModelTemperature(EnergyPlusData &state,
329 : int ZoneNum, // Zone number
330 : Real64 SumIntGain, // Zone sum of convective internal gains
331 : Real64 SumIntGainExceptPeople, // Zone sum of convective internal gains except for people
332 : Real64 SumHA, // Zone sum of Hc*Area
333 : Real64 SumHATsurf, // Zone sum of Hc*Area*Tsurf
334 : Real64 SumHATref, // Zone sum of Hc*Area*Tref, for ceiling diffuser convection correlation
335 : Real64 SumMCp, // Zone sum of MassFlowRate*Cp
336 : Real64 SumMCpT, // Zone sum of MassFlowRate*Cp*T
337 : Real64 SumSysMCp, // Zone sum of air system MassFlowRate*Cp
338 : Real64 SumSysMCpT, // Zone sum of air system MassFlowRate*Cp*T
339 : Real64 AirCap // Formerly CoefAirrat, coef in zone temp eqn with dim of "air power capacity"rd
340 : );
341 :
342 : void processInverseModelMultpHM(EnergyPlusData &state,
343 : Real64 &multiplierHM, // Hybrid model thermal mass multiplier
344 : Real64 &multSumHM, // Sum of Hybrid model thermal mass multipliers
345 : Real64 &countSumHM, // Count of number of points in sum
346 : Real64 &multAvgHM, // Average of hybrid model mass multipier
347 : int zoneNum // Zone number for the hybrid model
348 : );
349 :
350 : void InverseModelHumidity(EnergyPlusData &state,
351 : int ZoneNum, // Zone number
352 : Real64 LatentGain, // Zone sum of latent gain
353 : Real64 LatentGainExceptPeople, // Zone sum of latent gain except for people
354 : Real64 ZoneMassFlowRate, // Zone air mass flow rate
355 : Real64 MoistureMassFlowRate, // Zone moisture mass flow rate
356 : Real64 H2OHtOfVap, // Heat of vaporization of air
357 : Real64 RhoAir // Air density
358 : );
359 :
360 : void CalcZoneComponentLoadSums(EnergyPlusData &state,
361 : int ZoneNum, // Zone number
362 : ZoneTempPredictorCorrector::ZoneSpaceHeatBalanceData *thisHB,
363 : DataHeatBalance::AirReportVars &thisAirRpt);
364 :
365 : bool VerifyThermostatInZone(EnergyPlusData &state, std::string const &ZoneName); // Zone to verify
366 :
367 : bool VerifyControlledZoneForThermostat(EnergyPlusData &state, std::string const &ZoneName); // Zone to verify
368 :
369 : void DetectOscillatingZoneTemp(EnergyPlusData &state);
370 :
371 : void AdjustAirSetPointsforOpTempCntrl(EnergyPlusData &state, int TempControlledZoneID, int ActualZoneNum, Real64 &ZoneAirSetPoint);
372 :
373 : void AdjustOperativeSetPointsforAdapComfort(EnergyPlusData &state, int TempControlledZoneID, Real64 &ZoneAirSetPoint);
374 :
375 : void CalcZoneAirComfortSetPoints(EnergyPlusData &state);
376 :
377 : void GetComfortSetPoints(EnergyPlusData &state,
378 : int PeopleNum,
379 : int ComfortControlNum,
380 : Real64 PMVSet,
381 : Real64 &Tset // drybulb setpoint temperature for a given PMV value
382 : );
383 :
384 : void AdjustCoolingSetPointforTempAndHumidityControl(EnergyPlusData &state,
385 : int TempControlledZoneID,
386 : int ActualZoneNum // controlled zone actual zone number
387 : );
388 :
389 : void OverrideAirSetPointsforEMSCntrl(EnergyPlusData &state);
390 :
391 : void FillPredefinedTableOnThermostatSetpoints(EnergyPlusData &state);
392 :
393 : void FillPredefinedTableOnThermostatSchedules(EnergyPlusData &state);
394 :
395 : std::tuple<Real64, int, std::string>
396 : temperatureAndCountInSch(EnergyPlusData &state, int scheduleIndex, bool isSummer, int dayOfWeek, int hourOfDay);
397 :
398 : } // namespace ZoneTempPredictorCorrector
399 :
400 : struct ZoneTempPredictorCorrectorData : BaseGlobalStruct
401 : {
402 : int NumSingleTempHeatingControls = 0;
403 : int NumSingleTempCoolingControls = 0;
404 : int NumSingleTempHeatCoolControls = 0;
405 : int NumDualTempHeatCoolControls = 0;
406 :
407 : // Number of Thermal comfort control types
408 : int NumSingleFangerHeatingControls = 0;
409 : int NumSingleFangerCoolingControls = 0;
410 : int NumSingleFangerHeatCoolControls = 0;
411 : int NumDualFangerHeatCoolControls = 0;
412 :
413 : // Number of zone with staged controlled objects
414 : int NumStageCtrZone = 0;
415 : // Number of zone with onoff thermostat
416 : int NumOnOffCtrZone = 0;
417 :
418 : // Zone temperature history - used only for oscillation test
419 : Array2D<Real64> ZoneTempHist;
420 : Array1D<Real64> ZoneTempOscillate;
421 : Array1D<Real64> ZoneTempOscillateDuringOccupancy;
422 : Array1D<Real64> ZoneTempOscillateInDeadband;
423 : Real64 AnyZoneTempOscillate = 0.0;
424 : Real64 AnyZoneTempOscillateDuringOccupancy = 0.0;
425 : Real64 AnyZoneTempOscillateInDeadband = 0.0;
426 : Real64 AnnualAnyZoneTempOscillate = 0.0;
427 : Real64 AnnualAnyZoneTempOscillateDuringOccupancy = 0.0;
428 : Real64 AnnualAnyZoneTempOscillateInDeadband = 0.0;
429 : bool OscillationVariablesNeeded = false;
430 :
431 : bool InitZoneAirSetPointsOneTimeFlag = true;
432 : bool SetupOscillationOutputFlag = true;
433 :
434 : // Object Data
435 : std::unordered_set<std::string> HumidityControlZoneUniqueNames;
436 : EPVector<ZoneTempPredictorCorrector::ZoneTempControl> SetPointSingleHeating;
437 : EPVector<ZoneTempPredictorCorrector::ZoneTempControl> SetPointSingleCooling;
438 : EPVector<ZoneTempPredictorCorrector::ZoneTempControl> SetPointSingleHeatCool;
439 : EPVector<ZoneTempPredictorCorrector::ZoneTempControl> SetPointDualHeatCool;
440 : EPVector<ZoneTempPredictorCorrector::ZoneComfortFangerControl> SetPointSingleHeatingFanger;
441 : EPVector<ZoneTempPredictorCorrector::ZoneComfortFangerControl> SetPointSingleCoolingFanger;
442 : EPVector<ZoneTempPredictorCorrector::ZoneComfortFangerControl> SetPointSingleHeatCoolFanger;
443 : EPVector<ZoneTempPredictorCorrector::ZoneComfortFangerControl> SetPointDualHeatCoolFanger;
444 : ZoneTempPredictorCorrector::AdaptiveComfortDailySetPointSchedule AdapComfortDailySetPointSchedule;
445 :
446 : std::array<Real64, 7> AdapComfortSetPointSummerDesDay = {-1};
447 :
448 : bool CalcZoneAirComfortSetPointsFirstTimeFlag = true; // Flag set to make sure you get input once
449 : bool MyEnvrnFlag = true;
450 : bool MyDayFlag = true;
451 : bool ErrorsFound = false;
452 : bool ControlledZonesChecked = false;
453 :
454 : int IterLimitExceededNum1 = 0;
455 : int IterLimitErrIndex1 = 0;
456 : int IterLimitExceededNum2 = 0;
457 : int IterLimitErrIndex2 = 0;
458 :
459 : EPVector<ZoneTempPredictorCorrector::ZoneHeatBalanceData> zoneHeatBalance;
460 : EPVector<ZoneTempPredictorCorrector::SpaceHeatBalanceData> spaceHeatBalance;
461 :
462 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
463 : {
464 796 : }
465 :
466 0 : void clear_state() override
467 : {
468 0 : new (this) ZoneTempPredictorCorrectorData();
469 0 : }
470 : };
471 :
472 : } // namespace EnergyPlus
473 :
474 : #endif
|