LCOV - code coverage report
Current view: top level - EnergyPlus - ReportCoilSelection.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 89.1 % 1283 1143
Test Date: 2025-07-17 05:04:31 Functions: 97.6 % 41 40

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // C++ Headers
      49              : #include <memory>
      50              : #include <string>
      51              : 
      52              : // EnergyPlus Headers
      53              : #include <EnergyPlus/AirLoopHVACDOAS.hh>
      54              : #include <EnergyPlus/BoilerSteam.hh>
      55              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      56              : #include <EnergyPlus/DataAirLoop.hh>
      57              : #include <EnergyPlus/DataAirSystems.hh>
      58              : #include <EnergyPlus/DataEnvironment.hh>
      59              : #include <EnergyPlus/DataHVACGlobals.hh>
      60              : #include <EnergyPlus/DataHeatBalance.hh>
      61              : #include <EnergyPlus/DataSizing.hh>
      62              : #include <EnergyPlus/DataZoneEquipment.hh>
      63              : #include <EnergyPlus/Fans.hh>
      64              : #include <EnergyPlus/FluidProperties.hh>
      65              : #include <EnergyPlus/MixedAir.hh>
      66              : #include <EnergyPlus/OutputReportPredefined.hh>
      67              : #include <EnergyPlus/Plant/DataPlant.hh>
      68              : #include <EnergyPlus/PlantUtilities.hh>
      69              : #include <EnergyPlus/Psychrometrics.hh>
      70              : #include <EnergyPlus/ReportCoilSelection.hh>
      71              : #include <EnergyPlus/UtilityRoutines.hh>
      72              : #include <EnergyPlus/WeatherManager.hh>
      73              : 
      74              : namespace EnergyPlus {
      75              : 
      76          803 : void createCoilSelectionReportObj(EnergyPlusData &state)
      77              : {
      78          803 :     state.dataRptCoilSelection->coilSelectionReportObj = std::make_unique<ReportCoilSelection>();
      79          803 : }
      80              : 
      81         6483 : CoilSelectionData::CoilSelectionData( // constructor
      82         6483 :     std::string const &coilName)
      83        19449 :     : isCooling(false), isHeating(false), coilNum(-999), airloopNum(-999), oaControllerNum(-999), zoneEqNum(-999), oASysNum(-999), zoneHVACTypeNum(0),
      84        25932 :       zoneHVACIndex(0), typeof_Coil(-999), coilSizingMethodCapacity(-999), coilSizingMethodAirFlow(-999), isCoilSizingForTotalLoad(false),
      85        32415 :       capIsAutosized(false), volFlowIsAutosized(false), coilWaterFlowUser(-999.0), oaPretreated(false), isSupplementalHeater(false),
      86         6483 :       coilTotCapFinal(-999.0), coilSensCapFinal(-999.0), coilRefAirVolFlowFinal(-999.0), coilRefWaterVolFlowFinal(-999.0), coilTotCapAtPeak(-999.0),
      87         6483 :       coilSensCapAtPeak(-999.0), coilDesMassFlow(-999.0), coilDesVolFlow(-999.0), coilDesEntTemp(-999.0), coilDesEntWetBulb(-999.0),
      88         6483 :       coilDesEntHumRat(-999.0), coilDesEntEnth(-999.0), coilDesLvgTemp(-999.0), coilDesLvgWetBulb(-999.0), coilDesLvgHumRat(-999.0),
      89         6483 :       coilDesLvgEnth(-999.0), coilDesWaterMassFlow(-999.0), coilDesWaterEntTemp(-999.0), coilDesWaterLvgTemp(-999.0), coilDesWaterTempDiff(-999.0),
      90        12966 :       pltSizNum(-999), waterLoopNum(-999), oaPeakTemp(-999.00), oaPeakHumRat(-999.0), oaPeakWetBulb(-999.0), oaPeakVolFlow(-999.0),
      91         6483 :       oaPeakVolFrac(-999.0), oaDoaTemp(-999.0), oaDoaHumRat(-999.0), raPeakTemp(-999.0), raPeakHumRat(-999.0), rmPeakTemp(-999.0),
      92         6483 :       rmPeakHumRat(-999.0), rmPeakRelHum(-999.0), rmSensibleAtPeak(-999.0), rmLatentAtPeak(0.0), coilIdealSizCapOverSimPeakCap(-999.0),
      93         6483 :       coilIdealSizCapUnderSimPeakCap(-999.0), reheatLoadMult(-999.0), minRatio(-999.0), maxRatio(-999.0), cpMoistAir(-999.0), cpDryAir(-999.0),
      94         6483 :       rhoStandAir(-999.0), rhoFluid(-999.0), cpFluid(-999.0), coilCapFTIdealPeak(1.0), coilRatedTotCap(-999.0), coilRatedSensCap(-999.0),
      95         6483 :       ratedAirMassFlow(-999.0), ratedCoilInDb(-999.0), ratedCoilInWb(-999.0), ratedCoilInHumRat(-999.0), ratedCoilInEnth(-999.0),
      96         6483 :       ratedCoilOutDb(-999.0), ratedCoilOutWb(-999.0), ratedCoilOutHumRat(-999.0), ratedCoilOutEnth(-999.0), ratedCoilEff(-999.0),
      97         6483 :       ratedCoilBpFactor(-999.0), ratedCoilAppDewPt(-999.0), ratedCoilOadbRef(-999.0), ratedCoilOawbRef(-999.0),
      98              : 
      99         6483 :       supFanType(HVAC::FanType::Invalid), supFanNum(0), fanSizeMaxAirVolumeFlow(-999.0), fanSizeMaxAirMassFlow(-999.0), fanHeatGainIdealPeak(-999.0),
     100         6483 :       coilAndFanNetTotalCapacityIdealPeak(-999.0), plantDesMaxMassFlowRate(-999.0), plantDesRetTemp(-999.0), plantDesSupTemp(-999.0),
     101         6483 :       plantDesDeltaTemp(-999.0), plantDesCapacity(-999.0), coilCapPrcntPlantCap(-999.0), coilFlowPrcntPlantFlow(-999.0), coilUA(-999.0)
     102              : {
     103         6483 :     coilName_ = coilName;
     104         6483 :     coilLocation = "unknown";
     105         6483 :     desDayNameAtSensPeak = "unknown";
     106         6483 :     coilSensePeakHrMin = "unknown";
     107         6483 :     desDayNameAtTotalPeak = "unknown";
     108         6483 :     coilTotalPeakHrMin = "unknown";
     109         6483 :     desDayNameAtAirFlowPeak = "unknown";
     110         6483 :     airPeakHrMin = "unknown";
     111         6483 :     typeHVACname = "unknown";
     112         6483 :     userNameforHVACsystem = "unknown";
     113         6483 :     coilSizingMethodConcurrenceName = "N/A";
     114         6483 :     coilSizingMethodCapacityName = "N/A";
     115         6483 :     coilSizingMethodAirFlowName = "N/A";
     116         6483 :     coilPeakLoadTypeToSizeOnName = "N/A";
     117         6483 :     coilCapAutoMsg = "unknown";
     118         6483 :     coilVolFlowAutoMsg = "unknown";
     119         6483 :     coilWaterFlowAutoMsg = "unknown";
     120         6483 :     coilOAPretreatMsg = "unknown";
     121         6483 :     plantLoopName = "unknown";
     122         6483 :     fanAssociatedWithCoilName = "unknown";
     123         6483 :     fanTypeName = "unknown";
     124         6483 : }
     125              : 
     126          741 : void ReportCoilSelection::finishCoilSummaryReportTable(EnergyPlusData &state)
     127              : {
     128          741 :     doFinalProcessingOfCoilData(state);
     129          741 :     writeCoilSelectionOutput(state);
     130          741 :     writeCoilSelectionOutput2(state);
     131          741 : }
     132              : 
     133          741 : void ReportCoilSelection::writeCoilSelectionOutput(EnergyPlusData &state)
     134              : {
     135              : 
     136              :     // make calls to fill out predefined tabular report entries for each coil selection report object
     137         6986 :     for (auto &c : coilSelectionDataObjs) {
     138              : 
     139         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilType, c->coilName_, c->coilObjName);
     140         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilLocation, c->coilName_, c->coilLocation);
     141         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACType, c->coilName_, c->typeHVACname);
     142         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACName, c->coilName_, c->userNameforHVACsystem);
     143              : 
     144              :         // begin std 229 existing heating coil table adding new variables
     145         6245 :         if (c->isHeating) {
     146        13191 :             OutputReportPredefined::PreDefTableEntry(
     147        13191 :                 state, state.dataOutRptPredefined->pdchHeatCoilUsedAsSupHeat, c->coilName_, c->isSupplementalHeater ? "Yes" : "No");
     148        13191 :             OutputReportPredefined::PreDefTableEntry(state,
     149         4397 :                                                      state.dataOutRptPredefined->pdchHeatCoilAirloopName,
     150         4397 :                                                      c->coilName_,
     151         1358 :                                                      c->airloopNum > 0 && c->airloopNum <= state.dataHVACGlobal->NumPrimaryAirSys
     152        13191 :                                                          ? state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).Name
     153              :                                                          : "N/A");
     154        13191 :             OutputReportPredefined::PreDefTableEntry(state,
     155         4397 :                                                      state.dataOutRptPredefined->pdchHeatCoilPlantloopName,
     156         4397 :                                                      c->coilName_,
     157        12788 :                                                      c->waterLoopNum > 0 ? state.dataPlnt->PlantLoop(c->waterLoopNum).Name : "N/A");
     158              :         }
     159              :         // end std 229 existing heating coil table adding new variables
     160              : 
     161              :         // begin std 229 New coil connections table entries
     162         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilName_CCs, c->coilName_, c->coilName_);
     163         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilType_CCs, c->coilName_, c->coilObjName);
     164         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilLoc_CCs, c->coilName_, c->coilLocation);
     165         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACType_CCs, c->coilName_, c->typeHVACname);
     166         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilHVACName_CCs, c->coilName_, c->userNameforHVACsystem);
     167              :         // end of std 229 New coil connections table entries
     168              : 
     169         6245 :         if (c->zoneName.size() == 1) {
     170         4987 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilZoneName, c->coilName_, c->zoneName[0]);
     171              :             // begin std 229 New coil connections table entries
     172         4987 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilZoneNames_CCs, c->coilName_, c->zoneName[0]);
     173              :             // end of std 229 New coil connections table entries
     174         1258 :         } else if (c->zoneName.size() > 1) {
     175              :             // make list of zone names
     176         1025 :             std::string tmpZoneList;
     177         8092 :             for (std::size_t vecLoop = 0; vecLoop < c->zoneName.size(); ++vecLoop) {
     178         7067 :                 tmpZoneList += c->zoneName[vecLoop] + "; ";
     179              :             }
     180         1025 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilZoneName, c->coilName_, tmpZoneList);
     181              :             // begin std 229 New coil connections table entries
     182         1025 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilZoneNames_CCs, c->coilName_, tmpZoneList);
     183              :             // end of std 229 New coil connections table entries
     184         1025 :         } else {
     185          233 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilZoneName, c->coilName_, "N/A");
     186              :             // begin std 229 New coil connections table entries
     187          233 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilZoneNames_CCs, c->coilName_, "N/A");
     188              :             // end of std 229 New coil connections table entries
     189              :         }
     190              : 
     191        18735 :         OutputReportPredefined::PreDefTableEntry(
     192        18735 :             state, state.dataOutRptPredefined->pdchSysSizingMethCoinc, c->coilName_, c->coilSizingMethodConcurrenceName);
     193        18735 :         OutputReportPredefined::PreDefTableEntry(
     194        18735 :             state, state.dataOutRptPredefined->pdchSysSizingMethCap, c->coilName_, c->coilSizingMethodCapacityName);
     195        18735 :         OutputReportPredefined::PreDefTableEntry(
     196        18735 :             state, state.dataOutRptPredefined->pdchSysSizingMethAir, c->coilName_, c->coilSizingMethodAirFlowName);
     197         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilIsCapAutosized, c->coilName_, c->coilCapAutoMsg);
     198         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilIsAirFlowAutosized, c->coilName_, c->coilVolFlowAutoMsg);
     199        18735 :         OutputReportPredefined::PreDefTableEntry(
     200        18735 :             state, state.dataOutRptPredefined->pdchCoilIsWaterFlowAutosized, c->coilName_, c->coilWaterFlowAutoMsg);
     201         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilIsOATreated, c->coilName_, c->coilOAPretreatMsg);
     202         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilFinalTotalCap, c->coilName_, c->coilTotCapFinal, 3);
     203         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilFinalSensCap, c->coilName_, c->coilSensCapFinal, 3);
     204         6245 :         if (c->coilRefAirVolFlowFinal == -999.0 || c->coilRefAirVolFlowFinal == -99999.0) {
     205         3460 :             OutputReportPredefined::PreDefTableEntry(
     206         5190 :                 state, state.dataOutRptPredefined->pdchCoilFinalAirVolFlowRate, c->coilName_, c->coilRefAirVolFlowFinal, 1);
     207              :         } else {
     208         9030 :             OutputReportPredefined::PreDefTableEntry(
     209        13545 :                 state, state.dataOutRptPredefined->pdchCoilFinalAirVolFlowRate, c->coilName_, c->coilRefAirVolFlowFinal, 6);
     210              :         }
     211              : 
     212         6245 :         if (c->coilRefWaterVolFlowFinal == -999.0 || c->coilRefWaterVolFlowFinal == -99999.0) {
     213         5798 :             OutputReportPredefined::PreDefTableEntry(
     214         8697 :                 state, state.dataOutRptPredefined->pdchCoilFinalPlantVolFlowRate, c->coilName_, c->coilRefWaterVolFlowFinal, 1);
     215              :         } else {
     216         6692 :             OutputReportPredefined::PreDefTableEntry(
     217        10038 :                 state, state.dataOutRptPredefined->pdchCoilFinalPlantVolFlowRate, c->coilName_, c->coilRefWaterVolFlowFinal, 8);
     218              :         }
     219              : 
     220        18735 :         OutputReportPredefined::PreDefTableEntry(
     221        18735 :             state, state.dataOutRptPredefined->pdchFanAssociatedWithCoilName, c->coilName_, c->fanAssociatedWithCoilName);
     222              :         // begin std 229 New coil connections table entries
     223        18735 :         OutputReportPredefined::PreDefTableEntry(
     224        18735 :             state, state.dataOutRptPredefined->pdchCoilSupFanName_CCs, c->coilName_, c->fanAssociatedWithCoilName);
     225              :         // end of std 229 New coil connections table entries
     226              : 
     227         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFanAssociatedWithCoilType, c->coilName_, c->fanTypeName);
     228              :         // begin std 229 New coil connections table entries
     229         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilSupFanType_CCs, c->coilName_, c->fanTypeName);
     230              :         // end of std 229 New coil connections table entries
     231              : 
     232         6245 :         if (c->fanSizeMaxAirVolumeFlow == -999.0 || c->fanSizeMaxAirVolumeFlow == -99999.0) {
     233         5148 :             OutputReportPredefined::PreDefTableEntry(
     234         7722 :                 state, state.dataOutRptPredefined->pdchFanAssociatedVdotSize, c->coilName_, c->fanSizeMaxAirVolumeFlow, 1);
     235              :         } else {
     236         7342 :             OutputReportPredefined::PreDefTableEntry(
     237        11013 :                 state, state.dataOutRptPredefined->pdchFanAssociatedVdotSize, c->coilName_, c->fanSizeMaxAirVolumeFlow, 6);
     238              :         }
     239         6245 :         if (c->fanSizeMaxAirMassFlow == -999.0 || c->fanSizeMaxAirMassFlow == -99999.0) {
     240         5148 :             OutputReportPredefined::PreDefTableEntry(
     241         7722 :                 state, state.dataOutRptPredefined->pdchFanAssociatedMdotSize, c->coilName_, c->fanSizeMaxAirMassFlow, 1);
     242              :         } else {
     243         7342 :             OutputReportPredefined::PreDefTableEntry(
     244        11013 :                 state, state.dataOutRptPredefined->pdchFanAssociatedMdotSize, c->coilName_, c->fanSizeMaxAirMassFlow, 8);
     245              :         }
     246              : 
     247              :         // begin std 229 New coil connections table entries
     248         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilPlantName_CCs, c->coilName_, c->plantLoopName);
     249        18735 :         OutputReportPredefined::PreDefTableEntry(state,
     250         6245 :                                                  state.dataOutRptPredefined->pdchCoilAirloopName_CCs,
     251         6245 :                                                  c->coilName_,
     252         2577 :                                                  c->airloopNum > 0 && c->airloopNum <= state.dataHVACGlobal->NumPrimaryAirSys
     253        18735 :                                                      ? state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).Name
     254              :                                                      : "N/A");
     255         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilPlantloopName_CCs, c->coilName_, c->plantLoopName);
     256              :         // end of std 229 New coil connections table entries
     257              : 
     258        18735 :         OutputReportPredefined::PreDefTableEntry(
     259        18735 :             state, state.dataOutRptPredefined->pdchCoilDDnameSensIdealPeak, c->coilName_, c->desDayNameAtSensPeak);
     260        18735 :         OutputReportPredefined::PreDefTableEntry(
     261        18735 :             state, state.dataOutRptPredefined->pdchCoilDateTimeSensIdealPeak, c->coilName_, c->coilSensePeakHrMin);
     262        18735 :         OutputReportPredefined::PreDefTableEntry(
     263        18735 :             state, state.dataOutRptPredefined->pdchCoilDDnameTotIdealPeak, c->coilName_, c->desDayNameAtTotalPeak);
     264        18735 :         OutputReportPredefined::PreDefTableEntry(
     265        18735 :             state, state.dataOutRptPredefined->pdchCoilDateTimeTotIdealPeak, c->coilName_, c->coilTotalPeakHrMin);
     266        18735 :         OutputReportPredefined::PreDefTableEntry(
     267        18735 :             state, state.dataOutRptPredefined->pdchCoilDDnameAirFlowIdealPeak, c->coilName_, c->desDayNameAtAirFlowPeak);
     268         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilDateTimeAirFlowIdealPeak, c->coilName_, c->airPeakHrMin);
     269              : 
     270        18735 :         OutputReportPredefined::PreDefTableEntry(
     271        18735 :             state, state.dataOutRptPredefined->pdchCoilPeakLoadTypeToSizeOn, c->coilName_, c->coilPeakLoadTypeToSizeOnName);
     272              : 
     273         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilTotalCapIdealPeak, c->coilName_, c->coilTotCapAtPeak, 2);
     274         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilSensCapIdealPeak, c->coilName_, c->coilSensCapAtPeak, 2);
     275         6245 :         if (c->coilDesMassFlow == -999.0 || c->coilDesMassFlow == -99999.0) {
     276          770 :             OutputReportPredefined::PreDefTableEntry(
     277         1155 :                 state, state.dataOutRptPredefined->pdchCoilAirMassFlowIdealPeak, c->coilName_, c->coilDesMassFlow, 1);
     278              :         } else {
     279        11720 :             OutputReportPredefined::PreDefTableEntry(
     280        17580 :                 state, state.dataOutRptPredefined->pdchCoilAirMassFlowIdealPeak, c->coilName_, c->coilDesMassFlow, 8);
     281              :         }
     282         6245 :         if (c->coilDesVolFlow == -999.0 || c->coilDesVolFlow == -99999.0) {
     283         1036 :             OutputReportPredefined::PreDefTableEntry(
     284         1554 :                 state, state.dataOutRptPredefined->pdchCoilAirVolumeFlowIdealPeak, c->coilName_, c->coilDesVolFlow, 1);
     285              :         } else {
     286        11454 :             OutputReportPredefined::PreDefTableEntry(
     287        17181 :                 state, state.dataOutRptPredefined->pdchCoilAirVolumeFlowIdealPeak, c->coilName_, c->coilDesVolFlow, 6);
     288              :         }
     289         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilEntDryBulbIdealPeak, c->coilName_, c->coilDesEntTemp, 2);
     290        12490 :         OutputReportPredefined::PreDefTableEntry(
     291        12490 :             state, state.dataOutRptPredefined->pdchCoilEntWetBulbIdealPeak, c->coilName_, c->coilDesEntWetBulb, 2);
     292         6245 :         if (c->coilDesEntHumRat == -999.0 || c->coilDesEntHumRat == -99999.0) {
     293         1962 :             OutputReportPredefined::PreDefTableEntry(
     294         2943 :                 state, state.dataOutRptPredefined->pdchCoilEntHumRatIdealPeak, c->coilName_, c->coilDesEntHumRat, 1);
     295              :         } else {
     296        10528 :             OutputReportPredefined::PreDefTableEntry(
     297        15792 :                 state, state.dataOutRptPredefined->pdchCoilEntHumRatIdealPeak, c->coilName_, c->coilDesEntHumRat, 8);
     298              :         }
     299         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilEntEnthalpyIdealPeak, c->coilName_, c->coilDesEntEnth, 1);
     300         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilLvgDryBulbIdealPeak, c->coilName_, c->coilDesLvgTemp, 2);
     301        12490 :         OutputReportPredefined::PreDefTableEntry(
     302        12490 :             state, state.dataOutRptPredefined->pdchCoilLvgWetBulbIdealPeak, c->coilName_, c->coilDesLvgWetBulb, 2);
     303         6245 :         if (c->coilDesLvgHumRat == -999.0 || c->coilDesLvgHumRat == -99999.0) {
     304         1958 :             OutputReportPredefined::PreDefTableEntry(
     305         2937 :                 state, state.dataOutRptPredefined->pdchCoilLvgHumRatIdealPeak, c->coilName_, c->coilDesLvgHumRat, 1);
     306              :         } else {
     307        10532 :             OutputReportPredefined::PreDefTableEntry(
     308        15798 :                 state, state.dataOutRptPredefined->pdchCoilLvgHumRatIdealPeak, c->coilName_, c->coilDesLvgHumRat, 8);
     309              :         }
     310         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilLvgEnthalpyIdealPeak, c->coilName_, c->coilDesLvgEnth, 1);
     311         6245 :         if (c->coilDesWaterMassFlow == -999.0 || c->coilDesWaterMassFlow == -99999.0) {
     312         7396 :             OutputReportPredefined::PreDefTableEntry(
     313        11094 :                 state, state.dataOutRptPredefined->pdchCoilWaterMassFlowIdealPeak, c->coilName_, c->coilDesWaterMassFlow, 1);
     314              :         } else {
     315         5094 :             OutputReportPredefined::PreDefTableEntry(
     316         7641 :                 state, state.dataOutRptPredefined->pdchCoilWaterMassFlowIdealPeak, c->coilName_, c->coilDesWaterMassFlow, 8);
     317              :         }
     318              : 
     319        12490 :         OutputReportPredefined::PreDefTableEntry(
     320        12490 :             state, state.dataOutRptPredefined->pdchCoilEntWaterTempIdealPeak, c->coilName_, c->coilDesWaterEntTemp, 2);
     321        12490 :         OutputReportPredefined::PreDefTableEntry(
     322        12490 :             state, state.dataOutRptPredefined->pdchCoilLvgWaterTempIdealPeak, c->coilName_, c->coilDesWaterLvgTemp, 2);
     323        12490 :         OutputReportPredefined::PreDefTableEntry(
     324        12490 :             state, state.dataOutRptPredefined->pdchCoilWaterDeltaTempIdealPeak, c->coilName_, c->coilDesWaterTempDiff, 2);
     325        12490 :         OutputReportPredefined::PreDefTableEntry(
     326        12490 :             state, state.dataOutRptPredefined->pdchFanHeatGainIdealPeak, c->coilName_, c->fanHeatGainIdealPeak, 3);
     327        12490 :         OutputReportPredefined::PreDefTableEntry(
     328        12490 :             state, state.dataOutRptPredefined->pdchCoilNetTotalCapacityIdealPeak, c->coilName_, c->coilAndFanNetTotalCapacityIdealPeak, 2);
     329              : 
     330         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedTotalCap, c->coilName_, c->coilRatedTotCap, 2);
     331         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedSensCap, c->coilName_, c->coilRatedSensCap, 2);
     332        12490 :         OutputReportPredefined::PreDefTableEntry(
     333        12490 :             state, state.dataOutRptPredefined->pdchCoilOffRatingCapacityModifierIdealPeak, c->coilName_, c->coilCapFTIdealPeak, 4);
     334         6245 :         if (c->ratedAirMassFlow == -999.0 || c->ratedAirMassFlow == -99999.0) {
     335         2351 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedAirMass, c->coilName_, c->ratedAirMassFlow, 1);
     336              :         } else {
     337         3894 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedAirMass, c->coilName_, c->ratedAirMassFlow, 8);
     338              :         }
     339              : 
     340         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedEntDryBulb, c->coilName_, c->ratedCoilInDb, 2);
     341         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedEntWetBulb, c->coilName_, c->ratedCoilInWb, 2);
     342         6245 :         if (c->ratedCoilInHumRat == -999.0 || c->ratedCoilInHumRat == -99999.0) {
     343         4702 :             OutputReportPredefined::PreDefTableEntry(
     344         7053 :                 state, state.dataOutRptPredefined->pdchCoilRatedEntHumRat, c->coilName_, c->ratedCoilInHumRat, 1);
     345              :         } else {
     346         7788 :             OutputReportPredefined::PreDefTableEntry(
     347        11682 :                 state, state.dataOutRptPredefined->pdchCoilRatedEntHumRat, c->coilName_, c->ratedCoilInHumRat, 8);
     348              :         }
     349              : 
     350         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedEntEnthalpy, c->coilName_, c->ratedCoilInEnth, 1);
     351         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedLvgDryBulb, c->coilName_, c->ratedCoilOutDb, 2);
     352         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedLvgWetBulb, c->coilName_, c->ratedCoilOutWb, 2);
     353         6245 :         if (c->ratedCoilOutHumRat == -999.0 || c->ratedCoilOutHumRat == -99999.0) {
     354         4702 :             OutputReportPredefined::PreDefTableEntry(
     355         7053 :                 state, state.dataOutRptPredefined->pdchCoilRatedLvgHumRat, c->coilName_, c->ratedCoilOutHumRat, 1);
     356              :         } else {
     357         7788 :             OutputReportPredefined::PreDefTableEntry(
     358        11682 :                 state, state.dataOutRptPredefined->pdchCoilRatedLvgHumRat, c->coilName_, c->ratedCoilOutHumRat, 8);
     359              :         }
     360              : 
     361         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilRatedLvgEnthalpy, c->coilName_, c->ratedCoilOutEnth, 1);
     362              : 
     363         6245 :         if (c->plantDesMaxMassFlowRate == -999.0 || c->plantDesMaxMassFlowRate == -99999.0) {
     364         7342 :             OutputReportPredefined::PreDefTableEntry(
     365        11013 :                 state, state.dataOutRptPredefined->pdchPlantMassFlowMaximum, c->coilName_, c->plantDesMaxMassFlowRate, 1);
     366              :         } else {
     367         5148 :             OutputReportPredefined::PreDefTableEntry(
     368         7722 :                 state, state.dataOutRptPredefined->pdchPlantMassFlowMaximum, c->coilName_, c->plantDesMaxMassFlowRate, 8);
     369              :         }
     370         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchPlantRetTempDesign, c->coilName_, c->plantDesRetTemp, 2);
     371         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchPlantSupTempDesign, c->coilName_, c->plantDesSupTemp, 2);
     372         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchPlantDeltaTempDesign, c->coilName_, c->plantDesDeltaTemp, 2);
     373         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchPlantCapacity, c->coilName_, c->plantDesCapacity, 2);
     374        12490 :         OutputReportPredefined::PreDefTableEntry(
     375        12490 :             state, state.dataOutRptPredefined->pdchCoilCapPrcntPlantCapacity, c->coilName_, c->coilCapPrcntPlantCap, 4);
     376         6245 :         if (c->coilFlowPrcntPlantFlow == -999.0 || c->coilFlowPrcntPlantFlow == -99999.0) {
     377         7462 :             OutputReportPredefined::PreDefTableEntry(
     378        11193 :                 state, state.dataOutRptPredefined->pdchCoilFlowPrcntPlantFlow, c->coilName_, c->coilFlowPrcntPlantFlow, 1);
     379              :         } else {
     380         5028 :             OutputReportPredefined::PreDefTableEntry(
     381         7542 :                 state, state.dataOutRptPredefined->pdchCoilFlowPrcntPlantFlow, c->coilName_, c->coilFlowPrcntPlantFlow, 6);
     382              :         }
     383              : 
     384         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOADryBulbIdealPeak, c->coilName_, c->oaPeakTemp, 2);
     385         6245 :         if (c->oaPeakHumRat == -999.0 || c->oaPeakHumRat == -99999.0) {
     386         1232 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOAHumRatIdealPeak, c->coilName_, c->oaPeakHumRat, 1);
     387              :         } else {
     388         5013 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOAHumRatIdealPeak, c->coilName_, c->oaPeakHumRat, 8);
     389              :         }
     390              : 
     391         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOAWetBulbatIdealPeak, c->coilName_, c->oaPeakWetBulb, 2);
     392         6245 :         if (c->oaPeakVolFlow == -999.0 || c->oaPeakVolFlow == -99999.0) {
     393         1232 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOAVolFlowIdealPeak, c->coilName_, c->oaPeakVolFlow, 1);
     394              :         } else {
     395         5013 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOAVolFlowIdealPeak, c->coilName_, c->oaPeakVolFlow, 8);
     396              :         }
     397              : 
     398         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchOAFlowPrcntIdealPeak, c->coilName_, c->oaPeakVolFrac, 4);
     399         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchAirSysRADryBulbIdealPeak, c->coilName_, c->raPeakTemp, 2);
     400         6245 :         if (c->raPeakHumRat == -999.0 || c->raPeakHumRat == -99999.0) {
     401         2464 :             OutputReportPredefined::PreDefTableEntry(
     402         3696 :                 state, state.dataOutRptPredefined->pdchAirSysRAHumRatIdealPeak, c->coilName_, c->raPeakHumRat, 1);
     403              :         } else {
     404        10026 :             OutputReportPredefined::PreDefTableEntry(
     405        15039 :                 state, state.dataOutRptPredefined->pdchAirSysRAHumRatIdealPeak, c->coilName_, c->raPeakHumRat, 8);
     406              :         }
     407              : 
     408         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchZoneAirDryBulbIdealPeak, c->coilName_, c->rmPeakTemp, 2);
     409         6245 :         if (c->rmPeakHumRat == -999.0 || c->rmPeakHumRat == -99999.0) {
     410         1235 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchZoneAirHumRatIdealPeak, c->coilName_, c->rmPeakHumRat, 1);
     411              :         } else {
     412         5010 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchZoneAirHumRatIdealPeak, c->coilName_, c->rmPeakHumRat, 8);
     413              :         }
     414              : 
     415         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchZoneAirRelHumIdealPeak, c->coilName_, c->rmPeakRelHum, 4);
     416         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoilUA, c->coilName_, c->coilUA, 3);
     417        12490 :         OutputReportPredefined::PreDefTableEntry(
     418        12490 :             state, state.dataOutRptPredefined->pdchZoneSensibleLoadIdealPeak, c->coilName_, c->rmSensibleAtPeak, 2);
     419         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchZoneLatentLoadIdealPeak, c->coilName_, c->rmLatentAtPeak);
     420         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchReheatCoilMultiplier, c->coilName_, c->reheatLoadMult, 4);
     421        12490 :         OutputReportPredefined::PreDefTableEntry(
     422        12490 :             state, state.dataOutRptPredefined->pdchFlowCapRatioLowCapIncreaseRatio, c->coilName_, c->maxRatio, 5);
     423         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFlowCapRatioHiCapDecreaseRatio, c->coilName_, c->minRatio, 5);
     424         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchPlantFluidSpecificHeat, c->coilName_, c->cpFluid, 4);
     425         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchPlantFluidDensity, c->coilName_, c->rhoFluid, 4);
     426         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchMoistAirSpecificHeat, c->coilName_, c->cpMoistAir, 4);
     427         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchDryAirSpecificHeat, c->coilName_, c->cpDryAir, 4);
     428         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchStandRhoAir, c->coilName_, c->rhoStandAir, 4);
     429          741 :     }
     430          741 : }
     431              : 
     432          741 : void ReportCoilSelection::writeCoilSelectionOutput2(EnergyPlusData &state)
     433              : {
     434              : 
     435              :     // make calls to fill out predefined tabular report entries for each coil selection report object
     436         6986 :     for (auto &c : coilSelectionDataObjs) {
     437         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilType, c->coilName_, c->coilObjName);
     438         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilHVACType, c->coilName_, c->typeHVACname);
     439         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilHVACName, c->coilName_, c->userNameforHVACsystem);
     440              : 
     441         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilFinalTotalCap, c->coilName_, c->coilTotCapFinal, 3);
     442         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilFinalSensCap, c->coilName_, c->coilSensCapFinal, 3);
     443         6245 :         if (c->coilRefAirVolFlowFinal == -999.0 || c->coilRefAirVolFlowFinal == -99999.0) {
     444         3460 :             OutputReportPredefined::PreDefTableEntry(
     445         5190 :                 state, state.dataOutRptPredefined->pdch2CoilFinalAirVolFlowRate, c->coilName_, c->coilRefAirVolFlowFinal, 1);
     446              :         } else {
     447         9030 :             OutputReportPredefined::PreDefTableEntry(
     448        13545 :                 state, state.dataOutRptPredefined->pdch2CoilFinalAirVolFlowRate, c->coilName_, c->coilRefAirVolFlowFinal, 6);
     449              :         }
     450              : 
     451         6245 :         if (c->coilRefWaterVolFlowFinal == -999.0 || c->coilRefWaterVolFlowFinal == -99999.0) {
     452         5798 :             OutputReportPredefined::PreDefTableEntry(
     453         8697 :                 state, state.dataOutRptPredefined->pdch2CoilFinalPlantVolFlowRate, c->coilName_, c->coilRefWaterVolFlowFinal, 1);
     454              :         } else {
     455         6692 :             OutputReportPredefined::PreDefTableEntry(
     456        10038 :                 state, state.dataOutRptPredefined->pdch2CoilFinalPlantVolFlowRate, c->coilName_, c->coilRefWaterVolFlowFinal, 8);
     457              :         }
     458              : 
     459        18735 :         OutputReportPredefined::PreDefTableEntry(
     460        18735 :             state, state.dataOutRptPredefined->pdch2CoilDDnameSensIdealPeak, c->coilName_, c->desDayNameAtSensPeak);
     461        18735 :         OutputReportPredefined::PreDefTableEntry(
     462        18735 :             state, state.dataOutRptPredefined->pdch2CoilDateTimeSensIdealPeak, c->coilName_, c->coilSensePeakHrMin);
     463        18735 :         OutputReportPredefined::PreDefTableEntry(
     464        18735 :             state, state.dataOutRptPredefined->pdch2CoilDDnameAirFlowIdealPeak, c->coilName_, c->desDayNameAtAirFlowPeak);
     465         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilDateTimeAirFlowIdealPeak, c->coilName_, c->airPeakHrMin);
     466         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilTotalCapIdealPeak, c->coilName_, c->coilTotCapAtPeak, 2);
     467         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilSensCapIdealPeak, c->coilName_, c->coilSensCapAtPeak, 2);
     468         6245 :         if (c->coilDesVolFlow == -999.0 || c->coilDesVolFlow == -99999.0) {
     469         1036 :             OutputReportPredefined::PreDefTableEntry(
     470         1554 :                 state, state.dataOutRptPredefined->pdch2CoilAirVolumeFlowIdealPeak, c->coilName_, c->coilDesVolFlow, 1);
     471              :         } else {
     472        11454 :             OutputReportPredefined::PreDefTableEntry(
     473        17181 :                 state, state.dataOutRptPredefined->pdch2CoilAirVolumeFlowIdealPeak, c->coilName_, c->coilDesVolFlow, 6);
     474              :         }
     475         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilEntDryBulbIdealPeak, c->coilName_, c->coilDesEntTemp, 2);
     476        12490 :         OutputReportPredefined::PreDefTableEntry(
     477        12490 :             state, state.dataOutRptPredefined->pdch2CoilEntWetBulbIdealPeak, c->coilName_, c->coilDesEntWetBulb, 2);
     478         6245 :         if (c->coilDesEntHumRat == -999.0 || c->coilDesEntHumRat == -99999.0) {
     479         1962 :             OutputReportPredefined::PreDefTableEntry(
     480         2943 :                 state, state.dataOutRptPredefined->pdch2CoilEntHumRatIdealPeak, c->coilName_, c->coilDesEntHumRat, 1);
     481              :         } else {
     482        10528 :             OutputReportPredefined::PreDefTableEntry(
     483        15792 :                 state, state.dataOutRptPredefined->pdch2CoilEntHumRatIdealPeak, c->coilName_, c->coilDesEntHumRat, 8);
     484              :         }
     485         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilLvgDryBulbIdealPeak, c->coilName_, c->coilDesLvgTemp, 2);
     486        12490 :         OutputReportPredefined::PreDefTableEntry(
     487        12490 :             state, state.dataOutRptPredefined->pdch2CoilLvgWetBulbIdealPeak, c->coilName_, c->coilDesLvgWetBulb, 2);
     488         6245 :         if (c->coilDesLvgHumRat == -999.0 || c->coilDesLvgHumRat == -99999.0) {
     489         1958 :             OutputReportPredefined::PreDefTableEntry(
     490         2937 :                 state, state.dataOutRptPredefined->pdch2CoilLvgHumRatIdealPeak, c->coilName_, c->coilDesLvgHumRat, 1);
     491              :         } else {
     492        10532 :             OutputReportPredefined::PreDefTableEntry(
     493        15798 :                 state, state.dataOutRptPredefined->pdch2CoilLvgHumRatIdealPeak, c->coilName_, c->coilDesLvgHumRat, 8);
     494              :         }
     495              : 
     496         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilRatedTotalCap, c->coilName_, c->coilRatedTotCap, 2);
     497         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilRatedSensCap, c->coilName_, c->coilRatedSensCap, 2);
     498              : 
     499         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2OADryBulbIdealPeak, c->coilName_, c->oaPeakTemp, 2);
     500         6245 :         if (c->oaPeakHumRat == -999.0 || c->oaPeakHumRat == -99999.0) {
     501         1232 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2OAHumRatIdealPeak, c->coilName_, c->oaPeakHumRat, 1);
     502              :         } else {
     503         5013 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2OAHumRatIdealPeak, c->coilName_, c->oaPeakHumRat, 8);
     504              :         }
     505              : 
     506         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2OAWetBulbatIdealPeak, c->coilName_, c->oaPeakWetBulb, 2);
     507         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2OAFlowPrcntIdealPeak, c->coilName_, c->oaPeakVolFrac, 4);
     508              : 
     509         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2ZoneAirDryBulbIdealPeak, c->coilName_, c->rmPeakTemp, 2);
     510         6245 :         if (c->rmPeakHumRat == -999.0 || c->rmPeakHumRat == -99999.0) {
     511         2470 :             OutputReportPredefined::PreDefTableEntry(
     512         3705 :                 state, state.dataOutRptPredefined->pdch2ZoneAirHumRatIdealPeak, c->coilName_, c->rmPeakHumRat, 1);
     513              :         } else {
     514        10020 :             OutputReportPredefined::PreDefTableEntry(
     515        15030 :                 state, state.dataOutRptPredefined->pdch2ZoneAirHumRatIdealPeak, c->coilName_, c->rmPeakHumRat, 8);
     516              :         }
     517              : 
     518         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2ZoneAirRelHumIdealPeak, c->coilName_, c->rmPeakRelHum, 4);
     519         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2CoilUA, c->coilName_, c->coilUA, 3);
     520        12490 :         OutputReportPredefined::PreDefTableEntry(
     521        12490 :             state, state.dataOutRptPredefined->pdch2ZoneSensibleLoadIdealPeak, c->coilName_, c->rmSensibleAtPeak, 2);
     522         6245 :         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdch2ZoneLatentLoadIdealPeak, c->coilName_, c->rmLatentAtPeak);
     523          741 :     }
     524          741 : }
     525              : 
     526         6223 : void ReportCoilSelection::setCoilFinalSizes(EnergyPlusData &state,
     527              :                                             std::string const &coilName,    // user-defined name of the coil
     528              :                                             std::string const &coilObjName, //  coil object name, e.g., Coil:Cooling:Water
     529              :                                             Real64 const totGrossCap,       // total capacity [W]
     530              :                                             Real64 const sensGrossCap,      // sensible capacity [W]
     531              :                                             Real64 const airFlowRate,       // design or reference or rated air flow rate [m3/s]
     532              :                                             Real64 const waterFlowRate      // design or reference or rated water flow rate [m3/s]
     533              : )
     534              : {
     535         6223 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilObjName);
     536         6223 :     auto &c(coilSelectionDataObjs[index]);
     537         6223 :     if (c != nullptr) {
     538         6223 :         c->coilTotCapFinal = totGrossCap;
     539         6223 :         c->coilSensCapFinal = sensGrossCap;
     540         6223 :         c->coilRefAirVolFlowFinal = airFlowRate;
     541         6223 :         c->coilRefWaterVolFlowFinal = waterFlowRate;
     542              :     }
     543         6223 : }
     544              : 
     545        15261 : void ReportCoilSelection::doAirLoopSetup(EnergyPlusData &state, int const coilVecIndex)
     546              : {
     547              :     // this routine sets up some things for central air systems, needs to follow setting of an airloop num
     548        15261 :     auto &c(coilSelectionDataObjs[coilVecIndex]);
     549        15261 :     if (c->airloopNum > 0 && c->airloopNum <= int(state.dataAirSystemsData->PrimaryAirSystems.size())) {
     550              :         // see if there is an OA controller
     551         7134 :         if (state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).OASysExists) {
     552              :             // loop over OA controllers and match node num ?
     553        90195 :             for (int loop = 1; loop <= state.dataMixedAir->NumOAControllers; ++loop) {
     554        83350 :                 if (state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).OASysInletNodeNum == state.dataMixedAir->OAController(loop).RetNode) {
     555         6805 :                     c->oaControllerNum = loop;
     556              :                 }
     557              :             }
     558              :         }
     559              :         // fill list of zones connected to this air loop
     560              :         // this could be reworked to use different structure which is available now since std 62.1 changes
     561         7134 :         if (allocated(state.dataAirLoop->AirToZoneNodeInfo)) {
     562         7134 :             if (state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).NumZonesCooled > 0) {
     563         7134 :                 int zoneCount = state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).NumZonesCooled;
     564         7134 :                 c->zoneNum.resize(zoneCount);
     565         7134 :                 c->zoneName.resize(zoneCount);
     566        40997 :                 for (int loopZone = 1; loopZone <= state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).NumZonesCooled; ++loopZone) {
     567        33863 :                     c->zoneNum[loopZone - 1] = state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).CoolCtrlZoneNums(loopZone);
     568        33863 :                     c->zoneName[loopZone - 1] = state.dataHeatBal->Zone(c->zoneNum[loopZone - 1]).Name;
     569              :                 }
     570              :             }
     571              : 
     572         7134 :             if (state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).NumZonesHeated > 0) {
     573           36 :                 int zoneCount = state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).NumZonesHeated;
     574          209 :                 for (int loopZone = 1; loopZone <= zoneCount; ++loopZone) {
     575          173 :                     int zoneIndex = state.dataAirLoop->AirToZoneNodeInfo(c->airloopNum).HeatCtrlZoneNums(loopZone);
     576              :                     // see if this zone is new or already in list
     577          173 :                     bool found = false;
     578          531 :                     for (auto const &z : c->zoneNum) {
     579          531 :                         if (z == zoneIndex) {
     580          173 :                             found = true;
     581          173 :                             break;
     582              :                         }
     583          173 :                     }
     584          173 :                     if (!found) { // add it
     585            0 :                         c->zoneNum.emplace_back(zoneIndex);
     586            0 :                         c->zoneName.emplace_back(state.dataHeatBal->Zone(zoneIndex).Name);
     587              :                     }
     588              :                 }
     589              :             }
     590              :         }
     591              :     }
     592        15261 : }
     593              : 
     594            0 : void ReportCoilSelection::doZoneEqSetup(EnergyPlusData &state, int const coilVecIndex)
     595              : {
     596            0 :     auto &c(coilSelectionDataObjs[coilVecIndex]);
     597            0 :     c->coilLocation = "Zone";
     598            0 :     c->zoneNum.resize(1);
     599            0 :     c->zoneNum[0] = c->zoneEqNum;
     600            0 :     c->zoneName.resize(1);
     601            0 :     c->zoneName[0] = state.dataHeatBal->Zone(c->zoneNum[0]).Name;
     602            0 :     c->typeHVACname = "Zone Equipment"; // init
     603              : 
     604              :     // find the system and get   c->oaControllerNum
     605              : 
     606              :     // need to rework for new multiple air handler in zone
     607              : 
     608              :     // going to need the zone inlet node index for this now... how to find it??
     609              : 
     610              :     // maybe not needed, would be set in other calls   c->airloopNum = DataZoneEquipment::ZoneEquipConfig( c->zoneEqNum  ).AirLoopNum;
     611              : 
     612            0 :     if (c->airloopNum > 0) {
     613            0 :         if (state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).OASysExists) {
     614              :             // loop over OA controllers and match node num ?
     615            0 :             for (int loop = 1; loop <= state.dataMixedAir->NumOAControllers; ++loop) {
     616            0 :                 if (state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).OASysInletNodeNum == state.dataMixedAir->OAController(loop).RetNode) {
     617            0 :                     c->oaControllerNum = loop;
     618              :                 }
     619              :             }
     620              :         }
     621              :         // fill out supply fan info
     622            0 :         auto *fan = state.dataFans->fans(state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).supFanNum);
     623            0 :         state.dataRptCoilSelection->coilSelectionReportObj->setCoilSupplyFanInfo(
     624            0 :             state, c->coilName_, c->coilObjName, fan->Name, fan->type, state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).supFanNum);
     625              :     }
     626              : 
     627            0 :     if (c->zoneEqNum > 0) {
     628            0 :         associateZoneCoilWithParent(state, c);
     629              :     }
     630            0 : }
     631              : 
     632          741 : void ReportCoilSelection::doFinalProcessingOfCoilData(EnergyPlusData &state)
     633              : {
     634              :     // this routine does some final processing in preparation for writing out results
     635         6986 :     for (auto &c : coilSelectionDataObjs) {
     636              : 
     637              :         // mine final/hard values from coil models
     638              : 
     639         6245 :         if (c->zoneEqNum > 0) {
     640         3544 :             associateZoneCoilWithParent(state, c);
     641              :         }
     642              : 
     643         6245 :         if (c->airloopNum > state.dataHVACGlobal->NumPrimaryAirSys && c->oASysNum > 0) {
     644            2 :             c->coilLocation = "DOAS AirLoop";
     645            2 :             c->typeHVACname = "AirLoopHVAC:DedicatedOutdoorAirSystem";
     646            2 :             int DOASSysNum = state.dataAirLoop->OutsideAirSys(c->oASysNum).AirLoopDOASNum;
     647            2 :             c->userNameforHVACsystem = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].Name;
     648         6243 :         } else if (c->airloopNum > 0 && c->zoneEqNum == 0) {
     649         2575 :             c->coilLocation = "AirLoop";
     650         2575 :             c->typeHVACname = "AirLoopHVAC";
     651         2575 :             c->userNameforHVACsystem = state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).Name;
     652         3668 :         } else if (c->zoneEqNum > 0 && c->airloopNum > 0) { // e.g. reheat coil, has a system and is zone equipment
     653            0 :             c->userNameforHVACsystem += " on air system named " + state.dataAirSystemsData->PrimaryAirSystems(c->airloopNum).Name;
     654            0 :             c->coilLocation = "Zone Equipment";
     655              :         }
     656              : 
     657         6245 :         if (c->coilDesVolFlow > 0) {
     658         5455 :             c->oaPeakVolFrac = (c->oaPeakVolFlow / c->coilDesVolFlow) * 100.0; // make into percentage
     659              :         } else {
     660          790 :             c->oaPeakVolFrac = -999.0;
     661              :         }
     662              : 
     663         6245 :         c->coilSizingMethodConcurrenceName = DataSizing::CoilSizingConcurrenceNames[(int)c->coilSizingMethodConcurrence];
     664              : 
     665         6245 :         if (c->coilSizingMethodCapacity == DataSizing::CoolingDesignCapacity) {
     666          911 :             c->coilSizingMethodCapacityName = "CoolingDesignCapacity";
     667         5334 :         } else if (c->coilSizingMethodCapacity == DataSizing::HeatingDesignCapacity) {
     668         1099 :             c->coilSizingMethodCapacityName = "HeatingDesignCapacity";
     669         4235 :         } else if (c->coilSizingMethodCapacity == DataSizing::CapacityPerFloorArea) {
     670            0 :             c->coilSizingMethodCapacityName = "CapacityPerFloorArea";
     671         4235 :         } else if (c->coilSizingMethodCapacity == DataSizing::FractionOfAutosizedCoolingCapacity) {
     672            1 :             c->coilSizingMethodCapacityName = "FractionOfAutosizedCoolingCapacity";
     673         4234 :         } else if (c->coilSizingMethodCapacity == DataSizing::FractionOfAutosizedHeatingCapacity) {
     674            1 :             c->coilSizingMethodCapacityName = "FractionOfAutosizedHeatingCapacity";
     675              :         }
     676              : 
     677         6245 :         if (c->coilSizingMethodAirFlow == DataSizing::SupplyAirFlowRate) {
     678            0 :             c->coilSizingMethodAirFlowName = "SupplyAirFlowRate";
     679         6245 :         } else if (c->coilSizingMethodAirFlow == DataSizing::FlowPerFloorArea) {
     680            0 :             c->coilSizingMethodAirFlowName = "FlowPerFloorArea";
     681         6245 :         } else if (c->coilSizingMethodAirFlow == DataSizing::FractionOfAutosizedCoolingAirflow) {
     682            0 :             c->coilSizingMethodAirFlowName = "FractionOfAutosizedCoolingAirflow";
     683         6245 :         } else if (c->coilSizingMethodAirFlow == DataSizing::FractionOfAutosizedHeatingAirflow) {
     684            0 :             c->coilSizingMethodAirFlowName = "FractionOfAutosizedHeatingAirflow";
     685              :         }
     686              : 
     687         6245 :         if (c->isCoilSizingForTotalLoad) {
     688           12 :             c->coilPeakLoadTypeToSizeOnName = "Total";
     689              :         } else {
     690         6233 :             c->coilPeakLoadTypeToSizeOnName = "Sensible";
     691              :         }
     692              : 
     693         6245 :         if (c->capIsAutosized) {
     694         4786 :             c->coilCapAutoMsg = "Yes";
     695              :         } else {
     696         1459 :             c->coilCapAutoMsg = "No";
     697              :         }
     698              : 
     699         6245 :         if (c->volFlowIsAutosized) {
     700         4517 :             c->coilVolFlowAutoMsg = "Yes";
     701              :         } else {
     702         1728 :             c->coilVolFlowAutoMsg = "No";
     703              :         }
     704              : 
     705         6245 :         if (c->oaPretreated) {
     706           54 :             c->coilOAPretreatMsg = "Yes";
     707              :         } else {
     708         6191 :             c->coilOAPretreatMsg = "No";
     709              :         }
     710              : 
     711              :         // call psych routine to flush out moist air metrics from those available
     712         6245 :         if (c->coilDesEntTemp != -999.0 && c->coilDesEntHumRat != -999.0) {
     713        10526 :             c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
     714         5263 :                 state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::doFinalProcessingOfCoilData");
     715         5263 :             if (c->coilDesEntHumRat != -999.0) {
     716         5263 :                 c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
     717              :             }
     718              :         }
     719         6245 :         if (c->oaPeakTemp != -999.0 && c->oaPeakHumRat != -999.0) {
     720        10026 :             c->oaPeakWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
     721         5013 :                 state, c->oaPeakTemp, c->oaPeakHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::doFinalProcessingOfCoilData");
     722              :         }
     723              : 
     724         6245 :         if (c->waterLoopNum > 0 && c->pltSizNum > 0) {
     725              : 
     726         2574 :             c->plantLoopName = state.dataPlnt->PlantLoop(c->waterLoopNum).Name;
     727         2574 :             if (state.dataSize->PlantSizData(c->pltSizNum).LoopType != DataSizing::TypeOfPlantLoop::Steam) {
     728         2554 :                 c->rhoFluid = state.dataPlnt->PlantLoop(c->waterLoopNum)
     729         2554 :                                   .glycol->getDensity(state, Constant::InitConvTemp, "ReportCoilSelection::doFinalProcessingOfCoilData");
     730              : 
     731         2554 :                 c->cpFluid = state.dataPlnt->PlantLoop(c->waterLoopNum)
     732         2554 :                                  .glycol->getSpecificHeat(state, Constant::InitConvTemp, "ReportCoilSelection::doFinalProcessingOfCoilData");
     733              :             } else { // steam loop
     734           20 :                 c->rhoFluid = state.dataPlnt->PlantLoop(c->waterLoopNum)
     735           20 :                                   .steam->getSatDensity(state, 100.0, 1.0, "ReportCoilSelection::doFinalProcessingOfCoilData");
     736           20 :                 c->cpFluid = state.dataPlnt->PlantLoop(c->waterLoopNum)
     737           20 :                                  .steam->getSatSpecificHeat(state, 100.0, 0.0, "ReportCoilSelection::doFinalProcessingOfCoilData");
     738              :             }
     739         2574 :             c->plantDesMaxMassFlowRate = state.dataPlnt->PlantLoop(c->waterLoopNum).MaxMassFlowRate;
     740         2574 :             if (c->plantDesMaxMassFlowRate > 0.0 && c->coilDesWaterMassFlow > 0.0) {
     741         2514 :                 c->coilFlowPrcntPlantFlow = (c->coilDesWaterMassFlow / c->plantDesMaxMassFlowRate) * 100.0; // convert to percentage.
     742              :             }
     743              :         }
     744              :         // fill out some fan information
     745         6245 :         HVAC::FanType locFanType = HVAC::FanType::Invalid;
     746         6245 :         if (c->supFanNum == 0) {
     747         2813 :             c->supFanNum = Fans::GetFanIndex(state, c->fanAssociatedWithCoilName);
     748              :         }
     749              : 
     750         6245 :         if (c->supFanNum != 0) {
     751         3671 :             auto *fan = state.dataFans->fans(c->supFanNum);
     752         3671 :             locFanType = fan->type;
     753         3671 :             c->fanTypeName = HVAC::fanTypeNames[(int)locFanType];
     754         3671 :             c->fanSizeMaxAirVolumeFlow = fan->maxAirFlowRate;
     755         3671 :             c->fanSizeMaxAirMassFlow = fan->maxAirMassFlowRate;
     756              :         }
     757              : 
     758         6245 :         c->coilAndFanNetTotalCapacityIdealPeak = c->coilTotCapAtPeak - c->fanHeatGainIdealPeak;
     759              : 
     760              :         // fill out some plant design info
     761         6245 :         if (c->pltSizNum > 0) {
     762         2574 :             c->plantDesSupTemp = state.dataSize->PlantSizData(c->pltSizNum).ExitTemp;
     763         2574 :             c->plantDesDeltaTemp = state.dataSize->PlantSizData(c->pltSizNum).DeltaT;
     764         2574 :             if (state.dataSize->PlantSizData(c->pltSizNum).LoopType == DataSizing::TypeOfPlantLoop::Heating) {
     765         2095 :                 c->plantDesRetTemp = c->plantDesSupTemp - c->plantDesDeltaTemp;
     766          507 :             } else if (state.dataSize->PlantSizData(c->pltSizNum).LoopType == DataSizing::TypeOfPlantLoop::Cooling ||
     767           28 :                        state.dataSize->PlantSizData(c->pltSizNum).LoopType == DataSizing::TypeOfPlantLoop::Condenser) {
     768          459 :                 c->plantDesRetTemp = c->plantDesSupTemp + c->plantDesDeltaTemp;
     769              :             }
     770              : 
     771         2574 :             if (state.dataSize->PlantSizData(c->pltSizNum).LoopType != DataSizing::TypeOfPlantLoop::Steam) {
     772         5108 :                 c->plantDesCapacity = c->cpFluid * c->rhoFluid * state.dataSize->PlantSizData(c->pltSizNum).DeltaT *
     773         2554 :                                       state.dataSize->PlantSizData(c->pltSizNum).DesVolFlowRate;
     774              :             } else {
     775              :                 // find boiler on this plant loop and get capacity from it
     776           20 :                 if (allocated(state.dataBoilerSteam->Boiler)) {
     777           28 :                     for (int boilerIndex = 1; boilerIndex <= (int)state.dataBoilerSteam->Boiler.size(); ++boilerIndex) {
     778           14 :                         if (state.dataBoilerSteam->Boiler(boilerIndex).plantLoc.loopNum == c->waterLoopNum) { // steam boiler on this loop
     779           14 :                             c->plantDesSupTemp = state.dataBoilerSteam->Boiler(boilerIndex).TempUpLimitBoilerOut;
     780           14 :                             c->plantDesRetTemp = state.dataBoilerSteam->Boiler(boilerIndex).TempUpLimitBoilerOut - c->plantDesDeltaTemp;
     781           14 :                             c->plantDesCapacity = state.dataBoilerSteam->Boiler(boilerIndex).NomCap;
     782              :                         }
     783              :                     }
     784              :                 }
     785              :             }
     786              : 
     787         2574 :             if (c->plantDesCapacity > 0.0) {
     788         2568 :                 c->coilCapPrcntPlantCap = (c->coilTotCapAtPeak / c->plantDesCapacity) * 100.0; // convert to percentage.
     789              :             }
     790              :         }
     791              : 
     792         6245 :         if (c->pltSizNum == 0 && c->waterLoopNum == 0) {
     793            0 :             c->rhoFluid = -999.0;
     794            0 :             c->cpFluid = -999.0;
     795            0 :             c->plantDesMaxMassFlowRate = -999.0;
     796            0 :             c->coilFlowPrcntPlantFlow = -999.0;
     797            0 :             c->plantDesSupTemp = -999.0;
     798            0 :             c->plantDesDeltaTemp = -999.0;
     799            0 :             c->plantDesRetTemp = -999.0;
     800            0 :             c->coilDesWaterMassFlow = -999.0;
     801            0 :             c->coilDesWaterEntTemp = -999.0;
     802            0 :             c->coilDesWaterLvgTemp = -999.0;
     803            0 :             c->coilDesWaterTempDiff = -999.0;
     804            0 :             c->plantDesCapacity = -999.0;
     805            0 :             c->coilCapPrcntPlantCap = -999.0;
     806              :         }
     807              : 
     808         6245 :         c->cpDryAir = Psychrometrics::PsyCpAirFnW(0.0);
     809         6245 :         c->rhoStandAir = state.dataEnvrn->StdRhoAir;
     810              : 
     811              :         // apply ADP method to find an SHR for Ideal loads peak, calculate sensible capacity for cooling coils
     812         6245 :         if (c->coilDesEntTemp > c->coilDesLvgTemp) { // cooling coil
     813              :             Real64 CoilADPTemp =
     814         1576 :                 Psychrometrics::PsyTdpFnWPb(state, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress); // apparatus dewpoint temperature
     815              :             Real64 CoilADPHumRat =
     816         1576 :                 Psychrometrics::PsyWFnTdpPb(state, CoilADPTemp, state.dataEnvrn->StdBaroPress); // humidity ratio at apparatus dewpoint temperaure
     817         1576 :             Real64 CoilTinwADPEnthalpy = Psychrometrics::PsyHFnTdbW(
     818         1576 :                 c->coilDesEntTemp, CoilADPHumRat); // Enthalpy at inlet drybulb and humidity ratio at apparatus dewpoint temperature
     819              :             Real64 CoilADPEnthalpy =
     820         1576 :                 Psychrometrics::PsyHFnTdbW(CoilADPTemp, CoilADPHumRat); // Enthalpy at apparatus dewpoint, with Tdb set at apparatus dewpoint
     821         1576 :             Real64 SHRatIdealPeak(1.0);
     822         1576 :             if ((c->coilDesEntEnth - CoilADPEnthalpy) > 1.e-10) {
     823         1558 :                 SHRatIdealPeak = min((CoilTinwADPEnthalpy - CoilADPEnthalpy) / (c->coilDesEntEnth - CoilADPEnthalpy), 1.0); // calculate SHR
     824              :             } else {
     825           18 :                 SHRatIdealPeak = 1.0;
     826              :             }
     827         1576 :             c->coilSensCapAtPeak = SHRatIdealPeak * c->coilTotCapAtPeak;
     828              :         }
     829          741 :     } // end for loop over each coil
     830          741 : }
     831              : 
     832        86983 : int ReportCoilSelection::getIndexForOrCreateDataObjFromCoilName(EnergyPlusData &state,
     833              :                                                                 std::string const &coilName, // user-defined name of the coil
     834              :                                                                 std::string const &coilType  // idf input object class name of coil
     835              : )
     836              : {
     837        86983 :     int index(-1);
     838      2486539 :     for (int i = 0; i < numCoilsReported_; i++) {
     839      2480056 :         if (coilSelectionDataObjs[i] != nullptr) {
     840      2480056 :             if (Util::SameString(coilSelectionDataObjs[i]->coilName_, coilName)) {
     841        80500 :                 if (Util::SameString(coilSelectionDataObjs[i]->coilObjName, coilType)) {
     842        80500 :                     return index = i;
     843              :                 } else {
     844              :                     // throw error  coil type does not match coil name, check for unique names across coil types
     845            0 :                     ShowWarningError(state,
     846            0 :                                      format("check for unique coil names across different coil types: {} occurs in both {} and {}",
     847              :                                             coilName,
     848              :                                             coilType,
     849            0 :                                             coilSelectionDataObjs[i]->coilObjName));
     850              :                 }
     851              :             }
     852              :         }
     853              :     }
     854              : 
     855         6483 :     if (index == -1) { // then did not find it
     856              :         // check if really a coil type
     857         6483 :         bool found(false);
     858         6483 :         bool locIsCooling(false);
     859         6483 :         bool locIsHeating(false);
     860        95493 :         for (int loop = 1; loop <= HVAC::NumAllCoilTypes; ++loop) {
     861        95493 :             if (Util::SameString(coilType, HVAC::cAllCoilTypes(loop))) {
     862         6483 :                 found = true;
     863         6483 :                 locIsCooling = Util::SameString(coilType, HVAC::cCoolingCoilTypes(loop));
     864         6483 :                 locIsHeating = Util::SameString(coilType, HVAC::cHeatingCoilTypes(loop));
     865         6483 :                 break;
     866              :             }
     867              :         }
     868         6483 :         if (found) {
     869         6483 :             coilSelectionDataObjs.emplace_back(new CoilSelectionData(coilName));
     870         6483 :             index = coilSelectionDataObjs.size() - 1;
     871         6483 :             coilSelectionDataObjs[index]->coilObjName = coilType;
     872         6483 :             ++numCoilsReported_;
     873         6483 :             coilSelectionDataObjs[index]->isCooling = locIsCooling;
     874         6483 :             coilSelectionDataObjs[index]->isHeating = locIsHeating;
     875              :         }
     876              :     }
     877              : 
     878         6483 :     if (index == -1) {
     879            0 :         ShowFatalError(state, format("getIndexForOrCreateDataObjFromCoilName: Developer error - not a coil: {} = {}", coilType, coilName));
     880              :     }
     881         6483 :     return index;
     882              : }
     883              : 
     884         3544 : void ReportCoilSelection::associateZoneCoilWithParent(EnergyPlusData &state, std::unique_ptr<CoilSelectionData> &c)
     885              : {
     886         3544 :     c->coilLocation = "Unknown";
     887         3544 :     c->typeHVACname = "Unknown";
     888         3544 :     c->userNameforHVACsystem = "Unknown";
     889              :     // now search equipment
     890         3544 :     auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(c->zoneEqNum);
     891         3544 :     bool coilFound = false;
     892         3544 :     std::string fanType;
     893         3544 :     std::string fanName;
     894         6879 :     auto thisSubCoilLambda = [&c](const DataZoneEquipment::SubEquipmentData &myCoil) { return myCoil.Name == c->coilName_; };
     895         5865 :     auto thisSubFanLambda = [](const DataZoneEquipment::SubEquipmentData &myFan) { return myFan.TypeOf.rfind("FAN:", 0) == 0; };
     896         2373 :     auto thisSubSubCoilLambda = [&c](const DataZoneEquipment::SubSubEquipmentData &myCoil) { return myCoil.Name == c->coilName_; };
     897         2271 :     auto thisSubSubFanLambda = [](const DataZoneEquipment::SubSubEquipmentData &myFan) { return myFan.TypeOf.rfind("FAN:", 0) == 0; };
     898              : 
     899         4005 :     for (int equipLoop = 1; equipLoop <= zoneEquipList.NumOfEquipTypes; ++equipLoop) {
     900              :         // coil should be found only once, fan could be found multiple times, reset here
     901              :         // for each type of equipment (equipLoop) only one coil and fan could be found as a pair
     902         4005 :         bool fanFound = false;
     903         4005 :         auto &thisSubEq = zoneEquipList.EquipData(equipLoop).SubEquipData;
     904              : 
     905              :         // search for coil and fan SubEquipData and return parent type/name and fan type/name for coil reports.
     906         4005 :         if (std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubCoilLambda) != thisSubEq.end()) {
     907         1287 :             c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop);
     908         1287 :             c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop);
     909         1287 :             c->coilLocation = "Zone Equipment";
     910         1287 :             int zoneEqListIndex = Util::FindItemInList(zoneEquipList.Name, state.dataZoneEquip->ZoneEquipList);
     911         1287 :             if (c->zoneNum.empty()) {
     912          193 :                 c->zoneNum.resize(1);
     913              :             }
     914         1287 :             c->zoneNum[0] = zoneEqListIndex;
     915         1287 :             if (c->zoneName.empty()) {
     916          193 :                 c->zoneName.resize(1);
     917              :             }
     918         1287 :             c->zoneName[0] = state.dataHeatBal->Zone(zoneEqListIndex).Name;
     919         1287 :             coilFound = true;
     920              :         }
     921         4005 :         auto const &fanIterator = std::find_if(thisSubEq.begin(), thisSubEq.end(), thisSubFanLambda);
     922         4005 :         if (fanIterator != thisSubEq.end()) {
     923         1312 :             unsigned int fanIndex = fanIterator - thisSubEq.begin();
     924              :             // notice the brackets on the Array1D for [fanIndex]
     925         1312 :             fanType = thisSubEq[fanIndex].TypeOf;
     926         1312 :             fanName = thisSubEq[fanIndex].Name;
     927         1312 :             fanFound = true;
     928              :         }
     929              :         // if coil not found in SubEquipData then maybe it's HXAssisted and in SubSubEquipData. Fan is usually already found if exists.
     930         4005 :         if (!coilFound || !fanFound) {
     931         5402 :             for (int subEq = 1; subEq <= zoneEquipList.EquipData(equipLoop).NumSubEquip; ++subEq) {
     932         2761 :                 auto &thisSubSubEq = zoneEquipList.EquipData(equipLoop).SubEquipData(subEq).SubSubEquipData;
     933         2761 :                 if (!coilFound) {
     934         2761 :                     auto const &coilIterator2 = std::find_if(thisSubSubEq.begin(), thisSubSubEq.end(), thisSubSubCoilLambda);
     935         2761 :                     if (coilIterator2 != thisSubSubEq.end()) {
     936         2257 :                         c->typeHVACname = zoneEquipList.EquipTypeName(equipLoop);
     937         2257 :                         c->userNameforHVACsystem = zoneEquipList.EquipName(equipLoop);
     938         2257 :                         c->coilLocation = "Zone Equipment";
     939         2257 :                         int zoneEqListIndex = Util::FindItemInList(zoneEquipList.Name, state.dataZoneEquip->ZoneEquipList);
     940         2257 :                         if (c->zoneNum.empty()) {
     941          350 :                             c->zoneNum.resize(1);
     942              :                         }
     943         2257 :                         c->zoneNum[0] = zoneEqListIndex;
     944         2257 :                         if (c->zoneName.empty()) {
     945          350 :                             c->zoneName.resize(1);
     946              :                         }
     947         2257 :                         c->zoneName[0] = state.dataHeatBal->Zone(zoneEqListIndex).Name;
     948         2257 :                         coilFound = true;
     949              :                     }
     950              :                 }
     951         2761 :                 if (!fanFound) {
     952         2671 :                     auto const &fanIterator2 = std::find_if(thisSubSubEq.begin(), thisSubSubEq.end(), thisSubSubFanLambda);
     953         2671 :                     if (fanIterator2 != thisSubSubEq.end()) {
     954           80 :                         unsigned int fanIndex = fanIterator2 - thisSubSubEq.begin();
     955              :                         // notice the brackets on the Array1D for [fanIndex]
     956           80 :                         fanType = thisSubSubEq[fanIndex].TypeOf;
     957           80 :                         fanName = thisSubSubEq[fanIndex].Name;
     958           80 :                         fanFound = true;
     959              :                     }
     960              :                 }
     961         2761 :                 if (coilFound && fanFound) {
     962           77 :                     break;
     963              :                 }
     964              :             }
     965              :         }
     966         4005 :         if (coilFound) {
     967         3544 :             if (fanFound) {
     968         1364 :                 c->fanTypeName = fanType;
     969         1364 :                 c->fanAssociatedWithCoilName = fanName;
     970              :             }
     971         3544 :             break;
     972              :         }
     973              : 
     974              :     } // for (equipLoop)
     975              : 
     976         3544 :     if (c->typeHVACname == "Unknown") {
     977            0 :         ShowWarningError(state, format("Parent object not found for zone coil = {}", c->coilName_));
     978              :     }
     979         3544 : }
     980              : 
     981         4094 : void ReportCoilSelection::setRatedCoilConditions(EnergyPlusData &state,
     982              :                                                  std::string const &coilName,     // ! user-defined name of the coil
     983              :                                                  std::string const &coilObjName,  //  coil object name, e.g., Coil:Cooling:Water
     984              :                                                  Real64 const RatedCoilTotCap,    // ! rated coil total capacity [W]
     985              :                                                  Real64 const RatedCoilSensCap,   // rated coil sensible capacity [W]
     986              :                                                  Real64 const RatedAirMassFlow,   // rated coil design air mass flow rate [m3/s]
     987              :                                                  Real64 const RatedCoilInDb,      // rated coil inlet air dry bulb at time of peak [C]
     988              :                                                  Real64 const RatedCoilInHumRat,  // rated coil inlet air humidity ratio [kgWater/kgDryAir]
     989              :                                                  Real64 const RatedCoilInWb,      // rated coil inlet air wet bulb [C]
     990              :                                                  Real64 const RatedCoilOutDb,     // rated coil outlet air dry bulb [C]
     991              :                                                  Real64 const RatedCoilOutHumRat, // rated coil outlet air humidity ratio, [kgWater/kgDryAir]
     992              :                                                  Real64 const RatedCoilOutWb,     // rated coil outlet air wet bulb [C]
     993              :                                                  Real64 const RatedCoilOadbRef,   // rated DX coil outside air dry bulb reference [C]
     994              :                                                  Real64 const RatedCoilOawbRef,   // rated DX coil outside air wet bulb reference [C]
     995              :                                                  Real64 const RatedCoilBpFactor,  // rated coil bypass factor
     996              :                                                  Real64 const RatedCoilEff        // rated coil effectiveness
     997              : )
     998              : {
     999         4094 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilObjName);
    1000         4094 :     auto &c(coilSelectionDataObjs[index]);
    1001         4094 :     c->coilRatedTotCap = RatedCoilTotCap;
    1002         4094 :     c->coilRatedSensCap = RatedCoilSensCap;
    1003         4094 :     c->ratedAirMassFlow = RatedAirMassFlow;
    1004         4094 :     c->ratedCoilInDb = RatedCoilInDb;
    1005         4094 :     c->ratedCoilInWb = RatedCoilInWb;
    1006         4094 :     c->ratedCoilInHumRat = RatedCoilInHumRat;
    1007         4094 :     if ((RatedCoilInDb == -999.0) || (RatedCoilInHumRat == -999.0)) {
    1008           20 :         c->ratedCoilInEnth = -999.0;
    1009              :     } else {
    1010         4074 :         c->ratedCoilInEnth = Psychrometrics::PsyHFnTdbW(RatedCoilInDb, RatedCoilInHumRat);
    1011              :     }
    1012              : 
    1013         4094 :     c->ratedCoilOutDb = RatedCoilOutDb;
    1014         4094 :     c->ratedCoilOutWb = RatedCoilOutWb;
    1015         4094 :     c->ratedCoilOutHumRat = RatedCoilOutHumRat;
    1016         4094 :     if ((RatedCoilOutDb == -999.0) || (RatedCoilOutHumRat == -999.0)) {
    1017           20 :         c->ratedCoilOutEnth = -999.0;
    1018              :     } else {
    1019         4074 :         c->ratedCoilOutEnth = Psychrometrics::PsyHFnTdbW(RatedCoilOutDb, RatedCoilOutHumRat);
    1020              :     }
    1021              : 
    1022         4094 :     c->ratedCoilEff = RatedCoilEff;
    1023         4094 :     c->ratedCoilBpFactor = RatedCoilBpFactor;
    1024              :     // TODO    //c->ratedCoilAppDewPt =
    1025         4094 :     c->ratedCoilOadbRef = RatedCoilOadbRef;
    1026         4094 :     c->ratedCoilOawbRef = RatedCoilOawbRef;
    1027         4094 : }
    1028              : 
    1029         9791 : void ReportCoilSelection::setCoilAirFlow(EnergyPlusData &state,
    1030              :                                          std::string const &coilName, // user-defined name of the coil
    1031              :                                          std::string const &coilType, // idf input object class name of coil
    1032              :                                          Real64 const airVdot,        // air flow rate in m3/s
    1033              :                                          bool const isAutoSized       // true if air flow was autosized
    1034              : )
    1035              : {
    1036         9791 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1037         9791 :     auto &c(coilSelectionDataObjs[index]);
    1038         9791 :     c->coilDesVolFlow = airVdot;
    1039         9791 :     c->volFlowIsAutosized = isAutoSized;
    1040              : 
    1041         9791 :     c->coilDesMassFlow = airVdot * state.dataEnvrn->StdRhoAir;
    1042         9791 : }
    1043              : 
    1044           26 : void ReportCoilSelection::setCoilWaterFlowNodeNums(EnergyPlusData &state,
    1045              :                                                    std::string const &coilName, // user-defined name of the coil
    1046              :                                                    std::string const &coilType, // idf input object class name of coil
    1047              :                                                    Real64 const waterVdot,      // plant fluid flow rate in m3/s
    1048              :                                                    bool const isAutoSized,      // true if water flow was autosized
    1049              :                                                    int const inletNodeNum,      // coil chw inlet node num
    1050              :                                                    int const outletNodeNum,     // coil chw outlet node num
    1051              :                                                    int const plantLoopNum       // plant loop structure index
    1052              : )
    1053              : {
    1054           26 :     int plantSizNum = -999;
    1055           26 :     if ((state.dataSize->NumPltSizInput > 0) && (inletNodeNum > 0) && (outletNodeNum > 0)) {
    1056           26 :         bool errorsfound = false;
    1057           26 :         plantSizNum = PlantUtilities::MyPlantSizingIndex(state, "water coil", coilName, inletNodeNum, outletNodeNum, errorsfound);
    1058              :     }
    1059           26 :     state.dataRptCoilSelection->coilSelectionReportObj->setCoilWaterFlowPltSizNum(
    1060              :         state, coilName, coilType, waterVdot, isAutoSized, plantSizNum, plantLoopNum);
    1061           26 : }
    1062              : 
    1063         5369 : void ReportCoilSelection::setCoilWaterFlowPltSizNum(EnergyPlusData &state,
    1064              :                                                     std::string const &coilName, // user-defined name of the coil
    1065              :                                                     std::string const &coilType, // idf input object class name of coil
    1066              :                                                     Real64 const waterVdot,      // plant fluid flow rate in m3/s
    1067              :                                                     bool const isAutoSized,      // true if water flow was autosized
    1068              :                                                     int const plantSizNum,       // plant sizing structure index
    1069              :                                                     int const plantLoopNum       // plant loop structure index
    1070              : )
    1071              : {
    1072         5369 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1073         5369 :     auto &c(coilSelectionDataObjs[index]);
    1074         5369 :     c->pltSizNum = plantSizNum;
    1075         5369 :     c->waterLoopNum = plantLoopNum;
    1076         5369 :     if (c->waterLoopNum > 0) {
    1077         5355 :         c->plantLoopName = state.dataPlnt->PlantLoop(c->waterLoopNum).Name;
    1078              :     }
    1079              : 
    1080         5369 :     if (c->waterLoopNum > 0 && c->pltSizNum > 0) {
    1081         5355 :         if (state.dataSize->PlantSizData(c->pltSizNum).LoopType != DataSizing::TypeOfPlantLoop::Steam) {
    1082        10670 :             c->rhoFluid =
    1083         5335 :                 state.dataPlnt->PlantLoop(c->waterLoopNum).glycol->getDensity(state, Constant::InitConvTemp, "ReportCoilSelection::setCoilWaterFlow");
    1084              : 
    1085         5335 :             c->cpFluid = state.dataPlnt->PlantLoop(c->waterLoopNum)
    1086         5335 :                              .glycol->getSpecificHeat(state, Constant::InitConvTemp, "ReportCoilSelection::setCoilWaterFlow");
    1087              :         } else { // steam loop
    1088           20 :             c->rhoFluid = state.dataPlnt->PlantLoop(c->waterLoopNum).steam->getSatDensity(state, 100.0, 1.0, "ReportCoilSelection::setCoilWaterFlow");
    1089           40 :             c->cpFluid =
    1090           20 :                 state.dataPlnt->PlantLoop(c->waterLoopNum).steam->getSatSpecificHeat(state, 100.0, 0.0, "ReportCoilSelection::setCoilWaterFlow");
    1091              :         }
    1092              :     }
    1093         5369 :     if (c->rhoFluid > 0.0) {
    1094         5355 :         c->coilDesWaterMassFlow = waterVdot * c->rhoFluid;
    1095              :     }
    1096         5369 :     if (isAutoSized) {
    1097         5359 :         c->coilWaterFlowAutoMsg = "Yes";
    1098              :     } else {
    1099           10 :         c->coilWaterFlowAutoMsg = "No";
    1100              :     }
    1101         5369 : }
    1102              : 
    1103         6298 : void ReportCoilSelection::setCoilEntAirTemp(EnergyPlusData &state,
    1104              :                                             std::string const &coilName,    // user-defined name of the coil
    1105              :                                             std::string const &coilType,    // idf input object class name of coil
    1106              :                                             Real64 const entAirDryBulbTemp, // degree C air entering coil
    1107              :                                             int const curSysNum,            // airloop system number index, if non zero
    1108              :                                             int const curZoneEqNum          // zone equipment list index, if non-zero
    1109              : )
    1110              : {
    1111         6298 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1112         6298 :     auto &c(coilSelectionDataObjs[index]);
    1113         6298 :     c->coilDesEntTemp = entAirDryBulbTemp;
    1114         6298 :     c->airloopNum = curSysNum;
    1115         6298 :     doAirLoopSetup(state, index);
    1116         6298 :     c->zoneEqNum = curZoneEqNum;
    1117         6298 : }
    1118              : 
    1119         6757 : void ReportCoilSelection::setCoilEntAirHumRat(EnergyPlusData &state,
    1120              :                                               std::string const &coilName, // user-defined name of the coil
    1121              :                                               std::string const &coilType, // idf input object class name of coil
    1122              :                                               Real64 const entAirHumrat    //
    1123              : )
    1124              : {
    1125         6757 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1126         6757 :     auto &c(coilSelectionDataObjs[index]);
    1127         6757 :     c->coilDesEntHumRat = entAirHumrat;
    1128         6757 : }
    1129              : 
    1130         3622 : void ReportCoilSelection::setCoilEntWaterTemp(EnergyPlusData &state,
    1131              :                                               std::string const &coilName, // user-defined name of the coil
    1132              :                                               std::string const &coilType, // idf input object class name of coil
    1133              :                                               Real64 const entWaterTemp    //
    1134              : )
    1135              : {
    1136         3622 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1137         3622 :     auto &c(coilSelectionDataObjs[index]);
    1138         3622 :     c->coilDesWaterEntTemp = entWaterTemp;
    1139         3622 : }
    1140              : 
    1141         3165 : void ReportCoilSelection::setCoilLvgWaterTemp(EnergyPlusData &state,
    1142              :                                               std::string const &coilName, // user-defined name of the coil
    1143              :                                               std::string const &coilType, // idf input object class name of coil
    1144              :                                               Real64 const lvgWaterTemp    //
    1145              : )
    1146              : {
    1147         3165 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1148         3165 :     auto &c(coilSelectionDataObjs[index]);
    1149         3165 :     c->coilDesWaterLvgTemp = lvgWaterTemp;
    1150         3165 : }
    1151              : 
    1152         3165 : void ReportCoilSelection::setCoilWaterDeltaT(EnergyPlusData &state,
    1153              :                                              std::string const &coilName, // user-defined name of the coil
    1154              :                                              std::string const &coilType, // idf input object class name of coil
    1155              :                                              Real64 const CoilWaterDeltaT // degree C temperature difference used to size coil
    1156              : )
    1157              : {
    1158         3165 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1159         3165 :     auto &c(coilSelectionDataObjs[index]);
    1160         3165 :     c->coilDesWaterTempDiff = CoilWaterDeltaT;
    1161         3165 : }
    1162              : 
    1163         4118 : void ReportCoilSelection::setCoilLvgAirTemp(EnergyPlusData &state,
    1164              :                                             std::string const &coilName,   // user-defined name of the coil
    1165              :                                             std::string const &coilType,   // idf input object class name of coil
    1166              :                                             Real64 const lvgAirDryBulbTemp //
    1167              : )
    1168              : {
    1169         4118 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1170         4118 :     auto &c(coilSelectionDataObjs[index]);
    1171         4118 :     c->coilDesLvgTemp = lvgAirDryBulbTemp;
    1172         4118 : }
    1173              : 
    1174         4118 : void ReportCoilSelection::setCoilLvgAirHumRat(EnergyPlusData &state,
    1175              :                                               std::string const &coilName, // user-defined name of the coil
    1176              :                                               std::string const &coilType, // idf input object class name of coil
    1177              :                                               Real64 const lvgAirHumRat    //
    1178              : )
    1179              : {
    1180         4118 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1181         4118 :     auto &c(coilSelectionDataObjs[index]);
    1182         4118 :     c->coilDesLvgHumRat = lvgAirHumRat;
    1183         4118 : }
    1184              : 
    1185        13825 : std::string PeakHrMinString(EnergyPlusData &state, const int designDay, const int timeStepAtPeak)
    1186              : {
    1187              :     return fmt::format("{}/{} {}",
    1188        13825 :                        state.dataWeather->DesDayInput(designDay).Month,
    1189        13825 :                        state.dataWeather->DesDayInput(designDay).DayOfMonth,
    1190        27650 :                        ReportCoilSelection::getTimeText(state, timeStepAtPeak));
    1191              : }
    1192              : 
    1193         2056 : void ReportCoilSelection::setCoilCoolingCapacity(
    1194              :     EnergyPlusData &state,
    1195              :     std::string const &coilName,       // user-defined name of the coil
    1196              :     std::string const &coilType,       // idf input object class name of coil
    1197              :     Real64 const TotalCoolingCap,      // {W} coil cooling capacity, sizing result
    1198              :     bool const isAutoSize,             // true if value was autosized
    1199              :     int const curSysNum,               // airloop system number index, if non zero
    1200              :     int const curZoneEqNum,            // zone equipment list index, if non-zero
    1201              :     int const curOASysNum,             // OA system equipment list index, if non-zero
    1202              :     Real64 const fanCoolLoad,          // {W} fan load used in ideal loads coil sizing
    1203              :     Real64 const coilCapFunTempFac,    // {W} curve result for modification factor for capacity as a function of temperature
    1204              :     Real64 const DXFlowPerCapMinRatio, // non dimensional ratio, capacity adjustment ratio min
    1205              :     Real64 const DXFlowPerCapMaxRatio  // non dimensional ratio, capacity adjustment ratio max
    1206              : )
    1207              : {
    1208         2056 :     auto &ZoneEqSizing(state.dataSize->ZoneEqSizing);
    1209         2056 :     auto &SysSizPeakDDNum(state.dataSize->SysSizPeakDDNum);
    1210              : 
    1211         2056 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1212         2056 :     auto &c(coilSelectionDataObjs[index]);
    1213              :     // no this is adjusted back to ratings    c->coilTotCapAtPeak = TotalCoolingCap;
    1214         2056 :     c->coilCapFTIdealPeak = coilCapFunTempFac;
    1215         2056 :     c->coilTotCapAtPeak = TotalCoolingCap * c->coilCapFTIdealPeak;
    1216         2056 :     c->capIsAutosized = isAutoSize;
    1217         2056 :     c->minRatio = DXFlowPerCapMinRatio;
    1218         2056 :     c->maxRatio = DXFlowPerCapMaxRatio;
    1219              : 
    1220         2056 :     c->fanHeatGainIdealPeak = fanCoolLoad;
    1221         2056 :     c->airloopNum = curSysNum;
    1222         2056 :     doAirLoopSetup(state, index);
    1223         2056 :     c->zoneEqNum = curZoneEqNum;
    1224              :     //    if ( c->zoneEqNum > 0 ) doZoneEqSetup( index );
    1225         2056 :     c->oASysNum = curOASysNum;
    1226              : 
    1227         3449 :     if (curSysNum > 0 && c->zoneEqNum == 0 && allocated(state.dataSize->FinalSysSizing) && allocated(SysSizPeakDDNum) &&
    1228         1393 :         curSysNum <= state.dataHVACGlobal->NumPrimaryAirSys) {
    1229              : 
    1230              :         // These next blocks does not always work with SizingPeriod:WeatherFileDays or SizingPeriod:WeatherFileConditionType, protect against hard
    1231              :         // crash
    1232         1393 :         if (SysSizPeakDDNum(curSysNum).SensCoolPeakDD > 0 && SysSizPeakDDNum(curSysNum).SensCoolPeakDD <= state.dataEnvrn->TotDesDays) {
    1233         1391 :             c->desDayNameAtSensPeak = state.dataWeather->DesDayInput(SysSizPeakDDNum(curSysNum).SensCoolPeakDD).Title;
    1234         2782 :             c->coilSensePeakHrMin = PeakHrMinString(state,
    1235         1391 :                                                     SysSizPeakDDNum(curSysNum).SensCoolPeakDD,
    1236         2782 :                                                     SysSizPeakDDNum(curSysNum).TimeStepAtSensCoolPk(SysSizPeakDDNum(curSysNum).SensCoolPeakDD));
    1237              :         }
    1238         1393 :         if (SysSizPeakDDNum(curSysNum).TotCoolPeakDD > 0 && SysSizPeakDDNum(curSysNum).TotCoolPeakDD <= state.dataEnvrn->TotDesDays) {
    1239         1391 :             c->desDayNameAtTotalPeak = state.dataWeather->DesDayInput(SysSizPeakDDNum(curSysNum).TotCoolPeakDD).Title;
    1240         2782 :             c->coilTotalPeakHrMin = PeakHrMinString(state,
    1241         1391 :                                                     SysSizPeakDDNum(curSysNum).TotCoolPeakDD,
    1242         2782 :                                                     SysSizPeakDDNum(curSysNum).TimeStepAtTotCoolPk(SysSizPeakDDNum(curSysNum).TotCoolPeakDD));
    1243              :         }
    1244              : 
    1245         1393 :         if (SysSizPeakDDNum(curSysNum).CoolFlowPeakDD > 0 && SysSizPeakDDNum(curSysNum).CoolFlowPeakDD <= state.dataEnvrn->TotDesDays) {
    1246         1391 :             c->desDayNameAtAirFlowPeak = state.dataWeather->DesDayInput(SysSizPeakDDNum(curSysNum).CoolFlowPeakDD).Title;
    1247         2782 :             c->airPeakHrMin = PeakHrMinString(state,
    1248         1391 :                                               SysSizPeakDDNum(curSysNum).CoolFlowPeakDD,
    1249         2782 :                                               SysSizPeakDDNum(curSysNum).TimeStepAtCoolFlowPk(SysSizPeakDDNum(curSysNum).CoolFlowPeakDD));
    1250              :         }
    1251              : 
    1252         1393 :         auto const &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum);
    1253         1393 :         c->isCoilSizingForTotalLoad = (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::TotalCooling);
    1254         1393 :         c->oaPeakTemp = finalSysSizing.OutTempAtCoolPeak;
    1255         1393 :         c->oaPeakVolFlow = finalSysSizing.DesOutAirVolFlow;
    1256         1393 :         c->oaPeakHumRat = finalSysSizing.OutHumRatAtCoolPeak;
    1257         1393 :         c->raPeakTemp = finalSysSizing.RetTempAtCoolPeak;
    1258         1393 :         c->raPeakHumRat = finalSysSizing.RetHumRatAtCoolPeak;
    1259         1393 :         c->coilSizingMethodConcurrence = static_cast<DataSizing::CoilSizingConcurrence>(finalSysSizing.SizingOption);
    1260         1393 :         c->coilSizingMethodCapacity = finalSysSizing.CoolingCapMethod;
    1261         1393 :         c->coilSizingMethodAirFlow = finalSysSizing.ScaleCoolSAFMethod;
    1262              :         // DesOutAirVolFlow
    1263              : 
    1264              :         // loop over cooled zones attached to this airloop to find average Room condition
    1265              :         // change weighting to use supply air flow rate rather than zone air volume for all the zones on this coil's air system
    1266         1393 :         Real64 sumT_Vdot(0.0);   // numerator for average zone temperature, zone temperature values times zone supply air volume flow rate
    1267         1393 :         Real64 sumW_Vdot(0.0);   // numerator average zone humidity ratio, zone hum rat value times zone supply air volume flow rate
    1268         1393 :         Real64 sumSensLoad(0.0); // straight total for zone design loads
    1269         1393 :         Real64 sumVdot(0.0);     // denominator for supply air flow rate weighted averages
    1270              : 
    1271              :         // Decide what day and time to use for zone/room averages
    1272         1393 :         int SysPeakDDnum(0);
    1273         1393 :         int SysPeakTimeStepInDay(0);
    1274         1393 :         if (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::TotalCooling) {
    1275           18 :             SysPeakDDnum = SysSizPeakDDNum(curSysNum).TotCoolPeakDD;
    1276           18 :             if (SysPeakDDnum > 0) {
    1277           18 :                 SysPeakTimeStepInDay = SysSizPeakDDNum(curSysNum).TimeStepAtTotCoolPk(SysSizPeakDDNum(curSysNum).TotCoolPeakDD);
    1278              :             }
    1279         1375 :         } else if (finalSysSizing.coolingPeakLoad == DataSizing::PeakLoad::SensibleCooling) {
    1280         1375 :             SysPeakDDnum = SysSizPeakDDNum(curSysNum).SensCoolPeakDD;
    1281         1375 :             if (SysPeakDDnum > 0) {
    1282         1375 :                 SysPeakTimeStepInDay = SysSizPeakDDNum(curSysNum).TimeStepAtSensCoolPk(SysSizPeakDDNum(curSysNum).SensCoolPeakDD);
    1283              :             }
    1284              :         }
    1285              : 
    1286         1393 :         if (SysPeakDDnum > 0 && SysPeakTimeStepInDay > 0) {
    1287         7284 :             for (auto &z : c->zoneNum) {
    1288         5891 :                 auto const &thisCalcZoneSizing = state.dataSize->CalcZoneSizing(SysPeakDDnum, z);
    1289         5891 :                 auto const &thisFinalZoneSizing = state.dataSize->FinalZoneSizing(z);
    1290         5891 :                 Real64 mult = state.dataHeatBal->Zone(z).Multiplier * state.dataHeatBal->Zone(z).ListMultiplier;
    1291         5891 :                 Real64 Tz = thisCalcZoneSizing.CoolZoneTempSeq(SysPeakTimeStepInDay);
    1292         5891 :                 Real64 Vdot_z = thisCalcZoneSizing.CoolFlowSeq(SysPeakTimeStepInDay);
    1293         5891 :                 if (Vdot_z == 0.0) { // take value from final zone sizing
    1294           77 :                     Vdot_z = thisFinalZoneSizing.CoolMassFlow;
    1295           77 :                     if (Vdot_z == 0.0) {
    1296           77 :                         Vdot_z = finalSysSizing.DesCoolVolFlow * state.dataEnvrn->StdRhoAir / c->zoneNum.size();
    1297              :                     }
    1298              :                 }
    1299         5891 :                 Real64 Wz = thisCalcZoneSizing.CoolZoneHumRatSeq(SysPeakTimeStepInDay);
    1300         5891 :                 sumT_Vdot += Tz * Vdot_z * mult;
    1301         5891 :                 sumW_Vdot += Wz * Vdot_z * mult;
    1302         5891 :                 sumVdot += Vdot_z * mult;
    1303         5891 :                 Real64 Qdot_z = thisCalcZoneSizing.CoolLoadSeq(SysPeakTimeStepInDay);
    1304         5891 :                 if (Qdot_z > 0.0) {
    1305         5814 :                     sumSensLoad += Qdot_z * mult;
    1306              :                 } else {
    1307           77 :                     sumSensLoad += thisFinalZoneSizing.DesCoolLoad * mult;
    1308              :                 }
    1309         1393 :             }
    1310              :         }
    1311         1393 :         if (c->zoneNum.size() > 0 && sumVdot > 0.0) {
    1312         1393 :             c->rmPeakTemp = (sumT_Vdot / sumVdot);
    1313         1393 :             c->rmPeakHumRat = (sumW_Vdot / sumVdot);
    1314         2786 :             c->rmPeakRelHum =
    1315         1393 :                 Psychrometrics::PsyRhFnTdbWPb(state, c->rmPeakTemp, c->rmPeakHumRat, state.dataEnvrn->StdBaroPress) * 100.0; // convert to percentage
    1316              :         } else {
    1317            0 :             c->rmPeakTemp = -999.0;
    1318            0 :             c->rmPeakHumRat = -999.0;
    1319            0 :             c->rmPeakRelHum = -999.0;
    1320              :         }
    1321              : 
    1322         1393 :         if (c->coilSizingMethodConcurrence == DataSizing::CoilSizingConcurrence::Coincident) {
    1323          153 :             c->rmSensibleAtPeak = finalSysSizing.SysCoolCoinSpaceSens;
    1324         1240 :         } else if (c->coilSizingMethodConcurrence == DataSizing::CoilSizingConcurrence::NonCoincident) {
    1325         1240 :             c->rmSensibleAtPeak = sumSensLoad;
    1326              :         } else { // DataSizing::Combination or other
    1327            0 :             c->rmSensibleAtPeak = sumSensLoad;
    1328              :         }
    1329              : 
    1330              :         // now set Coil Ent And Lvg Conditions
    1331         1393 :         if (curOASysNum > 0) {                 // then this system coil is part of OA system
    1332           57 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly
    1333            0 :                 c->coilDesEntTemp = finalSysSizing.OutTempAtCoolPeak;
    1334              :             }
    1335           57 :             if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly
    1336            0 :                 c->coilDesEntHumRat = finalSysSizing.OutHumRatAtCoolPeak;
    1337              :             }
    1338          114 :             c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1339           57 :                 state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1340           57 :             c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1341           57 :             if (c->coilDesLvgTemp == -999.0) { // don't overwrite if already set directly
    1342            0 :                 c->coilDesLvgTemp = finalSysSizing.PrecoolTemp;
    1343              :             }
    1344           57 :             if (c->coilDesLvgHumRat == -999.0) { // don't overwrite if already set directly
    1345            0 :                 c->coilDesLvgHumRat = finalSysSizing.PrecoolHumRat;
    1346              :             }
    1347          114 :             c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1348           57 :                 state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1349           57 :             c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1350              : 
    1351              :         } else {                               // part of main air loop
    1352         1336 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly
    1353            0 :                 c->coilDesEntTemp = finalSysSizing.MixTempAtCoolPeak;
    1354              :             }
    1355         1336 :             if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly
    1356            0 :                 c->coilDesEntHumRat = finalSysSizing.MixHumRatAtCoolPeak;
    1357              :             }
    1358         2672 :             c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1359         1336 :                 state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1360         1336 :             c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1361         1336 :             if (c->coilDesLvgTemp == -999.0) {
    1362            0 :                 c->coilDesLvgTemp = finalSysSizing.CoolSupTemp;
    1363              :             }
    1364         1336 :             if (c->coilDesLvgHumRat == -999.0) { // don't overwrite if already set directly
    1365            0 :                 c->coilDesLvgHumRat = finalSysSizing.CoolSupHumRat;
    1366              :             }
    1367         2672 :             c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1368         1336 :                 state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1369         1336 :             c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1370         1336 :             if (state.dataAirSystemsData->PrimaryAirSystems(curSysNum).NumOACoolCoils > 0) { // there is precooling of the OA stream
    1371           53 :                 c->oaPretreated = true;
    1372              :             }
    1373              :         }
    1374              : 
    1375          663 :     } else if (curZoneEqNum > 0 && allocated(state.dataSize->FinalZoneSizing)) {
    1376          485 :         c->zoneNum.resize(1);
    1377          485 :         c->zoneName.resize(1);
    1378          485 :         c->zoneNum[0] = curZoneEqNum;
    1379          485 :         if (allocated(state.dataZoneEquip->ZoneEquipConfig)) {
    1380          485 :             c->zoneName[0] = state.dataZoneEquip->ZoneEquipConfig(curZoneEqNum).ZoneName;
    1381              :         }
    1382          485 :         auto const &thisFinalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum);
    1383          485 :         c->desDayNameAtSensPeak = thisFinalZoneSizing.CoolDesDay;
    1384          485 :         c->oaPeakTemp = thisFinalZoneSizing.OutTempAtCoolPeak;
    1385          485 :         c->oaPeakHumRat = thisFinalZoneSizing.OutHumRatAtCoolPeak;
    1386          485 :         c->raPeakTemp = thisFinalZoneSizing.ZoneTempAtCoolPeak;
    1387          485 :         c->raPeakHumRat = thisFinalZoneSizing.ZoneHumRatAtCoolPeak;
    1388          485 :         c->rmPeakTemp = thisFinalZoneSizing.ZoneTempAtCoolPeak;
    1389          485 :         c->rmPeakHumRat = thisFinalZoneSizing.ZoneHumRatAtCoolPeak;
    1390          970 :         c->rmPeakRelHum =
    1391          485 :             Psychrometrics::PsyRhFnTdbWPb(state, c->rmPeakTemp, c->rmPeakHumRat, state.dataEnvrn->StdBaroPress) * 100.0; // convert to percentage
    1392          485 :         if (thisFinalZoneSizing.CoolDDNum > 0 && thisFinalZoneSizing.CoolDDNum <= state.dataEnvrn->TotDesDays) {
    1393          476 :             c->coilSensePeakHrMin = PeakHrMinString(state, thisFinalZoneSizing.CoolDDNum, thisFinalZoneSizing.TimeStepNumAtCoolMax);
    1394          476 :             c->airPeakHrMin = PeakHrMinString(state, thisFinalZoneSizing.CoolDDNum, thisFinalZoneSizing.TimeStepNumAtCoolMax);
    1395              :         }
    1396              : 
    1397          485 :         c->rmSensibleAtPeak = thisFinalZoneSizing.DesCoolLoad;
    1398              : 
    1399          485 :         if (ZoneEqSizing(curZoneEqNum).OAVolFlow > 0.0) {
    1400          267 :             c->oaPeakVolFlow = ZoneEqSizing(curZoneEqNum).OAVolFlow;
    1401              :         } else {
    1402          218 :             c->oaPeakVolFlow = 0.0;
    1403              :         }
    1404              :         // coil entering conditions depend on the type of zone equipment involved
    1405              :         // set typeof_Coil integer
    1406          485 :         if (state.dataSize->TermUnitIU) { // an unpowered induction terminal unit
    1407              :             // should be picked up by CoolingWaterDesAirInletHumRatSizing and CoolingWaterDesWaterInletTempSizing
    1408              :             // c->coilDesEntTemp = DataSizing::FinalZoneSizing( curZoneEqNum ).ZoneTempAtCoolPeak;
    1409              :             // c->coilDesEntHumRat = DataSizing::FinalZoneSizing( curZoneEqNum ).ZoneHumRatAtCoolPeak;
    1410          477 :         } else if (state.dataSize->ZoneEqFanCoil) {
    1411              :             // should be picked up by CoolingWaterDesAirInletHumRatSizing and CoolingWaterDesWaterInletTempSizing
    1412              :             // if ( DataSizing::FinalZoneSizing( curZoneEqNum ).DesCoolMassFlow > 0.0 ) {
    1413              :             //    c->oaPeakVolFrac = min( (DataEnvironment::StdRhoAir * c->oaPeakVolFlow)/DataSizing::FinalZoneSizing( curZoneEqNum
    1414              :             //).DesCoolMassFlow, 1.0 ); } else {     c->oaPeakVolFrac = 0.0;
    1415              :             //}
    1416              :             // c->coilDesEntTemp = c->oaPeakVolFrac * DataSizing::FinalZoneSizing( curZoneEqNum ).OutTempAtCoolPeak + ( 1.0 - c->oaPeakVolFrac ) *
    1417              :             // DataSizing::FinalZoneSizing( curZoneEqNum ).ZoneTempAtCoolPeak;  c->coilDesEntHumRat =  c->oaPeakVolFrac *
    1418              :             // DataSizing::FinalZoneSizing( curZoneEqNum ).OutHumRatAtCoolPeak + ( 1.0 - c->oaPeakVolFrac ) * DataSizing::FinalZoneSizing(
    1419              :             // curZoneEqNum ).ZoneHumRatAtCoolPeak;
    1420          332 :         } else if (state.dataSize->ZoneEqDXCoil) {
    1421          263 :             if (ZoneEqSizing(curZoneEqNum).OAVolFlow > 0.0) {
    1422          206 :                 if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1423            0 :                     c->coilDesEntTemp = thisFinalZoneSizing.DesCoolCoilInTemp;
    1424              :                 }
    1425          206 :                 if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly by setCoilEntAirHumRat
    1426            0 :                     c->coilDesEntHumRat = thisFinalZoneSizing.DesCoolCoilInHumRat;
    1427              :                 }
    1428              :             } else {
    1429           57 :                 if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1430            0 :                     c->coilDesEntTemp = thisFinalZoneSizing.ZoneTempAtCoolPeak;
    1431              :                 }
    1432           57 :                 if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly by setCoilEntAirHumRat
    1433            0 :                     c->coilDesEntHumRat = thisFinalZoneSizing.ZoneHumRatAtCoolPeak;
    1434              :                 }
    1435              :             }
    1436              :         } else {
    1437           69 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1438            0 :                 c->coilDesEntTemp = thisFinalZoneSizing.DesCoolCoilInTemp;
    1439              :             }
    1440           69 :             if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly by setCoilEntAirHumRat
    1441            0 :                 c->coilDesEntHumRat = thisFinalZoneSizing.DesCoolCoilInHumRat;
    1442              :             }
    1443              :         }
    1444              : 
    1445          485 :         if (c->coilDesLvgTemp == -999.0) { // don't overwrite if already set directly by setCoilLvgAirTemp
    1446           76 :             c->coilDesLvgTemp = thisFinalZoneSizing.CoolDesTemp;
    1447              :         }
    1448          485 :         if (c->coilDesLvgHumRat == -999.0) { // don't overwrite if already set directly by setCoilLvgAirHumRat
    1449           76 :             c->coilDesLvgHumRat = thisFinalZoneSizing.CoolDesHumRat;
    1450              :         }
    1451          970 :         c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1452          485 :             state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1453          485 :         c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1454          178 :     } else if (curOASysNum > 0 && c->airloopNum > state.dataHVACGlobal->NumPrimaryAirSys) {
    1455            0 :         if (!state.dataAirLoopHVACDOAS->airloopDOAS.empty()) {
    1456            0 :             int DOASSysNum = state.dataAirLoop->OutsideAirSys(curOASysNum).AirLoopDOASNum;
    1457            0 :             c->coilDesEntTemp = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].SizingCoolOATemp;
    1458            0 :             c->coilDesEntHumRat = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].SizingCoolOAHumRat;
    1459            0 :             if (c->coilDesEntTemp > -999.0 && c->coilDesEntHumRat > -999.0) {
    1460            0 :                 c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1461            0 :                     state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1462            0 :                 c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1463              :             }
    1464            0 :             c->coilDesLvgTemp = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].PrecoolTemp;
    1465            0 :             c->coilDesLvgHumRat = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].PrecoolHumRat;
    1466            0 :             if (c->coilDesLvgTemp > -999.0 && c->coilDesLvgHumRat > -999.0) {
    1467            0 :                 c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1468            0 :                     state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilCoolingCapacity");
    1469            0 :                 c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1470              :             }
    1471            0 :             DataSizing::SizingConcurrence sizMethod = DataSizing::SizingConcurrence::Invalid;
    1472            0 :             bool sizMethodsAreTheSame = true;
    1473            0 :             for (int airLoopNum = 0; airLoopNum < state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].NumOfAirLoops; ++airLoopNum) {
    1474            0 :                 int actualAirLoopNum = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].m_AirLoopNum[airLoopNum];
    1475            0 :                 if (airLoopNum == 0) {
    1476            0 :                     sizMethod = state.dataSize->FinalSysSizing(actualAirLoopNum).SizingOption;
    1477              :                 } else {
    1478            0 :                     if (sizMethod != state.dataSize->FinalSysSizing(actualAirLoopNum).SizingOption) {
    1479            0 :                         sizMethodsAreTheSame = false;
    1480              :                     }
    1481              :                 }
    1482              :             }
    1483            0 :             if (sizMethodsAreTheSame) {
    1484            0 :                 c->coilSizingMethodConcurrence = static_cast<DataSizing::CoilSizingConcurrence>(sizMethod);
    1485              :             } else {
    1486            0 :                 c->coilSizingMethodConcurrence = DataSizing::CoilSizingConcurrence::Combination;
    1487              :             }
    1488              :         }
    1489              :     } else {
    1490              :         // do nothing
    1491              :     }
    1492              : 
    1493              :     // calc sensible capacity from inlet outlet
    1494         2056 :     c->cpMoistAir = Psychrometrics::PsyCpAirFnW(c->coilDesEntHumRat);
    1495         2056 : }
    1496              : 
    1497         4683 : void ReportCoilSelection::setCoilHeatingCapacity(
    1498              :     EnergyPlusData &state,
    1499              :     std::string const &coilName,       // user-defined name of the coil
    1500              :     std::string const &coilType,       // idf input object class name of coil
    1501              :     Real64 const totalHeatingCap,      // {W} coil Heating capacity
    1502              :     bool const isAutoSize,             // true if value was autosized
    1503              :     int const curSysNum,               // airloop system number index, if non zero
    1504              :     int const curZoneEqNum,            // zone equipment list index, if non-zero
    1505              :     int const curOASysNum,             // OA system equipment list index, if non-zero
    1506              :     Real64 const fanHeatGain,          // {W} fan load used in ideal loads coil sizing
    1507              :     Real64 const coilCapFunTempFac,    // {W} curve result for modification factor for capacity as a function of temperature
    1508              :     Real64 const DXFlowPerCapMinRatio, // non dimensional ratio, capacity adjustment ratio min
    1509              :     Real64 const DXFlowPerCapMaxRatio  // non dimensional ratio, capacity adjustment ratio max
    1510              : )
    1511              : {
    1512         4683 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1513         4683 :     auto &c(coilSelectionDataObjs[index]);
    1514         4683 :     c->capIsAutosized = isAutoSize;
    1515         4683 :     c->coilCapFTIdealPeak = coilCapFunTempFac;
    1516         4683 :     c->coilTotCapAtPeak = totalHeatingCap * c->coilCapFTIdealPeak;
    1517         4683 :     c->minRatio = DXFlowPerCapMinRatio;
    1518         4683 :     c->maxRatio = DXFlowPerCapMaxRatio;
    1519              : 
    1520         4683 :     c->fanHeatGainIdealPeak = fanHeatGain;
    1521         4683 :     c->airloopNum = curSysNum;
    1522         4683 :     doAirLoopSetup(state, index);
    1523         4683 :     c->zoneEqNum = curZoneEqNum;
    1524              :     //    if ( c->zoneEqNum > 0 ) doZoneEqSetup( index );
    1525         4683 :     if (curSysNum > 0 && c->zoneEqNum == 0 && curSysNum <= int(state.dataSize->FinalSysSizing.size())) {
    1526         1560 :         auto &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum);
    1527         1560 :         c->desDayNameAtSensPeak = finalSysSizing.HeatDesDay;
    1528              : 
    1529         1560 :         c->oaPeakTemp = finalSysSizing.HeatOutTemp;
    1530         1560 :         c->oaPeakHumRat = finalSysSizing.HeatOutHumRat;
    1531         1560 :         c->oaPeakVolFlow = finalSysSizing.DesOutAirVolFlow;
    1532         1560 :         c->raPeakTemp = finalSysSizing.HeatRetTemp;
    1533         1560 :         c->raPeakHumRat = finalSysSizing.HeatRetHumRat;
    1534         1560 :         c->coilSizingMethodConcurrence = static_cast<DataSizing::CoilSizingConcurrence>(finalSysSizing.SizingOption);
    1535         1560 :         c->coilSizingMethodCapacity = finalSysSizing.HeatingCapMethod;
    1536         1560 :         c->coilSizingMethodAirFlow = finalSysSizing.ScaleHeatSAFMethod;
    1537              : 
    1538              :         // Central Heating Coils are always sized at the conditions at the peak Sensible Heating Load
    1539         1560 :         c->isCoilSizingForTotalLoad = false;
    1540              : 
    1541              :         // DesOutAirVolFlow
    1542              : 
    1543              :         // loop over heated zones attached to this airloop to find average Room condition, if none heated use cooled zones
    1544              :         // weighted average by zone supply air volume flow rate for all the zones on this coil's air system
    1545         1560 :         Real64 sumT_Vdot(0.0); // numerator for average zone temperature, zone temperature values times zone air volume
    1546         1560 :         Real64 sumW_Vdot(0.0); // numerator average zone humidity ratio, zone hum rat value times zone air volume
    1547         1560 :         Real64 sumLoad(0.0);   // straight total for zone design loads
    1548         1560 :         Real64 sumVdot(0.0);   // denominator for zone-volume weighted averages
    1549              : 
    1550         1560 :         int SysPeakDDnum = finalSysSizing.HeatDDNum;
    1551         1560 :         int SysPeakTimeStepInDay = finalSysSizing.SysHeatCoilTimeStepPk;
    1552         1560 :         if (SysPeakDDnum > 0 && SysPeakTimeStepInDay > 0) { // may be zero if no peak found because of zero system load
    1553         9315 :             for (auto &z : c->zoneNum) {
    1554         7758 :                 auto const &thisCalcZoneSizing = state.dataSize->CalcZoneSizing(SysPeakDDnum, z);
    1555         7758 :                 auto const &thisFinalZoneSizing = state.dataSize->FinalZoneSizing(z);
    1556         7758 :                 Real64 mult = state.dataHeatBal->Zone(z).Multiplier * state.dataHeatBal->Zone(z).ListMultiplier;
    1557         7758 :                 Real64 Tz = thisCalcZoneSizing.HeatZoneTempSeq(SysPeakTimeStepInDay);
    1558         7758 :                 Real64 Vdot_z = thisCalcZoneSizing.HeatFlowSeq(SysPeakTimeStepInDay);
    1559         7758 :                 if (Vdot_z == 0.0) { // take value from final zone sizing
    1560          882 :                     Vdot_z = thisFinalZoneSizing.HeatMassFlow;
    1561          882 :                     if (Vdot_z == 0.0) {
    1562          882 :                         Vdot_z = finalSysSizing.DesHeatVolFlow * state.dataEnvrn->StdRhoAir / c->zoneNum.size();
    1563              :                     }
    1564              :                 }
    1565         7758 :                 Real64 Wz = thisCalcZoneSizing.HeatZoneHumRatSeq(SysPeakTimeStepInDay);
    1566         7758 :                 sumT_Vdot += Tz * Vdot_z * mult;
    1567         7758 :                 sumW_Vdot += Wz * Vdot_z * mult;
    1568         7758 :                 sumVdot += Vdot_z * mult;
    1569         7758 :                 Real64 Qdot_z = thisCalcZoneSizing.HeatLoadSeq(SysPeakTimeStepInDay);
    1570         7758 :                 if (Qdot_z > 0.0) {
    1571         6876 :                     sumLoad += Qdot_z * mult;
    1572              :                 } else {
    1573          882 :                     sumLoad += thisFinalZoneSizing.DesHeatLoad * mult;
    1574              :                 }
    1575         1557 :             }
    1576              :         }
    1577              : 
    1578         1560 :         if (c->zoneNum.size() > 0 && sumVdot > 0.0) {
    1579         1557 :             c->rmPeakTemp = (sumT_Vdot / sumVdot);
    1580         1557 :             c->rmPeakHumRat = (sumW_Vdot / sumVdot);
    1581         3114 :             c->rmPeakRelHum =
    1582         1557 :                 Psychrometrics::PsyRhFnTdbWPb(state, c->rmPeakTemp, c->rmPeakHumRat, state.dataEnvrn->StdBaroPress) * 100.0; // convert to percentage
    1583              :         } else {
    1584            3 :             c->rmPeakTemp = -999.0;
    1585            3 :             c->rmPeakHumRat = -999.0;
    1586            3 :             c->rmPeakRelHum = -999.0;
    1587              :         }
    1588              : 
    1589         1560 :         if (c->coilSizingMethodConcurrence == DataSizing::CoilSizingConcurrence::Coincident) {
    1590          131 :             c->rmSensibleAtPeak = finalSysSizing.SysHeatCoinSpaceSens;
    1591         1429 :         } else if (c->coilSizingMethodConcurrence == DataSizing::CoilSizingConcurrence::NonCoincident) {
    1592         1429 :             c->rmSensibleAtPeak = sumLoad;
    1593              :         }
    1594              : 
    1595         1560 :         if (finalSysSizing.HeatDDNum > 0 && finalSysSizing.HeatDDNum <= state.dataEnvrn->TotDesDays) {
    1596         1557 :             c->coilSensePeakHrMin = PeakHrMinString(state, finalSysSizing.HeatDDNum, finalSysSizing.SysHeatCoilTimeStepPk);
    1597              : 
    1598         1557 :             c->airPeakHrMin = PeakHrMinString(state, finalSysSizing.HeatDDNum, finalSysSizing.SysHeatAirTimeStepPk);
    1599              : 
    1600         1557 :             c->desDayNameAtAirFlowPeak = state.dataWeather->DesDayInput(finalSysSizing.HeatDDNum).Title;
    1601              :         }
    1602              : 
    1603              :         // now set Coil Ent And Lvg Conditions
    1604              : 
    1605         1560 :         if (curOASysNum > 0) { // then this system coil is part of OA system
    1606           57 :             if (c->coilDesEntTemp == -999.0) {
    1607            0 :                 c->coilDesEntTemp = finalSysSizing.HeatOutTemp;
    1608              :             }
    1609           57 :             if (c->coilDesEntHumRat == -999.0) {
    1610            0 :                 c->coilDesEntHumRat = finalSysSizing.HeatOutHumRat;
    1611              :             }
    1612          114 :             c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1613           57 :                 state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1614           57 :             c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1615           57 :             if (c->coilDesLvgTemp == -999.0) {
    1616            0 :                 c->coilDesLvgTemp = finalSysSizing.PreheatTemp;
    1617              :             }
    1618           57 :             if (c->coilDesLvgHumRat == -999.0) {
    1619            0 :                 c->coilDesLvgHumRat = finalSysSizing.PreheatHumRat;
    1620              :             }
    1621          114 :             c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1622           57 :                 state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1623           57 :             c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1624              : 
    1625              :         } else { // part of main air loop
    1626         1503 :             if (c->coilDesEntTemp == -999.0) {
    1627          103 :                 c->coilDesEntTemp = finalSysSizing.HeatMixTemp;
    1628              :             }
    1629         1503 :             if (c->coilDesEntHumRat == -999.0) {
    1630          103 :                 c->coilDesEntHumRat = finalSysSizing.HeatMixHumRat;
    1631              :             }
    1632         3006 :             c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1633         1503 :                 state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1634         1503 :             c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1635         1503 :             if (c->coilDesLvgTemp == -999.0) {
    1636          103 :                 c->coilDesLvgTemp = finalSysSizing.HeatSupTemp;
    1637              :             }
    1638         1503 :             if (c->coilDesLvgHumRat == -999.0) {
    1639          103 :                 c->coilDesLvgHumRat = finalSysSizing.HeatSupHumRat;
    1640              :             }
    1641         3006 :             c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1642         1503 :                 state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1643         1503 :             c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1644         1503 :             if (state.dataAirSystemsData->PrimaryAirSystems(curSysNum).NumOAHeatCoils > 0) { // there is preHeating of the OA stream
    1645           53 :                 c->oaPretreated = true;
    1646              :             }
    1647              :         }
    1648              : 
    1649         3123 :     } else if (curZoneEqNum > 0 && allocated(state.dataSize->FinalZoneSizing)) {
    1650         2793 :         auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum);
    1651         2793 :         c->zoneNum.resize(1);
    1652         2793 :         c->zoneName.resize(1);
    1653         2793 :         c->zoneNum[0] = curZoneEqNum;
    1654         2793 :         if (allocated(state.dataZoneEquip->ZoneEquipConfig)) {
    1655         2793 :             c->zoneName[0] = state.dataZoneEquip->ZoneEquipConfig(curZoneEqNum).ZoneName;
    1656              :         }
    1657         2793 :         c->desDayNameAtSensPeak = finalZoneSizing.HeatDesDay;
    1658         2793 :         c->oaPeakTemp = finalZoneSizing.OutTempAtHeatPeak;
    1659         2793 :         c->oaPeakHumRat = finalZoneSizing.OutHumRatAtHeatPeak;
    1660         2793 :         c->raPeakTemp = finalZoneSizing.ZoneRetTempAtHeatPeak;
    1661         2793 :         c->raPeakHumRat = finalZoneSizing.ZoneHumRatAtHeatPeak;
    1662         2793 :         c->rmPeakTemp = finalZoneSizing.ZoneTempAtHeatPeak;
    1663         2793 :         c->rmPeakHumRat = finalZoneSizing.ZoneHumRatAtHeatPeak;
    1664         5586 :         c->rmPeakRelHum =
    1665         2793 :             Psychrometrics::PsyRhFnTdbWPb(state, c->rmPeakTemp, c->rmPeakHumRat, state.dataEnvrn->StdBaroPress) * 100.0; // convert to percentage
    1666         2793 :         if (finalZoneSizing.HeatDDNum > 0 && finalZoneSizing.HeatDDNum <= state.dataEnvrn->TotDesDays) {
    1667         2793 :             c->coilSensePeakHrMin = PeakHrMinString(state, finalZoneSizing.HeatDDNum, finalZoneSizing.TimeStepNumAtHeatMax);
    1668         2793 :             c->airPeakHrMin = PeakHrMinString(state, finalZoneSizing.HeatDDNum, finalZoneSizing.TimeStepNumAtHeatMax);
    1669              :         }
    1670         2793 :         c->desDayNameAtAirFlowPeak = finalZoneSizing.HeatDesDay;
    1671              : 
    1672         2793 :         c->rmSensibleAtPeak = finalZoneSizing.DesHeatLoad;
    1673              : 
    1674         2793 :         auto const &zoneEqSizing = state.dataSize->ZoneEqSizing(curZoneEqNum);
    1675         2793 :         if (zoneEqSizing.OAVolFlow > 0.0) {
    1676          283 :             c->oaPeakVolFlow = zoneEqSizing.OAVolFlow;
    1677         2510 :         } else if (zoneEqSizing.ATMixerVolFlow > 0.0) {
    1678           48 :             c->oaPeakVolFlow = zoneEqSizing.ATMixerVolFlow;
    1679              :         } else {
    1680         2462 :             c->oaPeakVolFlow = 0.0;
    1681              :         }
    1682              :         // coil entering conditions depend on the type of zone equipment involved
    1683              :         // set typeof_Coil integer
    1684         2793 :         if (state.dataSize->TermUnitIU) {      // an unpowered induction terminal unit
    1685            4 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1686            0 :                 auto const &thisTermUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum);
    1687            0 :                 c->coilDesEntTemp = thisTermUnitFinalZoneSizing.DesHeatCoilInTempTU;
    1688            0 :                 c->coilDesEntHumRat = thisTermUnitFinalZoneSizing.DesHeatCoilInHumRatTU;
    1689              :             }
    1690         2789 :         } else if (state.dataSize->TermUnitSingDuct) {
    1691         1981 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1692           14 :                 auto const &thisTermUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum);
    1693           14 :                 c->coilDesEntTemp = thisTermUnitFinalZoneSizing.DesHeatCoilInTempTU;
    1694           14 :                 c->coilDesEntHumRat = thisTermUnitFinalZoneSizing.DesHeatCoilInHumRatTU;
    1695              :             }
    1696          808 :         } else if (state.dataSize->TermUnitPIU) {
    1697           57 :             auto const &thisTermUnitSizing = state.dataSize->TermUnitSizing(state.dataSize->CurTermUnitSizingNum);
    1698           57 :             Real64 MinPriFlowFrac = thisTermUnitSizing.MinPriFlowFrac;
    1699           57 :             if (thisTermUnitSizing.InducesPlenumAir) {
    1700           19 :                 if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1701            0 :                     auto const &termUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum);
    1702            0 :                     c->coilDesEntTemp = (termUnitFinalZoneSizing.DesHeatCoilInTempTU * MinPriFlowFrac) +
    1703            0 :                                         (termUnitFinalZoneSizing.ZoneRetTempAtHeatPeak * (1.0 - MinPriFlowFrac));
    1704            0 :                     c->coilDesEntHumRat = (termUnitFinalZoneSizing.DesHeatCoilInHumRatTU * MinPriFlowFrac) +
    1705            0 :                                           (termUnitFinalZoneSizing.ZoneHumRatAtHeatPeak * (1.0 - MinPriFlowFrac));
    1706              :                 }
    1707              :             } else {
    1708           38 :                 if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1709            0 :                     auto const &thisTermUnitFinalZoneSizing = state.dataSize->TermUnitFinalZoneSizing(state.dataSize->CurTermUnitSizingNum);
    1710            0 :                     c->coilDesEntTemp = (thisTermUnitFinalZoneSizing.DesHeatCoilInTempTU * MinPriFlowFrac) +
    1711            0 :                                         (thisTermUnitFinalZoneSizing.ZoneTempAtHeatPeak * (1.0 - MinPriFlowFrac));
    1712            0 :                     c->coilDesEntHumRat = (thisTermUnitFinalZoneSizing.DesHeatCoilInHumRatTU * MinPriFlowFrac) +
    1713            0 :                                           (thisTermUnitFinalZoneSizing.ZoneHumRatAtHeatPeak * (1.0 - MinPriFlowFrac));
    1714              :                 }
    1715              :             }
    1716          751 :         } else if (state.dataSize->ZoneEqFanCoil) {
    1717           73 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1718            0 :                 Real64 desOAFlowFrac = 0.0;
    1719            0 :                 if (zoneEqSizing.OAVolFlow > 0.0 && finalZoneSizing.DesHeatMassFlow > 0.0) {
    1720            0 :                     desOAFlowFrac = std::min(state.dataEnvrn->StdRhoAir * zoneEqSizing.OAVolFlow / finalZoneSizing.DesHeatMassFlow, 1.0);
    1721              :                 } else {
    1722            0 :                     desOAFlowFrac = finalZoneSizing.DesHeatOAFlowFrac;
    1723              :                 }
    1724            0 :                 c->coilDesEntTemp = desOAFlowFrac * finalZoneSizing.OutTempAtHeatPeak + (1.0 - desOAFlowFrac) * finalZoneSizing.ZoneTempAtHeatPeak;
    1725            0 :                 c->coilDesEntHumRat =
    1726            0 :                     desOAFlowFrac * finalZoneSizing.OutHumRatAtHeatPeak + (1.0 - desOAFlowFrac) * finalZoneSizing.ZoneHumRatAtHeatPeak;
    1727              :             }
    1728          678 :         } else if (state.dataSize->ZoneEqDXCoil) {
    1729          588 :             if (zoneEqSizing.OAVolFlow > 0.0) {
    1730          236 :                 if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1731           90 :                     c->coilDesEntTemp = finalZoneSizing.DesHeatCoilInTemp;
    1732              :                 }
    1733          236 :                 if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly by setCoilEntAirHumRat
    1734           90 :                     c->coilDesEntHumRat = finalZoneSizing.DesHeatCoilInHumRat;
    1735              :                 }
    1736              :             } else {
    1737          352 :                 if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1738          329 :                     c->coilDesEntTemp = finalZoneSizing.ZoneTempAtHeatPeak;
    1739              :                 }
    1740          352 :                 if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly by setCoilEntAirHumRat
    1741          329 :                     c->coilDesEntHumRat = finalZoneSizing.ZoneHumRatAtHeatPeak;
    1742              :                 }
    1743              :             }
    1744              :         } else {
    1745           90 :             if (c->coilDesEntTemp == -999.0) { // don't overwrite if already set directly by setCoilEntAirTemp
    1746           17 :                 c->coilDesEntTemp = finalZoneSizing.DesHeatCoilInTemp;
    1747              :             }
    1748           90 :             if (c->coilDesEntHumRat == -999.0) { // don't overwrite if already set directly by setCoilEntAirHumRat
    1749           17 :                 c->coilDesEntHumRat = finalZoneSizing.DesHeatCoilInHumRat;
    1750              :             }
    1751              :         }
    1752              : 
    1753         2793 :         if (c->coilDesEntTemp > -999.0 && c->coilDesEntHumRat > -999.0) {
    1754         5584 :             c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1755         2792 :                 state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1756         2792 :             c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1757              :         }
    1758              : 
    1759         2793 :         if (c->coilDesLvgTemp == -999.0) { // don't overwrite if already set directly by setCoilLvgAirTemp
    1760         2255 :             c->coilDesLvgTemp = finalZoneSizing.HeatDesTemp;
    1761              :         }
    1762         2793 :         if (c->coilDesLvgHumRat == -999.0) { // don't overwrite if already set directly by setCoilLvgAirHumRat
    1763         2255 :             c->coilDesLvgHumRat = finalZoneSizing.HeatDesHumRat;
    1764              :         }
    1765         5586 :         c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1766         2793 :             state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1767         2793 :         c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1768          330 :     } else if (curOASysNum > 0 && c->airloopNum > int(state.dataSize->FinalSysSizing.size())) {
    1769            7 :         if (!state.dataAirLoopHVACDOAS->airloopDOAS.empty()) {
    1770            1 :             c->oASysNum = curOASysNum; // where should this get set? It's -999 here.
    1771            1 :             int DOASSysNum = state.dataAirLoop->OutsideAirSys(curOASysNum).AirLoopDOASNum;
    1772            1 :             c->coilDesEntTemp = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].HeatOutTemp;
    1773            1 :             c->coilDesEntHumRat = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].HeatOutHumRat;
    1774            1 :             if (c->coilDesEntTemp > -999.0 && c->coilDesEntHumRat > -999.0) {
    1775            2 :                 c->coilDesEntWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1776            1 :                     state, c->coilDesEntTemp, c->coilDesEntHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1777            1 :                 c->coilDesEntEnth = Psychrometrics::PsyHFnTdbW(c->coilDesEntTemp, c->coilDesEntHumRat);
    1778              :             }
    1779            1 :             c->coilDesLvgTemp = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].PreheatTemp;
    1780            1 :             c->coilDesLvgHumRat = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].PreheatHumRat;
    1781            1 :             if (c->coilDesLvgTemp > -999.0 && c->coilDesLvgHumRat > -999.0) {
    1782            2 :                 c->coilDesLvgWetBulb = Psychrometrics::PsyTwbFnTdbWPb(
    1783            1 :                     state, c->coilDesLvgTemp, c->coilDesLvgHumRat, state.dataEnvrn->StdBaroPress, "ReportCoilSelection::setCoilHeatingCapacity");
    1784            1 :                 c->coilDesLvgEnth = Psychrometrics::PsyHFnTdbW(c->coilDesLvgTemp, c->coilDesLvgHumRat);
    1785              :             }
    1786            1 :             DataSizing::SizingConcurrence sizMethod = DataSizing::SizingConcurrence::Invalid;
    1787            1 :             bool sizMethodsAreTheSame = true;
    1788            6 :             for (int airLoopNum = 0; airLoopNum < state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].NumOfAirLoops; ++airLoopNum) {
    1789            5 :                 int actualAirLoopNum = state.dataAirLoopHVACDOAS->airloopDOAS[DOASSysNum].m_AirLoopNum[airLoopNum];
    1790            5 :                 if (airLoopNum == 0) {
    1791            1 :                     sizMethod = state.dataSize->FinalSysSizing(actualAirLoopNum).SizingOption;
    1792              :                 } else {
    1793            4 :                     if (sizMethod != state.dataSize->FinalSysSizing(actualAirLoopNum).SizingOption) {
    1794            0 :                         sizMethodsAreTheSame = false;
    1795              :                     }
    1796              :                 }
    1797              :             }
    1798            1 :             if (sizMethodsAreTheSame) {
    1799            1 :                 c->coilSizingMethodConcurrence = static_cast<DataSizing::CoilSizingConcurrence>(sizMethod);
    1800              :             } else {
    1801            0 :                 c->coilSizingMethodConcurrence = DataSizing::CoilSizingConcurrence::Combination;
    1802              :             }
    1803              :         }
    1804              :     } else {
    1805              :         // do nothing
    1806              :     }
    1807              : 
    1808         4683 :     if (state.dataSize->DataCoilIsSuppHeater) {
    1809          435 :         c->isSupplementalHeater = true;
    1810              :     }
    1811              :     // some heating coils only use this routine, so set air flow if not yet set
    1812         4683 :     if (c->coilDesVolFlow <= 0.0) {
    1813          854 :         if (state.dataSize->DataFlowUsedForSizing > 0.0) { // flow has been set in global, so use it
    1814           63 :             c->coilDesVolFlow = state.dataSize->DataFlowUsedForSizing;
    1815          791 :         } else if (curZoneEqNum > 0 && allocated(state.dataSize->FinalZoneSizing)) {
    1816          365 :             auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(curZoneEqNum);
    1817          365 :             if (finalZoneSizing.DesHeatMassFlow >= HVAC::SmallMassFlow) {
    1818          355 :                 c->coilDesMassFlow = finalZoneSizing.DesHeatMassFlow;
    1819          355 :                 c->coilDesVolFlow = c->coilDesMassFlow / state.dataEnvrn->StdRhoAir;
    1820              :             }
    1821          426 :         } else if (curSysNum > 0 && curSysNum <= int(state.dataSize->FinalSysSizing.size())) {
    1822          134 :             auto const &finalSysSizing = state.dataSize->FinalSysSizing(curSysNum);
    1823          134 :             if (curOASysNum > 0 && allocated(state.dataSize->OASysEqSizing)) {
    1824            0 :                 auto const &oASysEqSizing = state.dataSize->OASysEqSizing(curSysNum);
    1825            0 :                 if (oASysEqSizing.AirFlow) {
    1826            0 :                     c->coilDesVolFlow = oASysEqSizing.AirVolFlow;
    1827            0 :                 } else if (oASysEqSizing.HeatingAirFlow) {
    1828            0 :                     c->coilDesVolFlow = oASysEqSizing.HeatingAirVolFlow;
    1829              :                 } else {
    1830            0 :                     c->coilDesVolFlow = finalSysSizing.DesOutAirVolFlow;
    1831              :                 }
    1832              :             } else {
    1833          134 :                 if (state.dataSize->DataFlowUsedForSizing > 0.0) {
    1834            0 :                     c->coilDesVolFlow = state.dataSize->DataFlowUsedForSizing;
    1835          134 :                 } else if (curSysNum > 0 && allocated(state.dataSize->UnitarySysEqSizing)) {
    1836          134 :                     auto const &unitarySysEqSizing = state.dataSize->UnitarySysEqSizing(curSysNum);
    1837          134 :                     if (unitarySysEqSizing.AirFlow) {
    1838           32 :                         c->coilDesVolFlow = unitarySysEqSizing.AirVolFlow;
    1839          102 :                     } else if (unitarySysEqSizing.HeatingAirFlow) {
    1840            0 :                         c->coilDesVolFlow = unitarySysEqSizing.HeatingAirVolFlow;
    1841              :                     }
    1842              :                 } else {
    1843            0 :                     if (state.dataSize->CurDuctType == HVAC::AirDuctType::Main) {
    1844            0 :                         if (finalSysSizing.SysAirMinFlowRat > 0.0 && !state.dataSize->DataDesicRegCoil) {
    1845            0 :                             c->coilDesVolFlow = finalSysSizing.SysAirMinFlowRat * finalSysSizing.DesMainVolFlow;
    1846              :                         } else {
    1847            0 :                             c->coilDesVolFlow = finalSysSizing.DesMainVolFlow;
    1848              :                         }
    1849            0 :                     } else if (state.dataSize->CurDuctType == HVAC::AirDuctType::Cooling) {
    1850            0 :                         if (finalSysSizing.SysAirMinFlowRat > 0.0 && !state.dataSize->DataDesicRegCoil) {
    1851            0 :                             c->coilDesVolFlow = finalSysSizing.SysAirMinFlowRat * finalSysSizing.DesCoolVolFlow;
    1852              :                         } else {
    1853            0 :                             c->coilDesVolFlow = finalSysSizing.DesCoolVolFlow;
    1854              :                         }
    1855            0 :                     } else if (state.dataSize->CurDuctType == HVAC::AirDuctType::Heating) {
    1856            0 :                         c->coilDesVolFlow = finalSysSizing.DesHeatVolFlow;
    1857            0 :                     } else if (state.dataSize->CurDuctType == HVAC::AirDuctType::Other) {
    1858            0 :                         c->coilDesVolFlow = finalSysSizing.DesMainVolFlow;
    1859              :                     } else {
    1860            0 :                         c->coilDesVolFlow = finalSysSizing.DesMainVolFlow;
    1861              :                     }
    1862              :                 }
    1863              :             }
    1864              :         }
    1865          854 :         c->coilDesMassFlow = c->coilDesVolFlow * state.dataEnvrn->StdRhoAir;
    1866              :     }
    1867              : 
    1868              :     // calc sensible capacity from inlet outlet
    1869         4683 :     c->cpMoistAir = Psychrometrics::PsyCpAirFnW(c->coilDesLvgHumRat);
    1870              :     // this is not generally correct but okay for heating coils
    1871         4683 :     c->coilSensCapAtPeak = std::abs(c->cpMoistAir * c->coilDesMassFlow * (c->coilDesLvgTemp - c->coilDesEntTemp));
    1872         4683 :     c->coilSensCapAtPeak = min(c->coilSensCapAtPeak, c->coilTotCapAtPeak);
    1873         4683 : }
    1874              : 
    1875          560 : void ReportCoilSelection::setCoilWaterCoolingCapacity(EnergyPlusData &state,
    1876              :                                                       std::string const &coilName,  // user-defined name of the coil
    1877              :                                                       std::string const &coilType,  // idf input object class name of coil
    1878              :                                                       Real64 const totalCoolingCap, // {W} coil cooling capacity
    1879              :                                                       bool const isAutoSize,        // true if value was autosized
    1880              :                                                       int const inletNodeNum,       // coil chw inlet node num
    1881              :                                                       int const outletNodeNum,      // coil chw outlet node num
    1882              :                                                       int const dataWaterLoopNum    // plant loop structure index
    1883              : )
    1884              : {
    1885          560 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1886          560 :     auto &c(coilSelectionDataObjs[index]);
    1887          560 :     c->coilTotCapAtPeak = totalCoolingCap;
    1888          560 :     c->capIsAutosized = isAutoSize;
    1889          560 :     if ((state.dataSize->NumPltSizInput > 0) && (inletNodeNum > 0) && (outletNodeNum > 0)) {
    1890          469 :         bool errorsfound = false;
    1891          469 :         c->pltSizNum = PlantUtilities::MyPlantSizingIndex(state, "chilled water coil", coilName, inletNodeNum, outletNodeNum, errorsfound);
    1892              :     } else {
    1893           91 :         c->pltSizNum = -999;
    1894              :     }
    1895          560 :     c->waterLoopNum = dataWaterLoopNum;
    1896          560 : }
    1897              : 
    1898         2551 : void ReportCoilSelection::setCoilWaterHeaterCapacityNodeNums(EnergyPlusData &state,
    1899              :                                                              std::string const &coilName,  // user-defined name of the coil
    1900              :                                                              std::string const &coilType,  // idf input object class name of coil
    1901              :                                                              Real64 const totalHeatingCap, // {W} coil Heating capacity
    1902              :                                                              bool const isAutoSize,        // true if value was autosized
    1903              :                                                              int const inletNodeNum,       // coil chw inlet node num
    1904              :                                                              int const outletNodeNum,      // coil chw outlet node num
    1905              :                                                              int const dataWaterLoopNum    // plant loop structure index
    1906              : )
    1907              : {
    1908         2551 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1909         2551 :     auto &c(coilSelectionDataObjs[index]);
    1910         2551 :     c->coilTotCapAtPeak = totalHeatingCap;
    1911         2551 :     c->capIsAutosized = isAutoSize;
    1912         2551 :     if ((state.dataSize->NumPltSizInput > 0) && (inletNodeNum > 0) && (outletNodeNum > 0)) {
    1913         2275 :         bool errorsfound = false;
    1914         2275 :         c->pltSizNum = PlantUtilities::MyPlantSizingIndex(state, "hot water coil", coilName, inletNodeNum, outletNodeNum, errorsfound);
    1915              :     } else {
    1916          276 :         c->pltSizNum = -999;
    1917              :     }
    1918         2551 :     c->waterLoopNum = dataWaterLoopNum;
    1919         2551 : }
    1920              : 
    1921         1840 : void ReportCoilSelection::setCoilWaterHeaterCapacityPltSizNum(EnergyPlusData &state,
    1922              :                                                               std::string const &coilName,  // user-defined name of the coil
    1923              :                                                               std::string const &coilType,  // idf input object class name of coil
    1924              :                                                               Real64 const totalHeatingCap, // {W} coil Heating capacity
    1925              :                                                               bool const isAutoSize,        // true if value was autosized
    1926              :                                                               int const dataPltSizNum,      // plant sizing structure index
    1927              :                                                               int const dataWaterLoopNum    // plant loop structure index
    1928              : )
    1929              : {
    1930         1840 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1931         1840 :     auto &c(coilSelectionDataObjs[index]);
    1932         1840 :     c->coilTotCapAtPeak = totalHeatingCap;
    1933         1840 :     c->capIsAutosized = isAutoSize;
    1934         1840 :     c->pltSizNum = dataPltSizNum;
    1935         1840 :     c->waterLoopNum = dataWaterLoopNum;
    1936         1840 : }
    1937              : 
    1938         2224 : void ReportCoilSelection::setCoilUA(EnergyPlusData &state,
    1939              :                                     std::string const &coilName,            // user-defined name of the coil
    1940              :                                     std::string const &coilType,            // idf input object class name of coil
    1941              :                                     Real64 const UAvalue,                   // [W/k] UA value for coil,
    1942              :                                     Real64 const dataCapacityUsedForSizing, // [W] sizing global
    1943              :                                     bool const isAutoSize,                  // true if value was autosized
    1944              :                                     int const curSysNum,                    // airloop system number index, if non zero
    1945              :                                     int const curZoneEqNum                  // zone equipment list index, if non-zero
    1946              : )
    1947              : {
    1948         2224 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1949         2224 :     auto &c(coilSelectionDataObjs[index]);
    1950         2224 :     c->coilUA = UAvalue;
    1951         2224 :     c->coilTotCapAtPeak = dataCapacityUsedForSizing;
    1952         2224 :     c->capIsAutosized = isAutoSize;
    1953         2224 :     c->airloopNum = curSysNum;
    1954         2224 :     doAirLoopSetup(state, index);
    1955         2224 :     c->zoneEqNum = curZoneEqNum;
    1956         2224 : }
    1957              : 
    1958         5842 : void ReportCoilSelection::setCoilReheatMultiplier(EnergyPlusData &state,
    1959              :                                                   std::string const &coilName, // user-defined name of the coil
    1960              :                                                   std::string const &coilType, // idf input object class name of coil
    1961              :                                                   Real64 const multiplierReheatLoad)
    1962              : {
    1963         5842 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1964         5842 :     auto &c(coilSelectionDataObjs[index]);
    1965         5842 :     c->reheatLoadMult = multiplierReheatLoad;
    1966         5842 : }
    1967              : 
    1968         8124 : void ReportCoilSelection::setCoilSupplyFanInfo(EnergyPlusData &state,
    1969              :                                                std::string const &coilName, // user-defined name of the coil
    1970              :                                                std::string const &coilType, // idf input object class name of coil
    1971              :                                                std::string const &fanName,
    1972              :                                                HVAC::FanType fanType,
    1973              :                                                int fanIndex)
    1974              : {
    1975         8124 :     if (fanName.empty()) {
    1976          708 :         return;
    1977              :     }
    1978         7416 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1979         7416 :     auto &c(coilSelectionDataObjs[index]);
    1980         7416 :     c->fanAssociatedWithCoilName = fanName;
    1981         7416 :     c->supFanType = fanType;
    1982         7416 :     c->supFanNum = fanIndex;
    1983         7416 :     if (c->supFanNum == 0) {
    1984            0 :         c->supFanNum = Fans::GetFanIndex(state, fanName);
    1985              :     }
    1986              : }
    1987              : 
    1988         3091 : void ReportCoilSelection::setCoilEqNum(EnergyPlusData &state,
    1989              :                                        std::string const &coilName,
    1990              :                                        std::string const &coilType,
    1991              :                                        int const curSysNum,
    1992              :                                        int const curOASysNum,
    1993              :                                        int const curZoneEqNum)
    1994              : {
    1995         3091 :     int index = getIndexForOrCreateDataObjFromCoilName(state, coilName, coilType);
    1996         3091 :     auto &c(coilSelectionDataObjs[index]);
    1997         3091 :     c->airloopNum = curSysNum;
    1998         3091 :     c->oASysNum = curOASysNum;
    1999         3091 :     c->zoneEqNum = curZoneEqNum;
    2000         3091 : }
    2001              : 
    2002        17272 : std::string ReportCoilSelection::getTimeText(EnergyPlusData &state, int const timeStepAtPeak)
    2003              : {
    2004        17272 :     std::string returnString = "";
    2005              : 
    2006        17272 :     if (timeStepAtPeak == 0) {
    2007            0 :         return returnString;
    2008              :     }
    2009              : 
    2010              :     // Scan timesteps of 24-hr day to match up correct hour and minute
    2011        17272 :     int minutes(0);
    2012        17272 :     int timeStepIndex(0);
    2013              :     int hourPrint;
    2014       431800 :     for (int hourCounter = 1; hourCounter <= 24; ++hourCounter) {
    2015      2409720 :         for (int timeStepCounter = 1; timeStepCounter <= state.dataGlobal->TimeStepsInHour; ++timeStepCounter) {
    2016      1995192 :             ++timeStepIndex;
    2017      1995192 :             minutes += state.dataGlobal->MinutesInTimeStep;
    2018      1995192 :             if (minutes == 60) {
    2019       414528 :                 minutes = 0;
    2020       414528 :                 hourPrint = hourCounter;
    2021              :             } else {
    2022      1580664 :                 hourPrint = hourCounter - 1;
    2023              :             }
    2024      1995192 :             if (timeStepIndex == timeStepAtPeak) {
    2025        17272 :                 returnString = format(DataSizing::PeakHrMinFmt, hourPrint, minutes);
    2026              :             }
    2027              :         }
    2028              :     }
    2029              : 
    2030        17272 :     return returnString;
    2031            0 : }
    2032              : 
    2033         2145 : bool ReportCoilSelection::isCompTypeFan(std::string const &compType // string component type, input object class name
    2034              : )
    2035              : {
    2036              :     // if compType name is one of the fan objects, then return true
    2037         2145 :     if (Util::SameString(compType, "Fan:SystemModel")) {
    2038          228 :         return true;
    2039         1917 :     } else if (Util::SameString(compType, "Fan:ComponentModel")) {
    2040            5 :         return true;
    2041         1912 :     } else if (Util::SameString(compType, "Fan:OnOff")) {
    2042         1009 :         return true;
    2043          903 :     } else if (Util::SameString(compType, "Fan:ConstantVolume")) {
    2044          493 :         return true;
    2045          410 :     } else if (Util::SameString(compType, "Fan:VariableVolume")) {
    2046          410 :         return true;
    2047              :     } else {
    2048            0 :         return false;
    2049              :     }
    2050              : }
    2051              : 
    2052          345 : bool ReportCoilSelection::isCompTypeCoil(std::string const &compType // string component type, input object class name
    2053              : )
    2054              : {
    2055              :     // if compType name is one of the coil objects, then return true
    2056          345 :     bool found(false);
    2057        10803 :     for (int loop = 1; loop <= HVAC::NumAllCoilTypes; ++loop) {
    2058        10655 :         if (Util::SameString(compType, HVAC::cAllCoilTypes(loop))) {
    2059          197 :             found = true;
    2060          197 :             break;
    2061              :         }
    2062              :     }
    2063          345 :     return found;
    2064              : }
    2065              : 
    2066          189 : void ReportCoilSelection::setZoneLatentLoadCoolingIdealPeak(int const zoneIndex, Real64 const zoneCoolingLatentLoad)
    2067              : {
    2068              :     // loop over all the coils and the zones in the coils and if this zone index is in the coil
    2069         4575 :     for (auto const &c : coilSelectionDataObjs) {
    2070              : 
    2071         4386 :         if (c->isCooling) {
    2072         2577 :             for (std::size_t zoneInd = 0; zoneInd < c->zoneNum.size(); ++zoneInd) {
    2073         2502 :                 if (zoneIndex == c->zoneNum[zoneInd]) {
    2074          363 :                     c->rmLatentAtPeak += zoneCoolingLatentLoad;
    2075          363 :                     break;
    2076              :                 }
    2077              :             }
    2078              :         }
    2079          189 :     }
    2080          189 : }
    2081              : 
    2082          189 : void ReportCoilSelection::setZoneLatentLoadHeatingIdealPeak(int const zoneIndex, Real64 const zoneHeatingLatentLoad)
    2083              : {
    2084              :     // loop over all the coils and the zones in the coils and if this zone index is in the coil
    2085         4575 :     for (auto const &c : coilSelectionDataObjs) {
    2086              : 
    2087         4386 :         if (c->isHeating) {
    2088         9373 :             for (std::size_t zoneInd = 0; zoneInd < c->zoneNum.size(); ++zoneInd) {
    2089         5887 :                 if (zoneIndex == c->zoneNum[zoneInd]) {
    2090          462 :                     c->rmLatentAtPeak += zoneHeatingLatentLoad;
    2091          462 :                     break;
    2092              :                 }
    2093              :             }
    2094              :         }
    2095          189 :     }
    2096          189 : }
    2097              : 
    2098              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1