LCOV - code coverage report
Current view: top level - EnergyPlus - ReportCoilSelection.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 87.5 % 1257 1100
Test Date: 2025-05-22 16:09:37 Functions: 97.6 % 41 40

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

Generated by: LCOV version 2.0-1