LCOV - code coverage report
Current view: top level - EnergyPlus/Autosizing - HeatingCapacitySizing.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 200 302 66.2 %
Date: 2023-01-17 19:17:23 Functions: 3 4 75.0 %

          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             : #include <EnergyPlus/Autosizing/HeatingCapacitySizing.hh>
      49             : #include <EnergyPlus/CurveManager.hh>
      50             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      51             : #include <EnergyPlus/DataEnvironment.hh>
      52             : #include <EnergyPlus/DataHVACGlobals.hh>
      53             : #include <EnergyPlus/Fans.hh>
      54             : #include <EnergyPlus/General.hh>
      55             : #include <EnergyPlus/GeneralRoutines.hh>
      56             : #include <EnergyPlus/HVACFan.hh>
      57             : #include <EnergyPlus/Psychrometrics.hh>
      58             : #include <EnergyPlus/SimAirServingZones.hh>
      59             : #include <EnergyPlus/WeatherManager.hh>
      60             : 
      61             : namespace EnergyPlus {
      62             : 
      63        3043 : Real64 HeatingCapacitySizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
      64             : {
      65        3043 :     if (!this->checkInitialized(state, errorsFound)) {
      66           0 :         return 0.0;
      67             :     }
      68        3043 :     this->preSize(state, _originalValue);
      69        6086 :     std::string DDNameFanPeak = "";
      70        6086 :     std::string dateTimeFanPeak = "";
      71        3043 :     Real64 DesVolFlow = 0.0;
      72        3043 :     Real64 CoilInTemp = -999.0;
      73        3043 :     Real64 CoilInHumRat = -999.0;
      74        3043 :     Real64 CoilOutTemp = -999.0;
      75        3043 :     Real64 CoilOutHumRat = -999.0;
      76        3043 :     Real64 FanCoolLoad = 0.0;
      77        3043 :     Real64 TotCapTempModFac = 1.0;
      78        3043 :     Real64 DXFlowPerCapMinRatio = 1.0;
      79        3043 :     Real64 DXFlowPerCapMaxRatio = 1.0;
      80        3043 :     Real64 NominalCapacityDes = 0.0;
      81        3043 :     Real64 DesMassFlow = 0.0;
      82        3043 :     Real64 DesCoilLoad = 0.0;
      83        3043 :     Real64 OutAirFrac = 0.0;
      84        3043 :     Real64 CpAirStd = Psychrometrics::PsyCpAirFnW(0.0);
      85             : 
      86        3043 :     if (this->dataEMSOverrideON) {
      87           0 :         this->autoSizedValue = this->dataEMSOverride;
      88        3043 :     } else if (this->dataConstantUsedForSizing >= 0 && this->dataFractionUsedForSizing > 0) {
      89             :         // back and forth if dataConstantUsedForSizing should be > or >= 0 to make this work for AutoCalculate
      90         126 :         this->autoSizedValue = this->dataConstantUsedForSizing * this->dataFractionUsedForSizing;
      91             :     } else {
      92        2917 :         if (this->curZoneEqNum > 0) {
      93        1419 :             if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
      94          86 :                 this->autoSizedValue = _originalValue;
      95        1333 :             } else if (this->zoneEqSizing(this->curZoneEqNum).DesignSizeFromParent) {
      96           1 :                 this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).DesHeatingLoad;
      97             :             } else {
      98        1332 :                 if (this->dataCoilIsSuppHeater && this->suppHeatCap > 0.0) {
      99          90 :                     NominalCapacityDes = this->suppHeatCap;
     100         180 :                     if (this->dataFlowUsedForSizing > 0.0) {
     101           0 :                         DesVolFlow = this->dataFlowUsedForSizing;
     102             :                     }
     103        1242 :                 } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingCapacity) {
     104         131 :                     NominalCapacityDes = this->zoneEqSizing(this->curZoneEqNum).DesHeatingLoad;
     105         131 :                     if (this->dataFlowUsedForSizing > 0.0) {
     106           3 :                         DesVolFlow = this->dataFlowUsedForSizing;
     107             :                     }
     108        1111 :                 } else if (this->dataCoolCoilCap > 0.0 && this->dataFlowUsedForSizing > 0.0) {
     109          80 :                     NominalCapacityDes = this->dataCoolCoilCap;
     110          80 :                     DesVolFlow = this->dataFlowUsedForSizing;
     111        2062 :                 } else if (int(this->finalZoneSizing.size()) > 0 &&
     112        1031 :                            this->finalZoneSizing(this->curZoneEqNum).DesHeatMassFlow >= DataHVACGlobals::SmallMassFlow) {
     113        1021 :                     if (this->dataFlowUsedForSizing > 0.0) {
     114          18 :                         DesVolFlow = this->dataFlowUsedForSizing;
     115             :                     }
     116        1021 :                     if (this->termUnitPIU && (this->curTermUnitSizingNum > 0)) {
     117           0 :                         Real64 MinPriFlowFrac = this->termUnitSizing(this->curTermUnitSizingNum).MinFlowFrac;
     118           0 :                         if (this->termUnitSizing(this->curTermUnitSizingNum).InducesPlenumAir) {
     119           0 :                             CoilInTemp = (this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).DesHeatCoilInTempTU * MinPriFlowFrac) +
     120           0 :                                          (this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).ZoneRetTempAtHeatPeak * (1.0 - MinPriFlowFrac));
     121             :                         } else {
     122           0 :                             CoilInTemp = (this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).DesHeatCoilInTempTU * MinPriFlowFrac) +
     123           0 :                                          (this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).ZoneTempAtHeatPeak * (1.0 - MinPriFlowFrac));
     124           0 :                         }
     125        1021 :                     } else if (this->termUnitIU && (this->curTermUnitSizingNum > 0)) {
     126           0 :                         CoilInTemp = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).ZoneTempAtHeatPeak;
     127           0 :                         CoilInHumRat = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).ZoneHumRatAtHeatPeak;
     128        1021 :                     } else if (this->termUnitSingDuct && (this->curTermUnitSizingNum > 0)) {
     129         317 :                         CoilInTemp = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).DesHeatCoilInTempTU;
     130         317 :                         CoilInHumRat = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).DesHeatCoilInHumRatTU;
     131             :                     } else {
     132             :                         // all other components calculate coil inlet condition based on actual, not design, OA fraction (e.g., FanCoil)
     133         704 :                         if (DesVolFlow > 0.0) {
     134          18 :                             DesMassFlow = DesVolFlow * state.dataEnvrn->StdRhoAir;
     135             :                         } else {
     136         686 :                             DesMassFlow = this->finalZoneSizing(this->curZoneEqNum).DesHeatMassFlow;
     137             :                         }
     138        2112 :                         CoilInTemp = this->setHeatCoilInletTempForZoneEqSizing(
     139         704 :                             this->setOAFracForZoneEqSizing(state, DesMassFlow, zoneEqSizing(this->curZoneEqNum)),
     140         704 :                             zoneEqSizing(this->curZoneEqNum),
     141         704 :                             finalZoneSizing(this->curZoneEqNum));
     142        2112 :                         CoilInHumRat = this->setHeatCoilInletHumRatForZoneEqSizing(
     143         704 :                             this->setOAFracForZoneEqSizing(state, DesMassFlow, zoneEqSizing(this->curZoneEqNum)),
     144         704 :                             zoneEqSizing(this->curZoneEqNum),
     145         704 :                             finalZoneSizing(this->curZoneEqNum));
     146             :                     }
     147        1021 :                     if ((this->termUnitSingDuct || this->termUnitPIU) && (this->curTermUnitSizingNum > 0)) {
     148         317 :                         CoilOutTemp = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).HeatDesTemp;
     149         317 :                         CoilOutHumRat = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).HeatDesHumRat;
     150         317 :                         Real64 CpAir = Psychrometrics::PsyCpAirFnW(CoilOutHumRat);
     151         634 :                         DesCoilLoad = CpAir * state.dataEnvrn->StdRhoAir * this->termUnitSizing(this->curTermUnitSizingNum).AirVolFlow *
     152         317 :                                       (CoilOutTemp - CoilInTemp);
     153         317 :                         DesVolFlow = this->termUnitSizing(this->curTermUnitSizingNum).AirVolFlow;
     154         704 :                     } else if (this->termUnitIU && (this->curTermUnitSizingNum > 0)) {
     155           0 :                         if (this->termUnitSizing(this->curTermUnitSizingNum).InducRat > 0.01) {
     156           0 :                             DesVolFlow = this->termUnitSizing(this->curTermUnitSizingNum).AirVolFlow /
     157           0 :                                          this->termUnitSizing(this->curTermUnitSizingNum).InducRat;
     158           0 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).HeatDesHumRat);
     159             :                             // the design heating coil load is the zone load minus whatever the central system does.Note that
     160             :                             // DesHeatCoilInTempTU is really the primary air inlet temperature for the unit.
     161           0 :                             DesCoilLoad = this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).DesHeatLoad -
     162           0 :                                           (CpAir * state.dataEnvrn->StdRhoAir * DesVolFlow *
     163           0 :                                            (this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).DesHeatCoilInTempTU -
     164           0 :                                             this->termUnitFinalZoneSizing(this->curTermUnitSizingNum).ZoneTempAtHeatPeak));
     165             :                         } else {
     166           0 :                             DesCoilLoad = 0.0;
     167           0 :                         }
     168             :                     } else {
     169         704 :                         CoilOutTemp = this->finalZoneSizing(this->curZoneEqNum).HeatDesTemp;
     170         704 :                         CoilOutHumRat = this->finalZoneSizing(this->curZoneEqNum).HeatDesHumRat;
     171         704 :                         Real64 CpAir = Psychrometrics::PsyCpAirFnW(CoilOutHumRat);
     172         704 :                         DesCoilLoad = CpAir * this->finalZoneSizing(this->curZoneEqNum).DesHeatMassFlow * (CoilOutTemp - CoilInTemp);
     173         704 :                         DesVolFlow = this->finalZoneSizing(this->curZoneEqNum).DesHeatMassFlow / state.dataEnvrn->StdRhoAir;
     174             :                     }
     175        1021 :                     NominalCapacityDes = max(0.0, DesCoilLoad);
     176             :                 } else {
     177          10 :                     NominalCapacityDes = 0.0;
     178          10 :                     CoilOutTemp = -999.0;
     179             :                 }
     180        1332 :                 if (this->dataCoolCoilCap > 0.0) {
     181          80 :                     this->autoSizedValue = NominalCapacityDes * this->dataHeatSizeRatio;
     182             :                 } else {
     183        1252 :                     this->autoSizedValue = NominalCapacityDes * this->dataHeatSizeRatio * this->dataFracOfAutosizedHeatingCapacity;
     184             :                 }
     185        1332 :                 if (state.dataGlobal->DisplayExtraWarnings && this->autoSizedValue <= 0.0) {
     186           0 :                     ShowWarningMessage(state,
     187           0 :                                        this->callingRoutine + ": Potential issue with equipment sizing for " + this->compType + ' ' + this->compName);
     188           0 :                     ShowContinueError(state, format("...Rated Total Heating Capacity = {:.2T} [W]", this->autoSizedValue));
     189           0 :                     if (this->zoneEqSizing(this->curZoneEqNum).HeatingCapacity ||
     190           0 :                         (this->dataCoolCoilCap > 0.0 && this->dataFlowUsedForSizing > 0.0)) {
     191           0 :                         ShowContinueError(state,
     192           0 :                                           format("...Capacity passed by parent object to size child component = {:.2T} [W]", NominalCapacityDes));
     193             :                     } else {
     194           0 :                         if (CoilOutTemp > -999.0) {
     195           0 :                             ShowContinueError(state, format("...Air flow rate used for sizing = {:.5T} [m3/s]", DesVolFlow));
     196           0 :                             ShowContinueError(state, format("...Coil inlet air temperature used for sizing = {:.2T} [C]", CoilInTemp));
     197           0 :                             ShowContinueError(state, format("...Coil outlet air temperature used for sizing = {:.2T} [C]", CoilOutTemp));
     198             :                         } else {
     199           0 :                             ShowContinueError(state, "...Capacity used to size child component set to 0 [W]");
     200             :                         }
     201             :                     }
     202             :                 }
     203             :             }
     204        1498 :         } else if (this->curSysNum > 0) {
     205        1498 :             if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
     206         248 :                 this->autoSizedValue = _originalValue;
     207             :             } else {
     208        1250 :                 if (this->curOASysNum > 0) {
     209          29 :                     if (this->oaSysEqSizing(this->curOASysNum).AirFlow) {
     210           0 :                         DesVolFlow = this->oaSysEqSizing(this->curOASysNum).AirVolFlow;
     211          29 :                     } else if (this->oaSysEqSizing(this->curOASysNum).HeatingAirFlow) {
     212           1 :                         DesVolFlow = this->oaSysEqSizing(this->curOASysNum).HeatingAirVolFlow;
     213          28 :                     } else if (this->outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) {
     214           1 :                         DesVolFlow =
     215           1 :                             this->airloopDOAS[this->outsideAirSys(this->curOASysNum).AirLoopDOASNum].SizingMassFlow / state.dataEnvrn->StdRhoAir;
     216             :                     } else {
     217          27 :                         DesVolFlow = this->finalSysSizing(this->curSysNum).DesOutAirVolFlow;
     218             :                     }
     219             :                 } else {
     220        1221 :                     if (this->finalSysSizing(this->curSysNum).HeatingCapMethod == DataSizing::FractionOfAutosizedHeatingCapacity) {
     221           1 :                         this->dataFracOfAutosizedHeatingCapacity = this->finalSysSizing(this->curSysNum).FractionOfAutosizedHeatingCapacity;
     222             :                     }
     223        1221 :                     if (this->dataFlowUsedForSizing > 0.0) {
     224         477 :                         DesVolFlow = this->dataFlowUsedForSizing;
     225         744 :                     } else if (this->unitarySysEqSizing(this->curSysNum).AirFlow) {
     226         100 :                         DesVolFlow = this->unitarySysEqSizing(this->curSysNum).AirVolFlow;
     227         644 :                     } else if (this->unitarySysEqSizing(this->curSysNum).HeatingAirFlow) {
     228         138 :                         DesVolFlow = this->unitarySysEqSizing(this->curSysNum).HeatingAirVolFlow;
     229             :                     } else {
     230         506 :                         if (this->curDuctType == DataHVACGlobals::AirDuctType::Main) {
     231         506 :                             if (this->finalSysSizing(this->curSysNum).SysAirMinFlowRat > 0.0 && !this->dataDesicRegCoil) {
     232         502 :                                 DesVolFlow =
     233         502 :                                     this->finalSysSizing(this->curSysNum).SysAirMinFlowRat * this->finalSysSizing(this->curSysNum).DesMainVolFlow;
     234             :                             } else {
     235           4 :                                 DesVolFlow = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
     236             :                             }
     237           0 :                         } else if (this->curDuctType == DataHVACGlobals::AirDuctType::Cooling) {
     238           0 :                             if (this->finalSysSizing(this->curSysNum).SysAirMinFlowRat > 0.0 && !this->dataDesicRegCoil) {
     239           0 :                                 DesVolFlow =
     240           0 :                                     this->finalSysSizing(this->curSysNum).SysAirMinFlowRat * this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
     241             :                             } else {
     242           0 :                                 DesVolFlow = this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
     243             :                             }
     244           0 :                         } else if (this->curDuctType == DataHVACGlobals::AirDuctType::Heating) {
     245           0 :                             DesVolFlow = this->finalSysSizing(this->curSysNum).DesHeatVolFlow;
     246             :                         } else {
     247           0 :                             DesVolFlow = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
     248             :                         }
     249             :                     }
     250             :                 }
     251        1250 :                 DesMassFlow = state.dataEnvrn->StdRhoAir * DesVolFlow;
     252             :                 // get the outside air fraction
     253        1250 :                 if (this->curOASysNum > 0) {
     254          29 :                     OutAirFrac = 1.0;
     255        1221 :                 } else if (this->finalSysSizing(this->curSysNum).HeatOAOption == DataSizing::MinOA) {
     256        1194 :                     if (DesVolFlow > 0.0) {
     257        1194 :                         OutAirFrac = this->finalSysSizing(this->curSysNum).DesOutAirVolFlow / DesVolFlow;
     258             :                     } else {
     259           0 :                         OutAirFrac = 1.0;
     260             :                     }
     261        1194 :                     OutAirFrac = std::min(1.0, std::max(0.0, OutAirFrac));
     262             :                 } else {
     263          27 :                     OutAirFrac = 1.0;
     264             :                 }
     265             :                 // coil inlet temperature
     266        1250 :                 if (this->curOASysNum == 0 && this->primaryAirSystem(this->curSysNum).NumOAHeatCoils > 0) {
     267          52 :                     CoilInTemp = OutAirFrac * this->finalSysSizing(this->curSysNum).PreheatTemp +
     268          26 :                                  (1.0 - OutAirFrac) * this->finalSysSizing(this->curSysNum).HeatRetTemp;
     269          52 :                     CoilInHumRat = OutAirFrac * this->finalSysSizing(this->curSysNum).PreheatHumRat +
     270          26 :                                    (1.0 - OutAirFrac) * this->finalSysSizing(this->curSysNum).HeatRetHumRat; // include humrat for coil sizing reports
     271        1224 :                 } else if (this->curOASysNum > 0 && this->outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) {
     272           1 :                     CoilInTemp = this->airloopDOAS[this->outsideAirSys(this->curOASysNum).AirLoopDOASNum].HeatOutTemp;
     273             :                 } else {
     274        2446 :                     CoilInTemp = OutAirFrac * this->finalSysSizing(this->curSysNum).HeatOutTemp +
     275        1223 :                                  (1.0 - OutAirFrac) * this->finalSysSizing(this->curSysNum).HeatRetTemp;
     276        2446 :                     CoilInHumRat = OutAirFrac * this->finalSysSizing(this->curSysNum).HeatOutHumRat +
     277        1223 :                                    (1.0 - OutAirFrac) * this->finalSysSizing(this->curSysNum).HeatRetHumRat; // include humrat for coil sizing reports
     278             :                 }
     279             :                 // coil load
     280        1250 :                 if (this->curOASysNum > 0) {
     281          29 :                     if (this->oaSysEqSizing(this->curOASysNum).HeatingCapacity) {
     282           0 :                         DesCoilLoad = this->oaSysEqSizing(this->curOASysNum).DesHeatingLoad;
     283          29 :                     } else if (this->dataDesicRegCoil) {
     284           0 :                         DesCoilLoad = CpAirStd * DesMassFlow * (this->dataDesOutletAirTemp - this->dataDesInletAirTemp);
     285           0 :                         CoilOutTemp = this->dataDesOutletAirTemp;
     286          29 :                     } else if (this->outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) {
     287           2 :                         DesCoilLoad = CpAirStd * DesMassFlow *
     288           1 :                                       (this->airloopDOAS[this->outsideAirSys(this->curOASysNum).AirLoopDOASNum].PreheatTemp - CoilInTemp);
     289           1 :                         CoilOutTemp = this->airloopDOAS[outsideAirSys(this->curOASysNum).AirLoopDOASNum].PreheatTemp;
     290             :                     } else {
     291          28 :                         DesCoilLoad = CpAirStd * DesMassFlow * (this->finalSysSizing(this->curSysNum).PreheatTemp - CoilInTemp);
     292          28 :                         CoilOutTemp = this->finalSysSizing(this->curSysNum).PreheatTemp;
     293          28 :                         CoilOutHumRat = this->finalSysSizing(this->curSysNum).PreheatHumRat;
     294             :                     }
     295             :                 } else {
     296        1221 :                     if (this->unitarySysEqSizing(this->curSysNum).HeatingCapacity) {
     297         266 :                         DesCoilLoad = this->unitarySysEqSizing(this->curSysNum).DesHeatingLoad;
     298         266 :                         CoilOutTemp = this->finalSysSizing(this->curSysNum).HeatSupTemp;
     299         266 :                         CoilOutHumRat = this->finalSysSizing(this->curSysNum).HeatSupHumRat;
     300         955 :                     } else if (this->dataDesicRegCoil) {
     301           0 :                         DesCoilLoad = CpAirStd * DesMassFlow * (this->dataDesOutletAirTemp - this->dataDesInletAirTemp);
     302           0 :                         CoilOutTemp = this->dataDesOutletAirTemp;
     303             :                     } else {
     304         955 :                         DesCoilLoad = CpAirStd * DesMassFlow * (this->finalSysSizing(this->curSysNum).HeatSupTemp - CoilInTemp);
     305         955 :                         CoilOutTemp = this->finalSysSizing(this->curSysNum).HeatSupTemp;
     306         955 :                         CoilOutHumRat = this->finalSysSizing(this->curSysNum).HeatSupHumRat;
     307             :                     }
     308             :                 }
     309        1250 :                 if (this->curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys && this->airLoopControlInfo(this->curSysNum).UnitarySys) {
     310         649 :                     if (this->dataCoilIsSuppHeater) {
     311         173 :                         NominalCapacityDes = this->suppHeatCap;
     312         476 :                     } else if (this->dataCoolCoilCap > 0.0) {
     313          28 :                         NominalCapacityDes = this->dataCoolCoilCap;
     314             :                     } else {
     315             :                         // TRUE for all air loop parent equipment except UnitarySystem where flag is reset to FALSE after simulating
     316             :                         // This method allows downstream heating coils to size individually.Probably should do this for all air loop equipment
     317             :                         // ChangoverBypass model always sets AirLoopControlInfo%UnitarySys to FALSE so heating coil can individually size
     318        1165 :                         if (this->airLoopControlInfo(this->curSysNum).UnitarySysSimulating &&
     319         717 :                             !UtilityRoutines::SameString(this->compType, "COIL:HEATING:WATER")) {
     320         263 :                             NominalCapacityDes = this->unitaryHeatCap;
     321             :                         } else {
     322         185 :                             if (DesCoilLoad >= DataHVACGlobals::SmallLoad) {
     323         185 :                                 NominalCapacityDes = DesCoilLoad;
     324             :                             } else {
     325           0 :                                 NominalCapacityDes = 0.0;
     326             :                             }
     327             :                         }
     328             :                     }
     329         649 :                     DesCoilLoad = NominalCapacityDes;
     330        1201 :                 } else if (this->curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys &&
     331         600 :                            this->finalSysSizing(this->curSysNum).HeatingCapMethod == DataSizing::CapacityPerFloorArea) {
     332           0 :                     NominalCapacityDes = this->finalSysSizing(this->curSysNum).HeatingTotalCapacity;
     333        1802 :                 } else if (this->curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys &&
     334        1200 :                            this->finalSysSizing(this->curSysNum).HeatingCapMethod == DataSizing::HeatingDesignCapacity &&
     335         599 :                            this->finalSysSizing(this->curSysNum).HeatingTotalCapacity > 0.0) {
     336           0 :                     NominalCapacityDes = this->finalSysSizing(this->curSysNum).HeatingTotalCapacity;
     337             :                 } else {
     338         601 :                     if (this->dataCoolCoilCap > 0.0) { // this line can't get executed with same logic above else
     339           4 :                         NominalCapacityDes = this->dataCoolCoilCap;
     340         597 :                     } else if (DesCoilLoad >= DataHVACGlobals::SmallLoad) {
     341         564 :                         NominalCapacityDes = DesCoilLoad;
     342             :                     } else {
     343          33 :                         NominalCapacityDes = 0.0;
     344             :                     }
     345             :                 }
     346        1250 :                 this->autoSizedValue = NominalCapacityDes * this->dataHeatSizeRatio * this->dataFracOfAutosizedHeatingCapacity;
     347        1250 :                 if (state.dataGlobal->DisplayExtraWarnings && this->autoSizedValue <= 0.0) {
     348           0 :                     ShowWarningMessage(state,
     349           0 :                                        this->callingRoutine + ": Potential issue with equipment sizing for " + this->compType + ' ' + this->compName);
     350           0 :                     ShowContinueError(state, format("...Rated Total Heating Capacity = {:.2T} [W]", this->autoSizedValue));
     351           0 :                     if (CoilOutTemp > -999.0) {
     352           0 :                         ShowContinueError(state, format("...Air flow rate used for sizing = {:.5T} [m3/s]", DesVolFlow));
     353           0 :                         ShowContinueError(state, format("...Outdoor air fraction used for sizing = {:.2T}", OutAirFrac));
     354           0 :                         ShowContinueError(state, format("...Coil inlet air temperature used for sizing = {:.2T} [C]", CoilInTemp));
     355           0 :                         ShowContinueError(state, format("...Coil outlet air temperature used for sizing = {:.2T} [C]", CoilOutTemp));
     356             :                     } else {
     357           0 :                         ShowContinueError(state, format("...Capacity passed by parent object to size child component = {:.2T} [W]", DesCoilLoad));
     358             :                     }
     359             :                 }
     360             :             }
     361           0 :         } else if (this->dataNonZoneNonAirloopValue > 0) {
     362           0 :             this->autoSizedValue = this->dataNonZoneNonAirloopValue;
     363           0 :         } else if (!this->wasAutoSized) {
     364           0 :             this->autoSizedValue = this->originalValue;
     365             :         } else {
     366           0 :             std::string msg = this->callingRoutine + ' ' + this->compType + ' ' + this->compName + ", Developer Error: Component sizing incomplete.";
     367           0 :             ShowSevereError(state, msg);
     368           0 :             this->addErrorMessage(msg);
     369           0 :             msg = format("SizingString = {}, SizingResult = {:.1T}", this->sizingString, this->autoSizedValue);
     370           0 :             ShowContinueError(state, msg);
     371           0 :             this->addErrorMessage(msg);
     372           0 :             errorsFound = true;
     373             :         }
     374             :     }
     375        3043 :     if (!this->hardSizeNoDesignRun || this->dataScalableSizingON || this->dataScalableCapSizingON) {
     376        2809 :         if (this->wasAutoSized && this->dataFractionUsedForSizing == 0.0) {
     377             :             // Note: the VolFlowPerRatedTotCap check is not applicable for VRF-FluidTCtrl coil model, which implements variable flow fans and
     378             :             // determines capacity using physical calculations instead of emperical curves
     379        2386 :             bool FlagCheckVolFlowPerRatedTotCap = true;
     380        7158 :             if (UtilityRoutines::SameString(this->compType, "Coil:Cooling:DX:VariableRefrigerantFlow:FluidTemperatureControl") ||
     381        4772 :                 UtilityRoutines::SameString(this->compType, "Coil:Heating:DX:VariableRefrigerantFlow:FluidTemperatureControl"))
     382          15 :                 FlagCheckVolFlowPerRatedTotCap = false;
     383             : 
     384        2386 :             if (this->dataIsDXCoil && FlagCheckVolFlowPerRatedTotCap) {
     385         126 :                 Real64 RatedVolFlowPerRatedTotCap = 0.0;
     386         126 :                 if (this->autoSizedValue > 0.0) {
     387         126 :                     RatedVolFlowPerRatedTotCap = DesVolFlow / this->autoSizedValue;
     388             :                 }
     389         126 :                 if (RatedVolFlowPerRatedTotCap < state.dataHVACGlobal->MinRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT)) {
     390          28 :                     if (!this->dataEMSOverride && state.dataGlobal->DisplayExtraWarnings && this->printWarningFlag) {
     391           0 :                         ShowWarningError(state, this->callingRoutine + ' ' + this->compType + ' ' + this->compName);
     392           0 :                         ShowContinueError(
     393           0 :                             state, "..." + this->sizingString + " will be limited by the minimum rated volume flow per rated total capacity ratio.");
     394           0 :                         ShowContinueError(state, format("...DX coil volume flow rate (m3/s ) = {:.6T}", DesVolFlow));
     395           0 :                         ShowContinueError(state, format("...Requested capacity (W ) = {:.3T}", this->autoSizedValue));
     396           0 :                         ShowContinueError(state, format("...Requested flow/capacity ratio (m3/s/W ) = {:.3T}", RatedVolFlowPerRatedTotCap));
     397           0 :                         ShowContinueError(state,
     398           0 :                                           format("...Minimum flow/capacity ratio (m3/s/W ) = {:.3T}",
     399           0 :                                                  state.dataHVACGlobal->MinRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT)));
     400             :                     }
     401             : 
     402          56 :                     DXFlowPerCapMinRatio = (DesVolFlow / state.dataHVACGlobal->MinRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT)) /
     403          28 :                                            this->autoSizedValue; // set DX Coil Capacity Increase Ratio from Too Low Flow/Capacity Ratio
     404          28 :                     this->autoSizedValue = DesVolFlow / state.dataHVACGlobal->MinRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT);
     405             : 
     406          28 :                     if (!this->dataEMSOverride && state.dataGlobal->DisplayExtraWarnings && this->printWarningFlag) {
     407           0 :                         ShowContinueError(state, format("...Adjusted capacity ( W ) = {:.3T}", this->autoSizedValue));
     408             :                     }
     409          98 :                 } else if (RatedVolFlowPerRatedTotCap > state.dataHVACGlobal->MaxRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT)) {
     410           0 :                     if (!this->dataEMSOverride && state.dataGlobal->DisplayExtraWarnings && this->printWarningFlag) {
     411           0 :                         ShowWarningError(state, this->callingRoutine + ' ' + this->compType + ' ' + this->compName);
     412           0 :                         ShowContinueError(
     413           0 :                             state, "..." + this->sizingString + " will be limited by the maximum rated volume flow per rated total capacity ratio.");
     414           0 :                         ShowContinueError(state, format("...DX coil volume flow rate ( m3/s ) = {:.6T}", DesVolFlow));
     415           0 :                         ShowContinueError(state, format("...Requested capacity ( W ) = {:.3T}", this->autoSizedValue));
     416           0 :                         ShowContinueError(state, format("...Requested flow/capacity ratio ( m3/s/W ) = {:.3T}", RatedVolFlowPerRatedTotCap));
     417           0 :                         ShowContinueError(state,
     418           0 :                                           format("...Maximum flow/capacity ratio ( m3/s/W ) = {:.3T}",
     419           0 :                                                  state.dataHVACGlobal->MaxRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT)));
     420             :                     }
     421             : 
     422           0 :                     DXFlowPerCapMaxRatio = DesVolFlow / state.dataHVACGlobal->MaxRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT) /
     423           0 :                                            this->autoSizedValue; // set DX Coil Capacity Decrease Ratio from Too High Flow/Capacity Ratio
     424           0 :                     this->autoSizedValue = DesVolFlow / state.dataHVACGlobal->MaxRatedVolFlowPerRatedTotCap(state.dataHVACGlobal->DXCT);
     425             : 
     426           0 :                     if (!this->dataEMSOverride && state.dataGlobal->DisplayExtraWarnings && this->printWarningFlag) {
     427           0 :                         ShowContinueError(state, format("...Adjusted capacity ( W ) = {:.3T}", this->autoSizedValue));
     428             :                     }
     429             :                 }
     430             :             }
     431             :         }
     432             :     }
     433             : 
     434             :     // override sizing string
     435        3043 :     if (this->overrideSizeString) {
     436           9 :         if (this->isEpJSON) this->sizingString = "nominal_capacity [W]";
     437             :     }
     438        3043 :     if (this->dataScalableCapSizingON) {
     439           9 :         switch (this->zoneEqSizing(this->curZoneEqNum).SizingMethod(DataHVACGlobals::HeatingCapacitySizing)) {
     440           5 :         case DataSizing::CapacityPerFloorArea: {
     441           5 :             this->sizingStringScalable = "(scaled by capacity / area) ";
     442           5 :         } break;
     443           4 :         case DataSizing::FractionOfAutosizedHeatingCapacity:
     444             :         case DataSizing::FractionOfAutosizedCoolingCapacity: {
     445           4 :             this->sizingStringScalable = "(scaled by fractional multiplier) ";
     446           4 :         } break;
     447           0 :         default:
     448           0 :             break;
     449             :         }
     450             :     }
     451             : 
     452        3043 :     this->selectSizerOutput(state, errorsFound);
     453             : 
     454        3043 :     if (this->isCoilReportObject && this->curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys) {
     455        2008 :         if (CoilInTemp > -999.0) { // set inlet air properties used during capacity sizing if available, allow for negative winter temps
     456        1531 :             state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp(
     457             :                 state, this->compName, this->compType, CoilInTemp, this->curSysNum, this->curZoneEqNum);
     458        1531 :             state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, CoilInHumRat);
     459             :         }
     460        2008 :         if (CoilOutTemp > -999.0) { // set outlet air properties used during capacity sizing if available
     461        1531 :             state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, CoilOutTemp);
     462        1531 :             state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, this->compName, this->compType, CoilOutHumRat);
     463             :         }
     464        4016 :         state.dataRptCoilSelection->coilSelectionReportObj->setCoilHeatingCapacity(state,
     465             :                                                                                    this->compName,
     466             :                                                                                    this->compType,
     467             :                                                                                    this->autoSizedValue,
     468        2008 :                                                                                    this->wasAutoSized,
     469             :                                                                                    this->curSysNum,
     470             :                                                                                    this->curZoneEqNum,
     471             :                                                                                    this->curOASysNum,
     472             :                                                                                    FanCoolLoad,
     473             :                                                                                    TotCapTempModFac,
     474             :                                                                                    DXFlowPerCapMinRatio,
     475             :                                                                                    DXFlowPerCapMaxRatio);
     476             :     }
     477        3043 :     return this->autoSizedValue;
     478             : }
     479             : 
     480           0 : void HeatingCapacitySizer::clearState()
     481             : {
     482           0 :     BaseSizerWithScalableInputs::clearState();
     483           0 : }
     484             : 
     485        2313 : } // namespace EnergyPlus

Generated by: LCOV version 1.13