LCOV - code coverage report
Current view: top level - EnergyPlus - ZoneTempPredictorCorrector.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 7 10 70.0 %
Date: 2023-01-17 19:17:23 Functions: 16 24 66.7 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, 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       10628 :     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;
      83             :     };
      84             : 
      85          16 :     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;             // INdex to PMV cooling set point schedule
      94             :     };
      95             : 
      96        1542 :     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      113392 :     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 ZTAV = DataHeatBalance::ZoneInitialTemp;     // Air Temperature Averaged over the zone time step (during HVAC Time Steps)
     124             :         Real64 ZT = DataHeatBalance::ZoneInitialTemp;       // Air Temperature Averaged over the system time step
     125             :         Real64 ZTAVComf = DataHeatBalance::ZoneInitialTemp; // Air Temperature Averaged used in thermal comfort models (currently Fanger model only) -
     126             :                                                             // TODO: lagged? could MAT be used instead?
     127             :         Real64 XMPT = DataHeatBalance::ZoneInitialTemp;     // Air temperature at previous system time step
     128             :         std::array<Real64, 4> XMAT = {DataHeatBalance::ZoneInitialTemp,
     129             :                                       DataHeatBalance::ZoneInitialTemp,
     130             :                                       DataHeatBalance::ZoneInitialTemp,
     131             :                                       DataHeatBalance::ZoneInitialTemp}; // Temporary air temperature history
     132             :         std::array<Real64, 4> DSXMAT = {DataHeatBalance::ZoneInitialTemp,
     133             :                                         DataHeatBalance::ZoneInitialTemp,
     134             :                                         DataHeatBalance::ZoneInitialTemp,
     135             :                                         DataHeatBalance::ZoneInitialTemp}; // Down Stepped air temperature history storage
     136             :         // Exact and Euler solutions
     137             :         Real64 ZoneTMX = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature to test convergence in Exact and Euler method
     138             :         Real64 ZoneTM2 = DataHeatBalance::ZoneInitialTemp; // Temporary air temperature at timestep t-2 in Exact and Euler method
     139             :         Real64 ZoneT1 = 0.0;                               // Air temperature at the previous time step used in Exact and Euler method
     140             : 
     141             :         // Zone or space air moisture conditions
     142             :         Real64 ZoneAirHumRat = 0.01;        // Air Humidity Ratio
     143             :         Real64 ZoneAirHumRatAvg = 0.01;     // Air Humidity Ratio averaged over the zone time step
     144             :         Real64 ZoneAirHumRatTemp = 0.01;    // Temporary air humidity ratio at time plus 1
     145             :         Real64 ZoneAirHumRatAvgComf = 0.01; // Air Humidity Ratio averaged over the zone time
     146             :                                             // step used in thermal comfort models (currently Fang model only)
     147             :                                             // TODO: lagged? could ZoneAirHumRatAvg be used instead?
     148             : 
     149             :         std::array<Real64, 4> WPrevZoneTS = {0.0, 0.0, 0.0, 0.0};   // Air Humidity Ratio zone time step history
     150             :         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
     151             :         Real64 WZoneTimeMinusP = 0.0;                               // Air Humidity Ratio at previous system time step
     152             :         // Exact and Euler solutions
     153             :         Real64 ZoneWMX = 0.0; // Temporary humidity ratio to test convergence in Exact and Euler method
     154             :         Real64 ZoneWM2 = 0.0; // Temporary humidity ratio at timestep t-2 in Exact and Euler method
     155             :         Real64 ZoneW1 = 0.0;  // Zone/space humidity ratio at the previous time step used in Exact and Euler method
     156             : 
     157             :         std::array<Real64, 4> ZTM = {
     158             :             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)
     159             :         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)
     160             :         // Real64 WZoneTimeMinus1Temp = 0.0;                         // Zone air humidity ratio at previous timestep
     161             :         // Real64 WZoneTimeMinus2Temp = 0.0; // Zone air humidity ratio at timestep T-2
     162             :         // Real64 WZoneTimeMinus3Temp = 0.0; // Zone air humidity ratio at timestep T-3
     163             : 
     164             :         Real64 SumIntGain = 0.0; // Sum of convective internal gains
     165             :         Real64 SumHA = 0.0;      // Sum of Hc*Area
     166             :         Real64 SumHATsurf = 0.0; // Sum of Hc*Area*Tsurf
     167             :         Real64 SumHATref = 0.0;  // Sum of Hc*Area*Tref= 0.0; for ceiling diffuser convection correlation
     168             :         Real64 SumMCp = 0.0;     // Sum of MassFlowRate*Cp
     169             :         Real64 SumMCpT = 0.0;    // Sum of MassFlowRate*Cp*T
     170             :         Real64 SumSysMCp = 0.0;  // Sum of air system MassFlowRate*Cp
     171             :         Real64 SumSysMCpT = 0.0; // Sum of air system MassFlowRate*Cp*T
     172             :         Real64 SumIntGainExceptPeople = 0.0;
     173             : 
     174             :         // Moisture variables to carry info from HB to the Zone Temp Predictor-Corrector for Fan System
     175             :         Real64 SumHmAW = 0.0;   // SUM OF ZONE AREA*Moist CONVECTION COEFF*INSIDE Humidity Ratio
     176             :         Real64 SumHmARa = 0.0;  // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air
     177             :         Real64 SumHmARaW = 0.0; // SUM OF ZONE AREA*Moist CONVECTION COEFF*Rho Air* Inside Humidity Ration
     178             :         Real64 SumHmARaZ = 0.0;
     179             : 
     180             :         Real64 TempDepCoef = 0.0; // Temperature dependent coefficient
     181             :         Real64 TempIndCoef = 0.0; // Temperature ndependent coefficient
     182             :         Real64 TempHistoryTerm = 0.0;
     183             : 
     184             :         Real64 MCPI = 0.0;                       // INFILTRATION MASS FLOW * AIR SPECIFIC HEAT
     185             :         Real64 MCPTI = 0.0;                      // INFILTRATION MASS FLOW * AIR CP * AIR TEMPERATURE
     186             :         Real64 MCPV = 0.0;                       // VENTILATION MASS FLOW * AIR SPECIFIC HEAT
     187             :         Real64 MCPTV = 0.0;                      // VENTILATION MASS FLOW * AIR CP * AIR TEMPERATURE
     188             :         Real64 MCPM = 0.0;                       // Mixing MASS FLOW * AIR SPECIFIC HEAT
     189             :         Real64 MCPTM = 0.0;                      // Mixing MASS FLOW * AIR CP * AIR TEMPERATURE
     190             :         Real64 MCPE = 0.0;                       // EARTHTUBE MASS FLOW * AIR SPECIFIC HEAT
     191             :         Real64 EAMFL = 0.0;                      // OUTDOOR AIR MASS FLOW for EarthTube
     192             :         Real64 EAMFLxHumRat = 0.0;               // OUTDOOR AIR MASS FLOW * Humidity Ratio for EarthTube (water vapor mass flow)
     193             :         Real64 MCPTE = 0.0;                      // EARTHTUBE MASS FLOW * AIR CP * AIR TEMPERATURE
     194             :         Real64 MCPC = 0.0;                       // COOLTOWER MASS FLOW * AIR SPECIFIC HEAT
     195             :         Real64 CTMFL = 0.0;                      // OUTDOOR AIR MASS FLOW for cooltower
     196             :         Real64 MCPTC = 0.0;                      // COOLTOWER MASS FLOW * AIR CP * AIR TEMPERATURE
     197             :         Real64 ThermChimAMFL = 0.0;              // OUTDOOR AIR MASS FLOW for THERMALCHIMNEY
     198             :         Real64 MCPTThermChim = 0.0;              // THERMALCHIMNEY MASS FLOW * AIR SPECIFIC HEAT
     199             :         Real64 MCPThermChim = 0.0;               // THERMALCHIMNEY MASS FLOW * AIR CP * AIR TEMPERATURE
     200             :         Real64 ZoneLatentGain = 0.0;             // Latent Energy from each Zone (People, equipment)
     201             :         Real64 ZoneLatentGainExceptPeople = 0.0; // Added for hybrid model -- Latent Energy from each Zone (equipment)
     202             :         Real64 OAMFL = 0.0;                      // OUTDOOR AIR MASS FLOW (kg/s) for infiltration
     203             :         Real64 VAMFL = 0.0;                      // OUTDOOR AIR MASS FLOW (kg/s) for ventilation
     204             :         Real64 NonAirSystemResponse = 0.0;       // Convective heat addition rate from non forced air
     205             :         // equipment such as baseboards plus heat from lights to
     206             :         Real64 SysDepZoneLoads = 0.0; // Convective heat addition or subtraction rate from sources that
     207             :         // depend on what is happening with the HVAC system. Such as:
     208             :         // heat gain from lights to return air when return flow = 0= 0.0; heat gain
     209             :         // from air flow windows to return air when return air flow = 0= 0.0;
     210             :         // and heat removed by return air from refrigeration cases when
     211             :         // return air flow = 0.
     212             :         Real64 SysDepZoneLoadsLagged = 0.0; // SysDepZoneLoads saved to be added to zone heat balance next
     213             :         // HVAC time step
     214             :         Real64 MDotCPOA = 0.0; // Airbalance MASS FLOW * AIR SPECIFIC HEAT used at Air Balance Method = Quadrature in the ZoneAirBalance:OutdoorAir
     215             :         Real64 MDotOA = 0.0;   // Airbalance MASS FLOW rate used at Air Balance Method = Quadrature in the ZoneAirBalance:OutdoorAir
     216             :         Real64 MixingMAT = DataHeatBalance::ZoneInitialTemp; // Air temperature for mixing
     217             :         Real64 MixingHumRat = 0.01;                          // Air humidity ratio for mixing
     218             :         Real64 MixingMassFlowZone = 0.0;                     // Mixing MASS FLOW (kg/s)
     219             :         Real64 MixingMassFlowXHumRat = 0.0;                  // Mixing MASS FLOW * Humidity Ratio
     220             : 
     221             :         Real64 ZoneSetPointLast = 0.0;
     222             :         Real64 TempIndZnLd = 0.0;
     223             :         Real64 TempDepZnLd = 0.0;
     224             :         Real64 ZoneAirRelHum = 0.0; // Zone relative humidity in percent
     225             :         Real64 AirPowerCap = 0.0;   // "air power capacity"  Vol*VolMult*rho*Cp/timestep [W/degK]
     226             : 
     227             :         void beginEnvironmentInit(EnergyPlusData &state);
     228             : 
     229             :         void setUpOutputVars(EnergyPlusData &state, std::string_view prefix, std::string_view name);
     230             : 
     231             :         void predictSystemLoad(EnergyPlusData &state,
     232             :                                bool shortenTimeStepSys,
     233             :                                bool useZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step
     234             :                                Real64 priorTimeStep,        // the old value for timestep length is passed for possible use in interpolating
     235             :                                int zoneNum,
     236             :                                int spaceNum = 0);
     237             : 
     238             :         void calcPredictedSystemLoad(EnergyPlusData &state, Real64 RAFNFrac, int zoneNum, int spaceNum = 0);
     239             : 
     240             :         void calcZoneOrSpaceSums(EnergyPlusData &state,
     241             :                                  bool CorrectorFlag, // Corrector call flag
     242             :                                  int zoneNum,
     243             :                                  int spaceNum = 0);
     244             : 
     245             :         virtual SumHATOutput calcSumHAT(EnergyPlusData &state, int zoneNum, int spaceNum) = 0;
     246             : 
     247             :         void updateTemperatures(
     248             :             EnergyPlusData &state, bool ShortenTimeStepSys, bool UseZoneTimeStepHistory, Real64 PriorTimeStep, int zoneNum, int spaceNum = 0);
     249             : 
     250             :         Real64 correctAirTemp(EnergyPlusData &state,
     251             :                               bool useZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step history
     252             :                               int zoneNum,
     253             :                               int spaceNum = 0);
     254             : 
     255             :         void correctHumRat(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
     256             : 
     257             :         void calcPredictedHumidityRatio(EnergyPlusData &state, Real64 RAFNFrac, int zoneNum, int spaceNum = 0);
     258             : 
     259             :         void pushZoneTimestepHistory(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
     260             : 
     261             :         void pushSystemTimestepHistory(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
     262             : 
     263             :         void revertZoneTimestepHistory(EnergyPlusData &state, int zoneNum, int spaceNum = 0);
     264             :     };
     265             : 
     266       56672 :     struct ZoneHeatBalanceData : ZoneSpaceHeatBalanceData
     267             :     {
     268             :         SumHATOutput calcSumHAT(EnergyPlusData &state, int zoneNum, [[maybe_unused]] int spaceNum) override;
     269             :     };
     270             : 
     271       56720 :     struct SpaceHeatBalanceData : ZoneSpaceHeatBalanceData
     272             :     {
     273             :         SumHATOutput calcSumHAT(EnergyPlusData &state, int zoneNum, int spaceNum) override;
     274             :     };
     275             : 
     276             :     // Functions
     277             : 
     278             :     void ManageZoneAirUpdates(EnergyPlusData &state,
     279             :                               DataHeatBalFanSys::PredictorCorrectorCtrl UpdateType, // Can be iGetZoneSetPoints, iPredictStep, iCorrectStep
     280             :                               Real64 &ZoneTempChange,                               // Temp change in zone air btw previous and current timestep
     281             :                               bool ShortenTimeStepSys,
     282             :                               bool UseZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step
     283             :                               Real64 PriorTimeStep         // the old value for timestep length is passed for possible use in interpolating
     284             :     );
     285             : 
     286             :     void GetZoneAirSetPoints(EnergyPlusData &state);
     287             : 
     288             :     void InitZoneAirSetPoints(EnergyPlusData &state);
     289             : 
     290             :     void PredictSystemLoads(EnergyPlusData &state,
     291             :                             bool ShortenTimeStepSys,
     292             :                             bool UseZoneTimeStepHistory, // if true then use zone timestep history, if false use system time step
     293             :                             Real64 PriorTimeStep         // the old value for timestep length is passed for possible use in interpolating
     294             :     );
     295             : 
     296             :     void CalcZoneAirTempSetPoints(EnergyPlusData &state);
     297             : 
     298             :     void CalculateMonthlyRunningAverageDryBulb(EnergyPlusData &state, Array1D<Real64> &runningAverageASH, Array1D<Real64> &runningAverageCEN);
     299             : 
     300             :     void
     301             :     CalculateAdaptiveComfortSetPointSchl(EnergyPlusData &state, Array1D<Real64> const &runningAverageASH, Array1D<Real64> const &runningAverageCEN);
     302             : 
     303             :     Real64 correctZoneAirTemps(EnergyPlusData &state,
     304             :                                bool useZoneTimeStepHistory // if true then use zone timestep history, if false use system time step history
     305             :     );
     306             : 
     307             :     void PushZoneTimestepHistories(EnergyPlusData &state);
     308             : 
     309             :     void PushSystemTimestepHistories(EnergyPlusData &state);
     310             : 
     311             :     void RevertZoneTimestepHistories(EnergyPlusData &state);
     312             : 
     313             :     void DownInterpolate4HistoryValues(Real64 OldTimeStep,
     314             :                                        Real64 NewTimeStep,
     315             :                                        Real64 oldVal0,
     316             :                                        Real64 oldVal1,
     317             :                                        Real64 oldVal2,
     318             :                                        Real64 &newVal0,
     319             :                                        Real64 &newVal1,
     320             :                                        Real64 &newVal2,
     321             :                                        Real64 &newVal3,
     322             :                                        Real64 &newVal4);
     323             : 
     324             :     Real64
     325             :     DownInterpolate4HistoryValues(Real64 OldTimeStep, Real64 NewTimeStep, std::array<Real64, 4> const &oldVals, std::array<Real64, 4> &newVals);
     326             : 
     327             :     void InverseModelTemperature(EnergyPlusData &state,
     328             :                                  int ZoneNum,                   // Zone number
     329             :                                  Real64 SumIntGain,             // Zone sum of convective internal gains
     330             :                                  Real64 SumIntGainExceptPeople, // Zone sum of convective internal gains except for people
     331             :                                  Real64 SumHA,                  // Zone sum of Hc*Area
     332             :                                  Real64 SumHATsurf,             // Zone sum of Hc*Area*Tsurf
     333             :                                  Real64 SumHATref,              // Zone sum of Hc*Area*Tref, for ceiling diffuser convection correlation
     334             :                                  Real64 SumMCp,                 // Zone sum of MassFlowRate*Cp
     335             :                                  Real64 SumMCpT,                // Zone sum of MassFlowRate*Cp*T
     336             :                                  Real64 SumSysMCp,              // Zone sum of air system MassFlowRate*Cp
     337             :                                  Real64 SumSysMCpT,             // Zone sum of air system MassFlowRate*Cp*T
     338             :                                  Real64 AirCap                  // Formerly CoefAirrat, coef in zone temp eqn with dim of "air power capacity"rd
     339             :     );
     340             : 
     341             :     void InverseModelHumidity(EnergyPlusData &state,
     342             :                               int ZoneNum,                   // Zone number
     343             :                               Real64 LatentGain,             // Zone sum of latent gain
     344             :                               Real64 LatentGainExceptPeople, // Zone sum of latent gain except for people
     345             :                               Real64 ZoneMassFlowRate,       // Zone air mass flow rate
     346             :                               Real64 MoistureMassFlowRate,   // Zone moisture mass flow rate
     347             :                               Real64 H2OHtOfVap,             // Heat of vaporization of air
     348             :                               Real64 RhoAir                  // Air density
     349             :     );
     350             : 
     351             :     void CalcZoneComponentLoadSums(EnergyPlusData &state,
     352             :                                    int ZoneNum,             // Zone number
     353             :                                    Real64 TempDepCoef,      // Dependent coefficient
     354             :                                    Real64 TempIndCoef,      // Independent coefficient
     355             :                                    Real64 &SumIntGains,     // Zone sum of convective internal gains
     356             :                                    Real64 &SumHADTsurfs,    // Zone sum of Hc*Area*(Tsurf - Tz)
     357             :                                    Real64 &SumMCpDTzones,   // zone sum of MassFlowRate*cp*(TremotZone - Tz) transfer air from other zone, Mixing
     358             :                                    Real64 &SumMCpDtInfil,   // Zone sum of MassFlowRate*Cp*(Tout - Tz) transfer from outside, ventil, earth tube
     359             :                                    Real64 &SumMCpDTsystem,  // Zone sum of air system MassFlowRate*Cp*(Tsup - Tz)
     360             :                                    Real64 &SumNonAirSystem, // Zone sum of non air system convective heat gains
     361             :                                    Real64 &CzdTdt,          // Zone air energy storage term.
     362             :                                    Real64 &imBalance,       // put all terms in eq. 5 on RHS , should be zero
     363             :                                    Real64 &SumEnthalpyM,    // Zone sum of phase change material melting enthlpy
     364             :                                    Real64 &SumEnthalpyH     // Zone sum of phase change material freezing enthalpy
     365             :     );
     366             : 
     367             :     bool VerifyThermostatInZone(EnergyPlusData &state, std::string const &ZoneName); // Zone to verify
     368             : 
     369             :     bool VerifyControlledZoneForThermostat(EnergyPlusData &state, std::string const &ZoneName); // Zone to verify
     370             : 
     371             :     void DetectOscillatingZoneTemp(EnergyPlusData &state);
     372             : 
     373             :     void AdjustAirSetPointsforOpTempCntrl(EnergyPlusData &state, int TempControlledZoneID, int ActualZoneNum, Real64 &ZoneAirSetPoint);
     374             : 
     375             :     void AdjustOperativeSetPointsforAdapComfort(EnergyPlusData &state, int TempControlledZoneID, Real64 &ZoneAirSetPoint);
     376             : 
     377             :     void CalcZoneAirComfortSetPoints(EnergyPlusData &state);
     378             : 
     379             :     void GetComfortSetPoints(EnergyPlusData &state,
     380             :                              int PeopleNum,
     381             :                              int ComfortControlNum,
     382             :                              Real64 PMVSet,
     383             :                              Real64 &Tset // drybulb setpoint temperature for a given PMV value
     384             :     );
     385             : 
     386             :     void AdjustCoolingSetPointforTempAndHumidityControl(EnergyPlusData &state,
     387             :                                                         int TempControlledZoneID,
     388             :                                                         int ActualZoneNum // controlled zone actual zone number
     389             :     );
     390             : 
     391             :     void OverrideAirSetPointsforEMSCntrl(EnergyPlusData &state);
     392             : 
     393             :     void FillPredefinedTableOnThermostatSetpoints(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        1542 : 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           0 :     void clear_state() override
     463             :     {
     464           0 :         *this = ZoneTempPredictorCorrectorData();
     465           0 :     }
     466             : };
     467             : 
     468             : } // namespace EnergyPlus
     469             : 
     470             : #endif

Generated by: LCOV version 1.13