LCOV - code coverage report
Current view: top level - EnergyPlus - ReportCoilSelection.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 1064 1225 86.9 %
Date: 2023-01-17 19:17:23 Functions: 36 37 97.3 %

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

Generated by: LCOV version 1.13