LCOV - code coverage report
Current view: top level - EnergyPlus - DataSizing.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 586 680 86.2 %
Date: 2024-08-24 18:31:18 Functions: 15 15 100.0 %

          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             : // EnergyPlus Headers
      49             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      50             : #include <EnergyPlus/DataContaminantBalance.hh>
      51             : #include <EnergyPlus/DataEnvironment.hh>
      52             : #include <EnergyPlus/DataHeatBalance.hh>
      53             : #include <EnergyPlus/DataSizing.hh>
      54             : #include <EnergyPlus/DataZoneEnergyDemands.hh>
      55             : #include <EnergyPlus/DataZoneEquipment.hh>
      56             : #include <EnergyPlus/Psychrometrics.hh>
      57             : #include <EnergyPlus/ScheduleManager.hh>
      58             : 
      59             : namespace EnergyPlus::DataSizing {
      60             : 
      61             : // MODULE INFORMATION:
      62             : //       AUTHOR         Fred Buhl
      63             : //       DATE WRITTEN   December 2000
      64             : 
      65             : // PURPOSE OF THIS MODULE:
      66             : // This data-only module contains type definitions and variables
      67             : // associated with HVAC system design flow rates, temperatures and
      68             : // capacities. This data is available to the HVAC component modules
      69             : // for their self sizing calculations.
      70             : 
      71             : //  days; includes effects of user multiplier
      72             : //  and user set flows)
      73             : //  of user input multiplier and flows
      74             : //  all design days, calculated only)
      75             : //  using user input system flow rates.
      76             : //  before applying user input sys flow rates.
      77             : 
      78      826006 : Real64 TermUnitSizingData::applyTermUnitSizingCoolFlow(Real64 const coolFlowWithOA, // Cooling flow rate with MinOA limit applied
      79             :                                                        Real64 const coolFlowNoOA    // Cooling flow rate without MinOA limit applied
      80             : )
      81             : {
      82             :     // Apply DesignSpecification:AirTerminal:Sizing to cooling flow (could be vol flow or mass flow)
      83      826006 :     Real64 coolFlowRatio = 1.0;
      84      826006 :     if (this->SpecDesCoolSATRatio > 0.0) {
      85      826006 :         coolFlowRatio = this->SpecDesSensCoolingFrac / this->SpecDesCoolSATRatio;
      86             :     } else {
      87           0 :         coolFlowRatio = this->SpecDesSensCoolingFrac;
      88             :     }
      89      826006 :     Real64 adjustedFlow = coolFlowNoOA * coolFlowRatio + (coolFlowWithOA - coolFlowNoOA) * this->SpecMinOAFrac;
      90      826006 :     return adjustedFlow;
      91             : }
      92             : 
      93      826006 : Real64 TermUnitSizingData::applyTermUnitSizingHeatFlow(Real64 const heatFlowWithOA, // Heating flow rate with MinOA limit applied
      94             :                                                        Real64 const heatFlowNoOA    // Heating flow rate without MinOA limit applied
      95             : )
      96             : {
      97             :     // Apply DesignSpecification:AirTerminal:Sizing to heating flow (could be vol flow or mass flow)
      98      826006 :     Real64 heatFlowRatio = 1.0;
      99      826006 :     if (this->SpecDesHeatSATRatio > 0.0) {
     100      826006 :         heatFlowRatio = this->SpecDesSensHeatingFrac / this->SpecDesHeatSATRatio;
     101             :     } else {
     102           0 :         heatFlowRatio = this->SpecDesSensHeatingFrac;
     103             :     }
     104      826006 :     Real64 adjustedFlow = heatFlowNoOA * heatFlowRatio + (heatFlowWithOA - heatFlowNoOA) * this->SpecMinOAFrac;
     105      826006 :     return adjustedFlow;
     106             : }
     107             : 
     108         135 : void TermUnitZoneSizingData::scaleZoneCooling(Real64 const ratio)
     109             : {
     110             :     // Apply scaling ratio to TermUnitFinalZoneSizing cooling flow and load
     111         135 :     this->DesCoolVolFlow *= ratio;
     112         135 :     this->DesCoolMassFlow *= ratio;
     113         135 :     this->DesCoolLoad *= ratio;
     114       14055 :     for (auto &cfs : this->CoolFlowSeq) {
     115       13920 :         cfs *= ratio;
     116             :     }
     117         135 : }
     118             : 
     119          89 : void TermUnitZoneSizingData::scaleZoneHeating(Real64 const ratio)
     120             : {
     121             :     // Apply scaling ratio to TermUnitFinalZoneSizing heating flow and load
     122          89 :     this->DesHeatVolFlow *= ratio;
     123          89 :     this->DesHeatMassFlow *= ratio;
     124          89 :     this->DesHeatLoad *= ratio;
     125        9305 :     for (auto &cfs : this->HeatFlowSeq) {
     126        9216 :         cfs *= ratio;
     127             :     }
     128          89 : }
     129             : 
     130        1194 : void ZoneSizingData::zeroMemberData()
     131             : {
     132        1194 :     if (!allocated(this->DOASSupMassFlowSeq)) return;
     133        1194 :     std::fill(this->DOASSupMassFlowSeq.begin(), this->DOASSupMassFlowSeq.end(), 0.0);
     134        1194 :     std::fill(this->DOASHeatLoadSeq.begin(), this->DOASHeatLoadSeq.end(), 0.0);
     135        1194 :     std::fill(this->DOASCoolLoadSeq.begin(), this->DOASCoolLoadSeq.end(), 0.0);
     136        1194 :     std::fill(this->DOASHeatAddSeq.begin(), this->DOASHeatAddSeq.end(), 0.0);
     137        1194 :     std::fill(this->DOASLatAddSeq.begin(), this->DOASLatAddSeq.end(), 0.0);
     138        1194 :     std::fill(this->DOASSupTempSeq.begin(), this->DOASSupTempSeq.end(), 0.0);
     139        1194 :     std::fill(this->DOASSupHumRatSeq.begin(), this->DOASSupHumRatSeq.end(), 0.0);
     140        1194 :     std::fill(this->DOASTotCoolLoadSeq.begin(), this->DOASTotCoolLoadSeq.end(), 0.0);
     141        1194 :     std::fill(this->HeatFlowSeq.begin(), this->HeatFlowSeq.end(), 0.0);
     142        1194 :     std::fill(this->HeatFlowSeqNoOA.begin(), this->HeatFlowSeqNoOA.end(), 0.0);
     143        1194 :     std::fill(this->HeatLoadSeq.begin(), this->HeatLoadSeq.end(), 0.0);
     144        1194 :     std::fill(this->HeatZoneTempSeq.begin(), this->HeatZoneTempSeq.end(), 0.0);
     145        1194 :     std::fill(this->DesHeatSetPtSeq.begin(), this->DesHeatSetPtSeq.end(), 0.0);
     146        1194 :     std::fill(this->HeatOutTempSeq.begin(), this->HeatOutTempSeq.end(), 0.0);
     147        1194 :     std::fill(this->HeatZoneRetTempSeq.begin(), this->HeatZoneRetTempSeq.end(), 0.0);
     148        1194 :     std::fill(this->HeatTstatTempSeq.begin(), this->HeatTstatTempSeq.end(), 0.0);
     149        1194 :     std::fill(this->HeatZoneHumRatSeq.begin(), this->HeatZoneHumRatSeq.end(), 0.0);
     150        1194 :     std::fill(this->HeatOutHumRatSeq.begin(), this->HeatOutHumRatSeq.end(), 0.0);
     151        1194 :     std::fill(this->CoolFlowSeq.begin(), this->CoolFlowSeq.end(), 0.0);
     152        1194 :     std::fill(this->CoolFlowSeqNoOA.begin(), this->CoolFlowSeqNoOA.end(), 0.0);
     153        1194 :     std::fill(this->CoolLoadSeq.begin(), this->CoolLoadSeq.end(), 0.0);
     154        1194 :     std::fill(this->CoolZoneTempSeq.begin(), this->CoolZoneTempSeq.end(), 0.0);
     155        1194 :     std::fill(this->DesCoolSetPtSeq.begin(), this->DesCoolSetPtSeq.end(), 0.0);
     156        1194 :     std::fill(this->CoolOutTempSeq.begin(), this->CoolOutTempSeq.end(), 0.0);
     157        1194 :     std::fill(this->CoolZoneRetTempSeq.begin(), this->CoolZoneRetTempSeq.end(), 0.0);
     158        1194 :     std::fill(this->CoolTstatTempSeq.begin(), this->CoolTstatTempSeq.end(), 0.0);
     159        1194 :     std::fill(this->CoolZoneHumRatSeq.begin(), this->CoolZoneHumRatSeq.end(), 0.0);
     160        1194 :     std::fill(this->CoolOutHumRatSeq.begin(), this->CoolOutHumRatSeq.end(), 0.0);
     161        1194 :     std::fill(this->HeatLoadNoDOASSeq.begin(), this->HeatLoadNoDOASSeq.end(), 0.0);
     162        1194 :     std::fill(this->CoolLoadNoDOASSeq.begin(), this->CoolLoadNoDOASSeq.end(), 0.0);
     163        1194 :     std::fill(this->LatentHeatLoadSeq.begin(), this->LatentHeatLoadSeq.end(), 0.0);
     164        1194 :     std::fill(this->LatentCoolLoadSeq.begin(), this->LatentCoolLoadSeq.end(), 0.0);
     165        1194 :     std::fill(this->HeatLatentLoadNoDOASSeq.begin(), this->HeatLatentLoadNoDOASSeq.end(), 0.0);
     166        1194 :     std::fill(this->CoolLatentLoadNoDOASSeq.begin(), this->CoolLatentLoadNoDOASSeq.end(), 0.0);
     167        1194 :     std::fill(this->LatentCoolFlowSeq.begin(), this->LatentCoolFlowSeq.end(), 0.0);
     168        1194 :     std::fill(this->LatentHeatFlowSeq.begin(), this->LatentHeatFlowSeq.end(), 0.0);
     169             : 
     170        1194 :     this->CoolDesDay = "";          // name of a sensible cooling design day
     171        1194 :     this->HeatDesDay = "";          // name of a sensible heating design day
     172        1194 :     this->CoolNoDOASDesDay = "";    // name of a sensible cooling design day without DOAS
     173        1194 :     this->HeatNoDOASDesDay = "";    // name of a sensible heating design day without DOAS
     174        1194 :     this->LatCoolDesDay = "";       // name of a latent cooling design day
     175        1194 :     this->LatHeatDesDay = "";       // name of a latent heating design day
     176        1194 :     this->LatCoolNoDOASDesDay = ""; // name of a latent cooling design day without DOAS
     177        1194 :     this->LatHeatNoDOASDesDay = ""; // name of a latent heating design day without DOAS
     178             : 
     179        1194 :     this->DesHeatMassFlow = 0.0;                // zone design heating air mass flow rate [kg/s]
     180        1194 :     this->DesCoolMassFlow = 0.0;                // zone design cooling air mass flow rate [kg/s]
     181        1194 :     this->DesHeatLoad = 0.0;                    // zone design heating load [W]
     182        1194 :     this->DesCoolLoad = 0.0;                    // zone design cooling load [W]
     183        1194 :     this->DesHeatDens = 0.0;                    // zone design heating air density [kg/m3]
     184        1194 :     this->DesCoolDens = 0.0;                    // zone design cooling air density [kg/m3]
     185        1194 :     this->DesHeatVolFlow = 0.0;                 // zone design heating air volume flow rate [m3/s]
     186        1194 :     this->DesCoolVolFlow = 0.0;                 // zone design cooling air volume flow rate [m3/s]
     187        1194 :     this->DesHeatVolFlowMax = 0.0;              // zone design heating maximum air volume flow rate [m3/s]
     188        1194 :     this->DesCoolVolFlowMin = 0.0;              // zone design cooling minimum air volume flow rate [m3/s]
     189        1194 :     this->DesHeatCoilInTemp = 0.0;              // zone heating coil design air inlet temperature [C]
     190        1194 :     this->DesCoolCoilInTemp = 0.0;              // zone cooling coil design air inlet temperature [C]
     191        1194 :     this->DesHeatCoilInHumRat = 0.0;            // zone heating coil design air inlet humidity ratio [kg/kg]
     192        1194 :     this->DesCoolCoilInHumRat = 0.0;            // zone cooling coil design air inlet humidity ratio [kg/kg]
     193        1194 :     this->DesHeatCoilInTempTU = 0.0;            // zone heating coil design air inlet temperature (supply air)([C]
     194        1194 :     this->DesCoolCoilInTempTU = 0.0;            // zone cooling coil design air inlet temperature (supply air)[C]
     195        1194 :     this->DesHeatCoilInHumRatTU = 0.0;          // zone heating coil design air inlet humidity ratio
     196        1194 :     this->DesCoolCoilInHumRatTU = 0.0;          // zone cooling coil design air inlet humidity ratio
     197        1194 :     this->HeatMassFlow = 0.0;                   // current zone heating air mass flow rate (HVAC time step)
     198        1194 :     this->CoolMassFlow = 0.0;                   // current zone cooling air mass flow rate (HVAC time step)
     199        1194 :     this->HeatLoad = 0.0;                       // current zone heating load (HVAC time step)
     200        1194 :     this->CoolLoad = 0.0;                       // current zone heating load (HVAC time step)
     201        1194 :     this->HeatZoneTemp = 0.0;                   // current zone temperature (heating, time step)
     202        1194 :     this->HeatOutTemp = 0.0;                    // current outdoor temperature (heating, time step)
     203        1194 :     this->HeatZoneRetTemp = 0.0;                // current zone return temperature (heating, time step)
     204        1194 :     this->HeatTstatTemp = 0.0;                  // current zone thermostat temperature (heating, time step)
     205        1194 :     this->CoolZoneTemp = 0.0;                   // current zone temperature (cooling, time step)
     206        1194 :     this->CoolOutTemp = 0.0;                    // current Outdoor temperature (cooling, time step)
     207        1194 :     this->CoolZoneRetTemp = 0.0;                // current zone return temperature (cooling, time step)
     208        1194 :     this->CoolTstatTemp = 0.0;                  // current zone thermostat temperature (cooling, time step)
     209        1194 :     this->HeatZoneHumRat = 0.0;                 // current zone humidity ratio (heating, time step)
     210        1194 :     this->CoolZoneHumRat = 0.0;                 // current zone humidity ratio (cooling, time step)
     211        1194 :     this->HeatOutHumRat = 0.0;                  // current outdoor humidity ratio (heating, time step)
     212        1194 :     this->CoolOutHumRat = 0.0;                  // current outdoor humidity ratio (cooling, time step)
     213        1194 :     this->ZoneTempAtHeatPeak = 0.0;             // zone temp at max heating [C]
     214        1194 :     this->ZoneRetTempAtHeatPeak = 0.0;          // zone return temp at max heating [C]
     215        1194 :     this->OutTempAtHeatPeak = 0.0;              // outdoor temperature at max heating [C]
     216        1194 :     this->ZoneTempAtCoolPeak = 0.0;             // zone temp at max cooling [C]
     217        1194 :     this->ZoneRetTempAtCoolPeak = 0.0;          // zone return temp at max cooling [C]
     218        1194 :     this->OutTempAtCoolPeak = 0.0;              // outdoor temperature at max cooling [C]
     219        1194 :     this->ZoneHumRatAtHeatPeak = 0.0;           // zone humidity ratio at max heating [kg/kg]
     220        1194 :     this->ZoneHumRatAtCoolPeak = 0.0;           // zone humidity ratio at max cooling [kg/kg]
     221        1194 :     this->OutHumRatAtHeatPeak = 0.0;            // outdoor humidity at max heating [kg/kg]
     222        1194 :     this->OutHumRatAtCoolPeak = 0.0;            // outdoor humidity at max cooling [kg/kg]
     223        1194 :     this->TimeStepNumAtHeatMax = 0;             // time step number (in day) at Heating peak
     224        1194 :     this->TimeStepNumAtCoolMax = 0;             // time step number (in day) at cooling peak
     225        1194 :     this->HeatDDNum = 0;                        // design day index of design day causing heating peak
     226        1194 :     this->CoolDDNum = 0;                        // design day index of design day causing heating peak
     227        1194 :     this->LatentHeatDDNum = 0;                  // design day index of design day causing heating peak
     228        1194 :     this->LatentCoolDDNum = 0;                  // design day index of design day causing cooling peak
     229        1194 :     this->LatentHeatNoDOASDDNum = 0;            // design day index of design day causing latent heating peak without DOAS
     230        1194 :     this->LatentCoolNoDOASDDNum = 0;            // design day index of design day causing latent cooling peak without DOAS
     231        1194 :     this->cHeatDDDate = "";                     // date of design day causing heating peak
     232        1194 :     this->cCoolDDDate = "";                     // date of design day causing cooling peak
     233        1194 :     this->cLatentHeatDDDate = "";               // date of design day causing heating peak
     234        1194 :     this->cLatentCoolDDDate = "";               // date of design day causing cooling peak
     235        1194 :     this->DOASHeatLoad = 0.0;                   // current heating load from DOAS supply air [W]
     236        1194 :     this->DOASCoolLoad = 0.0;                   // current cooling load from DOAS supply air [W]
     237        1194 :     this->DOASSupMassFlow = 0.0;                // current mass flow rate of DOAS supply air [kg/s]
     238        1194 :     this->DOASSupTemp = 0.0;                    // current DOAS supply air temperature [C]
     239        1194 :     this->DOASSupHumRat = 0.0;                  // current DOAS supply air humidity ratio [kgWater/kgDryAir]
     240        1194 :     this->DOASTotCoolLoad = 0.0;                // current total cooling load imposed by DOAS supply air [W]
     241        1194 :     this->HeatLoadNoDOAS = 0.0;                 // current zone heating load no DOAS (HVAC time step)
     242        1194 :     this->CoolLoadNoDOAS = 0.0;                 // current zone heating load no DOAS (HVAC time step)
     243        1194 :     this->HeatLatentLoad = 0.0;                 // current zone humidification load (HVAC time step)
     244        1194 :     this->CoolLatentLoad = 0.0;                 // current zone dehumidification load (HVAC time step)
     245        1194 :     this->HeatLatentLoadNoDOAS = 0.0;           // current zone humidification load without DOAS (HVAC time step)
     246        1194 :     this->CoolLatentLoadNoDOAS = 0.0;           // current zone dehumidification load without DOAS (HVAC time step)
     247        1194 :     this->ZoneHeatLatentMassFlow = 0.0;         // current mass flow rate required to meet humidification load [kg/s]
     248        1194 :     this->ZoneCoolLatentMassFlow = 0.0;         // current mass flow rate required to meet dehumidification load [kg/s]
     249        1194 :     this->ZoneHeatLatentVolFlow = 0.0;          // current volume flow rate required to meet humidification load [m3/s]
     250        1194 :     this->ZoneCoolLatentVolFlow = 0.0;          // current volume flow rate required to meet dehumidification load [m3/s]
     251        1194 :     this->DesHeatLoadNoDOAS = 0.0;              // zone design heating load without DOAS [W]
     252        1194 :     this->DesCoolLoadNoDOAS = 0.0;              // zone design cooling load without DOAS [W]
     253        1194 :     this->DesLatentHeatLoad = 0.0;              // current zone humidification load (HVAC time step)
     254        1194 :     this->DesLatentCoolLoad = 0.0;              // current zone dehumidification load (HVAC time step)
     255        1194 :     this->DesLatentHeatLoadNoDOAS = 0.0;        // current zone humidification load no DOAS (HVAC time step)
     256        1194 :     this->DesLatentCoolLoadNoDOAS = 0.0;        // current zone dehumidification load no DOAS (HVAC time step)
     257        1194 :     this->DesLatentHeatMassFlow = 0.0;          // current mass flow rate required to meet humidification load [kg/s]
     258        1194 :     this->DesLatentCoolMassFlow = 0.0;          // current mass flow rate required to meet dehumidification load [kg/s]
     259        1194 :     this->DesLatentHeatVolFlow = 0.0;           // current volume flow rate required to meet humidification load [m3/s]
     260        1194 :     this->DesLatentCoolVolFlow = 0.0;           // current volume flow rate required to meet dehumidification load [m3/s]
     261        1194 :     this->DesLatentHeatCoilInTemp = 0.0;        // zone heating coil design air inlet temperature [C]
     262        1194 :     this->DesLatentCoolCoilInTemp = 0.0;        // zone cooling coil design air inlet temperature [C]
     263        1194 :     this->DesLatentHeatCoilInHumRat = 0.0;      // zone heating coil design air inlet humidity ratio [kg/kg]
     264        1194 :     this->DesLatentCoolCoilInHumRat = 0.0;      // zone cooling coil design air inlet humidity ratio [kg/kg]
     265        1194 :     this->TimeStepNumAtLatentHeatMax = 0;       // time step number (in day) at latent heating peak
     266        1194 :     this->TimeStepNumAtLatentCoolMax = 0;       // time step number (in day) at latent cooling peak
     267        1194 :     this->TimeStepNumAtLatentHeatNoDOASMax = 0; // time step number (in day) at latent heating peak without DOAS
     268        1194 :     this->TimeStepNumAtLatentCoolNoDOASMax = 0; // time step number (in day) at latent cooling peak without DOAS
     269        1194 :     this->OutTempAtLatentCoolPeak = 0.0;        // outdoor temperature at max latent cooling [C]
     270        1194 :     this->OutHumRatAtLatentCoolPeak = 0.0;      // outdoor humrat at max latent cooling [C]
     271        1194 :     this->OutTempAtLatentHeatPeak = 0.0;        // outdoor temperature at max latent heating [C]
     272        1194 :     this->OutHumRatAtLatentHeatPeak = 0.0;      // outdoor humrat at max latent heating [C]
     273        1194 :     this->ZoneRetTempAtLatentCoolPeak = 0.0;    // zone return temp at max cooling [C]
     274        1194 :     this->ZoneRetTempAtLatentHeatPeak = 0.0;    // zone return temp at max heating [C]
     275             : }
     276             : 
     277       22250 : void ZoneSizingData::allocateMemberArrays(int const numOfTimeStepInDay)
     278             : {
     279       22250 :     this->HeatFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     280       22250 :     this->CoolFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     281       22250 :     this->HeatFlowSeqNoOA.dimension(numOfTimeStepInDay, 0.0);
     282       22250 :     this->CoolFlowSeqNoOA.dimension(numOfTimeStepInDay, 0.0);
     283       22250 :     this->HeatLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     284       22250 :     this->CoolLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     285       22250 :     this->HeatZoneTempSeq.dimension(numOfTimeStepInDay, 0.0);
     286       22250 :     this->DesHeatSetPtSeq.dimension(numOfTimeStepInDay, 0.0);
     287       22250 :     this->CoolZoneTempSeq.dimension(numOfTimeStepInDay, 0.0);
     288       22250 :     this->DesCoolSetPtSeq.dimension(numOfTimeStepInDay, 0.0);
     289       22250 :     this->HeatOutTempSeq.dimension(numOfTimeStepInDay, 0.0);
     290       22250 :     this->CoolOutTempSeq.dimension(numOfTimeStepInDay, 0.0);
     291       22250 :     this->HeatZoneRetTempSeq.dimension(numOfTimeStepInDay, 0.0);
     292       22250 :     this->HeatTstatTempSeq.dimension(numOfTimeStepInDay, 0.0);
     293       22250 :     this->CoolZoneRetTempSeq.dimension(numOfTimeStepInDay, 0.0);
     294       22250 :     this->CoolTstatTempSeq.dimension(numOfTimeStepInDay, 0.0);
     295       22250 :     this->HeatZoneHumRatSeq.dimension(numOfTimeStepInDay, 0.0);
     296       22250 :     this->CoolZoneHumRatSeq.dimension(numOfTimeStepInDay, 0.0);
     297       22250 :     this->HeatOutHumRatSeq.dimension(numOfTimeStepInDay, 0.0);
     298       22250 :     this->CoolOutHumRatSeq.dimension(numOfTimeStepInDay, 0.0);
     299       22250 :     this->DOASHeatLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     300       22250 :     this->DOASCoolLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     301       22250 :     this->DOASHeatAddSeq.dimension(numOfTimeStepInDay, 0.0);
     302       22250 :     this->DOASLatAddSeq.dimension(numOfTimeStepInDay, 0.0);
     303       22250 :     this->DOASSupMassFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     304       22250 :     this->DOASSupTempSeq.dimension(numOfTimeStepInDay, 0.0);
     305       22250 :     this->DOASSupHumRatSeq.dimension(numOfTimeStepInDay, 0.0);
     306       22250 :     this->DOASTotCoolLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     307       22250 :     this->HeatLoadNoDOASSeq.dimension(numOfTimeStepInDay, 0.0);
     308       22250 :     this->CoolLoadNoDOASSeq.dimension(numOfTimeStepInDay, 0.0);
     309       22250 :     this->LatentHeatLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     310       22250 :     this->LatentCoolLoadSeq.dimension(numOfTimeStepInDay, 0.0);
     311       22250 :     this->HeatLatentLoadNoDOASSeq.dimension(numOfTimeStepInDay, 0.0);
     312       22250 :     this->CoolLatentLoadNoDOASSeq.dimension(numOfTimeStepInDay, 0.0);
     313       22250 :     this->LatentCoolFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     314       22250 :     this->LatentHeatFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     315       22250 : }
     316             : 
     317        3701 : void TermUnitZoneSizingData::allocateMemberArrays(int const numOfTimeStepInDay)
     318             : {
     319        3701 :     this->HeatFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     320        3701 :     this->CoolFlowSeq.dimension(numOfTimeStepInDay, 0.0);
     321        3701 :     this->HeatFlowSeqNoOA.dimension(numOfTimeStepInDay, 0.0);
     322        3701 :     this->CoolFlowSeqNoOA.dimension(numOfTimeStepInDay, 0.0);
     323        3701 :     this->HeatZoneTempSeq.dimension(numOfTimeStepInDay, 0.0);
     324        3701 :     this->HeatZoneRetTempSeq.dimension(numOfTimeStepInDay, 0.0);
     325        3701 :     this->CoolZoneTempSeq.dimension(numOfTimeStepInDay, 0.0);
     326        3701 :     this->CoolZoneRetTempSeq.dimension(numOfTimeStepInDay, 0.0);
     327        3701 : }
     328             : 
     329        3696 : void TermUnitZoneSizingData::copyFromZoneSizing(ZoneSizingData const &sourceData)
     330             : {
     331        3696 :     this->ZoneName = sourceData.ZoneName;
     332        3696 :     this->ADUName = sourceData.ADUName;
     333        3696 :     this->CoolDesTemp = sourceData.CoolDesTemp;
     334        3696 :     this->HeatDesTemp = sourceData.HeatDesTemp;
     335        3696 :     this->CoolDesHumRat = sourceData.CoolDesHumRat;
     336        3696 :     this->HeatDesHumRat = sourceData.HeatDesHumRat;
     337        3696 :     this->DesOAFlowPPer = sourceData.DesOAFlowPPer;
     338        3696 :     this->DesOAFlowPerArea = sourceData.DesOAFlowPerArea;
     339        3696 :     this->DesCoolMinAirFlow = sourceData.DesCoolMinAirFlow;
     340        3696 :     this->DesCoolMinAirFlowFrac = sourceData.DesCoolMinAirFlowFrac;
     341        3696 :     this->DesHeatMaxAirFlow = sourceData.DesHeatMaxAirFlow;
     342        3696 :     this->DesHeatMaxAirFlowFrac = sourceData.DesHeatMaxAirFlowFrac;
     343        3696 :     this->ZoneNum = sourceData.ZoneNum;
     344        3696 :     this->DesHeatMassFlow = sourceData.DesHeatMassFlow;
     345        3696 :     this->DesHeatMassFlowNoOA = sourceData.DesHeatMassFlowNoOA;
     346        3696 :     this->DesHeatOAFlowFrac = sourceData.DesHeatOAFlowFrac;
     347        3696 :     this->DesCoolMassFlow = sourceData.DesCoolMassFlow;
     348        3696 :     this->DesCoolMassFlowNoOA = sourceData.DesCoolMassFlowNoOA;
     349        3696 :     this->DesCoolOAFlowFrac = sourceData.DesCoolOAFlowFrac;
     350        3696 :     this->DesHeatLoad = sourceData.DesHeatLoad;
     351        3696 :     this->NonAirSysDesHeatLoad = sourceData.NonAirSysDesHeatLoad;
     352        3696 :     this->DesCoolLoad = sourceData.DesCoolLoad;
     353        3696 :     this->NonAirSysDesCoolLoad = sourceData.NonAirSysDesCoolLoad;
     354        3696 :     this->DesHeatVolFlow = sourceData.DesHeatVolFlow;
     355        3696 :     this->DesHeatVolFlowNoOA = sourceData.DesHeatVolFlowNoOA;
     356        3696 :     this->NonAirSysDesHeatVolFlow = sourceData.NonAirSysDesHeatVolFlow;
     357        3696 :     this->DesCoolVolFlow = sourceData.DesCoolVolFlow;
     358        3696 :     this->DesCoolVolFlowNoOA = sourceData.DesCoolVolFlowNoOA;
     359        3696 :     this->NonAirSysDesCoolVolFlow = sourceData.NonAirSysDesCoolVolFlow;
     360        3696 :     this->DesHeatVolFlowMax = sourceData.DesHeatVolFlowMax;
     361        3696 :     this->DesCoolVolFlowMin = sourceData.DesCoolVolFlowMin;
     362        3696 :     this->DesHeatCoilInTempTU = sourceData.DesHeatCoilInTempTU;
     363        3696 :     this->DesCoolCoilInTempTU = sourceData.DesCoolCoilInTempTU;
     364        3696 :     this->DesHeatCoilInHumRatTU = sourceData.DesHeatCoilInHumRatTU;
     365        3696 :     this->DesCoolCoilInHumRatTU = sourceData.DesCoolCoilInHumRatTU;
     366        3696 :     this->ZoneTempAtHeatPeak = sourceData.ZoneTempAtHeatPeak;
     367        3696 :     this->ZoneRetTempAtHeatPeak = sourceData.ZoneRetTempAtHeatPeak;
     368        3696 :     this->ZoneTempAtCoolPeak = sourceData.ZoneTempAtCoolPeak;
     369        3696 :     this->ZoneRetTempAtCoolPeak = sourceData.ZoneRetTempAtCoolPeak;
     370        3696 :     this->ZoneHumRatAtHeatPeak = sourceData.ZoneHumRatAtHeatPeak;
     371        3696 :     this->ZoneHumRatAtCoolPeak = sourceData.ZoneHumRatAtCoolPeak;
     372        3696 :     this->TimeStepNumAtHeatMax = sourceData.TimeStepNumAtHeatMax;
     373        3696 :     this->TimeStepNumAtCoolMax = sourceData.TimeStepNumAtCoolMax;
     374        3696 :     this->HeatDDNum = sourceData.HeatDDNum;
     375        3696 :     this->CoolDDNum = sourceData.CoolDDNum;
     376        3696 :     this->MinOA = sourceData.MinOA;
     377        3696 :     this->DesCoolMinAirFlow2 = sourceData.DesCoolMinAirFlow2;
     378        3696 :     this->DesHeatMaxAirFlow2 = sourceData.DesHeatMaxAirFlow2;
     379      447072 :     for (size_t t = 1; t <= this->HeatFlowSeq.size(); ++t) {
     380      443376 :         this->HeatFlowSeq(t) = sourceData.HeatFlowSeq(t);
     381      443376 :         this->HeatFlowSeqNoOA(t) = sourceData.HeatFlowSeqNoOA(t);
     382      443376 :         this->CoolFlowSeq(t) = sourceData.CoolFlowSeq(t);
     383      443376 :         this->CoolFlowSeqNoOA(t) = sourceData.CoolFlowSeqNoOA(t);
     384      443376 :         this->HeatZoneTempSeq(t) = sourceData.HeatZoneTempSeq(t);
     385      443376 :         this->HeatZoneRetTempSeq(t) = sourceData.HeatZoneRetTempSeq(t);
     386      443376 :         this->CoolZoneTempSeq(t) = sourceData.CoolZoneTempSeq(t);
     387      443376 :         this->CoolZoneRetTempSeq(t) = sourceData.CoolZoneRetTempSeq(t);
     388             :     }
     389        3696 :     this->ZoneADEffCooling = sourceData.ZoneADEffCooling;
     390        3696 :     this->ZoneADEffHeating = sourceData.ZoneADEffHeating;
     391        3696 :     this->ZoneSecondaryRecirculation = sourceData.ZoneSecondaryRecirculation;
     392        3696 :     this->ZoneVentilationEff = sourceData.ZoneVentilationEff;
     393        3696 :     this->ZonePrimaryAirFraction = sourceData.ZonePrimaryAirFraction;
     394        3696 :     this->ZonePrimaryAirFractionHtg = sourceData.ZonePrimaryAirFractionHtg;
     395        3696 :     this->ZoneOAFracCooling = sourceData.ZoneOAFracCooling;
     396        3696 :     this->ZoneOAFracHeating = sourceData.ZoneOAFracHeating;
     397        3696 :     this->TotalOAFromPeople = sourceData.TotalOAFromPeople;
     398        3696 :     this->TotalOAFromArea = sourceData.TotalOAFromArea;
     399        3696 :     this->TotPeopleInZone = sourceData.TotPeopleInZone;
     400        3696 :     this->TotalZoneFloorArea = sourceData.TotalZoneFloorArea;
     401        3696 :     this->SupplyAirAdjustFactor = sourceData.SupplyAirAdjustFactor;
     402        3696 :     this->ZpzClgByZone = sourceData.ZpzClgByZone;
     403        3696 :     this->ZpzHtgByZone = sourceData.ZpzHtgByZone;
     404        3696 :     this->VozClgByZone = sourceData.VozClgByZone;
     405        3696 :     this->VozHtgByZone = sourceData.VozHtgByZone;
     406        3696 :     this->VpzMinByZoneSPSized = sourceData.VpzMinByZoneSPSized;
     407        3696 :     this->ZoneSizThermSetPtHi = sourceData.ZoneSizThermSetPtHi;
     408        3696 :     this->ZoneSizThermSetPtLo = sourceData.ZoneSizThermSetPtLo;
     409        3696 : }
     410             : 
     411        1364 : void resetHVACSizingGlobals(EnergyPlusData &state,
     412             :                             int const curZoneEqNum,
     413             :                             int const curSysNum,
     414             :                             bool &firstPassFlag) // called in zone equipment Report function
     415             : {
     416             :     // reset Data globals so that previously set variables are not used in other equipment models
     417        1364 :     state.dataSize->DataTotCapCurveIndex = 0;
     418        1364 :     state.dataSize->DataPltSizCoolNum = 0;
     419        1364 :     state.dataSize->DataPltSizHeatNum = 0;
     420        1364 :     state.dataSize->DataWaterLoopNum = 0;
     421        1364 :     state.dataSize->DataCoilNum = 0;
     422        1364 :     state.dataSize->DataFanOp = HVAC::FanOp::Invalid;
     423        1364 :     state.dataSize->DataCoilIsSuppHeater = false;
     424        1364 :     state.dataSize->DataIsDXCoil = false;
     425        1364 :     state.dataSize->DataAutosizable = true;
     426        1364 :     state.dataSize->DataEMSOverrideON = false;
     427        1364 :     state.dataSize->DataScalableSizingON = false;
     428        1364 :     state.dataSize->DataScalableCapSizingON = false;
     429        1364 :     state.dataSize->DataSysScalableFlowSizingON = false;
     430        1364 :     state.dataSize->DataSysScalableCapSizingON = false;
     431        1364 :     state.dataSize->DataDesAccountForFanHeat = true;
     432        1364 :     state.dataSize->DataDXCoolsLowSpeedsAutozize = false;
     433             : 
     434        1364 :     state.dataSize->DataDesInletWaterTemp = 0.0;
     435        1364 :     state.dataSize->DataDesInletAirHumRat = 0.0;
     436        1364 :     state.dataSize->DataDesInletAirTemp = 0.0;
     437        1364 :     state.dataSize->DataDesOutletAirTemp = 0.0;
     438        1364 :     state.dataSize->DataDesOutletAirHumRat = 0.0;
     439        1364 :     state.dataSize->DataCoolCoilCap = 0.0;
     440        1364 :     state.dataSize->DataFlowUsedForSizing = 0.0;
     441        1364 :     state.dataSize->DataAirFlowUsedForSizing = 0.0;
     442        1364 :     state.dataSize->DataWaterFlowUsedForSizing = 0.0;
     443        1364 :     state.dataSize->DataCapacityUsedForSizing = 0.0;
     444        1364 :     state.dataSize->DataDesignCoilCapacity = 0.0;
     445        1364 :     state.dataSize->DataHeatSizeRatio = 1.0;
     446        1364 :     state.dataSize->DataEMSOverride = 0.0;
     447        1364 :     state.dataSize->DataBypassFrac = 0.0;
     448        1364 :     state.dataSize->DataFracOfAutosizedCoolingAirflow = 1.0;
     449        1364 :     state.dataSize->DataFracOfAutosizedHeatingAirflow = 1.0;
     450        1364 :     state.dataSize->DataFlowPerCoolingCapacity = 0.0;
     451        1364 :     state.dataSize->DataFlowPerHeatingCapacity = 0.0;
     452        1364 :     state.dataSize->DataFracOfAutosizedCoolingCapacity = 1.0;
     453        1364 :     state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0;
     454        1364 :     state.dataSize->DataAutosizedCoolingCapacity = 0.0;
     455        1364 :     state.dataSize->DataAutosizedHeatingCapacity = 0.0;
     456        1364 :     state.dataSize->DataConstantUsedForSizing = 0.0;
     457        1364 :     state.dataSize->DataFractionUsedForSizing = 0.0;
     458        1364 :     state.dataSize->DataNonZoneNonAirloopValue = 0.0;
     459        1364 :     state.dataSize->DataZoneNumber = 0;
     460        1364 :     state.dataSize->DataFanType = HVAC::FanType::Invalid;
     461        1364 :     state.dataSize->DataFanIndex = 0;
     462        1364 :     state.dataSize->DataWaterCoilSizCoolDeltaT = 0.0;
     463        1364 :     state.dataSize->DataWaterCoilSizHeatDeltaT = 0.0;
     464        1364 :     state.dataSize->DataNomCapInpMeth = false;
     465        1364 :     state.dataSize->DataFanPlacement = HVAC::FanPlace::Invalid;
     466        1364 :     state.dataSize->DataDXSpeedNum = 0;
     467        1364 :     state.dataSize->DataCoilSizingAirInTemp = 0.0;
     468        1364 :     state.dataSize->DataCoilSizingAirInHumRat = 0.0;
     469        1364 :     state.dataSize->DataCoilSizingAirOutTemp = 0.0;
     470        1364 :     state.dataSize->DataCoilSizingAirOutHumRat = 0.0;
     471        1364 :     state.dataSize->DataCoolCoilType = -1;
     472        1364 :     state.dataSize->DataCoolCoilIndex = -1;
     473             : 
     474             :     // These zone specific sizing variables are set in zone equipment to use for sizing.
     475             :     // Reset to avoid chance that second zone equipment will size using these variables set by first zone equipment to be sized
     476        1364 :     if (curZoneEqNum > 0) {
     477             : 
     478         594 :         if (state.dataSize->ZoneEqSizing.size() == 0) {
     479           0 :             firstPassFlag = false;
     480           0 :             return;
     481             :         }
     482             : 
     483         594 :         auto &ZoneEqSizing = state.dataSize->ZoneEqSizing(curZoneEqNum);
     484         594 :         ZoneEqSizing.AirFlow = false;
     485         594 :         ZoneEqSizing.CoolingAirFlow = false;
     486         594 :         ZoneEqSizing.HeatingAirFlow = false;
     487         594 :         ZoneEqSizing.SystemAirFlow = false;
     488         594 :         ZoneEqSizing.Capacity = false;
     489         594 :         ZoneEqSizing.CoolingCapacity = false;
     490         594 :         ZoneEqSizing.HeatingCapacity = false;
     491         594 :         ZoneEqSizing.AirVolFlow = 0.0;
     492         594 :         ZoneEqSizing.MaxHWVolFlow = 0.0;
     493         594 :         ZoneEqSizing.MaxCWVolFlow = 0.0;
     494         594 :         ZoneEqSizing.OAVolFlow = 0.0;
     495         594 :         ZoneEqSizing.DesCoolingLoad = 0.0;
     496         594 :         ZoneEqSizing.DesHeatingLoad = 0.0;
     497         594 :         ZoneEqSizing.CoolingAirVolFlow = 0.0;
     498         594 :         ZoneEqSizing.HeatingAirVolFlow = 0.0;
     499         594 :         ZoneEqSizing.SystemAirVolFlow = 0.0;
     500         594 :         ZoneEqSizing.DesignSizeFromParent = false;
     501             :     }
     502             : 
     503        1364 :     if (curSysNum > 0) {
     504             : 
     505         768 :         if (state.dataSize->UnitarySysEqSizing.size() == 0) {
     506           0 :             firstPassFlag = false;
     507           0 :             return;
     508             :         }
     509             : 
     510         768 :         auto &UnitarySysEqSizing = state.dataSize->UnitarySysEqSizing(curSysNum);
     511         768 :         UnitarySysEqSizing.AirFlow = false;
     512         768 :         UnitarySysEqSizing.CoolingAirFlow = false;
     513         768 :         UnitarySysEqSizing.HeatingAirFlow = false;
     514         768 :         UnitarySysEqSizing.Capacity = false;
     515         768 :         UnitarySysEqSizing.CoolingCapacity = false;
     516         768 :         UnitarySysEqSizing.HeatingCapacity = false;
     517             :     }
     518             : 
     519        1364 :     firstPassFlag = false;
     520             : }
     521             : 
     522         343 : void GetCoilDesFlowT(EnergyPlusData &state,
     523             :                      int SysNum,           // central air system index
     524             :                      Real64 CpAir,         // specific heat to be used in calculations [J/kgC]
     525             :                      Real64 &DesFlow,      // returned design mass flow [kg/s]
     526             :                      Real64 &DesExitTemp,  // returned design coil exit temperature [kg/s]
     527             :                      Real64 &DesExitHumRat // returned design coil exit humidity ratio [kg/kg]
     528             : )
     529             : {
     530             :     // FUNCTION INFORMATION:
     531             :     //       AUTHOR         Fred Buhl
     532             :     //       DATE WRITTEN   September 2014
     533             : 
     534             :     // PURPOSE OF THIS FUNCTION:
     535             :     // This function calculates the coil design air flow rate and exit temperature depending on the
     536             :     // cooling capacity control method
     537             : 
     538             :     // METHODOLOGY EMPLOYED:
     539             :     // energy and mass flow balance
     540             : 
     541             :     // FUNCTION LOCAL VARIABLE DECLARATIONS:
     542         343 :     int TimeStepAtPeak = 0;
     543         343 :     Real64 ZoneCoolLoadSum = 0; // sum of zone cooling loads at the peak [W]
     544         343 :     Real64 AvgZoneTemp = 0;     // average zone temperature [C]
     545             : 
     546         343 :     auto &finalSysSizing = state.dataSize->FinalSysSizing(SysNum);
     547         343 :     auto &sysSizPeakDDNum = state.dataSize->SysSizPeakDDNum(SysNum);
     548         343 :     auto &calcSysSizing = state.dataSize->CalcSysSizing(SysNum);
     549             : 
     550         343 :     int sysSizIndex = Util::FindItemInList(finalSysSizing.AirPriLoopName, state.dataSize->SysSizInput, &SystemSizingInputData::AirPriLoopName);
     551         343 :     if (sysSizIndex == 0) sysSizIndex = 1;
     552         343 :     auto &sysSizInput = state.dataSize->SysSizInput(sysSizIndex);
     553             : 
     554         343 :     if (sysSizPeakDDNum.SensCoolPeakDD > 0) {
     555         343 :         if (sysSizInput.coolingPeakLoad == PeakLoad::TotalCooling) {
     556           5 :             TimeStepAtPeak = sysSizPeakDDNum.TimeStepAtTotCoolPk(sysSizPeakDDNum.TotCoolPeakDD);
     557             :         } else {
     558         338 :             TimeStepAtPeak = sysSizPeakDDNum.TimeStepAtSensCoolPk(sysSizPeakDDNum.SensCoolPeakDD);
     559             :         }
     560             :     } else {
     561           0 :         if ((sysSizInput.CoolCapControl == CapacityControl::VT) || (sysSizInput.CoolCapControl == CapacityControl::Bypass)) {
     562           0 :             ShowWarningError(state,
     563           0 :                              format("GetCoilDesFlow: AirLoopHVAC = {} has no time of peak cooling load for sizing.", sysSizInput.AirPriLoopName));
     564           0 :             ShowContinueError(state, "Using Central Cooling Capacity Control Method=VAV instead of Bypass or VT.");
     565           0 :             sysSizInput.CoolCapControl = CapacityControl::VAV;
     566             :         }
     567             :     }
     568             : 
     569         343 :     if (sysSizInput.CoolCapControl == CapacityControl::VAV) {
     570         272 :         DesExitTemp = finalSysSizing.CoolSupTemp;
     571         272 :         DesFlow = finalSysSizing.MassFlowAtCoolPeak / state.dataEnvrn->StdRhoAir;
     572         272 :         DesExitHumRat = finalSysSizing.CoolSupHumRat;
     573          71 :     } else if (sysSizInput.CoolCapControl == CapacityControl::OnOff) {
     574          69 :         DesExitTemp = finalSysSizing.CoolSupTemp;
     575          69 :         DesFlow = state.dataSize->DataAirFlowUsedForSizing;
     576          69 :         DesExitHumRat = finalSysSizing.CoolSupHumRat;
     577           2 :     } else if (sysSizInput.CoolCapControl == CapacityControl::VT) {
     578           1 :         ZoneCoolLoadSum = calcSysSizing.SumZoneCoolLoadSeq(TimeStepAtPeak);
     579           1 :         AvgZoneTemp = calcSysSizing.CoolZoneAvgTempSeq(TimeStepAtPeak);
     580           1 :         DesExitTemp =
     581           1 :             max(finalSysSizing.CoolSupTemp, AvgZoneTemp - ZoneCoolLoadSum / (state.dataEnvrn->StdRhoAir * CpAir * finalSysSizing.DesCoolVolFlow));
     582           1 :         DesFlow = finalSysSizing.DesCoolVolFlow;
     583           1 :         DesExitHumRat = Psychrometrics::PsyWFnTdbRhPb(state, DesExitTemp, 0.9, state.dataEnvrn->StdBaroPress, "GetCoilDesFlowT");
     584           1 :     } else if (sysSizInput.CoolCapControl == CapacityControl::Bypass) {
     585           1 :         ZoneCoolLoadSum = calcSysSizing.SumZoneCoolLoadSeq(TimeStepAtPeak);
     586           1 :         AvgZoneTemp = calcSysSizing.CoolZoneAvgTempSeq(TimeStepAtPeak);
     587           1 :         DesExitTemp = finalSysSizing.CoolSupTemp;
     588           1 :         if (calcSysSizing.MixTempAtCoolPeak > DesExitTemp) {
     589           1 :             Real64 AvgSupTemp = AvgZoneTemp - ZoneCoolLoadSum / (state.dataEnvrn->StdRhoAir * CpAir * finalSysSizing.DesCoolVolFlow);
     590           1 :             DesFlow = finalSysSizing.DesCoolVolFlow *
     591           1 :                       max(0.0, min(1.0, ((calcSysSizing.MixTempAtCoolPeak - AvgSupTemp) / (calcSysSizing.MixTempAtCoolPeak - DesExitTemp))));
     592             :         } else {
     593           0 :             DesFlow = finalSysSizing.DesCoolVolFlow;
     594             :         }
     595           1 :         DesExitHumRat = Psychrometrics::PsyWFnTdbRhPb(state, DesExitTemp, 0.9, state.dataEnvrn->StdBaroPress, "GetCoilDesFlowT");
     596             :     }
     597         343 : }
     598             : 
     599      420081 : Real64 ZoneAirDistributionData::calculateEz(EnergyPlusData &state, int const ZoneNum) // Zone index
     600             : {
     601      420081 :     Real64 zoneEz = 1.0;
     602             :     // Calc the zone supplied OA flow rate counting the zone air distribution effectiveness
     603             :     //  First check whether the zone air distribution effectiveness schedule exists, if yes uses it;
     604             :     //   otherwise uses the inputs of zone distribution effectiveness in cooling mode or heating mode
     605      420081 :     if (this->ZoneADEffSchPtr > 0) {
     606             :         // Get schedule value for the zone air distribution effectiveness
     607           0 :         zoneEz = ScheduleManager::GetCurrentScheduleValue(state, this->ZoneADEffSchPtr);
     608             :     } else {
     609      420081 :         Real64 zoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired;
     610             : 
     611             :         // Zone in cooling mode
     612      420081 :         if (zoneLoad < 0.0) zoneEz = this->ZoneADEffCooling;
     613             : 
     614             :         // Zone in heating mode
     615      420081 :         if (zoneLoad > 0.0) zoneEz = this->ZoneADEffHeating;
     616             :     }
     617      420081 :     if (zoneEz <= 0.0) {
     618             :         // Enforce defaults
     619           0 :         zoneEz = 1.0;
     620             :     }
     621      420081 :     return zoneEz;
     622             : }
     623             : 
     624     7152168 : Real64 calcDesignSpecificationOutdoorAir(EnergyPlusData &state,
     625             :                                          int const DSOAPtr,          // Pointer to DesignSpecification:OutdoorAir object
     626             :                                          int const ActualZoneNum,    // Zone index
     627             :                                          bool const UseOccSchFlag,   // Zone occupancy schedule will be used instead of using total zone occupancy
     628             :                                          bool const UseMinOASchFlag, // Use min OA schedule in DesignSpecification:OutdoorAir object
     629             :                                          bool const PerPersonNotSet, // when calculation should not include occupants (e.g., dual duct)
     630             :                                          bool const MaxOAVolFlowFlag // TRUE when calculation uses occupancy schedule  (e.g., dual duct)
     631             : )
     632             : {
     633     7152168 :     Real64 totOAFlowRate = 0.0;
     634     7152168 :     if (DSOAPtr == 0) return totOAFlowRate;
     635             : 
     636     6442054 :     auto &thisDSOA = state.dataSize->OARequirements(DSOAPtr);
     637             : 
     638     6442054 :     if (thisDSOA.numDSOA == 0) {
     639             :         // This is a simple DesignSpecification:OutdoorAir
     640     6441349 :         return thisDSOA.calcOAFlowRate(state, ActualZoneNum, UseOccSchFlag, UseMinOASchFlag, PerPersonNotSet, MaxOAVolFlowFlag);
     641             :     } else {
     642             :         // This is a DesignSpecification:OutdoorAir:SpaceList
     643        2115 :         for (int dsoaCount = 1; dsoaCount <= thisDSOA.numDSOA; ++dsoaCount) {
     644        1410 :             totOAFlowRate += state.dataSize->OARequirements(thisDSOA.dsoaIndexes(dsoaCount))
     645        1410 :                                  .calcOAFlowRate(state,
     646             :                                                  ActualZoneNum,
     647             :                                                  UseOccSchFlag,
     648             :                                                  UseMinOASchFlag,
     649             :                                                  PerPersonNotSet,
     650             :                                                  MaxOAVolFlowFlag,
     651        1410 :                                                  thisDSOA.dsoaSpaceIndexes(dsoaCount));
     652             :         }
     653         705 :         return totOAFlowRate;
     654             :     }
     655             : }
     656             : 
     657        3503 : Real64 OARequirementsData::desFlowPerZoneArea(EnergyPlusData &state,
     658             :                                               int const actualZoneNum // Zone index
     659             : )
     660             : {
     661        3503 :     Real64 desFlowPA = 0.0;
     662        3503 :     if (this->numDSOA == 0) {
     663             :         // This is a simple DesignSpecification:OutdoorAir
     664        3500 :         if (this->OAFlowMethod != OAFlowCalcMethod::PerPerson && this->OAFlowMethod != OAFlowCalcMethod::PerZone &&
     665        1101 :             this->OAFlowMethod != OAFlowCalcMethod::ACH) {
     666        1101 :             desFlowPA = this->OAFlowPerArea;
     667             :         }
     668             :     } else {
     669             :         // This is a DesignSpecification:OutdoorAir:SpaceList
     670           3 :         Real64 sumAreaOA = 0.0;
     671           9 :         for (int dsoaCount = 1; dsoaCount <= this->numDSOA; ++dsoaCount) {
     672           6 :             auto const &thisDSOA = state.dataSize->OARequirements(this->dsoaIndexes(dsoaCount));
     673           6 :             if (thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerPerson && thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerZone &&
     674           6 :                 thisDSOA.OAFlowMethod != OAFlowCalcMethod::ACH) {
     675           6 :                 Real64 spaceArea = state.dataHeatBal->space(this->dsoaSpaceIndexes(dsoaCount)).FloorArea;
     676           6 :                 sumAreaOA += thisDSOA.OAFlowPerArea * spaceArea;
     677             :             }
     678             :         }
     679           3 :         if (state.dataHeatBal->Zone(actualZoneNum).FloorArea) {
     680           3 :             desFlowPA = sumAreaOA / state.dataHeatBal->Zone(actualZoneNum).FloorArea;
     681             :         }
     682             :     }
     683        3503 :     return desFlowPA;
     684             : }
     685             : 
     686        3503 : Real64 OARequirementsData::desFlowPerZonePerson(EnergyPlusData &state,
     687             :                                                 int const actualZoneNum // Zone index
     688             : )
     689             : {
     690        3503 :     Real64 desFlowPP = 0.0;
     691        3503 :     if (this->numDSOA == 0) {
     692             :         // This is a simple DesignSpecification:OutdoorAir
     693        3500 :         if (this->OAFlowMethod != OAFlowCalcMethod::PerArea && this->OAFlowMethod != OAFlowCalcMethod::PerZone &&
     694        1978 :             this->OAFlowMethod != OAFlowCalcMethod::ACH) {
     695        1978 :             desFlowPP = this->OAFlowPerPerson;
     696             :         }
     697             :     } else {
     698             :         // This is a DesignSpecification:OutdoorAir:SpaceList
     699           3 :         Real64 sumPeopleOA = 0.0;
     700           9 :         for (int dsoaCount = 1; dsoaCount <= this->numDSOA; ++dsoaCount) {
     701           6 :             auto const &thisDSOA = state.dataSize->OARequirements(this->dsoaIndexes(dsoaCount));
     702           6 :             if (thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerArea && thisDSOA.OAFlowMethod != OAFlowCalcMethod::PerZone &&
     703           6 :                 thisDSOA.OAFlowMethod != OAFlowCalcMethod::ACH) {
     704           6 :                 Real64 spacePeople = state.dataHeatBal->space(this->dsoaSpaceIndexes(dsoaCount)).TotOccupants;
     705           6 :                 sumPeopleOA += thisDSOA.OAFlowPerPerson * spacePeople;
     706             :             }
     707             :         }
     708           3 :         if (state.dataHeatBal->Zone(actualZoneNum).TotOccupants > 0.0) {
     709           3 :             desFlowPP = sumPeopleOA / state.dataHeatBal->Zone(actualZoneNum).TotOccupants;
     710             :         }
     711             :     }
     712        3503 :     return desFlowPP;
     713             : }
     714             : 
     715     6442759 : Real64 OARequirementsData::calcOAFlowRate(EnergyPlusData &state,
     716             :                                           int const ActualZoneNum,     // Zone index
     717             :                                           bool const UseOccSchFlag,    // Zone occupancy schedule will be used instead of using total zone occupancy
     718             :                                           bool const UseMinOASchFlag,  // Use min OA schedule in DesignSpecification:OutdoorAir object
     719             :                                           bool const PerPersonNotSet,  // when calculation should not include occupants (e.g., dual duct)
     720             :                                           bool const MaxOAVolFlowFlag, // TRUE when calculation uses occupancy schedule  (e.g., dual duct)
     721             :                                           int const spaceNum           // Space index (if applicable)
     722             : )
     723             : {
     724             : 
     725             :     // FUNCTION INFORMATION:
     726             :     //       AUTHOR         Richard Raustad, FSEC
     727             :     //       DATE WRITTEN   October 2012
     728             : 
     729             :     // PURPOSE OF THIS FUNCTION:
     730             :     // This function returns the air volume flow rate based on DesignSpecification:OutdoorAir object.
     731             : 
     732             :     // METHODOLOGY EMPLOYED:
     733             :     // User inputs and zone index allows calculation of outdoor air quantity.
     734             :     // Sizing does not use occupancy or min OA schedule and will call with flags set to FALSE
     735             :     // Ventilation Rate Procedure uses occupancy schedule based on user input.
     736             : 
     737             :     // Return value
     738             :     Real64 OAVolumeFlowRate; // Return value for calculated outdoor air volume flow rate [m3/s]
     739             : 
     740             :     // FUNCTION LOCAL VARIABLE DECLARATIONS:
     741             :     Real64 DSOAFlowPeople;            // Outdoor air volume flow rate based on occupancy (m3/s)
     742             :     Real64 DSOAFlowPerZone;           // Outdoor air volume flow rate (m3/s)
     743             :     Real64 DSOAFlowPerArea;           // Outdoor air volume flow rate based on zone floor area (m3/s)
     744             :     Real64 DSOAFlowACH;               // Outdoor air volume flow rate based on air changes per hour (m3/s)
     745             :     Real64 ZoneOAPeople;              // Zone OA flow rate based on number of occupants [m3/s]
     746             :     Real64 ZoneOAArea;                // Zone OA flow rate based on space floor area [m3/s]
     747             :     Real64 ZoneOAMin;                 // Minimum Zone OA flow rate when the zone is unoccupied (i.e. ZoneOAPeople = 0)
     748             :                                       // used for "ProportionalControl" System outdoor air method
     749             :     Real64 ZoneOAMax;                 // Maximum Zone OA flow rate (ZoneOAPeople + ZoneOAArea)
     750             :                                       // used for "ProportionalControl" System outdoor air method
     751             :     Real64 ZoneMaxCO2;                // Breathing-zone CO2 concentration
     752             :     Real64 ZoneMinCO2;                // Minimum CO2 concentration in zone
     753             :     Real64 ZoneContamControllerSched; // Schedule value for ZoneControl:ContaminantController
     754             :     Real64 CO2PeopleGeneration;       // CO2 generation from people at design level
     755             : 
     756     6442759 :     OAVolumeFlowRate = 0.0;
     757             : 
     758     6442759 :     auto &thisZone = state.dataHeatBal->Zone(ActualZoneNum);
     759     6442759 :     Real64 floorArea = 0.0;
     760     6442759 :     Real64 volume = 0.0;
     761     6442759 :     Real64 nomTotOccupants = 0.0;
     762     6442759 :     Real64 curNumOccupants = 0.0;
     763     6442759 :     Real64 maxOccupants = 0.0;
     764     6442759 :     if (spaceNum > 0) {
     765        1410 :         floorArea = state.dataHeatBal->space(spaceNum).FloorArea;
     766             :         // TODO MJW: For now just proportion space volume by floor area
     767        1410 :         if (thisZone.FloorArea > 0.0) {
     768        1410 :             volume = thisZone.Volume * state.dataHeatBal->space(spaceNum).FloorArea / thisZone.FloorArea;
     769             :         } else {
     770           0 :             volume = 0.0;
     771             :         }
     772        1410 :         nomTotOccupants = state.dataHeatBal->space(spaceNum).TotOccupants;
     773        1410 :         curNumOccupants = state.dataHeatBal->spaceIntGain(spaceNum).NOFOCC;
     774        1410 :         maxOccupants = state.dataHeatBal->space(spaceNum).maxOccupants;
     775             :     } else {
     776     6441349 :         floorArea = thisZone.FloorArea;
     777     6441349 :         volume = thisZone.Volume;
     778     6441349 :         nomTotOccupants = thisZone.TotOccupants;
     779     6441349 :         curNumOccupants = state.dataHeatBal->ZoneIntGain(ActualZoneNum).NOFOCC;
     780     6441349 :         maxOccupants = thisZone.maxOccupants;
     781             :     }
     782             : 
     783     6442759 :     if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::IAQProcedure && this->myEnvrnFlag) {
     784           5 :         if (!state.dataContaminantBalance->Contaminant.CO2Simulation) {
     785           0 :             ShowSevereError(state,
     786           0 :                             format("DesignSpecification:OutdoorAir=\"{}{}",
     787           0 :                                    this->Name,
     788             :                                    R"(" valid Outdoor Air Method =" IndoorAirQualityProcedure" requires CO2 simulation.)"));
     789           0 :             ShowContinueError(state, "The choice must be Yes for the field Carbon Dioxide Concentration in ZoneAirContaminantBalance");
     790           0 :             ShowFatalError(state, "CalcDesignSpecificationOutdoorAir: Errors found in input. Preceding condition(s) cause termination.");
     791             :         }
     792           5 :         this->myEnvrnFlag = false;
     793             :     }
     794     6442759 :     if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCOccSch && this->myEnvrnFlag) {
     795           2 :         if (!state.dataContaminantBalance->Contaminant.CO2Simulation) {
     796           0 :             ShowSevereError(state,
     797           0 :                             format("DesignSpecification:OutdoorAir=\"{}{}",
     798           0 :                                    this->Name,
     799             :                                    R"(" valid Outdoor Air Method =" ProportionalControlBasedOnDesignOccupancy" requires CO2 simulation.)"));
     800           0 :             ShowContinueError(state, "The choice must be Yes for the field Carbon Dioxide Concentration in ZoneAirContaminantBalance");
     801           0 :             ShowFatalError(state, "CalcDesignSpecificationOutdoorAir: Errors found in input. Preceding condition(s) cause termination.");
     802             :         }
     803           2 :         this->myEnvrnFlag = false;
     804             :     }
     805     6442759 :     if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCDesOcc && this->myEnvrnFlag) {
     806           3 :         if (!state.dataContaminantBalance->Contaminant.CO2Simulation) {
     807           0 :             ShowSevereError(state,
     808           0 :                             format("DesignSpecification:OutdoorAir=\"{}{}",
     809           0 :                                    this->Name,
     810             :                                    R"(" valid Outdoor Air Method =" ProportionalControlBasedOnOccupancySchedule" requires CO2 simulation.)"));
     811           0 :             ShowContinueError(state, "The choice must be Yes for the field Carbon Dioxide Concentration in ZoneAirContaminantBalance");
     812           0 :             ShowFatalError(state, "CalcDesignSpecificationOutdoorAir: Errors found in input. Preceding condition(s) cause termination.");
     813             :         }
     814           3 :         this->myEnvrnFlag = false;
     815             :     }
     816             : 
     817             :     // Calculate people outdoor air flow rate as needed
     818     6442759 :     switch (this->OAFlowMethod) {
     819     3464658 :     case OAFlowCalcMethod::PerPerson:
     820             :     case OAFlowCalcMethod::Sum:
     821             :     case OAFlowCalcMethod::Max: {
     822     3464658 :         if (UseOccSchFlag) {
     823     3451538 :             if (MaxOAVolFlowFlag) {
     824             :                 // OAPerPersonMode == PerPersonDCVByCurrentLevel (UseOccSchFlag = TRUE)
     825             :                 // for dual duct, get max people according to max schedule value when requesting MaxOAFlow
     826           6 :                 DSOAFlowPeople = maxOccupants * this->OAFlowPerPerson;
     827             :             } else {
     828     3451532 :                 DSOAFlowPeople = curNumOccupants * this->OAFlowPerPerson;
     829             :             }
     830             :         } else {
     831       13120 :             if (MaxOAVolFlowFlag) {
     832             :                 // OAPerPersonMode == PerPersonByDesignLevel (UseOccSchFlag = FALSE)
     833             :                 // use total people when requesting MaxOAFlow
     834           0 :                 DSOAFlowPeople = nomTotOccupants * this->OAFlowPerPerson;
     835             :             } else {
     836       13120 :                 DSOAFlowPeople = nomTotOccupants * this->OAFlowPerPerson;
     837             :             }
     838             :         }
     839     3464658 :         if (PerPersonNotSet) DSOAFlowPeople = 0.0; // for Dual Duct if Per Person Ventilation Rate Mode is not entered
     840     3464658 :     } break;
     841     2978101 :     default: {
     842     2978101 :         DSOAFlowPeople = 0.0;
     843     2978101 :     } break;
     844             :     }
     845             : 
     846             :     // Calculate minimum outdoor air flow rate
     847     6442759 :     switch (this->OAFlowMethod) {
     848     1850014 :     case OAFlowCalcMethod::PerPerson: {
     849             :         // Multiplied by occupancy
     850     1850014 :         OAVolumeFlowRate = DSOAFlowPeople;
     851     1850014 :     } break;
     852     2500603 :     case OAFlowCalcMethod::PerZone: {
     853             :         // User input
     854     2500603 :         OAVolumeFlowRate = this->OAFlowPerZone;
     855     2500603 :     } break;
     856      193734 :     case OAFlowCalcMethod::PerArea: {
     857             :         // Multiplied by zone floor area
     858      193734 :         OAVolumeFlowRate = this->OAFlowPerArea * floorArea;
     859      193734 :     } break;
     860           0 :     case OAFlowCalcMethod::ACH: {
     861             :         // Multiplied by zone volume
     862           0 :         OAVolumeFlowRate = this->OAFlowACH * volume / 3600.0;
     863           0 :     } break;
     864     1614644 :     case OAFlowCalcMethod::Sum:
     865             :     case OAFlowCalcMethod::Max: {
     866             :         // Use sum or max of per person and the following
     867     1614644 :         DSOAFlowPerZone = this->OAFlowPerZone;
     868     1614644 :         DSOAFlowPerArea = this->OAFlowPerArea * floorArea;
     869     1614644 :         DSOAFlowACH = this->OAFlowACH * volume / 3600.0;
     870     1614644 :         if (this->OAFlowMethod == OAFlowCalcMethod::Max) {
     871         821 :             OAVolumeFlowRate = max(DSOAFlowPeople, DSOAFlowPerZone, DSOAFlowPerArea, DSOAFlowACH);
     872             :         } else {
     873     1613823 :             OAVolumeFlowRate = DSOAFlowPeople + DSOAFlowPerZone + DSOAFlowPerArea + DSOAFlowACH;
     874             :         }
     875     1614644 :     } break;
     876      115745 :     case DataSizing::OAFlowCalcMethod::IAQProcedure: {
     877      115745 :         if (state.dataGlobal->DoingSizing) {
     878          10 :             DSOAFlowPeople = nomTotOccupants * this->OAFlowPerPerson;
     879          10 :             DSOAFlowPerZone = this->OAFlowPerZone;
     880          10 :             DSOAFlowPerArea = this->OAFlowPerArea * floorArea;
     881          10 :             DSOAFlowACH = this->OAFlowACH * volume / 3600.0;
     882          10 :             OAVolumeFlowRate = DSOAFlowPeople + DSOAFlowPerZone + DSOAFlowPerArea + DSOAFlowACH;
     883             :         } else {
     884      115735 :             OAVolumeFlowRate = state.dataContaminantBalance->ZoneSysContDemand(ActualZoneNum).OutputRequiredToCO2SP / state.dataEnvrn->StdRhoAir;
     885             :         }
     886      115745 :     } break;
     887      168019 :     case DataSizing::OAFlowCalcMethod::PCOccSch:
     888             :     case DataSizing::OAFlowCalcMethod::PCDesOcc: {
     889      168019 :         ZoneOAPeople = 0.0;
     890      168019 :         if (this->OAFlowMethod != DataSizing::OAFlowCalcMethod::PCDesOcc) {
     891       59219 :             ZoneOAPeople = curNumOccupants * thisZone.Multiplier * thisZone.ListMultiplier * this->OAFlowPerPerson;
     892             :         } else {
     893      108800 :             ZoneOAPeople = nomTotOccupants * thisZone.Multiplier * thisZone.ListMultiplier * this->OAFlowPerPerson;
     894      108800 :             CO2PeopleGeneration = 0.0;
     895      108800 :             if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCDesOcc) {
     896             :                 // Accumulate CO2 generation from people at design occupancy and current activity level
     897      652800 :                 for (int PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) {
     898      544000 :                     if (spaceNum > 0) {
     899           0 :                         if (state.dataHeatBal->People(PeopleNum).spaceIndex != spaceNum) continue;
     900             :                     } else {
     901      544000 :                         if (state.dataHeatBal->People(PeopleNum).ZonePtr != ActualZoneNum) continue;
     902             :                     }
     903      108800 :                     CO2PeopleGeneration += state.dataHeatBal->People(PeopleNum).NumberOfPeople * state.dataHeatBal->People(PeopleNum).CO2RateFactor *
     904      108800 :                                            ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->People(PeopleNum).ActivityLevelPtr);
     905             :                 }
     906             :             }
     907             :         }
     908      168019 :         ZoneOAArea = floorArea * thisZone.Multiplier * thisZone.ListMultiplier * this->OAFlowPerArea;
     909      168019 :         ZoneOAMin = ZoneOAArea;
     910      168019 :         ZoneOAMax = (ZoneOAArea + ZoneOAPeople);
     911      168019 :         if (thisZone.ZoneContamControllerSchedIndex > 0.0) {
     912             :             // Check the availability schedule value for ZoneControl:ContaminantController
     913      168019 :             ZoneContamControllerSched = ScheduleManager::GetCurrentScheduleValue(state, thisZone.ZoneContamControllerSchedIndex);
     914      168019 :             if (ZoneContamControllerSched > 0.0) {
     915      168019 :                 if (ZoneOAPeople > 0.0) {
     916      140806 :                     if (state.dataContaminantBalance->ZoneCO2GainFromPeople(ActualZoneNum) > 0.0) {
     917       85010 :                         if (thisZone.ZoneMinCO2SchedIndex > 0.0) {
     918             :                             // Take the schedule value of "Minimum Carbon Dioxide Concentration Schedule Name"
     919             :                             // in the ZoneControl:ContaminantController
     920           0 :                             ZoneMinCO2 = ScheduleManager::GetCurrentScheduleValue(state, thisZone.ZoneMinCO2SchedIndex);
     921             :                         } else {
     922       85010 :                             ZoneMinCO2 = state.dataContaminantBalance->OutdoorCO2;
     923             :                         }
     924             : 
     925             :                         // Calculate zone maximum target CO2 concentration in PPM
     926       85010 :                         if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCDesOcc) {
     927       53004 :                             ZoneMaxCO2 = state.dataContaminantBalance->OutdoorCO2 +
     928       53004 :                                          (CO2PeopleGeneration * thisZone.Multiplier * thisZone.ListMultiplier * 1.0e6) / ZoneOAMax;
     929             :                         } else {
     930       32006 :                             ZoneMaxCO2 =
     931       32006 :                                 state.dataContaminantBalance->OutdoorCO2 + (state.dataContaminantBalance->ZoneCO2GainFromPeople(ActualZoneNum) *
     932       32006 :                                                                             thisZone.Multiplier * thisZone.ListMultiplier * 1.0e6) /
     933             :                                                                                ZoneOAMax;
     934             :                         }
     935             : 
     936       85010 :                         if (ZoneMaxCO2 <= ZoneMinCO2) {
     937           0 :                             ++this->CO2MaxMinLimitErrorCount;
     938           0 :                             if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCOccSch) {
     939           0 :                                 if (this->CO2MaxMinLimitErrorCount < 2) {
     940           0 :                                     ShowSevereError(state,
     941           0 :                                                     format("CalcDesignSpecificationOutdoorAir DesignSpecification:OutdoorAir = \"{}\".", this->Name));
     942           0 :                                     ShowContinueError(
     943             :                                         state,
     944           0 :                                         format("For System Outdoor Air Method = ProportionalControlBasedOnOccupancySchedule, maximum target "
     945             :                                                "CO2 concentration ({:.2R}), is not greater than minimum target CO2 concentration ({:.2R}).",
     946             :                                                ZoneMaxCO2,
     947             :                                                ZoneMinCO2));
     948           0 :                                     ShowContinueError(state,
     949             :                                                       "\"ProportionalControlBasedOnOccupancySchedule\" will not be modeled. "
     950             :                                                       "Default \"Flow/Person+Flow/Area\" will be modeled. Simulation continues...");
     951           0 :                                     ShowContinueErrorTimeStamp(state, "");
     952             :                                 } else {
     953           0 :                                     ShowRecurringWarningErrorAtEnd(
     954             :                                         state,
     955           0 :                                         format("DesignSpecification:OutdoorAir = \"{}\", For System Outdoor Air Method = "
     956             :                                                "ProportionalControlBasedOnOccupancySchedule, maximum target CO2 concentration is not greater than "
     957             :                                                "minimum target CO2 concentration. Error continues...",
     958           0 :                                                this->Name),
     959           0 :                                         this->CO2MaxMinLimitErrorIndex);
     960             :                                 }
     961             :                             }
     962           0 :                             if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCDesOcc) {
     963           0 :                                 if (this->CO2MaxMinLimitErrorCount < 2) {
     964           0 :                                     ShowSevereError(state,
     965           0 :                                                     format("CalcDesignSpecificationOutdoorAir DesignSpecification:OutdoorAir = \"{}\".", this->Name));
     966           0 :                                     ShowContinueError(
     967             :                                         state,
     968           0 :                                         format("For System Outdoor Air Method = ProportionalControlBasedOnDesignOccupancy, maximum target "
     969             :                                                "CO2 concentration ({:.2R}), is not greater than minimum target CO2 concentration ({:.2R}).",
     970             :                                                ZoneMaxCO2,
     971             :                                                ZoneMinCO2));
     972           0 :                                     ShowContinueError(state,
     973             :                                                       "\"ProportionalControlBasedOnDesignOccupancy\" will not be modeled. "
     974             :                                                       "Default \"Flow/Person+Flow/Area\" will be modeled. Simulation continues...");
     975           0 :                                     ShowContinueErrorTimeStamp(state, "");
     976             :                                 } else {
     977           0 :                                     ShowRecurringWarningErrorAtEnd(
     978             :                                         state,
     979           0 :                                         format("DesignSpecification:OutdoorAir = \"{}\", For System Outdoor Air Method = "
     980             :                                                "ProportionalControlBasedOnDesignOccupancy, maximum target CO2 concentration is not greater than "
     981             :                                                "minimum target CO2 concentration. Error continues...",
     982           0 :                                                this->Name),
     983           0 :                                         this->CO2MaxMinLimitErrorIndex);
     984             :                                 }
     985             :                             }
     986             : 
     987           0 :                             OAVolumeFlowRate = ZoneOAMax;
     988             :                         } else {
     989             : 
     990       85010 :                             if (state.dataContaminantBalance->ZoneAirCO2(ActualZoneNum) <= ZoneMinCO2) {
     991             :                                 // Zone air CO2 concentration is less than minimum zone CO2 concentration, set the Zone OA flow rate to
     992             :                                 // minimum Zone OA flow rate when the zone is unoccupied
     993          18 :                                 OAVolumeFlowRate = ZoneOAMin;
     994       84992 :                             } else if (state.dataContaminantBalance->ZoneAirCO2(ActualZoneNum) >= ZoneMaxCO2) {
     995             :                                 // Zone air CO2 concentration is greater than maximum zone CO2 concentration, set the Zone OA flow rate to
     996             :                                 // maximum Zone OA flow rate (i.e. ZoneOAArea + ZoneOAPeople)
     997       22782 :                                 OAVolumeFlowRate = ZoneOAMax;
     998             :                             } else {
     999             :                                 // Zone air CO2 concentration is between maximum and minimum limits of zone CO2 concentration,
    1000             :                                 // set Zone OA flow rate by proportionally adjusting between ZoneOAMin and ZoneOAMax
    1001       62210 :                                 OAVolumeFlowRate =
    1002       62210 :                                     ZoneOAMin + (ZoneOAMax - ZoneOAMin) * ((state.dataContaminantBalance->ZoneAirCO2(ActualZoneNum) - ZoneMinCO2) /
    1003       62210 :                                                                            (ZoneMaxCO2 - ZoneMinCO2));
    1004             :                             }
    1005             :                         }
    1006             :                     } else {
    1007       55796 :                         if (state.dataGlobal->DisplayExtraWarnings) {
    1008           0 :                             ++this->CO2GainErrorCount;
    1009           0 :                             if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCOccSch) {
    1010           0 :                                 if (this->CO2GainErrorCount < 2) {
    1011           0 :                                     ShowSevereError(state,
    1012           0 :                                                     format("CalcDesignSpecificationOutdoorAir DesignSpecification:OutdoorAir = \"{}\".", this->Name));
    1013           0 :                                     ShowContinueError(state,
    1014           0 :                                                       format("For System Outdoor Air Method = ProportionalControlBasedOnOccupancySchedule, CO2 "
    1015             :                                                              "generation from people is not greater than zero. Occurs in Zone =\"{}\". ",
    1016           0 :                                                              thisZone.Name));
    1017           0 :                                     ShowContinueError(state,
    1018             :                                                       "\"ProportionalControlBasedOnOccupancySchedule\" will not be modeled. "
    1019             :                                                       "Default \"Flow/Person+Flow/Area\" will be modeled. Simulation continues...");
    1020           0 :                                     ShowContinueErrorTimeStamp(state, "");
    1021             :                                 } else {
    1022           0 :                                     ShowRecurringWarningErrorAtEnd(state,
    1023           0 :                                                                    format("DesignSpecification:OutdoorAir = \"{}\", For System Outdoor Air Method = "
    1024             :                                                                           "ProportionalControlBasedOnOccupancySchedule, CO2 generation from people "
    1025             :                                                                           "is not greater than zero. Error continues...",
    1026           0 :                                                                           this->Name),
    1027           0 :                                                                    this->CO2GainErrorIndex);
    1028             :                                 }
    1029             :                             }
    1030           0 :                             if (this->OAFlowMethod == DataSizing::OAFlowCalcMethod::PCDesOcc) {
    1031           0 :                                 if (this->CO2GainErrorCount < 2) {
    1032           0 :                                     ShowSevereError(state,
    1033           0 :                                                     format("CalcDesignSpecificationOutdoorAir DesignSpecification:OutdoorAir = \"{}\".", this->Name));
    1034           0 :                                     ShowContinueError(state,
    1035           0 :                                                       format("For System Outdoor Air Method = ProportionalControlBasedOnDesignOccupancy, CO2 "
    1036             :                                                              "generation from people is not greater than zero. Occurs in Zone =\"{}\". ",
    1037           0 :                                                              thisZone.Name));
    1038           0 :                                     ShowContinueError(state,
    1039             :                                                       "\"ProportionalControlBasedOnDesignOccupancy\" will not be modeled. "
    1040             :                                                       "Default \"Flow/Person+Flow/Area\" will be modeled. Simulation continues...");
    1041           0 :                                     ShowContinueErrorTimeStamp(state, "");
    1042             :                                 } else {
    1043           0 :                                     ShowRecurringWarningErrorAtEnd(state,
    1044           0 :                                                                    format("DesignSpecification:OutdoorAir = \"{}\", For System Outdoor Air Method = "
    1045             :                                                                           "ProportionalControlBasedOnDesignOccupancy, CO2 generation from people is "
    1046             :                                                                           "not greater than zero. Error continues...",
    1047           0 :                                                                           this->Name),
    1048           0 :                                                                    this->CO2GainErrorIndex);
    1049             :                                 }
    1050             :                             }
    1051             :                         }
    1052       55796 :                         OAVolumeFlowRate = ZoneOAMax;
    1053             :                     }
    1054             :                 } else {
    1055             :                     // ZoneOAPeople is less than or equal to zero
    1056       27213 :                     OAVolumeFlowRate = ZoneOAMax;
    1057             :                 }
    1058             :             } else {
    1059             :                 // ZoneControl:ContaminantController is scheduled off (not available)
    1060           0 :                 OAVolumeFlowRate = ZoneOAMax;
    1061             :             }
    1062             :         } else {
    1063             :             // "Carbon Dioxide Control Availability Schedule" for ZoneControl:ContaminantController not found
    1064           0 :             OAVolumeFlowRate = ZoneOAMax;
    1065             :         }
    1066      168019 :     } break;
    1067           0 :     default: {
    1068             :         // Will never get here
    1069           0 :         OAVolumeFlowRate = 0.0;
    1070           0 :     } break;
    1071             :     }
    1072             : 
    1073             :     // Apply zone multipliers and zone list multipliers
    1074             :     // TODO MJW: this looks like it's double-counting the multipliers
    1075     6442759 :     OAVolumeFlowRate *= thisZone.Multiplier * thisZone.ListMultiplier;
    1076             : 
    1077             :     // Apply schedule as needed. Sizing does not use schedule.
    1078     6442759 :     if (this->OAFlowFracSchPtr > 0 && UseMinOASchFlag) {
    1079      492727 :         if (MaxOAVolFlowFlag) {
    1080          11 :             OAVolumeFlowRate *= ScheduleManager::GetScheduleMaxValue(state, this->OAFlowFracSchPtr);
    1081             :         } else {
    1082      492716 :             OAVolumeFlowRate *= ScheduleManager::GetCurrentScheduleValue(state, this->OAFlowFracSchPtr);
    1083             :         }
    1084             :     }
    1085             : 
    1086     6442759 :     return OAVolumeFlowRate;
    1087             : }
    1088             : 
    1089             : } // namespace EnergyPlus::DataSizing

Generated by: LCOV version 1.14