LCOV - code coverage report
Current view: top level - EnergyPlus - ZoneTempPredictorCorrector.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 8 8
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 4 4

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

Generated by: LCOV version 2.0-1