LCOV - code coverage report
Current view: top level - EnergyPlus - InternalHeatGains.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 83.6 % 4624 3865
Test Date: 2025-06-02 07:23:51 Functions: 100.0 % 37 37

            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 <cmath>
      50              : #include <map>
      51              : #include <string>
      52              : 
      53              : // ObjexxFCL Headers
      54              : #include <ObjexxFCL/Array.functions.hh>
      55              : #include <ObjexxFCL/Array1D.hh>
      56              : #include <ObjexxFCL/Fmath.hh>
      57              : 
      58              : // EnergyPlus Headers
      59              : #include <EnergyPlus/CurveManager.hh>
      60              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      61              : #include <EnergyPlus/DataContaminantBalance.hh>
      62              : #include <EnergyPlus/DataEnvironment.hh>
      63              : #include <EnergyPlus/DataGlobalConstants.hh>
      64              : #include <EnergyPlus/DataHVACGlobals.hh>
      65              : #include <EnergyPlus/DataHeatBalSurface.hh>
      66              : #include <EnergyPlus/DataHeatBalance.hh>
      67              : #include <EnergyPlus/DataIPShortCuts.hh>
      68              : #include <EnergyPlus/DataLoopNode.hh>
      69              : #include <EnergyPlus/DataPrecisionGlobals.hh>
      70              : #include <EnergyPlus/DataRoomAirModel.hh>
      71              : #include <EnergyPlus/DataViewFactorInformation.hh>
      72              : #include <EnergyPlus/DataZoneEquipment.hh>
      73              : #include <EnergyPlus/DaylightingDevices.hh>
      74              : #include <EnergyPlus/DaylightingManager.hh>
      75              : #include <EnergyPlus/EMSManager.hh>
      76              : #include <EnergyPlus/ElectricPowerServiceManager.hh>
      77              : #include <EnergyPlus/FuelCellElectricGenerator.hh>
      78              : #include <EnergyPlus/General.hh>
      79              : #include <EnergyPlus/HeatBalanceIntRadExchange.hh>
      80              : #include <EnergyPlus/HeatBalanceInternalHeatGains.hh>
      81              : #include <EnergyPlus/HybridModel.hh>
      82              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      83              : #include <EnergyPlus/InternalHeatGains.hh>
      84              : #include <EnergyPlus/MicroCHPElectricGenerator.hh>
      85              : #include <EnergyPlus/NodeInputManager.hh>
      86              : #include <EnergyPlus/OutputProcessor.hh>
      87              : #include <EnergyPlus/OutputReportPredefined.hh>
      88              : #include <EnergyPlus/OutputReportTabular.hh>
      89              : #include <EnergyPlus/PipeHeatTransfer.hh>
      90              : #include <EnergyPlus/Psychrometrics.hh>
      91              : #include <EnergyPlus/RefrigeratedCase.hh>
      92              : #include <EnergyPlus/ScheduleManager.hh>
      93              : #include <EnergyPlus/SetPointManager.hh>
      94              : #include <EnergyPlus/UtilityRoutines.hh>
      95              : #include <EnergyPlus/WaterThermalTanks.hh>
      96              : #include <EnergyPlus/WaterUse.hh>
      97              : #include <EnergyPlus/ZonePlenum.hh>
      98              : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
      99              : 
     100              : namespace EnergyPlus {
     101              : 
     102              : namespace InternalHeatGains {
     103              :     // Module containing the routines dealing with the internal heat gains
     104              : 
     105              :     // MODULE INFORMATION:
     106              :     //       AUTHOR         Rick Strand
     107              :     //       DATE WRITTEN   August 2000
     108              :     //       MODIFIED       Aug 2005, PGE (Added object names and report variables)
     109              :     //                      Feb 2006, PGE (Added end-use subcategories)
     110              :     //       RE-ENGINEERED  na
     111              : 
     112              :     // PURPOSE OF THIS MODULE:
     113              :     // Part of the heat balance modularization/re-engineering.  Purpose of this
     114              :     // module is to contain the internal heat gain routines in a single location.
     115              : 
     116              :     // METHODOLOGY EMPLOYED:
     117              :     // Routines are called as subroutines to supply the data-only module structures
     118              :     // with the proper values.
     119              : 
     120              :     // REFERENCES:
     121              :     // Legacy BLAST code
     122              : 
     123              :     // OTHER NOTES: none
     124              : 
     125              :     // Using/Aliasing
     126              :     using namespace DataEnvironment;
     127              :     using namespace DataHeatBalance;
     128              :     using namespace DataSurfaces;
     129              : 
     130              :     static constexpr std::array<DataHeatBalance::IntGainType, 1> IntGainTypesPeople = {DataHeatBalance::IntGainType::People};
     131              :     static constexpr std::array<DataHeatBalance::IntGainType, 1> IntGainTypesLight = {DataHeatBalance::IntGainType::Lights};
     132              :     static constexpr std::array<DataHeatBalance::IntGainType, 7> IntGainTypesEquip = {DataHeatBalance::IntGainType::ElectricEquipment,
     133              :                                                                                       DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled,
     134              :                                                                                       DataHeatBalance::IntGainType::GasEquipment,
     135              :                                                                                       DataHeatBalance::IntGainType::HotWaterEquipment,
     136              :                                                                                       DataHeatBalance::IntGainType::SteamEquipment,
     137              :                                                                                       DataHeatBalance::IntGainType::OtherEquipment,
     138              :                                                                                       DataHeatBalance::IntGainType::IndoorGreen};
     139              :     static constexpr std::array<DataHeatBalance::IntGainType, 10> IntGainTypesRefrig = {
     140              :         DataHeatBalance::IntGainType::RefrigerationCase,
     141              :         DataHeatBalance::IntGainType::RefrigerationCompressorRack,
     142              :         DataHeatBalance::IntGainType::RefrigerationSystemAirCooledCondenser,
     143              :         DataHeatBalance::IntGainType::RefrigerationSystemSuctionPipe,
     144              :         DataHeatBalance::IntGainType::RefrigerationSecondaryReceiver,
     145              :         DataHeatBalance::IntGainType::RefrigerationSecondaryPipe,
     146              :         DataHeatBalance::IntGainType::RefrigerationWalkIn,
     147              :         DataHeatBalance::IntGainType::RefrigerationTransSysAirCooledGasCooler,
     148              :         DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeMT,
     149              :         DataHeatBalance::IntGainType::RefrigerationTransSysSuctionPipeLT};
     150              :     static constexpr std::array<DataHeatBalance::IntGainType, 3> IntGainTypesWaterUse = {DataHeatBalance::IntGainType::WaterUseEquipment,
     151              :                                                                                          DataHeatBalance::IntGainType::WaterHeaterMixed,
     152              :                                                                                          DataHeatBalance::IntGainType::WaterHeaterStratified};
     153              :     static constexpr std::array<DataHeatBalance::IntGainType, 20> IntGainTypesHvacLoss = {
     154              :         DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled,
     155              :         DataHeatBalance::IntGainType::ThermalStorageChilledWaterMixed,
     156              :         DataHeatBalance::IntGainType::ThermalStorageChilledWaterStratified,
     157              :         DataHeatBalance::IntGainType::PipeIndoor,
     158              :         DataHeatBalance::IntGainType::Pump_VarSpeed,
     159              :         DataHeatBalance::IntGainType::Pump_ConSpeed,
     160              :         DataHeatBalance::IntGainType::Pump_Cond,
     161              :         DataHeatBalance::IntGainType::PumpBank_VarSpeed,
     162              :         DataHeatBalance::IntGainType::PumpBank_ConSpeed,
     163              :         DataHeatBalance::IntGainType::PlantComponentUserDefined,
     164              :         DataHeatBalance::IntGainType::CoilUserDefined,
     165              :         DataHeatBalance::IntGainType::ZoneHVACForcedAirUserDefined,
     166              :         DataHeatBalance::IntGainType::AirTerminalUserDefined,
     167              :         DataHeatBalance::IntGainType::PackagedTESCoilTank,
     168              :         DataHeatBalance::IntGainType::FanSystemModel,
     169              :         DataHeatBalance::IntGainType::SecCoolingDXCoilSingleSpeed,
     170              :         DataHeatBalance::IntGainType::SecHeatingDXCoilSingleSpeed,
     171              :         DataHeatBalance::IntGainType::SecCoolingDXCoilTwoSpeed,
     172              :         DataHeatBalance::IntGainType::SecCoolingDXCoilMultiSpeed,
     173              :         DataHeatBalance::IntGainType::SecHeatingDXCoilMultiSpeed};
     174              :     static constexpr std::array<DataHeatBalance::IntGainType, 10> IntGainTypesPowerGen = {
     175              :         DataHeatBalance::IntGainType::GeneratorFuelCell,
     176              :         DataHeatBalance::IntGainType::GeneratorMicroCHP,
     177              :         DataHeatBalance::IntGainType::ElectricLoadCenterTransformer,
     178              :         DataHeatBalance::IntGainType::ElectricLoadCenterInverterSimple,
     179              :         DataHeatBalance::IntGainType::ElectricLoadCenterInverterFunctionOfPower,
     180              :         DataHeatBalance::IntGainType::ElectricLoadCenterInverterLookUpTable,
     181              :         DataHeatBalance::IntGainType::ElectricLoadCenterStorageLiIonNmcBattery,
     182              :         DataHeatBalance::IntGainType::ElectricLoadCenterStorageBattery,
     183              :         DataHeatBalance::IntGainType::ElectricLoadCenterStorageSimple,
     184              :         DataHeatBalance::IntGainType::ElectricLoadCenterConverter};
     185              :     // Explicitly list internal gains not gathered here
     186              :     static constexpr std::array<DataHeatBalance::IntGainType, 3> ExcludedIntGainTypes = {
     187              :         DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide,
     188              :         DataHeatBalance::IntGainType::DaylightingDeviceTubular,
     189              :         DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkGenericContam};
     190              : 
     191      2829209 :     void ManageInternalHeatGains(EnergyPlusData &state,
     192              :                                  ObjexxFCL::Optional_bool_const InitOnly) // when true, just calls the get input, if appropriate and returns.
     193              :     {
     194              : 
     195              :         // SUBROUTINE INFORMATION:
     196              :         //       AUTHOR         Rick Strand
     197              :         //       DATE WRITTEN   May 2000
     198              :         //       MODIFIED       Mar 2004, FCW: move call to DayltgElecLightingControl from InitSurfaceHeatBalance
     199              :         //       RE-ENGINEERED  na
     200              : 
     201              :         // PURPOSE OF THIS SUBROUTINE:
     202              :         // This is the main driver subroutine for the internal heat gains.
     203              : 
     204      2829209 :         if (state.dataInternalHeatGains->GetInternalHeatGainsInputFlag) {
     205          801 :             GetInternalHeatGainsInput(state);
     206          801 :             state.dataInternalHeatGains->GetInternalHeatGainsInputFlag = false;
     207              :         }
     208              : 
     209      2829209 :         if (present(InitOnly)) {
     210      2829209 :             if (InitOnly) {
     211          801 :                 return;
     212              :             }
     213              :         }
     214              : 
     215      2828408 :         InitInternalHeatGains(state);
     216              : 
     217      2828408 :         ReportInternalHeatGains(state);
     218              : 
     219      2828408 :         CheckReturnAirHeatGain(state);
     220              : 
     221              :         // for the load component report, gather the load components for each timestep but not when doing pulse
     222      2828408 :         if (state.dataGlobal->ZoneSizingCalc) {
     223       830322 :             GatherComponentLoadsIntGain(state);
     224              :         }
     225              :     }
     226              : 
     227          801 :     void GetInternalHeatGainsInput(EnergyPlusData &state)
     228              :     {
     229              : 
     230              :         // SUBROUTINE INFORMATION:
     231              :         //       AUTHOR         Linda K. Lawrie
     232              :         //       DATE WRITTEN   September 1997
     233              :         //       MODIFIED       September 1998, FW
     234              :         //                      May 2009, BG: added calls to setup for possible EMS override
     235              :         //       RE-ENGINEERED  August 2000, RKS
     236              : 
     237              :         // PURPOSE OF THIS SUBROUTINE:
     238              :         // This subroutine gets the Internal Heat Gain Data for the Zones.
     239              :         // Sets up the various data that will be used later with the
     240              :         // schedulemanager to determine the actual values.
     241              : 
     242              :         // METHODOLOGY EMPLOYED:
     243              :         // The GetObjectItem routines are employed to retrieve the data.
     244              : 
     245              :         // REFERENCES:
     246              :         // IDD Objects:
     247              :         // People
     248              :         // Lights
     249              :         // ElectricEquipment
     250              :         // GasEquipment
     251              :         // SteamEquipment
     252              :         // HotWaterEquipment
     253              :         // OtherEquipment
     254              :         // ElectricEquipment:ITE:AirCooled
     255              :         // ZoneBaseboard:OutdoorTemperatureControlled
     256              : 
     257              :         // Using/Aliasing
     258              :         using namespace OutputReportPredefined;
     259              :         using namespace DataLoopNode;
     260              :         using Curve::GetCurveIndex;
     261              :         using NodeInputManager::GetOnlySingleNode;
     262              : 
     263              :         // SUBROUTINE PARAMETER DEFINITIONS:
     264              :         static constexpr std::string_view RoutineName("GetInternalHeatGains: ");
     265              :         static constexpr std::string_view routineName = "GetInternalHeatGains";
     266              : 
     267              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     268              :         int IOStat;
     269              : 
     270              :         //   Variables for reporting nominal internal gains
     271              :         Real64 LightTot; // Total Lights for calculating lights per square meter
     272              :         Real64 ElecTot;  // Total Electric Load for calculating electric per square meter
     273              :         Real64 GasTot;   // Total Gas load for calculating gas per square meter
     274              :         Real64 OthTot;   // Total Other load for calculating other load per square meter
     275              :         Real64 HWETot;   // Total Hot Water Equipment for calculating HWE per square meter
     276              :         Real64 StmTot;   // Total Steam for calculating Steam per square meter
     277              : 
     278              :         // Formats
     279              :         static constexpr std::string_view Format_720(" Zone Internal Gains Nominal, {},{:.2R},{:.1R},");
     280              :         static constexpr std::string_view Format_722(" {} Internal Gains Nominal, {},{},{},{:.2R},{:.1R},");
     281              :         static constexpr std::string_view Format_723(
     282              :             "! <{} Internal Gains Nominal>,Name,Schedule Name,Zone Name,Zone Floor Area {{m2}},# Zone Occupants,{}");
     283              :         static constexpr std::string_view Format_724(" {}, {}\n");
     284              : 
     285        32114 :         auto print_and_divide_if_greater_than_zero = [&](const Real64 numerator, const Real64 denominator) {
     286        32114 :             if (denominator > 0.0) {
     287        30355 :                 print(state.files.eio, "{:.3R},", numerator / denominator);
     288              :             } else {
     289         1759 :                 print(state.files.eio, "N/A,");
     290              :             }
     291        32114 :         };
     292              : 
     293          801 :         auto &ErrorsFound(state.dataInternalHeatGains->ErrorsFound);
     294              : 
     295              :         // TODO MJW: Punt for now, sometimes unit test need these to be allocated in AllocateZoneHeatBalArrays, but simulations need them here
     296          801 :         if (!state.dataHeatBal->ZoneIntGain.allocated()) {
     297          801 :             DataHeatBalance::AllocateIntGains(state);
     298              :         }
     299          801 :         state.dataHeatBal->ZoneRpt.allocate(state.dataGlobal->NumOfZones);
     300          801 :         state.dataHeatBal->spaceRpt.allocate(state.dataGlobal->numSpaces);
     301          801 :         state.dataHeatBal->ZoneIntEEuse.allocate(state.dataGlobal->NumOfZones);
     302          801 :         state.dataHeatBal->RefrigCaseCredit.allocate(state.dataGlobal->NumOfZones);
     303              : 
     304          801 :         Array1D_bool RepVarSet;
     305          801 :         RepVarSet.allocate(state.dataGlobal->NumOfZones);
     306         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
     307         5201 :             RepVarSet(zoneNum) = true;
     308              :         }
     309              : 
     310         1602 :         const std::string peopleModuleObject = "People";
     311         1602 :         const std::string lightsModuleObject = "Lights";
     312         1602 :         const std::string elecEqModuleObject = "ElectricEquipment";
     313         1602 :         const std::string gasEqModuleObject = "GasEquipment";
     314         1602 :         const std::string hwEqModuleObject = "HotWaterEquipment";
     315         1602 :         const std::string stmEqModuleObject = "SteamEquipment";
     316         1602 :         const std::string othEqModuleObject = "OtherEquipment";
     317         1602 :         const std::string itEqModuleObject = "ElectricEquipment:ITE:AirCooled";
     318         1602 :         const std::string bbModuleObject = "ZoneBaseboard:OutdoorTemperatureControlled";
     319          801 :         const std::string contamSSModuleObject = "ZoneContaminantSourceAndSink:CarbonDioxide";
     320              : 
     321              :         // Because there are occasions where getObjectItem will be called a second time within the routine (#9680)
     322              :         // We should use local arrays instead of state.dataIPShortCut
     323          801 :         int IHGNumAlphas = 0;
     324          801 :         int IHGNumNumbers = 0;
     325          801 :         Array1D<Real64> IHGNumbers;
     326          801 :         Array1D_string IHGAlphas;
     327          801 :         Array1D_bool IHGNumericFieldBlanks;
     328          801 :         Array1D_bool IHGAlphaFieldBlanks;
     329          801 :         Array1D_string IHGAlphaFieldNames;
     330          801 :         Array1D_string IHGNumericFieldNames;
     331              : 
     332              :         {
     333          801 :             int MaxAlphas = 0;
     334          801 :             int MaxNums = 0;
     335          801 :             int NumParams = 0;
     336          801 :             for (const auto &moduleName : {peopleModuleObject,
     337              :                                            lightsModuleObject,
     338              :                                            elecEqModuleObject,
     339              :                                            gasEqModuleObject,
     340              :                                            hwEqModuleObject,
     341              :                                            stmEqModuleObject,
     342              :                                            othEqModuleObject,
     343              :                                            itEqModuleObject,
     344              :                                            bbModuleObject,
     345        17622 :                                            contamSSModuleObject}) {
     346         8010 :                 state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, moduleName, NumParams, IHGNumAlphas, IHGNumNumbers);
     347         8010 :                 MaxAlphas = std::max(MaxAlphas, IHGNumAlphas);
     348         8010 :                 MaxNums = std::max(MaxNums, IHGNumNumbers);
     349         8811 :             }
     350          801 :             IHGAlphas.allocate(MaxAlphas);
     351          801 :             IHGAlphaFieldNames.allocate(MaxAlphas);
     352          801 :             IHGAlphaFieldBlanks.dimension(MaxAlphas, true);
     353              : 
     354          801 :             IHGNumbers.dimension(MaxNums, 0.0);
     355          801 :             IHGNumericFieldNames.allocate(MaxNums);
     356          801 :             IHGNumericFieldBlanks.dimension(MaxNums, true);
     357          801 :             IHGNumAlphas = 0;
     358          801 :             IHGNumNumbers = 0;
     359              :         }
     360              : 
     361              :         // PEOPLE: Includes both information related to the heat balance and thermal comfort
     362          801 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> peopleObjects;
     363          801 :         int numPeopleStatements = 0;
     364          801 :         setupIHGZonesAndSpaces(state, peopleModuleObject, peopleObjects, numPeopleStatements, state.dataHeatBal->TotPeople, ErrorsFound);
     365              : 
     366          801 :         if (state.dataHeatBal->TotPeople > 0) {
     367          668 :             state.dataHeatBal->People.allocate(state.dataHeatBal->TotPeople);
     368          668 :             int peopleNum = 0;
     369         4782 :             for (int peopleInputNum = 1; peopleInputNum <= numPeopleStatements; ++peopleInputNum) {
     370         4114 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
     371              :                                                                          peopleModuleObject,
     372              :                                                                          peopleInputNum,
     373              :                                                                          IHGAlphas,
     374              :                                                                          IHGNumAlphas,
     375              :                                                                          IHGNumbers,
     376              :                                                                          IHGNumNumbers,
     377              :                                                                          IOStat,
     378              :                                                                          IHGNumericFieldBlanks,
     379              :                                                                          IHGAlphaFieldBlanks,
     380              :                                                                          IHGAlphaFieldNames,
     381              :                                                                          IHGNumericFieldNames);
     382              : 
     383         4114 :                 ErrorObjectHeader eoh{routineName, peopleModuleObject, IHGAlphas(1)};
     384              :                 // Create one People instance for every space associated with this People input object
     385         4114 :                 auto &thisPeopleInput = peopleObjects(peopleInputNum);
     386         8352 :                 for (int Item1 = 1; Item1 <= thisPeopleInput.numOfSpaces; ++Item1) {
     387         4238 :                     ++peopleNum;
     388         4238 :                     auto &thisPeople = state.dataHeatBal->People(peopleNum);
     389         4238 :                     int const spaceNum = thisPeopleInput.spaceNums(Item1);
     390         4238 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
     391         4238 :                     thisPeople.Name = thisPeopleInput.names(Item1);
     392         4238 :                     thisPeople.spaceIndex = spaceNum;
     393         4238 :                     thisPeople.ZonePtr = zoneNum;
     394              : 
     395         4238 :                     thisPeople.sched = Sched::GetSchedule(state, IHGAlphas(3));
     396              : 
     397         4238 :                     if (Item1 == 1) { // only show error on first one
     398         4114 :                         if (IHGAlphaFieldBlanks(3)) {
     399            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
     400            0 :                             ErrorsFound = true;
     401         4114 :                         } else if (thisPeople.sched == nullptr) {
     402            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
     403            0 :                             ErrorsFound = true;
     404         4114 :                         } else if (!thisPeople.sched->checkMinVal(state, Clusive::In, 0.0)) {
     405            0 :                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
     406            0 :                             ErrorsFound = true;
     407              :                         }
     408              :                     }
     409              : 
     410              :                     // Number of people calculation method.
     411              :                     { // Why open a new scope here
     412         4238 :                         std::string const &peopleMethod = IHGAlphas(4);
     413         4238 :                         if (peopleMethod == "PEOPLE") {
     414              :                             // Set space load fraction
     415         2950 :                             Real64 spaceFrac = 1.0;
     416         2950 :                             if (thisPeopleInput.numOfSpaces > 1) {
     417           18 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
     418           18 :                                 if (zoneArea > 0.0) {
     419           18 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
     420              :                                 } else {
     421            0 :                                     ShowSevereError(state, format("{}Zone floor area is zero when allocating People loads to Spaces.", RoutineName));
     422            0 :                                     ShowContinueError(state,
     423            0 :                                                       format("Occurs for People object ={} in Zone={}",
     424            0 :                                                              thisPeopleInput.Name,
     425            0 :                                                              state.dataHeatBal->Zone(zoneNum).Name));
     426            0 :                                     ErrorsFound = true;
     427              :                                 }
     428              :                             }
     429         2950 :                             thisPeople.NumberOfPeople = IHGNumbers(1) * spaceFrac;
     430         2950 :                             if (IHGNumericFieldBlanks(1)) {
     431           40 :                                 ShowWarningError(state,
     432           60 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 People will result.",
     433              :                                                         RoutineName,
     434              :                                                         peopleModuleObject,
     435           20 :                                                         thisPeople.Name,
     436              :                                                         IHGNumericFieldNames(1)));
     437              :                             }
     438              : 
     439         1288 :                         } else if (peopleMethod == "PEOPLE/AREA") {
     440          143 :                             if (spaceNum != 0) {
     441          143 :                                 if (IHGNumbers(2) >= 0.0) {
     442          143 :                                     thisPeople.NumberOfPeople = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
     443          146 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
     444            3 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
     445            0 :                                         ShowWarningError(state,
     446            0 :                                                          format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 People will result.",
     447              :                                                                 RoutineName,
     448              :                                                                 peopleModuleObject,
     449            0 :                                                                 thisPeople.Name,
     450              :                                                                 IHGNumericFieldNames(2)));
     451              :                                     }
     452              :                                 } else {
     453            0 :                                     ShowSevereError(state,
     454            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
     455              :                                                            RoutineName,
     456              :                                                            peopleModuleObject,
     457            0 :                                                            thisPeople.Name,
     458              :                                                            IHGNumericFieldNames(2),
     459              :                                                            IHGNumbers(2)));
     460            0 :                                     ErrorsFound = true;
     461              :                                 }
     462              :                             }
     463          143 :                             if (IHGNumericFieldBlanks(2)) {
     464            0 :                                 ShowWarningError(state,
     465            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 People will result.",
     466              :                                                         RoutineName,
     467              :                                                         peopleModuleObject,
     468            0 :                                                         thisPeople.Name,
     469              :                                                         IHGNumericFieldNames(2)));
     470              :                             }
     471              : 
     472         1145 :                         } else if (peopleMethod == "AREA/PERSON") {
     473         1145 :                             if (spaceNum != 0) {
     474         1145 :                                 if (IHGNumbers(3) > 0.0) {
     475         1145 :                                     thisPeople.NumberOfPeople = state.dataHeatBal->space(spaceNum).FloorArea / IHGNumbers(3);
     476         1145 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
     477            0 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
     478            0 :                                         ShowWarningError(state,
     479            0 :                                                          format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 People will result.",
     480              :                                                                 RoutineName,
     481              :                                                                 peopleModuleObject,
     482            0 :                                                                 thisPeople.Name,
     483              :                                                                 IHGNumericFieldNames(3)));
     484              :                                     }
     485              :                                 } else {
     486            0 :                                     ShowSevereError(state,
     487            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
     488              :                                                            RoutineName,
     489              :                                                            peopleModuleObject,
     490            0 :                                                            thisPeople.Name,
     491              :                                                            IHGNumericFieldNames(3),
     492              :                                                            IHGNumbers(3)));
     493            0 :                                     ErrorsFound = true;
     494              :                                 }
     495              :                             }
     496         1145 :                             if (IHGNumericFieldBlanks(3)) {
     497            0 :                                 ShowWarningError(state,
     498            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 People will result.",
     499              :                                                         RoutineName,
     500              :                                                         peopleModuleObject,
     501            0 :                                                         thisPeople.Name,
     502              :                                                         IHGNumericFieldNames(3)));
     503              :                             }
     504              : 
     505              :                         } else {
     506            0 :                             if (Item1 == 1) {
     507            0 :                                 ShowSevereError(state,
     508            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
     509              :                                                        RoutineName,
     510              :                                                        peopleModuleObject,
     511              :                                                        IHGAlphas(1),
     512              :                                                        IHGAlphaFieldNames(4),
     513              :                                                        IHGAlphas(4)));
     514            0 :                                 ShowContinueError(state, "...Valid values are \"People\", \"People/Area\", \"Area/Person\".");
     515            0 :                                 ErrorsFound = true;
     516              :                             }
     517              :                         }
     518              :                     }
     519              : 
     520              :                     // Calculate nominal min/max people
     521         4238 :                     thisPeople.NomMinNumberPeople = thisPeople.NumberOfPeople * thisPeople.sched->getMinVal(state);
     522         4238 :                     thisPeople.NomMaxNumberPeople = thisPeople.NumberOfPeople * thisPeople.sched->getMaxVal(state);
     523              : 
     524         4238 :                     if (zoneNum > 0) {
     525         4238 :                         state.dataHeatBal->Zone(zoneNum).TotOccupants += thisPeople.NumberOfPeople;
     526              :                         // Note that min/max occupants are non-coincident
     527         4238 :                         state.dataHeatBal->Zone(zoneNum).minOccupants += thisPeople.NomMinNumberPeople;
     528         4238 :                         state.dataHeatBal->Zone(zoneNum).maxOccupants += thisPeople.NomMaxNumberPeople;
     529              :                     }
     530              : 
     531         4238 :                     if (spaceNum > 0) {
     532         4238 :                         state.dataHeatBal->space(spaceNum).TotOccupants += thisPeople.NumberOfPeople;
     533              :                         // Note that min/max occupants are non-coincident
     534         4238 :                         state.dataHeatBal->space(spaceNum).minOccupants += thisPeople.NomMinNumberPeople;
     535         4238 :                         state.dataHeatBal->space(spaceNum).maxOccupants += thisPeople.NomMaxNumberPeople;
     536              :                     }
     537         4238 :                     thisPeople.FractionRadiant = IHGNumbers(4);
     538         4238 :                     thisPeople.FractionConvected = 1.0 - thisPeople.FractionRadiant;
     539         4238 :                     if (Item1 == 1) {
     540         4114 :                         if (thisPeople.FractionConvected < 0.0) {
     541            0 :                             ShowSevereError(state,
     542            0 :                                             format("{}{}=\"{}\", {} < 0.0, value ={:.2R}",
     543              :                                                    RoutineName,
     544              :                                                    peopleModuleObject,
     545              :                                                    IHGAlphas(1),
     546              :                                                    IHGNumericFieldNames(4),
     547              :                                                    IHGNumbers(4)));
     548            0 :                             ErrorsFound = true;
     549              :                         }
     550              :                     }
     551              : 
     552         4238 :                     if (IHGNumNumbers >= 5 && !IHGNumericFieldBlanks(5)) {
     553         2249 :                         thisPeople.UserSpecSensFrac = IHGNumbers(5);
     554              :                     } else {
     555         1989 :                         thisPeople.UserSpecSensFrac = Constant::AutoCalculate;
     556              :                     }
     557              : 
     558         4238 :                     if (IHGNumNumbers >= 6 && !IHGNumericFieldBlanks(6)) {
     559         1160 :                         thisPeople.CO2RateFactor = IHGNumbers(6);
     560              :                     } else {
     561         3078 :                         thisPeople.CO2RateFactor = 3.82e-8; // m3/s-W
     562              :                     }
     563              : 
     564         4238 :                     if (IHGNumNumbers >= 7 && !IHGNumericFieldBlanks(7)) {
     565            6 :                         thisPeople.ColdStressTempThresh = IHGNumbers(7);
     566              :                     } else {
     567         4232 :                         thisPeople.ColdStressTempThresh = 15.56; // degree C
     568              :                     }
     569              : 
     570         4238 :                     if (IHGNumNumbers == 8 && !IHGNumericFieldBlanks(8)) {
     571            6 :                         thisPeople.HeatStressTempThresh = IHGNumbers(8);
     572              :                     } else {
     573         4232 :                         thisPeople.HeatStressTempThresh = 30.0; // degree C
     574              :                     }
     575              : 
     576         4238 :                     if (thisPeople.CO2RateFactor < 0.0) {
     577            0 :                         ShowSevereError(state,
     578            0 :                                         format("{}{}=\"{}\", {} < 0.0, value ={:.2R}",
     579              :                                                RoutineName,
     580              :                                                peopleModuleObject,
     581              :                                                IHGAlphas(1),
     582              :                                                IHGNumericFieldNames(6),
     583              :                                                IHGNumbers(6)));
     584            0 :                         ErrorsFound = true;
     585              :                     }
     586              : 
     587         4238 :                     thisPeople.activityLevelSched = Sched::GetSchedule(state, IHGAlphas(5));
     588              : 
     589         4238 :                     if (Item1 == 1) {
     590         4114 :                         if (IHGAlphaFieldBlanks(5)) {
     591            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(5));
     592            0 :                             ErrorsFound = true;
     593         4114 :                         } else if (thisPeople.activityLevelSched == nullptr) {
     594            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5));
     595            0 :                             ErrorsFound = true;
     596         4114 :                         } else if (!thisPeople.activityLevelSched->checkMinVal(state, Clusive::In, 0.0)) {
     597            0 :                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5), Clusive::In, 0.0);
     598            0 :                             ErrorsFound = true;
     599         4114 :                         } else if (!thisPeople.activityLevelSched->checkMinMaxVals(state, Clusive::In, 70.0, Clusive::In, 1000.0)) {
     600            0 :                             Sched::ShowWarningBadMinMax(state,
     601              :                                                         eoh,
     602            0 :                                                         IHGAlphaFieldNames(5),
     603            0 :                                                         IHGAlphas(5),
     604              :                                                         Clusive::In,
     605              :                                                         70.0,
     606              :                                                         Clusive::In,
     607              :                                                         1000.0,
     608              :                                                         "Values fall outside of typical w/person range for thermal comfort reporting.");
     609              :                         }
     610              :                     }
     611              : 
     612              :                     // Following is an optional parameter (ASHRAE 55 warnings
     613         4238 :                     if (IHGNumAlphas >= 6) {
     614         2823 :                         if (BooleanSwitch bs = getYesNoValue(IHGAlphas(6)); bs != BooleanSwitch::Invalid) {
     615         2823 :                             thisPeople.Show55Warning = static_cast<bool>(bs);
     616            0 :                         } else if (Item1 == 1) {
     617            0 :                             ShowSevereInvalidKey(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6));
     618            0 :                             ErrorsFound = true;
     619              :                         }
     620              :                     }
     621              : 
     622         4238 :                     if (IHGNumAlphas > 6) { // Optional parameters present--thermal comfort data follows...
     623         2823 :                         int lastOption = 0;
     624         2823 :                         bool usingThermalComfort = false;
     625         2823 :                         if (IHGNumAlphas > 20) {
     626            7 :                             lastOption = 20;
     627              :                         } else {
     628         2816 :                             lastOption = IHGNumAlphas;
     629              :                         }
     630              : 
     631              :                         // check to see if the user has specified schedules for air velocity, clothing insulation, and/or work efficiency
     632              :                         // but have NOT made a selection for a thermal comfort model.  If so, then the schedules are reported as unused
     633              :                         // which could cause confusion.  The solution is for the user to either remove those schedules or pick a thermal
     634              :                         // comfort model.
     635         2823 :                         int constexpr NumFirstTCModel = 14;
     636         2823 :                         if (IHGNumAlphas < NumFirstTCModel) {
     637          148 :                             bool NoTCModelSelectedWithSchedules = false;
     638              :                             NoTCModelSelectedWithSchedules =
     639          148 :                                 CheckThermalComfortSchedules(IHGAlphaFieldBlanks(9), IHGAlphaFieldBlanks(12), IHGAlphaFieldBlanks(13));
     640          148 :                             if (NoTCModelSelectedWithSchedules) {
     641           68 :                                 ShowWarningError(state,
     642           68 :                                                  format("{}{}=\"{}\" has comfort related schedules but no thermal comfort model selected.",
     643              :                                                         RoutineName,
     644              :                                                         peopleModuleObject,
     645              :                                                         IHGAlphas(1)));
     646           68 :                                 ShowContinueError(state,
     647              :                                                   "If schedules are specified for air velocity, clothing insulation, and/or work efficiency but no "
     648              :                                                   "thermal comfort");
     649           68 :                                 ShowContinueError(
     650              :                                     state, "thermal comfort model is selected, the schedules will be listed as unused schedules in the .err file.");
     651          102 :                                 ShowContinueError(
     652              :                                     state,
     653              :                                     "To avoid these errors, select a valid thermal comfort model or eliminate these schedules in the PEOPLE input.");
     654              :                             }
     655              :                         }
     656              : 
     657         5552 :                         for (int OptionNum = NumFirstTCModel; OptionNum <= lastOption; ++OptionNum) {
     658              : 
     659              :                             { // Why are we starting a nested scope immediately after opening up a scope?
     660         2729 :                                 std::string const &thermalComfortType = IHGAlphas(OptionNum);
     661              : 
     662         2729 :                                 if (thermalComfortType == "FANGER") {
     663         2664 :                                     thisPeople.Fanger = true;
     664         2664 :                                     usingThermalComfort = true;
     665              : 
     666           65 :                                 } else if (thermalComfortType == "PIERCE") {
     667           11 :                                     thisPeople.Pierce = true;
     668           11 :                                     state.dataHeatBal->AnyThermalComfortPierceModel = true;
     669           11 :                                     usingThermalComfort = true;
     670              : 
     671           54 :                                 } else if (thermalComfortType == "KSU") {
     672            6 :                                     thisPeople.KSU = true;
     673            6 :                                     state.dataHeatBal->AnyThermalComfortKSUModel = true;
     674            6 :                                     usingThermalComfort = true;
     675              : 
     676           48 :                                 } else if (thermalComfortType == "ADAPTIVEASH55") {
     677            6 :                                     thisPeople.AdaptiveASH55 = true;
     678            6 :                                     state.dataHeatBal->AdaptiveComfortRequested_ASH55 = true;
     679            6 :                                     usingThermalComfort = true;
     680              : 
     681           42 :                                 } else if (thermalComfortType == "ADAPTIVECEN15251") {
     682            1 :                                     thisPeople.AdaptiveCEN15251 = true;
     683            1 :                                     state.dataHeatBal->AdaptiveComfortRequested_CEN15251 = true;
     684            1 :                                     usingThermalComfort = true;
     685              : 
     686           41 :                                 } else if (thermalComfortType == "COOLINGEFFECTASH55") {
     687            1 :                                     thisPeople.CoolingEffectASH55 = true;
     688            1 :                                     state.dataHeatBal->AnyThermalComfortCoolingEffectModel = true;
     689            1 :                                     usingThermalComfort = true;
     690              : 
     691           40 :                                 } else if (thermalComfortType == "ANKLEDRAFTASH55") {
     692            1 :                                     thisPeople.AnkleDraftASH55 = true;
     693            1 :                                     state.dataHeatBal->AnyThermalComfortAnkleDraftModel = true;
     694            1 :                                     usingThermalComfort = true;
     695              : 
     696           39 :                                 } else if (thermalComfortType == "") { // Blank input field--just ignore this
     697              : 
     698              :                                 } else { // An invalid keyword was entered--warn but ignore
     699            0 :                                     if (Item1 == 1) {
     700            0 :                                         ShowWarningInvalidKey(state, eoh, IHGAlphaFieldNames(OptionNum), IHGAlphas(OptionNum), "");
     701            0 :                                         ShowContinueError(state,
     702              :                                                           "Valid Values are \"Fanger\", \"Pierce\", \"KSU\", \"AdaptiveASH55\", "
     703              :                                                           "\"AdaptiveCEN15251\", \"CoolingEffectASH55\", \"AnkleDraftASH55\"");
     704              :                                     }
     705              :                                 }
     706              :                             }
     707              :                         }
     708              : 
     709         2823 :                         if (usingThermalComfort) {
     710              : 
     711              :                             // Set the default value of MRTCalcType as 'EnclosureAveraged'
     712         2675 :                             thisPeople.MRTCalcType = DataHeatBalance::CalcMRT::EnclosureAveraged;
     713              : 
     714           11 :                             bool ModelWithAdditionalInputs = thisPeople.Fanger || thisPeople.Pierce || thisPeople.KSU ||
     715         2686 :                                                              thisPeople.CoolingEffectASH55 || thisPeople.AnkleDraftASH55;
     716              : 
     717              :                             // MRT Calculation Type and Surface Name
     718         2675 :                             thisPeople.MRTCalcType = static_cast<CalcMRT>(getEnumValue(CalcMRTTypeNamesUC, IHGAlphas(7)));
     719              : 
     720         2675 :                             switch (thisPeople.MRTCalcType) {
     721         2666 :                             case DataHeatBalance::CalcMRT::EnclosureAveraged: {
     722              :                                 // nothing to do here
     723         2666 :                             } break;
     724            6 :                             case DataHeatBalance::CalcMRT::SurfaceWeighted: {
     725            6 :                                 thisPeople.SurfacePtr = Util::FindItemInList(IHGAlphas(8), state.dataSurface->Surface);
     726            6 :                                 if (thisPeople.SurfacePtr == 0 && ModelWithAdditionalInputs) {
     727            0 :                                     if (Item1 == 1) {
     728            0 :                                         ShowSevereError(state,
     729            0 :                                                         format("{}{}=\"{}\", {}={} invalid Surface Name={}",
     730              :                                                                RoutineName,
     731              :                                                                peopleModuleObject,
     732              :                                                                IHGAlphas(1),
     733              :                                                                IHGAlphaFieldNames(7),
     734              :                                                                IHGAlphas(7),
     735              :                                                                IHGAlphas(8)));
     736            0 :                                         ErrorsFound = true;
     737              :                                     }
     738              :                                 } else {
     739            6 :                                     int const surfRadEnclNum = state.dataSurface->Surface(thisPeople.SurfacePtr).RadEnclIndex;
     740            6 :                                     int const thisPeopleRadEnclNum = state.dataHeatBal->space(thisPeople.spaceIndex).radiantEnclosureNum;
     741            6 :                                     if (surfRadEnclNum != thisPeopleRadEnclNum && ModelWithAdditionalInputs) {
     742            0 :                                         ShowSevereError(state,
     743            0 :                                                         format("{}{}=\"{}\", Surface referenced in {}={} in different enclosure.",
     744              :                                                                RoutineName,
     745              :                                                                peopleModuleObject,
     746              :                                                                IHGAlphas(1),
     747              :                                                                IHGAlphaFieldNames(7),
     748              :                                                                IHGAlphas(7)));
     749            0 :                                         ShowContinueError(state,
     750            0 :                                                           format("Surface is in Enclosure={} and {} is in Enclosure={}",
     751            0 :                                                                  state.dataViewFactor->EnclRadInfo(surfRadEnclNum).Name,
     752              :                                                                  peopleModuleObject,
     753            0 :                                                                  state.dataViewFactor->EnclRadInfo(thisPeopleRadEnclNum).Name));
     754            0 :                                         ErrorsFound = true;
     755              :                                     }
     756              :                                 }
     757              : 
     758            6 :                             } break;
     759            3 :                             case DataHeatBalance::CalcMRT::AngleFactor: {
     760            3 :                                 thisPeople.AngleFactorListName = IHGAlphas(8);
     761              : 
     762            3 :                             } break;
     763            0 :                             default: { // An invalid keyword was entered--warn but ignore
     764            0 :                                 if (Item1 == 1 && ModelWithAdditionalInputs) {
     765            0 :                                     ShowWarningError(state,
     766            0 :                                                      format("{}{}=\"{}\", invalid {}={}",
     767              :                                                             RoutineName,
     768              :                                                             peopleModuleObject,
     769              :                                                             IHGAlphas(1),
     770              :                                                             IHGAlphaFieldNames(7),
     771              :                                                             IHGAlphas(7)));
     772            0 :                                     ShowContinueError(state, "...Valid values are \"EnclosureAveraged\", \"SurfaceWeighted\", \"AngleFactor\".");
     773              :                                 }
     774            0 :                             } break;
     775              :                             } // switch (thisPeople.MRTCalcType)
     776              : 
     777         2675 :                             if (!IHGAlphaFieldBlanks(9)) {
     778         2675 :                                 thisPeople.workEffSched = Sched::GetSchedule(state, IHGAlphas(9));
     779              :                             }
     780              : 
     781         2675 :                             if (Item1 == 1) {
     782         2673 :                                 if (IHGAlphaFieldBlanks(9)) {
     783            0 :                                     if (ModelWithAdditionalInputs) {
     784            0 :                                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(9));
     785            0 :                                         ShowContinueError(state,
     786              :                                                           "It is required when Thermal Comfort Model Type is one of "
     787              :                                                           "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\"");
     788            0 :                                         ErrorsFound = true;
     789              :                                     }
     790         2673 :                                 } else if (thisPeople.workEffSched == nullptr) {
     791            0 :                                     ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(9), IHGAlphas(9));
     792            0 :                                     ErrorsFound = true;
     793         2673 :                                 } else if (!thisPeople.workEffSched->checkMinMaxVals(state, Clusive::In, 0.0, Clusive::In, 1.0)) {
     794            0 :                                     Sched::ShowSevereBadMinMax(state, eoh, IHGAlphaFieldNames(9), IHGAlphas(9), Clusive::In, 0.0, Clusive::In, 1.0);
     795            0 :                                     ErrorsFound = true;
     796              :                                 }
     797              :                             }
     798              : 
     799         2675 :                             if (IHGAlphas(10).empty()) { // Using IHGAlphaFieldBlanks(10) doesn't work because this value is defaulted
     800         2675 :                             } else if ((thisPeople.clothingType = static_cast<ClothingType>(getEnumValue(clothingTypeNamesUC, IHGAlphas(10)))) ==
     801              :                                        ClothingType::Invalid) {
     802            0 :                                 ShowSevereInvalidKey(state, eoh, IHGAlphaFieldNames(10), IHGAlphas(10));
     803            0 :                                 ErrorsFound = true;
     804              : 
     805              :                             } else {
     806              : 
     807         2675 :                                 switch (thisPeople.clothingType) {
     808              : 
     809         2672 :                                 case ClothingType::InsulationSchedule: {
     810              : 
     811         2672 :                                     thisPeople.clothingSched = Sched::GetSchedule(state, IHGAlphas(12));
     812         2672 :                                     if (Item1 == 1) {
     813         2670 :                                         if (IHGAlphaFieldBlanks(12)) {
     814            0 :                                             if (ModelWithAdditionalInputs) {
     815            0 :                                                 ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(12), IHGAlphaFieldNames(10), IHGAlphas(10));
     816            0 :                                                 ErrorsFound = true;
     817              :                                             }
     818         2670 :                                         } else if (thisPeople.clothingSched == nullptr) {
     819            0 :                                             if (ModelWithAdditionalInputs) {
     820            0 :                                                 ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12));
     821            0 :                                                 ErrorsFound = true;
     822              :                                             }
     823         2670 :                                         } else if (!thisPeople.clothingSched->checkMinVal(state, Clusive::In, 0.0)) {
     824            0 :                                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12), Clusive::In, 0.0);
     825            0 :                                             ErrorsFound = true;
     826         2670 :                                         } else if (!thisPeople.clothingSched->checkMaxVal(state, Clusive::In, 2.0)) {
     827            0 :                                             Sched::ShowWarningBadMax(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12), Clusive::In, 2.0, "");
     828              :                                         }
     829              :                                     }
     830         2672 :                                 } break;
     831              : 
     832            2 :                                 case ClothingType::DynamicAshrae55: {
     833            2 :                                 } break; // nothing extra to do, at least for now
     834              : 
     835            1 :                                 case ClothingType::CalculationSchedule: {
     836            1 :                                     thisPeople.clothingMethodSched = Sched::GetSchedule(state, IHGAlphas(11));
     837              : 
     838            1 :                                     if (Item1 == 1) {
     839            1 :                                         if (thisPeople.clothingMethodSched == nullptr) {
     840            0 :                                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(11), IHGAlphas(11));
     841            0 :                                             ErrorsFound = true;
     842              :                                         }
     843              :                                     }
     844              : 
     845            1 :                                     if (thisPeople.clothingMethodSched->hasVal(state, 1)) {
     846            1 :                                         if ((thisPeople.clothingSched = Sched::GetSchedule(state, IHGAlphas(12))) == nullptr) {
     847            0 :                                             if (Item1 == 1) {
     848            0 :                                                 ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12));
     849            0 :                                                 ErrorsFound = true;
     850              :                                             }
     851              :                                         }
     852              :                                     }
     853            1 :                                 } break;
     854              : 
     855            0 :                                 default: {
     856            0 :                                 } break; // nothing to do for the other cases
     857              :                                 } // switch (thisPeople.clothingType)
     858              :                             }
     859              : 
     860         2675 :                             if (IHGAlphaFieldBlanks(13)) {
     861              :                             } else {
     862         2675 :                                 thisPeople.airVelocitySched = Sched::GetSchedule(state, IHGAlphas(13));
     863              :                             }
     864              : 
     865         2675 :                             if (Item1 == 1) {
     866         2673 :                                 if (IHGAlphaFieldBlanks(13)) {
     867            0 :                                     if (ModelWithAdditionalInputs) {
     868            0 :                                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(13));
     869            0 :                                         ShowContinueError(state,
     870              :                                                           "Required when Thermal Comfort Model Type is one of "
     871              :                                                           "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\"");
     872            0 :                                         ErrorsFound = true;
     873              :                                     }
     874         2673 :                                 } else if (thisPeople.airVelocitySched == nullptr) {
     875            0 :                                     ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(13), IHGAlphas(13));
     876            0 :                                     ErrorsFound = true;
     877         2673 :                                 } else if (!thisPeople.airVelocitySched->checkMinVal(state, Clusive::In, 0.0)) {
     878            0 :                                     Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(13), IHGAlphas(13), Clusive::In, 0.0);
     879            0 :                                     ErrorsFound = true;
     880              :                                 }
     881              :                             }
     882              : 
     883         2675 :                             if (IHGAlphas(21).empty()) { // Using IHGAlphaFieldBlanks(21) doesn't work because this field has a default
     884              :                             } else {
     885            1 :                                 thisPeople.ankleAirVelocitySched = Sched::GetSchedule(state, IHGAlphas(21));
     886              :                             }
     887              : 
     888         2675 :                             if (Item1 == 1) {
     889         2673 :                                 if (IHGAlphaFieldBlanks(21)) {
     890         2672 :                                     if (thisPeople.AnkleDraftASH55) {
     891            0 :                                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(21), IHGAlphas(21));
     892            0 :                                         ShowContinueError(state,
     893              :                                                           "Required when Thermal Comfort Model Type is one of "
     894              :                                                           "\"Fanger\", \"Pierce\", \"KSU\", \"CoolingEffectASH55\" or \"AnkleDraftASH55\"");
     895            0 :                                         ErrorsFound = true;
     896              :                                     }
     897            1 :                                 } else if (thisPeople.ankleAirVelocitySched == nullptr) {
     898            0 :                                     ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(21), IHGAlphas(21));
     899            0 :                                     ErrorsFound = true;
     900              :                                 }
     901              :                             }
     902              :                         } // usingthermalcomfort block
     903              : 
     904              :                     } // ...end of thermal comfort data IF-THEN block  (IHGNumAlphass > 6)
     905              : 
     906         4238 :                     if (thisPeople.ZonePtr <= 0) {
     907            0 :                         continue; // Error, will be caught and terminated later
     908              :                     }
     909              :                 }
     910              :             }
     911              : 
     912         4906 :             for (int peopleNum2 = 1; peopleNum2 <= state.dataHeatBal->TotPeople; ++peopleNum2) {
     913         4238 :                 if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
     914         2092 :                     SetupEMSActuator(state,
     915              :                                      "People",
     916         1046 :                                      state.dataHeatBal->People(peopleNum2).Name,
     917              :                                      "Number of People",
     918              :                                      "[each]",
     919         1046 :                                      state.dataHeatBal->People(peopleNum2).EMSPeopleOn,
     920         1046 :                                      state.dataHeatBal->People(peopleNum2).EMSNumberOfPeople);
     921         1046 :                     SetupEMSInternalVariable(state,
     922              :                                              "People Count Design Level",
     923         1046 :                                              state.dataHeatBal->People(peopleNum2).Name,
     924              :                                              "[each]",
     925         1046 :                                              state.dataHeatBal->People(peopleNum2).NumberOfPeople);
     926              :                 }
     927              : 
     928              :                 // setup internal gains
     929         4238 :                 if (!ErrorsFound) {
     930        25428 :                     SetupSpaceInternalGain(state,
     931         4238 :                                            state.dataHeatBal->People(peopleNum2).spaceIndex,
     932              :                                            1.0,
     933         4238 :                                            state.dataHeatBal->People(peopleNum2).Name,
     934              :                                            DataHeatBalance::IntGainType::People,
     935         4238 :                                            &state.dataHeatBal->People(peopleNum2).ConGainRate,
     936              :                                            nullptr,
     937         4238 :                                            &state.dataHeatBal->People(peopleNum2).RadGainRate,
     938         4238 :                                            &state.dataHeatBal->People(peopleNum2).LatGainRate,
     939              :                                            nullptr,
     940         4238 :                                            &state.dataHeatBal->People(peopleNum2).CO2GainRate);
     941              :                 }
     942              :             }
     943              : 
     944              :             // transfer the nominal number of people in a zone to the tabular reporting
     945         5628 :             for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) {
     946         4960 :                 if (state.dataHeatBal->Zone(Loop).TotOccupants > 0.0) {
     947         8268 :                     if (state.dataHeatBal->Zone(Loop).FloorArea > 0.0 &&
     948         4134 :                         state.dataHeatBal->Zone(Loop).FloorArea / state.dataHeatBal->Zone(Loop).TotOccupants < 0.1) {
     949            0 :                         ShowWarningError(
     950            0 :                             state, format("{}Zone=\"{}\" occupant density is extremely high.", RoutineName, state.dataHeatBal->Zone(Loop).Name));
     951            0 :                         if (state.dataHeatBal->Zone(Loop).FloorArea > 0.0) {
     952            0 :                             ShowContinueError(state,
     953            0 :                                               format("Occupant Density=[{:.0R}] person/m2.",
     954            0 :                                                      state.dataHeatBal->Zone(Loop).TotOccupants / state.dataHeatBal->Zone(Loop).FloorArea));
     955              :                         }
     956            0 :                         ShowContinueError(state,
     957            0 :                                           format("Occupant Density=[{:.3R}] m2/person. Problems in Temperature Out of Bounds may result.",
     958            0 :                                                  state.dataHeatBal->Zone(Loop).FloorArea / state.dataHeatBal->Zone(Loop).TotOccupants));
     959              :                     }
     960         4134 :                     Real64 maxOccupLoad = 0.0;
     961         4134 :                     int OptionNum = 0;
     962       102587 :                     for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotPeople; ++Loop1) {
     963        98453 :                         auto const &people = state.dataHeatBal->People(Loop1);
     964        98453 :                         if (people.ZonePtr != Loop) {
     965        94274 :                             continue;
     966              :                         }
     967         4179 :                         if (maxOccupLoad < people.sched->getCurrentVal() * people.NumberOfPeople) {
     968          473 :                             maxOccupLoad = people.sched->getCurrentVal() * people.NumberOfPeople;
     969          473 :                             OptionNum = Loop1;
     970              :                         }
     971              :                     }
     972         4134 :                     if (maxOccupLoad > state.dataHeatBal->Zone(Loop).TotOccupants) {
     973            0 :                         if (state.dataHeatBal->Zone(Loop).FloorArea > 0.0 && state.dataHeatBal->Zone(Loop).FloorArea / maxOccupLoad < 0.1) {
     974            0 :                             ShowWarningError(state,
     975            0 :                                              format("{}Zone=\"{}\" occupant density at a maximum schedule value is extremely high.",
     976              :                                                     RoutineName,
     977            0 :                                                     state.dataHeatBal->Zone(Loop).Name));
     978            0 :                             if (state.dataHeatBal->Zone(Loop).FloorArea > 0.0) {
     979            0 :                                 ShowContinueError(
     980            0 :                                     state, format("Occupant Density=[{:.0R}] person/m2.", maxOccupLoad / state.dataHeatBal->Zone(Loop).FloorArea));
     981              :                             }
     982            0 :                             ShowContinueError(state,
     983            0 :                                               format("Occupant Density=[{:.3R}] m2/person. Problems in Temperature Out of Bounds may result.",
     984            0 :                                                      state.dataHeatBal->Zone(Loop).FloorArea / maxOccupLoad));
     985            0 :                             ShowContinueError(state,
     986            0 :                                               format("Check values in People={}, Number of People Schedule={}",
     987            0 :                                                      state.dataHeatBal->People(OptionNum).Name,
     988            0 :                                                      state.dataHeatBal->People(OptionNum).sched->getCurrentVal()));
     989              :                         }
     990              :                     }
     991              :                 }
     992              : 
     993         4960 :                 if (state.dataHeatBal->Zone(Loop).isNominalControlled) { // conditioned zones only
     994         4332 :                     if (state.dataHeatBal->Zone(Loop).TotOccupants > 0.0) {
     995         4052 :                         state.dataHeatBal->Zone(Loop).isNominalOccupied = true;
     996         8104 :                         PreDefTableEntry(state,
     997         4052 :                                          state.dataOutRptPredefined->pdchOaoNomNumOcc1,
     998         4052 :                                          state.dataHeatBal->Zone(Loop).Name,
     999         4052 :                                          state.dataHeatBal->Zone(Loop).TotOccupants);
    1000         8104 :                         PreDefTableEntry(state,
    1001         4052 :                                          state.dataOutRptPredefined->pdchOaoNomNumOcc2,
    1002         4052 :                                          state.dataHeatBal->Zone(Loop).Name,
    1003         4052 :                                          state.dataHeatBal->Zone(Loop).TotOccupants);
    1004              :                     }
    1005              :                 }
    1006              :             }
    1007              :         } // TotPeople > 0
    1008              : 
    1009              :         // Lights
    1010              :         // Declared in state because the lights inputs are needed for demand manager
    1011          801 :         int numLightsStatements = 0;
    1012          801 :         Real64 sumArea = 0.0;  // sum of floor area for all lights objects
    1013          801 :         Real64 sumPower = 0.0; // sum of power for all lights objects
    1014          801 :         setupIHGZonesAndSpaces(
    1015          801 :             state, lightsModuleObject, state.dataInternalHeatGains->lightsObjects, numLightsStatements, state.dataHeatBal->TotLights, ErrorsFound);
    1016              : 
    1017          801 :         if (state.dataHeatBal->TotLights > 0) {
    1018          667 :             state.dataHeatBal->Lights.allocate(state.dataHeatBal->TotLights);
    1019          667 :             bool CheckSharedExhaustFlag = false;
    1020          667 :             int lightsNum = 0;
    1021         5044 :             for (int lightsInputNum = 1; lightsInputNum <= numLightsStatements; ++lightsInputNum) {
    1022              : 
    1023         4377 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1024              :                                                                          lightsModuleObject,
    1025              :                                                                          lightsInputNum,
    1026              :                                                                          IHGAlphas,
    1027              :                                                                          IHGNumAlphas,
    1028              :                                                                          IHGNumbers,
    1029              :                                                                          IHGNumNumbers,
    1030              :                                                                          IOStat,
    1031              :                                                                          IHGNumericFieldBlanks,
    1032              :                                                                          IHGAlphaFieldBlanks,
    1033              :                                                                          IHGAlphaFieldNames,
    1034              :                                                                          IHGNumericFieldNames);
    1035              : 
    1036         4377 :                 ErrorObjectHeader eoh{routineName, lightsModuleObject, IHGAlphas(1)};
    1037              : 
    1038         4377 :                 auto &thisLightsInput = state.dataInternalHeatGains->lightsObjects(lightsInputNum);
    1039              :                 // Create one Lights instance for every space associated with this Lights input object
    1040              :                 // Why? Why can't multple spaces share a single lights instance?
    1041         8848 :                 for (int Item1 = 1; Item1 <= thisLightsInput.numOfSpaces; ++Item1) {
    1042         4471 :                     ++lightsNum;
    1043         4471 :                     auto &thisLights = state.dataHeatBal->Lights(lightsNum);
    1044         4471 :                     int const spaceNum = thisLightsInput.spaceNums(Item1);
    1045         4471 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1046         4471 :                     thisLights.Name = thisLightsInput.names(Item1);
    1047         4471 :                     thisLights.spaceIndex = spaceNum;
    1048         4471 :                     thisLights.ZonePtr = zoneNum;
    1049              : 
    1050         4471 :                     if (!IHGAlphaFieldBlanks(3)) {
    1051         4471 :                         thisLights.sched = Sched::GetSchedule(state, IHGAlphas(3));
    1052              :                     }
    1053              : 
    1054         4471 :                     if (Item1 == 1) {
    1055         4377 :                         if (IHGAlphaFieldBlanks(3)) {
    1056            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1057            0 :                             ErrorsFound = true;
    1058         4377 :                         } else if (thisLights.sched == nullptr) {
    1059            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1060            0 :                             ErrorsFound = true;
    1061         4377 :                         } else if (!thisLights.sched->checkMinVal(state, Clusive::In, 0.0)) {
    1062            0 :                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    1063            0 :                             ErrorsFound = true;
    1064              :                         }
    1065              :                     }
    1066              : 
    1067              :                     // Lights Design Level calculation method.
    1068              :                     {
    1069              :                         // Set space load fraction
    1070         4471 :                         std::string const &lightingLevel = IHGAlphas(4);
    1071         4471 :                         if (lightingLevel == "LIGHTINGLEVEL") {
    1072         2455 :                             Real64 spaceFrac = 1.0;
    1073         2455 :                             if (thisLightsInput.numOfSpaces > 1) {
    1074            9 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1075            9 :                                 if (zoneArea > 0.0) {
    1076            9 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    1077              :                                 } else {
    1078            0 :                                     ShowSevereError(state, format("{}Zone floor area is zero when allocating Lights loads to Spaces.", RoutineName));
    1079            0 :                                     ShowContinueError(
    1080              :                                         state,
    1081            0 :                                         format("Occurs for Lights object ={} in Zone={}", IHGAlphas(1), state.dataHeatBal->Zone(zoneNum).Name));
    1082            0 :                                     ErrorsFound = true;
    1083              :                                 }
    1084              :                             }
    1085              : 
    1086         2455 :                             thisLights.DesignLevel = IHGNumbers(1) * spaceFrac;
    1087         2455 :                             if (IHGNumericFieldBlanks(1)) {
    1088            0 :                                 ShowWarningError(state,
    1089            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Lights will result.",
    1090              :                                                         RoutineName,
    1091              :                                                         lightsModuleObject,
    1092              :                                                         IHGAlphas(1),
    1093              :                                                         IHGNumericFieldNames(1)));
    1094              :                             }
    1095         2016 :                         } else if (lightingLevel == "WATTS/AREA") {
    1096         2014 :                             if (spaceNum != 0) {
    1097         2014 :                                 if (IHGNumbers(2) >= 0.0) {
    1098         2014 :                                     thisLights.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1099         2014 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
    1100            0 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    1101            0 :                                         ShowWarningError(state,
    1102            0 :                                                          format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 Lights will result.",
    1103              :                                                                 RoutineName,
    1104              :                                                                 lightsModuleObject,
    1105            0 :                                                                 thisLights.Name,
    1106              :                                                                 IHGNumericFieldNames(2)));
    1107              :                                     }
    1108              :                                 } else {
    1109            0 :                                     ShowSevereError(state,
    1110            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1111              :                                                            RoutineName,
    1112              :                                                            lightsModuleObject,
    1113            0 :                                                            thisLights.Name,
    1114              :                                                            IHGNumericFieldNames(2),
    1115              :                                                            IHGNumbers(2)));
    1116            0 :                                     ErrorsFound = true;
    1117              :                                 }
    1118              :                             }
    1119         2014 :                             if (IHGNumericFieldBlanks(2)) {
    1120            2 :                                 ShowWarningError(state,
    1121            2 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Lights will result.",
    1122              :                                                         RoutineName,
    1123              :                                                         lightsModuleObject,
    1124              :                                                         IHGAlphas(1),
    1125              :                                                         IHGNumericFieldNames(2)));
    1126              :                             }
    1127            2 :                         } else if (lightingLevel == "WATTS/PERSON") {
    1128            2 :                             if (spaceNum != 0) {
    1129            2 :                                 if (IHGNumbers(3) >= 0.0) {
    1130            2 :                                     thisLights.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1131            2 :                                     if (state.dataHeatBal->space(spaceNum).TotOccupants <= 0.0) {
    1132            0 :                                         ShowWarningError(state,
    1133            0 :                                                          format("{}{}=\"{}\", specifies {}, but Total Occupants = 0.  0 Lights will result.",
    1134              :                                                                 RoutineName,
    1135              :                                                                 lightsModuleObject,
    1136            0 :                                                                 thisLights.Name,
    1137              :                                                                 IHGNumericFieldNames(2)));
    1138              :                                     }
    1139              :                                 } else {
    1140            0 :                                     ShowSevereError(state,
    1141            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1142              :                                                            RoutineName,
    1143              :                                                            lightsModuleObject,
    1144            0 :                                                            thisLights.Name,
    1145              :                                                            IHGNumericFieldNames(3),
    1146              :                                                            IHGNumbers(3)));
    1147            0 :                                     ErrorsFound = true;
    1148              :                                 }
    1149              :                             }
    1150            2 :                             if (IHGNumericFieldBlanks(3)) {
    1151            0 :                                 ShowWarningError(state,
    1152            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Lights will result.",
    1153              :                                                         RoutineName,
    1154              :                                                         lightsModuleObject,
    1155              :                                                         IHGAlphas(1),
    1156              :                                                         IHGNumericFieldNames(3)));
    1157              :                             }
    1158              :                         } else {
    1159            0 :                             if (Item1 == 1) {
    1160            0 :                                 ShowSevereError(state,
    1161            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
    1162              :                                                        RoutineName,
    1163              :                                                        lightsModuleObject,
    1164              :                                                        IHGAlphas(1),
    1165              :                                                        IHGAlphaFieldNames(4),
    1166              :                                                        IHGAlphas(4)));
    1167            0 :                                 ShowContinueError(state, R"(...Valid values are "LightingLevel", "Watts/Area", "Watts/Person".)");
    1168            0 :                                 ErrorsFound = true;
    1169              :                             }
    1170              :                         }
    1171              :                     }
    1172              : 
    1173              :                     // Calculate nominal min/max lighting level
    1174         4471 :                     thisLights.NomMinDesignLevel = thisLights.DesignLevel * thisLights.sched->getMinVal(state);
    1175         4471 :                     thisLights.NomMaxDesignLevel = thisLights.DesignLevel * thisLights.sched->getMaxVal(state);
    1176              : 
    1177         4471 :                     thisLights.FractionReturnAir = IHGNumbers(4);
    1178         4471 :                     thisLights.FractionRadiant = IHGNumbers(5);
    1179         4471 :                     thisLights.FractionShortWave = IHGNumbers(6);
    1180         4471 :                     thisLights.FractionReplaceable = IHGNumbers(7);
    1181         4471 :                     thisLights.FractionReturnAirPlenTempCoeff1 = IHGNumbers(8);
    1182         4471 :                     thisLights.FractionReturnAirPlenTempCoeff2 = IHGNumbers(9);
    1183              : 
    1184         4471 :                     thisLights.FractionConvected = 1.0 - (thisLights.FractionReturnAir + thisLights.FractionRadiant + thisLights.FractionShortWave);
    1185         4471 :                     if (std::abs(thisLights.FractionConvected) <= 0.001) {
    1186          151 :                         thisLights.FractionConvected = 0.0;
    1187              :                     }
    1188         4471 :                     if (thisLights.FractionConvected < 0.0) {
    1189            0 :                         if (Item1 == 1) {
    1190            0 :                             ShowSevereError(state, format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, lightsModuleObject, thisLights.Name));
    1191            0 :                             ErrorsFound = true;
    1192              :                         }
    1193              :                     }
    1194              : 
    1195              :                     // Note: if FractionReturnAirIsCalculated = Yes and there is a return-air plenum:
    1196              :                     // (1) The input values of FractionReturnAir, FractionRadiant and FractionShortWave, and the
    1197              :                     // value of FractionConvected calculated from these are used in the zone sizing calculations;
    1198              :                     // (2) in the regular calculation, FractionReturnAir is calculated each time step in
    1199              :                     // Subr. InitInternalHeatGains as a function of the zone's return plenum air temperature
    1200              :                     // using FractionReturnAirPlenTempCoeff1 and FractionReturnAirPlenTempCoeff2; then
    1201              :                     // FractionRadiant and FractionConvected are adjusted from their input values such that
    1202              :                     // FractionReturnAir + FractionRadiant + FractionShortWave + FractionConvected = 1.0, assuming
    1203              :                     // FractionShortWave is constant and equal to its input value.
    1204              : 
    1205         4471 :                     if (IHGNumAlphas > 4) {
    1206         4449 :                         thisLights.EndUseSubcategory = IHGAlphas(5);
    1207              :                     } else {
    1208           22 :                         thisLights.EndUseSubcategory = "General";
    1209              :                     }
    1210              : 
    1211         4471 :                     if (IHGAlphaFieldBlanks(6)) {
    1212         2156 :                         thisLights.FractionReturnAirIsCalculated = false;
    1213         2315 :                     } else if (IHGAlphas(6) != "YES" && IHGAlphas(6) != "NO") {
    1214            0 :                         if (Item1 == 1) {
    1215            0 :                             ShowWarningError(state,
    1216            0 :                                              format("{}{}=\"{}\", invalid {}, value  ={}",
    1217              :                                                     RoutineName,
    1218              :                                                     lightsModuleObject,
    1219            0 :                                                     thisLightsInput.Name,
    1220              :                                                     IHGAlphaFieldNames(6),
    1221              :                                                     IHGAlphas(6)));
    1222            0 :                             ShowContinueError(state, ".. Return Air Fraction from Plenum will NOT be calculated.");
    1223              :                         }
    1224            0 :                         thisLights.FractionReturnAirIsCalculated = false;
    1225              :                     } else {
    1226         2315 :                         thisLights.FractionReturnAirIsCalculated = (IHGAlphas(6) == "YES");
    1227              :                     }
    1228              : 
    1229              :                     // Set return air node number
    1230         4471 :                     thisLights.ZoneReturnNum = 0;
    1231         4471 :                     thisLights.RetNodeName = "";
    1232         4471 :                     if (!IHGAlphaFieldBlanks(7)) {
    1233            1 :                         if (thisLightsInput.ZoneListActive) {
    1234            0 :                             ShowSevereError(state,
    1235            0 :                                             format("{}{}=\"{}\": {} must be blank when using a ZoneList.",
    1236              :                                                    RoutineName,
    1237              :                                                    lightsModuleObject,
    1238            0 :                                                    thisLightsInput.Name,
    1239              :                                                    IHGAlphaFieldNames(7)));
    1240            0 :                             ErrorsFound = true;
    1241              :                         } else {
    1242            1 :                             thisLights.RetNodeName = IHGAlphas(7);
    1243              :                         }
    1244              :                     }
    1245         4471 :                     if (thisLights.ZonePtr > 0) {
    1246         4471 :                         thisLights.ZoneReturnNum = DataZoneEquipment::GetReturnNumForZone(state, thisLights.ZonePtr, thisLights.RetNodeName);
    1247              :                     }
    1248              : 
    1249         4471 :                     if ((thisLights.ZoneReturnNum == 0) && (thisLights.FractionReturnAir > 0.0) && (!IHGAlphaFieldBlanks(7))) {
    1250            0 :                         ShowSevereError(
    1251              :                             state,
    1252            0 :                             format(
    1253              :                                 "{}{}=\"{}\", invalid {} ={}", RoutineName, lightsModuleObject, IHGAlphas(1), IHGAlphaFieldNames(7), IHGAlphas(7)));
    1254            0 :                         ShowContinueError(state, "No matching Zone Return Air Node found.");
    1255            0 :                         ErrorsFound = true;
    1256              :                     }
    1257              :                     // Set exhaust air node number
    1258         4471 :                     thisLights.ZoneExhaustNodeNum = 0;
    1259         4471 :                     if (!IHGAlphaFieldBlanks(8)) {
    1260            1 :                         if (thisLightsInput.ZoneListActive) {
    1261            0 :                             ShowSevereError(state,
    1262            0 :                                             format("{}{}=\"{}\": {} must be blank when using a ZoneList.",
    1263              :                                                    RoutineName,
    1264              :                                                    lightsModuleObject,
    1265            0 :                                                    thisLightsInput.Name,
    1266              :                                                    IHGAlphaFieldNames(8)));
    1267            0 :                             ErrorsFound = true;
    1268              :                         } else {
    1269            1 :                             bool exhaustNodeError = false;
    1270            1 :                             thisLights.ZoneExhaustNodeNum = GetOnlySingleNode(state,
    1271            1 :                                                                               IHGAlphas(8),
    1272              :                                                                               exhaustNodeError,
    1273              :                                                                               DataLoopNode::ConnectionObjectType::Lights,
    1274            1 :                                                                               thisLights.Name,
    1275              :                                                                               DataLoopNode::NodeFluidType::Air,
    1276              :                                                                               DataLoopNode::ConnectionType::ZoneExhaust,
    1277              :                                                                               NodeInputManager::CompFluidStream::Primary,
    1278              :                                                                               ObjectIsNotParent);
    1279            1 :                             if (!exhaustNodeError) { // GetOnlySingleNode will throw error messages if this is a NodeList Name and for other issues
    1280            1 :                                 exhaustNodeError =
    1281            1 :                                     DataZoneEquipment::VerifyLightsExhaustNodeForZone(state, thisLights.ZonePtr, thisLights.ZoneExhaustNodeNum);
    1282              :                             }
    1283            1 :                             if (exhaustNodeError) {
    1284            0 :                                 ShowSevereError(state,
    1285            0 :                                                 format("{}{}=\"{}\", invalid {} = {}",
    1286              :                                                        RoutineName,
    1287              :                                                        lightsModuleObject,
    1288              :                                                        IHGAlphas(1),
    1289              :                                                        IHGAlphaFieldNames(8),
    1290              :                                                        IHGAlphas(8)));
    1291            0 :                                 ShowContinueError(state, "No matching Zone Exhaust Air Node found.");
    1292            0 :                                 ErrorsFound = true;
    1293              :                             } else {
    1294            1 :                                 if (thisLights.ZoneReturnNum > 0) {
    1295            1 :                                     state.dataZoneEquip->ZoneEquipConfig(thisLights.ZonePtr).ReturnNodeExhaustNodeNum(thisLights.ZoneReturnNum) =
    1296            1 :                                         thisLights.ZoneExhaustNodeNum;
    1297            1 :                                     CheckSharedExhaustFlag = true;
    1298              :                                 } else {
    1299            0 :                                     ShowSevereError(state,
    1300            0 :                                                     format("{}{}=\"{}\", {} ={} is not used",
    1301              :                                                            RoutineName,
    1302              :                                                            lightsModuleObject,
    1303              :                                                            IHGAlphas(1),
    1304              :                                                            IHGAlphaFieldNames(8),
    1305              :                                                            IHGAlphas(8)));
    1306            0 :                                     ShowContinueError(
    1307              :                                         state, "No matching Zone Return Air Node found. The Exhaust Node requires Return Node to work together");
    1308            0 :                                     ErrorsFound = true;
    1309              :                                 }
    1310              :                             }
    1311              :                         }
    1312              : 
    1313            1 :                         if (thisLights.ZonePtr <= 0) {
    1314            0 :                             continue; // Error, will be caught and terminated later
    1315              :                         }
    1316              :                     }
    1317              :                 }
    1318              :             }
    1319          667 :             if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    1320         1352 :                 for (int lightsNum2 = 1; lightsNum2 <= state.dataHeatBal->TotLights; ++lightsNum2) {
    1321         2562 :                     SetupEMSActuator(state,
    1322              :                                      "Lights",
    1323         1281 :                                      state.dataHeatBal->Lights(lightsNum2).Name,
    1324              :                                      "Electricity Rate",
    1325              :                                      "[W]",
    1326         1281 :                                      state.dataHeatBal->Lights(lightsNum2).EMSLightsOn,
    1327         1281 :                                      state.dataHeatBal->Lights(lightsNum2).EMSLightingPower);
    1328         1281 :                     SetupEMSInternalVariable(state,
    1329              :                                              "Lighting Power Design Level",
    1330         1281 :                                              state.dataHeatBal->Lights(lightsNum2).Name,
    1331              :                                              "[W]",
    1332         1281 :                                              state.dataHeatBal->Lights(lightsNum2).DesignLevel);
    1333              :                 } // EMS
    1334              :             }
    1335         5138 :             for (int lightsNum2 = 1; lightsNum2 <= state.dataHeatBal->TotLights; ++lightsNum2) {
    1336         4471 :                 int spaceNum = state.dataHeatBal->Lights(lightsNum2).spaceIndex;
    1337         4471 :                 int zoneNum = state.dataHeatBal->Lights(lightsNum2).ZonePtr;
    1338              :                 // setup internal gains
    1339         4471 :                 int returnNodeNum = 0;
    1340         8808 :                 if ((state.dataHeatBal->Lights(lightsNum2).ZoneReturnNum > 0) &&
    1341         4337 :                     (state.dataHeatBal->Lights(lightsNum2).ZoneReturnNum <= state.dataZoneEquip->ZoneEquipConfig(zoneNum).NumReturnNodes)) {
    1342         4336 :                     returnNodeNum = state.dataZoneEquip->ZoneEquipConfig(zoneNum).ReturnNode(state.dataHeatBal->Lights(lightsNum2).ZoneReturnNum);
    1343              :                 }
    1344         4471 :                 if (!ErrorsFound) {
    1345        22355 :                     SetupSpaceInternalGain(state,
    1346         4471 :                                            state.dataHeatBal->Lights(lightsNum2).spaceIndex,
    1347              :                                            1.0,
    1348         4471 :                                            state.dataHeatBal->Lights(lightsNum2).Name,
    1349              :                                            DataHeatBalance::IntGainType::Lights,
    1350         4471 :                                            &state.dataHeatBal->Lights(lightsNum2).ConGainRate,
    1351         4471 :                                            &state.dataHeatBal->Lights(lightsNum2).RetAirGainRate,
    1352         4471 :                                            &state.dataHeatBal->Lights(lightsNum2).RadGainRate,
    1353              :                                            nullptr,
    1354              :                                            nullptr,
    1355              :                                            nullptr,
    1356              :                                            nullptr,
    1357              :                                            returnNodeNum);
    1358              :                 }
    1359              : 
    1360         4471 :                 if (state.dataHeatBal->Lights(lightsNum2).FractionReturnAir > 0) {
    1361         1052 :                     state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum2).ZonePtr).HasLtsRetAirGain = true;
    1362              :                 }
    1363              :                 // send values to predefined lighting summary report
    1364         4471 :                 std::string liteName = state.dataHeatBal->Lights(lightsNum2).Name;
    1365         4471 :                 Real64 mult = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier;
    1366         4471 :                 Real64 spaceArea = state.dataHeatBal->space(spaceNum).FloorArea;
    1367         4471 :                 sumArea += spaceArea * mult;
    1368         4471 :                 sumPower += state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult;
    1369         4471 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtZone, liteName, state.dataHeatBal->Zone(zoneNum).Name);
    1370         4471 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpace, liteName, state.dataHeatBal->space(spaceNum).Name);
    1371         4471 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpaceType, liteName, state.dataHeatBal->space(spaceNum).spaceType);
    1372         4471 :                 if (spaceArea > 0.0) {
    1373         4468 :                     PreDefTableEntry(
    1374         8936 :                         state, state.dataOutRptPredefined->pdchInLtDens, liteName, state.dataHeatBal->Lights(lightsNum2).DesignLevel / spaceArea, 4);
    1375              :                 } else {
    1376            3 :                     PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, liteName, DataPrecisionGlobals::constant_zero, 4);
    1377              :                 }
    1378         4471 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, liteName, spaceArea * mult);
    1379         8942 :                 PreDefTableEntry(
    1380         4471 :                     state, state.dataOutRptPredefined->pdchInLtPower, liteName, state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult);
    1381         8942 :                 PreDefTableEntry(
    1382         8942 :                     state, state.dataOutRptPredefined->pdchInLtEndUse, liteName, state.dataHeatBal->Lights(lightsNum2).EndUseSubcategory);
    1383         4471 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSchd, liteName, state.dataHeatBal->Lights(lightsNum2).sched->Name);
    1384         4471 :                 PreDefTableEntry(
    1385         4471 :                     state, state.dataOutRptPredefined->pdchInLtRetAir, liteName, state.dataHeatBal->Lights(lightsNum2).FractionReturnAir, 4);
    1386         4471 :             } // Item1 - Number of Lights instances
    1387          667 :             if (CheckSharedExhaustFlag) {
    1388            1 :                 DataZoneEquipment::CheckSharedExhaust(state);
    1389            1 :                 Array1D_bool ReturnNodeShared; // zone supply air inlet nodes
    1390            1 :                 ReturnNodeShared.allocate(state.dataHeatBal->TotLights);
    1391            1 :                 ReturnNodeShared = false;
    1392            6 :                 for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    1393            5 :                     int ZoneNum = state.dataHeatBal->Lights(Loop).ZonePtr;
    1394            5 :                     int ReturnNum = state.dataHeatBal->Lights(Loop).ZoneReturnNum;
    1395            5 :                     int ExhaustNodeNum = state.dataHeatBal->Lights(Loop).ZoneExhaustNodeNum;
    1396            5 :                     if (ReturnNum == 0 || ExhaustNodeNum == 0) {
    1397            4 :                         continue;
    1398              :                     }
    1399            5 :                     for (int Loop1 = Loop + 1; Loop1 <= state.dataHeatBal->TotLights; ++Loop1) {
    1400            4 :                         if (ZoneNum != state.dataHeatBal->Lights(Loop1).ZonePtr) {
    1401            4 :                             continue;
    1402              :                         }
    1403            0 :                         if (ReturnNodeShared(Loop1)) {
    1404            0 :                             continue;
    1405              :                         }
    1406            0 :                         if (ReturnNum == state.dataHeatBal->Lights(Loop1).ZoneReturnNum &&
    1407            0 :                             ExhaustNodeNum != state.dataHeatBal->Lights(Loop1).ZoneExhaustNodeNum) {
    1408            0 :                             ShowSevereError(state,
    1409            0 :                                             format("{}{}: Duplicated Return Air Node = {} is found, ",
    1410              :                                                    RoutineName,
    1411              :                                                    lightsModuleObject,
    1412            0 :                                                    state.dataHeatBal->Lights(Loop1).RetNodeName));
    1413            0 :                             ShowContinueError(state,
    1414            0 :                                               format(" in both Lights objects = {} and {}.",
    1415            0 :                                                      state.dataHeatBal->Lights(Loop).Name,
    1416            0 :                                                      state.dataHeatBal->Lights(Loop1).Name));
    1417            0 :                             ErrorsFound = true;
    1418            0 :                             ReturnNodeShared(Loop1) = true;
    1419              :                         }
    1420              :                     }
    1421              :                 }
    1422            1 :                 ReturnNodeShared.deallocate();
    1423            1 :             }
    1424              :         } // TotLights > 0 check
    1425              :         // add total line to lighting summary table
    1426          801 :         if (sumArea > 0.0) {
    1427          667 :             PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", sumPower / sumArea,
    1428         1334 :                              4); // line 792
    1429              :         } else {
    1430          134 :             PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", DataPrecisionGlobals::constant_zero, 4);
    1431              :         }
    1432          801 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, "Interior Lighting Total", sumArea);
    1433          801 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtPower, "Interior Lighting Total", sumPower);
    1434              : 
    1435              :         // ElectricEquipment
    1436              :         // Declared in state because the lights inputs are needed for demand manager
    1437          801 :         int numZoneElectricStatements = 0;
    1438          801 :         setupIHGZonesAndSpaces(state,
    1439              :                                elecEqModuleObject,
    1440          801 :                                state.dataInternalHeatGains->zoneElectricObjects,
    1441              :                                numZoneElectricStatements,
    1442          801 :                                state.dataHeatBal->TotElecEquip,
    1443              :                                ErrorsFound);
    1444              : 
    1445          801 :         if (state.dataHeatBal->TotElecEquip > 0) {
    1446          655 :             state.dataHeatBal->ZoneElectric.allocate(state.dataHeatBal->TotElecEquip);
    1447          655 :             int elecEqNum = 0;
    1448         5124 :             for (int elecEqInputNum = 1; elecEqInputNum <= numZoneElectricStatements; ++elecEqInputNum) {
    1449              : 
    1450         4469 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1451              :                                                                          elecEqModuleObject,
    1452              :                                                                          elecEqInputNum,
    1453              :                                                                          IHGAlphas,
    1454              :                                                                          IHGNumAlphas,
    1455              :                                                                          IHGNumbers,
    1456              :                                                                          IHGNumNumbers,
    1457              :                                                                          IOStat,
    1458              :                                                                          IHGNumericFieldBlanks,
    1459              :                                                                          IHGAlphaFieldBlanks,
    1460              :                                                                          IHGAlphaFieldNames,
    1461              :                                                                          IHGNumericFieldNames);
    1462              : 
    1463         4469 :                 ErrorObjectHeader eoh{routineName, elecEqModuleObject, IHGAlphas(1)};
    1464              : 
    1465         4469 :                 auto &thisElecEqInput = state.dataInternalHeatGains->zoneElectricObjects(elecEqInputNum);
    1466         9047 :                 for (int Item1 = 1; Item1 <= thisElecEqInput.numOfSpaces; ++Item1) {
    1467         4578 :                     ++elecEqNum;
    1468         4578 :                     auto &thisZoneElectric = state.dataHeatBal->ZoneElectric(elecEqNum);
    1469         4578 :                     int const spaceNum = thisElecEqInput.spaceNums(Item1);
    1470         4578 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1471         4578 :                     thisZoneElectric.Name = thisElecEqInput.names(Item1);
    1472         4578 :                     thisZoneElectric.spaceIndex = spaceNum;
    1473         4578 :                     thisZoneElectric.ZonePtr = zoneNum;
    1474              : 
    1475              :                     // Why are error messages not guarded by (Item1 == 1) checks for equipment?
    1476              : 
    1477         4578 :                     if (IHGAlphaFieldBlanks(3)) {
    1478            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1479            0 :                         ErrorsFound = true;
    1480         4578 :                     } else if ((thisZoneElectric.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    1481            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1482            0 :                         ErrorsFound = true;
    1483         4578 :                     } else if (!thisZoneElectric.sched->checkMinVal(state, Clusive::In, 0.0)) {
    1484            0 :                         Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    1485            0 :                         ErrorsFound = true;
    1486              :                     }
    1487              : 
    1488              :                     // Electric equipment design level calculation method.
    1489              :                     {
    1490         4578 :                         std::string const &equipmentLevel = IHGAlphas(4);
    1491         4578 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    1492         3268 :                             Real64 spaceFrac = 1.0;
    1493         3268 :                             if (thisElecEqInput.numOfSpaces > 1) {
    1494            0 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1495            0 :                                 if (zoneArea > 0.0) {
    1496            0 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    1497              :                                 } else {
    1498            0 :                                     ShowSevereError(
    1499            0 :                                         state, format("{}Zone floor area is zero when allocating ElectricEquipment loads to Spaces.", RoutineName));
    1500            0 :                                     ShowContinueError(state,
    1501            0 :                                                       format("Occurs for ElectricEquipment object ={} in Zone={}",
    1502            0 :                                                              thisElecEqInput.Name,
    1503            0 :                                                              state.dataHeatBal->Zone(thisZoneElectric.ZonePtr).Name));
    1504            0 :                                     ErrorsFound = true;
    1505              :                                 }
    1506              :                             }
    1507         3268 :                             thisZoneElectric.DesignLevel = IHGNumbers(1) * spaceFrac;
    1508         3268 :                             if (IHGNumericFieldBlanks(1)) {
    1509            0 :                                 ShowWarningError(state,
    1510            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Electric Equipment will result.",
    1511              :                                                         RoutineName,
    1512              :                                                         elecEqModuleObject,
    1513            0 :                                                         thisElecEqInput.Name,
    1514              :                                                         IHGNumericFieldNames(1)));
    1515              :                             }
    1516         1310 :                         } else if (equipmentLevel == "WATTS/AREA") {
    1517         1278 :                             if (spaceNum != 0) {
    1518         1278 :                                 if (IHGNumbers(2) >= 0.0) {
    1519         1278 :                                     thisZoneElectric.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1520         1278 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
    1521            0 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    1522            0 :                                         ShowWarningError(
    1523              :                                             state,
    1524            0 :                                             format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 Electric Equipment will result.",
    1525              :                                                    RoutineName,
    1526              :                                                    elecEqModuleObject,
    1527            0 :                                                    thisZoneElectric.Name,
    1528              :                                                    IHGNumericFieldNames(2)));
    1529              :                                     }
    1530              :                                 } else {
    1531            0 :                                     ShowSevereError(state,
    1532            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1533              :                                                            RoutineName,
    1534              :                                                            elecEqModuleObject,
    1535            0 :                                                            thisZoneElectric.Name,
    1536              :                                                            IHGNumericFieldNames(2),
    1537              :                                                            IHGNumbers(2)));
    1538            0 :                                     ErrorsFound = true;
    1539              :                                 }
    1540              :                             }
    1541         1278 :                             if (IHGNumericFieldBlanks(2)) {
    1542            0 :                                 ShowWarningError(state,
    1543            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Electric Equipment will result.",
    1544              :                                                         RoutineName,
    1545              :                                                         elecEqModuleObject,
    1546            0 :                                                         thisElecEqInput.Name,
    1547              :                                                         IHGNumericFieldNames(2)));
    1548              :                             }
    1549              : 
    1550           32 :                         } else if (equipmentLevel == "WATTS/PERSON") {
    1551           32 :                             if (spaceNum != 0) {
    1552           32 :                                 if (IHGNumbers(3) >= 0.0) {
    1553           32 :                                     thisZoneElectric.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1554           32 :                                     if (state.dataHeatBal->space(spaceNum).TotOccupants <= 0.0) {
    1555            0 :                                         ShowWarningError(
    1556              :                                             state,
    1557            0 :                                             format("{}{}=\"{}\", specifies {}, but Total Occupants = 0.  0 Electric Equipment will result.",
    1558              :                                                    RoutineName,
    1559              :                                                    elecEqModuleObject,
    1560            0 :                                                    thisZoneElectric.Name,
    1561              :                                                    IHGNumericFieldNames(2)));
    1562              :                                     }
    1563              :                                 } else {
    1564            0 :                                     ShowSevereError(state,
    1565            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1566              :                                                            RoutineName,
    1567              :                                                            elecEqModuleObject,
    1568            0 :                                                            thisZoneElectric.Name,
    1569              :                                                            IHGNumericFieldNames(3),
    1570              :                                                            IHGNumbers(3)));
    1571            0 :                                     ErrorsFound = true;
    1572              :                                 }
    1573              :                             }
    1574           32 :                             if (IHGNumericFieldBlanks(3)) {
    1575            0 :                                 ShowWarningError(state,
    1576            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Electric Equipment will result.",
    1577              :                                                         RoutineName,
    1578              :                                                         elecEqModuleObject,
    1579            0 :                                                         thisElecEqInput.Name,
    1580              :                                                         IHGNumericFieldNames(3)));
    1581              :                             }
    1582              : 
    1583              :                         } else {
    1584            0 :                             if (Item1 == 1) {
    1585            0 :                                 ShowSevereError(state,
    1586            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
    1587              :                                                        RoutineName,
    1588              :                                                        elecEqModuleObject,
    1589            0 :                                                        thisElecEqInput.Name,
    1590              :                                                        IHGAlphaFieldNames(4),
    1591              :                                                        IHGAlphas(4)));
    1592            0 :                                 ShowContinueError(state, "...Valid values are \"EquipmentLevel\", \"Watts/Area\", \"Watts/Person\".");
    1593            0 :                                 ErrorsFound = true;
    1594              :                             }
    1595              :                         }
    1596              :                     }
    1597              : 
    1598              :                     // Calculate nominal min/max equipment level
    1599         4578 :                     thisZoneElectric.NomMinDesignLevel = thisZoneElectric.DesignLevel * thisZoneElectric.sched->getMinVal(state);
    1600         4578 :                     thisZoneElectric.NomMaxDesignLevel = thisZoneElectric.DesignLevel * thisZoneElectric.sched->getMaxVal(state);
    1601              : 
    1602         4578 :                     thisZoneElectric.FractionLatent = IHGNumbers(4);
    1603         4578 :                     thisZoneElectric.FractionRadiant = IHGNumbers(5);
    1604         4578 :                     thisZoneElectric.FractionLost = IHGNumbers(6);
    1605              :                     // FractionConvected is a calculated field
    1606         4578 :                     thisZoneElectric.FractionConvected =
    1607         4578 :                         1.0 - (thisZoneElectric.FractionLatent + thisZoneElectric.FractionRadiant + thisZoneElectric.FractionLost);
    1608         4578 :                     if (std::abs(thisZoneElectric.FractionConvected) <= 0.001) {
    1609           66 :                         thisZoneElectric.FractionConvected = 0.0;
    1610              :                     }
    1611         4578 :                     if (thisZoneElectric.FractionConvected < 0.0) {
    1612            0 :                         ShowSevereError(state, format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, elecEqModuleObject, thisElecEqInput.Name));
    1613            0 :                         ErrorsFound = true;
    1614              :                     }
    1615              : 
    1616         4578 :                     if (IHGNumAlphas > 4) {
    1617         2560 :                         thisZoneElectric.EndUseSubcategory = IHGAlphas(5);
    1618              :                     } else {
    1619         2018 :                         thisZoneElectric.EndUseSubcategory = "General";
    1620              :                     }
    1621         4578 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    1622         1242 :                         SetupEMSActuator(state,
    1623              :                                          "ElectricEquipment",
    1624              :                                          thisZoneElectric.Name,
    1625              :                                          "Electricity Rate",
    1626              :                                          "[W]",
    1627         1242 :                                          thisZoneElectric.EMSZoneEquipOverrideOn,
    1628         1242 :                                          thisZoneElectric.EMSEquipPower);
    1629         1242 :                         SetupEMSInternalVariable(
    1630         1242 :                             state, "Plug and Process Power Design Level", thisZoneElectric.Name, "[W]", thisZoneElectric.DesignLevel);
    1631              :                     } // EMS
    1632         4578 :                     if (!ErrorsFound) {
    1633         4578 :                         SetupSpaceInternalGain(state,
    1634              :                                                thisZoneElectric.spaceIndex,
    1635              :                                                1.0,
    1636              :                                                thisZoneElectric.Name,
    1637              :                                                DataHeatBalance::IntGainType::ElectricEquipment,
    1638              :                                                &thisZoneElectric.ConGainRate,
    1639              :                                                nullptr,
    1640              :                                                &thisZoneElectric.RadGainRate,
    1641              :                                                &thisZoneElectric.LatGainRate);
    1642              :                     }
    1643              :                 } // for elecEqInputNum.NumOfSpaces
    1644              :             } // for elecEqInputNum
    1645              :         } // TotElecEquip > 0
    1646              : 
    1647              :         // GasEquipment
    1648         1602 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> zoneGasObjects;
    1649          801 :         int numZoneGasStatements = 0;
    1650          801 :         setupIHGZonesAndSpaces(state, gasEqModuleObject, zoneGasObjects, numZoneGasStatements, state.dataHeatBal->TotGasEquip, ErrorsFound);
    1651              : 
    1652          801 :         if (state.dataHeatBal->TotGasEquip > 0) {
    1653           39 :             state.dataHeatBal->ZoneGas.allocate(state.dataHeatBal->TotGasEquip);
    1654           39 :             int gasEqNum = 0;
    1655          125 :             for (int gasEqInputNum = 1; gasEqInputNum <= numZoneGasStatements; ++gasEqInputNum) {
    1656              : 
    1657           86 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1658              :                                                                          gasEqModuleObject,
    1659              :                                                                          gasEqInputNum,
    1660              :                                                                          IHGAlphas,
    1661              :                                                                          IHGNumAlphas,
    1662              :                                                                          IHGNumbers,
    1663              :                                                                          IHGNumNumbers,
    1664              :                                                                          IOStat,
    1665              :                                                                          IHGNumericFieldBlanks,
    1666              :                                                                          IHGAlphaFieldBlanks,
    1667              :                                                                          IHGAlphaFieldNames,
    1668              :                                                                          IHGNumericFieldNames);
    1669              : 
    1670           86 :                 ErrorObjectHeader eoh{routineName, gasEqModuleObject, IHGAlphas(1)};
    1671              : 
    1672           86 :                 auto &thisGasEqInput = zoneGasObjects(gasEqInputNum);
    1673          174 :                 for (int Item1 = 1; Item1 <= thisGasEqInput.numOfSpaces; ++Item1) {
    1674           88 :                     ++gasEqNum;
    1675           88 :                     auto &thisZoneGas = state.dataHeatBal->ZoneGas(gasEqNum);
    1676           88 :                     int const spaceNum = thisGasEqInput.spaceNums(Item1);
    1677           88 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1678           88 :                     thisZoneGas.Name = thisGasEqInput.names(Item1);
    1679           88 :                     thisZoneGas.spaceIndex = spaceNum;
    1680           88 :                     thisZoneGas.ZonePtr = zoneNum;
    1681              : 
    1682           88 :                     if (!IHGAlphaFieldBlanks(3)) {
    1683           88 :                         thisZoneGas.sched = Sched::GetSchedule(state, IHGAlphas(3));
    1684              :                     }
    1685              : 
    1686              :                     // And here for gas, we are guarding with (Item1 == 1) again
    1687           88 :                     if (Item1 == 1) {
    1688           86 :                         if (IHGAlphaFieldBlanks(3)) {
    1689            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1690            0 :                             ErrorsFound = true;
    1691           86 :                         } else if (thisZoneGas.sched == nullptr) {
    1692            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1693            0 :                             ErrorsFound = true;
    1694           86 :                         } else if (!thisZoneGas.sched->checkMinVal(state, Clusive::In, 0.0)) {
    1695            0 :                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    1696            0 :                             ErrorsFound = true;
    1697              :                         }
    1698              :                     }
    1699              : 
    1700              :                     // Gas equipment design level calculation method.
    1701              :                     {
    1702           88 :                         std::string const &equipmentLevel = IHGAlphas(4);
    1703           88 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    1704           80 :                             Real64 spaceFrac = 1.0;
    1705           80 :                             if (thisGasEqInput.numOfSpaces > 1) {
    1706            0 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1707            0 :                                 if (zoneArea > 0.0) {
    1708            0 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    1709              :                                 } else {
    1710            0 :                                     ShowSevereError(state,
    1711            0 :                                                     format("{}Zone floor area is zero when allocating GasEquipment loads to Spaces.", RoutineName));
    1712            0 :                                     ShowContinueError(state,
    1713            0 :                                                       format("Occurs for GasEquipment object ={} in Zone={}",
    1714            0 :                                                              thisGasEqInput.Name,
    1715            0 :                                                              state.dataHeatBal->Zone(thisZoneGas.ZonePtr).Name));
    1716            0 :                                     ErrorsFound = true;
    1717              :                                 }
    1718              :                             }
    1719           80 :                             thisZoneGas.DesignLevel = IHGNumbers(1) * spaceFrac;
    1720           80 :                             if (IHGNumericFieldBlanks(1)) {
    1721            0 :                                 ShowWarningError(state,
    1722            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Gas Equipment will result.",
    1723              :                                                         RoutineName,
    1724              :                                                         gasEqModuleObject,
    1725            0 :                                                         thisGasEqInput.Name,
    1726              :                                                         IHGNumericFieldNames(1)));
    1727              :                             }
    1728            8 :                         } else if (equipmentLevel == "WATTS/AREA" || equipmentLevel == "POWER/AREA") {
    1729            8 :                             if (spaceNum != 0) {
    1730            8 :                                 if (IHGNumbers(2) >= 0.0) {
    1731            8 :                                     thisZoneGas.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1732            8 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
    1733            0 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    1734            0 :                                         ShowWarningError(state,
    1735            0 :                                                          format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 Gas Equipment will result.",
    1736              :                                                                 RoutineName,
    1737              :                                                                 gasEqModuleObject,
    1738            0 :                                                                 thisZoneGas.Name,
    1739              :                                                                 IHGNumericFieldNames(2)));
    1740              :                                     }
    1741              :                                 } else {
    1742            0 :                                     ShowSevereError(state,
    1743            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1744              :                                                            RoutineName,
    1745              :                                                            gasEqModuleObject,
    1746            0 :                                                            thisGasEqInput.Name,
    1747              :                                                            IHGNumericFieldNames(2),
    1748              :                                                            IHGNumbers(2)));
    1749            0 :                                     ErrorsFound = true;
    1750              :                                 }
    1751              :                             }
    1752            8 :                             if (IHGNumericFieldBlanks(2)) {
    1753            0 :                                 ShowWarningError(state,
    1754            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Gas Equipment will result.",
    1755              :                                                         RoutineName,
    1756              :                                                         gasEqModuleObject,
    1757            0 :                                                         thisGasEqInput.Name,
    1758              :                                                         IHGNumericFieldNames(2)));
    1759              :                             }
    1760              : 
    1761            0 :                         } else if (equipmentLevel == "WATTS/PERSON" || equipmentLevel == "POWER/PERSON") {
    1762            0 :                             if (spaceNum != 0) {
    1763            0 :                                 if (IHGNumbers(3) >= 0.0) {
    1764            0 :                                     thisZoneGas.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1765            0 :                                     if (state.dataHeatBal->space(spaceNum).TotOccupants <= 0.0) {
    1766            0 :                                         ShowWarningError(state,
    1767            0 :                                                          format("{}{}=\"{}\", specifies {}, but Total Occupants = 0.  0 Gas Equipment will result.",
    1768              :                                                                 RoutineName,
    1769              :                                                                 gasEqModuleObject,
    1770            0 :                                                                 thisZoneGas.Name,
    1771              :                                                                 IHGNumericFieldNames(2)));
    1772              :                                     }
    1773              :                                 } else {
    1774            0 :                                     ShowSevereError(state,
    1775            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1776              :                                                            RoutineName,
    1777              :                                                            gasEqModuleObject,
    1778            0 :                                                            thisGasEqInput.Name,
    1779              :                                                            IHGNumericFieldNames(3),
    1780              :                                                            IHGNumbers(3)));
    1781            0 :                                     ErrorsFound = true;
    1782              :                                 }
    1783              :                             }
    1784            0 :                             if (IHGNumericFieldBlanks(3)) {
    1785            0 :                                 ShowWarningError(state,
    1786            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Gas Equipment will result.",
    1787              :                                                         RoutineName,
    1788              :                                                         gasEqModuleObject,
    1789            0 :                                                         thisGasEqInput.Name,
    1790              :                                                         IHGNumericFieldNames(3)));
    1791              :                             }
    1792              : 
    1793              :                         } else {
    1794            0 :                             if (Item1 == 1) {
    1795            0 :                                 ShowSevereInvalidKey(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4));
    1796            0 :                                 ErrorsFound = true;
    1797              :                             }
    1798              :                         }
    1799              :                     }
    1800              : 
    1801              :                     // Calculate nominal min/max equipment level
    1802           88 :                     thisZoneGas.NomMinDesignLevel = thisZoneGas.DesignLevel * thisZoneGas.sched->getMinVal(state);
    1803           88 :                     thisZoneGas.NomMaxDesignLevel = thisZoneGas.DesignLevel * thisZoneGas.sched->getMaxVal(state);
    1804              : 
    1805           88 :                     thisZoneGas.FractionLatent = IHGNumbers(4);
    1806           88 :                     thisZoneGas.FractionRadiant = IHGNumbers(5);
    1807           88 :                     thisZoneGas.FractionLost = IHGNumbers(6);
    1808              : 
    1809           88 :                     if ((IHGNumNumbers == 7) || (!IHGNumericFieldBlanks(7))) {
    1810           80 :                         thisZoneGas.CO2RateFactor = IHGNumbers(7);
    1811              :                     }
    1812           88 :                     if (thisZoneGas.CO2RateFactor < 0.0) {
    1813            0 :                         ShowSevereError(state,
    1814            0 :                                         format("{}{}=\"{}\", {} < 0.0, value ={:.2R}",
    1815              :                                                RoutineName,
    1816              :                                                gasEqModuleObject,
    1817            0 :                                                thisGasEqInput.Name,
    1818              :                                                IHGNumericFieldNames(7),
    1819              :                                                IHGNumbers(7)));
    1820            0 :                         ErrorsFound = true;
    1821              :                     }
    1822           88 :                     if (thisZoneGas.CO2RateFactor > 4.0e-7) {
    1823            0 :                         ShowSevereError(state,
    1824            0 :                                         format("{}{}=\"{}\", {} > 4.0E-7, value ={:.2R}",
    1825              :                                                RoutineName,
    1826              :                                                gasEqModuleObject,
    1827            0 :                                                thisGasEqInput.Name,
    1828              :                                                IHGNumericFieldNames(7),
    1829              :                                                IHGNumbers(7)));
    1830            0 :                         ErrorsFound = true;
    1831              :                     }
    1832              :                     // FractionConvected is a calculated field
    1833           88 :                     thisZoneGas.FractionConvected = 1.0 - (thisZoneGas.FractionLatent + thisZoneGas.FractionRadiant + thisZoneGas.FractionLost);
    1834           88 :                     if (std::abs(thisZoneGas.FractionConvected) <= 0.001) {
    1835           14 :                         thisZoneGas.FractionConvected = 0.0;
    1836              :                     }
    1837           88 :                     if (thisZoneGas.FractionConvected < 0.0) {
    1838            0 :                         if (Item1 == 1) {
    1839            0 :                             ShowSevereError(state,
    1840            0 :                                             format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, gasEqModuleObject, thisGasEqInput.Name));
    1841            0 :                             ErrorsFound = true;
    1842              :                         }
    1843              :                     }
    1844              : 
    1845           88 :                     if (IHGNumAlphas > 4) {
    1846           80 :                         thisZoneGas.EndUseSubcategory = IHGAlphas(5);
    1847              :                     } else {
    1848            8 :                         thisZoneGas.EndUseSubcategory = "General";
    1849              :                     }
    1850              : 
    1851           88 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    1852           20 :                         SetupEMSActuator(state,
    1853              :                                          "GasEquipment",
    1854              :                                          thisZoneGas.Name,
    1855              :                                          "NaturalGas Rate",
    1856              :                                          "[W]",
    1857           20 :                                          thisZoneGas.EMSZoneEquipOverrideOn,
    1858           20 :                                          thisZoneGas.EMSEquipPower);
    1859           20 :                         SetupEMSInternalVariable(state, "Gas Process Power Design Level", thisZoneGas.Name, "[W]", thisZoneGas.DesignLevel);
    1860              :                     } // EMS
    1861              : 
    1862           88 :                     if (!ErrorsFound) {
    1863           88 :                         SetupSpaceInternalGain(state,
    1864              :                                                thisZoneGas.spaceIndex,
    1865              :                                                1.0,
    1866              :                                                thisZoneGas.Name,
    1867              :                                                DataHeatBalance::IntGainType::GasEquipment,
    1868              :                                                &thisZoneGas.ConGainRate,
    1869              :                                                nullptr,
    1870              :                                                &thisZoneGas.RadGainRate,
    1871              :                                                &thisZoneGas.LatGainRate,
    1872              :                                                nullptr,
    1873              :                                                &thisZoneGas.CO2GainRate);
    1874              :                     }
    1875              : 
    1876              :                 } // for gasEqInputNum.NumOfSpaces
    1877              :             } // for gasEqInputNum
    1878              :         } // TotGasEquip > 0
    1879              : 
    1880              :         // HotWaterEquipment
    1881         1602 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> hotWaterEqObjects;
    1882          801 :         int numHotWaterEqStatements = 0;
    1883          801 :         setupIHGZonesAndSpaces(state, hwEqModuleObject, hotWaterEqObjects, numHotWaterEqStatements, state.dataHeatBal->TotHWEquip, ErrorsFound);
    1884              : 
    1885          801 :         if (state.dataHeatBal->TotHWEquip > 0) {
    1886            6 :             state.dataHeatBal->ZoneHWEq.allocate(state.dataHeatBal->TotHWEquip);
    1887            6 :             int hwEqNum = 0;
    1888           12 :             for (int hwEqInputNum = 1; hwEqInputNum <= numHotWaterEqStatements; ++hwEqInputNum) {
    1889              : 
    1890            6 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1891              :                                                                          hwEqModuleObject,
    1892              :                                                                          hwEqInputNum,
    1893              :                                                                          IHGAlphas,
    1894              :                                                                          IHGNumAlphas,
    1895              :                                                                          IHGNumbers,
    1896              :                                                                          IHGNumNumbers,
    1897              :                                                                          IOStat,
    1898              :                                                                          IHGNumericFieldBlanks,
    1899              :                                                                          IHGAlphaFieldBlanks,
    1900              :                                                                          IHGAlphaFieldNames,
    1901              :                                                                          IHGNumericFieldNames);
    1902              : 
    1903            6 :                 ErrorObjectHeader eoh{routineName, hwEqModuleObject, IHGAlphas(1)};
    1904              : 
    1905            6 :                 auto &thisHWEqInput = hotWaterEqObjects(hwEqInputNum);
    1906           20 :                 for (int Item1 = 1; Item1 <= thisHWEqInput.numOfSpaces; ++Item1) {
    1907           14 :                     ++hwEqNum;
    1908           14 :                     auto &thisZoneHWEq = state.dataHeatBal->ZoneHWEq(hwEqNum);
    1909           14 :                     int const spaceNum = thisHWEqInput.spaceNums(Item1);
    1910           14 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1911           14 :                     thisZoneHWEq.Name = thisHWEqInput.names(Item1);
    1912           14 :                     thisZoneHWEq.spaceIndex = spaceNum;
    1913           14 :                     thisZoneHWEq.ZonePtr = zoneNum;
    1914              : 
    1915           14 :                     if (IHGAlphaFieldBlanks(3)) {
    1916            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1917            0 :                         ErrorsFound = true;
    1918           14 :                     } else if ((thisZoneHWEq.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    1919            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1920            0 :                         ErrorsFound = true;
    1921           14 :                     } else if (!thisZoneHWEq.sched->checkMinVal(state, Clusive::In, 0.0)) {
    1922            0 :                         Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    1923            0 :                         ErrorsFound = true;
    1924              :                     }
    1925              : 
    1926              :                     // Hot Water equipment design level calculation method.
    1927              :                     {
    1928           14 :                         std::string const &equipmentLevel = IHGAlphas(4);
    1929           14 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    1930            5 :                             Real64 spaceFrac = 1.0;
    1931            5 :                             if (thisHWEqInput.numOfSpaces > 1) {
    1932            0 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1933            0 :                                 if (zoneArea > 0.0) {
    1934            0 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    1935              :                                 } else {
    1936            0 :                                     ShowSevereError(
    1937            0 :                                         state, format("{}Zone floor area is zero when allocating HotWaterEquipment loads to Spaces.", RoutineName));
    1938            0 :                                     ShowContinueError(state,
    1939            0 :                                                       format("Occurs for HotWaterEquipment object ={} in Zone={}",
    1940            0 :                                                              thisHWEqInput.Name,
    1941            0 :                                                              state.dataHeatBal->Zone(zoneNum).Name));
    1942            0 :                                     ErrorsFound = true;
    1943              :                                 }
    1944              :                             }
    1945            5 :                             thisZoneHWEq.DesignLevel = IHGNumbers(1) * spaceFrac;
    1946            5 :                             if (IHGNumericFieldBlanks(1)) {
    1947            0 :                                 ShowWarningError(state,
    1948            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Hot Water Equipment will result.",
    1949              :                                                         RoutineName,
    1950              :                                                         hwEqModuleObject,
    1951            0 :                                                         thisHWEqInput.Name,
    1952              :                                                         IHGNumericFieldNames(1)));
    1953              :                             }
    1954            9 :                         } else if (equipmentLevel == "WATTS/AREA" || equipmentLevel == "POWER/AREA") {
    1955            0 :                             if (spaceNum != 0) {
    1956            0 :                                 if (IHGNumbers(2) >= 0.0) {
    1957            0 :                                     thisZoneHWEq.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1958            0 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
    1959            0 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    1960            0 :                                         ShowWarningError(
    1961              :                                             state,
    1962            0 :                                             format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 Hot Water Equipment will result.",
    1963              :                                                    RoutineName,
    1964              :                                                    hwEqModuleObject,
    1965            0 :                                                    thisZoneHWEq.Name,
    1966              :                                                    IHGNumericFieldNames(2)));
    1967              :                                     }
    1968              :                                 } else {
    1969            0 :                                     ShowSevereError(state,
    1970            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    1971              :                                                            RoutineName,
    1972              :                                                            hwEqModuleObject,
    1973            0 :                                                            thisHWEqInput.Name,
    1974              :                                                            IHGNumericFieldNames(2),
    1975              :                                                            IHGNumbers(2)));
    1976            0 :                                     ErrorsFound = true;
    1977              :                                 }
    1978              :                             }
    1979            0 :                             if (IHGNumericFieldBlanks(2)) {
    1980            0 :                                 ShowWarningError(state,
    1981            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Hot Water Equipment will result.",
    1982              :                                                         RoutineName,
    1983              :                                                         hwEqModuleObject,
    1984            0 :                                                         thisHWEqInput.Name,
    1985              :                                                         IHGNumericFieldNames(2)));
    1986              :                             }
    1987              : 
    1988            9 :                         } else if (equipmentLevel == "WATTS/PERSON" || equipmentLevel == "POWER/PERSON") {
    1989            9 :                             if (spaceNum != 0) {
    1990            9 :                                 if (IHGNumbers(3) >= 0.0) {
    1991            9 :                                     thisZoneHWEq.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1992            9 :                                     if (state.dataHeatBal->space(spaceNum).TotOccupants <= 0.0) {
    1993            0 :                                         ShowWarningError(
    1994              :                                             state,
    1995            0 :                                             format("{}{}=\"{}\", specifies {}, but Total Occupants = 0.  0 Hot Water Equipment will result.",
    1996              :                                                    RoutineName,
    1997              :                                                    hwEqModuleObject,
    1998            0 :                                                    thisZoneHWEq.Name,
    1999              :                                                    IHGNumericFieldNames(2)));
    2000              :                                     }
    2001              :                                 } else {
    2002            0 :                                     ShowSevereError(state,
    2003            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    2004              :                                                            RoutineName,
    2005              :                                                            hwEqModuleObject,
    2006            0 :                                                            thisHWEqInput.Name,
    2007              :                                                            IHGNumericFieldNames(3),
    2008              :                                                            IHGNumbers(3)));
    2009            0 :                                     ErrorsFound = true;
    2010              :                                 }
    2011              :                             }
    2012            9 :                             if (IHGNumericFieldBlanks(3)) {
    2013            0 :                                 ShowWarningError(state,
    2014            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Hot Water Equipment will result.",
    2015              :                                                         RoutineName,
    2016              :                                                         hwEqModuleObject,
    2017            0 :                                                         thisHWEqInput.Name,
    2018              :                                                         IHGNumericFieldNames(3)));
    2019              :                             }
    2020              : 
    2021              :                         } else {
    2022            0 :                             if (Item1 == 1) {
    2023            0 :                                 ShowSevereError(state,
    2024            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
    2025              :                                                        RoutineName,
    2026              :                                                        hwEqModuleObject,
    2027            0 :                                                        thisHWEqInput.Name,
    2028              :                                                        IHGAlphaFieldNames(4),
    2029              :                                                        IHGAlphas(4)));
    2030            0 :                                 ShowContinueError(state, "...Valid values are \"EquipmentLevel\", \"Watts/Area\", \"Watts/Person\".");
    2031            0 :                                 ErrorsFound = true;
    2032              :                             }
    2033              :                         }
    2034              :                     }
    2035              : 
    2036              :                     // Calculate nominal min/max equipment level
    2037           14 :                     thisZoneHWEq.NomMinDesignLevel = thisZoneHWEq.DesignLevel * thisZoneHWEq.sched->getMinVal(state);
    2038           14 :                     thisZoneHWEq.NomMaxDesignLevel = thisZoneHWEq.DesignLevel * thisZoneHWEq.sched->getMaxVal(state);
    2039              : 
    2040           14 :                     thisZoneHWEq.FractionLatent = IHGNumbers(4);
    2041           14 :                     thisZoneHWEq.FractionRadiant = IHGNumbers(5);
    2042           14 :                     thisZoneHWEq.FractionLost = IHGNumbers(6);
    2043              :                     // FractionConvected is a calculated field
    2044           14 :                     thisZoneHWEq.FractionConvected = 1.0 - (thisZoneHWEq.FractionLatent + thisZoneHWEq.FractionRadiant + thisZoneHWEq.FractionLost);
    2045           14 :                     if (std::abs(thisZoneHWEq.FractionConvected) <= 0.001) {
    2046            0 :                         thisZoneHWEq.FractionConvected = 0.0;
    2047              :                     }
    2048           14 :                     if (thisZoneHWEq.FractionConvected < 0.0) {
    2049            0 :                         ShowSevereError(state, format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, hwEqModuleObject, thisHWEqInput.Name));
    2050            0 :                         ErrorsFound = true;
    2051              :                     }
    2052              : 
    2053           14 :                     if (IHGNumAlphas > 4) {
    2054           14 :                         thisZoneHWEq.EndUseSubcategory = IHGAlphas(5);
    2055              :                     } else {
    2056            0 :                         thisZoneHWEq.EndUseSubcategory = "General";
    2057              :                     }
    2058              : 
    2059           14 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2060            0 :                         SetupEMSActuator(state,
    2061              :                                          "HotWaterEquipment",
    2062              :                                          thisZoneHWEq.Name,
    2063              :                                          "District Heating Power Level",
    2064              :                                          "[W]",
    2065            0 :                                          thisZoneHWEq.EMSZoneEquipOverrideOn,
    2066            0 :                                          thisZoneHWEq.EMSEquipPower);
    2067            0 :                         SetupEMSInternalVariable(state, "Process District Heat Design Level", thisZoneHWEq.Name, "[W]", thisZoneHWEq.DesignLevel);
    2068              :                     } // EMS
    2069              : 
    2070           14 :                     if (!ErrorsFound) {
    2071           14 :                         SetupSpaceInternalGain(state,
    2072              :                                                thisZoneHWEq.spaceIndex,
    2073              :                                                1.0,
    2074              :                                                thisZoneHWEq.Name,
    2075              :                                                DataHeatBalance::IntGainType::HotWaterEquipment,
    2076              :                                                &thisZoneHWEq.ConGainRate,
    2077              :                                                nullptr,
    2078              :                                                &thisZoneHWEq.RadGainRate,
    2079              :                                                &thisZoneHWEq.LatGainRate);
    2080              :                     }
    2081              : 
    2082              :                 } // for hwEqInputNum.NumOfSpaces
    2083              :             } // for hwEqInputNum
    2084              :         } // TotHWEquip > 0
    2085              : 
    2086              :         // SteamEquipment
    2087         1602 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> steamEqObjects;
    2088          801 :         int numSteamEqStatements = 0;
    2089          801 :         setupIHGZonesAndSpaces(state, stmEqModuleObject, steamEqObjects, numSteamEqStatements, state.dataHeatBal->TotStmEquip, ErrorsFound);
    2090              : 
    2091          801 :         if (state.dataHeatBal->TotStmEquip > 0) {
    2092            5 :             state.dataHeatBal->ZoneSteamEq.allocate(state.dataHeatBal->TotStmEquip);
    2093            5 :             int stmEqNum = 0;
    2094           10 :             for (int stmEqInputNum = 1; stmEqInputNum <= numSteamEqStatements; ++stmEqInputNum) {
    2095            5 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2096              :                                                                          stmEqModuleObject,
    2097              :                                                                          stmEqInputNum,
    2098              :                                                                          IHGAlphas,
    2099              :                                                                          IHGNumAlphas,
    2100              :                                                                          IHGNumbers,
    2101              :                                                                          IHGNumNumbers,
    2102              :                                                                          IOStat,
    2103              :                                                                          IHGNumericFieldBlanks,
    2104              :                                                                          IHGAlphaFieldBlanks,
    2105              :                                                                          IHGAlphaFieldNames,
    2106              :                                                                          IHGNumericFieldNames);
    2107              : 
    2108            5 :                 ErrorObjectHeader eoh{routineName, stmEqModuleObject, IHGAlphas(1)};
    2109              : 
    2110            5 :                 auto &thisStmEqInput = steamEqObjects(stmEqInputNum);
    2111           10 :                 for (int Item1 = 1; Item1 <= thisStmEqInput.numOfSpaces; ++Item1) {
    2112            5 :                     ++stmEqNum;
    2113            5 :                     auto &thisZoneStmEq = state.dataHeatBal->ZoneSteamEq(stmEqNum);
    2114            5 :                     int const spaceNum = thisStmEqInput.spaceNums(Item1);
    2115            5 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    2116            5 :                     thisZoneStmEq.Name = thisStmEqInput.names(Item1);
    2117            5 :                     thisZoneStmEq.spaceIndex = spaceNum;
    2118            5 :                     thisZoneStmEq.ZonePtr = zoneNum;
    2119              : 
    2120            5 :                     if (IHGAlphaFieldBlanks(3)) {
    2121            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    2122            0 :                         ErrorsFound = true;
    2123            5 :                     } else if ((thisZoneStmEq.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    2124            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    2125            0 :                         ErrorsFound = true;
    2126            5 :                     } else if (!thisZoneStmEq.sched->checkMinVal(state, Clusive::In, 0.0)) {
    2127            0 :                         Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    2128            0 :                         ErrorsFound = true;
    2129              :                     }
    2130              : 
    2131              :                     // Steam equipment design level calculation method.
    2132              :                     {
    2133            5 :                         std::string const &equipmentLevel = IHGAlphas(4);
    2134            5 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    2135            5 :                             Real64 spaceFrac = 1.0;
    2136            5 :                             if (thisStmEqInput.numOfSpaces > 1) {
    2137            0 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    2138            0 :                                 if (zoneArea > 0.0) {
    2139            0 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    2140              :                                 } else {
    2141            0 :                                     ShowSevereError(state,
    2142            0 :                                                     format("{}Zone floor area is zero when allocating SteamEquipment loads to Spaces.", RoutineName));
    2143            0 :                                     ShowContinueError(state,
    2144            0 :                                                       format("Occurs for SteamEquipment object ={} in Zone={}",
    2145            0 :                                                              thisStmEqInput.Name,
    2146            0 :                                                              state.dataHeatBal->Zone(zoneNum).Name));
    2147            0 :                                     ErrorsFound = true;
    2148              :                                 }
    2149              :                             }
    2150            5 :                             thisZoneStmEq.DesignLevel = IHGNumbers(1) * spaceFrac;
    2151            5 :                             if (IHGNumericFieldBlanks(1)) {
    2152            0 :                                 ShowWarningError(state,
    2153            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Steam Equipment will result.",
    2154              :                                                         RoutineName,
    2155              :                                                         hwEqModuleObject,
    2156            0 :                                                         thisStmEqInput.Name,
    2157              :                                                         IHGNumericFieldNames(1)));
    2158              :                             }
    2159            0 :                         } else if (equipmentLevel == "WATTS/AREA" || equipmentLevel == "POWER/AREA") {
    2160            0 :                             if (spaceNum > 0) {
    2161            0 :                                 if (IHGNumbers(2) >= 0.0) {
    2162            0 :                                     thisZoneStmEq.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    2163            0 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
    2164            0 :                                         !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    2165            0 :                                         ShowWarningError(
    2166              :                                             state,
    2167            0 :                                             format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 Steam Equipment will result.",
    2168              :                                                    RoutineName,
    2169              :                                                    stmEqModuleObject,
    2170            0 :                                                    thisZoneStmEq.Name,
    2171              :                                                    IHGNumericFieldNames(2)));
    2172              :                                     }
    2173              :                                 } else {
    2174            0 :                                     ShowSevereError(state,
    2175            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    2176              :                                                            RoutineName,
    2177              :                                                            stmEqModuleObject,
    2178              :                                                            IHGAlphas(1),
    2179              :                                                            IHGNumericFieldNames(2),
    2180              :                                                            IHGNumbers(2)));
    2181            0 :                                     ErrorsFound = true;
    2182              :                                 }
    2183              :                             }
    2184            0 :                             if (IHGNumericFieldBlanks(2)) {
    2185            0 :                                 ShowWarningError(state,
    2186            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Steam Equipment will result.",
    2187              :                                                         RoutineName,
    2188              :                                                         stmEqModuleObject,
    2189            0 :                                                         thisStmEqInput.Name,
    2190              :                                                         IHGNumericFieldNames(2)));
    2191              :                             }
    2192              : 
    2193            0 :                         } else if (equipmentLevel == "WATTS/PERSON" || equipmentLevel == "POWER/PERSON") {
    2194            0 :                             if (spaceNum != 0) {
    2195            0 :                                 if (IHGNumbers(3) >= 0.0) {
    2196            0 :                                     thisZoneStmEq.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    2197            0 :                                     if (state.dataHeatBal->space(spaceNum).TotOccupants <= 0.0) {
    2198            0 :                                         ShowWarningError(state,
    2199            0 :                                                          format("{}{}=\"{}\", specifies {}, but Total Occupants = 0.  0 Steam Equipment will result.",
    2200              :                                                                 RoutineName,
    2201              :                                                                 stmEqModuleObject,
    2202            0 :                                                                 thisZoneStmEq.Name,
    2203              :                                                                 IHGNumericFieldNames(2)));
    2204              :                                     }
    2205              :                                 } else {
    2206            0 :                                     ShowSevereError(state,
    2207            0 :                                                     format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    2208              :                                                            RoutineName,
    2209              :                                                            stmEqModuleObject,
    2210              :                                                            IHGAlphas(1),
    2211              :                                                            IHGNumericFieldNames(3),
    2212              :                                                            IHGNumbers(3)));
    2213            0 :                                     ErrorsFound = true;
    2214              :                                 }
    2215              :                             }
    2216            0 :                             if (IHGNumericFieldBlanks(3)) {
    2217            0 :                                 ShowWarningError(state,
    2218            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Steam Equipment will result.",
    2219              :                                                         RoutineName,
    2220              :                                                         stmEqModuleObject,
    2221              :                                                         IHGAlphas(1),
    2222              :                                                         IHGNumericFieldNames(3)));
    2223              :                             }
    2224              : 
    2225              :                         } else {
    2226            0 :                             if (Item1 == 1) {
    2227            0 :                                 ShowSevereError(state,
    2228            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
    2229              :                                                        RoutineName,
    2230              :                                                        stmEqModuleObject,
    2231              :                                                        IHGAlphas(1),
    2232              :                                                        IHGAlphaFieldNames(4),
    2233              :                                                        IHGAlphas(4)));
    2234            0 :                                 ShowContinueError(state, "...Valid values are \"EquipmentLevel\", \"Watts/Area\", \"Watts/Person\".");
    2235            0 :                                 ErrorsFound = true;
    2236              :                             }
    2237              :                         }
    2238              :                     }
    2239              : 
    2240              :                     // Calculate nominal min/max equipment level
    2241            5 :                     thisZoneStmEq.NomMinDesignLevel = thisZoneStmEq.DesignLevel * thisZoneStmEq.sched->getMinVal(state);
    2242            5 :                     thisZoneStmEq.NomMaxDesignLevel = thisZoneStmEq.DesignLevel * thisZoneStmEq.sched->getMaxVal(state);
    2243              : 
    2244            5 :                     thisZoneStmEq.FractionLatent = IHGNumbers(4);
    2245            5 :                     thisZoneStmEq.FractionRadiant = IHGNumbers(5);
    2246            5 :                     thisZoneStmEq.FractionLost = IHGNumbers(6);
    2247              :                     // FractionConvected is a calculated field
    2248            5 :                     thisZoneStmEq.FractionConvected =
    2249            5 :                         1.0 - (thisZoneStmEq.FractionLatent + thisZoneStmEq.FractionRadiant + thisZoneStmEq.FractionLost);
    2250            5 :                     if (std::abs(thisZoneStmEq.FractionConvected) <= 0.001) {
    2251            0 :                         thisZoneStmEq.FractionConvected = 0.0;
    2252              :                     }
    2253            5 :                     if (thisZoneStmEq.FractionConvected < 0.0) {
    2254            0 :                         ShowSevereError(state, format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, stmEqModuleObject, IHGAlphas(1)));
    2255            0 :                         ErrorsFound = true;
    2256              :                     }
    2257              : 
    2258            5 :                     if (IHGNumAlphas > 4) {
    2259            5 :                         thisZoneStmEq.EndUseSubcategory = IHGAlphas(5);
    2260              :                     } else {
    2261            0 :                         thisZoneStmEq.EndUseSubcategory = "General";
    2262              :                     }
    2263              : 
    2264            5 :                     if (thisZoneStmEq.ZonePtr <= 0) {
    2265            0 :                         continue; // Error, will be caught and terminated later
    2266              :                     }
    2267              : 
    2268            5 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2269            0 :                         SetupEMSActuator(state,
    2270              :                                          "SteamEquipment",
    2271              :                                          thisZoneStmEq.Name,
    2272              :                                          "District Heating Power Level",
    2273              :                                          "[W]",
    2274            0 :                                          thisZoneStmEq.EMSZoneEquipOverrideOn,
    2275            0 :                                          thisZoneStmEq.EMSEquipPower);
    2276            0 :                         SetupEMSInternalVariable(
    2277            0 :                             state, "Process Steam District Heat Design Level", thisZoneStmEq.Name, "[W]", thisZoneStmEq.DesignLevel);
    2278              :                     } // EMS
    2279              : 
    2280            5 :                     if (!ErrorsFound) {
    2281            5 :                         SetupSpaceInternalGain(state,
    2282              :                                                thisZoneStmEq.spaceIndex,
    2283              :                                                1.0,
    2284              :                                                thisZoneStmEq.Name,
    2285              :                                                DataHeatBalance::IntGainType::SteamEquipment,
    2286              :                                                &thisZoneStmEq.ConGainRate,
    2287              :                                                nullptr,
    2288              :                                                &thisZoneStmEq.RadGainRate,
    2289              :                                                &thisZoneStmEq.LatGainRate);
    2290              :                     }
    2291              : 
    2292              :                 } // for stmEqInputNum.NumOfSpaces
    2293              :             } // for stmEqInputNum
    2294              :         } // TotStmEquip > 0
    2295              : 
    2296              :         // OtherEquipment
    2297         1602 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> otherEqObjects;
    2298          801 :         int numOtherEqStatements = 0;
    2299          801 :         setupIHGZonesAndSpaces(state, othEqModuleObject, otherEqObjects, numOtherEqStatements, state.dataHeatBal->TotOthEquip, ErrorsFound);
    2300              : 
    2301          801 :         if (state.dataHeatBal->TotOthEquip > 0) {
    2302           33 :             state.dataHeatBal->ZoneOtherEq.allocate(state.dataHeatBal->TotOthEquip);
    2303           33 :             int othEqNum = 0;
    2304          122 :             for (int othEqInputNum = 1; othEqInputNum <= numOtherEqStatements; ++othEqInputNum) {
    2305              : 
    2306           89 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2307              :                                                                          othEqModuleObject,
    2308              :                                                                          othEqInputNum,
    2309              :                                                                          IHGAlphas,
    2310              :                                                                          IHGNumAlphas,
    2311              :                                                                          IHGNumbers,
    2312              :                                                                          IHGNumNumbers,
    2313              :                                                                          IOStat,
    2314              :                                                                          IHGNumericFieldBlanks,
    2315              :                                                                          IHGAlphaFieldBlanks,
    2316              :                                                                          IHGAlphaFieldNames,
    2317              :                                                                          IHGNumericFieldNames);
    2318              : 
    2319           89 :                 ErrorObjectHeader eoh{routineName, othEqModuleObject, IHGAlphas(1)};
    2320              : 
    2321           89 :                 auto &thisOthEqInput = otherEqObjects(othEqInputNum);
    2322          178 :                 for (int Item1 = 1; Item1 <= thisOthEqInput.numOfSpaces; ++Item1) {
    2323           89 :                     ++othEqNum;
    2324           89 :                     auto &thisZoneOthEq = state.dataHeatBal->ZoneOtherEq(othEqNum);
    2325           89 :                     int const spaceNum = thisOthEqInput.spaceNums(Item1);
    2326           89 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    2327           89 :                     thisZoneOthEq.Name = thisOthEqInput.names(Item1);
    2328           89 :                     thisZoneOthEq.spaceIndex = spaceNum;
    2329           89 :                     thisZoneOthEq.ZonePtr = zoneNum;
    2330              : 
    2331           89 :                     if (IHGAlphas(2) == "NONE") {
    2332           85 :                         thisZoneOthEq.OtherEquipFuelType = Constant::eFuel::None;
    2333              :                     } else {
    2334            4 :                         thisZoneOthEq.OtherEquipFuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, IHGAlphas(2)));
    2335            4 :                         if (thisZoneOthEq.OtherEquipFuelType == Constant::eFuel::Invalid ||
    2336            4 :                             thisZoneOthEq.OtherEquipFuelType == Constant::eFuel::Water) {
    2337            0 :                             ShowSevereError(state,
    2338            0 :                                             format("{}{}: invalid {} entered={} for {}={}",
    2339              :                                                    RoutineName,
    2340              :                                                    othEqModuleObject,
    2341              :                                                    IHGAlphaFieldNames(2),
    2342              :                                                    IHGAlphas(2),
    2343              :                                                    IHGAlphaFieldNames(1),
    2344            0 :                                                    thisOthEqInput.Name));
    2345            0 :                             ErrorsFound = true;
    2346              :                         }
    2347              : 
    2348              :                         // Build list of fuel types used in each zone and space (excluding Water)
    2349              : 
    2350            4 :                         bool found = false;
    2351            4 :                         for (Constant::eFuel fuelType : state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums) {
    2352            0 :                             if (thisZoneOthEq.OtherEquipFuelType == fuelType) {
    2353            0 :                                 found = true;
    2354            0 :                                 break;
    2355              :                             }
    2356            4 :                         }
    2357            4 :                         if (!found) {
    2358            4 :                             state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums.emplace_back(thisZoneOthEq.OtherEquipFuelType);
    2359              :                             // state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNames.emplace_back(FuelTypeString);
    2360              :                         }
    2361            4 :                         found = false;
    2362            4 :                         for (Constant::eFuel fuelType : state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums) {
    2363            0 :                             if (thisZoneOthEq.OtherEquipFuelType == fuelType) {
    2364            0 :                                 found = true;
    2365            0 :                                 break;
    2366              :                             }
    2367            4 :                         }
    2368            4 :                         if (!found) {
    2369            4 :                             state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums.emplace_back(thisZoneOthEq.OtherEquipFuelType);
    2370              :                             // state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNames.emplace_back(FuelTypeString);
    2371              :                         }
    2372              :                     }
    2373              : 
    2374           89 :                     if (IHGAlphaFieldBlanks(4)) {
    2375            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(4));
    2376            0 :                         ErrorsFound = true;
    2377           89 :                     } else if ((thisZoneOthEq.sched = Sched::GetSchedule(state, IHGAlphas(4))) == nullptr) {
    2378            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4));
    2379            0 :                         ErrorsFound = true;
    2380           89 :                     } else if (!thisZoneOthEq.sched->checkMinVal(state, Clusive::In, 0.0)) {
    2381            0 :                         Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4), Clusive::In, 0.0);
    2382            0 :                         ErrorsFound = true;
    2383              :                     }
    2384              : 
    2385              :                     // equipment design level calculation method.
    2386              :                     unsigned int DesignLevelFieldNumber;
    2387              :                     {
    2388           89 :                         std::string const &equipmentLevel = IHGAlphas(5);
    2389           89 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    2390           89 :                             DesignLevelFieldNumber = 1;
    2391           89 :                             Real64 spaceFrac = 1.0;
    2392           89 :                             if (thisOthEqInput.numOfSpaces > 1) {
    2393            0 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    2394            0 :                                 if (zoneArea > 0.0) {
    2395            0 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    2396              :                                 } else {
    2397            0 :                                     ShowSevereError(state,
    2398            0 :                                                     format("{}Zone floor area is zero when allocating OtherEquipment loads to Spaces.", RoutineName));
    2399            0 :                                     ShowContinueError(state,
    2400            0 :                                                       format("Occurs for OtherEquipment object ={} in Zone={}",
    2401            0 :                                                              thisOthEqInput.Name,
    2402            0 :                                                              state.dataHeatBal->Zone(zoneNum).Name));
    2403            0 :                                     ErrorsFound = true;
    2404              :                                 }
    2405              :                             }
    2406           89 :                             thisZoneOthEq.DesignLevel = IHGNumbers(1) * spaceFrac;
    2407           89 :                             if (IHGNumericFieldBlanks(DesignLevelFieldNumber)) {
    2408            0 :                                 ShowWarningError(state,
    2409            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Other Equipment will result.",
    2410              :                                                         RoutineName,
    2411              :                                                         othEqModuleObject,
    2412            0 :                                                         thisOthEqInput.Name,
    2413              :                                                         IHGNumericFieldNames(DesignLevelFieldNumber)));
    2414              :                             }
    2415              : 
    2416            0 :                         } else if (equipmentLevel == "WATTS/AREA" || equipmentLevel == "POWER/AREA") {
    2417            0 :                             DesignLevelFieldNumber = 2;
    2418            0 :                             if (spaceNum > 0) {
    2419            0 :                                 thisZoneOthEq.DesignLevel = IHGNumbers(DesignLevelFieldNumber) * state.dataHeatBal->space(spaceNum).FloorArea;
    2420            0 :                                 if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) && !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    2421            0 :                                     ShowWarningError(state,
    2422            0 :                                                      format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 Other Equipment will result.",
    2423              :                                                             RoutineName,
    2424              :                                                             othEqModuleObject,
    2425            0 :                                                             thisZoneOthEq.Name,
    2426              :                                                             IHGNumericFieldNames(DesignLevelFieldNumber)));
    2427              :                                 }
    2428              :                             }
    2429            0 :                             if (IHGNumericFieldBlanks(DesignLevelFieldNumber)) {
    2430            0 :                                 ShowWarningError(state,
    2431            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Other Equipment will result.",
    2432              :                                                         RoutineName,
    2433              :                                                         othEqModuleObject,
    2434              :                                                         IHGAlphas(1),
    2435              :                                                         IHGNumericFieldNames(DesignLevelFieldNumber)));
    2436              :                             }
    2437              : 
    2438            0 :                         } else if (equipmentLevel == "WATTS/PERSON" || equipmentLevel == "POWER/PERSON") {
    2439            0 :                             DesignLevelFieldNumber = 3;
    2440            0 :                             if (thisZoneOthEq.ZonePtr != 0) {
    2441            0 :                                 thisZoneOthEq.DesignLevel = IHGNumbers(3) * state.dataHeatBal->Zone(thisZoneOthEq.ZonePtr).TotOccupants;
    2442            0 :                                 if (state.dataHeatBal->Zone(thisZoneOthEq.ZonePtr).TotOccupants <= 0.0) {
    2443            0 :                                     ShowWarningError(state,
    2444            0 :                                                      format("{}{}=\"{}\", specifies {}, but Total Occupants = 0.  0 Other Equipment will result.",
    2445              :                                                             RoutineName,
    2446              :                                                             othEqModuleObject,
    2447            0 :                                                             thisZoneOthEq.Name,
    2448              :                                                             IHGNumericFieldNames(DesignLevelFieldNumber)));
    2449              :                                 }
    2450              :                             }
    2451            0 :                             if (IHGNumericFieldBlanks(DesignLevelFieldNumber)) {
    2452            0 :                                 ShowWarningError(state,
    2453            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Other Equipment will result.",
    2454              :                                                         RoutineName,
    2455              :                                                         othEqModuleObject,
    2456            0 :                                                         thisOthEqInput.Name,
    2457              :                                                         IHGNumericFieldNames(DesignLevelFieldNumber)));
    2458              :                             }
    2459              : 
    2460              :                         } else {
    2461            0 :                             if (Item1 == 1) {
    2462            0 :                                 ShowSevereError(state,
    2463            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
    2464              :                                                        RoutineName,
    2465              :                                                        othEqModuleObject,
    2466            0 :                                                        thisOthEqInput.Name,
    2467              :                                                        IHGAlphaFieldNames(5),
    2468              :                                                        IHGAlphas(5)));
    2469            0 :                                 ShowContinueError(state, "...Valid values are \"EquipmentLevel\", \"Watts/Area\", \"Watts/Person\".");
    2470            0 :                                 ErrorsFound = true;
    2471              :                             }
    2472              :                         }
    2473              :                     }
    2474              : 
    2475              :                     // Throw an error if the design level is negative and we have a fuel type
    2476           89 :                     if (thisZoneOthEq.DesignLevel < 0.0 && thisZoneOthEq.OtherEquipFuelType != Constant::eFuel::Invalid &&
    2477           20 :                         thisZoneOthEq.OtherEquipFuelType != Constant::eFuel::None) {
    2478            0 :                         ShowSevereError(state,
    2479            0 :                                         format("{}{}=\"{}\", {} is not allowed to be negative",
    2480              :                                                RoutineName,
    2481              :                                                othEqModuleObject,
    2482            0 :                                                thisOthEqInput.Name,
    2483              :                                                IHGNumericFieldNames(DesignLevelFieldNumber)));
    2484            0 :                         ShowContinueError(
    2485            0 :                             state, format("... when a fuel type of {} is specified.", Constant::eFuelNames[(int)thisZoneOthEq.OtherEquipFuelType]));
    2486            0 :                         ErrorsFound = true;
    2487              :                     }
    2488              : 
    2489              :                     // Calculate nominal min/max equipment level
    2490           89 :                     thisZoneOthEq.NomMinDesignLevel = thisZoneOthEq.DesignLevel * thisZoneOthEq.sched->getMinVal(state);
    2491           89 :                     thisZoneOthEq.NomMaxDesignLevel = thisZoneOthEq.DesignLevel * thisZoneOthEq.sched->getMaxVal(state);
    2492              : 
    2493           89 :                     thisZoneOthEq.FractionLatent = IHGNumbers(4);
    2494           89 :                     thisZoneOthEq.FractionRadiant = IHGNumbers(5);
    2495           89 :                     thisZoneOthEq.FractionLost = IHGNumbers(6);
    2496              : 
    2497           89 :                     if ((IHGNumNumbers == 7) || (!IHGNumericFieldBlanks(7))) {
    2498           35 :                         thisZoneOthEq.CO2RateFactor = IHGNumbers(7);
    2499              :                     }
    2500           89 :                     if (thisZoneOthEq.CO2RateFactor < 0.0) {
    2501            0 :                         ShowSevereError(state,
    2502            0 :                                         format("{}{}=\"{}\", {} < 0.0, value ={:.2R}",
    2503              :                                                RoutineName,
    2504              :                                                othEqModuleObject,
    2505            0 :                                                thisOthEqInput.Name,
    2506              :                                                IHGNumericFieldNames(7),
    2507              :                                                IHGNumbers(7)));
    2508            0 :                         ErrorsFound = true;
    2509              :                     }
    2510           89 :                     if (thisZoneOthEq.CO2RateFactor > 4.0e-7) {
    2511            0 :                         ShowSevereError(state,
    2512            0 :                                         format("{}{}=\"{}\", {} > 4.0E-7, value ={:.2R}",
    2513              :                                                RoutineName,
    2514              :                                                othEqModuleObject,
    2515            0 :                                                thisOthEqInput.Name,
    2516              :                                                IHGNumericFieldNames(7),
    2517              :                                                IHGNumbers(7)));
    2518            0 :                         ErrorsFound = true;
    2519              :                     }
    2520              : 
    2521              :                     // FractionConvected is a calculated field
    2522           89 :                     thisZoneOthEq.FractionConvected =
    2523           89 :                         1.0 - (thisZoneOthEq.FractionLatent + thisZoneOthEq.FractionRadiant + thisZoneOthEq.FractionLost);
    2524           89 :                     if (std::abs(thisZoneOthEq.FractionConvected) <= 0.001) {
    2525           26 :                         thisZoneOthEq.FractionConvected = 0.0;
    2526              :                     }
    2527           89 :                     if (thisZoneOthEq.FractionConvected < 0.0) {
    2528            0 :                         ShowSevereError(state, format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, othEqModuleObject, thisOthEqInput.Name));
    2529            0 :                         ErrorsFound = true;
    2530              :                     }
    2531              : 
    2532           89 :                     if (IHGNumAlphas > 5) {
    2533           35 :                         thisZoneOthEq.EndUseSubcategory = IHGAlphas(6);
    2534              :                     } else {
    2535           54 :                         thisZoneOthEq.EndUseSubcategory = "General";
    2536              :                     }
    2537              : 
    2538           89 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2539           39 :                         SetupEMSActuator(state,
    2540              :                                          "OtherEquipment",
    2541              :                                          thisZoneOthEq.Name,
    2542              :                                          "Power Level",
    2543              :                                          "[W]",
    2544           39 :                                          thisZoneOthEq.EMSZoneEquipOverrideOn,
    2545           39 :                                          thisZoneOthEq.EMSEquipPower);
    2546           39 :                         SetupEMSInternalVariable(state, "Other Equipment Design Level", thisZoneOthEq.Name, "[W]", thisZoneOthEq.DesignLevel);
    2547              :                     } // EMS
    2548              : 
    2549           89 :                     if (!ErrorsFound) {
    2550           89 :                         SetupSpaceInternalGain(state,
    2551              :                                                thisZoneOthEq.spaceIndex,
    2552              :                                                1.0,
    2553              :                                                thisZoneOthEq.Name,
    2554              :                                                DataHeatBalance::IntGainType::OtherEquipment,
    2555              :                                                &thisZoneOthEq.ConGainRate,
    2556              :                                                nullptr,
    2557              :                                                &thisZoneOthEq.RadGainRate,
    2558              :                                                &thisZoneOthEq.LatGainRate);
    2559              :                     }
    2560              : 
    2561              :                 } // for othEqInputNum.NumOfSpaces
    2562              :             } // for othEqInputNum
    2563              :         } // TotOtherEquip > 0
    2564              : 
    2565              :         // ElectricEquipment:ITE:AirCooled
    2566         1602 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> iTEqObjects;
    2567          801 :         int numZoneITEqStatements = 0;
    2568              :         // Note that this object type does not support ZoneList due to node names in input fields
    2569          801 :         bool zoneListNotAllowed = true;
    2570         1602 :         setupIHGZonesAndSpaces(
    2571          801 :             state, itEqModuleObject, iTEqObjects, numZoneITEqStatements, state.dataHeatBal->TotITEquip, ErrorsFound, zoneListNotAllowed);
    2572              : 
    2573          801 :         if (state.dataHeatBal->TotITEquip > 0) {
    2574            5 :             state.dataHeatBal->ZoneITEq.allocate(state.dataHeatBal->TotITEquip);
    2575            5 :             int itEqNum = 0;
    2576           12 :             for (int itEqInputNum = 1; itEqInputNum <= numZoneITEqStatements; ++itEqInputNum) {
    2577              : 
    2578            7 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2579              :                                                                          itEqModuleObject,
    2580              :                                                                          itEqInputNum,
    2581              :                                                                          IHGAlphas,
    2582              :                                                                          IHGNumAlphas,
    2583              :                                                                          IHGNumbers,
    2584              :                                                                          IHGNumNumbers,
    2585              :                                                                          IOStat,
    2586              :                                                                          IHGNumericFieldBlanks,
    2587              :                                                                          IHGAlphaFieldBlanks,
    2588              :                                                                          IHGAlphaFieldNames,
    2589              :                                                                          IHGNumericFieldNames);
    2590              : 
    2591            7 :                 ErrorObjectHeader eoh{routineName, itEqModuleObject, IHGAlphas(1)};
    2592              : 
    2593            7 :                 auto &thisITEqInput = iTEqObjects(itEqInputNum);
    2594           14 :                 for (int Item1 = 1; Item1 <= thisITEqInput.numOfSpaces; ++Item1) {
    2595            7 :                     ++itEqNum;
    2596            7 :                     auto &thisZoneITEq = state.dataHeatBal->ZoneITEq(itEqNum);
    2597            7 :                     int const spaceNum = thisITEqInput.spaceNums(Item1);
    2598            7 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    2599            7 :                     thisZoneITEq.Name = thisITEqInput.names(Item1);
    2600            7 :                     thisZoneITEq.spaceIndex = spaceNum;
    2601            7 :                     thisZoneITEq.ZonePtr = zoneNum;
    2602              : 
    2603              :                     // IT equipment design level calculation method.
    2604            7 :                     if (IHGAlphaFieldBlanks(3)) {
    2605            0 :                         thisZoneITEq.FlowControlWithApproachTemps = false;
    2606              :                     } else {
    2607            7 :                         if (Util::SameString(IHGAlphas(3), "FlowFromSystem")) {
    2608            3 :                             thisZoneITEq.FlowControlWithApproachTemps = false;
    2609            4 :                         } else if (Util::SameString(IHGAlphas(3), "FlowControlWithApproachTemperatures")) {
    2610            4 :                             thisZoneITEq.FlowControlWithApproachTemps = true;
    2611            4 :                             state.dataHeatBal->Zone(thisZoneITEq.ZonePtr).HasAdjustedReturnTempByITE = true;
    2612            4 :                             state.dataHeatBal->Zone(thisZoneITEq.ZonePtr).NoHeatToReturnAir = false;
    2613              :                         } else {
    2614            0 :                             ShowSevereError(
    2615              :                                 state,
    2616            0 :                                 format("{}{}=\"{}\": invalid calculation method: {}", RoutineName, itEqModuleObject, IHGAlphas(1), IHGAlphas(3)));
    2617            0 :                             ErrorsFound = true;
    2618              :                         }
    2619              :                     }
    2620              : 
    2621              :                     {
    2622            7 :                         std::string const &equipmentLevel = IHGAlphas(4);
    2623            7 :                         if (equipmentLevel == "WATTS/UNIT") {
    2624            3 :                             Real64 spaceFrac = 1.0;
    2625            3 :                             if (thisITEqInput.numOfSpaces > 1) {
    2626            0 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    2627            0 :                                 if (zoneArea > 0.0) {
    2628            0 :                                     spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    2629              :                                 } else {
    2630            0 :                                     ShowSevereError(
    2631              :                                         state,
    2632            0 :                                         format("{}Zone floor area is zero when allocating ElectricEquipment:ITE:AirCooled loads to Spaces.",
    2633              :                                                RoutineName));
    2634            0 :                                     ShowContinueError(state,
    2635            0 :                                                       format("Occurs for ElectricEquipment:ITE:AirCooled object ={} in Zone={}",
    2636            0 :                                                              thisITEqInput.Name,
    2637            0 :                                                              state.dataHeatBal->Zone(zoneNum).Name));
    2638            0 :                                     ErrorsFound = true;
    2639              :                                 }
    2640              :                             }
    2641            3 :                             thisZoneITEq.DesignTotalPower = IHGNumbers(1) * IHGNumbers(2) * spaceFrac;
    2642            3 :                             if (IHGNumericFieldBlanks(1)) {
    2643            0 :                                 ShowWarningError(state,
    2644            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 IT Equipment will result.",
    2645              :                                                         RoutineName,
    2646              :                                                         itEqModuleObject,
    2647              :                                                         IHGAlphas(1),
    2648              :                                                         IHGNumericFieldNames(1)));
    2649              :                             }
    2650            3 :                             if (IHGNumericFieldBlanks(2)) {
    2651            0 :                                 ShowWarningError(state,
    2652            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 IT Equipment will result.",
    2653              :                                                         RoutineName,
    2654              :                                                         itEqModuleObject,
    2655              :                                                         IHGAlphas(1),
    2656              :                                                         IHGNumericFieldNames(2)));
    2657              :                             }
    2658              : 
    2659            4 :                         } else if (equipmentLevel == "WATTS/AREA") {
    2660            4 :                             if (thisZoneITEq.ZonePtr != 0) {
    2661            4 :                                 if (IHGNumbers(3) >= 0.0) {
    2662            4 :                                     if (spaceNum > 0) {
    2663            4 :                                         thisZoneITEq.DesignTotalPower = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).FloorArea;
    2664            4 :                                         if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
    2665            0 :                                             !state.dataHeatBal->space(spaceNum).isRemainderSpace) {
    2666            0 :                                             ShowWarningError(
    2667              :                                                 state,
    2668            0 :                                                 format("{}{}=\"{}\", specifies {}, but Space Floor Area = 0.  0 IT Equipment will result.",
    2669              :                                                        RoutineName,
    2670              :                                                        itEqModuleObject,
    2671              :                                                        IHGAlphas(1),
    2672              :                                                        IHGNumericFieldNames(3)));
    2673              :                                         }
    2674              :                                     } else {
    2675            0 :                                         ShowSevereError(state,
    2676            0 :                                                         format("{}{}=\"{}\", invalid {}, value  [<0.0]={:.3R}",
    2677              :                                                                RoutineName,
    2678              :                                                                itEqModuleObject,
    2679              :                                                                IHGAlphas(1),
    2680              :                                                                IHGNumericFieldNames(3),
    2681              :                                                                IHGNumbers(3)));
    2682            0 :                                         ErrorsFound = true;
    2683              :                                     }
    2684              :                                 }
    2685            4 :                                 if (IHGNumericFieldBlanks(3)) {
    2686            0 :                                     ShowWarningError(state,
    2687            0 :                                                      format("{}{}=\"{}\", specifies {}, but that field is blank.  0 IT Equipment will result.",
    2688              :                                                             RoutineName,
    2689              :                                                             itEqModuleObject,
    2690              :                                                             IHGAlphas(1),
    2691              :                                                             IHGNumericFieldNames(3)));
    2692              :                                 }
    2693              : 
    2694              :                             } else {
    2695            0 :                                 ShowSevereError(state,
    2696            0 :                                                 format("{}{}=\"{}\", invalid {}, value  ={}",
    2697              :                                                        RoutineName,
    2698              :                                                        itEqModuleObject,
    2699              :                                                        IHGAlphas(1),
    2700              :                                                        IHGAlphaFieldNames(4),
    2701              :                                                        IHGAlphas(4)));
    2702            0 :                                 ShowContinueError(state, "...Valid values are \"Watts/Unit\" or \"Watts/Area\".");
    2703            0 :                                 ErrorsFound = true;
    2704              :                             }
    2705              :                         }
    2706              : 
    2707            7 :                         if (IHGAlphaFieldBlanks(5)) {
    2708            0 :                             thisZoneITEq.operSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but default is constant-1.0
    2709            7 :                         } else if ((thisZoneITEq.operSched = Sched::GetSchedule(state, IHGAlphas(5))) == nullptr) {
    2710            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5));
    2711            0 :                             ErrorsFound = true;
    2712            7 :                         } else if (!thisZoneITEq.operSched->checkMinVal(state, Clusive::In, 0.0)) {
    2713            0 :                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5), Clusive::In, 0.0);
    2714            0 :                             ErrorsFound = true;
    2715              :                         }
    2716              : 
    2717            7 :                         if (IHGAlphaFieldBlanks(6)) {
    2718            0 :                             thisZoneITEq.cpuLoadSched =
    2719            0 :                                 Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but default is constant-1.0
    2720            7 :                         } else if ((thisZoneITEq.cpuLoadSched = Sched::GetSchedule(state, IHGAlphas(6))) == nullptr) {
    2721            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6));
    2722            0 :                             ErrorsFound = true;
    2723            7 :                         } else if (!thisZoneITEq.cpuLoadSched->checkMinVal(state, Clusive::In, 0.0)) {
    2724            0 :                             Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6), Clusive::In, 0.0);
    2725            0 :                             ErrorsFound = true;
    2726              :                         }
    2727              : 
    2728              :                         // Calculate nominal min/max equipment level
    2729            7 :                         thisZoneITEq.NomMinDesignLevel = thisZoneITEq.DesignTotalPower * thisZoneITEq.cpuLoadSched->getMinVal(state);
    2730            7 :                         thisZoneITEq.NomMaxDesignLevel = thisZoneITEq.DesignTotalPower * thisZoneITEq.cpuLoadSched->getMaxVal(state);
    2731              : 
    2732            7 :                         thisZoneITEq.DesignFanPowerFrac = IHGNumbers(4);
    2733            7 :                         thisZoneITEq.DesignFanPower = thisZoneITEq.DesignFanPowerFrac * thisZoneITEq.DesignTotalPower;
    2734            7 :                         thisZoneITEq.DesignCPUPower = (1.0 - thisZoneITEq.DesignFanPowerFrac) * thisZoneITEq.DesignTotalPower;
    2735            7 :                         thisZoneITEq.DesignAirVolFlowRate = IHGNumbers(5) * thisZoneITEq.DesignTotalPower;
    2736            7 :                         thisZoneITEq.DesignTAirIn = IHGNumbers(6);
    2737            7 :                         thisZoneITEq.DesignRecircFrac = IHGNumbers(7);
    2738            7 :                         thisZoneITEq.DesignUPSEfficiency = IHGNumbers(8);
    2739            7 :                         thisZoneITEq.UPSLossToZoneFrac = IHGNumbers(9);
    2740            7 :                         thisZoneITEq.SupplyApproachTemp = IHGNumbers(10);
    2741            7 :                         thisZoneITEq.ReturnApproachTemp = IHGNumbers(11);
    2742              : 
    2743            7 :                         bool hasSupplyApproachTemp = !IHGNumericFieldBlanks(10);
    2744            7 :                         bool hasReturnApproachTemp = !IHGNumericFieldBlanks(11);
    2745              : 
    2746              :                         // Performance curves
    2747            7 :                         thisZoneITEq.CPUPowerFLTCurve = GetCurveIndex(state, IHGAlphas(7));
    2748            7 :                         if (thisZoneITEq.CPUPowerFLTCurve == 0) {
    2749            0 :                             ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2750            0 :                             ShowContinueError(state, format("Invalid {}={}", IHGAlphaFieldNames(7), IHGAlphas(7)));
    2751            0 :                             ErrorsFound = true;
    2752              :                         }
    2753              : 
    2754            7 :                         thisZoneITEq.AirFlowFLTCurve = GetCurveIndex(state, IHGAlphas(8));
    2755            7 :                         if (thisZoneITEq.AirFlowFLTCurve == 0) {
    2756            0 :                             ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2757            0 :                             ShowContinueError(state, format("Invalid {}={}", IHGAlphaFieldNames(8), IHGAlphas(8)));
    2758            0 :                             ErrorsFound = true;
    2759              :                         }
    2760              : 
    2761            7 :                         thisZoneITEq.FanPowerFFCurve = GetCurveIndex(state, IHGAlphas(9));
    2762            7 :                         if (thisZoneITEq.FanPowerFFCurve == 0) {
    2763            0 :                             ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2764            0 :                             ShowContinueError(state, format("Invalid {}={}", IHGAlphaFieldNames(9), IHGAlphas(9)));
    2765            0 :                             ErrorsFound = true;
    2766              :                         }
    2767              : 
    2768            7 :                         if (!IHGAlphaFieldBlanks(15)) {
    2769              :                             // If this field isn't blank, it must point to a valid curve
    2770            7 :                             thisZoneITEq.RecircFLTCurve = GetCurveIndex(state, IHGAlphas(15));
    2771            7 :                             if (thisZoneITEq.RecircFLTCurve == 0) {
    2772            0 :                                 ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2773            0 :                                 ShowContinueError(state, format("Invalid {}={}", IHGAlphaFieldNames(15), IHGAlphas(15)));
    2774            0 :                                 ErrorsFound = true;
    2775              :                             }
    2776              :                         } else {
    2777              :                             // If this curve is left blank, then the curve is assumed to always equal 1.0.
    2778            0 :                             thisZoneITEq.RecircFLTCurve = 0;
    2779              :                         }
    2780              : 
    2781            7 :                         if (!IHGAlphaFieldBlanks(16)) {
    2782              :                             // If this field isn't blank, it must point to a valid curve
    2783            7 :                             thisZoneITEq.UPSEfficFPLRCurve = GetCurveIndex(state, IHGAlphas(16));
    2784            7 :                             if (thisZoneITEq.UPSEfficFPLRCurve == 0) {
    2785            0 :                                 ShowSevereError(state, format("{}{} \"{}\"", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2786            0 :                                 ShowContinueError(state, format("Invalid {}={}", IHGAlphaFieldNames(16), IHGAlphas(16)));
    2787            0 :                                 ErrorsFound = true;
    2788              :                             }
    2789              :                         } else {
    2790              :                             // If this curve is left blank, then the curve is assumed to always equal 1.0.
    2791            0 :                             thisZoneITEq.UPSEfficFPLRCurve = 0;
    2792              :                         }
    2793              : 
    2794              :                         // Environmental class
    2795            7 :                         thisZoneITEq.Class = static_cast<ITEClass>(getEnumValue(ITEClassNamesUC, Util::makeUPPER(IHGAlphas(10))));
    2796            7 :                         ErrorsFound = ErrorsFound || (thisZoneITEq.Class == ITEClass::Invalid);
    2797              : 
    2798              :                         // Air and supply inlet connections
    2799            7 :                         thisZoneITEq.AirConnectionType =
    2800            7 :                             static_cast<ITEInletConnection>(getEnumValue(ITEInletConnectionNamesUC, Util::makeUPPER(IHGAlphas(11))));
    2801            7 :                         if (thisZoneITEq.AirConnectionType == ITEInletConnection::RoomAirModel) {
    2802              :                             // ZoneITEq(Loop).AirConnectionType = ITEInletConnection::RoomAirModel;
    2803            0 :                             ShowWarningError(state,
    2804            0 :                                              format("{}{}=\"{}Air Inlet Connection Type = RoomAirModel is not implemented yet, using ZoneAirNode",
    2805              :                                                     RoutineName,
    2806              :                                                     itEqModuleObject,
    2807              :                                                     IHGAlphas(1)));
    2808            0 :                             thisZoneITEq.AirConnectionType = ITEInletConnection::ZoneAirNode;
    2809              :                         }
    2810            7 :                         ErrorsFound = ErrorsFound || (thisZoneITEq.AirConnectionType == ITEInletConnection::Invalid);
    2811              : 
    2812            7 :                         if (IHGAlphaFieldBlanks(14)) {
    2813            0 :                             if (thisZoneITEq.AirConnectionType == ITEInletConnection::AdjustedSupply) {
    2814            0 :                                 ShowSevereError(state, format("{}{}: {}", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2815            0 :                                 ShowContinueError(state,
    2816            0 :                                                   format("For {}= AdjustedSupply, {} is required, but this field is blank.",
    2817              :                                                          IHGAlphaFieldNames(11),
    2818              :                                                          IHGAlphaFieldNames(14)));
    2819            0 :                                 ErrorsFound = true;
    2820            0 :                             } else if (thisZoneITEq.FlowControlWithApproachTemps) {
    2821            0 :                                 ShowSevereError(state, format("{}{}: {}", RoutineName, itEqModuleObject, IHGAlphas(1)));
    2822            0 :                                 ShowContinueError(state,
    2823            0 :                                                   format("For {}= FlowControlWithApproachTemperatures, {} is required, but this field is blank.",
    2824              :                                                          IHGAlphaFieldNames(3),
    2825              :                                                          IHGAlphaFieldNames(14)));
    2826            0 :                                 ErrorsFound = true;
    2827              :                             }
    2828              :                         } else {
    2829           14 :                             thisZoneITEq.SupplyAirNodeNum = GetOnlySingleNode(state,
    2830            7 :                                                                               IHGAlphas(14),
    2831              :                                                                               ErrorsFound,
    2832              :                                                                               DataLoopNode::ConnectionObjectType::ElectricEquipmentITEAirCooled,
    2833            7 :                                                                               IHGAlphas(1),
    2834              :                                                                               DataLoopNode::NodeFluidType::Air,
    2835              :                                                                               DataLoopNode::ConnectionType::Sensor,
    2836              :                                                                               NodeInputManager::CompFluidStream::Primary,
    2837              :                                                                               ObjectIsNotParent);
    2838              :                         }
    2839              : 
    2840              :                         // check supply air node for matches with zone equipment supply air node
    2841            7 :                         int zoneEqIndex = DataZoneEquipment::GetControlledZoneIndex(state, state.dataHeatBal->Zone(thisZoneITEq.ZonePtr).Name);
    2842            7 :                         if (zoneEqIndex > 0) { // zoneEqIndex could be zero in the case of an uncontrolled zone
    2843            7 :                             auto itStart = state.dataZoneEquip->ZoneEquipConfig(zoneEqIndex).InletNode.begin();
    2844            7 :                             auto itEnd = state.dataZoneEquip->ZoneEquipConfig(zoneEqIndex).InletNode.end();
    2845            7 :                             int key = thisZoneITEq.SupplyAirNodeNum;
    2846            7 :                             thisZoneITEq.inControlledZone = true;
    2847            7 :                             bool supplyNodeFound = false;
    2848            7 :                             if (std::find(itStart, itEnd, key) != itEnd) {
    2849            7 :                                 supplyNodeFound = true;
    2850              :                             }
    2851              : 
    2852            7 :                             if (thisZoneITEq.AirConnectionType == ITEInletConnection::AdjustedSupply && !supplyNodeFound) {
    2853              :                                 // supply air node must match zone equipment supply air node for these conditions
    2854            0 :                                 ShowSevereError(state, format("{}: ElectricEquipment:ITE:AirCooled {}", RoutineName, thisZoneITEq.Name));
    2855            0 :                                 ShowContinueError(state, "Air Inlet Connection Type = AdjustedSupply but no Supply Air Node is specified.");
    2856            0 :                                 ErrorsFound = true;
    2857            7 :                             } else if (thisZoneITEq.FlowControlWithApproachTemps && !supplyNodeFound) {
    2858              :                                 // supply air node must match zone equipment supply air node for these conditions
    2859            0 :                                 ShowSevereError(state, format("{}: ElectricEquipment:ITE:AirCooled {}", RoutineName, thisZoneITEq.Name));
    2860            0 :                                 ShowContinueError(state, "Air Inlet Connection Type = AdjustedSupply but no Supply Air Node is specified.");
    2861            0 :                                 ErrorsFound = true;
    2862            7 :                             } else if (thisZoneITEq.SupplyAirNodeNum != 0 && !supplyNodeFound) {
    2863              :                                 // the given supply air node does not match any zone equipment supply air nodes
    2864            0 :                                 ShowWarningError(
    2865              :                                     state,
    2866            0 :                                     format("{}name: '{}. Supply Air Node Name '{}' does not match any ZoneHVAC:EquipmentConnections objects.",
    2867              :                                            itEqModuleObject,
    2868              :                                            IHGAlphas(1),
    2869              :                                            IHGAlphas(14)));
    2870              :                             }
    2871              :                         } // end of if block for zoneEqIndex > 0
    2872              : 
    2873              :                         // End-Use subcategories
    2874            7 :                         if (IHGNumAlphas > 16) {
    2875            7 :                             thisZoneITEq.EndUseSubcategoryCPU = IHGAlphas(17);
    2876              :                         } else {
    2877            0 :                             thisZoneITEq.EndUseSubcategoryCPU = "ITE-CPU";
    2878              :                         }
    2879              : 
    2880            7 :                         if (IHGNumAlphas > 17) {
    2881            7 :                             thisZoneITEq.EndUseSubcategoryFan = IHGAlphas(18);
    2882              :                         } else {
    2883            0 :                             thisZoneITEq.EndUseSubcategoryFan = "ITE-Fans";
    2884              :                         }
    2885            7 :                         if (thisZoneITEq.ZonePtr <= 0) {
    2886            0 :                             continue; // Error, will be caught and terminated later
    2887              :                         }
    2888              : 
    2889            7 :                         if (IHGNumAlphas > 18) {
    2890            7 :                             thisZoneITEq.EndUseSubcategoryUPS = IHGAlphas(19);
    2891              :                         } else {
    2892            0 :                             thisZoneITEq.EndUseSubcategoryUPS = "ITE-UPS";
    2893              :                         }
    2894            7 :                         if (thisZoneITEq.FlowControlWithApproachTemps) {
    2895            4 :                             if (IHGAlphaFieldBlanks(20)) {
    2896            4 :                                 if (!hasSupplyApproachTemp) {
    2897            0 :                                     ShowSevereCustom(
    2898              :                                         state,
    2899              :                                         eoh,
    2900            0 :                                         format("For {}= FlowControlWithApproachTemperatures, either {} or {} is required, but both are left blank.",
    2901              :                                                IHGAlphaFieldNames(3),
    2902              :                                                IHGNumericFieldNames(10),
    2903              :                                                IHGAlphaFieldNames(20)));
    2904            0 :                                     ErrorsFound = true;
    2905              :                                 }
    2906            0 :                             } else if ((thisZoneITEq.supplyApproachTempSched = Sched::GetSchedule(state, IHGAlphas(20))) == nullptr) {
    2907            0 :                                 ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(20), IHGAlphas(20));
    2908            0 :                                 ErrorsFound = true;
    2909              :                             }
    2910              : 
    2911            4 :                             if (IHGAlphaFieldBlanks(21)) {
    2912            4 :                                 if (!hasReturnApproachTemp) {
    2913            0 :                                     ShowSevereCustom(
    2914              :                                         state,
    2915              :                                         eoh,
    2916            0 :                                         format("For {}= FlowControlWithApproachTemperatures, either {} or {} is required, but both are left blank.",
    2917              :                                                IHGAlphaFieldNames(3),
    2918              :                                                IHGNumericFieldNames(11),
    2919              :                                                IHGAlphaFieldNames(21)));
    2920            0 :                                     ErrorsFound = true;
    2921              :                                 }
    2922            0 :                             } else if ((thisZoneITEq.returnApproachTempSched = Sched::GetSchedule(state, IHGAlphas(21))) == nullptr) {
    2923            0 :                                 ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(20), IHGAlphas(20));
    2924            0 :                                 ErrorsFound = true;
    2925              :                             }
    2926              :                         }
    2927              : 
    2928            7 :                         if (thisZoneITEq.FlowControlWithApproachTemps) {
    2929            4 :                             Real64 TAirInSizing = 0.0;
    2930              :                             // Set the TAirInSizing to the maximum setpoint value to do sizing based on the maximum fan and cpu power of the ite
    2931              :                             // object
    2932            4 :                             SetPointManager::GetSetPointManagerInputs(state);
    2933           20 :                             for (auto *spm : state.dataSetPointManager->spms) {
    2934           16 :                                 if (spm->type != SetPointManager::SPMType::SZCooling) {
    2935           12 :                                     continue;
    2936              :                                 }
    2937            4 :                                 auto const *spmSZC = dynamic_cast<SetPointManager::SPMSingleZoneTemp *>(spm);
    2938            4 :                                 assert(spmSZC != nullptr);
    2939            4 :                                 if (spmSZC->ctrlZoneNum == zoneNum) {
    2940            2 :                                     TAirInSizing = spmSZC->maxSetTemp;
    2941              :                                 }
    2942              :                             }
    2943              : 
    2944            4 :                             thisZoneITEq.SizingTAirIn = max(TAirInSizing, thisZoneITEq.DesignTAirIn);
    2945              :                         }
    2946              : 
    2947              :                         // MJW - EMS Not in place yet
    2948              :                         // if ( AnyEnergyManagementSystemInModel ) {
    2949              :                         // SetupEMSActuator( "ElectricEquipment", ZoneITEq( Loop ).Name, "Electric Power Level", "[W]", ZoneITEq( Loop
    2950              :                         // ).EMSZoneEquipOverrideOn, ZoneITEq( Loop ).EMSEquipPower ); SetupEMSInternalVariable( "Plug and Process Power Design
    2951              :                         // Level", ZoneITEq( Loop ).Name, "[W]", ZoneITEq( Loop ).DesignTotalPower ); } // EMS
    2952              : 
    2953            7 :                         if (!ErrorsFound) {
    2954            7 :                             SetupSpaceInternalGain(state,
    2955              :                                                    thisZoneITEq.spaceIndex,
    2956              :                                                    1.0,
    2957              :                                                    thisZoneITEq.Name,
    2958              :                                                    DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled,
    2959            7 :                                                    &thisZoneITEq.PowerRpt[(int)PERptVars::ConGainToZone]);
    2960              :                         }
    2961              :                     }
    2962              :                 } // for itEqInputNum.NumOfSpaces
    2963              :             } // for itEqInputNum
    2964           12 :             for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    2965           11 :                 if (state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(Loop).ZonePtr).HasAdjustedReturnTempByITE &&
    2966            4 :                     (!state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps)) {
    2967            0 :                     ShowSevereError(state,
    2968            0 :                                     format("{}{}=\"{}\": invalid calculation method {} for Zone: {}",
    2969              :                                            RoutineName,
    2970              :                                            itEqModuleObject,
    2971              :                                            IHGAlphas(1),
    2972              :                                            IHGAlphas(3),
    2973              :                                            IHGAlphas(2)));
    2974            0 :                     ShowContinueError(state, "...Multiple flow control methods apply to one zone. ");
    2975            0 :                     ErrorsFound = true;
    2976              :                 }
    2977              :             }
    2978              :         } // TotITEquip > 0
    2979              : 
    2980              :         // ZoneBaseboard:OutdoorTemperatureControlled
    2981         1602 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> zoneBBHeatObjects;
    2982          801 :         int numZoneBBHeatStatements = 0;
    2983          801 :         setupIHGZonesAndSpaces(state, bbModuleObject, zoneBBHeatObjects, numZoneBBHeatStatements, state.dataHeatBal->TotBBHeat, ErrorsFound);
    2984              : 
    2985          801 :         if (state.dataHeatBal->TotBBHeat > 0) {
    2986            3 :             state.dataHeatBal->ZoneBBHeat.allocate(state.dataHeatBal->TotBBHeat);
    2987            3 :             int bbHeatNum = 0;
    2988            6 :             for (int bbHeatInputNum = 1; bbHeatInputNum <= numZoneBBHeatStatements; ++bbHeatInputNum) {
    2989            3 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2990              :                                                                          bbModuleObject,
    2991              :                                                                          bbHeatInputNum,
    2992              :                                                                          IHGAlphas,
    2993              :                                                                          IHGNumAlphas,
    2994              :                                                                          IHGNumbers,
    2995              :                                                                          IHGNumNumbers,
    2996              :                                                                          IOStat,
    2997              :                                                                          IHGNumericFieldBlanks,
    2998              :                                                                          IHGAlphaFieldBlanks,
    2999              :                                                                          IHGAlphaFieldNames,
    3000              :                                                                          IHGNumericFieldNames);
    3001              : 
    3002            3 :                 ErrorObjectHeader eoh{routineName, bbModuleObject, IHGAlphas(1)};
    3003              : 
    3004            3 :                 auto &thisBBHeatInput = zoneBBHeatObjects(bbHeatInputNum);
    3005            6 :                 for (int Item1 = 1; Item1 <= thisBBHeatInput.numOfSpaces; ++Item1) {
    3006            3 :                     ++bbHeatNum;
    3007            3 :                     auto &thisZoneBBHeat = state.dataHeatBal->ZoneBBHeat(bbHeatNum);
    3008            3 :                     int const spaceNum = thisBBHeatInput.spaceNums(Item1);
    3009            3 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    3010            3 :                     thisZoneBBHeat.Name = thisBBHeatInput.names(Item1);
    3011            3 :                     thisZoneBBHeat.spaceIndex = spaceNum;
    3012            3 :                     thisZoneBBHeat.ZonePtr = zoneNum;
    3013              : 
    3014            3 :                     if (IHGAlphaFieldBlanks(3)) {
    3015            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    3016            0 :                         ErrorsFound = true;
    3017            3 :                     } else if ((thisZoneBBHeat.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    3018            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    3019            0 :                         ErrorsFound = true;
    3020            3 :                     } else if (!thisZoneBBHeat.sched->checkMinVal(state, Clusive::In, 0.0)) {
    3021            0 :                         Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    3022            0 :                         ErrorsFound = true;
    3023              :                     }
    3024              : 
    3025            3 :                     if (IHGNumAlphas > 3) {
    3026            3 :                         thisZoneBBHeat.EndUseSubcategory = IHGAlphas(4);
    3027              :                     } else {
    3028            0 :                         thisZoneBBHeat.EndUseSubcategory = "General";
    3029              :                     }
    3030              : 
    3031            3 :                     Real64 spaceFrac = 1.0;
    3032            3 :                     if (thisBBHeatInput.numOfSpaces > 1) {
    3033            0 :                         Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    3034            0 :                         if (zoneArea > 0.0) {
    3035            0 :                             spaceFrac = state.dataHeatBal->space(spaceNum).FloorArea / zoneArea;
    3036              :                         } else {
    3037            0 :                             ShowSevereError(
    3038              :                                 state,
    3039            0 :                                 format("{}Zone floor area is zero when allocating ZoneBaseboard:OutdoorTemperatureControlled loads to Spaces.",
    3040              :                                        RoutineName));
    3041            0 :                             ShowContinueError(state,
    3042            0 :                                               format("Occurs for ZoneBaseboard:OutdoorTemperatureControlled object ={} in Zone={}",
    3043            0 :                                                      thisBBHeatInput.Name,
    3044            0 :                                                      state.dataHeatBal->Zone(zoneNum).Name));
    3045            0 :                             ErrorsFound = true;
    3046              :                         }
    3047              :                     }
    3048            3 :                     thisZoneBBHeat.CapatLowTemperature = IHGNumbers(1) * spaceFrac;
    3049            3 :                     thisZoneBBHeat.LowTemperature = IHGNumbers(2);
    3050            3 :                     thisZoneBBHeat.CapatHighTemperature = IHGNumbers(3) * spaceFrac;
    3051            3 :                     thisZoneBBHeat.HighTemperature = IHGNumbers(4);
    3052            3 :                     thisZoneBBHeat.FractionRadiant = IHGNumbers(5);
    3053            3 :                     thisZoneBBHeat.FractionConvected = 1.0 - thisZoneBBHeat.FractionRadiant;
    3054            3 :                     if (thisZoneBBHeat.FractionConvected < 0.0) {
    3055            0 :                         ShowSevereError(state, format("{}{}=\"{}\", Sum of Fractions > 1.0", RoutineName, bbModuleObject, thisBBHeatInput.Name));
    3056            0 :                         ErrorsFound = true;
    3057              :                     }
    3058              : 
    3059            3 :                     if (thisZoneBBHeat.ZonePtr <= 0) {
    3060            0 :                         continue; // Error, will be caught and terminated later
    3061              :                     }
    3062              : 
    3063            3 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    3064            0 :                         SetupEMSActuator(state,
    3065              :                                          "ZoneBaseboard:OutdoorTemperatureControlled",
    3066              :                                          thisZoneBBHeat.Name,
    3067              :                                          "Power Level",
    3068              :                                          "[W]",
    3069            0 :                                          thisZoneBBHeat.EMSZoneBaseboardOverrideOn,
    3070            0 :                                          thisZoneBBHeat.EMSZoneBaseboardPower);
    3071            0 :                         SetupEMSInternalVariable(state,
    3072              :                                                  "Simple Zone Baseboard Capacity At Low Temperature",
    3073              :                                                  thisZoneBBHeat.Name,
    3074              :                                                  "[W]",
    3075            0 :                                                  thisZoneBBHeat.CapatLowTemperature);
    3076            0 :                         SetupEMSInternalVariable(state,
    3077              :                                                  "Simple Zone Baseboard Capacity At High Temperature",
    3078              :                                                  thisZoneBBHeat.Name,
    3079              :                                                  "[W]",
    3080            0 :                                                  thisZoneBBHeat.CapatHighTemperature);
    3081              :                     } // EMS
    3082              : 
    3083            3 :                     SetupSpaceInternalGain(state,
    3084              :                                            thisZoneBBHeat.spaceIndex,
    3085              :                                            1.0,
    3086              :                                            thisZoneBBHeat.Name,
    3087              :                                            DataHeatBalance::IntGainType::ZoneBaseboardOutdoorTemperatureControlled,
    3088              :                                            &thisZoneBBHeat.ConGainRate,
    3089              :                                            nullptr,
    3090              :                                            &thisZoneBBHeat.RadGainRate);
    3091              :                 } // for bbHeatInputNum.NumOfSpaces
    3092              :             } // for bbHeatInputNum
    3093              :         } // TotBBHeat > 0
    3094              : 
    3095          801 :         state.dataHeatBal->TotCO2Gen = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, contamSSModuleObject);
    3096          801 :         state.dataHeatBal->ZoneCO2Gen.allocate(state.dataHeatBal->TotCO2Gen);
    3097              : 
    3098          806 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotCO2Gen; ++Loop) {
    3099            5 :             IHGAlphas = "";
    3100            5 :             IHGNumbers = 0.0;
    3101            5 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3102              :                                                                      contamSSModuleObject,
    3103              :                                                                      Loop,
    3104              :                                                                      IHGAlphas,
    3105              :                                                                      IHGNumAlphas,
    3106              :                                                                      IHGNumbers,
    3107              :                                                                      IHGNumNumbers,
    3108              :                                                                      IOStat,
    3109              :                                                                      IHGNumericFieldBlanks,
    3110              :                                                                      IHGAlphaFieldBlanks,
    3111              :                                                                      IHGAlphaFieldNames,
    3112              :                                                                      IHGNumericFieldNames);
    3113              : 
    3114            5 :             ErrorObjectHeader eoh{routineName, contamSSModuleObject, IHGAlphas(1)};
    3115            5 :             Util::IsNameEmpty(state, IHGAlphas(1), contamSSModuleObject, ErrorsFound);
    3116              : 
    3117            5 :             state.dataHeatBal->ZoneCO2Gen(Loop).Name = IHGAlphas(1);
    3118              : 
    3119            5 :             state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr = Util::FindItemInList(IHGAlphas(2), state.dataHeatBal->Zone);
    3120            5 :             if (state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr == 0) {
    3121            0 :                 ShowSevereError(
    3122              :                     state,
    3123            0 :                     format(
    3124              :                         "{}{}=\"{}\", invalid {} entered={}", RoutineName, contamSSModuleObject, IHGAlphas(1), IHGAlphaFieldNames(2), IHGAlphas(2)));
    3125            0 :                 ErrorsFound = true;
    3126              :             }
    3127              : 
    3128            5 :             if (IHGAlphaFieldBlanks(3)) {
    3129            0 :                 ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    3130            0 :                 ErrorsFound = true;
    3131            5 :             } else if ((state.dataHeatBal->ZoneCO2Gen(Loop).sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    3132            0 :                 ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    3133            0 :                 ErrorsFound = true;
    3134            5 :             } else if (!state.dataHeatBal->ZoneCO2Gen(Loop).sched->checkMinVal(state, Clusive::In, 0.0)) {
    3135            0 :                 Sched::ShowSevereBadMin(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3), Clusive::In, 0.0);
    3136            0 :                 ErrorsFound = true;
    3137              :             }
    3138              : 
    3139            5 :             state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate = IHGNumbers(1);
    3140              : 
    3141            5 :             if (state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr <= 0) {
    3142            0 :                 continue; // Error, will be caught and terminated later
    3143              :             }
    3144              : 
    3145              :             // Object report variables
    3146           10 :             SetupOutputVariable(state,
    3147              :                                 "Contaminant Source or Sink CO2 Gain Volume Flow Rate",
    3148              :                                 Constant::Units::m3_s,
    3149            5 :                                 state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate,
    3150              :                                 OutputProcessor::TimeStepType::Zone,
    3151              :                                 OutputProcessor::StoreType::Average,
    3152            5 :                                 state.dataHeatBal->ZoneCO2Gen(Loop).Name);
    3153              : 
    3154              :             // Zone total report variables
    3155            5 :             if (RepVarSet(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr)) {
    3156            5 :                 RepVarSet(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr) = false;
    3157              : 
    3158           10 :                 SetupOutputVariable(state,
    3159              :                                     "Zone Contaminant Source or Sink CO2 Gain Volume Flow Rate",
    3160              :                                     Constant::Units::m3_s,
    3161            5 :                                     state.dataHeatBal->ZoneRpt(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr).CO2Rate,
    3162              :                                     OutputProcessor::TimeStepType::Zone,
    3163              :                                     OutputProcessor::StoreType::Average,
    3164            5 :                                     state.dataHeatBal->Zone(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr).Name);
    3165              :             }
    3166              : 
    3167           15 :             SetupZoneInternalGain(state,
    3168            5 :                                   state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr,
    3169            5 :                                   state.dataHeatBal->ZoneCO2Gen(Loop).Name,
    3170              :                                   DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide,
    3171              :                                   nullptr,
    3172              :                                   nullptr,
    3173              :                                   nullptr,
    3174              :                                   nullptr,
    3175              :                                   nullptr,
    3176            5 :                                   &state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate);
    3177              :         }
    3178              : 
    3179          801 :         RepVarSet.deallocate();
    3180              : 
    3181          801 :         if (ErrorsFound) {
    3182            0 :             ShowFatalError(state, format("{}Errors found in Getting Internal Gains Input, Program Stopped", RoutineName));
    3183              :         }
    3184          801 :         setupIHGOutputs(state);
    3185              : 
    3186              :         static constexpr std::string_view Format_721(
    3187              :             "! <Zone Internal Gains Nominal>,Zone Name, Floor Area {{m2}},# Occupants,Area per Occupant "
    3188              :             "{{m2/person}},Occupant per Area {{person/m2}},Interior Lighting {{W/m2}},Electric Load {{W/m2}},Gas Load {{W/m2}},Other "
    3189              :             "Load {{W/m2}},Hot Water Eq {{W/m2}},Steam Equipment {{W/m2}},Sum Loads per Area {{W/m2}},Outdoor Controlled Baseboard "
    3190              :             "Heat\n");
    3191              : 
    3192          801 :         print(state.files.eio, Format_721);
    3193              : 
    3194         6002 :         for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) {
    3195         5201 :             auto &zone = state.dataHeatBal->Zone(Loop);
    3196              : 
    3197         5201 :             Real64 LightTot = 0.0;
    3198         5201 :             Real64 ElecTot = 0.0;
    3199         5201 :             Real64 GasTot = 0.0;
    3200         5201 :             Real64 OthTot = 0.0;
    3201         5201 :             Real64 HWETot = 0.0;
    3202         5201 :             Real64 StmTot = 0.0;
    3203         5201 :             std::string BBHeatInd = "No"; // Yes if BBHeat in zone, no if not.
    3204              : 
    3205       163526 :             for (auto const &lights : state.dataHeatBal->Lights) {
    3206       158325 :                 if (lights.ZonePtr == Loop) {
    3207         4471 :                     LightTot += lights.DesignLevel;
    3208              :                 }
    3209         5201 :             }
    3210       156533 :             for (auto const &elecEq : state.dataHeatBal->ZoneElectric) {
    3211       151332 :                 if (elecEq.ZonePtr == Loop) {
    3212         4578 :                     ElecTot += elecEq.DesignLevel;
    3213              :                 }
    3214         5201 :             }
    3215         5220 :             for (auto const &itEq : state.dataHeatBal->ZoneITEq) {
    3216           19 :                 if (itEq.ZonePtr == Loop) {
    3217            7 :                     ElecTot += itEq.DesignTotalPower; // Should this not be itTot?
    3218              :                 }
    3219         5201 :             }
    3220         8382 :             for (auto const &gasEq : state.dataHeatBal->ZoneGas) {
    3221         3181 :                 if (gasEq.ZonePtr == Loop) {
    3222           88 :                     GasTot += gasEq.DesignLevel;
    3223              :                 }
    3224         5201 :             }
    3225         5426 :             for (auto const &otherEq : state.dataHeatBal->ZoneOtherEq) {
    3226          225 :                 if (otherEq.ZonePtr == Loop) {
    3227           89 :                     OthTot += otherEq.DesignLevel;
    3228              :                 }
    3229         5201 :             }
    3230         5231 :             for (auto const &steamEq : state.dataHeatBal->ZoneSteamEq) {
    3231           30 :                 if (steamEq.ZonePtr == Loop) {
    3232            5 :                     StmTot += steamEq.DesignLevel;
    3233              :                 }
    3234         5201 :             }
    3235         5312 :             for (auto const &hotWaterEq : state.dataHeatBal->ZoneHWEq) {
    3236          111 :                 if (hotWaterEq.ZonePtr == Loop) {
    3237           14 :                     HWETot += hotWaterEq.DesignLevel;
    3238              :                 }
    3239         5201 :             }
    3240         5219 :             for (auto const &bbHeat : state.dataHeatBal->ZoneBBHeat) {
    3241           18 :                 if (bbHeat.ZonePtr == Loop) {
    3242            3 :                     BBHeatInd = "Yes";
    3243              :                 }
    3244         5201 :             }
    3245              : 
    3246         5201 :             zone.InternalHeatGains = LightTot + ElecTot + GasTot + OthTot + HWETot + StmTot;
    3247         5201 :             if (zone.FloorArea > 0.0) {
    3248         5199 :                 print(state.files.eio, Format_720, zone.Name, zone.FloorArea, zone.TotOccupants);
    3249         5199 :                 print_and_divide_if_greater_than_zero(zone.FloorArea, zone.TotOccupants);
    3250         5199 :                 print(state.files.eio, "{:.3R},", zone.TotOccupants / zone.FloorArea);
    3251         5199 :                 print(state.files.eio, "{:.3R},", LightTot / zone.FloorArea);
    3252         5199 :                 print(state.files.eio, "{:.3R},", ElecTot / zone.FloorArea);
    3253         5199 :                 print(state.files.eio, "{:.3R},", GasTot / zone.FloorArea);
    3254         5199 :                 print(state.files.eio, "{:.3R},", OthTot / zone.FloorArea);
    3255         5199 :                 print(state.files.eio, "{:.3R},", HWETot / zone.FloorArea);
    3256         5199 :                 print(state.files.eio, "{:.3R},", StmTot / zone.FloorArea);
    3257         5199 :                 print(state.files.eio, "{:.3R},{}\n", zone.InternalHeatGains / zone.FloorArea, BBHeatInd);
    3258              :             } else {
    3259            2 :                 print(state.files.eio, Format_720, zone.Name, zone.FloorArea, zone.TotOccupants);
    3260            2 :                 print(state.files.eio, "0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{}\n", BBHeatInd);
    3261              :             }
    3262         5201 :         }
    3263              : 
    3264         5039 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) {
    3265         4238 :             auto &people = state.dataHeatBal->People(Loop);
    3266              : 
    3267         4238 :             if (Loop == 1) {
    3268          668 :                 print(state.files.eio,
    3269              :                       Format_723,
    3270              :                       "People",
    3271              :                       "Number of People {},People/Floor Area {person/m2},Floor Area per person {m2/person},Fraction Radiant,Fraction "
    3272              :                       "Convected,Sensible Fraction Calculation,Activity level,ASHRAE 55 Warnings,Carbon Dioxide Generation Rate,"
    3273              :                       "Minimum Number of People for All Day Types,Maximum Number of People for All Day Types,"
    3274              :                       "Minimum Number of People for Weekdays, Maximum Number of People for Weekdays, "
    3275              :                       "Minimum Number of People for Weekends/Holidays, Maximum Number of People for Weekends /Holidays,"
    3276              :                       "Minimum Number of People for Summer Design Days, Maximum Number of People for Summer Design Days,"
    3277              :                       "Minimum Number of People for Winter Design Days, Maximum Number of People for Winter Design Days");
    3278          668 :                 if (people.Fanger || people.Pierce || people.KSU || people.CoolingEffectASH55 || people.AnkleDraftASH55) {
    3279          381 :                     print(state.files.eio,
    3280              :                           ",MRT Calculation Type,Work Efficiency, Clothing Insulation Calculation Method,Clothing "
    3281              :                           "Insulation Calculation Method Schedule,Clothing,Air Velocity,Fanger Calculation,Pierce "
    3282              :                           "Calculation,KSU Calculation,Cooling Effect Calculation,Ankle Draft Calculation\n");
    3283              :                 } else {
    3284          287 :                     print(state.files.eio, "\n");
    3285              :                 }
    3286              :             }
    3287              : 
    3288         4238 :             if (people.ZonePtr == 0) {
    3289            0 :                 print(state.files.eio, Format_724, "People-Illegal Zone specified", people.Name);
    3290            0 :                 continue;
    3291              :             }
    3292              : 
    3293         4238 :             auto const &zone = state.dataHeatBal->Zone(people.ZonePtr);
    3294              : 
    3295         4238 :             print(state.files.eio, Format_722, "People", people.Name, people.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3296         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople);
    3297              : 
    3298         4238 :             print_and_divide_if_greater_than_zero(people.NumberOfPeople, zone.FloorArea);
    3299              : 
    3300         4238 :             if (people.NumberOfPeople > 0.0) {
    3301         4173 :                 print_and_divide_if_greater_than_zero(zone.FloorArea, people.NumberOfPeople);
    3302              :             } else {
    3303           65 :                 print(state.files.eio, "N/A,");
    3304              :             }
    3305              : 
    3306         4238 :             print(state.files.eio, "{:.3R},", people.FractionRadiant);
    3307         4238 :             print(state.files.eio, "{:.3R},", people.FractionConvected);
    3308         4238 :             if (people.UserSpecSensFrac == Constant::AutoCalculate) {
    3309         4138 :                 print(state.files.eio, "AutoCalculate,");
    3310              :             } else {
    3311          100 :                 print(state.files.eio, "{:.3R},", people.UserSpecSensFrac);
    3312              :             }
    3313         4238 :             print(state.files.eio, "{},", people.activityLevelSched->Name);
    3314              : 
    3315         4238 :             print(state.files.eio, "{},", yesNoNames[(int)people.Show55Warning]);
    3316         4238 :             print(state.files.eio, "{:.4R},", people.CO2RateFactor);
    3317         4238 :             print(state.files.eio, "{:.1R},", people.NomMinNumberPeople);
    3318         4238 :             print(state.files.eio, "{:.1R},", people.NomMaxNumberPeople);
    3319              : 
    3320              :             Real64 SchMin, SchMax;
    3321              : 
    3322              :             // weekdays
    3323         4238 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3324         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3325         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3326              : 
    3327              :             // weekends/holidays
    3328         4238 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3329         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3330         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3331              : 
    3332              :             // summer design days
    3333         4238 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3334         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3335         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3336              : 
    3337              :             // winter design days
    3338         4238 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3339         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3340         4238 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3341              : 
    3342         4238 :             if (people.Fanger || people.Pierce || people.KSU || people.CoolingEffectASH55 || people.AnkleDraftASH55) {
    3343              : 
    3344         2671 :                 if (people.MRTCalcType == DataHeatBalance::CalcMRT::EnclosureAveraged) {
    3345         2662 :                     print(state.files.eio, "Zone Averaged,");
    3346            9 :                 } else if (people.MRTCalcType == DataHeatBalance::CalcMRT::SurfaceWeighted) {
    3347            6 :                     print(state.files.eio, "Surface Weighted,");
    3348            3 :                 } else if (people.MRTCalcType == DataHeatBalance::CalcMRT::AngleFactor) {
    3349            3 :                     print(state.files.eio, "Angle Factor,");
    3350              :                 } else {
    3351            0 :                     print(state.files.eio, "N/A,");
    3352              :                 }
    3353         2671 :                 print(state.files.eio, "{},", people.workEffSched ? people.workEffSched->Name : "");
    3354              : 
    3355         2671 :                 print(state.files.eio, clothingTypeEIOStrings[(int)people.clothingType]);
    3356              : 
    3357         2671 :                 if (people.clothingType == ClothingType::CalculationSchedule) {
    3358            1 :                     print(state.files.eio, "{},", people.clothingMethodSched->Name);
    3359              :                 } else {
    3360         2670 :                     print(state.files.eio, "N/A,");
    3361              :                 }
    3362              : 
    3363         2673 :                 print(state.files.eio, "{},", people.clothingSched ? people.clothingSched->Name : "");
    3364         2671 :                 print(state.files.eio, "{},", people.airVelocitySched ? people.airVelocitySched->Name : "");
    3365              : 
    3366         2671 :                 print(state.files.eio, "{},", yesNoNames[(int)people.Fanger]);
    3367         2671 :                 print(state.files.eio, "{},", yesNoNames[(int)people.Pierce]);
    3368         2671 :                 print(state.files.eio, "{},", yesNoNames[(int)people.KSU]);
    3369         2671 :                 print(state.files.eio, "{},", yesNoNames[(int)people.CoolingEffectASH55]);
    3370         2671 :                 print(state.files.eio, "{}", yesNoNames[(int)people.AnkleDraftASH55]);
    3371              :             }
    3372         4238 :             print(state.files.eio, "\n");
    3373              :         }
    3374              : 
    3375         5272 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    3376         4471 :             auto &lights = state.dataHeatBal->Lights(Loop);
    3377              : 
    3378         4471 :             if (Loop == 1) {
    3379          667 :                 print(state.files.eio,
    3380              :                       Format_723,
    3381              :                       "Lights",
    3382              :                       "Lighting Level {W},Lights/Floor Area {W/m2},Lights per person {W/person},Fraction Return "
    3383              :                       "Air,Fraction Radiant,Fraction Short Wave,Fraction Convected,Fraction Replaceable,End-Use, "
    3384              :                       "Minimum Lighting Level for All Day Types {W},Maximum Lighting Level for All Day Types {W},"
    3385              :                       "Minimum Lighting Level for Weekdays {W}, Maximum Lighting Level for Weekdays {W},"
    3386              :                       "Minimum Lighting Level for Weekends/Holidays {W}, Maximum Lighting Level for Weekends /Holidays {W},"
    3387              :                       "Minimum Lighting Level for Summer Design Days {W}, Maximum Lighting Level for Summer Design Days {W},"
    3388              :                       "Minimum Lighting Level for Winter Design Days {W}, Maximum Lighting Level for Winter Design Days {W}\n");
    3389              :             }
    3390              : 
    3391         4471 :             if (lights.ZonePtr == 0) {
    3392            0 :                 print(state.files.eio, "Lights-Illegal Zone specified", lights.Name);
    3393            0 :                 continue;
    3394              :             }
    3395              : 
    3396         4471 :             auto const &zone = state.dataHeatBal->Zone(lights.ZonePtr);
    3397              : 
    3398         4471 :             print(state.files.eio, Format_722, "Lights", lights.Name, lights.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3399              : 
    3400         4471 :             print(state.files.eio, "{:.3R},", lights.DesignLevel);
    3401              : 
    3402         4471 :             print_and_divide_if_greater_than_zero(lights.DesignLevel, zone.FloorArea);
    3403         4471 :             print_and_divide_if_greater_than_zero(lights.DesignLevel, zone.TotOccupants);
    3404              : 
    3405         4471 :             print(state.files.eio, "{:.3R},", lights.FractionReturnAir);
    3406         4471 :             print(state.files.eio, "{:.3R},", lights.FractionRadiant);
    3407         4471 :             print(state.files.eio, "{:.3R},", lights.FractionShortWave);
    3408         4471 :             print(state.files.eio, "{:.3R},", lights.FractionConvected);
    3409         4471 :             print(state.files.eio, "{:.3R},", lights.FractionReplaceable);
    3410         4471 :             print(state.files.eio, "{},", lights.EndUseSubcategory);
    3411         4471 :             print(state.files.eio, "{:.3R},", lights.NomMinDesignLevel);
    3412         4471 :             print(state.files.eio, "{:.3R},", lights.NomMaxDesignLevel);
    3413              : 
    3414         4471 :             auto &light = state.dataHeatBal->Lights(Loop);
    3415              : 
    3416              :             Real64 SchMin, SchMax;
    3417              :             // weekdays
    3418         4471 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3419         4471 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3420         4471 :             print(state.files.eio, "{:.1R},", light.DesignLevel * SchMax);
    3421              : 
    3422              :             // weekends/holidays
    3423         4471 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3424         4471 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3425         4471 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMax);
    3426              : 
    3427              :             // summer design days
    3428         4471 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3429         4471 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3430         4471 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMax);
    3431              : 
    3432              :             // winter design days
    3433         4471 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3434         4471 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3435         4471 :             print(state.files.eio, "{:.3R}\n", light.DesignLevel * SchMax);
    3436              :         }
    3437              : 
    3438         5379 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) {
    3439         4578 :             auto &elecEq = state.dataHeatBal->ZoneElectric(Loop);
    3440              : 
    3441         4578 :             if (Loop == 1) {
    3442          655 :                 print(state.files.eio,
    3443              :                       Format_723,
    3444              :                       "ElectricEquipment",
    3445              :                       "Equipment Level {W},Equipment/Floor Area {W/m2},Equipment per person {W/person},Fraction Latent,Fraction Radiant,Fraction "
    3446              :                       "Lost,Fraction Convected,End-Use SubCategory,"
    3447              :                       "Minimum Equipment Level for All Day Types {W},Maximum Equipment Level for All Day Types {W},"
    3448              :                       "Minimum Equipment Level for Weekdays {W}, Maximum Equipment Level for Weekdays {W},"
    3449              :                       "Minimum Equipment Level for Weekends/Holidays {W}, Maximum Equipment Level for Weekends /Holidays {W},"
    3450              :                       "Minimum Equipment Level for Summer Design Days {W}, Maximum Equipment Level for Summer Design Days {W},"
    3451              :                       "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n");
    3452              :             }
    3453              : 
    3454         4578 :             if (elecEq.ZonePtr == 0) {
    3455            0 :                 print(state.files.eio, Format_724, "Electric Equipment-Illegal Zone specified", elecEq.Name);
    3456            0 :                 continue;
    3457              :             }
    3458              : 
    3459         4578 :             auto &zone = state.dataHeatBal->Zone(elecEq.ZonePtr);
    3460              : 
    3461         4578 :             print(state.files.eio, Format_722, "ElectricEquipment", elecEq.Name, elecEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3462         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel);
    3463              : 
    3464         4578 :             print_and_divide_if_greater_than_zero(elecEq.DesignLevel, zone.FloorArea);
    3465         4578 :             print_and_divide_if_greater_than_zero(elecEq.DesignLevel, zone.TotOccupants);
    3466              : 
    3467         4578 :             print(state.files.eio, "{:.3R},", elecEq.FractionLatent);
    3468         4578 :             print(state.files.eio, "{:.3R},", elecEq.FractionRadiant);
    3469         4578 :             print(state.files.eio, "{:.3R},", elecEq.FractionLost);
    3470         4578 :             print(state.files.eio, "{:.3R},", elecEq.FractionConvected);
    3471         4578 :             print(state.files.eio, "{},", elecEq.EndUseSubcategory);
    3472         4578 :             print(state.files.eio, "{:.3R},", elecEq.NomMinDesignLevel);
    3473         4578 :             print(state.files.eio, "{:.3R},", elecEq.NomMaxDesignLevel);
    3474              : 
    3475              :             Real64 SchMin, SchMax;
    3476              : 
    3477              :             // weekdays
    3478         4578 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3479         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3480         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax);
    3481              : 
    3482              :             // weekends/holidays
    3483         4578 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3484         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3485         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax);
    3486              : 
    3487              :             // summer design days
    3488         4578 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3489         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3490         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax);
    3491              : 
    3492              :             // winter design days
    3493         4578 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3494         4578 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3495         4578 :             print(state.files.eio, "{:.3R}\n", elecEq.DesignLevel * SchMax);
    3496              :         }
    3497              : 
    3498          889 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) {
    3499           88 :             auto &gasEq = state.dataHeatBal->ZoneGas(Loop);
    3500              : 
    3501           88 :             if (Loop == 1) {
    3502           39 :                 print(state.files.eio,
    3503              :                       Format_723,
    3504              :                       "GasEquipment",
    3505              :                       "Equipment Level {W},Equipment/Floor Area {W/m2},Equipment per person {W/person},Fraction Latent,Fraction Radiant,Fraction "
    3506              :                       "Lost,Fraction Convected,End-Use SubCategory,"
    3507              :                       "Minimum Equipment Level for All Day Types {W},Maximum Equipment Level for All Day Types {W},"
    3508              :                       "Minimum Equipment Level for Weekdays {W}, Maximum Equipment Level for Weekdays {W},"
    3509              :                       "Minimum Equipment Level for Weekends/Holidays {W}, Maximum Equipment Level for Weekends /Holidays {W},"
    3510              :                       "Minimum Equipment Level for Summer Design Days {W}, Maximum Equipment Level for Summer Design Days {W},"
    3511              :                       "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n");
    3512              :             }
    3513              : 
    3514           88 :             if (gasEq.ZonePtr == 0) {
    3515            0 :                 print(state.files.eio, Format_724, "Gas Equipment-Illegal Zone specified", gasEq.Name);
    3516            0 :                 continue;
    3517              :             }
    3518              : 
    3519           88 :             auto &zone = state.dataHeatBal->Zone(gasEq.ZonePtr);
    3520              : 
    3521           88 :             print(state.files.eio, Format_722, "GasEquipment", gasEq.Name, gasEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3522           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel);
    3523              : 
    3524           88 :             print_and_divide_if_greater_than_zero(gasEq.DesignLevel, zone.FloorArea);
    3525           88 :             print_and_divide_if_greater_than_zero(gasEq.DesignLevel, zone.TotOccupants);
    3526              : 
    3527           88 :             print(state.files.eio, "{:.3R},", gasEq.FractionLatent);
    3528           88 :             print(state.files.eio, "{:.3R},", gasEq.FractionRadiant);
    3529           88 :             print(state.files.eio, "{:.3R},", gasEq.FractionLost);
    3530           88 :             print(state.files.eio, "{:.3R},", gasEq.FractionConvected);
    3531           88 :             print(state.files.eio, "{},", gasEq.EndUseSubcategory);
    3532           88 :             print(state.files.eio, "{:.3R},", gasEq.NomMinDesignLevel);
    3533           88 :             print(state.files.eio, "{:.3R},", gasEq.NomMaxDesignLevel);
    3534              : 
    3535              :             Real64 SchMin, SchMax;
    3536              :             // weekdays
    3537           88 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3538           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3539           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax);
    3540              : 
    3541              :             // weekends/holidays
    3542           88 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3543           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3544           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax);
    3545              : 
    3546              :             // summer design days
    3547           88 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3548           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3549           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax);
    3550              : 
    3551              :             // winter design days
    3552           88 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3553           88 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3554           88 :             print(state.files.eio, "{:.3R}\n", gasEq.DesignLevel * SchMax);
    3555              :         }
    3556              : 
    3557          815 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) {
    3558           14 :             auto &hotWaterEq = state.dataHeatBal->ZoneHWEq(Loop);
    3559              : 
    3560           14 :             if (Loop == 1) {
    3561            6 :                 print(state.files.eio,
    3562              :                       Format_723,
    3563              :                       "HotWaterEquipment",
    3564              :                       "Equipment Level {W},Equipment/Floor Area {W/m2},Equipment per person {W/person},Fraction Latent,Fraction Radiant,Fraction "
    3565              :                       "Lost,Fraction Convected,End-Use SubCategory,"
    3566              :                       "Minimum Equipment Level for All Day Types {W},Maximum Equipment Level for All Day Types {W},"
    3567              :                       "Minimum Equipment Level for Weekdays {W}, Maximum Equipment Level for Weekdays {W},"
    3568              :                       "Minimum Equipment Level for Weekends/Holidays {W}, Maximum Equipment Level for Weekends /Holidays {W},"
    3569              :                       "Minimum Equipment Level for Summer Design Days {W}, Maximum Equipment Level for Summer Design Days {W},"
    3570              :                       "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n");
    3571              :             }
    3572              : 
    3573           14 :             if (hotWaterEq.ZonePtr == 0) {
    3574            0 :                 print(state.files.eio, Format_724, "Hot Water Equipment-Illegal Zone specified", hotWaterEq.Name);
    3575            0 :                 continue;
    3576              :             }
    3577              : 
    3578           14 :             auto const &zone = state.dataHeatBal->Zone(hotWaterEq.ZonePtr);
    3579              : 
    3580           14 :             print(state.files.eio,
    3581              :                   Format_722,
    3582              :                   "HotWaterEquipment",
    3583           14 :                   hotWaterEq.Name,
    3584           14 :                   hotWaterEq.sched->Name,
    3585           14 :                   zone.Name,
    3586           14 :                   zone.FloorArea,
    3587           14 :                   zone.TotOccupants);
    3588              : 
    3589           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel);
    3590              : 
    3591           14 :             print_and_divide_if_greater_than_zero(hotWaterEq.DesignLevel, zone.FloorArea);
    3592           14 :             print_and_divide_if_greater_than_zero(hotWaterEq.DesignLevel, zone.TotOccupants);
    3593              : 
    3594           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionLatent);
    3595           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionRadiant);
    3596           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionLost);
    3597           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionConvected);
    3598           14 :             print(state.files.eio, "{},", hotWaterEq.EndUseSubcategory);
    3599           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.NomMinDesignLevel);
    3600           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.NomMaxDesignLevel);
    3601              : 
    3602              :             Real64 SchMin, SchMax;
    3603              :             // weekdays
    3604           14 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3605           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3606           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax);
    3607              : 
    3608              :             // weekends/holidays
    3609           14 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3610           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3611           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax);
    3612              : 
    3613              :             // summer design days
    3614           14 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3615           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3616           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax);
    3617              : 
    3618              :             // winter design days
    3619           14 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3620           14 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3621           14 :             print(state.files.eio, "{:.3R}\n", hotWaterEq.DesignLevel * SchMax);
    3622              :         }
    3623              : 
    3624          806 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) {
    3625            5 :             auto &steamEq = state.dataHeatBal->ZoneSteamEq(Loop);
    3626              : 
    3627            5 :             if (Loop == 1) {
    3628            5 :                 print(state.files.eio,
    3629              :                       Format_723,
    3630              :                       "SteamEquipment",
    3631              :                       "Equipment Level {W},Equipment/Floor Area {W/m2},Equipment per person {W/person},Fraction Latent,Fraction Radiant,Fraction "
    3632              :                       "Lost,Fraction Convected,End-Use SubCategory,"
    3633              :                       "Minimum Equipment Level for All Day Types {W},Maximum Equipment Level for All Day Types {W},"
    3634              :                       "Minimum Equipment Level for Weekdays {W}, Maximum Equipment Level for Weekdays {W},"
    3635              :                       "Minimum Equipment Level for Weekends/Holidays {W}, Maximum Equipment Level for Weekends /Holidays {W},"
    3636              :                       "Minimum Equipment Level for Summer Design Days {W}, Maximum Equipment Level for Summer Design Days {W},"
    3637              :                       "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n");
    3638              :             }
    3639              : 
    3640            5 :             if (steamEq.ZonePtr == 0) {
    3641            0 :                 print(state.files.eio, Format_724, "Steam Equipment-Illegal Zone specified", steamEq.Name);
    3642            0 :                 continue;
    3643              :             }
    3644              : 
    3645            5 :             auto &zone = state.dataHeatBal->Zone(steamEq.ZonePtr);
    3646              : 
    3647            5 :             print(state.files.eio, Format_722, "SteamEquipment", steamEq.Name, steamEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3648            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel);
    3649              : 
    3650            5 :             print_and_divide_if_greater_than_zero(steamEq.DesignLevel, zone.FloorArea);
    3651            5 :             print_and_divide_if_greater_than_zero(steamEq.DesignLevel, zone.TotOccupants);
    3652              : 
    3653            5 :             print(state.files.eio, "{:.3R},", steamEq.FractionLatent);
    3654            5 :             print(state.files.eio, "{:.3R},", steamEq.FractionRadiant);
    3655            5 :             print(state.files.eio, "{:.3R},", steamEq.FractionLost);
    3656            5 :             print(state.files.eio, "{:.3R},", steamEq.FractionConvected);
    3657            5 :             print(state.files.eio, "{},", steamEq.EndUseSubcategory);
    3658            5 :             print(state.files.eio, "{:.3R},", steamEq.NomMinDesignLevel);
    3659            5 :             print(state.files.eio, "{:.3R},", steamEq.NomMaxDesignLevel);
    3660              : 
    3661              :             Real64 SchMin, SchMax;
    3662              :             // weekdays
    3663            5 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3664            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3665            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax);
    3666              : 
    3667              :             // weekends/holidays
    3668            5 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3669            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3670            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax);
    3671              : 
    3672              :             // summer design days
    3673            5 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3674            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3675            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax);
    3676              : 
    3677              :             // winter design days
    3678            5 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3679            5 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3680            5 :             print(state.files.eio, "{:.3R}\n", steamEq.DesignLevel * SchMax);
    3681              :         }
    3682              : 
    3683          890 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) {
    3684           89 :             if (Loop == 1) {
    3685           33 :                 print(state.files.eio,
    3686              :                       Format_723,
    3687              :                       "OtherEquipment",
    3688              :                       "Equipment Level {W},Equipment/Floor Area {W/m2},Equipment per person {W/person},Fraction Latent,Fraction Radiant,Fraction "
    3689              :                       "Lost,Fraction Convected,"
    3690              :                       "Minimum Equipment Level for All Day Types {W},Maximum Equipment Level for All Day Types {W},"
    3691              :                       "Minimum Equipment Level for Weekdays {W}, Maximum Equipment Level for Weekdays {W},"
    3692              :                       "Minimum Equipment Level for Weekends/Holidays {W}, Maximum Equipment Level for Weekends /Holidays {W},"
    3693              :                       "Minimum Equipment Level for Summer Design Days {W}, Maximum Equipment Level for Summer Design Days {W},"
    3694              :                       "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W}\n");
    3695              :             }
    3696              : 
    3697           89 :             auto &otherEq = state.dataHeatBal->ZoneOtherEq(Loop);
    3698              : 
    3699           89 :             if (otherEq.ZonePtr == 0) {
    3700            0 :                 print(state.files.eio, Format_724, "Other Equipment-Illegal Zone specified", otherEq.Name);
    3701            0 :                 continue;
    3702              :             }
    3703              : 
    3704           89 :             auto const &zone = state.dataHeatBal->Zone(otherEq.ZonePtr);
    3705              : 
    3706           89 :             print(state.files.eio, Format_722, "OtherEquipment", otherEq.Name, otherEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3707           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel);
    3708              : 
    3709           89 :             print_and_divide_if_greater_than_zero(otherEq.DesignLevel, zone.FloorArea);
    3710           89 :             print_and_divide_if_greater_than_zero(otherEq.DesignLevel, zone.TotOccupants);
    3711              : 
    3712           89 :             print(state.files.eio, "{:.3R},", otherEq.FractionLatent);
    3713           89 :             print(state.files.eio, "{:.3R},", otherEq.FractionRadiant);
    3714           89 :             print(state.files.eio, "{:.3R},", otherEq.FractionLost);
    3715           89 :             print(state.files.eio, "{:.3R},", otherEq.FractionConvected);
    3716           89 :             print(state.files.eio, "{:.3R},", otherEq.NomMinDesignLevel);
    3717           89 :             print(state.files.eio, "{:.3R},", otherEq.NomMaxDesignLevel);
    3718              : 
    3719              :             Real64 SchMin, SchMax;
    3720              : 
    3721              :             // weekdays
    3722           89 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3723           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3724           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax);
    3725              : 
    3726              :             // weekends/holidays
    3727           89 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3728           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3729           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax);
    3730              : 
    3731              :             // summer design days
    3732           89 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3733           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3734           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax);
    3735              : 
    3736              :             // winter design days
    3737           89 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3738           89 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3739           89 :             print(state.files.eio, "{:.3R}\n", otherEq.DesignLevel * SchMax);
    3740              :         }
    3741              : 
    3742          808 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    3743            7 :             auto &itEq = state.dataHeatBal->ZoneITEq(Loop);
    3744              : 
    3745            7 :             if (Loop == 1) {
    3746            5 :                 print(state.files.eio,
    3747              :                       Format_723,
    3748              :                       "ElectricEquipment:ITE:AirCooled",
    3749              :                       "Equipment Level {W},"
    3750              :                       "Equipment/Floor Area {W/m2},Equipment per person {W/person},"
    3751              :                       "Fraction Convected,CPU End-Use SubCategory,Fan End-Use SubCategory,UPS End-Use SubCategory,"
    3752              :                       "Minimum Equipment Level for All Day Types {W},Maximum Equipment Level for All Day Types {W},"
    3753              :                       "Minimum Equipment Level for Weekdays {W}, Maximum Equipment Level for Weekdays {W},"
    3754              :                       "Minimum Equipment Level for Weekends/Holidays {W}, Maximum Equipment Level for Weekends /Holidays {W},"
    3755              :                       "Minimum Equipment Level for Summer Design Days {W}, Maximum Equipment Level for Summer Design Days {W},"
    3756              :                       "Minimum Equipment Level for Winter Design Days {W}, Maximum Equipment Level for Winter Design Days {W},"
    3757              :                       "Design Air Volume Flow Rate {m3/s}\n");
    3758              :             }
    3759              : 
    3760            7 :             if (itEq.ZonePtr == 0) {
    3761            0 :                 print(state.files.eio, Format_724, "ElectricEquipment:ITE:AirCooled-Illegal Zone specified", itEq.Name);
    3762            0 :                 continue;
    3763              :             }
    3764              : 
    3765            7 :             auto const &zone = state.dataHeatBal->Zone(itEq.ZonePtr);
    3766            7 :             print(state.files.eio,
    3767              :                   Format_722,
    3768              :                   "ElectricEquipment:ITE:AirCooled",
    3769            7 :                   itEq.Name,
    3770            7 :                   itEq.operSched->Name,
    3771            7 :                   zone.Name,
    3772            7 :                   zone.FloorArea,
    3773            7 :                   zone.TotOccupants);
    3774              : 
    3775            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower);
    3776              : 
    3777            7 :             print_and_divide_if_greater_than_zero(itEq.DesignTotalPower, zone.FloorArea);
    3778            7 :             print_and_divide_if_greater_than_zero(itEq.DesignTotalPower, zone.TotOccupants);
    3779              : 
    3780              :             // ElectricEquipment:ITE:AirCooled is 100% convective
    3781            7 :             print(state.files.eio, "1.0,");
    3782              : 
    3783            7 :             print(state.files.eio, "{},", itEq.EndUseSubcategoryCPU);
    3784            7 :             print(state.files.eio, "{},", itEq.EndUseSubcategoryFan);
    3785            7 :             print(state.files.eio, "{},", itEq.EndUseSubcategoryUPS);
    3786            7 :             print(state.files.eio, "{:.3R},", itEq.NomMinDesignLevel);
    3787            7 :             print(state.files.eio, "{:.3R},", itEq.NomMaxDesignLevel);
    3788              : 
    3789              :             Real64 SchMin, SchMax;
    3790              :             // weekdays
    3791            7 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3792            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3793            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3794              : 
    3795              :             // weekends/holidays
    3796            7 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3797            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3798            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3799              : 
    3800              :             // summer design days
    3801            7 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3802            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3803            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3804              : 
    3805              :             // winter design days
    3806            7 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3807            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3808            7 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3809              : 
    3810            7 :             print(state.files.eio, "{:.10R}\n", itEq.DesignAirVolFlowRate);
    3811              :         }
    3812              : 
    3813          804 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) {
    3814            3 :             auto &bbHeat = state.dataHeatBal->ZoneBBHeat(Loop);
    3815            3 :             if (Loop == 1) {
    3816            3 :                 print(state.files.eio,
    3817              :                       Format_723,
    3818              :                       "Outdoor Controlled Baseboard Heat",
    3819              :                       "Capacity at Low Temperature {W},Low Temperature {C},Capacity at High Temperature "
    3820              :                       "{W},High Temperature {C},Fraction Radiant,Fraction Convected,End-Use Subcategory\n");
    3821              :             }
    3822              : 
    3823            3 :             if (bbHeat.ZonePtr == 0) {
    3824            0 :                 print(state.files.eio, Format_724, "Outdoor Controlled Baseboard Heat-Illegal Zone specified", bbHeat.Name);
    3825            0 :                 continue;
    3826              :             }
    3827              : 
    3828            3 :             auto const &zone = state.dataHeatBal->Zone(bbHeat.ZonePtr);
    3829              : 
    3830            3 :             print(state.files.eio,
    3831              :                   Format_722,
    3832              :                   "Outdoor Controlled Baseboard Heat",
    3833            3 :                   bbHeat.Name,
    3834            3 :                   bbHeat.sched->Name,
    3835            3 :                   zone.Name,
    3836            3 :                   zone.FloorArea,
    3837            3 :                   zone.TotOccupants);
    3838              : 
    3839            3 :             print(state.files.eio, "{:.3R},", bbHeat.CapatLowTemperature);
    3840            3 :             print(state.files.eio, "{:.3R},", bbHeat.LowTemperature);
    3841            3 :             print(state.files.eio, "{:.3R},", bbHeat.CapatHighTemperature);
    3842            3 :             print(state.files.eio, "{:.3R},", bbHeat.HighTemperature);
    3843            3 :             print(state.files.eio, "{:.3R},", bbHeat.FractionRadiant);
    3844            3 :             print(state.files.eio, "{:.3R},", bbHeat.FractionConvected);
    3845            3 :             print(state.files.eio, "{}\n", bbHeat.EndUseSubcategory);
    3846              :         }
    3847          801 :     }
    3848              : 
    3849        12816 :     void setupIHGZonesAndSpaces(EnergyPlusData &state,
    3850              :                                 const std::string &objectType,
    3851              :                                 EPVector<InternalHeatGains::GlobalInternalGainMiscObject> &inputObjects,
    3852              :                                 int &numInputObjects,
    3853              :                                 int &numGainInstances,
    3854              :                                 bool &errors,
    3855              :                                 const bool zoneListNotAllowed)
    3856              :     {
    3857              :         // This function pre-processes the input objects for objectType and determines the ultimate number
    3858              :         // of simulation instances for each input object after expansion for SpaceList, Zone, or ZoneList.
    3859              :         // inputObjects is allocated here and filled with data for further input processing.
    3860              : 
    3861        12816 :         constexpr std::string_view routineName = "setupIHGZonesAndSpaces: ";
    3862              : 
    3863        12816 :         auto &ip = state.dataInputProcessing->inputProcessor;
    3864        12816 :         auto const instances = ip->epJSON.find(objectType);
    3865        12816 :         if (instances != ip->epJSON.end()) {
    3866        12816 :             bool localErrFlag = false;
    3867        12816 :             auto const &objectSchemaProps = ip->getObjectSchemaProps(state, objectType);
    3868        12816 :             auto &instancesValue = instances.value();
    3869        12816 :             numInputObjects = int(instancesValue.size());
    3870        12816 :             inputObjects.allocate(numInputObjects);
    3871              : 
    3872        12816 :             numGainInstances = 0;
    3873        12816 :             int counter = 0;
    3874        29766 :             for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
    3875        16950 :                 auto const &objectFields = instance.value();
    3876        16950 :                 std::string const &thisObjectName = Util::makeUPPER(instance.key());
    3877        16950 :                 ip->markObjectAsUsed(objectType, instance.key());
    3878              : 
    3879              :                 // For incoming idf, maintain object order
    3880        16950 :                 ++counter;
    3881        16950 :                 int objNum = ip->getIDFObjNum(state, objectType, counter);
    3882        16950 :                 inputObjects(objNum).Name = thisObjectName;
    3883        16950 :                 std::string areaFieldName;
    3884        16950 :                 if (zoneListNotAllowed) {
    3885          209 :                     areaFieldName = "zone_or_space_name";
    3886              :                 } else {
    3887        16741 :                     areaFieldName = "zone_or_zonelist_or_space_or_spacelist_name";
    3888              :                 }
    3889        16950 :                 std::string areaName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, areaFieldName);
    3890              : 
    3891        16950 :                 int zoneNum = Util::FindItemInList(areaName, state.dataHeatBal->Zone);
    3892        16950 :                 if (zoneNum > 0) {
    3893        16846 :                     inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3894        16846 :                     int numSpaces = state.dataHeatBal->Zone(zoneNum).numSpaces;
    3895        16846 :                     numGainInstances += numSpaces;
    3896        16846 :                     inputObjects(objNum).numOfSpaces = numSpaces;
    3897        16846 :                     inputObjects(objNum).ZoneListActive = false;
    3898        16846 :                     if (numSpaces == 1) {
    3899        16831 :                         inputObjects(objNum).spaceNums.emplace_back(state.dataHeatBal->Zone(zoneNum).spaceIndexes(1));
    3900        16831 :                         inputObjects(objNum).names.emplace_back(inputObjects(objNum).Name);
    3901              :                     } else {
    3902           60 :                         for (int const spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    3903           45 :                             inputObjects(objNum).spaceNums.emplace_back(spaceNum);
    3904           45 :                             inputObjects(objNum).names.emplace_back(state.dataHeatBal->space(spaceNum).Name + ' ' + inputObjects(objNum).Name);
    3905           15 :                         }
    3906              :                     }
    3907        16846 :                     continue;
    3908        16846 :                 }
    3909          104 :                 int spaceNum = Util::FindItemInList(areaName, state.dataHeatBal->space);
    3910          104 :                 if (spaceNum > 0) {
    3911           61 :                     inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3912           61 :                     ++numGainInstances;
    3913           61 :                     inputObjects(objNum).numOfSpaces = 1;
    3914           61 :                     inputObjects(objNum).spaceListActive = false;
    3915           61 :                     inputObjects(objNum).spaceOrSpaceListPtr = spaceNum;
    3916           61 :                     inputObjects(objNum).spaceNums.emplace_back(spaceNum);
    3917           61 :                     inputObjects(objNum).names.emplace_back(inputObjects(objNum).Name);
    3918           61 :                     continue;
    3919              :                 }
    3920           43 :                 int zoneListNum = Util::FindItemInList(areaName, state.dataHeatBal->ZoneList);
    3921           43 :                 if (zoneListNum > 0) {
    3922           39 :                     if (zoneListNotAllowed) {
    3923            0 :                         ShowSevereError(
    3924            0 :                             state, format("{}=\"{}\" ZoneList Name=\"{}\" not allowed for {}.", objectType, thisObjectName, areaName, objectType));
    3925            0 :                         errors = true;
    3926            0 :                         localErrFlag = true;
    3927              :                     } else {
    3928              : 
    3929           39 :                         inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3930           39 :                         int numSpaces = 0;
    3931          422 :                         for (int const listZoneIdx : state.dataHeatBal->ZoneList(zoneListNum).Zone) {
    3932          383 :                             numSpaces += state.dataHeatBal->Zone(listZoneIdx).numSpaces;
    3933          778 :                             for (int const spaceNum2 : state.dataHeatBal->Zone(listZoneIdx).spaceIndexes) {
    3934          395 :                                 inputObjects(objNum).spaceNums.emplace_back(spaceNum2);
    3935          395 :                                 inputObjects(objNum).names.emplace_back(state.dataHeatBal->space(spaceNum2).Name + ' ' + inputObjects(objNum).Name);
    3936          383 :                             }
    3937              :                         }
    3938           39 :                         numGainInstances += numSpaces;
    3939           39 :                         inputObjects(objNum).numOfSpaces = numSpaces;
    3940           39 :                         inputObjects(objNum).ZoneListActive = true;
    3941              :                     }
    3942           39 :                     continue;
    3943           39 :                 }
    3944            4 :                 int spaceListNum = Util::FindItemInList(areaName, state.dataHeatBal->spaceList);
    3945            4 :                 if (spaceListNum > 0) {
    3946            4 :                     if (zoneListNotAllowed) {
    3947            0 :                         ShowSevereError(
    3948            0 :                             state, format("{}=\"{}\" SpaceList Name=\"{}\" not allowed for {}.", objectType, thisObjectName, areaName, objectType));
    3949            0 :                         errors = true;
    3950            0 :                         localErrFlag = true;
    3951              :                     } else {
    3952            4 :                         inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3953            4 :                         int numSpaces = state.dataHeatBal->spaceList(spaceListNum).numListSpaces;
    3954            4 :                         numGainInstances += numSpaces;
    3955            4 :                         inputObjects(objNum).numOfSpaces = numSpaces;
    3956            4 :                         inputObjects(objNum).spaceListActive = true;
    3957            4 :                         inputObjects(objNum).spaceOrSpaceListPtr = spaceListNum;
    3958           29 :                         for (int const spaceNum2 : state.dataHeatBal->spaceList(spaceListNum).spaces) {
    3959           25 :                             inputObjects(objNum).spaceNums.emplace_back(spaceNum2);
    3960           25 :                             inputObjects(objNum).names.emplace_back(state.dataHeatBal->space(spaceNum2).Name + ' ' + inputObjects(objNum).Name);
    3961            4 :                         }
    3962              :                     }
    3963            4 :                     continue;
    3964            4 :                 }
    3965            0 :                 ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", objectType, thisObjectName, areaFieldName, areaName));
    3966            0 :                 errors = true;
    3967            0 :                 localErrFlag = true;
    3968        63666 :             }
    3969        12816 :             if (localErrFlag) {
    3970            0 :                 ShowSevereError(state, format("{}Errors with invalid names in {} objects.", routineName, objectType));
    3971            0 :                 ShowContinueError(state, "...These will not be read in.  Other errors may occur.");
    3972            0 :                 numGainInstances = 0;
    3973              :             }
    3974              :         }
    3975        12816 :     }
    3976              : 
    3977          801 :     void setupIHGOutputs(EnergyPlusData &state)
    3978              :     {
    3979         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    3980              :             // Overall Zone Variables
    3981        10402 :             SetupOutputVariable(state,
    3982              :                                 "Zone Total Internal Radiant Heating Energy",
    3983              :                                 Constant::Units::J,
    3984         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotRadiantGain,
    3985              :                                 OutputProcessor::TimeStepType::Zone,
    3986              :                                 OutputProcessor::StoreType::Sum,
    3987         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    3988        10402 :             SetupOutputVariable(state,
    3989              :                                 "Zone Total Internal Radiant Heating Rate",
    3990              :                                 Constant::Units::W,
    3991         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotRadiantGainRate,
    3992              :                                 OutputProcessor::TimeStepType::Zone,
    3993              :                                 OutputProcessor::StoreType::Average,
    3994         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    3995        10402 :             SetupOutputVariable(state,
    3996              :                                 "Zone Total Internal Visible Radiation Heating Energy",
    3997              :                                 Constant::Units::J,
    3998         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotVisHeatGain,
    3999              :                                 OutputProcessor::TimeStepType::Zone,
    4000              :                                 OutputProcessor::StoreType::Sum,
    4001         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4002        10402 :             SetupOutputVariable(state,
    4003              :                                 "Zone Total Internal Visible Radiation Heating Rate",
    4004              :                                 Constant::Units::W,
    4005         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotVisHeatGainRate,
    4006              :                                 OutputProcessor::TimeStepType::Zone,
    4007              :                                 OutputProcessor::StoreType::Average,
    4008         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4009        10402 :             SetupOutputVariable(state,
    4010              :                                 "Zone Total Internal Convective Heating Energy",
    4011              :                                 Constant::Units::J,
    4012         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotConvectiveGain,
    4013              :                                 OutputProcessor::TimeStepType::Zone,
    4014              :                                 OutputProcessor::StoreType::Sum,
    4015         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4016        10402 :             SetupOutputVariable(state,
    4017              :                                 "Zone Total Internal Convective Heating Rate",
    4018              :                                 Constant::Units::W,
    4019         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotConvectiveGainRate,
    4020              :                                 OutputProcessor::TimeStepType::Zone,
    4021              :                                 OutputProcessor::StoreType::Average,
    4022         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4023        10402 :             SetupOutputVariable(state,
    4024              :                                 "Zone Total Internal Latent Gain Energy",
    4025              :                                 Constant::Units::J,
    4026         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotLatentGain,
    4027              :                                 OutputProcessor::TimeStepType::Zone,
    4028              :                                 OutputProcessor::StoreType::Sum,
    4029         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4030        10402 :             SetupOutputVariable(state,
    4031              :                                 "Zone Total Internal Latent Gain Rate",
    4032              :                                 Constant::Units::W,
    4033         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotLatentGainRate,
    4034              :                                 OutputProcessor::TimeStepType::Zone,
    4035              :                                 OutputProcessor::StoreType::Average,
    4036         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4037        10402 :             SetupOutputVariable(state,
    4038              :                                 "Zone Total Internal Total Heating Energy",
    4039              :                                 Constant::Units::J,
    4040         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotTotalHeatGain,
    4041              :                                 OutputProcessor::TimeStepType::Zone,
    4042              :                                 OutputProcessor::StoreType::Sum,
    4043         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4044        10402 :             SetupOutputVariable(state,
    4045              :                                 "Zone Total Internal Total Heating Rate",
    4046              :                                 Constant::Units::W,
    4047         5201 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotTotalHeatGainRate,
    4048              :                                 OutputProcessor::TimeStepType::Zone,
    4049              :                                 OutputProcessor::StoreType::Average,
    4050         5201 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4051              :         }
    4052              : 
    4053         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4054              :             // Overall Space Variables
    4055        10426 :             SetupOutputVariable(state,
    4056              :                                 "Space Total Internal Radiant Heating Energy",
    4057              :                                 Constant::Units::J,
    4058         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotRadiantGain,
    4059              :                                 OutputProcessor::TimeStepType::Zone,
    4060              :                                 OutputProcessor::StoreType::Sum,
    4061         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4062        10426 :             SetupOutputVariable(state,
    4063              :                                 "Space Total Internal Radiant Heating Rate",
    4064              :                                 Constant::Units::W,
    4065         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotRadiantGainRate,
    4066              :                                 OutputProcessor::TimeStepType::Zone,
    4067              :                                 OutputProcessor::StoreType::Average,
    4068         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4069        10426 :             SetupOutputVariable(state,
    4070              :                                 "Space Total Internal Visible Radiation Heating Energy",
    4071              :                                 Constant::Units::J,
    4072         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotVisHeatGain,
    4073              :                                 OutputProcessor::TimeStepType::Zone,
    4074              :                                 OutputProcessor::StoreType::Sum,
    4075         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4076        10426 :             SetupOutputVariable(state,
    4077              :                                 "Space Total Internal Visible Radiation Heating Rate",
    4078              :                                 Constant::Units::W,
    4079         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotVisHeatGainRate,
    4080              :                                 OutputProcessor::TimeStepType::Zone,
    4081              :                                 OutputProcessor::StoreType::Average,
    4082         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4083        10426 :             SetupOutputVariable(state,
    4084              :                                 "Space Total Internal Convective Heating Energy",
    4085              :                                 Constant::Units::J,
    4086         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotConvectiveGain,
    4087              :                                 OutputProcessor::TimeStepType::Zone,
    4088              :                                 OutputProcessor::StoreType::Sum,
    4089         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4090        10426 :             SetupOutputVariable(state,
    4091              :                                 "Space Total Internal Convective Heating Rate",
    4092              :                                 Constant::Units::W,
    4093         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotConvectiveGainRate,
    4094              :                                 OutputProcessor::TimeStepType::Zone,
    4095              :                                 OutputProcessor::StoreType::Average,
    4096         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4097        10426 :             SetupOutputVariable(state,
    4098              :                                 "Space Total Internal Latent Gain Energy",
    4099              :                                 Constant::Units::J,
    4100         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotLatentGain,
    4101              :                                 OutputProcessor::TimeStepType::Zone,
    4102              :                                 OutputProcessor::StoreType::Sum,
    4103         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4104        10426 :             SetupOutputVariable(state,
    4105              :                                 "Space Total Internal Latent Gain Rate",
    4106              :                                 Constant::Units::W,
    4107         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotLatentGainRate,
    4108              :                                 OutputProcessor::TimeStepType::Zone,
    4109              :                                 OutputProcessor::StoreType::Average,
    4110         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4111        10426 :             SetupOutputVariable(state,
    4112              :                                 "Space Total Internal Total Heating Energy",
    4113              :                                 Constant::Units::J,
    4114         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotTotalHeatGain,
    4115              :                                 OutputProcessor::TimeStepType::Zone,
    4116              :                                 OutputProcessor::StoreType::Sum,
    4117         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4118        10426 :             SetupOutputVariable(state,
    4119              :                                 "Space Total Internal Total Heating Rate",
    4120              :                                 Constant::Units::W,
    4121         5213 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotTotalHeatGainRate,
    4122              :                                 OutputProcessor::TimeStepType::Zone,
    4123              :                                 OutputProcessor::StoreType::Average,
    4124         5213 :                                 state.dataHeatBal->space(spaceNum).Name);
    4125              :         }
    4126              : 
    4127              :         // Add zone and space outputs only where the particular type of equipment is actually present
    4128          801 :         Array1D_bool addZoneOutputs;
    4129          801 :         addZoneOutputs.dimension(state.dataGlobal->NumOfZones, false);
    4130          801 :         Array1D_bool addSpaceOutputs;
    4131          801 :         addSpaceOutputs.dimension(state.dataGlobal->numSpaces, false);
    4132              : 
    4133         5039 :         for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) {
    4134              :             // Set flags for zone and space total report variables
    4135         4238 :             addZoneOutputs(state.dataHeatBal->People(peopleNum).ZonePtr) = true;
    4136         4238 :             addSpaceOutputs(state.dataHeatBal->People(peopleNum).spaceIndex) = true;
    4137              :             // Object report variables
    4138         8476 :             SetupOutputVariable(state,
    4139              :                                 "People Occupant Count",
    4140              :                                 Constant::Units::None,
    4141         4238 :                                 state.dataHeatBal->People(peopleNum).NumOcc,
    4142              :                                 OutputProcessor::TimeStepType::Zone,
    4143              :                                 OutputProcessor::StoreType::Average,
    4144         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4145         8476 :             SetupOutputVariable(state,
    4146              :                                 "People Radiant Heating Energy",
    4147              :                                 Constant::Units::J,
    4148         4238 :                                 state.dataHeatBal->People(peopleNum).RadGainEnergy,
    4149              :                                 OutputProcessor::TimeStepType::Zone,
    4150              :                                 OutputProcessor::StoreType::Sum,
    4151         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4152         8476 :             SetupOutputVariable(state,
    4153              :                                 "People Radiant Heating Rate",
    4154              :                                 Constant::Units::W,
    4155         4238 :                                 state.dataHeatBal->People(peopleNum).RadGainRate,
    4156              :                                 OutputProcessor::TimeStepType::Zone,
    4157              :                                 OutputProcessor::StoreType::Average,
    4158         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4159         8476 :             SetupOutputVariable(state,
    4160              :                                 "People Convective Heating Energy",
    4161              :                                 Constant::Units::J,
    4162         4238 :                                 state.dataHeatBal->People(peopleNum).ConGainEnergy,
    4163              :                                 OutputProcessor::TimeStepType::Zone,
    4164              :                                 OutputProcessor::StoreType::Sum,
    4165         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4166         8476 :             SetupOutputVariable(state,
    4167              :                                 "People Convective Heating Rate",
    4168              :                                 Constant::Units::W,
    4169         4238 :                                 state.dataHeatBal->People(peopleNum).ConGainRate,
    4170              :                                 OutputProcessor::TimeStepType::Zone,
    4171              :                                 OutputProcessor::StoreType::Average,
    4172         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4173         8476 :             SetupOutputVariable(state,
    4174              :                                 "People Sensible Heating Energy",
    4175              :                                 Constant::Units::J,
    4176         4238 :                                 state.dataHeatBal->People(peopleNum).SenGainEnergy,
    4177              :                                 OutputProcessor::TimeStepType::Zone,
    4178              :                                 OutputProcessor::StoreType::Sum,
    4179         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4180         8476 :             SetupOutputVariable(state,
    4181              :                                 "People Sensible Heating Rate",
    4182              :                                 Constant::Units::W,
    4183         4238 :                                 state.dataHeatBal->People(peopleNum).SenGainRate,
    4184              :                                 OutputProcessor::TimeStepType::Zone,
    4185              :                                 OutputProcessor::StoreType::Average,
    4186         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4187         8476 :             SetupOutputVariable(state,
    4188              :                                 "People Latent Gain Energy",
    4189              :                                 Constant::Units::J,
    4190         4238 :                                 state.dataHeatBal->People(peopleNum).LatGainEnergy,
    4191              :                                 OutputProcessor::TimeStepType::Zone,
    4192              :                                 OutputProcessor::StoreType::Sum,
    4193         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4194         8476 :             SetupOutputVariable(state,
    4195              :                                 "People Latent Gain Rate",
    4196              :                                 Constant::Units::W,
    4197         4238 :                                 state.dataHeatBal->People(peopleNum).LatGainRate,
    4198              :                                 OutputProcessor::TimeStepType::Zone,
    4199              :                                 OutputProcessor::StoreType::Average,
    4200         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4201         8476 :             SetupOutputVariable(state,
    4202              :                                 "People Total Heating Energy",
    4203              :                                 Constant::Units::J,
    4204         4238 :                                 state.dataHeatBal->People(peopleNum).TotGainEnergy,
    4205              :                                 OutputProcessor::TimeStepType::Zone,
    4206              :                                 OutputProcessor::StoreType::Sum,
    4207         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4208         8476 :             SetupOutputVariable(state,
    4209              :                                 "People Total Heating Rate",
    4210              :                                 Constant::Units::W,
    4211         4238 :                                 state.dataHeatBal->People(peopleNum).TotGainRate,
    4212              :                                 OutputProcessor::TimeStepType::Zone,
    4213              :                                 OutputProcessor::StoreType::Average,
    4214         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4215         8476 :             SetupOutputVariable(state,
    4216              :                                 "People Air Temperature",
    4217              :                                 Constant::Units::C,
    4218         4238 :                                 state.dataHeatBal->People(peopleNum).TemperatureInZone,
    4219              :                                 OutputProcessor::TimeStepType::Zone,
    4220              :                                 OutputProcessor::StoreType::Average,
    4221         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4222         8476 :             SetupOutputVariable(state,
    4223              :                                 "People Air Relative Humidity",
    4224              :                                 Constant::Units::Perc,
    4225         4238 :                                 state.dataHeatBal->People(peopleNum).RelativeHumidityInZone,
    4226              :                                 OutputProcessor::TimeStepType::Zone,
    4227              :                                 OutputProcessor::StoreType::Average,
    4228         4238 :                                 state.dataHeatBal->People(peopleNum).Name);
    4229              :         }
    4230              : 
    4231         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    4232         5201 :             if (addZoneOutputs(zoneNum)) {
    4233              :                 // Zone total report variables
    4234         8386 :                 SetupOutputVariable(state,
    4235              :                                     "Zone People Occupant Count",
    4236              :                                     Constant::Units::None,
    4237         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleNumOcc,
    4238              :                                     OutputProcessor::TimeStepType::Zone,
    4239              :                                     OutputProcessor::StoreType::Average,
    4240         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4241         8386 :                 SetupOutputVariable(state,
    4242              :                                     "Zone People Radiant Heating Energy",
    4243              :                                     Constant::Units::J,
    4244         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleRadGain,
    4245              :                                     OutputProcessor::TimeStepType::Zone,
    4246              :                                     OutputProcessor::StoreType::Sum,
    4247         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4248         8386 :                 SetupOutputVariable(state,
    4249              :                                     "Zone People Radiant Heating Rate",
    4250              :                                     Constant::Units::W,
    4251         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleRadGainRate,
    4252              :                                     OutputProcessor::TimeStepType::Zone,
    4253              :                                     OutputProcessor::StoreType::Average,
    4254         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4255         8386 :                 SetupOutputVariable(state,
    4256              :                                     "Zone People Convective Heating Energy",
    4257              :                                     Constant::Units::J,
    4258         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleConGain,
    4259              :                                     OutputProcessor::TimeStepType::Zone,
    4260              :                                     OutputProcessor::StoreType::Sum,
    4261         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4262         8386 :                 SetupOutputVariable(state,
    4263              :                                     "Zone People Convective Heating Rate",
    4264              :                                     Constant::Units::W,
    4265         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleConGainRate,
    4266              :                                     OutputProcessor::TimeStepType::Zone,
    4267              :                                     OutputProcessor::StoreType::Average,
    4268         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4269         8386 :                 SetupOutputVariable(state,
    4270              :                                     "Zone People Sensible Heating Energy",
    4271              :                                     Constant::Units::J,
    4272         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleSenGain,
    4273              :                                     OutputProcessor::TimeStepType::Zone,
    4274              :                                     OutputProcessor::StoreType::Sum,
    4275         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4276         8386 :                 SetupOutputVariable(state,
    4277              :                                     "Zone People Sensible Heating Rate",
    4278              :                                     Constant::Units::W,
    4279         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleSenGainRate,
    4280              :                                     OutputProcessor::TimeStepType::Zone,
    4281              :                                     OutputProcessor::StoreType::Average,
    4282         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4283         8386 :                 SetupOutputVariable(state,
    4284              :                                     "Zone People Latent Gain Energy",
    4285              :                                     Constant::Units::J,
    4286         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleLatGain,
    4287              :                                     OutputProcessor::TimeStepType::Zone,
    4288              :                                     OutputProcessor::StoreType::Sum,
    4289         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4290         8386 :                 SetupOutputVariable(state,
    4291              :                                     "Zone People Latent Gain Rate",
    4292              :                                     Constant::Units::W,
    4293         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleLatGainRate,
    4294              :                                     OutputProcessor::TimeStepType::Zone,
    4295              :                                     OutputProcessor::StoreType::Average,
    4296         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4297         8386 :                 SetupOutputVariable(state,
    4298              :                                     "Zone People Total Heating Energy",
    4299              :                                     Constant::Units::J,
    4300         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleTotGain,
    4301              :                                     OutputProcessor::TimeStepType::Zone,
    4302              :                                     OutputProcessor::StoreType::Sum,
    4303         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4304         8386 :                 SetupOutputVariable(state,
    4305              :                                     "Zone People Total Heating Rate",
    4306              :                                     Constant::Units::W,
    4307         4193 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleTotGainRate,
    4308              :                                     OutputProcessor::TimeStepType::Zone,
    4309              :                                     OutputProcessor::StoreType::Average,
    4310         4193 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4311              :             }
    4312              :             // Reset zone output flag
    4313         5201 :             addZoneOutputs(zoneNum) = false;
    4314              :         }
    4315              : 
    4316              :         // Space total report variables
    4317         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4318         5213 :             if (addSpaceOutputs(spaceNum)) {
    4319         8410 :                 SetupOutputVariable(state,
    4320              :                                     "Space People Occupant Count",
    4321              :                                     Constant::Units::None,
    4322         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleNumOcc,
    4323              :                                     OutputProcessor::TimeStepType::Zone,
    4324              :                                     OutputProcessor::StoreType::Average,
    4325         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4326         8410 :                 SetupOutputVariable(state,
    4327              :                                     "Space People Radiant Heating Energy",
    4328              :                                     Constant::Units::J,
    4329         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleRadGain,
    4330              :                                     OutputProcessor::TimeStepType::Zone,
    4331              :                                     OutputProcessor::StoreType::Sum,
    4332         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4333         8410 :                 SetupOutputVariable(state,
    4334              :                                     "Space People Radiant Heating Rate",
    4335              :                                     Constant::Units::W,
    4336         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleRadGainRate,
    4337              :                                     OutputProcessor::TimeStepType::Zone,
    4338              :                                     OutputProcessor::StoreType::Average,
    4339         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4340         8410 :                 SetupOutputVariable(state,
    4341              :                                     "Space People Convective Heating Energy",
    4342              :                                     Constant::Units::J,
    4343         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleConGain,
    4344              :                                     OutputProcessor::TimeStepType::Zone,
    4345              :                                     OutputProcessor::StoreType::Sum,
    4346         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4347         8410 :                 SetupOutputVariable(state,
    4348              :                                     "Space People Convective Heating Rate",
    4349              :                                     Constant::Units::W,
    4350         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleConGainRate,
    4351              :                                     OutputProcessor::TimeStepType::Zone,
    4352              :                                     OutputProcessor::StoreType::Average,
    4353         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4354         8410 :                 SetupOutputVariable(state,
    4355              :                                     "Space People Sensible Heating Energy",
    4356              :                                     Constant::Units::J,
    4357         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleSenGain,
    4358              :                                     OutputProcessor::TimeStepType::Zone,
    4359              :                                     OutputProcessor::StoreType::Sum,
    4360         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4361         8410 :                 SetupOutputVariable(state,
    4362              :                                     "Space People Sensible Heating Rate",
    4363              :                                     Constant::Units::W,
    4364         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleSenGainRate,
    4365              :                                     OutputProcessor::TimeStepType::Zone,
    4366              :                                     OutputProcessor::StoreType::Average,
    4367         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4368         8410 :                 SetupOutputVariable(state,
    4369              :                                     "Space People Latent Gain Energy",
    4370              :                                     Constant::Units::J,
    4371         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleLatGain,
    4372              :                                     OutputProcessor::TimeStepType::Zone,
    4373              :                                     OutputProcessor::StoreType::Sum,
    4374         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4375         8410 :                 SetupOutputVariable(state,
    4376              :                                     "Space People Latent Gain Rate",
    4377              :                                     Constant::Units::W,
    4378         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleLatGainRate,
    4379              :                                     OutputProcessor::TimeStepType::Zone,
    4380              :                                     OutputProcessor::StoreType::Average,
    4381         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4382         8410 :                 SetupOutputVariable(state,
    4383              :                                     "Space People Total Heating Energy",
    4384              :                                     Constant::Units::J,
    4385         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleTotGain,
    4386              :                                     OutputProcessor::TimeStepType::Zone,
    4387              :                                     OutputProcessor::StoreType::Sum,
    4388         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4389         8410 :                 SetupOutputVariable(state,
    4390              :                                     "Space People Total Heating Rate",
    4391              :                                     Constant::Units::W,
    4392         4205 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleTotGainRate,
    4393              :                                     OutputProcessor::TimeStepType::Zone,
    4394              :                                     OutputProcessor::StoreType::Average,
    4395         4205 :                                     state.dataHeatBal->space(spaceNum).Name);
    4396              :             }
    4397              :             // Reset space output flag
    4398         5213 :             addSpaceOutputs(spaceNum) = false;
    4399              :         }
    4400              : 
    4401         5272 :         for (int lightsNum = 1; lightsNum <= state.dataHeatBal->TotLights; ++lightsNum) {
    4402              :             // Set flags for zone and space total report variables
    4403         4471 :             addZoneOutputs(state.dataHeatBal->Lights(lightsNum).ZonePtr) = true;
    4404         4471 :             addSpaceOutputs(state.dataHeatBal->Lights(lightsNum).spaceIndex) = true;
    4405              :             // Object report variables
    4406         8942 :             SetupOutputVariable(state,
    4407              :                                 "Lights Electricity Rate",
    4408              :                                 Constant::Units::W,
    4409         4471 :                                 state.dataHeatBal->Lights(lightsNum).Power,
    4410              :                                 OutputProcessor::TimeStepType::Zone,
    4411              :                                 OutputProcessor::StoreType::Average,
    4412         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4413              : 
    4414         8942 :             SetupOutputVariable(state,
    4415              :                                 "Lights Radiant Heating Energy",
    4416              :                                 Constant::Units::J,
    4417         4471 :                                 state.dataHeatBal->Lights(lightsNum).RadGainEnergy,
    4418              :                                 OutputProcessor::TimeStepType::Zone,
    4419              :                                 OutputProcessor::StoreType::Sum,
    4420         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4421         8942 :             SetupOutputVariable(state,
    4422              :                                 "Lights Radiant Heating Rate",
    4423              :                                 Constant::Units::W,
    4424         4471 :                                 state.dataHeatBal->Lights(lightsNum).RadGainRate,
    4425              :                                 OutputProcessor::TimeStepType::Zone,
    4426              :                                 OutputProcessor::StoreType::Average,
    4427         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4428         8942 :             SetupOutputVariable(state,
    4429              :                                 "Lights Visible Radiation Heating Energy",
    4430              :                                 Constant::Units::J,
    4431         4471 :                                 state.dataHeatBal->Lights(lightsNum).VisGainEnergy,
    4432              :                                 OutputProcessor::TimeStepType::Zone,
    4433              :                                 OutputProcessor::StoreType::Sum,
    4434         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4435              : 
    4436         8942 :             SetupOutputVariable(state,
    4437              :                                 "Lights Visible Radiation Heating Rate",
    4438              :                                 Constant::Units::W,
    4439         4471 :                                 state.dataHeatBal->Lights(lightsNum).VisGainRate,
    4440              :                                 OutputProcessor::TimeStepType::Zone,
    4441              :                                 OutputProcessor::StoreType::Average,
    4442         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4443         8942 :             SetupOutputVariable(state,
    4444              :                                 "Lights Convective Heating Energy",
    4445              :                                 Constant::Units::J,
    4446         4471 :                                 state.dataHeatBal->Lights(lightsNum).ConGainEnergy,
    4447              :                                 OutputProcessor::TimeStepType::Zone,
    4448              :                                 OutputProcessor::StoreType::Sum,
    4449         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4450         8942 :             SetupOutputVariable(state,
    4451              :                                 "Lights Convective Heating Rate",
    4452              :                                 Constant::Units::W,
    4453         4471 :                                 state.dataHeatBal->Lights(lightsNum).ConGainRate,
    4454              :                                 OutputProcessor::TimeStepType::Zone,
    4455              :                                 OutputProcessor::StoreType::Average,
    4456         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4457         8942 :             SetupOutputVariable(state,
    4458              :                                 "Lights Return Air Heating Energy",
    4459              :                                 Constant::Units::J,
    4460         4471 :                                 state.dataHeatBal->Lights(lightsNum).RetAirGainEnergy,
    4461              :                                 OutputProcessor::TimeStepType::Zone,
    4462              :                                 OutputProcessor::StoreType::Sum,
    4463         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4464         8942 :             SetupOutputVariable(state,
    4465              :                                 "Lights Return Air Heating Rate",
    4466              :                                 Constant::Units::W,
    4467         4471 :                                 state.dataHeatBal->Lights(lightsNum).RetAirGainRate,
    4468              :                                 OutputProcessor::TimeStepType::Zone,
    4469              :                                 OutputProcessor::StoreType::Average,
    4470         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4471         8942 :             SetupOutputVariable(state,
    4472              :                                 "Lights Total Heating Energy",
    4473              :                                 Constant::Units::J,
    4474         4471 :                                 state.dataHeatBal->Lights(lightsNum).TotGainEnergy,
    4475              :                                 OutputProcessor::TimeStepType::Zone,
    4476              :                                 OutputProcessor::StoreType::Sum,
    4477         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4478         8942 :             SetupOutputVariable(state,
    4479              :                                 "Lights Total Heating Rate",
    4480              :                                 Constant::Units::W,
    4481         4471 :                                 state.dataHeatBal->Lights(lightsNum).TotGainRate,
    4482              :                                 OutputProcessor::TimeStepType::Zone,
    4483              :                                 OutputProcessor::StoreType::Average,
    4484         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4485         8942 :             SetupOutputVariable(state,
    4486              :                                 "Lights Electricity Energy",
    4487              :                                 Constant::Units::J,
    4488         4471 :                                 state.dataHeatBal->Lights(lightsNum).Consumption,
    4489              :                                 OutputProcessor::TimeStepType::Zone,
    4490              :                                 OutputProcessor::StoreType::Sum,
    4491         4471 :                                 state.dataHeatBal->Lights(lightsNum).Name,
    4492              :                                 Constant::eResource::Electricity,
    4493              :                                 OutputProcessor::Group::Building,
    4494              :                                 OutputProcessor::EndUseCat::InteriorLights,
    4495         4471 :                                 state.dataHeatBal->Lights(lightsNum).EndUseSubcategory,
    4496         4471 :                                 state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum).ZonePtr).Name,
    4497         4471 :                                 state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum).ZonePtr).Multiplier,
    4498         4471 :                                 state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum).ZonePtr).ListMultiplier,
    4499         4471 :                                 state.dataHeatBal->space(state.dataHeatBal->Lights(lightsNum).spaceIndex).spaceType);
    4500              :         }
    4501              : 
    4502              :         // Zone total report variables
    4503         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    4504         5201 :             if (addZoneOutputs(zoneNum)) {
    4505         8526 :                 SetupOutputVariable(state,
    4506              :                                     "Zone Lights Electricity Rate",
    4507              :                                     Constant::Units::W,
    4508         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsPower,
    4509              :                                     OutputProcessor::TimeStepType::Zone,
    4510              :                                     OutputProcessor::StoreType::Average,
    4511         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4512         8526 :                 SetupOutputVariable(state,
    4513              :                                     "Zone Lights Electricity Energy",
    4514              :                                     Constant::Units::J,
    4515         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsElecConsump,
    4516              :                                     OutputProcessor::TimeStepType::Zone,
    4517              :                                     OutputProcessor::StoreType::Sum,
    4518         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4519         8526 :                 SetupOutputVariable(state,
    4520              :                                     "Zone Lights Radiant Heating Energy",
    4521              :                                     Constant::Units::J,
    4522         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRadGain,
    4523              :                                     OutputProcessor::TimeStepType::Zone,
    4524              :                                     OutputProcessor::StoreType::Sum,
    4525         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4526         8526 :                 SetupOutputVariable(state,
    4527              :                                     "Zone Lights Radiant Heating Rate",
    4528              :                                     Constant::Units::W,
    4529         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRadGainRate,
    4530              :                                     OutputProcessor::TimeStepType::Zone,
    4531              :                                     OutputProcessor::StoreType::Average,
    4532         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4533         8526 :                 SetupOutputVariable(state,
    4534              :                                     "Zone Lights Visible Radiation Heating Energy",
    4535              :                                     Constant::Units::J,
    4536         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsVisGain,
    4537              :                                     OutputProcessor::TimeStepType::Zone,
    4538              :                                     OutputProcessor::StoreType::Sum,
    4539         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4540         8526 :                 SetupOutputVariable(state,
    4541              :                                     "Zone Lights Visible Radiation Heating Rate",
    4542              :                                     Constant::Units::W,
    4543         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsVisGainRate,
    4544              :                                     OutputProcessor::TimeStepType::Zone,
    4545              :                                     OutputProcessor::StoreType::Average,
    4546         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4547         8526 :                 SetupOutputVariable(state,
    4548              :                                     "Zone Lights Convective Heating Energy",
    4549              :                                     Constant::Units::J,
    4550         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsConGain,
    4551              :                                     OutputProcessor::TimeStepType::Zone,
    4552              :                                     OutputProcessor::StoreType::Sum,
    4553         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4554         8526 :                 SetupOutputVariable(state,
    4555              :                                     "Zone Lights Convective Heating Rate",
    4556              :                                     Constant::Units::W,
    4557         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsConGainRate,
    4558              :                                     OutputProcessor::TimeStepType::Zone,
    4559              :                                     OutputProcessor::StoreType::Average,
    4560         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4561         8526 :                 SetupOutputVariable(state,
    4562              :                                     "Zone Lights Return Air Heating Energy",
    4563              :                                     Constant::Units::J,
    4564         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRetAirGain,
    4565              :                                     OutputProcessor::TimeStepType::Zone,
    4566              :                                     OutputProcessor::StoreType::Sum,
    4567         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4568         8526 :                 SetupOutputVariable(state,
    4569              :                                     "Zone Lights Return Air Heating Rate",
    4570              :                                     Constant::Units::W,
    4571         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRetAirGainRate,
    4572              :                                     OutputProcessor::TimeStepType::Zone,
    4573              :                                     OutputProcessor::StoreType::Average,
    4574         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4575         8526 :                 SetupOutputVariable(state,
    4576              :                                     "Zone Lights Total Heating Energy",
    4577              :                                     Constant::Units::J,
    4578         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsTotGain,
    4579              :                                     OutputProcessor::TimeStepType::Zone,
    4580              :                                     OutputProcessor::StoreType::Sum,
    4581         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4582         8526 :                 SetupOutputVariable(state,
    4583              :                                     "Zone Lights Total Heating Rate",
    4584              :                                     Constant::Units::W,
    4585         4263 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsTotGainRate,
    4586              :                                     OutputProcessor::TimeStepType::Zone,
    4587              :                                     OutputProcessor::StoreType::Average,
    4588         4263 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4589              :             }
    4590              :             // Reset zone output flag
    4591         5201 :             addZoneOutputs(zoneNum) = false;
    4592              :         }
    4593              : 
    4594              :         // Space total report variables
    4595         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4596         5213 :             if (addSpaceOutputs(spaceNum)) {
    4597         8550 :                 SetupOutputVariable(state,
    4598              :                                     "Space Lights Electricity Rate",
    4599              :                                     Constant::Units::W,
    4600         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsPower,
    4601              :                                     OutputProcessor::TimeStepType::Zone,
    4602              :                                     OutputProcessor::StoreType::Average,
    4603         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4604         8550 :                 SetupOutputVariable(state,
    4605              :                                     "Space Lights Electricity Energy",
    4606              :                                     Constant::Units::J,
    4607         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsElecConsump,
    4608              :                                     OutputProcessor::TimeStepType::Zone,
    4609              :                                     OutputProcessor::StoreType::Sum,
    4610         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4611         8550 :                 SetupOutputVariable(state,
    4612              :                                     "Space Lights Radiant Heating Energy",
    4613              :                                     Constant::Units::J,
    4614         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRadGain,
    4615              :                                     OutputProcessor::TimeStepType::Zone,
    4616              :                                     OutputProcessor::StoreType::Sum,
    4617         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4618         8550 :                 SetupOutputVariable(state,
    4619              :                                     "Space Lights Radiant Heating Rate",
    4620              :                                     Constant::Units::W,
    4621         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRadGainRate,
    4622              :                                     OutputProcessor::TimeStepType::Zone,
    4623              :                                     OutputProcessor::StoreType::Average,
    4624         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4625         8550 :                 SetupOutputVariable(state,
    4626              :                                     "Space Lights Visible Radiation Heating Energy",
    4627              :                                     Constant::Units::J,
    4628         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsVisGain,
    4629              :                                     OutputProcessor::TimeStepType::Zone,
    4630              :                                     OutputProcessor::StoreType::Sum,
    4631         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4632         8550 :                 SetupOutputVariable(state,
    4633              :                                     "Space Lights Visible Radiation Heating Rate",
    4634              :                                     Constant::Units::W,
    4635         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsVisGainRate,
    4636              :                                     OutputProcessor::TimeStepType::Zone,
    4637              :                                     OutputProcessor::StoreType::Average,
    4638         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4639         8550 :                 SetupOutputVariable(state,
    4640              :                                     "Space Lights Convective Heating Energy",
    4641              :                                     Constant::Units::J,
    4642         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsConGain,
    4643              :                                     OutputProcessor::TimeStepType::Zone,
    4644              :                                     OutputProcessor::StoreType::Sum,
    4645         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4646         8550 :                 SetupOutputVariable(state,
    4647              :                                     "Space Lights Convective Heating Rate",
    4648              :                                     Constant::Units::W,
    4649         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsConGainRate,
    4650              :                                     OutputProcessor::TimeStepType::Zone,
    4651              :                                     OutputProcessor::StoreType::Average,
    4652         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4653         8550 :                 SetupOutputVariable(state,
    4654              :                                     "Space Lights Return Air Heating Energy",
    4655              :                                     Constant::Units::J,
    4656         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRetAirGain,
    4657              :                                     OutputProcessor::TimeStepType::Zone,
    4658              :                                     OutputProcessor::StoreType::Sum,
    4659         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4660         8550 :                 SetupOutputVariable(state,
    4661              :                                     "Space Lights Return Air Heating Rate",
    4662              :                                     Constant::Units::W,
    4663         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRetAirGainRate,
    4664              :                                     OutputProcessor::TimeStepType::Zone,
    4665              :                                     OutputProcessor::StoreType::Average,
    4666         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4667         8550 :                 SetupOutputVariable(state,
    4668              :                                     "Space Lights Total Heating Energy",
    4669              :                                     Constant::Units::J,
    4670         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsTotGain,
    4671              :                                     OutputProcessor::TimeStepType::Zone,
    4672              :                                     OutputProcessor::StoreType::Sum,
    4673         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4674         8550 :                 SetupOutputVariable(state,
    4675              :                                     "Space Lights Total Heating Rate",
    4676              :                                     Constant::Units::W,
    4677         4275 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsTotGainRate,
    4678              :                                     OutputProcessor::TimeStepType::Zone,
    4679              :                                     OutputProcessor::StoreType::Average,
    4680         4275 :                                     state.dataHeatBal->space(spaceNum).Name);
    4681              :             }
    4682              :             // Reset space output flag
    4683         5213 :             addSpaceOutputs(spaceNum) = false;
    4684              :         }
    4685         5379 :         for (int elecEqNum = 1; elecEqNum <= state.dataHeatBal->TotElecEquip; ++elecEqNum) {
    4686              :             // Set flags for zone and space total report variables
    4687         4578 :             addZoneOutputs(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr) = true;
    4688         4578 :             addSpaceOutputs(state.dataHeatBal->ZoneElectric(elecEqNum).spaceIndex) = true;
    4689              :             // Object report variables
    4690         9156 :             SetupOutputVariable(state,
    4691              :                                 "Electric Equipment Electricity Rate",
    4692              :                                 Constant::Units::W,
    4693         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Power,
    4694              :                                 OutputProcessor::TimeStepType::Zone,
    4695              :                                 OutputProcessor::StoreType::Average,
    4696         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4697         9156 :             SetupOutputVariable(state,
    4698              :                                 "Electric Equipment Electricity Energy",
    4699              :                                 Constant::Units::J,
    4700         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Consumption,
    4701              :                                 OutputProcessor::TimeStepType::Zone,
    4702              :                                 OutputProcessor::StoreType::Sum,
    4703         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name,
    4704              :                                 Constant::eResource::Electricity,
    4705              :                                 OutputProcessor::Group::Building,
    4706              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    4707         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).EndUseSubcategory,
    4708         4578 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr).Name,
    4709         4578 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr).Multiplier,
    4710         4578 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr).ListMultiplier,
    4711         4578 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneElectric(elecEqNum).spaceIndex).spaceType);
    4712              : 
    4713         9156 :             SetupOutputVariable(state,
    4714              :                                 "Electric Equipment Radiant Heating Energy",
    4715              :                                 Constant::Units::J,
    4716         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).RadGainEnergy,
    4717              :                                 OutputProcessor::TimeStepType::Zone,
    4718              :                                 OutputProcessor::StoreType::Sum,
    4719         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4720         9156 :             SetupOutputVariable(state,
    4721              :                                 "Electric Equipment Radiant Heating Rate",
    4722              :                                 Constant::Units::W,
    4723         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).RadGainRate,
    4724              :                                 OutputProcessor::TimeStepType::Zone,
    4725              :                                 OutputProcessor::StoreType::Average,
    4726         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4727         9156 :             SetupOutputVariable(state,
    4728              :                                 "Electric Equipment Convective Heating Energy",
    4729              :                                 Constant::Units::J,
    4730         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).ConGainEnergy,
    4731              :                                 OutputProcessor::TimeStepType::Zone,
    4732              :                                 OutputProcessor::StoreType::Sum,
    4733         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4734         9156 :             SetupOutputVariable(state,
    4735              :                                 "Electric Equipment Convective Heating Rate",
    4736              :                                 Constant::Units::W,
    4737         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).ConGainRate,
    4738              :                                 OutputProcessor::TimeStepType::Zone,
    4739              :                                 OutputProcessor::StoreType::Average,
    4740         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4741         9156 :             SetupOutputVariable(state,
    4742              :                                 "Electric Equipment Latent Gain Energy",
    4743              :                                 Constant::Units::J,
    4744         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LatGainEnergy,
    4745              :                                 OutputProcessor::TimeStepType::Zone,
    4746              :                                 OutputProcessor::StoreType::Sum,
    4747         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4748         9156 :             SetupOutputVariable(state,
    4749              :                                 "Electric Equipment Latent Gain Rate",
    4750              :                                 Constant::Units::W,
    4751         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LatGainRate,
    4752              :                                 OutputProcessor::TimeStepType::Zone,
    4753              :                                 OutputProcessor::StoreType::Average,
    4754         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4755         9156 :             SetupOutputVariable(state,
    4756              :                                 "Electric Equipment Lost Heat Energy",
    4757              :                                 Constant::Units::J,
    4758         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LostEnergy,
    4759              :                                 OutputProcessor::TimeStepType::Zone,
    4760              :                                 OutputProcessor::StoreType::Sum,
    4761         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4762         9156 :             SetupOutputVariable(state,
    4763              :                                 "Electric Equipment Lost Heat Rate",
    4764              :                                 Constant::Units::W,
    4765         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LostRate,
    4766              :                                 OutputProcessor::TimeStepType::Zone,
    4767              :                                 OutputProcessor::StoreType::Average,
    4768         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4769         9156 :             SetupOutputVariable(state,
    4770              :                                 "Electric Equipment Total Heating Energy",
    4771              :                                 Constant::Units::J,
    4772         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).TotGainEnergy,
    4773              :                                 OutputProcessor::TimeStepType::Zone,
    4774              :                                 OutputProcessor::StoreType::Sum,
    4775         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4776         9156 :             SetupOutputVariable(state,
    4777              :                                 "Electric Equipment Total Heating Rate",
    4778              :                                 Constant::Units::W,
    4779         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).TotGainRate,
    4780              :                                 OutputProcessor::TimeStepType::Zone,
    4781              :                                 OutputProcessor::StoreType::Average,
    4782         4578 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4783              :         }
    4784              : 
    4785              :         // Zone total report variables
    4786         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    4787         5201 :             if (addZoneOutputs(zoneNum)) {
    4788         8640 :                 SetupOutputVariable(state,
    4789              :                                     "Zone Electric Equipment Electricity Rate",
    4790              :                                     Constant::Units::W,
    4791         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecPower,
    4792              :                                     OutputProcessor::TimeStepType::Zone,
    4793              :                                     OutputProcessor::StoreType::Average,
    4794         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4795         8640 :                 SetupOutputVariable(state,
    4796              :                                     "Zone Electric Equipment Electricity Energy",
    4797              :                                     Constant::Units::J,
    4798         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecConsump,
    4799              :                                     OutputProcessor::TimeStepType::Zone,
    4800              :                                     OutputProcessor::StoreType::Sum,
    4801         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4802              : 
    4803         8640 :                 SetupOutputVariable(state,
    4804              :                                     "Zone Electric Equipment Radiant Heating Energy",
    4805              :                                     Constant::Units::J,
    4806         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecRadGain,
    4807              :                                     OutputProcessor::TimeStepType::Zone,
    4808              :                                     OutputProcessor::StoreType::Sum,
    4809         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4810         8640 :                 SetupOutputVariable(state,
    4811              :                                     "Zone Electric Equipment Radiant Heating Rate",
    4812              :                                     Constant::Units::W,
    4813         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecRadGainRate,
    4814              :                                     OutputProcessor::TimeStepType::Zone,
    4815              :                                     OutputProcessor::StoreType::Average,
    4816         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4817         8640 :                 SetupOutputVariable(state,
    4818              :                                     "Zone Electric Equipment Convective Heating Energy",
    4819              :                                     Constant::Units::J,
    4820         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecConGain,
    4821              :                                     OutputProcessor::TimeStepType::Zone,
    4822              :                                     OutputProcessor::StoreType::Sum,
    4823         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4824         8640 :                 SetupOutputVariable(state,
    4825              :                                     "Zone Electric Equipment Convective Heating Rate",
    4826              :                                     Constant::Units::W,
    4827         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecConGainRate,
    4828              :                                     OutputProcessor::TimeStepType::Zone,
    4829              :                                     OutputProcessor::StoreType::Average,
    4830         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4831         8640 :                 SetupOutputVariable(state,
    4832              :                                     "Zone Electric Equipment Latent Gain Energy",
    4833              :                                     Constant::Units::J,
    4834         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLatGain,
    4835              :                                     OutputProcessor::TimeStepType::Zone,
    4836              :                                     OutputProcessor::StoreType::Sum,
    4837         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4838         8640 :                 SetupOutputVariable(state,
    4839              :                                     "Zone Electric Equipment Latent Gain Rate",
    4840              :                                     Constant::Units::W,
    4841         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLatGainRate,
    4842              :                                     OutputProcessor::TimeStepType::Zone,
    4843              :                                     OutputProcessor::StoreType::Average,
    4844         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4845         8640 :                 SetupOutputVariable(state,
    4846              :                                     "Zone Electric Equipment Lost Heat Energy",
    4847              :                                     Constant::Units::J,
    4848         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLost,
    4849              :                                     OutputProcessor::TimeStepType::Zone,
    4850              :                                     OutputProcessor::StoreType::Sum,
    4851         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4852         8640 :                 SetupOutputVariable(state,
    4853              :                                     "Zone Electric Equipment Lost Heat Rate",
    4854              :                                     Constant::Units::W,
    4855         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLostRate,
    4856              :                                     OutputProcessor::TimeStepType::Zone,
    4857              :                                     OutputProcessor::StoreType::Average,
    4858         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4859         8640 :                 SetupOutputVariable(state,
    4860              :                                     "Zone Electric Equipment Total Heating Energy",
    4861              :                                     Constant::Units::J,
    4862         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecTotGain,
    4863              :                                     OutputProcessor::TimeStepType::Zone,
    4864              :                                     OutputProcessor::StoreType::Sum,
    4865         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4866         8640 :                 SetupOutputVariable(state,
    4867              :                                     "Zone Electric Equipment Total Heating Rate",
    4868              :                                     Constant::Units::W,
    4869         4320 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecTotGainRate,
    4870              :                                     OutputProcessor::TimeStepType::Zone,
    4871              :                                     OutputProcessor::StoreType::Average,
    4872         4320 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4873              :             }
    4874              :             // Reset zone output flag
    4875         5201 :             addZoneOutputs(zoneNum) = false;
    4876              :         }
    4877              : 
    4878              :         // space total report variables
    4879         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4880         5213 :             if (addSpaceOutputs(spaceNum)) {
    4881         8658 :                 SetupOutputVariable(state,
    4882              :                                     "Space Electric Equipment Electricity Rate",
    4883              :                                     Constant::Units::W,
    4884         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecPower,
    4885              :                                     OutputProcessor::TimeStepType::Zone,
    4886              :                                     OutputProcessor::StoreType::Average,
    4887         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4888         8658 :                 SetupOutputVariable(state,
    4889              :                                     "Space Electric Equipment Electricity Energy",
    4890              :                                     Constant::Units::J,
    4891         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecConsump,
    4892              :                                     OutputProcessor::TimeStepType::Zone,
    4893              :                                     OutputProcessor::StoreType::Sum,
    4894         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4895              : 
    4896         8658 :                 SetupOutputVariable(state,
    4897              :                                     "Space Electric Equipment Radiant Heating Energy",
    4898              :                                     Constant::Units::J,
    4899         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecRadGain,
    4900              :                                     OutputProcessor::TimeStepType::Zone,
    4901              :                                     OutputProcessor::StoreType::Sum,
    4902         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4903         8658 :                 SetupOutputVariable(state,
    4904              :                                     "Space Electric Equipment Radiant Heating Rate",
    4905              :                                     Constant::Units::W,
    4906         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecRadGainRate,
    4907              :                                     OutputProcessor::TimeStepType::Zone,
    4908              :                                     OutputProcessor::StoreType::Average,
    4909         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4910         8658 :                 SetupOutputVariable(state,
    4911              :                                     "Space Electric Equipment Convective Heating Energy",
    4912              :                                     Constant::Units::J,
    4913         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecConGain,
    4914              :                                     OutputProcessor::TimeStepType::Zone,
    4915              :                                     OutputProcessor::StoreType::Sum,
    4916         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4917         8658 :                 SetupOutputVariable(state,
    4918              :                                     "Space Electric Equipment Convective Heating Rate",
    4919              :                                     Constant::Units::W,
    4920         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecConGainRate,
    4921              :                                     OutputProcessor::TimeStepType::Zone,
    4922              :                                     OutputProcessor::StoreType::Average,
    4923         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4924         8658 :                 SetupOutputVariable(state,
    4925              :                                     "Space Electric Equipment Latent Gain Energy",
    4926              :                                     Constant::Units::J,
    4927         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLatGain,
    4928              :                                     OutputProcessor::TimeStepType::Zone,
    4929              :                                     OutputProcessor::StoreType::Sum,
    4930         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4931         8658 :                 SetupOutputVariable(state,
    4932              :                                     "Space Electric Equipment Latent Gain Rate",
    4933              :                                     Constant::Units::W,
    4934         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLatGainRate,
    4935              :                                     OutputProcessor::TimeStepType::Zone,
    4936              :                                     OutputProcessor::StoreType::Average,
    4937         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4938         8658 :                 SetupOutputVariable(state,
    4939              :                                     "Space Electric Equipment Lost Heat Energy",
    4940              :                                     Constant::Units::J,
    4941         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLost,
    4942              :                                     OutputProcessor::TimeStepType::Zone,
    4943              :                                     OutputProcessor::StoreType::Sum,
    4944         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4945         8658 :                 SetupOutputVariable(state,
    4946              :                                     "Space Electric Equipment Lost Heat Rate",
    4947              :                                     Constant::Units::W,
    4948         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLostRate,
    4949              :                                     OutputProcessor::TimeStepType::Zone,
    4950              :                                     OutputProcessor::StoreType::Average,
    4951         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4952         8658 :                 SetupOutputVariable(state,
    4953              :                                     "Space Electric Equipment Total Heating Energy",
    4954              :                                     Constant::Units::J,
    4955         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecTotGain,
    4956              :                                     OutputProcessor::TimeStepType::Zone,
    4957              :                                     OutputProcessor::StoreType::Sum,
    4958         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4959         8658 :                 SetupOutputVariable(state,
    4960              :                                     "Space Electric Equipment Total Heating Rate",
    4961              :                                     Constant::Units::W,
    4962         4329 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecTotGainRate,
    4963              :                                     OutputProcessor::TimeStepType::Zone,
    4964              :                                     OutputProcessor::StoreType::Average,
    4965         4329 :                                     state.dataHeatBal->space(spaceNum).Name);
    4966              :             }
    4967              :             // Reset space output flag
    4968         5213 :             addSpaceOutputs(spaceNum) = false;
    4969              :         }
    4970              :         // Object report variables
    4971          889 :         for (int gasEqNum = 1; gasEqNum <= state.dataHeatBal->TotGasEquip; ++gasEqNum) {
    4972              :             // Set flags for zone and space total report variables
    4973           88 :             addZoneOutputs(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr) = true;
    4974           88 :             addSpaceOutputs(state.dataHeatBal->ZoneGas(gasEqNum).spaceIndex) = true;
    4975          176 :             SetupOutputVariable(state,
    4976              :                                 "Gas Equipment NaturalGas Rate",
    4977              :                                 Constant::Units::W,
    4978           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Power,
    4979              :                                 OutputProcessor::TimeStepType::Zone,
    4980              :                                 OutputProcessor::StoreType::Average,
    4981           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    4982          176 :             SetupOutputVariable(state,
    4983              :                                 "Gas Equipment NaturalGas Energy",
    4984              :                                 Constant::Units::J,
    4985           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Consumption,
    4986              :                                 OutputProcessor::TimeStepType::Zone,
    4987              :                                 OutputProcessor::StoreType::Sum,
    4988           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name,
    4989              :                                 Constant::eResource::NaturalGas,
    4990              :                                 OutputProcessor::Group::Building,
    4991              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    4992           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).EndUseSubcategory,
    4993           88 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr).Name,
    4994           88 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr).Multiplier,
    4995           88 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr).ListMultiplier,
    4996           88 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneGas(gasEqNum).spaceIndex).spaceType);
    4997              : 
    4998          176 :             SetupOutputVariable(state,
    4999              :                                 "Gas Equipment Radiant Heating Energy",
    5000              :                                 Constant::Units::J,
    5001           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).RadGainEnergy,
    5002              :                                 OutputProcessor::TimeStepType::Zone,
    5003              :                                 OutputProcessor::StoreType::Sum,
    5004           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5005          176 :             SetupOutputVariable(state,
    5006              :                                 "Gas Equipment Convective Heating Energy",
    5007              :                                 Constant::Units::J,
    5008           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).ConGainEnergy,
    5009              :                                 OutputProcessor::TimeStepType::Zone,
    5010              :                                 OutputProcessor::StoreType::Sum,
    5011           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5012          176 :             SetupOutputVariable(state,
    5013              :                                 "Gas Equipment Latent Gain Energy",
    5014              :                                 Constant::Units::J,
    5015           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LatGainEnergy,
    5016              :                                 OutputProcessor::TimeStepType::Zone,
    5017              :                                 OutputProcessor::StoreType::Sum,
    5018           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5019          176 :             SetupOutputVariable(state,
    5020              :                                 "Gas Equipment Lost Heat Energy",
    5021              :                                 Constant::Units::J,
    5022           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LostEnergy,
    5023              :                                 OutputProcessor::TimeStepType::Zone,
    5024              :                                 OutputProcessor::StoreType::Sum,
    5025           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5026          176 :             SetupOutputVariable(state,
    5027              :                                 "Gas Equipment Total Heating Energy",
    5028              :                                 Constant::Units::J,
    5029           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).TotGainEnergy,
    5030              :                                 OutputProcessor::TimeStepType::Zone,
    5031              :                                 OutputProcessor::StoreType::Sum,
    5032           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5033          176 :             SetupOutputVariable(state,
    5034              :                                 "Gas Equipment Radiant Heating Rate",
    5035              :                                 Constant::Units::W,
    5036           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).RadGainRate,
    5037              :                                 OutputProcessor::TimeStepType::Zone,
    5038              :                                 OutputProcessor::StoreType::Average,
    5039           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5040          176 :             SetupOutputVariable(state,
    5041              :                                 "Gas Equipment Convective Heating Rate",
    5042              :                                 Constant::Units::W,
    5043           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).ConGainRate,
    5044              :                                 OutputProcessor::TimeStepType::Zone,
    5045              :                                 OutputProcessor::StoreType::Average,
    5046           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5047          176 :             SetupOutputVariable(state,
    5048              :                                 "Gas Equipment Latent Gain Rate",
    5049              :                                 Constant::Units::W,
    5050           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LatGainRate,
    5051              :                                 OutputProcessor::TimeStepType::Zone,
    5052              :                                 OutputProcessor::StoreType::Average,
    5053           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5054          176 :             SetupOutputVariable(state,
    5055              :                                 "Gas Equipment Lost Heat Rate",
    5056              :                                 Constant::Units::W,
    5057           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LostRate,
    5058              :                                 OutputProcessor::TimeStepType::Zone,
    5059              :                                 OutputProcessor::StoreType::Average,
    5060           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5061          176 :             SetupOutputVariable(state,
    5062              :                                 "Gas Equipment Total Heating Rate",
    5063              :                                 Constant::Units::W,
    5064           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).TotGainRate,
    5065              :                                 OutputProcessor::TimeStepType::Zone,
    5066              :                                 OutputProcessor::StoreType::Average,
    5067           88 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5068              :         }
    5069              : 
    5070              :         // Zone total report variables
    5071         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5072         5201 :             if (addZoneOutputs(zoneNum)) {
    5073              : 
    5074          176 :                 SetupOutputVariable(state,
    5075              :                                     "Zone Gas Equipment NaturalGas Rate",
    5076              :                                     Constant::Units::W,
    5077           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasPower,
    5078              :                                     OutputProcessor::TimeStepType::Zone,
    5079              :                                     OutputProcessor::StoreType::Average,
    5080           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5081          176 :                 SetupOutputVariable(state,
    5082              :                                     "Zone Gas Equipment NaturalGas Energy",
    5083              :                                     Constant::Units::J,
    5084           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasConsump,
    5085              :                                     OutputProcessor::TimeStepType::Zone,
    5086              :                                     OutputProcessor::StoreType::Sum,
    5087           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5088              : 
    5089          176 :                 SetupOutputVariable(state,
    5090              :                                     "Zone Gas Equipment Radiant Heating Energy",
    5091              :                                     Constant::Units::J,
    5092           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasRadGain,
    5093              :                                     OutputProcessor::TimeStepType::Zone,
    5094              :                                     OutputProcessor::StoreType::Sum,
    5095           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5096          176 :                 SetupOutputVariable(state,
    5097              :                                     "Zone Gas Equipment Radiant Heating Rate",
    5098              :                                     Constant::Units::W,
    5099           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasRadGainRate,
    5100              :                                     OutputProcessor::TimeStepType::Zone,
    5101              :                                     OutputProcessor::StoreType::Average,
    5102           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5103          176 :                 SetupOutputVariable(state,
    5104              :                                     "Zone Gas Equipment Convective Heating Energy",
    5105              :                                     Constant::Units::J,
    5106           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasConGain,
    5107              :                                     OutputProcessor::TimeStepType::Zone,
    5108              :                                     OutputProcessor::StoreType::Sum,
    5109           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5110          176 :                 SetupOutputVariable(state,
    5111              :                                     "Zone Gas Equipment Convective Heating Rate",
    5112              :                                     Constant::Units::W,
    5113           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasConGainRate,
    5114              :                                     OutputProcessor::TimeStepType::Zone,
    5115              :                                     OutputProcessor::StoreType::Average,
    5116           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5117          176 :                 SetupOutputVariable(state,
    5118              :                                     "Zone Gas Equipment Latent Gain Energy",
    5119              :                                     Constant::Units::J,
    5120           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLatGain,
    5121              :                                     OutputProcessor::TimeStepType::Zone,
    5122              :                                     OutputProcessor::StoreType::Sum,
    5123           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5124          176 :                 SetupOutputVariable(state,
    5125              :                                     "Zone Gas Equipment Latent Gain Rate",
    5126              :                                     Constant::Units::W,
    5127           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLatGainRate,
    5128              :                                     OutputProcessor::TimeStepType::Zone,
    5129              :                                     OutputProcessor::StoreType::Average,
    5130           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5131          176 :                 SetupOutputVariable(state,
    5132              :                                     "Zone Gas Equipment Lost Heat Energy",
    5133              :                                     Constant::Units::J,
    5134           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLost,
    5135              :                                     OutputProcessor::TimeStepType::Zone,
    5136              :                                     OutputProcessor::StoreType::Sum,
    5137           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5138          176 :                 SetupOutputVariable(state,
    5139              :                                     "Zone Gas Equipment Lost Heat Rate",
    5140              :                                     Constant::Units::W,
    5141           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLostRate,
    5142              :                                     OutputProcessor::TimeStepType::Zone,
    5143              :                                     OutputProcessor::StoreType::Average,
    5144           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5145          176 :                 SetupOutputVariable(state,
    5146              :                                     "Zone Gas Equipment Total Heating Energy",
    5147              :                                     Constant::Units::J,
    5148           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasTotGain,
    5149              :                                     OutputProcessor::TimeStepType::Zone,
    5150              :                                     OutputProcessor::StoreType::Sum,
    5151           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5152          176 :                 SetupOutputVariable(state,
    5153              :                                     "Zone Gas Equipment Total Heating Rate",
    5154              :                                     Constant::Units::W,
    5155           88 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasTotGainRate,
    5156              :                                     OutputProcessor::TimeStepType::Zone,
    5157              :                                     OutputProcessor::StoreType::Average,
    5158           88 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5159              :             }
    5160              :             // Reset zone output flag
    5161         5201 :             addZoneOutputs(zoneNum) = false;
    5162              :         }
    5163              : 
    5164              :         // Space total report variables
    5165         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    5166         5213 :             if (addSpaceOutputs(spaceNum)) {
    5167              : 
    5168          176 :                 SetupOutputVariable(state,
    5169              :                                     "Space Gas Equipment NaturalGas Rate",
    5170              :                                     Constant::Units::W,
    5171           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasPower,
    5172              :                                     OutputProcessor::TimeStepType::Zone,
    5173              :                                     OutputProcessor::StoreType::Average,
    5174           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5175          176 :                 SetupOutputVariable(state,
    5176              :                                     "Space Gas Equipment NaturalGas Energy",
    5177              :                                     Constant::Units::J,
    5178           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasConsump,
    5179              :                                     OutputProcessor::TimeStepType::Zone,
    5180              :                                     OutputProcessor::StoreType::Sum,
    5181           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5182              : 
    5183          176 :                 SetupOutputVariable(state,
    5184              :                                     "Space Gas Equipment Radiant Heating Energy",
    5185              :                                     Constant::Units::J,
    5186           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasRadGain,
    5187              :                                     OutputProcessor::TimeStepType::Zone,
    5188              :                                     OutputProcessor::StoreType::Sum,
    5189           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5190          176 :                 SetupOutputVariable(state,
    5191              :                                     "Space Gas Equipment Radiant Heating Rate",
    5192              :                                     Constant::Units::W,
    5193           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasRadGainRate,
    5194              :                                     OutputProcessor::TimeStepType::Zone,
    5195              :                                     OutputProcessor::StoreType::Average,
    5196           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5197          176 :                 SetupOutputVariable(state,
    5198              :                                     "Space Gas Equipment Convective Heating Energy",
    5199              :                                     Constant::Units::J,
    5200           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasConGain,
    5201              :                                     OutputProcessor::TimeStepType::Zone,
    5202              :                                     OutputProcessor::StoreType::Sum,
    5203           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5204          176 :                 SetupOutputVariable(state,
    5205              :                                     "Space Gas Equipment Convective Heating Rate",
    5206              :                                     Constant::Units::W,
    5207           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasConGainRate,
    5208              :                                     OutputProcessor::TimeStepType::Zone,
    5209              :                                     OutputProcessor::StoreType::Average,
    5210           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5211          176 :                 SetupOutputVariable(state,
    5212              :                                     "Space Gas Equipment Latent Gain Energy",
    5213              :                                     Constant::Units::J,
    5214           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLatGain,
    5215              :                                     OutputProcessor::TimeStepType::Zone,
    5216              :                                     OutputProcessor::StoreType::Sum,
    5217           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5218          176 :                 SetupOutputVariable(state,
    5219              :                                     "Space Gas Equipment Latent Gain Rate",
    5220              :                                     Constant::Units::W,
    5221           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLatGainRate,
    5222              :                                     OutputProcessor::TimeStepType::Zone,
    5223              :                                     OutputProcessor::StoreType::Average,
    5224           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5225          176 :                 SetupOutputVariable(state,
    5226              :                                     "Space Gas Equipment Lost Heat Energy",
    5227              :                                     Constant::Units::J,
    5228           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLost,
    5229              :                                     OutputProcessor::TimeStepType::Zone,
    5230              :                                     OutputProcessor::StoreType::Sum,
    5231           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5232          176 :                 SetupOutputVariable(state,
    5233              :                                     "Space Gas Equipment Lost Heat Rate",
    5234              :                                     Constant::Units::W,
    5235           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLostRate,
    5236              :                                     OutputProcessor::TimeStepType::Zone,
    5237              :                                     OutputProcessor::StoreType::Average,
    5238           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5239          176 :                 SetupOutputVariable(state,
    5240              :                                     "Space Gas Equipment Total Heating Energy",
    5241              :                                     Constant::Units::J,
    5242           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasTotGain,
    5243              :                                     OutputProcessor::TimeStepType::Zone,
    5244              :                                     OutputProcessor::StoreType::Sum,
    5245           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5246          176 :                 SetupOutputVariable(state,
    5247              :                                     "Space Gas Equipment Total Heating Rate",
    5248              :                                     Constant::Units::W,
    5249           88 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasTotGainRate,
    5250              :                                     OutputProcessor::TimeStepType::Zone,
    5251              :                                     OutputProcessor::StoreType::Average,
    5252           88 :                                     state.dataHeatBal->space(spaceNum).Name);
    5253              :             }
    5254              :             // Reset space output flag
    5255         5213 :             addSpaceOutputs(spaceNum) = false;
    5256              :         }
    5257              : 
    5258              :         // Object report variables
    5259          815 :         for (int hwEqNum = 1; hwEqNum <= state.dataHeatBal->TotHWEquip; ++hwEqNum) {
    5260              :             // Set flags for zone and space total report variables
    5261           14 :             addZoneOutputs(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr) = true;
    5262           14 :             addSpaceOutputs(state.dataHeatBal->ZoneHWEq(hwEqNum).spaceIndex) = true;
    5263           28 :             SetupOutputVariable(state,
    5264              :                                 "Hot Water Equipment District Heating Rate",
    5265              :                                 Constant::Units::W,
    5266           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Power,
    5267              :                                 OutputProcessor::TimeStepType::Zone,
    5268              :                                 OutputProcessor::StoreType::Average,
    5269           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5270           28 :             SetupOutputVariable(state,
    5271              :                                 "Hot Water Equipment District Heating Energy",
    5272              :                                 Constant::Units::J,
    5273           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Consumption,
    5274              :                                 OutputProcessor::TimeStepType::Zone,
    5275              :                                 OutputProcessor::StoreType::Sum,
    5276           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name,
    5277              :                                 Constant::eResource::DistrictHeatingWater,
    5278              :                                 OutputProcessor::Group::Building,
    5279              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    5280           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).EndUseSubcategory,
    5281           14 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr).Name,
    5282           14 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr).Multiplier,
    5283           14 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr).ListMultiplier,
    5284           14 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneHWEq(hwEqNum).spaceIndex).spaceType);
    5285              : 
    5286           28 :             SetupOutputVariable(state,
    5287              :                                 "Hot Water Equipment Radiant Heating Energy",
    5288              :                                 Constant::Units::J,
    5289           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).RadGainEnergy,
    5290              :                                 OutputProcessor::TimeStepType::Zone,
    5291              :                                 OutputProcessor::StoreType::Sum,
    5292           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5293           28 :             SetupOutputVariable(state,
    5294              :                                 "Hot Water Equipment Radiant Heating Rate",
    5295              :                                 Constant::Units::W,
    5296           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).RadGainRate,
    5297              :                                 OutputProcessor::TimeStepType::Zone,
    5298              :                                 OutputProcessor::StoreType::Average,
    5299           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5300           28 :             SetupOutputVariable(state,
    5301              :                                 "Hot Water Equipment Convective Heating Energy",
    5302              :                                 Constant::Units::J,
    5303           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).ConGainEnergy,
    5304              :                                 OutputProcessor::TimeStepType::Zone,
    5305              :                                 OutputProcessor::StoreType::Sum,
    5306           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5307           28 :             SetupOutputVariable(state,
    5308              :                                 "Hot Water Equipment Convective Heating Rate",
    5309              :                                 Constant::Units::W,
    5310           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).ConGainRate,
    5311              :                                 OutputProcessor::TimeStepType::Zone,
    5312              :                                 OutputProcessor::StoreType::Average,
    5313           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5314           28 :             SetupOutputVariable(state,
    5315              :                                 "Hot Water Equipment Latent Gain Energy",
    5316              :                                 Constant::Units::J,
    5317           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LatGainEnergy,
    5318              :                                 OutputProcessor::TimeStepType::Zone,
    5319              :                                 OutputProcessor::StoreType::Sum,
    5320           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5321           28 :             SetupOutputVariable(state,
    5322              :                                 "Hot Water Equipment Latent Gain Rate",
    5323              :                                 Constant::Units::W,
    5324           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LatGainRate,
    5325              :                                 OutputProcessor::TimeStepType::Zone,
    5326              :                                 OutputProcessor::StoreType::Average,
    5327           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5328           28 :             SetupOutputVariable(state,
    5329              :                                 "Hot Water Equipment Lost Heat Energy",
    5330              :                                 Constant::Units::J,
    5331           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LostEnergy,
    5332              :                                 OutputProcessor::TimeStepType::Zone,
    5333              :                                 OutputProcessor::StoreType::Sum,
    5334           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5335           28 :             SetupOutputVariable(state,
    5336              :                                 "Hot Water Equipment Lost Heat Rate",
    5337              :                                 Constant::Units::W,
    5338           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LostRate,
    5339              :                                 OutputProcessor::TimeStepType::Zone,
    5340              :                                 OutputProcessor::StoreType::Average,
    5341           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5342           28 :             SetupOutputVariable(state,
    5343              :                                 "Hot Water Equipment Total Heating Energy",
    5344              :                                 Constant::Units::J,
    5345           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).TotGainEnergy,
    5346              :                                 OutputProcessor::TimeStepType::Zone,
    5347              :                                 OutputProcessor::StoreType::Sum,
    5348           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5349           28 :             SetupOutputVariable(state,
    5350              :                                 "Hot Water Equipment Total Heating Rate",
    5351              :                                 Constant::Units::W,
    5352           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).TotGainRate,
    5353              :                                 OutputProcessor::TimeStepType::Zone,
    5354              :                                 OutputProcessor::StoreType::Average,
    5355           14 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5356              :         }
    5357              : 
    5358              :         // Zone total report variables
    5359         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5360         5201 :             if (addZoneOutputs(zoneNum)) {
    5361           28 :                 SetupOutputVariable(state,
    5362              :                                     "Zone Hot Water Equipment District Heating Rate",
    5363              :                                     Constant::Units::W,
    5364           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWPower,
    5365              :                                     OutputProcessor::TimeStepType::Zone,
    5366              :                                     OutputProcessor::StoreType::Average,
    5367           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5368           28 :                 SetupOutputVariable(state,
    5369              :                                     "Zone Hot Water Equipment District Heating Energy",
    5370              :                                     Constant::Units::J,
    5371           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWConsump,
    5372              :                                     OutputProcessor::TimeStepType::Zone,
    5373              :                                     OutputProcessor::StoreType::Sum,
    5374           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5375              : 
    5376           28 :                 SetupOutputVariable(state,
    5377              :                                     "Zone Hot Water Equipment Radiant Heating Energy",
    5378              :                                     Constant::Units::J,
    5379           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWRadGain,
    5380              :                                     OutputProcessor::TimeStepType::Zone,
    5381              :                                     OutputProcessor::StoreType::Sum,
    5382           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5383           28 :                 SetupOutputVariable(state,
    5384              :                                     "Zone Hot Water Equipment Radiant Heating Rate",
    5385              :                                     Constant::Units::W,
    5386           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWRadGainRate,
    5387              :                                     OutputProcessor::TimeStepType::Zone,
    5388              :                                     OutputProcessor::StoreType::Average,
    5389           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5390           28 :                 SetupOutputVariable(state,
    5391              :                                     "Zone Hot Water Equipment Convective Heating Energy",
    5392              :                                     Constant::Units::J,
    5393           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWConGain,
    5394              :                                     OutputProcessor::TimeStepType::Zone,
    5395              :                                     OutputProcessor::StoreType::Sum,
    5396           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5397           28 :                 SetupOutputVariable(state,
    5398              :                                     "Zone Hot Water Equipment Convective Heating Rate",
    5399              :                                     Constant::Units::W,
    5400           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWConGainRate,
    5401              :                                     OutputProcessor::TimeStepType::Zone,
    5402              :                                     OutputProcessor::StoreType::Average,
    5403           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5404           28 :                 SetupOutputVariable(state,
    5405              :                                     "Zone Hot Water Equipment Latent Gain Energy",
    5406              :                                     Constant::Units::J,
    5407           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLatGain,
    5408              :                                     OutputProcessor::TimeStepType::Zone,
    5409              :                                     OutputProcessor::StoreType::Sum,
    5410           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5411           28 :                 SetupOutputVariable(state,
    5412              :                                     "Zone Hot Water Equipment Latent Gain Rate",
    5413              :                                     Constant::Units::W,
    5414           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLatGainRate,
    5415              :                                     OutputProcessor::TimeStepType::Zone,
    5416              :                                     OutputProcessor::StoreType::Average,
    5417           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5418           28 :                 SetupOutputVariable(state,
    5419              :                                     "Zone Hot Water Equipment Lost Heat Energy",
    5420              :                                     Constant::Units::J,
    5421           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLost,
    5422              :                                     OutputProcessor::TimeStepType::Zone,
    5423              :                                     OutputProcessor::StoreType::Sum,
    5424           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5425           28 :                 SetupOutputVariable(state,
    5426              :                                     "Zone Hot Water Equipment Lost Heat Rate",
    5427              :                                     Constant::Units::W,
    5428           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLostRate,
    5429              :                                     OutputProcessor::TimeStepType::Zone,
    5430              :                                     OutputProcessor::StoreType::Average,
    5431           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5432           28 :                 SetupOutputVariable(state,
    5433              :                                     "Zone Hot Water Equipment Total Heating Energy",
    5434              :                                     Constant::Units::J,
    5435           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWTotGain,
    5436              :                                     OutputProcessor::TimeStepType::Zone,
    5437              :                                     OutputProcessor::StoreType::Sum,
    5438           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5439           28 :                 SetupOutputVariable(state,
    5440              :                                     "Zone Hot Water Equipment Total Heating Rate",
    5441              :                                     Constant::Units::W,
    5442           14 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWTotGainRate,
    5443              :                                     OutputProcessor::TimeStepType::Zone,
    5444              :                                     OutputProcessor::StoreType::Average,
    5445           14 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5446              :             }
    5447              :             // Reset zone output flag
    5448         5201 :             addZoneOutputs(zoneNum) = false;
    5449              :         }
    5450              : 
    5451              :         // Space total report variables
    5452         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    5453         5213 :             if (addSpaceOutputs(spaceNum)) {
    5454           28 :                 SetupOutputVariable(state,
    5455              :                                     "Space Hot Water Equipment District Heating Rate",
    5456              :                                     Constant::Units::W,
    5457           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWPower,
    5458              :                                     OutputProcessor::TimeStepType::Zone,
    5459              :                                     OutputProcessor::StoreType::Average,
    5460           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5461           28 :                 SetupOutputVariable(state,
    5462              :                                     "Space Hot Water Equipment District Heating Energy",
    5463              :                                     Constant::Units::J,
    5464           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWConsump,
    5465              :                                     OutputProcessor::TimeStepType::Zone,
    5466              :                                     OutputProcessor::StoreType::Sum,
    5467           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5468              : 
    5469           28 :                 SetupOutputVariable(state,
    5470              :                                     "Space Hot Water Equipment Radiant Heating Energy",
    5471              :                                     Constant::Units::J,
    5472           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWRadGain,
    5473              :                                     OutputProcessor::TimeStepType::Zone,
    5474              :                                     OutputProcessor::StoreType::Sum,
    5475           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5476           28 :                 SetupOutputVariable(state,
    5477              :                                     "Space Hot Water Equipment Radiant Heating Rate",
    5478              :                                     Constant::Units::W,
    5479           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWRadGainRate,
    5480              :                                     OutputProcessor::TimeStepType::Zone,
    5481              :                                     OutputProcessor::StoreType::Average,
    5482           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5483           28 :                 SetupOutputVariable(state,
    5484              :                                     "Space Hot Water Equipment Convective Heating Energy",
    5485              :                                     Constant::Units::J,
    5486           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWConGain,
    5487              :                                     OutputProcessor::TimeStepType::Zone,
    5488              :                                     OutputProcessor::StoreType::Sum,
    5489           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5490           28 :                 SetupOutputVariable(state,
    5491              :                                     "Space Hot Water Equipment Convective Heating Rate",
    5492              :                                     Constant::Units::W,
    5493           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWConGainRate,
    5494              :                                     OutputProcessor::TimeStepType::Zone,
    5495              :                                     OutputProcessor::StoreType::Average,
    5496           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5497           28 :                 SetupOutputVariable(state,
    5498              :                                     "Space Hot Water Equipment Latent Gain Energy",
    5499              :                                     Constant::Units::J,
    5500           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLatGain,
    5501              :                                     OutputProcessor::TimeStepType::Zone,
    5502              :                                     OutputProcessor::StoreType::Sum,
    5503           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5504           28 :                 SetupOutputVariable(state,
    5505              :                                     "Space Hot Water Equipment Latent Gain Rate",
    5506              :                                     Constant::Units::W,
    5507           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLatGainRate,
    5508              :                                     OutputProcessor::TimeStepType::Zone,
    5509              :                                     OutputProcessor::StoreType::Average,
    5510           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5511           28 :                 SetupOutputVariable(state,
    5512              :                                     "Space Hot Water Equipment Lost Heat Energy",
    5513              :                                     Constant::Units::J,
    5514           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLost,
    5515              :                                     OutputProcessor::TimeStepType::Zone,
    5516              :                                     OutputProcessor::StoreType::Sum,
    5517           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5518           28 :                 SetupOutputVariable(state,
    5519              :                                     "Space Hot Water Equipment Lost Heat Rate",
    5520              :                                     Constant::Units::W,
    5521           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLostRate,
    5522              :                                     OutputProcessor::TimeStepType::Zone,
    5523              :                                     OutputProcessor::StoreType::Average,
    5524           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5525           28 :                 SetupOutputVariable(state,
    5526              :                                     "Space Hot Water Equipment Total Heating Energy",
    5527              :                                     Constant::Units::J,
    5528           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWTotGain,
    5529              :                                     OutputProcessor::TimeStepType::Zone,
    5530              :                                     OutputProcessor::StoreType::Sum,
    5531           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5532           28 :                 SetupOutputVariable(state,
    5533              :                                     "Space Hot Water Equipment Total Heating Rate",
    5534              :                                     Constant::Units::W,
    5535           14 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWTotGainRate,
    5536              :                                     OutputProcessor::TimeStepType::Zone,
    5537              :                                     OutputProcessor::StoreType::Average,
    5538           14 :                                     state.dataHeatBal->space(spaceNum).Name);
    5539              :             }
    5540              :             // Reset space output flag
    5541         5213 :             addSpaceOutputs(spaceNum) = false;
    5542              :         }
    5543              : 
    5544              :         // Object report variables
    5545          806 :         for (int stmEqNum = 1; stmEqNum <= state.dataHeatBal->TotStmEquip; ++stmEqNum) {
    5546              :             // Set flags for zone and space total report variables
    5547            5 :             addZoneOutputs(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr) = true;
    5548            5 :             addSpaceOutputs(state.dataHeatBal->ZoneSteamEq(stmEqNum).spaceIndex) = true;
    5549           10 :             SetupOutputVariable(state,
    5550              :                                 "Steam Equipment District Heating Rate",
    5551              :                                 Constant::Units::W,
    5552            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Power,
    5553              :                                 OutputProcessor::TimeStepType::Zone,
    5554              :                                 OutputProcessor::StoreType::Average,
    5555            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5556           10 :             SetupOutputVariable(state,
    5557              :                                 "Steam Equipment District Heating Energy",
    5558              :                                 Constant::Units::J,
    5559            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Consumption,
    5560              :                                 OutputProcessor::TimeStepType::Zone,
    5561              :                                 OutputProcessor::StoreType::Sum,
    5562            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name,
    5563              :                                 Constant::eResource::DistrictHeatingSteam,
    5564              :                                 OutputProcessor::Group::Building,
    5565              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    5566            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).EndUseSubcategory,
    5567            5 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr).Name,
    5568            5 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr).Multiplier,
    5569            5 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr).ListMultiplier,
    5570            5 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneSteamEq(stmEqNum).spaceIndex).spaceType);
    5571              : 
    5572           10 :             SetupOutputVariable(state,
    5573              :                                 "Steam Equipment Radiant Heating Energy",
    5574              :                                 Constant::Units::J,
    5575            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).RadGainEnergy,
    5576              :                                 OutputProcessor::TimeStepType::Zone,
    5577              :                                 OutputProcessor::StoreType::Sum,
    5578            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5579           10 :             SetupOutputVariable(state,
    5580              :                                 "Steam Equipment Radiant Heating Rate",
    5581              :                                 Constant::Units::W,
    5582            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).RadGainRate,
    5583              :                                 OutputProcessor::TimeStepType::Zone,
    5584              :                                 OutputProcessor::StoreType::Average,
    5585            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5586           10 :             SetupOutputVariable(state,
    5587              :                                 "Steam Equipment Convective Heating Energy",
    5588              :                                 Constant::Units::J,
    5589            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).ConGainEnergy,
    5590              :                                 OutputProcessor::TimeStepType::Zone,
    5591              :                                 OutputProcessor::StoreType::Sum,
    5592            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5593           10 :             SetupOutputVariable(state,
    5594              :                                 "Steam Equipment Convective Heating Rate",
    5595              :                                 Constant::Units::W,
    5596            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).ConGainRate,
    5597              :                                 OutputProcessor::TimeStepType::Zone,
    5598              :                                 OutputProcessor::StoreType::Average,
    5599            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5600           10 :             SetupOutputVariable(state,
    5601              :                                 "Steam Equipment Latent Gain Energy",
    5602              :                                 Constant::Units::J,
    5603            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LatGainEnergy,
    5604              :                                 OutputProcessor::TimeStepType::Zone,
    5605              :                                 OutputProcessor::StoreType::Sum,
    5606            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5607           10 :             SetupOutputVariable(state,
    5608              :                                 "Steam Equipment Latent Gain Rate",
    5609              :                                 Constant::Units::W,
    5610            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LatGainRate,
    5611              :                                 OutputProcessor::TimeStepType::Zone,
    5612              :                                 OutputProcessor::StoreType::Average,
    5613            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5614           10 :             SetupOutputVariable(state,
    5615              :                                 "Steam Equipment Lost Heat Energy",
    5616              :                                 Constant::Units::J,
    5617            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LostEnergy,
    5618              :                                 OutputProcessor::TimeStepType::Zone,
    5619              :                                 OutputProcessor::StoreType::Sum,
    5620            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5621           10 :             SetupOutputVariable(state,
    5622              :                                 "Steam Equipment Lost Heat Rate",
    5623              :                                 Constant::Units::W,
    5624            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LostRate,
    5625              :                                 OutputProcessor::TimeStepType::Zone,
    5626              :                                 OutputProcessor::StoreType::Average,
    5627            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5628           10 :             SetupOutputVariable(state,
    5629              :                                 "Steam Equipment Total Heating Energy",
    5630              :                                 Constant::Units::J,
    5631            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).TotGainEnergy,
    5632              :                                 OutputProcessor::TimeStepType::Zone,
    5633              :                                 OutputProcessor::StoreType::Sum,
    5634            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5635           10 :             SetupOutputVariable(state,
    5636              :                                 "Steam Equipment Total Heating Rate",
    5637              :                                 Constant::Units::W,
    5638            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).TotGainRate,
    5639              :                                 OutputProcessor::TimeStepType::Zone,
    5640              :                                 OutputProcessor::StoreType::Average,
    5641            5 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5642              :         }
    5643              : 
    5644              :         // Zone total report variables
    5645         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5646         5201 :             if (addZoneOutputs(zoneNum)) {
    5647           10 :                 SetupOutputVariable(state,
    5648              :                                     "Zone Steam Equipment District Heating Rate",
    5649              :                                     Constant::Units::W,
    5650            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamPower,
    5651              :                                     OutputProcessor::TimeStepType::Zone,
    5652              :                                     OutputProcessor::StoreType::Average,
    5653            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5654           10 :                 SetupOutputVariable(state,
    5655              :                                     "Zone Steam Equipment District Heating Energy",
    5656              :                                     Constant::Units::J,
    5657            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamConsump,
    5658              :                                     OutputProcessor::TimeStepType::Zone,
    5659              :                                     OutputProcessor::StoreType::Sum,
    5660            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5661              : 
    5662           10 :                 SetupOutputVariable(state,
    5663              :                                     "Zone Steam Equipment Radiant Heating Energy",
    5664              :                                     Constant::Units::J,
    5665            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamRadGain,
    5666              :                                     OutputProcessor::TimeStepType::Zone,
    5667              :                                     OutputProcessor::StoreType::Sum,
    5668            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5669           10 :                 SetupOutputVariable(state,
    5670              :                                     "Zone Steam Equipment Radiant Heating Rate",
    5671              :                                     Constant::Units::W,
    5672            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamRadGainRate,
    5673              :                                     OutputProcessor::TimeStepType::Zone,
    5674              :                                     OutputProcessor::StoreType::Average,
    5675            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5676           10 :                 SetupOutputVariable(state,
    5677              :                                     "Zone Steam Equipment Convective Heating Energy",
    5678              :                                     Constant::Units::J,
    5679            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamConGain,
    5680              :                                     OutputProcessor::TimeStepType::Zone,
    5681              :                                     OutputProcessor::StoreType::Sum,
    5682            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5683           10 :                 SetupOutputVariable(state,
    5684              :                                     "Zone Steam Equipment Convective Heating Rate",
    5685              :                                     Constant::Units::W,
    5686            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamConGainRate,
    5687              :                                     OutputProcessor::TimeStepType::Zone,
    5688              :                                     OutputProcessor::StoreType::Average,
    5689            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5690           10 :                 SetupOutputVariable(state,
    5691              :                                     "Zone Steam Equipment Latent Gain Energy",
    5692              :                                     Constant::Units::J,
    5693            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLatGain,
    5694              :                                     OutputProcessor::TimeStepType::Zone,
    5695              :                                     OutputProcessor::StoreType::Sum,
    5696            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5697           10 :                 SetupOutputVariable(state,
    5698              :                                     "Zone Steam Equipment Latent Gain Rate",
    5699              :                                     Constant::Units::W,
    5700            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLatGainRate,
    5701              :                                     OutputProcessor::TimeStepType::Zone,
    5702              :                                     OutputProcessor::StoreType::Average,
    5703            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5704           10 :                 SetupOutputVariable(state,
    5705              :                                     "Zone Steam Equipment Lost Heat Energy",
    5706              :                                     Constant::Units::J,
    5707            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLost,
    5708              :                                     OutputProcessor::TimeStepType::Zone,
    5709              :                                     OutputProcessor::StoreType::Sum,
    5710            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5711           10 :                 SetupOutputVariable(state,
    5712              :                                     "Zone Steam Equipment Lost Heat Rate",
    5713              :                                     Constant::Units::W,
    5714            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLostRate,
    5715              :                                     OutputProcessor::TimeStepType::Zone,
    5716              :                                     OutputProcessor::StoreType::Average,
    5717            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5718           10 :                 SetupOutputVariable(state,
    5719              :                                     "Zone Steam Equipment Total Heating Energy",
    5720              :                                     Constant::Units::J,
    5721            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamTotGain,
    5722              :                                     OutputProcessor::TimeStepType::Zone,
    5723              :                                     OutputProcessor::StoreType::Sum,
    5724            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5725           10 :                 SetupOutputVariable(state,
    5726              :                                     "Zone Steam Equipment Total Heating Rate",
    5727              :                                     Constant::Units::W,
    5728            5 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamTotGainRate,
    5729              :                                     OutputProcessor::TimeStepType::Zone,
    5730              :                                     OutputProcessor::StoreType::Average,
    5731            5 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5732              :             }
    5733              :             // Reset zone output flag
    5734         5201 :             addZoneOutputs(zoneNum) = false;
    5735              :         }
    5736              : 
    5737              :         // Space total report variables
    5738         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    5739         5213 :             if (addSpaceOutputs(spaceNum)) {
    5740           10 :                 SetupOutputVariable(state,
    5741              :                                     "Space Steam Equipment District Heating Rate",
    5742              :                                     Constant::Units::W,
    5743            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamPower,
    5744              :                                     OutputProcessor::TimeStepType::Zone,
    5745              :                                     OutputProcessor::StoreType::Average,
    5746            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5747           10 :                 SetupOutputVariable(state,
    5748              :                                     "Space Steam Equipment District Heating Energy",
    5749              :                                     Constant::Units::J,
    5750            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamConsump,
    5751              :                                     OutputProcessor::TimeStepType::Zone,
    5752              :                                     OutputProcessor::StoreType::Sum,
    5753            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5754              : 
    5755           10 :                 SetupOutputVariable(state,
    5756              :                                     "Space Steam Equipment Radiant Heating Energy",
    5757              :                                     Constant::Units::J,
    5758            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamRadGain,
    5759              :                                     OutputProcessor::TimeStepType::Zone,
    5760              :                                     OutputProcessor::StoreType::Sum,
    5761            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5762           10 :                 SetupOutputVariable(state,
    5763              :                                     "Space Steam Equipment Radiant Heating Rate",
    5764              :                                     Constant::Units::W,
    5765            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamRadGainRate,
    5766              :                                     OutputProcessor::TimeStepType::Zone,
    5767              :                                     OutputProcessor::StoreType::Average,
    5768            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5769           10 :                 SetupOutputVariable(state,
    5770              :                                     "Space Steam Equipment Convective Heating Energy",
    5771              :                                     Constant::Units::J,
    5772            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamConGain,
    5773              :                                     OutputProcessor::TimeStepType::Zone,
    5774              :                                     OutputProcessor::StoreType::Sum,
    5775            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5776           10 :                 SetupOutputVariable(state,
    5777              :                                     "Space Steam Equipment Convective Heating Rate",
    5778              :                                     Constant::Units::W,
    5779            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamConGainRate,
    5780              :                                     OutputProcessor::TimeStepType::Zone,
    5781              :                                     OutputProcessor::StoreType::Average,
    5782            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5783           10 :                 SetupOutputVariable(state,
    5784              :                                     "Space Steam Equipment Latent Gain Energy",
    5785              :                                     Constant::Units::J,
    5786            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLatGain,
    5787              :                                     OutputProcessor::TimeStepType::Zone,
    5788              :                                     OutputProcessor::StoreType::Sum,
    5789            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5790           10 :                 SetupOutputVariable(state,
    5791              :                                     "Space Steam Equipment Latent Gain Rate",
    5792              :                                     Constant::Units::W,
    5793            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLatGainRate,
    5794              :                                     OutputProcessor::TimeStepType::Zone,
    5795              :                                     OutputProcessor::StoreType::Average,
    5796            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5797           10 :                 SetupOutputVariable(state,
    5798              :                                     "Space Steam Equipment Lost Heat Energy",
    5799              :                                     Constant::Units::J,
    5800            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLost,
    5801              :                                     OutputProcessor::TimeStepType::Zone,
    5802              :                                     OutputProcessor::StoreType::Sum,
    5803            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5804           10 :                 SetupOutputVariable(state,
    5805              :                                     "Space Steam Equipment Lost Heat Rate",
    5806              :                                     Constant::Units::W,
    5807            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLostRate,
    5808              :                                     OutputProcessor::TimeStepType::Zone,
    5809              :                                     OutputProcessor::StoreType::Average,
    5810            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5811           10 :                 SetupOutputVariable(state,
    5812              :                                     "Space Steam Equipment Total Heating Energy",
    5813              :                                     Constant::Units::J,
    5814            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamTotGain,
    5815              :                                     OutputProcessor::TimeStepType::Zone,
    5816              :                                     OutputProcessor::StoreType::Sum,
    5817            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5818           10 :                 SetupOutputVariable(state,
    5819              :                                     "Space Steam Equipment Total Heating Rate",
    5820              :                                     Constant::Units::W,
    5821            5 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamTotGainRate,
    5822              :                                     OutputProcessor::TimeStepType::Zone,
    5823              :                                     OutputProcessor::StoreType::Average,
    5824            5 :                                     state.dataHeatBal->space(spaceNum).Name);
    5825              :             }
    5826              :             // Reset space output flag
    5827         5213 :             addSpaceOutputs(spaceNum) = false;
    5828              :         }
    5829              : 
    5830              :         // Object report variables
    5831          890 :         for (int othEqNum = 1; othEqNum <= state.dataHeatBal->TotOthEquip; ++othEqNum) {
    5832              :             // Set flags for zone and space total report variables
    5833           89 :             auto &zoneOtherEq = state.dataHeatBal->ZoneOtherEq(othEqNum);
    5834              : 
    5835           89 :             addZoneOutputs(zoneOtherEq.ZonePtr) = true;
    5836           89 :             addSpaceOutputs(zoneOtherEq.spaceIndex) = true;
    5837           89 :             if (zoneOtherEq.OtherEquipFuelType != Constant::eFuel::Invalid && zoneOtherEq.OtherEquipFuelType != Constant::eFuel::None) {
    5838           12 :                 SetupOutputVariable(state,
    5839            8 :                                     format("Other Equipment {} Rate", Constant::eFuelNames[(int)zoneOtherEq.OtherEquipFuelType]),
    5840              :                                     Constant::Units::W,
    5841            4 :                                     zoneOtherEq.Power,
    5842              :                                     OutputProcessor::TimeStepType::Zone,
    5843              :                                     OutputProcessor::StoreType::Average,
    5844            4 :                                     zoneOtherEq.Name);
    5845            8 :                 SetupOutputVariable(state,
    5846            8 :                                     format("Other Equipment {} Energy", Constant::eFuelNames[(int)zoneOtherEq.OtherEquipFuelType]),
    5847              :                                     Constant::Units::J,
    5848            4 :                                     zoneOtherEq.Consumption,
    5849              :                                     OutputProcessor::TimeStepType::Zone,
    5850              :                                     OutputProcessor::StoreType::Sum,
    5851            4 :                                     zoneOtherEq.Name,
    5852            4 :                                     Constant::eFuel2eResource[(int)zoneOtherEq.OtherEquipFuelType],
    5853              :                                     OutputProcessor::Group::Building,
    5854              :                                     OutputProcessor::EndUseCat::InteriorEquipment,
    5855              :                                     zoneOtherEq.EndUseSubcategory,
    5856            4 :                                     state.dataHeatBal->Zone(zoneOtherEq.ZonePtr).Name,
    5857            4 :                                     state.dataHeatBal->Zone(zoneOtherEq.ZonePtr).Multiplier,
    5858            4 :                                     state.dataHeatBal->Zone(zoneOtherEq.ZonePtr).ListMultiplier,
    5859            4 :                                     state.dataHeatBal->space(zoneOtherEq.spaceIndex).spaceType);
    5860              :             }
    5861              : 
    5862          178 :             SetupOutputVariable(state,
    5863              :                                 "Other Equipment Radiant Heating Energy",
    5864              :                                 Constant::Units::J,
    5865           89 :                                 zoneOtherEq.RadGainEnergy,
    5866              :                                 OutputProcessor::TimeStepType::Zone,
    5867              :                                 OutputProcessor::StoreType::Sum,
    5868           89 :                                 zoneOtherEq.Name);
    5869          178 :             SetupOutputVariable(state,
    5870              :                                 "Other Equipment Radiant Heating Rate",
    5871              :                                 Constant::Units::W,
    5872           89 :                                 zoneOtherEq.RadGainRate,
    5873              :                                 OutputProcessor::TimeStepType::Zone,
    5874              :                                 OutputProcessor::StoreType::Average,
    5875           89 :                                 zoneOtherEq.Name);
    5876          178 :             SetupOutputVariable(state,
    5877              :                                 "Other Equipment Convective Heating Energy",
    5878              :                                 Constant::Units::J,
    5879           89 :                                 zoneOtherEq.ConGainEnergy,
    5880              :                                 OutputProcessor::TimeStepType::Zone,
    5881              :                                 OutputProcessor::StoreType::Sum,
    5882           89 :                                 zoneOtherEq.Name);
    5883          178 :             SetupOutputVariable(state,
    5884              :                                 "Other Equipment Convective Heating Rate",
    5885              :                                 Constant::Units::W,
    5886           89 :                                 zoneOtherEq.ConGainRate,
    5887              :                                 OutputProcessor::TimeStepType::Zone,
    5888              :                                 OutputProcessor::StoreType::Average,
    5889           89 :                                 zoneOtherEq.Name);
    5890          178 :             SetupOutputVariable(state,
    5891              :                                 "Other Equipment Latent Gain Energy",
    5892              :                                 Constant::Units::J,
    5893           89 :                                 zoneOtherEq.LatGainEnergy,
    5894              :                                 OutputProcessor::TimeStepType::Zone,
    5895              :                                 OutputProcessor::StoreType::Sum,
    5896           89 :                                 zoneOtherEq.Name);
    5897          178 :             SetupOutputVariable(state,
    5898              :                                 "Other Equipment Latent Gain Rate",
    5899              :                                 Constant::Units::W,
    5900           89 :                                 zoneOtherEq.LatGainRate,
    5901              :                                 OutputProcessor::TimeStepType::Zone,
    5902              :                                 OutputProcessor::StoreType::Average,
    5903           89 :                                 zoneOtherEq.Name);
    5904          178 :             SetupOutputVariable(state,
    5905              :                                 "Other Equipment Lost Heat Energy",
    5906              :                                 Constant::Units::J,
    5907           89 :                                 zoneOtherEq.LostEnergy,
    5908              :                                 OutputProcessor::TimeStepType::Zone,
    5909              :                                 OutputProcessor::StoreType::Sum,
    5910           89 :                                 zoneOtherEq.Name);
    5911          178 :             SetupOutputVariable(state,
    5912              :                                 "Other Equipment Lost Heat Rate",
    5913              :                                 Constant::Units::W,
    5914           89 :                                 zoneOtherEq.LostRate,
    5915              :                                 OutputProcessor::TimeStepType::Zone,
    5916              :                                 OutputProcessor::StoreType::Average,
    5917           89 :                                 zoneOtherEq.Name);
    5918          178 :             SetupOutputVariable(state,
    5919              :                                 "Other Equipment Total Heating Energy",
    5920              :                                 Constant::Units::J,
    5921           89 :                                 zoneOtherEq.TotGainEnergy,
    5922              :                                 OutputProcessor::TimeStepType::Zone,
    5923              :                                 OutputProcessor::StoreType::Sum,
    5924           89 :                                 zoneOtherEq.Name);
    5925          178 :             SetupOutputVariable(state,
    5926              :                                 "Other Equipment Total Heating Rate",
    5927              :                                 Constant::Units::W,
    5928           89 :                                 zoneOtherEq.TotGainRate,
    5929              :                                 OutputProcessor::TimeStepType::Zone,
    5930              :                                 OutputProcessor::StoreType::Average,
    5931           89 :                                 zoneOtherEq.Name);
    5932              :         }
    5933              : 
    5934              :         // Zone total report variables
    5935         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5936         5201 :             if (addZoneOutputs(zoneNum)) {
    5937           44 :                 for (size_t i = 0; i < state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums.size(); ++i) {
    5938            4 :                     Constant::eFuel fuelType = state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums[i];
    5939            4 :                     if (fuelType == Constant::eFuel::Invalid || fuelType == Constant::eFuel::None) {
    5940            0 :                         continue;
    5941              :                     }
    5942              : 
    5943            4 :                     std::string_view fuelName = Constant::eFuelNames[(int)state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums[i]];
    5944              : 
    5945           12 :                     SetupOutputVariable(state,
    5946            8 :                                         format("Zone Other Equipment {} Rate", fuelName),
    5947              :                                         Constant::Units::W,
    5948            4 :                                         state.dataHeatBal->ZoneRpt(zoneNum).OtherPower[(int)fuelType],
    5949              :                                         OutputProcessor::TimeStepType::Zone,
    5950              :                                         OutputProcessor::StoreType::Average,
    5951            4 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    5952           12 :                     SetupOutputVariable(state,
    5953            8 :                                         format("Zone Other Equipment {} Energy", fuelName),
    5954              :                                         Constant::Units::J,
    5955            4 :                                         state.dataHeatBal->ZoneRpt(zoneNum).OtherConsump[(int)fuelType],
    5956              :                                         OutputProcessor::TimeStepType::Zone,
    5957              :                                         OutputProcessor::StoreType::Sum,
    5958            4 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    5959              :                 }
    5960              : 
    5961           80 :                 SetupOutputVariable(state,
    5962              :                                     "Zone Other Equipment Radiant Heating Energy",
    5963              :                                     Constant::Units::J,
    5964           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherRadGain,
    5965              :                                     OutputProcessor::TimeStepType::Zone,
    5966              :                                     OutputProcessor::StoreType::Sum,
    5967           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5968           80 :                 SetupOutputVariable(state,
    5969              :                                     "Zone Other Equipment Radiant Heating Rate",
    5970              :                                     Constant::Units::W,
    5971           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherRadGainRate,
    5972              :                                     OutputProcessor::TimeStepType::Zone,
    5973              :                                     OutputProcessor::StoreType::Average,
    5974           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5975           80 :                 SetupOutputVariable(state,
    5976              :                                     "Zone Other Equipment Convective Heating Energy",
    5977              :                                     Constant::Units::J,
    5978           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherConGain,
    5979              :                                     OutputProcessor::TimeStepType::Zone,
    5980              :                                     OutputProcessor::StoreType::Sum,
    5981           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5982           80 :                 SetupOutputVariable(state,
    5983              :                                     "Zone Other Equipment Convective Heating Rate",
    5984              :                                     Constant::Units::W,
    5985           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherConGainRate,
    5986              :                                     OutputProcessor::TimeStepType::Zone,
    5987              :                                     OutputProcessor::StoreType::Average,
    5988           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5989           80 :                 SetupOutputVariable(state,
    5990              :                                     "Zone Other Equipment Latent Gain Energy",
    5991              :                                     Constant::Units::J,
    5992           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLatGain,
    5993              :                                     OutputProcessor::TimeStepType::Zone,
    5994              :                                     OutputProcessor::StoreType::Sum,
    5995           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5996           80 :                 SetupOutputVariable(state,
    5997              :                                     "Zone Other Equipment Latent Gain Rate",
    5998              :                                     Constant::Units::W,
    5999           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLatGainRate,
    6000              :                                     OutputProcessor::TimeStepType::Zone,
    6001              :                                     OutputProcessor::StoreType::Average,
    6002           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6003           80 :                 SetupOutputVariable(state,
    6004              :                                     "Zone Other Equipment Lost Heat Energy",
    6005              :                                     Constant::Units::J,
    6006           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLost,
    6007              :                                     OutputProcessor::TimeStepType::Zone,
    6008              :                                     OutputProcessor::StoreType::Sum,
    6009           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6010           80 :                 SetupOutputVariable(state,
    6011              :                                     "Zone Other Equipment Lost Heat Rate",
    6012              :                                     Constant::Units::W,
    6013           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLostRate,
    6014              :                                     OutputProcessor::TimeStepType::Zone,
    6015              :                                     OutputProcessor::StoreType::Average,
    6016           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6017           80 :                 SetupOutputVariable(state,
    6018              :                                     "Zone Other Equipment Total Heating Energy",
    6019              :                                     Constant::Units::J,
    6020           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherTotGain,
    6021              :                                     OutputProcessor::TimeStepType::Zone,
    6022              :                                     OutputProcessor::StoreType::Sum,
    6023           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6024           80 :                 SetupOutputVariable(state,
    6025              :                                     "Zone Other Equipment Total Heating Rate",
    6026              :                                     Constant::Units::W,
    6027           40 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherTotGainRate,
    6028              :                                     OutputProcessor::TimeStepType::Zone,
    6029              :                                     OutputProcessor::StoreType::Average,
    6030           40 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6031              :             }
    6032              :             // Reset zone output flag
    6033         5201 :             addZoneOutputs(zoneNum) = false;
    6034              :         }
    6035              : 
    6036              :         // Space total report variables
    6037         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    6038         5213 :             if (addSpaceOutputs(spaceNum)) {
    6039           44 :                 for (size_t i = 0; i < state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums.size(); ++i) {
    6040            4 :                     Constant::eFuel fuelType = state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums[i];
    6041            4 :                     if (fuelType == Constant::eFuel::Invalid || fuelType == Constant::eFuel::None) {
    6042            0 :                         continue;
    6043              :                     }
    6044              : 
    6045           12 :                     SetupOutputVariable(state,
    6046            8 :                                         format("Space Other Equipment {} Rate", Constant::eFuelNames[(int)fuelType]),
    6047              :                                         Constant::Units::W,
    6048            4 :                                         state.dataHeatBal->spaceRpt(spaceNum).OtherPower[(int)fuelType],
    6049              :                                         OutputProcessor::TimeStepType::Zone,
    6050              :                                         OutputProcessor::StoreType::Average,
    6051            4 :                                         state.dataHeatBal->space(spaceNum).Name);
    6052           12 :                     SetupOutputVariable(state,
    6053            8 :                                         format("Space Other Equipment {} Energy", Constant::eFuelNames[(int)fuelType]),
    6054              :                                         Constant::Units::J,
    6055            4 :                                         state.dataHeatBal->spaceRpt(spaceNum).OtherConsump[(int)fuelType],
    6056              :                                         OutputProcessor::TimeStepType::Zone,
    6057              :                                         OutputProcessor::StoreType::Sum,
    6058            4 :                                         state.dataHeatBal->space(spaceNum).Name);
    6059              :                 }
    6060              : 
    6061           80 :                 SetupOutputVariable(state,
    6062              :                                     "Space Other Equipment Radiant Heating Energy",
    6063              :                                     Constant::Units::J,
    6064           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherRadGain,
    6065              :                                     OutputProcessor::TimeStepType::Zone,
    6066              :                                     OutputProcessor::StoreType::Sum,
    6067           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6068           80 :                 SetupOutputVariable(state,
    6069              :                                     "Space Other Equipment Radiant Heating Rate",
    6070              :                                     Constant::Units::W,
    6071           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherRadGainRate,
    6072              :                                     OutputProcessor::TimeStepType::Zone,
    6073              :                                     OutputProcessor::StoreType::Average,
    6074           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6075           80 :                 SetupOutputVariable(state,
    6076              :                                     "Space Other Equipment Convective Heating Energy",
    6077              :                                     Constant::Units::J,
    6078           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherConGain,
    6079              :                                     OutputProcessor::TimeStepType::Zone,
    6080              :                                     OutputProcessor::StoreType::Sum,
    6081           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6082           80 :                 SetupOutputVariable(state,
    6083              :                                     "Space Other Equipment Convective Heating Rate",
    6084              :                                     Constant::Units::W,
    6085           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherConGainRate,
    6086              :                                     OutputProcessor::TimeStepType::Zone,
    6087              :                                     OutputProcessor::StoreType::Average,
    6088           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6089           80 :                 SetupOutputVariable(state,
    6090              :                                     "Space Other Equipment Latent Gain Energy",
    6091              :                                     Constant::Units::J,
    6092           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLatGain,
    6093              :                                     OutputProcessor::TimeStepType::Zone,
    6094              :                                     OutputProcessor::StoreType::Sum,
    6095           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6096           80 :                 SetupOutputVariable(state,
    6097              :                                     "Space Other Equipment Latent Gain Rate",
    6098              :                                     Constant::Units::W,
    6099           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLatGainRate,
    6100              :                                     OutputProcessor::TimeStepType::Zone,
    6101              :                                     OutputProcessor::StoreType::Average,
    6102           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6103           80 :                 SetupOutputVariable(state,
    6104              :                                     "Space Other Equipment Lost Heat Energy",
    6105              :                                     Constant::Units::J,
    6106           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLost,
    6107              :                                     OutputProcessor::TimeStepType::Zone,
    6108              :                                     OutputProcessor::StoreType::Sum,
    6109           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6110           80 :                 SetupOutputVariable(state,
    6111              :                                     "Space Other Equipment Lost Heat Rate",
    6112              :                                     Constant::Units::W,
    6113           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLostRate,
    6114              :                                     OutputProcessor::TimeStepType::Zone,
    6115              :                                     OutputProcessor::StoreType::Average,
    6116           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6117           80 :                 SetupOutputVariable(state,
    6118              :                                     "Space Other Equipment Total Heating Energy",
    6119              :                                     Constant::Units::J,
    6120           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherTotGain,
    6121              :                                     OutputProcessor::TimeStepType::Zone,
    6122              :                                     OutputProcessor::StoreType::Sum,
    6123           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6124           80 :                 SetupOutputVariable(state,
    6125              :                                     "Space Other Equipment Total Heating Rate",
    6126              :                                     Constant::Units::W,
    6127           40 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherTotGainRate,
    6128              :                                     OutputProcessor::TimeStepType::Zone,
    6129              :                                     OutputProcessor::StoreType::Average,
    6130           40 :                                     state.dataHeatBal->space(spaceNum).Name);
    6131              :             }
    6132              :             // Reset space output flag
    6133         5213 :             addSpaceOutputs(spaceNum) = false;
    6134              :         }
    6135              :         // Object report variables
    6136          808 :         for (int itEqNum = 1; itEqNum <= state.dataHeatBal->TotITEquip; ++itEqNum) {
    6137              :             // Set flags for zone and space total report variables
    6138            7 :             addZoneOutputs(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr) = true;
    6139            7 :             addSpaceOutputs(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex) = true;
    6140              : 
    6141            7 :             constexpr std::array<std::string_view, (int)PERptVars::Num> PowerOutputVariableStrings = {
    6142              :                 "ITE CPU Electricity Rate",
    6143              :                 "ITE Fan Electricity Rate",
    6144              :                 "ITE UPS Electricity Rate",
    6145              :                 "ITE CPU Electricity Rate at Design Inlet Conditions",
    6146              :                 "ITE Fan Electricity Rate at Design Inlet Conditions",
    6147              :                 "ITE UPS Heat Gain to Zone Rate",
    6148              :                 "ITE Total Heat Gain to Zone Rate"};
    6149              : 
    6150           56 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6151           98 :                 SetupOutputVariable(state,
    6152           49 :                                     PowerOutputVariableStrings[i],
    6153              :                                     Constant::Units::W,
    6154           49 :                                     state.dataHeatBal->ZoneITEq(itEqNum).PowerRpt[i],
    6155              :                                     OutputProcessor::TimeStepType::Zone,
    6156              :                                     OutputProcessor::StoreType::Average,
    6157           49 :                                     state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6158              :             }
    6159              : 
    6160           14 :             SetupOutputVariable(state,
    6161              :                                 "ITE CPU Electricity Energy",
    6162              :                                 Constant::Units::J,
    6163            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::CPU],
    6164              :                                 OutputProcessor::TimeStepType::Zone,
    6165              :                                 OutputProcessor::StoreType::Sum,
    6166            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name,
    6167              :                                 Constant::eResource::Electricity,
    6168              :                                 OutputProcessor::Group::Building,
    6169              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6170            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EndUseSubcategoryCPU,
    6171            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Name,
    6172            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Multiplier,
    6173            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).ListMultiplier,
    6174            7 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex).spaceType);
    6175              : 
    6176           14 :             SetupOutputVariable(state,
    6177              :                                 "ITE Fan Electricity Energy",
    6178              :                                 Constant::Units::J,
    6179            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::Fan],
    6180              :                                 OutputProcessor::TimeStepType::Zone,
    6181              :                                 OutputProcessor::StoreType::Sum,
    6182            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name,
    6183              :                                 Constant::eResource::Electricity,
    6184              :                                 OutputProcessor::Group::Building,
    6185              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6186            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EndUseSubcategoryFan,
    6187            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Name,
    6188            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Multiplier,
    6189            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).ListMultiplier,
    6190            7 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex).spaceType);
    6191           14 :             SetupOutputVariable(state,
    6192              :                                 "ITE UPS Electricity Energy",
    6193              :                                 Constant::Units::J,
    6194            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::UPS],
    6195              :                                 OutputProcessor::TimeStepType::Zone,
    6196              :                                 OutputProcessor::StoreType::Sum,
    6197            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name,
    6198              :                                 Constant::eResource::Electricity,
    6199              :                                 OutputProcessor::Group::Building,
    6200              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6201            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EndUseSubcategoryUPS,
    6202            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Name,
    6203            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Multiplier,
    6204            7 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).ListMultiplier,
    6205            7 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex).spaceType);
    6206           14 :             SetupOutputVariable(state,
    6207              :                                 "ITE CPU Electricity Energy at Design Inlet Conditions",
    6208              :                                 Constant::Units::J,
    6209            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::CPUAtDesign],
    6210              :                                 OutputProcessor::TimeStepType::Zone,
    6211              :                                 OutputProcessor::StoreType::Sum,
    6212            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6213           14 :             SetupOutputVariable(state,
    6214              :                                 "ITE Fan Electricity Energy at Design Inlet Conditions",
    6215              :                                 Constant::Units::J,
    6216            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::FanAtDesign],
    6217              :                                 OutputProcessor::TimeStepType::Zone,
    6218              :                                 OutputProcessor::StoreType::Sum,
    6219            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6220           14 :             SetupOutputVariable(state,
    6221              :                                 "ITE UPS Heat Gain to Zone Energy",
    6222              :                                 Constant::Units::J,
    6223            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::UPSGainToZone],
    6224              :                                 OutputProcessor::TimeStepType::Zone,
    6225              :                                 OutputProcessor::StoreType::Sum,
    6226            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6227           14 :             SetupOutputVariable(state,
    6228              :                                 "ITE Total Heat Gain to Zone Energy",
    6229              :                                 Constant::Units::J,
    6230            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::ConGainToZone],
    6231              :                                 OutputProcessor::TimeStepType::Zone,
    6232              :                                 OutputProcessor::StoreType::Sum,
    6233            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6234              : 
    6235           14 :             SetupOutputVariable(state,
    6236              :                                 "ITE Standard Density Air Volume Flow Rate",
    6237              :                                 Constant::Units::m3_s,
    6238            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirVolFlowStdDensity,
    6239              :                                 OutputProcessor::TimeStepType::Zone,
    6240              :                                 OutputProcessor::StoreType::Average,
    6241            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6242           14 :             SetupOutputVariable(state,
    6243              :                                 "ITE Current Density Air Volume Flow Rate",
    6244              :                                 Constant::Units::m3_s,
    6245            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirVolFlowCurDensity,
    6246              :                                 OutputProcessor::TimeStepType::Zone,
    6247              :                                 OutputProcessor::StoreType::Average,
    6248            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6249           14 :             SetupOutputVariable(state,
    6250              :                                 "ITE Air Mass Flow Rate",
    6251              :                                 Constant::Units::kg_s,
    6252            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirMassFlow,
    6253              :                                 OutputProcessor::TimeStepType::Zone,
    6254              :                                 OutputProcessor::StoreType::Average,
    6255            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6256           14 :             SetupOutputVariable(state,
    6257              :                                 "ITE Air Inlet Dry-Bulb Temperature",
    6258              :                                 Constant::Units::C,
    6259            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirInletDryBulbT,
    6260              :                                 OutputProcessor::TimeStepType::Zone,
    6261              :                                 OutputProcessor::StoreType::Average,
    6262            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6263           14 :             SetupOutputVariable(state,
    6264              :                                 "ITE Air Inlet Dewpoint Temperature",
    6265              :                                 Constant::Units::C,
    6266            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirInletDewpointT,
    6267              :                                 OutputProcessor::TimeStepType::Zone,
    6268              :                                 OutputProcessor::StoreType::Average,
    6269            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6270           14 :             SetupOutputVariable(state,
    6271              :                                 "ITE Air Inlet Relative Humidity",
    6272              :                                 Constant::Units::Perc,
    6273            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirInletRelHum,
    6274              :                                 OutputProcessor::TimeStepType::Zone,
    6275              :                                 OutputProcessor::StoreType::Average,
    6276            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6277           14 :             SetupOutputVariable(state,
    6278              :                                 "ITE Air Outlet Dry-Bulb Temperature",
    6279              :                                 Constant::Units::C,
    6280            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirOutletDryBulbT,
    6281              :                                 OutputProcessor::TimeStepType::Zone,
    6282              :                                 OutputProcessor::StoreType::Average,
    6283            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6284            7 :             if (state.dataHeatBal->ZoneITEq(itEqNum).SupplyAirNodeNum != 0) {
    6285           14 :                 SetupOutputVariable(state,
    6286              :                                     "ITE Supply Heat Index",
    6287              :                                     Constant::Units::None,
    6288            7 :                                     state.dataHeatBal->ZoneITEq(itEqNum).SHI,
    6289              :                                     OutputProcessor::TimeStepType::Zone,
    6290              :                                     OutputProcessor::StoreType::Average,
    6291            7 :                                     state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6292              :             }
    6293           14 :             SetupOutputVariable(state,
    6294              :                                 "ITE Air Inlet Operating Range Exceeded Time",
    6295              :                                 Constant::Units::hr,
    6296            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeOutOfOperRange,
    6297              :                                 OutputProcessor::TimeStepType::Zone,
    6298              :                                 OutputProcessor::StoreType::Sum,
    6299            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6300           14 :             SetupOutputVariable(state,
    6301              :                                 "ITE Air Inlet Dry-Bulb Temperature Above Operating Range Time",
    6302              :                                 Constant::Units::hr,
    6303            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeAboveDryBulbT,
    6304              :                                 OutputProcessor::TimeStepType::Zone,
    6305              :                                 OutputProcessor::StoreType::Sum,
    6306            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6307           14 :             SetupOutputVariable(state,
    6308              :                                 "ITE Air Inlet Dry-Bulb Temperature Below Operating Range Time",
    6309              :                                 Constant::Units::hr,
    6310            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeBelowDryBulbT,
    6311              :                                 OutputProcessor::TimeStepType::Zone,
    6312              :                                 OutputProcessor::StoreType::Sum,
    6313            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6314           14 :             SetupOutputVariable(state,
    6315              :                                 "ITE Air Inlet Dewpoint Temperature Above Operating Range Time",
    6316              :                                 Constant::Units::hr,
    6317            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeAboveDewpointT,
    6318              :                                 OutputProcessor::TimeStepType::Zone,
    6319              :                                 OutputProcessor::StoreType::Sum,
    6320            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6321           14 :             SetupOutputVariable(state,
    6322              :                                 "ITE Air Inlet Dewpoint Temperature Below Operating Range Time",
    6323              :                                 Constant::Units::hr,
    6324            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeBelowDewpointT,
    6325              :                                 OutputProcessor::TimeStepType::Zone,
    6326              :                                 OutputProcessor::StoreType::Sum,
    6327            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6328           14 :             SetupOutputVariable(state,
    6329              :                                 "ITE Air Inlet Relative Humidity Above Operating Range Time",
    6330              :                                 Constant::Units::hr,
    6331            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeAboveRH,
    6332              :                                 OutputProcessor::TimeStepType::Zone,
    6333              :                                 OutputProcessor::StoreType::Sum,
    6334            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6335           14 :             SetupOutputVariable(state,
    6336              :                                 "ITE Air Inlet Relative Humidity Below Operating Range Time",
    6337              :                                 Constant::Units::hr,
    6338            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeBelowRH,
    6339              :                                 OutputProcessor::TimeStepType::Zone,
    6340              :                                 OutputProcessor::StoreType::Sum,
    6341            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6342           14 :             SetupOutputVariable(state,
    6343              :                                 "ITE Air Inlet Dry-Bulb Temperature Difference Above Operating Range",
    6344              :                                 Constant::Units::deltaC,
    6345            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DryBulbTAboveDeltaT,
    6346              :                                 OutputProcessor::TimeStepType::Zone,
    6347              :                                 OutputProcessor::StoreType::Average,
    6348            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6349           14 :             SetupOutputVariable(state,
    6350              :                                 "ITE Air Inlet Dry-Bulb Temperature Difference Below Operating Range",
    6351              :                                 Constant::Units::deltaC,
    6352            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DryBulbTBelowDeltaT,
    6353              :                                 OutputProcessor::TimeStepType::Zone,
    6354              :                                 OutputProcessor::StoreType::Average,
    6355            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6356           14 :             SetupOutputVariable(state,
    6357              :                                 "ITE Air Inlet Dewpoint Temperature Difference Above Operating Range",
    6358              :                                 Constant::Units::deltaC,
    6359            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DewpointTAboveDeltaT,
    6360              :                                 OutputProcessor::TimeStepType::Zone,
    6361              :                                 OutputProcessor::StoreType::Average,
    6362            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6363           14 :             SetupOutputVariable(state,
    6364              :                                 "ITE Air Inlet Dewpoint Temperature Difference Below Operating Range",
    6365              :                                 Constant::Units::deltaC,
    6366            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DewpointTBelowDeltaT,
    6367              :                                 OutputProcessor::TimeStepType::Zone,
    6368              :                                 OutputProcessor::StoreType::Average,
    6369            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6370           14 :             SetupOutputVariable(state,
    6371              :                                 "ITE Air Inlet Relative Humidity Difference Above Operating Range",
    6372              :                                 Constant::Units::Perc,
    6373            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).RHAboveDeltaRH,
    6374              :                                 OutputProcessor::TimeStepType::Zone,
    6375              :                                 OutputProcessor::StoreType::Average,
    6376            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6377           14 :             SetupOutputVariable(state,
    6378              :                                 "ITE Air Inlet Relative Humidity Difference Below Operating Range",
    6379              :                                 Constant::Units::Perc,
    6380            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).RHBelowDeltaRH,
    6381              :                                 OutputProcessor::TimeStepType::Zone,
    6382              :                                 OutputProcessor::StoreType::Average,
    6383            7 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6384              :         }
    6385              : 
    6386              :         // Zone total report variables
    6387         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    6388         5201 :             if (addZoneOutputs(zoneNum)) {
    6389              : 
    6390            7 :                 constexpr std::array<std::string_view, (int)PERptVars::Num> PowerOutputVariableStrings = {
    6391              :                     "Zone ITE CPU Electricity Rate",
    6392              :                     "Zone ITE Fan Electricity Rate",
    6393              :                     "Zone ITE UPS Electricity Rate",
    6394              :                     "Zone ITE CPU Electricity Rate at Design Inlet Conditions",
    6395              :                     "Zone ITE Fan Electricity Rate at Design Inlet Conditions",
    6396              :                     "Zone ITE UPS Heat Gain to Zone Rate",
    6397              :                     "Zone ITE Total Heat Gain to Zone Rate"};
    6398              : 
    6399           56 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6400           98 :                     SetupOutputVariable(state,
    6401           49 :                                         PowerOutputVariableStrings[i],
    6402              :                                         Constant::Units::W,
    6403           49 :                                         state.dataHeatBal->ZoneRpt(zoneNum).PowerRpt[i],
    6404              :                                         OutputProcessor::TimeStepType::Zone,
    6405              :                                         OutputProcessor::StoreType::Average,
    6406           49 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    6407              :                 }
    6408              : 
    6409           14 :                 SetupOutputVariable(state,
    6410              :                                     "Zone ITE Adjusted Return Air Temperature",
    6411              :                                     Constant::Units::C,
    6412            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEAdjReturnTemp,
    6413              :                                     OutputProcessor::TimeStepType::Zone,
    6414              :                                     OutputProcessor::StoreType::Average,
    6415            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6416              : 
    6417            7 :                 constexpr std::array<std::string_view, (int)PERptVars::Num> EnergyOutputVariableStrings = {
    6418              :                     "Zone ITE CPU Electricity Energy",
    6419              :                     "Zone ITE Fan Electricity Energy",
    6420              :                     "Zone ITE UPS Electricity Energy",
    6421              :                     "Zone ITE CPU Electricity Energy at Design Inlet Conditions",
    6422              :                     "Zone ITE Fan Electricity Energy at Design Inlet Conditions",
    6423              :                     "Zone ITE UPS Heat Gain to Zone Energy",
    6424              :                     "Zone ITE Total Heat Gain to Zone Energy"};
    6425              : 
    6426           56 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6427           98 :                     SetupOutputVariable(state,
    6428           49 :                                         EnergyOutputVariableStrings[i],
    6429              :                                         Constant::Units::J,
    6430           49 :                                         state.dataHeatBal->ZoneRpt(zoneNum).EnergyRpt[i],
    6431              :                                         OutputProcessor::TimeStepType::Zone,
    6432              :                                         OutputProcessor::StoreType::Sum,
    6433           49 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    6434              :                 }
    6435              : 
    6436           14 :                 SetupOutputVariable(state,
    6437              :                                     "Zone ITE Standard Density Air Volume Flow Rate",
    6438              :                                     Constant::Units::m3_s,
    6439            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqAirVolFlowStdDensity,
    6440              :                                     OutputProcessor::TimeStepType::Zone,
    6441              :                                     OutputProcessor::StoreType::Average,
    6442            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6443           14 :                 SetupOutputVariable(state,
    6444              :                                     "Zone ITE Air Mass Flow Rate",
    6445              :                                     Constant::Units::kg_s,
    6446            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqAirMassFlow,
    6447              :                                     OutputProcessor::TimeStepType::Zone,
    6448              :                                     OutputProcessor::StoreType::Average,
    6449            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6450           14 :                 SetupOutputVariable(state,
    6451              :                                     "Zone ITE Average Supply Heat Index",
    6452              :                                     Constant::Units::None,
    6453            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqSHI,
    6454              :                                     OutputProcessor::TimeStepType::Zone,
    6455              :                                     OutputProcessor::StoreType::Average,
    6456            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6457           14 :                 SetupOutputVariable(state,
    6458              :                                     "Zone ITE Any Air Inlet Operating Range Exceeded Time",
    6459              :                                     Constant::Units::hr,
    6460            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeOutOfOperRange,
    6461              :                                     OutputProcessor::TimeStepType::Zone,
    6462              :                                     OutputProcessor::StoreType::Sum,
    6463            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6464           14 :                 SetupOutputVariable(state,
    6465              :                                     "Zone ITE Any Air Inlet Dry-Bulb Temperature Above Operating Range Time",
    6466              :                                     Constant::Units::hr,
    6467            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeAboveDryBulbT,
    6468              :                                     OutputProcessor::TimeStepType::Zone,
    6469              :                                     OutputProcessor::StoreType::Sum,
    6470            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6471           14 :                 SetupOutputVariable(state,
    6472              :                                     "Zone ITE Any Air Inlet Dry-Bulb Temperature Below Operating Range Time",
    6473              :                                     Constant::Units::hr,
    6474            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeBelowDryBulbT,
    6475              :                                     OutputProcessor::TimeStepType::Zone,
    6476              :                                     OutputProcessor::StoreType::Sum,
    6477            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6478           14 :                 SetupOutputVariable(state,
    6479              :                                     "Zone ITE Any Air Inlet Dewpoint Temperature Above Operating Range Time",
    6480              :                                     Constant::Units::hr,
    6481            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeAboveDewpointT,
    6482              :                                     OutputProcessor::TimeStepType::Zone,
    6483              :                                     OutputProcessor::StoreType::Sum,
    6484            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6485           14 :                 SetupOutputVariable(state,
    6486              :                                     "Zone ITE Any Air Inlet Dewpoint Temperature Below Operating Range Time",
    6487              :                                     Constant::Units::hr,
    6488            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeBelowDewpointT,
    6489              :                                     OutputProcessor::TimeStepType::Zone,
    6490              :                                     OutputProcessor::StoreType::Sum,
    6491            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6492           14 :                 SetupOutputVariable(state,
    6493              :                                     "Zone ITE Any Air Inlet Relative Humidity Above Operating Range Time",
    6494              :                                     Constant::Units::hr,
    6495            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeAboveRH,
    6496              :                                     OutputProcessor::TimeStepType::Zone,
    6497              :                                     OutputProcessor::StoreType::Sum,
    6498            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6499           14 :                 SetupOutputVariable(state,
    6500              :                                     "Zone ITE Any Air Inlet Relative Humidity Below Operating Range Time",
    6501              :                                     Constant::Units::hr,
    6502            7 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeBelowRH,
    6503              :                                     OutputProcessor::TimeStepType::Zone,
    6504              :                                     OutputProcessor::StoreType::Sum,
    6505            7 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6506              :             }
    6507              :             // Reset zone output flag
    6508         5201 :             addZoneOutputs(zoneNum) = false;
    6509              :         }
    6510              : 
    6511              :         // Space total report variables
    6512         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    6513         5213 :             if (addSpaceOutputs(spaceNum)) {
    6514            7 :                 constexpr std::array<std::string_view, (int)PERptVars::Num> PowerOutputVariableStrings = {
    6515              :                     "Space ITE CPU Electricity Rate",
    6516              :                     "Space ITE Fan Electricity Rate",
    6517              :                     "Space ITE UPS Electricity Rate",
    6518              :                     "Space ITE CPU Electricity Rate at Design Inlet Conditions",
    6519              :                     "Space ITE Fan Electricity Rate at Design Inlet Conditions",
    6520              :                     "Space ITE UPS Heat Gain to Zone Rate",
    6521              :                     "Space ITE Total Heat Gain to Zone Rate"};
    6522              : 
    6523           56 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6524           98 :                     SetupOutputVariable(state,
    6525           49 :                                         PowerOutputVariableStrings[i],
    6526              :                                         Constant::Units::W,
    6527           49 :                                         state.dataHeatBal->spaceRpt(spaceNum).PowerRpt[i],
    6528              :                                         OutputProcessor::TimeStepType::Zone,
    6529              :                                         OutputProcessor::StoreType::Average,
    6530           49 :                                         state.dataHeatBal->space(spaceNum).Name);
    6531              :                 }
    6532              : 
    6533              :                 // Not applicable for space until space has it's own air temperatures
    6534              :                 // Setup Output Variable(state,
    6535              :                 //                    "Space ITE Adjusted Return Air Temperature",
    6536              :                 //                    Constant::Units::W,
    6537              :                 //                    state.dataHeatBal->spaceRpt(spaceNum).ITEAdjReturnTemp,
    6538              :                 //                    OutputProcessor::TimeStepType::Zone,
    6539              :                 //                    OutputProcessor::StoreType::Average,
    6540              :                 //                    state.dataHeatBal->space(spaceNum).Name);
    6541              : 
    6542            7 :                 constexpr std::array<std::string_view, (int)PERptVars::Num> EnergyOutputVariableStrings = {
    6543              :                     "Space ITE CPU Electricity Energy",
    6544              :                     "Space ITE Fan Electricity Energy",
    6545              :                     "Space ITE UPS Electricity Energy",
    6546              :                     "Space ITE CPU Electricity Energy at Design Inlet Conditions",
    6547              :                     "Space ITE Fan Electricity Energy at Design Inlet Conditions",
    6548              :                     "Space ITE UPS Heat Gain to Zone Energy",
    6549              :                     "Space ITE Total Heat Gain to Zone Energy"};
    6550              : 
    6551           56 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6552           98 :                     SetupOutputVariable(state,
    6553           49 :                                         EnergyOutputVariableStrings[i],
    6554              :                                         Constant::Units::J,
    6555           49 :                                         state.dataHeatBal->spaceRpt(spaceNum).EnergyRpt[i],
    6556              :                                         OutputProcessor::TimeStepType::Zone,
    6557              :                                         OutputProcessor::StoreType::Sum,
    6558           49 :                                         state.dataHeatBal->space(spaceNum).Name);
    6559              :                 }
    6560              : 
    6561           14 :                 SetupOutputVariable(state,
    6562              :                                     "Space ITE Standard Density Air Volume Flow Rate",
    6563              :                                     Constant::Units::m3_s,
    6564            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqAirVolFlowStdDensity,
    6565              :                                     OutputProcessor::TimeStepType::Zone,
    6566              :                                     OutputProcessor::StoreType::Average,
    6567            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6568           14 :                 SetupOutputVariable(state,
    6569              :                                     "Space ITE Air Mass Flow Rate",
    6570              :                                     Constant::Units::kg_s,
    6571            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqAirMassFlow,
    6572              :                                     OutputProcessor::TimeStepType::Zone,
    6573              :                                     OutputProcessor::StoreType::Average,
    6574            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6575           14 :                 SetupOutputVariable(state,
    6576              :                                     "Space ITE Average Supply Heat Index",
    6577              :                                     Constant::Units::None,
    6578            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqSHI,
    6579              :                                     OutputProcessor::TimeStepType::Zone,
    6580              :                                     OutputProcessor::StoreType::Average,
    6581            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6582           14 :                 SetupOutputVariable(state,
    6583              :                                     "Space ITE Any Air Inlet Operating Range Exceeded Time",
    6584              :                                     Constant::Units::hr,
    6585            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange,
    6586              :                                     OutputProcessor::TimeStepType::Zone,
    6587              :                                     OutputProcessor::StoreType::Sum,
    6588            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6589           14 :                 SetupOutputVariable(state,
    6590              :                                     "Space ITE Any Air Inlet Dry-Bulb Temperature Above Operating Range Time",
    6591              :                                     Constant::Units::hr,
    6592            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDryBulbT,
    6593              :                                     OutputProcessor::TimeStepType::Zone,
    6594              :                                     OutputProcessor::StoreType::Sum,
    6595            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6596           14 :                 SetupOutputVariable(state,
    6597              :                                     "Space ITE Any Air Inlet Dry-Bulb Temperature Below Operating Range Time",
    6598              :                                     Constant::Units::hr,
    6599            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDryBulbT,
    6600              :                                     OutputProcessor::TimeStepType::Zone,
    6601              :                                     OutputProcessor::StoreType::Sum,
    6602            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6603           14 :                 SetupOutputVariable(state,
    6604              :                                     "Space ITE Any Air Inlet Dewpoint Temperature Above Operating Range Time",
    6605              :                                     Constant::Units::hr,
    6606            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDewpointT,
    6607              :                                     OutputProcessor::TimeStepType::Zone,
    6608              :                                     OutputProcessor::StoreType::Sum,
    6609            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6610           14 :                 SetupOutputVariable(state,
    6611              :                                     "Space ITE Any Air Inlet Dewpoint Temperature Below Operating Range Time",
    6612              :                                     Constant::Units::hr,
    6613            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDewpointT,
    6614              :                                     OutputProcessor::TimeStepType::Zone,
    6615              :                                     OutputProcessor::StoreType::Sum,
    6616            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6617           14 :                 SetupOutputVariable(state,
    6618              :                                     "Space ITE Any Air Inlet Relative Humidity Above Operating Range Time",
    6619              :                                     Constant::Units::hr,
    6620            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveRH,
    6621              :                                     OutputProcessor::TimeStepType::Zone,
    6622              :                                     OutputProcessor::StoreType::Sum,
    6623            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6624           14 :                 SetupOutputVariable(state,
    6625              :                                     "Space ITE Any Air Inlet Relative Humidity Below Operating Range Time",
    6626              :                                     Constant::Units::hr,
    6627            7 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowRH,
    6628              :                                     OutputProcessor::TimeStepType::Zone,
    6629              :                                     OutputProcessor::StoreType::Sum,
    6630            7 :                                     state.dataHeatBal->space(spaceNum).Name);
    6631              :             }
    6632              :             // Reset space output flag
    6633         5213 :             addSpaceOutputs(spaceNum) = false;
    6634              :         }
    6635              : 
    6636              :         // Object report variables
    6637          804 :         for (int bbHeatNum = 1; bbHeatNum <= state.dataHeatBal->TotBBHeat; ++bbHeatNum) {
    6638              :             // Set flags for zone and space total report variables
    6639            3 :             addZoneOutputs(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr) = true;
    6640            3 :             addSpaceOutputs(state.dataHeatBal->ZoneBBHeat(bbHeatNum).spaceIndex) = true;
    6641            6 :             SetupOutputVariable(state,
    6642              :                                 "Baseboard Electricity Rate",
    6643              :                                 Constant::Units::W,
    6644            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Power,
    6645              :                                 OutputProcessor::TimeStepType::Zone,
    6646              :                                 OutputProcessor::StoreType::Average,
    6647            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6648            6 :             SetupOutputVariable(state,
    6649              :                                 "Baseboard Electricity Energy",
    6650              :                                 Constant::Units::J,
    6651            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Consumption,
    6652              :                                 OutputProcessor::TimeStepType::Zone,
    6653              :                                 OutputProcessor::StoreType::Sum,
    6654            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name,
    6655              :                                 Constant::eResource::Electricity,
    6656              :                                 OutputProcessor::Group::Building,
    6657              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6658            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).EndUseSubcategory,
    6659            3 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr).Name,
    6660            3 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr).Multiplier,
    6661            3 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr).ListMultiplier,
    6662            3 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneBBHeat(bbHeatNum).spaceIndex).spaceType);
    6663              : 
    6664            6 :             SetupOutputVariable(state,
    6665              :                                 "Baseboard Radiant Heating Energy",
    6666              :                                 Constant::Units::J,
    6667            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).RadGainEnergy,
    6668              :                                 OutputProcessor::TimeStepType::Zone,
    6669              :                                 OutputProcessor::StoreType::Sum,
    6670            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6671            6 :             SetupOutputVariable(state,
    6672              :                                 "Baseboard Radiant Heating Rate",
    6673              :                                 Constant::Units::W,
    6674            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).RadGainRate,
    6675              :                                 OutputProcessor::TimeStepType::Zone,
    6676              :                                 OutputProcessor::StoreType::Average,
    6677            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6678            6 :             SetupOutputVariable(state,
    6679              :                                 "Baseboard Convective Heating Energy",
    6680              :                                 Constant::Units::J,
    6681            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).ConGainEnergy,
    6682              :                                 OutputProcessor::TimeStepType::Zone,
    6683              :                                 OutputProcessor::StoreType::Sum,
    6684            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6685            6 :             SetupOutputVariable(state,
    6686              :                                 "Baseboard Convective Heating Rate",
    6687              :                                 Constant::Units::W,
    6688            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).ConGainRate,
    6689              :                                 OutputProcessor::TimeStepType::Zone,
    6690              :                                 OutputProcessor::StoreType::Average,
    6691            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6692            6 :             SetupOutputVariable(state,
    6693              :                                 "Baseboard Total Heating Energy",
    6694              :                                 Constant::Units::J,
    6695            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).TotGainEnergy,
    6696              :                                 OutputProcessor::TimeStepType::Zone,
    6697              :                                 OutputProcessor::StoreType::Sum,
    6698            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6699            6 :             SetupOutputVariable(state,
    6700              :                                 "Baseboard Total Heating Rate",
    6701              :                                 Constant::Units::W,
    6702            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).TotGainRate,
    6703              :                                 OutputProcessor::TimeStepType::Zone,
    6704              :                                 OutputProcessor::StoreType::Average,
    6705            3 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6706              :         }
    6707              : 
    6708              :         // Zone total report variables
    6709         6002 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    6710         5201 :             if (addZoneOutputs(zoneNum)) {
    6711            6 :                 SetupOutputVariable(state,
    6712              :                                     "Zone Baseboard Electricity Rate",
    6713              :                                     Constant::Units::W,
    6714            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatPower,
    6715              :                                     OutputProcessor::TimeStepType::Zone,
    6716              :                                     OutputProcessor::StoreType::Average,
    6717            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6718            6 :                 SetupOutputVariable(state,
    6719              :                                     "Zone Baseboard Electricity Energy",
    6720              :                                     Constant::Units::J,
    6721            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatElecCons,
    6722              :                                     OutputProcessor::TimeStepType::Zone,
    6723              :                                     OutputProcessor::StoreType::Sum,
    6724            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6725              : 
    6726            6 :                 SetupOutputVariable(state,
    6727              :                                     "Zone Baseboard Radiant Heating Energy",
    6728              :                                     Constant::Units::J,
    6729            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatRadGain,
    6730              :                                     OutputProcessor::TimeStepType::Zone,
    6731              :                                     OutputProcessor::StoreType::Sum,
    6732            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6733            6 :                 SetupOutputVariable(state,
    6734              :                                     "Zone Baseboard Radiant Heating Rate",
    6735              :                                     Constant::Units::W,
    6736            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatRadGainRate,
    6737              :                                     OutputProcessor::TimeStepType::Zone,
    6738              :                                     OutputProcessor::StoreType::Average,
    6739            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6740            6 :                 SetupOutputVariable(state,
    6741              :                                     "Zone Baseboard Convective Heating Energy",
    6742              :                                     Constant::Units::J,
    6743            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatConGain,
    6744              :                                     OutputProcessor::TimeStepType::Zone,
    6745              :                                     OutputProcessor::StoreType::Sum,
    6746            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6747            6 :                 SetupOutputVariable(state,
    6748              :                                     "Zone Baseboard Convective Heating Rate",
    6749              :                                     Constant::Units::W,
    6750            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatConGainRate,
    6751              :                                     OutputProcessor::TimeStepType::Zone,
    6752              :                                     OutputProcessor::StoreType::Average,
    6753            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6754            6 :                 SetupOutputVariable(state,
    6755              :                                     "Zone Baseboard Total Heating Energy",
    6756              :                                     Constant::Units::J,
    6757            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatTotGain,
    6758              :                                     OutputProcessor::TimeStepType::Zone,
    6759              :                                     OutputProcessor::StoreType::Sum,
    6760            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6761            6 :                 SetupOutputVariable(state,
    6762              :                                     "Zone Baseboard Total Heating Rate",
    6763              :                                     Constant::Units::W,
    6764            3 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatTotGainRate,
    6765              :                                     OutputProcessor::TimeStepType::Zone,
    6766              :                                     OutputProcessor::StoreType::Average,
    6767            3 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6768              :             }
    6769              :             // Reset zone output flag
    6770         5201 :             addZoneOutputs(zoneNum) = false;
    6771              :         }
    6772              : 
    6773              :         // Space total report variables
    6774         6014 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    6775         5213 :             if (addSpaceOutputs(spaceNum)) {
    6776            6 :                 SetupOutputVariable(state,
    6777              :                                     "Space Baseboard Electricity Rate",
    6778              :                                     Constant::Units::W,
    6779            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatPower,
    6780              :                                     OutputProcessor::TimeStepType::Zone,
    6781              :                                     OutputProcessor::StoreType::Average,
    6782            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6783            6 :                 SetupOutputVariable(state,
    6784              :                                     "Space Baseboard Electricity Energy",
    6785              :                                     Constant::Units::J,
    6786            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatElecCons,
    6787              :                                     OutputProcessor::TimeStepType::Zone,
    6788              :                                     OutputProcessor::StoreType::Sum,
    6789            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6790              : 
    6791            6 :                 SetupOutputVariable(state,
    6792              :                                     "Space Baseboard Radiant Heating Energy",
    6793              :                                     Constant::Units::J,
    6794            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatRadGain,
    6795              :                                     OutputProcessor::TimeStepType::Zone,
    6796              :                                     OutputProcessor::StoreType::Sum,
    6797            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6798            6 :                 SetupOutputVariable(state,
    6799              :                                     "Space Baseboard Radiant Heating Rate",
    6800              :                                     Constant::Units::W,
    6801            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatRadGainRate,
    6802              :                                     OutputProcessor::TimeStepType::Zone,
    6803              :                                     OutputProcessor::StoreType::Average,
    6804            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6805            6 :                 SetupOutputVariable(state,
    6806              :                                     "Space Baseboard Convective Heating Energy",
    6807              :                                     Constant::Units::J,
    6808            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatConGain,
    6809              :                                     OutputProcessor::TimeStepType::Zone,
    6810              :                                     OutputProcessor::StoreType::Sum,
    6811            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6812            6 :                 SetupOutputVariable(state,
    6813              :                                     "Space Baseboard Convective Heating Rate",
    6814              :                                     Constant::Units::W,
    6815            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatConGainRate,
    6816              :                                     OutputProcessor::TimeStepType::Zone,
    6817              :                                     OutputProcessor::StoreType::Average,
    6818            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6819            6 :                 SetupOutputVariable(state,
    6820              :                                     "Space Baseboard Total Heating Energy",
    6821              :                                     Constant::Units::J,
    6822            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatTotGain,
    6823              :                                     OutputProcessor::TimeStepType::Zone,
    6824              :                                     OutputProcessor::StoreType::Sum,
    6825            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6826            6 :                 SetupOutputVariable(state,
    6827              :                                     "Space Baseboard Total Heating Rate",
    6828              :                                     Constant::Units::W,
    6829            3 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatTotGainRate,
    6830              :                                     OutputProcessor::TimeStepType::Zone,
    6831              :                                     OutputProcessor::StoreType::Average,
    6832            3 :                                     state.dataHeatBal->space(spaceNum).Name);
    6833              :             }
    6834              :             // Reset space output flag
    6835         5213 :             addSpaceOutputs(spaceNum) = false;
    6836              :         }
    6837          801 :     }
    6838              : 
    6839      2828408 :     void InitInternalHeatGains(EnergyPlusData &state)
    6840              :     {
    6841              : 
    6842              :         // SUBROUTINE INFORMATION:
    6843              :         //       AUTHOR         Linda K. Lawrie
    6844              :         //       DATE WRITTEN   September 1997
    6845              :         //       MODIFIED       November 1998, FW: add adjustment to elec lights for dayltg controls
    6846              :         //                      August 2003, FCW: add optional calculation of light-to-return fraction
    6847              :         //                       as a function of return plenum air temperature.
    6848              :         //       RE-ENGINEERED  na
    6849              : 
    6850              :         // PURPOSE OF THIS SUBROUTINE:
    6851              :         // This subroutine sets up the zone internal heat gains
    6852              :         // that are independent of the zone air temperature.
    6853              : 
    6854              :         // Using/Aliasing
    6855              :         using Dayltg::FigureTDDZoneGains;
    6856              :         using FuelCellElectricGenerator::FigureFuelCellZoneGains;
    6857              :         using MicroCHPElectricGenerator::FigureMicroCHPZoneGains;
    6858              :         using OutputReportTabular::AllocateLoadComponentArrays;
    6859              :         using Psychrometrics::PsyRhoAirFnPbTdbW;
    6860              :         using RefrigeratedCase::FigureRefrigerationZoneGains;
    6861              :         using WaterThermalTanks::CalcWaterThermalTankZoneGains;
    6862              :         using WaterUse::CalcWaterUseZoneGains;
    6863              : 
    6864              :         // SUBROUTINE PARAMETER DEFINITIONS:
    6865              :         static constexpr std::array<Real64, 9> C = {
    6866              :             6.4611027, 0.946892, 0.0000255737, 7.139322, -0.0627909, 0.0000589271, -0.198550, 0.000940018, -0.00000149532};
    6867      2828408 :         static ZoneCatEUseData const zeroZoneCatEUse; // For initialization
    6868              : 
    6869              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6870              :         Real64 ActivityLevel_WperPerson; // Units on Activity Level (Schedule)
    6871              :         Real64 NumberOccupants;          // Number of occupants
    6872              :         Real64 Q;                        // , QR
    6873              :         Real64 TotalPeopleGain;          // Total heat gain from people (intermediate calculational variable)
    6874              :         Real64 SensiblePeopleGain;       // Sensible heat gain from people (intermediate calculational variable)
    6875              :         Real64 FractionConvected;        // For general lighting, fraction of heat from lights convected to zone air
    6876              :         Real64 FractionReturnAir;        // For general lighting, fraction of heat from lights convected to zone's return air
    6877              :         Real64 FractionRadiant;          // For general lighting, fraction of heat from lights to zone that is long wave
    6878              :         Real64 ReturnPlenumTemp;         // Air temperature of a zone's return air plenum (C)
    6879              :         Real64 pulseMultipler;           // use to create a pulse for the load component report computations
    6880              : 
    6881              :         //  REAL(r64), ALLOCATABLE, SAVE, DIMENSION(:) :: QSA
    6882              : 
    6883              :         //  IF (.NOT. ALLOCATED(QSA)) ALLOCATE(QSA(NumOfZones))
    6884              : 
    6885              :         //  Zero out time step variables
    6886     23412419 :         for (auto &e : state.dataHeatBal->spaceIntGain) {
    6887     20584011 :             e.NOFOCC = 0.0;
    6888     20584011 :             e.QLTSW = 0.0;
    6889      2828408 :         }
    6890              : 
    6891      2828408 :         state.dataHeatBal->ZoneIntEEuse = zeroZoneCatEUse; // Set all member arrays to zeros
    6892              : 
    6893     23363819 :         for (auto &e : state.dataHeatBal->ZoneRpt) {
    6894     20535411 :             e.CO2Rate = 0.0;
    6895      2828408 :         }
    6896              : 
    6897     23412419 :         for (auto &e : state.dataHeatBal->spaceRpt) {
    6898              :             // People
    6899     20584011 :             e.PeopleRadGain = 0.0;
    6900     20584011 :             e.PeopleConGain = 0.0;
    6901     20584011 :             e.PeopleSenGain = 0.0;
    6902     20584011 :             e.PeopleNumOcc = 0.0;
    6903     20584011 :             e.PeopleLatGain = 0.0;
    6904     20584011 :             e.PeopleTotGain = 0.0;
    6905     20584011 :             e.PeopleRadGainRate = 0.0;
    6906     20584011 :             e.PeopleConGainRate = 0.0;
    6907     20584011 :             e.PeopleSenGainRate = 0.0;
    6908     20584011 :             e.PeopleLatGainRate = 0.0;
    6909     20584011 :             e.PeopleTotGainRate = 0.0;
    6910              :             // Lights
    6911     20584011 :             e.LtsPower = 0.0;
    6912     20584011 :             e.LtsElecConsump = 0.0;
    6913     20584011 :             e.LtsRadGain = 0.0;
    6914     20584011 :             e.LtsVisGain = 0.0;
    6915     20584011 :             e.LtsConGain = 0.0;
    6916     20584011 :             e.LtsRetAirGain = 0.0;
    6917     20584011 :             e.LtsTotGain = 0.0;
    6918     20584011 :             e.LtsRadGainRate = 0.0;
    6919     20584011 :             e.LtsVisGainRate = 0.0;
    6920     20584011 :             e.LtsConGainRate = 0.0;
    6921     20584011 :             e.LtsRetAirGainRate = 0.0;
    6922     20584011 :             e.LtsTotGainRate = 0.0;
    6923              :             // Baseboard Heat
    6924     20584011 :             e.BaseHeatPower = 0.0;
    6925     20584011 :             e.BaseHeatElecCons = 0.0;
    6926     20584011 :             e.BaseHeatRadGain = 0.0;
    6927     20584011 :             e.BaseHeatConGain = 0.0;
    6928     20584011 :             e.BaseHeatTotGain = 0.0;
    6929     20584011 :             e.BaseHeatRadGainRate = 0.0;
    6930     20584011 :             e.BaseHeatConGainRate = 0.0;
    6931     20584011 :             e.BaseHeatTotGainRate = 0.0;
    6932              :             // Electric Equipment
    6933     20584011 :             e.ElecPower = 0.0;
    6934     20584011 :             e.ElecConsump = 0.0;
    6935     20584011 :             e.ElecRadGain = 0.0;
    6936     20584011 :             e.ElecConGain = 0.0;
    6937     20584011 :             e.ElecLatGain = 0.0;
    6938     20584011 :             e.ElecLost = 0.0;
    6939     20584011 :             e.ElecTotGain = 0.0;
    6940     20584011 :             e.ElecRadGainRate = 0.0;
    6941     20584011 :             e.ElecConGainRate = 0.0;
    6942     20584011 :             e.ElecLatGainRate = 0.0;
    6943     20584011 :             e.ElecLostRate = 0.0;
    6944     20584011 :             e.ElecTotGainRate = 0.0;
    6945              :             // Gas Equipment
    6946     20584011 :             e.GasPower = 0.0;
    6947     20584011 :             e.GasConsump = 0.0;
    6948     20584011 :             e.GasRadGain = 0.0;
    6949     20584011 :             e.GasConGain = 0.0;
    6950     20584011 :             e.GasLatGain = 0.0;
    6951     20584011 :             e.GasLost = 0.0;
    6952     20584011 :             e.GasTotGain = 0.0;
    6953     20584011 :             e.GasRadGainRate = 0.0;
    6954     20584011 :             e.GasConGainRate = 0.0;
    6955     20584011 :             e.GasLatGainRate = 0.0;
    6956     20584011 :             e.GasLostRate = 0.0;
    6957     20584011 :             e.GasTotGainRate = 0.0;
    6958              :             // Hot Water Equipment
    6959     20584011 :             e.HWPower = 0.0;
    6960     20584011 :             e.HWConsump = 0.0;
    6961     20584011 :             e.HWRadGain = 0.0;
    6962     20584011 :             e.HWConGain = 0.0;
    6963     20584011 :             e.HWLatGain = 0.0;
    6964     20584011 :             e.HWLost = 0.0;
    6965     20584011 :             e.HWTotGain = 0.0;
    6966     20584011 :             e.HWRadGainRate = 0.0;
    6967     20584011 :             e.HWConGainRate = 0.0;
    6968     20584011 :             e.HWLatGainRate = 0.0;
    6969     20584011 :             e.HWLostRate = 0.0;
    6970     20584011 :             e.HWTotGainRate = 0.0;
    6971              :             // Steam Equipment
    6972     20584011 :             e.SteamPower = 0.0;
    6973     20584011 :             e.SteamConsump = 0.0;
    6974     20584011 :             e.SteamRadGain = 0.0;
    6975     20584011 :             e.SteamConGain = 0.0;
    6976     20584011 :             e.SteamLatGain = 0.0;
    6977     20584011 :             e.SteamLost = 0.0;
    6978     20584011 :             e.SteamTotGain = 0.0;
    6979     20584011 :             e.SteamRadGainRate = 0.0;
    6980     20584011 :             e.SteamConGainRate = 0.0;
    6981     20584011 :             e.SteamLatGainRate = 0.0;
    6982     20584011 :             e.SteamLostRate = 0.0;
    6983     20584011 :             e.SteamTotGainRate = 0.0;
    6984              :             // Other Equipment
    6985     20584011 :             e.OtherRadGain = 0.0;
    6986     20584011 :             e.OtherConGain = 0.0;
    6987     20584011 :             e.OtherLatGain = 0.0;
    6988     20584011 :             e.OtherLost = 0.0;
    6989     20584011 :             e.OtherTotGain = 0.0;
    6990     20584011 :             e.OtherRadGainRate = 0.0;
    6991     20584011 :             e.OtherConGainRate = 0.0;
    6992     20584011 :             e.OtherLatGainRate = 0.0;
    6993     20584011 :             e.OtherLostRate = 0.0;
    6994     20584011 :             e.OtherTotGainRate = 0.0;
    6995              :             // Overall Zone Variables
    6996     20584011 :             e.TotRadiantGain = 0.0;
    6997     20584011 :             e.TotVisHeatGain = 0.0;
    6998     20584011 :             e.TotConvectiveGain = 0.0;
    6999     20584011 :             e.TotLatentGain = 0.0;
    7000     20584011 :             e.TotTotalHeatGain = 0.0;
    7001     20584011 :             e.TotRadiantGainRate = 0.0;
    7002     20584011 :             e.TotVisHeatGainRate = 0.0;
    7003     20584011 :             e.TotConvectiveGainRate = 0.0;
    7004     20584011 :             e.TotLatentGainRate = 0.0;
    7005     20584011 :             e.TotTotalHeatGainRate = 0.0;
    7006              :             // Contaminant
    7007     20584011 :             e.CO2Rate = 0.0;
    7008     20584011 :             e.GCRate = 0.0;
    7009    329344176 :             for (int i = 0; i < (int)Constant::eFuel::Num; ++i) {
    7010    308760165 :                 e.OtherPower[i] = 0.0;
    7011    308760165 :                 e.OtherConsump[i] = 0.0;
    7012              :             }
    7013      2828408 :         }
    7014              : 
    7015     23363819 :         for (auto &e : state.dataHeatBal->ZonePreDefRep) {
    7016     20535411 :             e.NumOcc = 0.0;
    7017      2828408 :         }
    7018              : 
    7019              :         //  QSA = 0.0
    7020              : 
    7021              :         // Process Internal Heat Gains, People done below
    7022              :         // Occupant Stuff
    7023              :         //   METHOD:
    7024              :         //       The function is based on a curve fit to data presented in
    7025              :         //       Table 48 'Heat Gain From People' of Chapter 1 of the 'Carrier
    7026              :         //       Handbook of Air Conditioning System Design', 1965.  Values of
    7027              :         //       Sensible gain were obtained from the table at average adjusted
    7028              :         //       metabolic rates 350, 400, 450, 500, 750, 850, 1000, and
    7029              :         //       1450 Btu/hr each at temperatures 82, 80, 78, 75, and 70F.
    7030              :         //       Sensible gains of 0.0 at 96F and equal to the metabolic rate
    7031              :         //       at 30F were assumed in order to give reasonable values beyond
    7032              :         //       The reported temperature range.
    7033     19899054 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) {
    7034     17070646 :             auto &thisPeople = state.dataHeatBal->People(Loop);
    7035     17070646 :             int NZ = state.dataHeatBal->People(Loop).ZonePtr;
    7036     17070646 :             int spaceNum = thisPeople.spaceIndex;
    7037     17070646 :             auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum);
    7038     17070646 :             NumberOccupants = thisPeople.NumberOfPeople * thisPeople.sched->getCurrentVal();
    7039              : 
    7040     17070646 :             if (thisPeople.EMSPeopleOn) {
    7041            0 :                 NumberOccupants = thisPeople.EMSNumberOfPeople;
    7042              :             }
    7043              : 
    7044     17070646 :             TotalPeopleGain = 0.0;
    7045     17070646 :             SensiblePeopleGain = 0.0;
    7046              : 
    7047     17070646 :             auto &thisZoneRep = state.dataHeatBal->ZonePreDefRep(NZ);
    7048     17070646 :             if (NumberOccupants > 0.0) {
    7049      7704529 :                 ActivityLevel_WperPerson = thisPeople.activityLevelSched->getCurrentVal();
    7050      7704529 :                 TotalPeopleGain = NumberOccupants * ActivityLevel_WperPerson;
    7051              :                 // if the user did not specify a sensible fraction, calculate the sensible heat gain
    7052      7704529 :                 if (thisPeople.UserSpecSensFrac == Constant::AutoCalculate) {
    7053      7541156 :                     Real64 airTemp = thisSpaceHB.MAT;
    7054      7541156 :                     if (state.dataRoomAir->anyNonMixingRoomAirModel) {
    7055        39066 :                         if (state.dataRoomAir->IsZoneDispVent3Node(NZ) || state.dataRoomAir->IsZoneUFAD(NZ)) {
    7056        15024 :                             airTemp = state.dataRoomAir->TCMF(NZ);
    7057              :                         }
    7058              :                     }
    7059      7541156 :                     SensiblePeopleGain =
    7060      7541156 :                         NumberOccupants * (C[0] + ActivityLevel_WperPerson * (C[1] + ActivityLevel_WperPerson * C[2]) +
    7061      7541156 :                                            airTemp * ((C[3] + ActivityLevel_WperPerson * (C[4] + ActivityLevel_WperPerson * C[5])) +
    7062      7541156 :                                                       airTemp * (C[6] + ActivityLevel_WperPerson * (C[7] + ActivityLevel_WperPerson * C[8]))));
    7063              :                 } else { // if the user did specify a sensible fraction, use it
    7064       163373 :                     SensiblePeopleGain = TotalPeopleGain * thisPeople.UserSpecSensFrac;
    7065              :                 }
    7066              : 
    7067      7704529 :                 if (SensiblePeopleGain > TotalPeopleGain) {
    7068         4174 :                     SensiblePeopleGain = TotalPeopleGain;
    7069              :                 }
    7070      7704529 :                 if (SensiblePeopleGain < 0.0) {
    7071        59363 :                     SensiblePeopleGain = 0.0;
    7072              :                 }
    7073              : 
    7074              :                 // For predefined tabular reports related to outside air ventilation
    7075      7704529 :                 thisZoneRep.isOccupied = true; // set flag to occupied to be used in tabular reporting for ventilation
    7076      7704529 :                 thisZoneRep.NumOcc += NumberOccupants;
    7077      7704529 :                 thisZoneRep.NumOccAccum += NumberOccupants * state.dataGlobal->TimeStepZone;
    7078      7704529 :                 thisZoneRep.NumOccAccumTime += state.dataGlobal->TimeStepZone;
    7079              :             } else {
    7080      9366117 :                 state.dataHeatBal->ZonePreDefRep(NZ).isOccupied = false; // set flag to occupied to be used in tabular reporting for ventilation
    7081              :             }
    7082              : 
    7083     17070646 :             thisPeople.NumOcc = NumberOccupants;
    7084     17070646 :             thisPeople.RadGainRate = SensiblePeopleGain * thisPeople.FractionRadiant;
    7085     17070646 :             thisPeople.ConGainRate = SensiblePeopleGain * thisPeople.FractionConvected;
    7086     17070646 :             thisPeople.SenGainRate = SensiblePeopleGain;
    7087     17070646 :             thisPeople.LatGainRate = TotalPeopleGain - SensiblePeopleGain;
    7088     17070646 :             thisPeople.TotGainRate = TotalPeopleGain;
    7089     17070646 :             thisPeople.CO2GainRate = TotalPeopleGain * thisPeople.CO2RateFactor;
    7090              : 
    7091     17070646 :             auto &thisSpaceIntGain = state.dataHeatBal->spaceIntGain(spaceNum);
    7092     17070646 :             thisSpaceIntGain.NOFOCC += thisPeople.NumOcc;
    7093     17070646 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(spaceNum);
    7094     17070646 :             thisSpaceRpt.PeopleRadGainRate += thisPeople.RadGainRate;
    7095     17070646 :             thisSpaceRpt.PeopleConGainRate += thisPeople.ConGainRate;
    7096     17070646 :             thisSpaceRpt.PeopleSenGainRate += thisPeople.SenGainRate;
    7097     17070646 :             thisSpaceRpt.PeopleLatGainRate += thisPeople.LatGainRate;
    7098     17070646 :             thisSpaceRpt.PeopleTotGainRate += thisPeople.TotGainRate;
    7099              :         }
    7100              : 
    7101     20950878 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    7102     18122470 :             auto &thisLights = state.dataHeatBal->Lights(Loop);
    7103     18122470 :             int NZ = thisLights.ZonePtr;
    7104     18122470 :             int spaceNum = thisLights.spaceIndex;
    7105     18122470 :             Q = thisLights.DesignLevel * thisLights.sched->getCurrentVal();
    7106              : 
    7107     18122470 :             if (state.dataDayltg->ZoneDaylight(NZ).totRefPts > 0) {
    7108      1660533 :                 if (thisLights.FractionReplaceable > 0.0) { // FractionReplaceable can only be 0 or 1 for these models
    7109      1651080 :                     Q *= state.dataDayltg->spacePowerReductionFactor(spaceNum);
    7110              :                 }
    7111              :             }
    7112              : 
    7113              :             // Reduce lighting power due to demand limiting
    7114     18122470 :             if (thisLights.ManageDemand && (Q > thisLights.DemandLimit)) {
    7115         1020 :                 Q = thisLights.DemandLimit;
    7116              :             }
    7117              : 
    7118              :             // Set Q to EMS override if being called for by EMs
    7119     18122470 :             if (thisLights.EMSLightsOn) {
    7120        30964 :                 Q = thisLights.EMSLightingPower;
    7121              :             }
    7122              : 
    7123     18122470 :             FractionConvected = thisLights.FractionConvected;
    7124     18122470 :             FractionReturnAir = thisLights.FractionReturnAir;
    7125     18122470 :             FractionRadiant = thisLights.FractionRadiant;
    7126     18122470 :             if (thisLights.FractionReturnAirIsCalculated && !state.dataGlobal->ZoneSizingCalc && state.dataGlobal->SimTimeSteps > 1) {
    7127              :                 // Calculate FractionReturnAir based on conditions in the zone's return air plenum, if there is one.
    7128            0 :                 if (state.dataHeatBal->Zone(NZ).IsControlled) {
    7129            0 :                     int retNum = thisLights.ZoneReturnNum;
    7130            0 :                     int ReturnZonePlenumCondNum = state.dataZoneEquip->ZoneEquipConfig(NZ).ReturnNodePlenumNum(retNum);
    7131            0 :                     if (ReturnZonePlenumCondNum > 0) {
    7132            0 :                         ReturnPlenumTemp = state.dataZonePlenum->ZoneRetPlenCond(ReturnZonePlenumCondNum).ZoneTemp;
    7133            0 :                         FractionReturnAir =
    7134            0 :                             thisLights.FractionReturnAirPlenTempCoeff1 - thisLights.FractionReturnAirPlenTempCoeff2 * ReturnPlenumTemp;
    7135            0 :                         FractionReturnAir = max(0.0, min(1.0, FractionReturnAir));
    7136            0 :                         if (FractionReturnAir >= (1.0 - thisLights.FractionShortWave)) {
    7137            0 :                             FractionReturnAir = 1.0 - thisLights.FractionShortWave;
    7138            0 :                             FractionRadiant = 0.0;
    7139            0 :                             FractionConvected = 0.0;
    7140              :                         } else {
    7141            0 :                             FractionRadiant = ((1.0 - FractionReturnAir - thisLights.FractionShortWave) /
    7142            0 :                                                (thisLights.FractionRadiant + thisLights.FractionConvected)) *
    7143            0 :                                               thisLights.FractionRadiant;
    7144            0 :                             FractionConvected = 1.0 - (FractionReturnAir + FractionRadiant + thisLights.FractionShortWave);
    7145              :                         }
    7146              :                     }
    7147              :                 }
    7148              :             }
    7149              : 
    7150     18122470 :             thisLights.Power = Q;
    7151     18122470 :             thisLights.RadGainRate = Q * FractionRadiant;
    7152     18122470 :             thisLights.VisGainRate = Q * thisLights.FractionShortWave;
    7153     18122470 :             thisLights.ConGainRate = Q * FractionConvected;
    7154     18122470 :             thisLights.RetAirGainRate = Q * FractionReturnAir;
    7155     18122470 :             thisLights.TotGainRate = Q;
    7156              : 
    7157     18122470 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(spaceNum);
    7158     18122470 :             thisSpaceRpt.LtsPower += thisLights.Power;
    7159     18122470 :             thisSpaceRpt.LtsRadGainRate += thisLights.RadGainRate;
    7160     18122470 :             thisSpaceRpt.LtsVisGainRate += thisLights.VisGainRate;
    7161     18122470 :             state.dataHeatBal->spaceIntGain(spaceNum).QLTSW += thisLights.VisGainRate;
    7162     18122470 :             thisSpaceRpt.LtsConGainRate += thisLights.ConGainRate;
    7163     18122470 :             thisSpaceRpt.LtsRetAirGainRate += thisLights.RetAirGainRate;
    7164     18122470 :             thisSpaceRpt.LtsTotGainRate += thisLights.TotGainRate;
    7165              :         }
    7166              : 
    7167     21520029 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) {
    7168     18691621 :             auto &thisElecEq = state.dataHeatBal->ZoneElectric(Loop);
    7169     18691621 :             Q = thisElecEq.DesignLevel * thisElecEq.sched->getCurrentVal();
    7170              : 
    7171              :             // Reduce equipment power due to demand limiting
    7172     18691621 :             if (thisElecEq.ManageDemand && (Q > thisElecEq.DemandLimit)) {
    7173          850 :                 Q = thisElecEq.DemandLimit;
    7174              :             }
    7175              : 
    7176              :             // Set Q to EMS override if being called for by EMs
    7177     18691621 :             if (thisElecEq.EMSZoneEquipOverrideOn) {
    7178        19878 :                 Q = thisElecEq.EMSEquipPower;
    7179              :             }
    7180              : 
    7181     18691621 :             thisElecEq.Power = Q;
    7182     18691621 :             thisElecEq.RadGainRate = Q * thisElecEq.FractionRadiant;
    7183     18691621 :             thisElecEq.ConGainRate = Q * thisElecEq.FractionConvected;
    7184     18691621 :             thisElecEq.LatGainRate = Q * thisElecEq.FractionLatent;
    7185     18691621 :             thisElecEq.LostRate = Q * thisElecEq.FractionLost;
    7186     18691621 :             thisElecEq.TotGainRate = Q - thisElecEq.LostRate;
    7187              : 
    7188     18691621 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisElecEq.spaceIndex);
    7189     18691621 :             thisSpaceRpt.ElecPower += thisElecEq.Power;
    7190     18691621 :             thisSpaceRpt.ElecRadGainRate += thisElecEq.RadGainRate;
    7191     18691621 :             thisSpaceRpt.ElecConGainRate += thisElecEq.ConGainRate;
    7192     18691621 :             thisSpaceRpt.ElecLatGainRate += thisElecEq.LatGainRate;
    7193     18691621 :             thisSpaceRpt.ElecLostRate += thisElecEq.LostRate;
    7194              :         }
    7195              : 
    7196      3192950 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) {
    7197       364542 :             auto &thisGasEq = state.dataHeatBal->ZoneGas(Loop);
    7198       364542 :             Q = thisGasEq.DesignLevel * thisGasEq.sched->getCurrentVal();
    7199              : 
    7200              :             // Set Q to EMS override if being called for by EMs
    7201       364542 :             if (thisGasEq.EMSZoneEquipOverrideOn) {
    7202            0 :                 Q = thisGasEq.EMSEquipPower;
    7203              :             }
    7204              : 
    7205       364542 :             thisGasEq.Power = Q;
    7206       364542 :             thisGasEq.RadGainRate = Q * thisGasEq.FractionRadiant;
    7207       364542 :             thisGasEq.ConGainRate = Q * thisGasEq.FractionConvected;
    7208       364542 :             thisGasEq.LatGainRate = Q * thisGasEq.FractionLatent;
    7209       364542 :             thisGasEq.LostRate = Q * thisGasEq.FractionLost;
    7210       364542 :             thisGasEq.TotGainRate = Q - thisGasEq.LostRate;
    7211       364542 :             thisGasEq.CO2GainRate = Q * thisGasEq.CO2RateFactor;
    7212              : 
    7213       364542 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisGasEq.spaceIndex);
    7214       364542 :             thisSpaceRpt.GasPower += thisGasEq.Power;
    7215       364542 :             thisSpaceRpt.GasRadGainRate += thisGasEq.RadGainRate;
    7216       364542 :             thisSpaceRpt.GasConGainRate += thisGasEq.ConGainRate;
    7217       364542 :             thisSpaceRpt.GasLatGainRate += thisGasEq.LatGainRate;
    7218       364542 :             thisSpaceRpt.GasLostRate += thisGasEq.LostRate;
    7219              :         }
    7220              : 
    7221      3413561 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) {
    7222       585153 :             auto &thisOtherEq = state.dataHeatBal->ZoneOtherEq(Loop);
    7223       585153 :             Q = thisOtherEq.DesignLevel * thisOtherEq.sched->getCurrentVal();
    7224              : 
    7225              :             // Set Q to EMS override if being called for by EMs
    7226       585153 :             if (thisOtherEq.EMSZoneEquipOverrideOn) {
    7227       126676 :                 Q = thisOtherEq.EMSEquipPower;
    7228              :             }
    7229              : 
    7230       585153 :             thisOtherEq.Power = Q;
    7231       585153 :             thisOtherEq.RadGainRate = Q * thisOtherEq.FractionRadiant;
    7232       585153 :             thisOtherEq.ConGainRate = Q * thisOtherEq.FractionConvected;
    7233       585153 :             thisOtherEq.LatGainRate = Q * thisOtherEq.FractionLatent;
    7234       585153 :             thisOtherEq.LostRate = Q * thisOtherEq.FractionLost;
    7235       585153 :             thisOtherEq.TotGainRate = Q - thisOtherEq.LostRate;
    7236              : 
    7237       585153 :             int fuelType = (int)thisOtherEq.OtherEquipFuelType;
    7238       585153 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisOtherEq.spaceIndex);
    7239       585153 :             thisSpaceRpt.OtherPower[fuelType] += thisOtherEq.Power;
    7240       585153 :             thisSpaceRpt.OtherTotGainRate += thisOtherEq.TotGainRate;
    7241       585153 :             thisSpaceRpt.OtherRadGainRate += thisOtherEq.RadGainRate;
    7242       585153 :             thisSpaceRpt.OtherConGainRate += thisOtherEq.ConGainRate;
    7243       585153 :             thisSpaceRpt.OtherLatGainRate += thisOtherEq.LatGainRate;
    7244       585153 :             thisSpaceRpt.OtherLostRate += thisOtherEq.LostRate;
    7245              :         }
    7246              : 
    7247      2914688 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) {
    7248        86280 :             auto &thisHWEq = state.dataHeatBal->ZoneHWEq(Loop);
    7249        86280 :             Q = thisHWEq.DesignLevel * thisHWEq.sched->getCurrentVal();
    7250              : 
    7251              :             // Set Q to EMS override if being called for by EMs
    7252        86280 :             if (thisHWEq.EMSZoneEquipOverrideOn) {
    7253            0 :                 Q = thisHWEq.EMSEquipPower;
    7254              :             }
    7255              : 
    7256        86280 :             thisHWEq.Power = Q;
    7257        86280 :             thisHWEq.RadGainRate = Q * thisHWEq.FractionRadiant;
    7258        86280 :             thisHWEq.ConGainRate = Q * thisHWEq.FractionConvected;
    7259        86280 :             thisHWEq.LatGainRate = Q * thisHWEq.FractionLatent;
    7260        86280 :             thisHWEq.LostRate = Q * thisHWEq.FractionLost;
    7261        86280 :             thisHWEq.TotGainRate = Q - thisHWEq.LostRate;
    7262              : 
    7263        86280 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisHWEq.spaceIndex);
    7264        86280 :             thisSpaceRpt.HWPower += thisHWEq.Power;
    7265        86280 :             thisSpaceRpt.HWRadGainRate += thisHWEq.RadGainRate;
    7266        86280 :             thisSpaceRpt.HWConGainRate += thisHWEq.ConGainRate;
    7267        86280 :             thisSpaceRpt.HWLatGainRate += thisHWEq.LatGainRate;
    7268        86280 :             thisSpaceRpt.HWLostRate += thisHWEq.LostRate;
    7269              :         }
    7270              : 
    7271      2841923 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) {
    7272        13515 :             auto &thisSteamEq = state.dataHeatBal->ZoneSteamEq(Loop);
    7273        13515 :             Q = thisSteamEq.DesignLevel * thisSteamEq.sched->getCurrentVal();
    7274              : 
    7275              :             // Set Q to EMS override if being called for by EMs
    7276        13515 :             if (thisSteamEq.EMSZoneEquipOverrideOn) {
    7277            0 :                 Q = thisSteamEq.EMSEquipPower;
    7278              :             }
    7279              : 
    7280        13515 :             thisSteamEq.Power = Q;
    7281        13515 :             thisSteamEq.RadGainRate = Q * thisSteamEq.FractionRadiant;
    7282        13515 :             thisSteamEq.ConGainRate = Q * thisSteamEq.FractionConvected;
    7283        13515 :             thisSteamEq.LatGainRate = Q * thisSteamEq.FractionLatent;
    7284        13515 :             thisSteamEq.LostRate = Q * thisSteamEq.FractionLost;
    7285        13515 :             thisSteamEq.TotGainRate = Q - thisSteamEq.LostRate;
    7286              : 
    7287        13515 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisSteamEq.spaceIndex);
    7288        13515 :             thisSpaceRpt.SteamPower += thisSteamEq.Power;
    7289        13515 :             thisSpaceRpt.SteamRadGainRate += thisSteamEq.RadGainRate;
    7290        13515 :             thisSpaceRpt.SteamConGainRate += thisSteamEq.ConGainRate;
    7291        13515 :             thisSpaceRpt.SteamLatGainRate += thisSteamEq.LatGainRate;
    7292        13515 :             thisSpaceRpt.SteamLostRate += thisSteamEq.LostRate;
    7293              :         }
    7294              : 
    7295      2836517 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) {
    7296         8109 :             auto &thisBBHeat = state.dataHeatBal->ZoneBBHeat(Loop);
    7297         8109 :             int NZ = thisBBHeat.ZonePtr;
    7298         8109 :             if (state.dataHeatBal->Zone(NZ).OutDryBulbTemp >= thisBBHeat.HighTemperature) {
    7299         4059 :                 Q = 0.0;
    7300         4050 :             } else if (state.dataHeatBal->Zone(NZ).OutDryBulbTemp > thisBBHeat.LowTemperature) {
    7301         1350 :                 Q = (state.dataHeatBal->Zone(NZ).OutDryBulbTemp - thisBBHeat.LowTemperature) *
    7302         1350 :                         (thisBBHeat.CapatHighTemperature - thisBBHeat.CapatLowTemperature) /
    7303         1350 :                         (thisBBHeat.HighTemperature - thisBBHeat.LowTemperature) +
    7304         1350 :                     thisBBHeat.CapatLowTemperature;
    7305              :             } else {
    7306         2700 :                 Q = thisBBHeat.CapatLowTemperature;
    7307              :             }
    7308         8109 :             Q *= thisBBHeat.sched->getCurrentVal();
    7309              : 
    7310              :             // set with EMS value if being called for.
    7311         8109 :             if (thisBBHeat.EMSZoneBaseboardOverrideOn) {
    7312            0 :                 Q = thisBBHeat.EMSZoneBaseboardPower;
    7313              :             }
    7314              : 
    7315         8109 :             thisBBHeat.Power = Q;
    7316         8109 :             thisBBHeat.RadGainRate = Q * thisBBHeat.FractionRadiant;
    7317         8109 :             thisBBHeat.ConGainRate = Q * thisBBHeat.FractionConvected;
    7318         8109 :             thisBBHeat.TotGainRate = Q;
    7319              : 
    7320         8109 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisBBHeat.spaceIndex);
    7321         8109 :             thisSpaceRpt.BaseHeatPower += thisBBHeat.Power;
    7322         8109 :             thisSpaceRpt.BaseHeatRadGainRate += thisBBHeat.RadGainRate;
    7323         8109 :             thisSpaceRpt.BaseHeatConGainRate += thisBBHeat.ConGainRate;
    7324              :         }
    7325              : 
    7326      2838677 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotCO2Gen; ++Loop) {
    7327        10269 :             int NZ = state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr;
    7328        10269 :             state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate =
    7329        10269 :                 state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate * state.dataHeatBal->ZoneCO2Gen(Loop).sched->getCurrentVal();
    7330        10269 :             state.dataHeatBal->ZoneRpt(NZ).CO2Rate += state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate;
    7331              :         }
    7332              : 
    7333      2828408 :         if (state.dataHeatBal->TotITEquip > 0) {
    7334        11508 :             CalcZoneITEq(state);
    7335              :         }
    7336              : 
    7337      2828408 :         CalcWaterThermalTankZoneGains(state);
    7338      2828408 :         PipeHeatTransfer::PipeHTData::CalcZonePipesHeatGain(state);
    7339      2828408 :         CalcWaterUseZoneGains(state);
    7340      2828408 :         FigureFuelCellZoneGains(state);
    7341      2828408 :         FigureMicroCHPZoneGains(state);
    7342      2828408 :         initializeElectricPowerServiceZoneGains(state);
    7343      2828408 :         FigureTDDZoneGains(state);
    7344      2828408 :         FigureRefrigerationZoneGains(state);
    7345              : 
    7346              :         // store pointer values to hold generic internal gain values constant for entire timestep
    7347      2828408 :         UpdateInternalGainValues(state);
    7348              : 
    7349     23363819 :         for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) {
    7350     20535411 :             InternalHeatGains::SumAllInternalLatentGains(state, NZ); // Sets zone and space latent gains
    7351              :             // Added for hybrid model
    7352     20535411 :             if (state.dataHybridModel->FlagHybridModel_PC) {
    7353         8096 :                 InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ); // Also sets space gains
    7354              :             }
    7355              :         }
    7356              : 
    7357              :         // QL is per radiant enclosure (one or more spaces if grouped by air boundaries)
    7358     23359775 :         for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfRadiantEnclosures; ++enclosureNum) {
    7359     20531367 :             auto &thisEnclosure(state.dataViewFactor->EnclRadInfo(enclosureNum));
    7360     20531367 :             thisEnclosure.radQThermalRad = 0.0;
    7361     41115378 :             for (int const spaceNum : thisEnclosure.spaceNums) {
    7362     20584011 :                 Real64 spaceQL = SumAllSpaceInternalRadiationGains(state, spaceNum);
    7363     20584011 :                 thisEnclosure.radQThermalRad += spaceQL;
    7364     20531367 :             }
    7365              :         }
    7366              : 
    7367      2828408 :         pulseMultipler = 0.01; // the W/sqft pulse for the zone
    7368      2828408 :         if (state.dataGlobal->CompLoadReportIsReq) {
    7369       178743 :             AllocateLoadComponentArrays(state);
    7370              :         }
    7371     23363819 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { // Loop through all surfaces...
    7372     41119422 :             for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    7373     20584011 :                 auto const &thisSpace = state.dataHeatBal->space(spaceNum);
    7374     20584011 :                 int const firstSurf = thisSpace.HTSurfaceFirst;
    7375     20584011 :                 int const lastSurf = thisSpace.HTSurfaceLast;
    7376     20584011 :                 if (firstSurf <= 0) {
    7377            0 :                     continue;
    7378              :                 }
    7379    197920873 :                 for (int SurfNum = firstSurf; SurfNum <= lastSurf; ++SurfNum) {
    7380    177336862 :                     auto const &thisEnclosure = state.dataViewFactor->EnclRadInfo(state.dataSurface->Surface(SurfNum).RadEnclIndex);
    7381              : 
    7382    177336862 :                     if (!state.dataGlobal->doLoadComponentPulseNow) {
    7383    177333334 :                         state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) =
    7384    177333334 :                             thisEnclosure.radQThermalRad * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum);
    7385              :                     } else {
    7386              :                         // radiant value prior to adjustment for pulse for load component report
    7387         3528 :                         Real64 const curQL = thisEnclosure.radQThermalRad;
    7388              :                         // for the loads component report during the special sizing run increase the radiant portion
    7389              :                         // a small amount to create a "pulse" of heat that is used for the delayed loads
    7390              :                         // radiant value including adjustment for pulse for load component report
    7391         3528 :                         Real64 const adjQL = curQL + thisEnclosure.FloorArea * pulseMultipler;
    7392              :                         // ITABSF is the Inside Thermal Absorptance
    7393              :                         // EnclRadThermAbsMult is a multiplier for each zone
    7394              :                         // SurfQdotRadIntGainsInPerArea is the thermal radiation absorbed on inside surfaces
    7395         3528 :                         state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) =
    7396         3528 :                             adjQL * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum);
    7397              :                         // store the magnitude and time of the pulse
    7398         3528 :                         state.dataOutRptTab->radiantPulseTimestep(state.dataSize->CurOverallSimDay, zoneNum) =
    7399         3528 :                             (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep;
    7400         3528 :                         state.dataOutRptTab->radiantPulseReceived(state.dataSize->CurOverallSimDay, SurfNum) =
    7401         3528 :                             (adjQL - curQL) * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) *
    7402         3528 :                             state.dataSurface->Surface(SurfNum).Area;
    7403              :                     }
    7404              :                 }
    7405     20535411 :             }
    7406              :         }
    7407      2828408 :     }
    7408              : 
    7409      2828408 :     void CheckReturnAirHeatGain(EnergyPlusData &state)
    7410              :     {
    7411              :         // SUBROUTINE INFORMATION:
    7412              :         //       AUTHOR         Xuan Luo
    7413              :         //       DATE WRITTEN   Jan 2018
    7414              : 
    7415              :         // PURPOSE OF THIS SUBROUTINE:
    7416              :         // This subroutine currently creates the values for standard "zone loads" reporting
    7417              :         // from the heat balance module.
    7418     23363819 :         for (auto const &zone : state.dataHeatBal->Zone) {
    7419     20535411 :             if (zone.HasAdjustedReturnTempByITE && zone.HasLtsRetAirGain) {
    7420            0 :                 ShowFatalError(state,
    7421              :                                "Return air heat gains from lights are not allowed when Air Flow Calculation Method = "
    7422              :                                "FlowControlWithApproachTemperatures in zones with ITE objects.");
    7423              :             }
    7424     20535411 :             if (zone.HasAdjustedReturnTempByITE && zone.HasAirFlowWindowReturn) {
    7425            0 :                 ShowFatalError(state,
    7426              :                                "Return air heat gains from windows are not allowed when Air Flow Calculation Method = "
    7427              :                                "FlowControlWithApproachTemperatures in zones with ITE objects.");
    7428              :             }
    7429      2828408 :         }
    7430      2828408 :     }
    7431              : 
    7432        11508 :     void CalcZoneITEq(EnergyPlusData &state)
    7433              :     {
    7434              : 
    7435              :         // SUBROUTINE INFORMATION:
    7436              :         //       AUTHOR         M.J. Witte
    7437              :         //       DATE WRITTEN   October 2014
    7438              : 
    7439              :         // PURPOSE OF THIS SUBROUTINE:
    7440              :         // This subroutine calculates the gains and other results for ElectricEquipment:ITE:AirCooled.
    7441              :         // This broken into a separate subroutine, because the calculations are more detailed than the other
    7442              :         // types of internal gains.
    7443              : 
    7444              :         using namespace Psychrometrics;
    7445              :         using Curve::CurveValue;
    7446              :         using HVAC::SmallAirVolFlow;
    7447              :         using HVAC::SmallTempDiff;
    7448              : 
    7449              :         // Operating Limits for environmental class: None, A1, A2, A3, A4, B, C, H1
    7450              :         // From ASHRAE 2021 Thermal Guidelines environmental classes for Air-Cooled ITE
    7451              :         static constexpr std::array<Real64, static_cast<int>(ITEClass::Num)> DBMin = {
    7452              :             -99.0, 15.0, 10.0, 5.0, 5.0, 5.0, 5.0, 5.0}; // Minimum dry-bulb temperature [C]
    7453              :         static constexpr std::array<Real64, static_cast<int>(ITEClass::Num)> DBMax = {
    7454              :             99.0, 32.0, 35.0, 40.0, 45.0, 35.0, 40.0, 25.0}; // Maximum dry-bulb temperature [C]
    7455              :         static constexpr std::array<Real64, static_cast<int>(ITEClass::Num)> DPMin = {
    7456              :             -99.0, -12.0, -12.0, -12.0, -12.0, -99.0, -99.0, -12.0}; // Minimum dewpoint temperature [C]
    7457              :         static constexpr std::array<Real64, static_cast<int>(ITEClass::Num)> DPMax = {
    7458              :             99.0, 17.0, 21.0, 24.0, 24.0, 28.0, 28.0, 17.0}; // Maximum dewpoint temperature [C]
    7459              :         static constexpr std::array<Real64, static_cast<int>(ITEClass::Num)> RHMin = {
    7460              :             0.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0}; // Minimum relative humidity [%]
    7461              :         static constexpr std::array<Real64, static_cast<int>(ITEClass::Num)> RHMax = {
    7462              :             99.0, 80.0, 80.0, 85.0, 90.0, 80.0, 80.0, 80.0}; // Maximum relative humidity [%]
    7463              : 
    7464              :         static constexpr std::string_view RoutineName("CalcZoneITEq");
    7465              :         Real64 OperSchedFrac;             // Operating schedule fraction
    7466              :         Real64 CPULoadSchedFrac;          // CPU loading schedule fraction
    7467              :         ITEInletConnection AirConnection; // Air connection type
    7468        11508 :         Real64 TSupply(0.0);              // Supply air temperature [C]
    7469              :         Real64 WSupply;                   // Supply air humidity ratio [kgWater/kgDryAir]
    7470              :         Real64 RecircFrac;                // Recirculation fraction - current
    7471              :         Real64 TRecirc;                   // Recirculation air temperature [C]
    7472              :         Real64 WRecirc;                   // Recirculation air humidity ratio [kgWater/kgDryAir]
    7473              :         Real64 TAirIn;                    // Entering air dry-bulb temperature [C]
    7474              :         Real64 TAirInDesign;              // Design entering air dry-bulb temperature [C]
    7475              :         Real64 WAirIn;                    // Entering air humidity ratio [kgWater/kgDryAir]
    7476              :         Real64 TDPAirIn;                  // Entering air dewpoint temperature [C]
    7477              :         Real64 RHAirIn;                   // Entering air relative humidity [%]
    7478              :         Real64 SupplyHeatIndex;           // Supply heat index
    7479              :         Real64 TAirOut;                   // Leaving air temperature [C]
    7480              :         Real64 AirVolFlowFrac;            // Air volume flow fraction
    7481              :         Real64 AirVolFlowFracDesignT;     // Air volume flow fraction at design entering air temperature
    7482              :         Real64 AirVolFlowRate;            // Air volume flow rate at current density [m3/s]
    7483              :         Real64 AirMassFlowRate;           // Air mass flow rate [kg/s]
    7484              :         Real64 CPUPower;                  // CPU power input [W]
    7485              :         Real64 FanPower;                  // Fan power input [W]
    7486              :         Real64 UPSPower;                  // UPS new power input (losses) [W]
    7487              :         Real64 UPSPartLoadRatio;          // UPS part load ratio (current total power input / design total power input)
    7488              :         Real64 UPSHeatGain;               // UPS convective heat gain to zone [W]
    7489              : 
    7490        11508 :         std::map<int, std::vector<int>> ZoneITEMap;
    7491              : 
    7492              :         //  Zero out time step variables
    7493              :         // Object report variables
    7494        28440 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    7495              : 
    7496       135456 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7497       118524 :                 state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i] = 0.0;
    7498       118524 :                 state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i] = 0.0;
    7499              :             }
    7500              : 
    7501        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity = 0.0;
    7502        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowCurDensity = 0.0;
    7503        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirMassFlow = 0.0;
    7504        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDryBulbT = 0.0;
    7505        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDewpointT = 0.0;
    7506        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirInletRelHum = 0.0;
    7507        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirOutletDryBulbT = 0.0;
    7508        16932 :             state.dataHeatBal->ZoneITEq(Loop).SHI = 0.0;
    7509        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = 0.0;
    7510        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeAboveDryBulbT = 0.0;
    7511        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeBelowDryBulbT = 0.0;
    7512        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeAboveDewpointT = 0.0;
    7513        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeBelowDewpointT = 0.0;
    7514        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeAboveRH = 0.0;
    7515        16932 :             state.dataHeatBal->ZoneITEq(Loop).TimeBelowRH = 0.0;
    7516        16932 :             state.dataHeatBal->ZoneITEq(Loop).DryBulbTAboveDeltaT = 0.0;
    7517        16932 :             state.dataHeatBal->ZoneITEq(Loop).DryBulbTBelowDeltaT = 0.0;
    7518        16932 :             state.dataHeatBal->ZoneITEq(Loop).DewpointTAboveDeltaT = 0.0;
    7519        16932 :             state.dataHeatBal->ZoneITEq(Loop).DewpointTBelowDeltaT = 0.0;
    7520        16932 :             state.dataHeatBal->ZoneITEq(Loop).RHAboveDeltaRH = 0.0;
    7521        16932 :             state.dataHeatBal->ZoneITEq(Loop).RHBelowDeltaRH = 0.0;
    7522              :         } // ZoneITEq init loop
    7523              : 
    7524              :         // Zone total report variables
    7525        39288 :         for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) {
    7526              : 
    7527       222240 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7528       194460 :                 state.dataHeatBal->ZoneRpt(Loop).PowerRpt[i] = 0.0;
    7529       194460 :                 state.dataHeatBal->ZoneRpt(Loop).EnergyRpt[i] = 0.0;
    7530              :             }
    7531              : 
    7532        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEAdjReturnTemp = 0.0;
    7533              : 
    7534        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqAirVolFlowStdDensity = 0.0;
    7535        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqAirMassFlow = 0.0;
    7536        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqSHI = 0.0;
    7537        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeOutOfOperRange = 0.0;
    7538        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeAboveDryBulbT = 0.0;
    7539        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeBelowDryBulbT = 0.0;
    7540        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeAboveDewpointT = 0.0;
    7541        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeBelowDewpointT = 0.0;
    7542        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeAboveRH = 0.0;
    7543        27780 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeBelowRH = 0.0;
    7544              : 
    7545        27780 :             state.dataHeatBal->ZoneRpt(Loop).SumTinMinusTSup = 0.0;
    7546        27780 :             state.dataHeatBal->ZoneRpt(Loop).SumToutMinusTSup = 0.0;
    7547              :         } // Zone init loop
    7548              : 
    7549              :         // Space total report variables
    7550        39288 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    7551              : 
    7552       222240 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7553       194460 :                 state.dataHeatBal->spaceRpt(spaceNum).PowerRpt[i] = 0.0;
    7554       194460 :                 state.dataHeatBal->spaceRpt(spaceNum).EnergyRpt[i] = 0.0;
    7555              :             }
    7556              : 
    7557        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEAdjReturnTemp = 0.0;
    7558              : 
    7559        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirVolFlowStdDensity = 0.0;
    7560        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirMassFlow = 0.0;
    7561        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqSHI = 0.0;
    7562        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = 0.0;
    7563        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDryBulbT = 0.0;
    7564        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDryBulbT = 0.0;
    7565        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDewpointT = 0.0;
    7566        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDewpointT = 0.0;
    7567        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveRH = 0.0;
    7568        27780 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowRH = 0.0;
    7569              : 
    7570        27780 :             state.dataHeatBal->spaceRpt(spaceNum).SumTinMinusTSup = 0.0;
    7571        27780 :             state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup = 0.0;
    7572              :         } // Space init spaceNum
    7573              : 
    7574        28440 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    7575              :             // Get schedules
    7576        16932 :             int NZ = state.dataHeatBal->ZoneITEq(Loop).ZonePtr;
    7577        16932 :             auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ);
    7578        16932 :             int spaceNum = state.dataHeatBal->ZoneITEq(Loop).spaceIndex;
    7579        16932 :             OperSchedFrac = state.dataHeatBal->ZoneITEq(Loop).operSched->getCurrentVal();
    7580        16932 :             CPULoadSchedFrac = state.dataHeatBal->ZoneITEq(Loop).cpuLoadSched->getCurrentVal();
    7581              : 
    7582              :             // Determine inlet air temperature and humidity
    7583        16932 :             AirConnection = state.dataHeatBal->ZoneITEq(Loop).AirConnectionType;
    7584        16932 :             RecircFrac = 0.0;
    7585        16932 :             int SupplyNodeNum = state.dataHeatBal->ZoneITEq(Loop).SupplyAirNodeNum;
    7586        16932 :             if (state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) {
    7587         9480 :                 TSupply = state.dataLoopNodes->Node(SupplyNodeNum).Temp;
    7588         9480 :                 WSupply = state.dataLoopNodes->Node(SupplyNodeNum).HumRat;
    7589         9480 :                 if (state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched != nullptr) {
    7590            0 :                     TAirIn = TSupply + state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched->getCurrentVal();
    7591              :                 } else {
    7592         9480 :                     TAirIn = TSupply + state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTemp;
    7593              :                 }
    7594         9480 :                 WAirIn = state.dataLoopNodes->Node(SupplyNodeNum).HumRat;
    7595              :             } else {
    7596         7452 :                 if (AirConnection == ITEInletConnection::AdjustedSupply) {
    7597         7452 :                     TSupply = state.dataLoopNodes->Node(SupplyNodeNum).Temp;
    7598         7452 :                     WSupply = state.dataLoopNodes->Node(SupplyNodeNum).HumRat;
    7599         7452 :                     if (state.dataHeatBal->ZoneITEq(Loop).RecircFLTCurve != 0) {
    7600         7452 :                         RecircFrac = state.dataHeatBal->ZoneITEq(Loop).DesignRecircFrac *
    7601         7452 :                                      CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).RecircFLTCurve, CPULoadSchedFrac, TSupply);
    7602              :                     } else {
    7603            0 :                         RecircFrac = state.dataHeatBal->ZoneITEq(Loop).DesignRecircFrac;
    7604              :                     }
    7605         7452 :                     TRecirc = thisZoneHB.MAT;
    7606         7452 :                     WRecirc = thisZoneHB.airHumRat;
    7607         7452 :                     TAirIn = TRecirc * RecircFrac + TSupply * (1.0 - RecircFrac);
    7608         7452 :                     WAirIn = WRecirc * RecircFrac + WSupply * (1.0 - RecircFrac);
    7609            0 :                 } else if (AirConnection == ITEInletConnection::RoomAirModel) {
    7610              :                     // Room air model option: TAirIn=TAirZone, according to EngineeringRef 17.1.4
    7611            0 :                     TAirIn = thisZoneHB.MAT;
    7612            0 :                     TSupply = TAirIn;
    7613            0 :                     WAirIn = thisZoneHB.airHumRat;
    7614              :                 } else {
    7615              :                     // TAirIn = TRoomAirNodeIn, according to EngineeringRef 17.1.4
    7616            0 :                     if (state.dataHeatBal->ZoneITEq(Loop).inControlledZone) {
    7617            0 :                         int ZoneAirInletNode = state.dataZoneEquip->ZoneEquipConfig(NZ).InletNode(1);
    7618            0 :                         TSupply = state.dataLoopNodes->Node(ZoneAirInletNode).Temp;
    7619              :                     } else {
    7620            0 :                         TSupply = thisZoneHB.MAT;
    7621              :                     }
    7622            0 :                     TAirIn = thisZoneHB.MAT;
    7623            0 :                     WAirIn = thisZoneHB.airHumRat;
    7624              :                 }
    7625              :             }
    7626        16932 :             TDPAirIn = PsyTdpFnWPb(state, WAirIn, state.dataEnvrn->StdBaroPress, RoutineName);
    7627        16932 :             RHAirIn = 100.0 * PsyRhFnTdbWPb(state, TAirIn, WAirIn, state.dataEnvrn->StdBaroPress, RoutineName); // RHAirIn is %
    7628              : 
    7629              :             // Calculate power input and airflow
    7630        16932 :             TAirInDesign = state.dataHeatBal->ZoneITEq(Loop).DesignTAirIn;
    7631              : 
    7632        16932 :             if (state.dataGlobal->DoingSizing && state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) {
    7633              : 
    7634         2700 :                 TAirInDesign = state.dataHeatBal->ZoneITEq(Loop).SizingTAirIn;
    7635         2700 :                 if (state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched != nullptr) {
    7636            0 :                     TAirInDesign = TAirInDesign + state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched->getCurrentVal();
    7637              :                 } else {
    7638         2700 :                     TAirInDesign = TAirInDesign + state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTemp;
    7639              :                 }
    7640         2700 :                 OperSchedFrac = state.dataHeatBal->ZoneITEq(Loop).operSched->getCurrentVal();
    7641         2700 :                 CPULoadSchedFrac = state.dataHeatBal->ZoneITEq(Loop).cpuLoadSched->getCurrentVal();
    7642              :             }
    7643              : 
    7644        16932 :             CPUPower = max(state.dataHeatBal->ZoneITEq(Loop).DesignCPUPower * OperSchedFrac *
    7645        16932 :                                CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).CPUPowerFLTCurve, CPULoadSchedFrac, TAirIn),
    7646              :                            0.0);
    7647        16932 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPUAtDesign] =
    7648        16932 :                 max(state.dataHeatBal->ZoneITEq(Loop).DesignCPUPower * OperSchedFrac *
    7649        16932 :                         CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).CPUPowerFLTCurve, CPULoadSchedFrac, TAirInDesign),
    7650              :                     0.0);
    7651              : 
    7652        16932 :             AirVolFlowFrac = max(CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).AirFlowFLTCurve, CPULoadSchedFrac, TAirIn), 0.0);
    7653        16932 :             AirVolFlowRate = state.dataHeatBal->ZoneITEq(Loop).DesignAirVolFlowRate * OperSchedFrac * AirVolFlowFrac;
    7654        16932 :             if (AirVolFlowRate < SmallAirVolFlow) {
    7655           21 :                 AirVolFlowRate = 0.0;
    7656              :             }
    7657        16932 :             AirVolFlowFracDesignT = max(CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).AirFlowFLTCurve, CPULoadSchedFrac, TAirInDesign), 0.0);
    7658              : 
    7659        16932 :             FanPower = max(state.dataHeatBal->ZoneITEq(Loop).DesignFanPower * OperSchedFrac *
    7660        16932 :                                CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).FanPowerFFCurve, AirVolFlowFrac),
    7661              :                            0.0);
    7662        16932 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::FanAtDesign] =
    7663        16932 :                 max(state.dataHeatBal->ZoneITEq(Loop).DesignFanPower * OperSchedFrac *
    7664        16932 :                         CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).FanPowerFFCurve, AirVolFlowFracDesignT),
    7665              :                     0.0);
    7666              : 
    7667              :             // Calculate UPS net power input (power in less power to ITEquip) and UPS heat gain to zone
    7668        16932 :             if (state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower > 0.0) {
    7669        16932 :                 UPSPartLoadRatio = (CPUPower + FanPower) / state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower;
    7670              :             } else {
    7671            0 :                 UPSPartLoadRatio = 0.0;
    7672              :             }
    7673        16932 :             if (state.dataHeatBal->ZoneITEq(Loop).UPSEfficFPLRCurve != 0) {
    7674        16932 :                 UPSPower =
    7675        16932 :                     (CPUPower + FanPower) * max((1.0 - state.dataHeatBal->ZoneITEq(Loop).DesignUPSEfficiency *
    7676        16932 :                                                            CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).UPSEfficFPLRCurve, UPSPartLoadRatio)),
    7677              :                                                 0.0);
    7678              :             } else {
    7679            0 :                 UPSPower = (CPUPower + FanPower) * max((1.0 - state.dataHeatBal->ZoneITEq(Loop).DesignUPSEfficiency), 0.0);
    7680              :             }
    7681        16932 :             UPSHeatGain = UPSPower * state.dataHeatBal->ZoneITEq(Loop).UPSLossToZoneFrac;
    7682              : 
    7683              :             // Calculate air outlet conditions and convective heat gain to zone
    7684              : 
    7685        16932 :             AirMassFlowRate = AirVolFlowRate * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, TAirIn, WAirIn, RoutineName);
    7686        16932 :             if (AirMassFlowRate > 0.0) {
    7687        16911 :                 TAirOut = TAirIn + (CPUPower + FanPower) / AirMassFlowRate / PsyCpAirFnW(WAirIn);
    7688              :             } else {
    7689           21 :                 TAirOut = TAirIn;
    7690              :             }
    7691              : 
    7692        16932 :             if (std::abs(TAirOut - TSupply) < SmallTempDiff) {
    7693            0 :                 TAirOut = TSupply;
    7694              :             }
    7695              : 
    7696        16932 :             if ((SupplyNodeNum != 0) && (TAirOut != TSupply)) {
    7697        16932 :                 SupplyHeatIndex = (TAirIn - TSupply) / (TAirOut - TSupply);
    7698              :             } else {
    7699            0 :                 SupplyHeatIndex = 0.0;
    7700              :             }
    7701              : 
    7702        16932 :             if (AirConnection == ITEInletConnection::AdjustedSupply || AirConnection == ITEInletConnection::ZoneAirNode) {
    7703              :                 // If not a room air model, then all ITEquip power input is a convective heat gain to the zone heat balance, plus UPS heat gain
    7704        16932 :                 state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::ConGainToZone] = CPUPower + FanPower + UPSHeatGain;
    7705            0 :             } else if (AirConnection == ITEInletConnection::RoomAirModel) {
    7706              :                 // Room air model option not implemented yet - set room air model outlet node conditions here
    7707              :                 // If a room air model, then the only convective heat gain to the zone heat balance is the UPS heat gain
    7708            0 :                 state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::ConGainToZone] = UPSHeatGain;
    7709              :             }
    7710        16932 :             if (state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(Loop).ZonePtr).HasAdjustedReturnTempByITE) {
    7711         9480 :                 ZoneITEMap[state.dataHeatBal->ZoneITEq(Loop).ZonePtr].push_back(Loop);
    7712              :             }
    7713        16932 :             if (state.dataGlobal->DoingSizing && state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) {
    7714         2700 :                 if (state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::FanAtDesign] +
    7715         2700 :                         state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPUAtDesign] >
    7716         2700 :                     state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower) {
    7717         2700 :                     state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::ConGainToZone] =
    7718         5400 :                         state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::FanAtDesign] +
    7719         2700 :                         state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPUAtDesign];
    7720              :                 }
    7721              :             }
    7722              :             // Object report variables
    7723        16932 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPU] = CPUPower;
    7724        16932 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::Fan] = FanPower;
    7725        16932 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::UPS] = UPSPower;
    7726              :             // ZoneITEq( Loop ).CPUPowerAtDesign = set above
    7727              :             // ZoneITEq( Loop ).FanPowerAtDesign = set above
    7728        16932 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::UPSGainToZone] = UPSHeatGain; // UPSGainRateToZone = UPSHeatGain;
    7729              :             // ZoneITEq( Loop ).ConGainRateToZone = set above
    7730              : 
    7731       135456 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7732       118524 :                 state.dataHeatBal->ZoneRpt(NZ).PowerRpt[i] += state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i];
    7733       118524 :                 state.dataHeatBal->spaceRpt(spaceNum).PowerRpt[i] += state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i];
    7734       118524 :                 state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i] = state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i] * state.dataGlobal->TimeStepZoneSec;
    7735       118524 :                 state.dataHeatBal->ZoneRpt(NZ).EnergyRpt[i] += state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i];
    7736       118524 :                 state.dataHeatBal->spaceRpt(spaceNum).EnergyRpt[i] += state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i];
    7737              :             }
    7738              : 
    7739        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity = AirMassFlowRate / state.dataEnvrn->StdRhoAir;
    7740        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowCurDensity = AirVolFlowRate;
    7741        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirMassFlow = AirMassFlowRate;
    7742        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDryBulbT = TAirIn;
    7743        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDewpointT = TDPAirIn;
    7744        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirInletRelHum = RHAirIn;
    7745        16932 :             state.dataHeatBal->ZoneITEq(Loop).AirOutletDryBulbT = TAirOut;
    7746        16932 :             state.dataHeatBal->ZoneITEq(Loop).SHI = SupplyHeatIndex;
    7747              : 
    7748        16932 :             state.dataHeatBal->ZoneRpt(NZ).ITEqAirVolFlowStdDensity += state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity;
    7749        16932 :             state.dataHeatBal->ZoneRpt(NZ).ITEqAirMassFlow += state.dataHeatBal->ZoneITEq(Loop).AirMassFlow;
    7750        16932 :             state.dataHeatBal->ZoneRpt(NZ).SumTinMinusTSup += (TAirIn - TSupply) * AirVolFlowRate;
    7751        16932 :             state.dataHeatBal->ZoneRpt(NZ).SumToutMinusTSup += (TAirOut - TSupply) * AirVolFlowRate;
    7752              : 
    7753        16932 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirVolFlowStdDensity += state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity;
    7754        16932 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirMassFlow += state.dataHeatBal->ZoneITEq(Loop).AirMassFlow;
    7755        16932 :             state.dataHeatBal->spaceRpt(spaceNum).SumTinMinusTSup += (TAirIn - TSupply) * AirVolFlowRate;
    7756        16932 :             state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup += (TAirOut - TSupply) * AirVolFlowRate;
    7757              : 
    7758              :             // Check environmental class operating range limits (defined as parameters in this subroutine)
    7759              :             // Index for environmental class (None=0, A1=1, A2=2, A3=3, A4=4, B=5, C=6, H1=7)
    7760        16932 :             int EnvClass = static_cast<int>(state.dataHeatBal->ZoneITEq(Loop).Class);
    7761        16932 :             if (EnvClass > 0) {
    7762        16932 :                 if (TAirIn > DBMax[EnvClass]) {
    7763         2933 :                     state.dataHeatBal->ZoneITEq(Loop).TimeAboveDryBulbT = state.dataGlobal->TimeStepZone;
    7764         2933 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7765         2933 :                     state.dataHeatBal->ZoneITEq(Loop).DryBulbTAboveDeltaT = TAirIn - DBMax[EnvClass];
    7766         2933 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeAboveDryBulbT = state.dataGlobal->TimeStepZone;
    7767         2933 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7768         2933 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDryBulbT = state.dataGlobal->TimeStepZone;
    7769         2933 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7770              :                 }
    7771        16932 :                 if (TAirIn < DBMin[EnvClass]) {
    7772         1378 :                     state.dataHeatBal->ZoneITEq(Loop).TimeBelowDryBulbT = state.dataGlobal->TimeStepZone;
    7773         1378 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7774         1378 :                     state.dataHeatBal->ZoneITEq(Loop).DryBulbTBelowDeltaT = TAirIn - DBMin[EnvClass];
    7775         1378 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeBelowDryBulbT = state.dataGlobal->TimeStepZone;
    7776         1378 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7777         1378 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDryBulbT = state.dataGlobal->TimeStepZone;
    7778         1378 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7779              :                 }
    7780        16932 :                 if (TDPAirIn > DPMax[EnvClass]) {
    7781            6 :                     state.dataHeatBal->ZoneITEq(Loop).TimeAboveDewpointT = state.dataGlobal->TimeStepZone;
    7782            6 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7783            6 :                     state.dataHeatBal->ZoneITEq(Loop).DewpointTAboveDeltaT = TDPAirIn - DPMax[EnvClass];
    7784            6 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeAboveDewpointT = state.dataGlobal->TimeStepZone;
    7785            6 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7786            6 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDewpointT = state.dataGlobal->TimeStepZone;
    7787            6 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7788              :                 }
    7789        16932 :                 if (TDPAirIn < DPMin[EnvClass]) {
    7790         5219 :                     state.dataHeatBal->ZoneITEq(Loop).TimeBelowDewpointT = state.dataGlobal->TimeStepZone;
    7791         5219 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7792         5219 :                     state.dataHeatBal->ZoneITEq(Loop).DewpointTBelowDeltaT = TDPAirIn - DPMin[EnvClass];
    7793         5219 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeBelowDewpointT = state.dataGlobal->TimeStepZone;
    7794         5219 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7795         5219 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDewpointT = state.dataGlobal->TimeStepZone;
    7796         5219 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7797              :                 }
    7798        16932 :                 if (RHAirIn > RHMax[EnvClass]) {
    7799          697 :                     state.dataHeatBal->ZoneITEq(Loop).TimeAboveRH = state.dataGlobal->TimeStepZone;
    7800          697 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7801          697 :                     state.dataHeatBal->ZoneITEq(Loop).RHAboveDeltaRH = RHAirIn - RHMax[EnvClass];
    7802          697 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeAboveRH = state.dataGlobal->TimeStepZone;
    7803          697 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7804          697 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveRH = state.dataGlobal->TimeStepZone;
    7805          697 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7806              :                 }
    7807        16932 :                 if (RHAirIn < RHMin[EnvClass]) {
    7808         5703 :                     state.dataHeatBal->ZoneITEq(Loop).TimeBelowRH = state.dataGlobal->TimeStepZone;
    7809         5703 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7810         5703 :                     state.dataHeatBal->ZoneITEq(Loop).RHBelowDeltaRH = RHAirIn - RHMin[EnvClass];
    7811         5703 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeBelowRH = state.dataGlobal->TimeStepZone;
    7812         5703 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7813         5703 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowRH = state.dataGlobal->TimeStepZone;
    7814         5703 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7815              :                 }
    7816              :             }
    7817              : 
    7818              :         } // ZoneITEq calc loop
    7819              : 
    7820              :         // Zone and space-level sensible heat index
    7821        28440 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    7822        16932 :             int ZN = state.dataHeatBal->ZoneITEq(Loop).ZonePtr;
    7823        16932 :             int spaceNum = state.dataHeatBal->ZoneITEq(Loop).spaceIndex;
    7824        16932 :             if (state.dataHeatBal->ZoneRpt(ZN).SumToutMinusTSup != 0.0) {
    7825        16911 :                 state.dataHeatBal->ZoneRpt(ZN).ITEqSHI =
    7826        16911 :                     state.dataHeatBal->ZoneRpt(ZN).SumTinMinusTSup / state.dataHeatBal->ZoneRpt(ZN).SumToutMinusTSup;
    7827              :             }
    7828        16932 :             if (state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup != 0.0) {
    7829        16911 :                 state.dataHeatBal->spaceRpt(spaceNum).ITEqSHI =
    7830        16911 :                     state.dataHeatBal->spaceRpt(spaceNum).SumTinMinusTSup / state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup;
    7831              :             }
    7832              :         }
    7833              : 
    7834        11508 :         std::map<int, std::vector<int>>::iterator it = ZoneITEMap.begin();
    7835              :         Real64 totalGain;
    7836              :         Real64 totalRate;
    7837              :         Real64 TAirReturn;
    7838        20988 :         while (it != ZoneITEMap.end()) {
    7839         9480 :             if (state.dataHeatBal->Zone(it->first).HasAdjustedReturnTempByITE) {
    7840         9480 :                 totalGain = 0;
    7841         9480 :                 totalRate = 0;
    7842        18960 :                 for (int i : it->second) {
    7843         9480 :                     if (state.dataHeatBal->ZoneITEq(i).returnApproachTempSched != nullptr) {
    7844            0 :                         TAirReturn = state.dataHeatBal->ZoneITEq(i).AirOutletDryBulbT +
    7845            0 :                                      state.dataHeatBal->ZoneITEq(i).returnApproachTempSched->getCurrentVal();
    7846              :                     } else {
    7847         9480 :                         TAirReturn = state.dataHeatBal->ZoneITEq(i).AirOutletDryBulbT + state.dataHeatBal->ZoneITEq(i).ReturnApproachTemp;
    7848              :                     }
    7849         9480 :                     totalRate += state.dataHeatBal->ZoneITEq(i).AirMassFlow;
    7850         9480 :                     totalGain += state.dataHeatBal->ZoneITEq(i).AirMassFlow * TAirReturn;
    7851         9480 :                 }
    7852         9480 :                 if (totalRate != 0) {
    7853         9468 :                     state.dataHeatBal->Zone(it->first).AdjustedReturnTempByITE = totalGain / totalRate;
    7854         9468 :                     state.dataHeatBal->ZoneRpt(it->first).ITEAdjReturnTemp = state.dataHeatBal->Zone(it->first).AdjustedReturnTempByITE;
    7855              :                 }
    7856              :             }
    7857         9480 :             ++it;
    7858              :         }
    7859              : 
    7860        11508 :     } // End CalcZoneITEq
    7861              : 
    7862      2828408 :     void ReportInternalHeatGains(EnergyPlusData &state)
    7863              :     {
    7864              : 
    7865              :         // SUBROUTINE INFORMATION:
    7866              :         //       AUTHOR         Richard Liesen
    7867              :         //       DATE WRITTEN   June 1997
    7868              :         //       MODIFIED       July 1997 RKS
    7869              :         //       RE-ENGINEERED  December 1998 LKL
    7870              : 
    7871              :         // PURPOSE OF THIS SUBROUTINE:
    7872              :         // This subroutine currently creates the values for standard "zone loads" reporting
    7873              :         // from the heat balance module.
    7874              : 
    7875              :         // METHODOLOGY EMPLOYED:
    7876              :         // The reporting methodology is described in the OutputDataStructure.doc
    7877              :         // as the "modified modular" format.
    7878              : 
    7879              :         // REFERENCES:
    7880              :         // OutputDataStructure.doc (EnergyPlus documentation)
    7881              : 
    7882              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7883              :         static constexpr std::array<DataHeatBalance::IntGainType, 8> TradIntGainTypes = {DataHeatBalance::IntGainType::People,
    7884              :                                                                                          DataHeatBalance::IntGainType::Lights,
    7885              :                                                                                          DataHeatBalance::IntGainType::ElectricEquipment,
    7886              :                                                                                          DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled,
    7887              :                                                                                          DataHeatBalance::IntGainType::GasEquipment,
    7888              :                                                                                          DataHeatBalance::IntGainType::HotWaterEquipment,
    7889              :                                                                                          DataHeatBalance::IntGainType::SteamEquipment,
    7890              :                                                                                          DataHeatBalance::IntGainType::OtherEquipment};
    7891              : 
    7892     19899054 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) {
    7893     17070646 :             auto &thisPeople = state.dataHeatBal->People(Loop);
    7894     17070646 :             thisPeople.RadGainEnergy = thisPeople.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7895     17070646 :             thisPeople.ConGainEnergy = thisPeople.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7896     17070646 :             thisPeople.SenGainEnergy = thisPeople.SenGainRate * state.dataGlobal->TimeStepZoneSec;
    7897     17070646 :             thisPeople.LatGainEnergy = thisPeople.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7898     17070646 :             thisPeople.TotGainEnergy = thisPeople.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7899              :         }
    7900              : 
    7901     20950878 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    7902     18122470 :             auto &thisLights = state.dataHeatBal->Lights(Loop);
    7903     18122470 :             thisLights.Consumption = thisLights.Power * state.dataGlobal->TimeStepZoneSec;
    7904     18122470 :             thisLights.RadGainEnergy = thisLights.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7905     18122470 :             thisLights.VisGainEnergy = thisLights.VisGainRate * state.dataGlobal->TimeStepZoneSec;
    7906     18122470 :             thisLights.ConGainEnergy = thisLights.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7907     18122470 :             thisLights.RetAirGainEnergy = thisLights.RetAirGainRate * state.dataGlobal->TimeStepZoneSec;
    7908     18122470 :             thisLights.TotGainEnergy = thisLights.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7909     18122470 :             if (!state.dataGlobal->WarmupFlag) {
    7910      5072264 :                 if (state.dataGlobal->DoOutputReporting && state.dataOutRptTab->WriteTabularFiles &&
    7911      1975980 :                     (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather)) { // for weather simulations only
    7912              :                     // for tabular report, accumulate the total electricity used for each Light object
    7913       745060 :                     thisLights.SumConsumption += thisLights.Consumption;
    7914              :                     // for tabular report, accumulate the time when each Light has consumption (using a very small threshold instead of zero)
    7915       745060 :                     if (thisLights.Power > 0.01 * thisLights.DesignLevel) {
    7916       745060 :                         thisLights.SumTimeNotZeroCons += state.dataGlobal->TimeStepZone;
    7917              :                     }
    7918              :                 }
    7919              :             }
    7920              :         }
    7921              : 
    7922     21520029 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) {
    7923     18691621 :             auto &thisElecEquip = state.dataHeatBal->ZoneElectric(Loop);
    7924     18691621 :             thisElecEquip.Consumption = thisElecEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7925     18691621 :             thisElecEquip.RadGainEnergy = thisElecEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7926     18691621 :             thisElecEquip.ConGainEnergy = thisElecEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7927     18691621 :             thisElecEquip.LatGainEnergy = thisElecEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7928     18691621 :             thisElecEquip.LostEnergy = thisElecEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7929     18691621 :             thisElecEquip.TotGainEnergy = thisElecEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7930              :         }
    7931              : 
    7932      3192950 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) {
    7933       364542 :             auto &thisGasEquip = state.dataHeatBal->ZoneGas(Loop);
    7934       364542 :             thisGasEquip.Consumption = thisGasEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7935       364542 :             thisGasEquip.RadGainEnergy = thisGasEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7936       364542 :             thisGasEquip.ConGainEnergy = thisGasEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7937       364542 :             thisGasEquip.LatGainEnergy = thisGasEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7938       364542 :             thisGasEquip.LostEnergy = thisGasEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7939       364542 :             thisGasEquip.TotGainEnergy = thisGasEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7940              :         }
    7941              : 
    7942      3413561 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) {
    7943       585153 :             auto &thisOtherEquip = state.dataHeatBal->ZoneOtherEq(Loop);
    7944       585153 :             thisOtherEquip.Consumption = thisOtherEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7945       585153 :             thisOtherEquip.RadGainEnergy = thisOtherEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7946       585153 :             thisOtherEquip.ConGainEnergy = thisOtherEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7947       585153 :             thisOtherEquip.LatGainEnergy = thisOtherEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7948       585153 :             thisOtherEquip.LostEnergy = thisOtherEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7949       585153 :             thisOtherEquip.TotGainEnergy = thisOtherEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7950              :         }
    7951              : 
    7952      2914688 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) {
    7953        86280 :             auto &thisHWEquip = state.dataHeatBal->ZoneHWEq(Loop);
    7954        86280 :             thisHWEquip.Consumption = thisHWEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7955        86280 :             thisHWEquip.RadGainEnergy = thisHWEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7956        86280 :             thisHWEquip.ConGainEnergy = thisHWEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7957        86280 :             thisHWEquip.LatGainEnergy = thisHWEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7958        86280 :             thisHWEquip.LostEnergy = thisHWEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7959        86280 :             thisHWEquip.TotGainEnergy = thisHWEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7960              :         }
    7961              : 
    7962      2841923 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) {
    7963        13515 :             auto &thisSteamEquip = state.dataHeatBal->ZoneSteamEq(Loop);
    7964        13515 :             thisSteamEquip.Consumption = thisSteamEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7965        13515 :             thisSteamEquip.RadGainEnergy = thisSteamEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7966        13515 :             thisSteamEquip.ConGainEnergy = thisSteamEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7967        13515 :             thisSteamEquip.LatGainEnergy = thisSteamEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7968        13515 :             thisSteamEquip.LostEnergy = thisSteamEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7969        13515 :             thisSteamEquip.TotGainEnergy = thisSteamEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7970              :         }
    7971              : 
    7972      2836517 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) {
    7973         8109 :             auto &thisBBHeat = state.dataHeatBal->ZoneBBHeat(Loop);
    7974         8109 :             thisBBHeat.Consumption = thisBBHeat.Power * state.dataGlobal->TimeStepZoneSec;
    7975         8109 :             thisBBHeat.RadGainEnergy = thisBBHeat.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7976         8109 :             thisBBHeat.ConGainEnergy = thisBBHeat.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7977         8109 :             thisBBHeat.TotGainEnergy = thisBBHeat.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7978              :         }
    7979              : 
    7980              :         // Zero zone-level values
    7981     23363819 :         for (auto &e : state.dataHeatBal->ZoneIntGain) {
    7982     20535411 :             e.NOFOCC = 0.0;
    7983     20535411 :             e.QLTSW = 0.0;
    7984      2828408 :         }
    7985              : 
    7986     23363819 :         for (auto &e : state.dataHeatBal->ZoneRpt) {
    7987              :             // People
    7988     20535411 :             e.PeopleRadGain = 0.0;
    7989     20535411 :             e.PeopleConGain = 0.0;
    7990     20535411 :             e.PeopleSenGain = 0.0;
    7991     20535411 :             e.PeopleNumOcc = 0.0;
    7992     20535411 :             e.PeopleLatGain = 0.0;
    7993     20535411 :             e.PeopleTotGain = 0.0;
    7994     20535411 :             e.PeopleRadGainRate = 0.0;
    7995     20535411 :             e.PeopleConGainRate = 0.0;
    7996     20535411 :             e.PeopleSenGainRate = 0.0;
    7997     20535411 :             e.PeopleLatGainRate = 0.0;
    7998     20535411 :             e.PeopleTotGainRate = 0.0;
    7999              :             // Lights
    8000     20535411 :             e.LtsPower = 0.0;
    8001     20535411 :             e.LtsElecConsump = 0.0;
    8002     20535411 :             e.LtsRadGain = 0.0;
    8003     20535411 :             e.LtsVisGain = 0.0;
    8004     20535411 :             e.LtsConGain = 0.0;
    8005     20535411 :             e.LtsRetAirGain = 0.0;
    8006     20535411 :             e.LtsTotGain = 0.0;
    8007     20535411 :             e.LtsRadGainRate = 0.0;
    8008     20535411 :             e.LtsVisGainRate = 0.0;
    8009     20535411 :             e.LtsConGainRate = 0.0;
    8010     20535411 :             e.LtsRetAirGainRate = 0.0;
    8011     20535411 :             e.LtsTotGainRate = 0.0;
    8012              :             // Baseboard Heat
    8013     20535411 :             e.BaseHeatPower = 0.0;
    8014     20535411 :             e.BaseHeatElecCons = 0.0;
    8015     20535411 :             e.BaseHeatRadGain = 0.0;
    8016     20535411 :             e.BaseHeatConGain = 0.0;
    8017     20535411 :             e.BaseHeatTotGain = 0.0;
    8018     20535411 :             e.BaseHeatRadGainRate = 0.0;
    8019     20535411 :             e.BaseHeatConGainRate = 0.0;
    8020     20535411 :             e.BaseHeatTotGainRate = 0.0;
    8021              :             // Electric Equipment
    8022     20535411 :             e.ElecPower = 0.0;
    8023     20535411 :             e.ElecConsump = 0.0;
    8024     20535411 :             e.ElecRadGain = 0.0;
    8025     20535411 :             e.ElecConGain = 0.0;
    8026     20535411 :             e.ElecLatGain = 0.0;
    8027     20535411 :             e.ElecLost = 0.0;
    8028     20535411 :             e.ElecTotGain = 0.0;
    8029     20535411 :             e.ElecRadGainRate = 0.0;
    8030     20535411 :             e.ElecConGainRate = 0.0;
    8031     20535411 :             e.ElecLatGainRate = 0.0;
    8032     20535411 :             e.ElecLostRate = 0.0;
    8033     20535411 :             e.ElecTotGainRate = 0.0;
    8034              :             // Gas Equipment
    8035     20535411 :             e.GasPower = 0.0;
    8036     20535411 :             e.GasConsump = 0.0;
    8037     20535411 :             e.GasRadGain = 0.0;
    8038     20535411 :             e.GasConGain = 0.0;
    8039     20535411 :             e.GasLatGain = 0.0;
    8040     20535411 :             e.GasLost = 0.0;
    8041     20535411 :             e.GasTotGain = 0.0;
    8042     20535411 :             e.GasRadGainRate = 0.0;
    8043     20535411 :             e.GasConGainRate = 0.0;
    8044     20535411 :             e.GasLatGainRate = 0.0;
    8045     20535411 :             e.GasLostRate = 0.0;
    8046     20535411 :             e.GasTotGainRate = 0.0;
    8047              :             // Hot Water Equipment
    8048     20535411 :             e.HWPower = 0.0;
    8049     20535411 :             e.HWConsump = 0.0;
    8050     20535411 :             e.HWRadGain = 0.0;
    8051     20535411 :             e.HWConGain = 0.0;
    8052     20535411 :             e.HWLatGain = 0.0;
    8053     20535411 :             e.HWLost = 0.0;
    8054     20535411 :             e.HWTotGain = 0.0;
    8055     20535411 :             e.HWRadGainRate = 0.0;
    8056     20535411 :             e.HWConGainRate = 0.0;
    8057     20535411 :             e.HWLatGainRate = 0.0;
    8058     20535411 :             e.HWLostRate = 0.0;
    8059     20535411 :             e.HWTotGainRate = 0.0;
    8060              :             // Steam Equipment
    8061     20535411 :             e.SteamPower = 0.0;
    8062     20535411 :             e.SteamConsump = 0.0;
    8063     20535411 :             e.SteamRadGain = 0.0;
    8064     20535411 :             e.SteamConGain = 0.0;
    8065     20535411 :             e.SteamLatGain = 0.0;
    8066     20535411 :             e.SteamLost = 0.0;
    8067     20535411 :             e.SteamTotGain = 0.0;
    8068     20535411 :             e.SteamRadGainRate = 0.0;
    8069     20535411 :             e.SteamConGainRate = 0.0;
    8070     20535411 :             e.SteamLatGainRate = 0.0;
    8071     20535411 :             e.SteamLostRate = 0.0;
    8072     20535411 :             e.SteamTotGainRate = 0.0;
    8073              :             // Other Equipment
    8074     20535411 :             e.OtherRadGain = 0.0;
    8075     20535411 :             e.OtherConGain = 0.0;
    8076     20535411 :             e.OtherLatGain = 0.0;
    8077     20535411 :             e.OtherLost = 0.0;
    8078     20535411 :             e.OtherTotGain = 0.0;
    8079     20535411 :             e.OtherRadGainRate = 0.0;
    8080     20535411 :             e.OtherConGainRate = 0.0;
    8081     20535411 :             e.OtherLatGainRate = 0.0;
    8082     20535411 :             e.OtherLostRate = 0.0;
    8083     20535411 :             e.OtherTotGainRate = 0.0;
    8084              :             // Overall Zone Variables
    8085     20535411 :             e.TotRadiantGain = 0.0;
    8086     20535411 :             e.TotVisHeatGain = 0.0;
    8087     20535411 :             e.TotConvectiveGain = 0.0;
    8088     20535411 :             e.TotLatentGain = 0.0;
    8089     20535411 :             e.TotTotalHeatGain = 0.0;
    8090     20535411 :             e.TotRadiantGainRate = 0.0;
    8091     20535411 :             e.TotVisHeatGainRate = 0.0;
    8092     20535411 :             e.TotConvectiveGainRate = 0.0;
    8093     20535411 :             e.TotLatentGainRate = 0.0;
    8094     20535411 :             e.TotTotalHeatGainRate = 0.0;
    8095              :             // Contaminant
    8096              :             // e.CO2Rate = 0.0; - cleared and accumulated in InitInternalHeatGains
    8097     20535411 :             e.GCRate = 0.0;
    8098    328566576 :             for (int i = 0; i < (int)Constant::eFuel::Num; ++i) {
    8099    308031165 :                 e.OtherPower[i] = 0.0;
    8100    308031165 :                 e.OtherConsump[i] = 0.0;
    8101              :             }
    8102      2828408 :         }
    8103              : 
    8104     23412419 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    8105     20584011 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(spaceNum);
    8106     20584011 :             auto &thisSpaceIntGain = state.dataHeatBal->spaceIntGain(spaceNum);
    8107     20584011 :             int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    8108     20584011 :             auto &thisZoneRpt = state.dataHeatBal->ZoneRpt(zoneNum);
    8109     20584011 :             auto &thisZoneIntGain = state.dataHeatBal->ZoneIntGain(zoneNum);
    8110              :             // People
    8111     20584011 :             thisSpaceRpt.PeopleNumOcc = thisSpaceIntGain.NOFOCC;
    8112     20584011 :             thisSpaceRpt.PeopleRadGain = thisSpaceRpt.PeopleRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8113     20584011 :             thisSpaceRpt.PeopleConGain = thisSpaceRpt.PeopleConGainRate * state.dataGlobal->TimeStepZoneSec;
    8114     20584011 :             thisSpaceRpt.PeopleSenGain = thisSpaceRpt.PeopleSenGainRate * state.dataGlobal->TimeStepZoneSec;
    8115     20584011 :             thisSpaceRpt.PeopleLatGain = thisSpaceRpt.PeopleLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8116     20584011 :             thisSpaceRpt.PeopleTotGain = thisSpaceRpt.PeopleTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8117              : 
    8118     20584011 :             thisZoneIntGain.NOFOCC += thisSpaceIntGain.NOFOCC;
    8119     20584011 :             thisZoneRpt.PeopleRadGainRate += thisSpaceRpt.PeopleRadGainRate;
    8120     20584011 :             thisZoneRpt.PeopleConGainRate += thisSpaceRpt.PeopleConGainRate;
    8121     20584011 :             thisZoneRpt.PeopleSenGainRate += thisSpaceRpt.PeopleSenGainRate;
    8122     20584011 :             thisZoneRpt.PeopleLatGainRate += thisSpaceRpt.PeopleLatGainRate;
    8123     20584011 :             thisZoneRpt.PeopleTotGainRate += thisSpaceRpt.PeopleTotGainRate;
    8124              : 
    8125              :             // General Lights
    8126     20584011 :             thisSpaceRpt.LtsElecConsump = thisSpaceRpt.LtsPower * state.dataGlobal->TimeStepZoneSec;
    8127     20584011 :             thisSpaceRpt.LtsRetAirGain = thisSpaceRpt.LtsRetAirGainRate * state.dataGlobal->TimeStepZoneSec;
    8128     20584011 :             thisSpaceRpt.LtsRadGain = thisSpaceRpt.LtsRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8129     20584011 :             thisSpaceRpt.LtsTotGain = thisSpaceRpt.LtsTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8130     20584011 :             thisSpaceRpt.LtsConGain = thisSpaceRpt.LtsConGainRate * state.dataGlobal->TimeStepZoneSec;
    8131     20584011 :             thisSpaceRpt.LtsVisGain = thisSpaceRpt.LtsVisGainRate * state.dataGlobal->TimeStepZoneSec;
    8132              : 
    8133     20584011 :             thisZoneRpt.LtsPower += thisSpaceRpt.LtsPower;
    8134     20584011 :             thisZoneRpt.LtsRetAirGainRate += thisSpaceRpt.LtsRetAirGainRate;
    8135     20584011 :             thisZoneRpt.LtsRadGainRate += thisSpaceRpt.LtsRadGainRate;
    8136     20584011 :             thisZoneRpt.LtsTotGainRate += thisSpaceRpt.LtsTotGainRate;
    8137     20584011 :             thisZoneRpt.LtsConGainRate += thisSpaceRpt.LtsConGainRate;
    8138     20584011 :             thisZoneRpt.LtsVisGainRate += thisSpaceRpt.LtsVisGainRate;
    8139     20584011 :             thisZoneIntGain.QLTSW += thisSpaceIntGain.QLTSW;
    8140              : 
    8141              :             // Electric Equipment
    8142     20584011 :             thisSpaceRpt.ElecConsump = thisSpaceRpt.ElecPower * state.dataGlobal->TimeStepZoneSec;
    8143     20584011 :             thisSpaceRpt.ElecConGain = thisSpaceRpt.ElecConGainRate * state.dataGlobal->TimeStepZoneSec;
    8144     20584011 :             thisSpaceRpt.ElecRadGain = thisSpaceRpt.ElecRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8145     20584011 :             thisSpaceRpt.ElecLatGain = thisSpaceRpt.ElecLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8146     20584011 :             thisSpaceRpt.ElecLost = thisSpaceRpt.ElecLostRate * state.dataGlobal->TimeStepZoneSec;
    8147     20584011 :             thisSpaceRpt.ElecTotGainRate = thisSpaceRpt.ElecConGainRate + thisSpaceRpt.ElecRadGainRate + thisSpaceRpt.ElecLatGainRate;
    8148     20584011 :             thisSpaceRpt.ElecTotGain = thisSpaceRpt.ElecTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8149              : 
    8150     20584011 :             thisZoneRpt.ElecPower += thisSpaceRpt.ElecPower;
    8151     20584011 :             thisZoneRpt.ElecConGainRate += thisSpaceRpt.ElecConGainRate;
    8152     20584011 :             thisZoneRpt.ElecRadGainRate += thisSpaceRpt.ElecRadGainRate;
    8153     20584011 :             thisZoneRpt.ElecLatGainRate += thisSpaceRpt.ElecLatGainRate;
    8154     20584011 :             thisZoneRpt.ElecLostRate += thisSpaceRpt.ElecLostRate;
    8155     20584011 :             thisZoneRpt.ElecTotGainRate += thisSpaceRpt.ElecTotGainRate;
    8156              : 
    8157              :             // Gas Equipment
    8158     20584011 :             thisSpaceRpt.GasConsump = thisSpaceRpt.GasPower * state.dataGlobal->TimeStepZoneSec;
    8159     20584011 :             thisSpaceRpt.GasConGain = thisSpaceRpt.GasConGainRate * state.dataGlobal->TimeStepZoneSec;
    8160     20584011 :             thisSpaceRpt.GasRadGain = thisSpaceRpt.GasRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8161     20584011 :             thisSpaceRpt.GasLatGain = thisSpaceRpt.GasLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8162     20584011 :             thisSpaceRpt.GasLost = thisSpaceRpt.GasLostRate * state.dataGlobal->TimeStepZoneSec;
    8163     20584011 :             thisSpaceRpt.GasTotGainRate = thisSpaceRpt.GasConGainRate + thisSpaceRpt.GasRadGainRate + thisSpaceRpt.GasLatGainRate;
    8164     20584011 :             thisSpaceRpt.GasTotGain = thisSpaceRpt.GasTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8165              : 
    8166     20584011 :             thisZoneRpt.GasPower += thisSpaceRpt.GasPower;
    8167     20584011 :             thisZoneRpt.GasConGainRate += thisSpaceRpt.GasConGainRate;
    8168     20584011 :             thisZoneRpt.GasRadGainRate += thisSpaceRpt.GasRadGainRate;
    8169     20584011 :             thisZoneRpt.GasLatGainRate += thisSpaceRpt.GasLatGainRate;
    8170     20584011 :             thisZoneRpt.GasLostRate += thisSpaceRpt.GasLostRate;
    8171     20584011 :             thisZoneRpt.GasTotGainRate += thisSpaceRpt.GasTotGainRate;
    8172              : 
    8173              :             // Hot Water Equipment
    8174     20584011 :             thisSpaceRpt.HWConsump = thisSpaceRpt.HWPower * state.dataGlobal->TimeStepZoneSec;
    8175     20584011 :             thisSpaceRpt.HWConGain = thisSpaceRpt.HWConGainRate * state.dataGlobal->TimeStepZoneSec;
    8176     20584011 :             thisSpaceRpt.HWRadGain = thisSpaceRpt.HWRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8177     20584011 :             thisSpaceRpt.HWLatGain = thisSpaceRpt.HWLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8178     20584011 :             thisSpaceRpt.HWLost = thisSpaceRpt.HWLostRate * state.dataGlobal->TimeStepZoneSec;
    8179     20584011 :             thisSpaceRpt.HWTotGainRate = thisSpaceRpt.HWConGainRate + thisSpaceRpt.HWRadGainRate + thisSpaceRpt.HWLatGainRate;
    8180     20584011 :             thisSpaceRpt.HWTotGain = thisSpaceRpt.HWTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8181              : 
    8182     20584011 :             thisZoneRpt.HWPower += thisSpaceRpt.HWPower;
    8183     20584011 :             thisZoneRpt.HWConGainRate += thisSpaceRpt.HWConGainRate;
    8184     20584011 :             thisZoneRpt.HWRadGainRate += thisSpaceRpt.HWRadGainRate;
    8185     20584011 :             thisZoneRpt.HWLatGainRate += thisSpaceRpt.HWLatGainRate;
    8186     20584011 :             thisZoneRpt.HWLostRate += thisSpaceRpt.HWLostRate;
    8187     20584011 :             thisZoneRpt.HWTotGainRate += thisSpaceRpt.HWTotGainRate;
    8188              : 
    8189              :             // Steam Equipment
    8190     20584011 :             thisSpaceRpt.SteamConsump = thisSpaceRpt.SteamPower * state.dataGlobal->TimeStepZoneSec;
    8191     20584011 :             thisSpaceRpt.SteamConGain = thisSpaceRpt.SteamConGainRate * state.dataGlobal->TimeStepZoneSec;
    8192     20584011 :             thisSpaceRpt.SteamRadGain = thisSpaceRpt.SteamRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8193     20584011 :             thisSpaceRpt.SteamLatGain = thisSpaceRpt.SteamLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8194     20584011 :             thisSpaceRpt.SteamLost = thisSpaceRpt.SteamLostRate * state.dataGlobal->TimeStepZoneSec;
    8195     20584011 :             thisSpaceRpt.SteamTotGainRate = thisSpaceRpt.SteamConGainRate + thisSpaceRpt.SteamRadGainRate + thisSpaceRpt.SteamLatGainRate;
    8196     20584011 :             thisSpaceRpt.SteamTotGain = thisSpaceRpt.SteamTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8197              : 
    8198     20584011 :             thisZoneRpt.SteamPower += thisSpaceRpt.SteamPower;
    8199     20584011 :             thisZoneRpt.SteamConGainRate += thisSpaceRpt.SteamConGainRate;
    8200     20584011 :             thisZoneRpt.SteamRadGainRate += thisSpaceRpt.SteamRadGainRate;
    8201     20584011 :             thisZoneRpt.SteamLatGainRate += thisSpaceRpt.SteamLatGainRate;
    8202     20584011 :             thisZoneRpt.SteamLostRate += thisSpaceRpt.SteamLostRate;
    8203     20584011 :             thisZoneRpt.SteamTotGainRate += thisSpaceRpt.SteamTotGainRate;
    8204              : 
    8205              :             // Other Equipment
    8206     20584011 :             thisSpaceRpt.OtherConGain = thisSpaceRpt.OtherConGainRate * state.dataGlobal->TimeStepZoneSec;
    8207     20584011 :             thisSpaceRpt.OtherRadGain = thisSpaceRpt.OtherRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8208     20584011 :             thisSpaceRpt.OtherLatGain = thisSpaceRpt.OtherLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8209     20584011 :             thisSpaceRpt.OtherLost = thisSpaceRpt.OtherLostRate * state.dataGlobal->TimeStepZoneSec;
    8210     20584011 :             thisSpaceRpt.OtherTotGainRate = thisSpaceRpt.OtherConGainRate + thisSpaceRpt.OtherRadGainRate + thisSpaceRpt.OtherLatGainRate;
    8211     20584011 :             thisSpaceRpt.OtherTotGain = thisSpaceRpt.OtherTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8212              : 
    8213     20584011 :             thisZoneRpt.OtherConGainRate += thisSpaceRpt.OtherConGainRate;
    8214     20584011 :             thisZoneRpt.OtherRadGainRate += thisSpaceRpt.OtherRadGainRate;
    8215     20584011 :             thisZoneRpt.OtherLatGainRate += thisSpaceRpt.OtherLatGainRate;
    8216     20584011 :             thisZoneRpt.OtherLostRate += thisSpaceRpt.OtherLostRate;
    8217     20584011 :             thisZoneRpt.OtherTotGainRate += thisSpaceRpt.OtherTotGainRate;
    8218              : 
    8219     20597802 :             for (Constant::eFuel fuelTypeNum : state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums) {
    8220        13791 :                 int fuelIdx = (int)fuelTypeNum;
    8221        13791 :                 thisSpaceRpt.OtherConsump[fuelIdx] = thisSpaceRpt.OtherPower[fuelIdx] * state.dataGlobal->TimeStepZoneSec;
    8222        13791 :                 thisZoneRpt.OtherPower[fuelIdx] += thisSpaceRpt.OtherPower[fuelIdx];
    8223     20584011 :             }
    8224              : 
    8225              :             // Baseboard Heat
    8226     20584011 :             thisSpaceRpt.BaseHeatElecCons = thisSpaceRpt.BaseHeatPower * state.dataGlobal->TimeStepZoneSec;
    8227     20584011 :             thisSpaceRpt.BaseHeatConGain = thisSpaceRpt.BaseHeatConGainRate * state.dataGlobal->TimeStepZoneSec;
    8228     20584011 :             thisSpaceRpt.BaseHeatRadGain = thisSpaceRpt.BaseHeatRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8229     20584011 :             thisSpaceRpt.BaseHeatTotGainRate = thisSpaceRpt.BaseHeatConGainRate + thisSpaceRpt.BaseHeatRadGainRate;
    8230     20584011 :             thisSpaceRpt.BaseHeatTotGain = thisSpaceRpt.BaseHeatTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8231              : 
    8232     20584011 :             thisZoneRpt.BaseHeatPower += thisSpaceRpt.BaseHeatPower;
    8233     20584011 :             thisZoneRpt.BaseHeatConGainRate += thisSpaceRpt.BaseHeatConGainRate;
    8234     20584011 :             thisZoneRpt.BaseHeatRadGainRate += thisSpaceRpt.BaseHeatRadGainRate;
    8235     20584011 :             thisZoneRpt.BaseHeatTotGainRate += thisSpaceRpt.BaseHeatTotGainRate;
    8236              : 
    8237              :             // Overall Space Variables
    8238              : 
    8239              :             // these overalls include component gains from devices like water heater, water use, and generators
    8240              :             //   working vars QFCConv QGenConv QFCRad QGenRad  WaterUseLatentGain WaterThermalTankGain WaterUseSensibleGain
    8241              : 
    8242     20584011 :             thisSpaceRpt.TotVisHeatGain = thisSpaceRpt.LtsVisGain;
    8243     20584011 :             thisSpaceRpt.TotVisHeatGainRate = thisSpaceRpt.LtsVisGainRate;
    8244              : 
    8245     20584011 :             thisSpaceRpt.TotRadiantGainRate = SumInternalRadiationGainsByTypes(state, zoneNum, TradIntGainTypes, spaceNum);
    8246     20584011 :             thisSpaceRpt.TotRadiantGain = thisSpaceRpt.TotRadiantGainRate * state.dataGlobal->TimeStepZoneSec;
    8247              : 
    8248     20584011 :             thisSpaceRpt.TotConvectiveGainRate = SumInternalConvectionGainsByTypes(state, zoneNum, TradIntGainTypes, spaceNum);
    8249     20584011 :             thisSpaceRpt.TotConvectiveGain = thisSpaceRpt.TotConvectiveGainRate * state.dataGlobal->TimeStepZoneSec;
    8250              : 
    8251     20584011 :             thisSpaceRpt.TotLatentGainRate = SumInternalLatentGainsByTypes(state, zoneNum, TradIntGainTypes, spaceNum);
    8252     20584011 :             thisSpaceRpt.TotLatentGain = thisSpaceRpt.TotLatentGainRate * state.dataGlobal->TimeStepZoneSec;
    8253              : 
    8254     20584011 :             thisSpaceRpt.TotTotalHeatGainRate = thisSpaceRpt.TotLatentGainRate + thisSpaceRpt.TotRadiantGainRate +
    8255     20584011 :                                                 thisSpaceRpt.TotConvectiveGainRate + thisSpaceRpt.TotVisHeatGainRate;
    8256     20584011 :             thisSpaceRpt.TotTotalHeatGain = thisSpaceRpt.TotTotalHeatGainRate * state.dataGlobal->TimeStepZoneSec;
    8257              :         }
    8258              : 
    8259     23363819 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    8260     20535411 :             auto &thisZoneRpt = state.dataHeatBal->ZoneRpt(zoneNum);
    8261     20535411 :             auto &thisZoneIntGain = state.dataHeatBal->ZoneIntGain(zoneNum);
    8262              : 
    8263              :             // People
    8264     20535411 :             thisZoneRpt.PeopleNumOcc = thisZoneIntGain.NOFOCC;
    8265     20535411 :             thisZoneRpt.PeopleRadGain = thisZoneRpt.PeopleRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8266     20535411 :             thisZoneRpt.PeopleConGain = thisZoneRpt.PeopleConGainRate * state.dataGlobal->TimeStepZoneSec;
    8267     20535411 :             thisZoneRpt.PeopleSenGain = thisZoneRpt.PeopleSenGainRate * state.dataGlobal->TimeStepZoneSec;
    8268     20535411 :             thisZoneRpt.PeopleLatGain = thisZoneRpt.PeopleLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8269     20535411 :             thisZoneRpt.PeopleTotGain = thisZoneRpt.PeopleTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8270              : 
    8271              :             // General Lights
    8272     20535411 :             thisZoneRpt.LtsRetAirGain = thisZoneRpt.LtsRetAirGainRate * state.dataGlobal->TimeStepZoneSec;
    8273     20535411 :             thisZoneRpt.LtsRadGain = thisZoneRpt.LtsRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8274     20535411 :             thisZoneRpt.LtsTotGain = thisZoneRpt.LtsTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8275     20535411 :             thisZoneRpt.LtsConGain = thisZoneRpt.LtsConGainRate * state.dataGlobal->TimeStepZoneSec;
    8276     20535411 :             thisZoneRpt.LtsVisGain = thisZoneRpt.LtsVisGainRate * state.dataGlobal->TimeStepZoneSec;
    8277     20535411 :             thisZoneRpt.LtsElecConsump = thisZoneRpt.LtsPower * state.dataGlobal->TimeStepZoneSec;
    8278              : 
    8279              :             // Electric Equipment
    8280     20535411 :             thisZoneRpt.ElecConGain = thisZoneRpt.ElecConGainRate * state.dataGlobal->TimeStepZoneSec;
    8281     20535411 :             thisZoneRpt.ElecRadGain = thisZoneRpt.ElecRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8282     20535411 :             thisZoneRpt.ElecLatGain = thisZoneRpt.ElecLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8283     20535411 :             thisZoneRpt.ElecLost = thisZoneRpt.ElecLostRate * state.dataGlobal->TimeStepZoneSec;
    8284     20535411 :             thisZoneRpt.ElecConsump = thisZoneRpt.ElecPower * state.dataGlobal->TimeStepZoneSec;
    8285     20535411 :             thisZoneRpt.ElecTotGain = thisZoneRpt.ElecTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8286              : 
    8287              :             // Gas Equipment
    8288     20535411 :             thisZoneRpt.GasConGain = thisZoneRpt.GasConGainRate * state.dataGlobal->TimeStepZoneSec;
    8289     20535411 :             thisZoneRpt.GasRadGain = thisZoneRpt.GasRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8290     20535411 :             thisZoneRpt.GasLatGain = thisZoneRpt.GasLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8291     20535411 :             thisZoneRpt.GasLost = thisZoneRpt.GasLostRate * state.dataGlobal->TimeStepZoneSec;
    8292     20535411 :             thisZoneRpt.GasConsump = thisZoneRpt.GasPower * state.dataGlobal->TimeStepZoneSec;
    8293     20535411 :             thisZoneRpt.GasTotGain = thisZoneRpt.GasTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8294              : 
    8295              :             // Hot Water Equipment
    8296     20535411 :             thisZoneRpt.HWConGain = thisZoneRpt.HWConGainRate * state.dataGlobal->TimeStepZoneSec;
    8297     20535411 :             thisZoneRpt.HWRadGain = thisZoneRpt.HWRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8298     20535411 :             thisZoneRpt.HWLatGain = thisZoneRpt.HWLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8299     20535411 :             thisZoneRpt.HWLost = thisZoneRpt.HWLostRate * state.dataGlobal->TimeStepZoneSec;
    8300     20535411 :             thisZoneRpt.HWConsump = thisZoneRpt.HWPower * state.dataGlobal->TimeStepZoneSec;
    8301     20535411 :             thisZoneRpt.HWTotGain = thisZoneRpt.HWTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8302              : 
    8303              :             // Steam Equipment
    8304     20535411 :             thisZoneRpt.SteamConGain = thisZoneRpt.SteamConGainRate * state.dataGlobal->TimeStepZoneSec;
    8305     20535411 :             thisZoneRpt.SteamRadGain = thisZoneRpt.SteamRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8306     20535411 :             thisZoneRpt.SteamLatGain = thisZoneRpt.SteamLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8307     20535411 :             thisZoneRpt.SteamLost = thisZoneRpt.SteamLostRate * state.dataGlobal->TimeStepZoneSec;
    8308     20535411 :             thisZoneRpt.SteamConsump = thisZoneRpt.SteamPower * state.dataGlobal->TimeStepZoneSec;
    8309     20535411 :             thisZoneRpt.SteamTotGain = thisZoneRpt.SteamTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8310              : 
    8311              :             // Other Equipment
    8312     20535411 :             thisZoneRpt.OtherConGain = thisZoneRpt.OtherConGainRate * state.dataGlobal->TimeStepZoneSec;
    8313     20535411 :             thisZoneRpt.OtherRadGain = thisZoneRpt.OtherRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8314     20535411 :             thisZoneRpt.OtherLatGain = thisZoneRpt.OtherLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8315     20535411 :             thisZoneRpt.OtherLost = thisZoneRpt.OtherLostRate * state.dataGlobal->TimeStepZoneSec;
    8316     20535411 :             thisZoneRpt.OtherTotGain = thisZoneRpt.OtherTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8317     20549202 :             for (Constant::eFuel fuelTypeNum : state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums) {
    8318        13791 :                 int fuelIdx = (int)fuelTypeNum;
    8319        13791 :                 thisZoneRpt.OtherConsump[fuelIdx] = thisZoneRpt.OtherPower[fuelIdx] * state.dataGlobal->TimeStepZoneSec;
    8320     20535411 :             }
    8321              : 
    8322              :             // Baseboard Heat
    8323     20535411 :             thisZoneRpt.BaseHeatConGain = thisZoneRpt.BaseHeatConGainRate * state.dataGlobal->TimeStepZoneSec;
    8324     20535411 :             thisZoneRpt.BaseHeatRadGain = thisZoneRpt.BaseHeatRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8325     20535411 :             thisZoneRpt.BaseHeatElecCons = thisZoneRpt.BaseHeatPower * state.dataGlobal->TimeStepZoneSec;
    8326     20535411 :             thisZoneRpt.BaseHeatTotGain = thisZoneRpt.BaseHeatTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8327              : 
    8328              :             // Overall Zone Variables
    8329              : 
    8330              :             // these overalls include component gains from devices like water heater, water use, and generators
    8331              :             //   working vars QFCConv QGenConv QFCRad QGenRad  WaterUseLatentGain WaterThermalTankGain WaterUseSensibleGain
    8332              : 
    8333     20535411 :             thisZoneRpt.TotVisHeatGain = thisZoneRpt.LtsVisGain;
    8334     20535411 :             thisZoneRpt.TotVisHeatGainRate = thisZoneRpt.LtsVisGainRate;
    8335              : 
    8336     20535411 :             thisZoneRpt.TotRadiantGainRate = SumInternalRadiationGainsByTypes(state, zoneNum, TradIntGainTypes);
    8337     20535411 :             thisZoneRpt.TotRadiantGain = thisZoneRpt.TotRadiantGainRate * state.dataGlobal->TimeStepZoneSec;
    8338              : 
    8339     20535411 :             thisZoneRpt.TotConvectiveGainRate = SumInternalConvectionGainsByTypes(state, zoneNum, TradIntGainTypes);
    8340     20535411 :             thisZoneRpt.TotConvectiveGain = thisZoneRpt.TotConvectiveGainRate * state.dataGlobal->TimeStepZoneSec;
    8341              : 
    8342     20535411 :             thisZoneRpt.TotLatentGainRate = SumInternalLatentGainsByTypes(state, zoneNum, TradIntGainTypes);
    8343     20535411 :             thisZoneRpt.TotLatentGain = thisZoneRpt.TotLatentGainRate * state.dataGlobal->TimeStepZoneSec;
    8344              : 
    8345     20535411 :             thisZoneRpt.TotTotalHeatGainRate =
    8346     20535411 :                 thisZoneRpt.TotLatentGainRate + thisZoneRpt.TotRadiantGainRate + thisZoneRpt.TotConvectiveGainRate + thisZoneRpt.TotVisHeatGainRate;
    8347     20535411 :             thisZoneRpt.TotTotalHeatGain = thisZoneRpt.TotTotalHeatGainRate * state.dataGlobal->TimeStepZoneSec;
    8348              :         }
    8349      2828408 :     }
    8350              : 
    8351          341 :     Real64 GetDesignLightingLevelForZone(EnergyPlusData &state, int const WhichZone) // name of zone
    8352              :     {
    8353              : 
    8354              :         // FUNCTION INFORMATION:
    8355              :         //       AUTHOR         Linda Lawrie
    8356              :         //       DATE WRITTEN   April 2007; January 2008 - moved to InternalGains
    8357              :         //       MODIFIED       na
    8358              :         //       RE-ENGINEERED  na
    8359              : 
    8360              :         // PURPOSE OF THIS FUNCTION:
    8361              :         // This routine sums the Lighting Level for a zone.
    8362              :         // Will issue a severe error for illegal zone.
    8363              :         // Must be called after InternalHeatGains get input.
    8364              : 
    8365              :         // Using/Aliasing
    8366              :         using namespace DataHeatBalance;
    8367              :         // Return value
    8368              :         Real64 DesignLightingLevelSum; // Sum of design lighting level for this zone
    8369              : 
    8370              :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    8371              :         int Loop;
    8372              : 
    8373          341 :         if (state.dataInternalHeatGains->GetInternalHeatGainsInputFlag) {
    8374            0 :             ShowFatalError(state, "GetDesignLightingLevelForZone: Function called prior to Getting Lights Input.");
    8375              :         }
    8376              : 
    8377          341 :         DesignLightingLevelSum = 0.0;
    8378              : 
    8379        13299 :         for (Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    8380        12958 :             if (state.dataHeatBal->Lights(Loop).ZonePtr == WhichZone) {
    8381          343 :                 DesignLightingLevelSum += state.dataHeatBal->Lights(Loop).DesignLevel;
    8382              :             }
    8383              :         }
    8384              : 
    8385          341 :         return DesignLightingLevelSum;
    8386              :     }
    8387              : 
    8388          148 :     bool CheckThermalComfortSchedules(bool const WorkEffSch, // Blank work efficiency schedule = true
    8389              :                                       bool const CloInsSch,  // Blank clothing insulation schedule = true
    8390              :                                       bool const AirVeloSch) // Blank air velocity schedule = true
    8391              :     {
    8392          148 :         bool TCSchedsPresent = false;
    8393              : 
    8394          148 :         if (!WorkEffSch || !CloInsSch || !AirVeloSch) {
    8395           34 :             TCSchedsPresent = true;
    8396              :         }
    8397              : 
    8398          148 :         return TCSchedsPresent;
    8399              :     }
    8400              : 
    8401          341 :     void CheckLightsReplaceableMinMaxForZone(EnergyPlusData &state, int const WhichZone) // Zone Number
    8402              :     {
    8403              : 
    8404              :         // SUBROUTINE INFORMATION:
    8405              :         //       AUTHOR         Linda Lawrie
    8406              :         //       DATE WRITTEN   April 2007
    8407              :         //       MODIFIED       na
    8408              :         //       RE-ENGINEERED  na
    8409              : 
    8410              :         // PURPOSE OF THIS SUBROUTINE:
    8411              :         // Daylighting is not available unless Lights (replaceable) is 0.0 or 1.0.  No dimming will be done
    8412              :         // unless the lights replaceable fraction is 1.0.  This is documented in the InputOutputReference but
    8413              :         // not warned about.  Also, this will sum the Zone Design Lighting level, in case the calling routine
    8414              :         // would like to have an error if the lights is zero and daylighting is requested.
    8415              : 
    8416              :         // METHODOLOGY EMPLOYED:
    8417              :         // Traverse the LIGHTS structure and get fraction replaceable - min/max as well as lighting
    8418              :         // level for a zone.
    8419              : 
    8420              :         // Using/Aliasing
    8421              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    8422              :         int Loop;
    8423              :         Real64 LightsRepMin; // Minimum Lighting replacement fraction for any lights statement for this zone
    8424              :         Real64 LightsRepMax; // Maximum Lighting replacement fraction for any lights statement for this zone
    8425              :         int NumLights;       // Number of Lights statement for that zone.
    8426              : 
    8427          341 :         if (state.dataInternalHeatGains->GetInternalHeatGainsInputFlag) {
    8428            0 :             ShowFatalError(state, "CheckLightsReplaceableMinMaxForZone: Function called prior to Getting Lights Input.");
    8429              :         }
    8430              : 
    8431          341 :         LightsRepMin = 99999.0;
    8432          341 :         LightsRepMax = -99999.0;
    8433          341 :         NumLights = 0;
    8434              : 
    8435        13299 :         for (Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    8436        12958 :             if (state.dataHeatBal->Lights(Loop).ZonePtr != WhichZone) {
    8437        12615 :                 continue;
    8438              :             }
    8439          343 :             LightsRepMin = min(LightsRepMin, state.dataHeatBal->Lights(Loop).FractionReplaceable);
    8440          343 :             LightsRepMax = max(LightsRepMax, state.dataHeatBal->Lights(Loop).FractionReplaceable);
    8441          343 :             ++NumLights;
    8442          686 :             if ((state.dataDayltg->ZoneDaylight(WhichZone).totRefPts > 0) &&
    8443          343 :                 (state.dataHeatBal->Lights(Loop).FractionReplaceable > 0.0 && state.dataHeatBal->Lights(Loop).FractionReplaceable < 1.0)) {
    8444            0 :                 ShowWarningError(state, "CheckLightsReplaceableMinMaxForZone: Fraction Replaceable must be 0.0 or 1.0 if used with daylighting.");
    8445            0 :                 ShowContinueError(state,
    8446            0 :                                   format("..Lights=\"{}\", Fraction Replaceable will be reset to 1.0 to allow dimming controls",
    8447            0 :                                          state.dataHeatBal->Lights(Loop).Name));
    8448            0 :                 ShowContinueError(state, format("..in Zone={}", state.dataHeatBal->Zone(WhichZone).Name));
    8449            0 :                 state.dataHeatBal->Lights(Loop).FractionReplaceable = 1.0;
    8450              :             }
    8451              :         }
    8452              : 
    8453          341 :         if (state.dataDayltg->ZoneDaylight(WhichZone).totRefPts > 0) {
    8454          341 :             if (LightsRepMax == 0.0) {
    8455            2 :                 ShowWarningError(state,
    8456            2 :                                  format("CheckLightsReplaceable: Zone \"{}\" has Daylighting:Controls.", state.dataHeatBal->Zone(WhichZone).Name));
    8457            2 :                 ShowContinueError(state, "but all of the LIGHTS object in that zone have zero Fraction Replaceable.");
    8458            3 :                 ShowContinueError(state, "The daylighting controls will have no effect.");
    8459              :             }
    8460          341 :             if (NumLights == 0) {
    8461            0 :                 ShowWarningError(state,
    8462            0 :                                  format("CheckLightsReplaceable: Zone \"{}\" has Daylighting:Controls.", state.dataHeatBal->Zone(WhichZone).Name));
    8463            0 :                 ShowContinueError(state, "but there are no LIGHTS objects in that zone.");
    8464            0 :                 ShowContinueError(state, "The daylighting controls will have no effect.");
    8465              :             }
    8466              :         }
    8467          341 :     }
    8468              : 
    8469      6724988 :     void UpdateInternalGainValues(EnergyPlusData &state, bool const SuppressRadiationUpdate, bool const SumLatentGains)
    8470              :     {
    8471              : 
    8472              :         // SUBROUTINE INFORMATION:
    8473              :         //       AUTHOR         B. Griffith
    8474              :         //       DATE WRITTEN   Dec. 2011
    8475      6724988 :         bool DoRadiationUpdate{!SuppressRadiationUpdate};
    8476              : 
    8477              :         // store pointer values to hold generic internal gain values constant for entire timestep
    8478     58717675 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    8479     51992687 :             auto &thisIntGain = state.dataHeatBal->spaceIntGainDevices(spaceNum);
    8480    198096126 :             for (int Loop = 1; Loop <= thisIntGain.numberOfDevices; ++Loop) {
    8481    146103439 :                 thisIntGain.device(Loop).ConvectGainRate = *thisIntGain.device(Loop).PtrConvectGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8482    292206878 :                 thisIntGain.device(Loop).ReturnAirConvGainRate =
    8483    146103439 :                     *thisIntGain.device(Loop).PtrReturnAirConvGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8484    146103439 :                 if (DoRadiationUpdate) {
    8485     58240833 :                     thisIntGain.device(Loop).RadiantGainRate = *thisIntGain.device(Loop).PtrRadiantGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8486              :                 }
    8487    146103439 :                 thisIntGain.device(Loop).LatentGainRate = *thisIntGain.device(Loop).PtrLatentGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8488    292206878 :                 thisIntGain.device(Loop).ReturnAirLatentGainRate =
    8489    146103439 :                     *thisIntGain.device(Loop).PtrReturnAirLatentGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8490    292206878 :                 thisIntGain.device(Loop).CarbonDioxideGainRate =
    8491    146103439 :                     *thisIntGain.device(Loop).PtrCarbonDioxideGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8492    146103439 :                 thisIntGain.device(Loop).GenericContamGainRate =
    8493    146103439 :                     *thisIntGain.device(Loop).PtrGenericContamGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8494              :             }
    8495              :         }
    8496      6724988 :         if (SumLatentGains) {
    8497     35241392 :             for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) {
    8498     31344812 :                 InternalHeatGains::SumAllInternalLatentGains(state, NZ);
    8499              :                 // Added for the hybrid model
    8500     31344812 :                 if (state.dataHybridModel->FlagHybridModel_PC) {
    8501         8212 :                     InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ);
    8502              :                 }
    8503              :             }
    8504              :         }
    8505              : 
    8506      6724988 :         if (state.dataContaminantBalance->Contaminant.GenericContamSimulation && allocated(state.dataContaminantBalance->ZoneGCGain)) {
    8507       355534 :             for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) {
    8508       324838 :                 state.dataContaminantBalance->ZoneGCGain(NZ) = InternalHeatGains::SumAllInternalGenericContamGains(state, NZ);
    8509       324838 :                 state.dataHeatBal->ZoneRpt(NZ).GCRate = state.dataContaminantBalance->ZoneGCGain(NZ);
    8510              :             }
    8511              :         }
    8512      6724988 :     }
    8513              : 
    8514     94143368 :     Real64 zoneSumAllInternalConvectionGains(EnergyPlusData &state,
    8515              :                                              int const zoneNum // zone index pointer to sum gains for
    8516              :     )
    8517              :     {
    8518     94143368 :         Real64 zoneSumConvGainRate(0.0);
    8519              :         // worker routine for summing all the internal gain types
    8520              : 
    8521    188546116 :         for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    8522     94402748 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8523     10131287 :                 continue;
    8524              :             }
    8525     84271461 :             zoneSumConvGainRate += InternalHeatGains::spaceSumAllInternalConvectionGains(state, spaceNum);
    8526     94143368 :         }
    8527              : 
    8528     94143368 :         return zoneSumConvGainRate;
    8529              :     }
    8530              : 
    8531     84387025 :     Real64 spaceSumAllInternalConvectionGains(EnergyPlusData &state,
    8532              :                                               int const spaceNum // space index pointer to sum gains for
    8533              :     )
    8534              :     {
    8535              :         // SUBROUTINE INFORMATION:
    8536              :         //       AUTHOR         B. Griffith
    8537              :         //       DATE WRITTEN   Nov. 2011
    8538              : 
    8539              :         // PURPOSE OF THIS SUBROUTINE:
    8540              :         // worker routine for summing all the internal gain types
    8541              : 
    8542     84387025 :         Real64 spaceSumConvGainRate(0.0);
    8543              : 
    8544    348919058 :         for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8545    264532033 :             spaceSumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
    8546              :         }
    8547     84387025 :         return spaceSumConvGainRate;
    8548              :     }
    8549              : 
    8550              :     // For HybridModel
    8551        16424 :     Real64 SumAllInternalConvectionGainsExceptPeople(EnergyPlusData &state, int const ZoneNum)
    8552              :     {
    8553              :         // Return value
    8554        16424 :         Real64 SumConvGainRateExceptPeople = 0.0;
    8555              : 
    8556        32848 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8557        16424 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8558            0 :                 continue;
    8559              :             }
    8560        32848 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8561        16424 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
    8562            0 :                     SumConvGainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
    8563              :                 }
    8564              :             }
    8565        16424 :         }
    8566              : 
    8567        16424 :         return SumConvGainRateExceptPeople;
    8568              :     }
    8569              : 
    8570     43726266 :     Real64 SumInternalConvectionGainsByTypes(
    8571              :         EnergyPlusData &state,
    8572              :         int const ZoneNum,                                         // zone index pointer for which zone to sum gains for
    8573              :         gsl::span<const DataHeatBalance::IntGainType> GainTypeARR, // variable length 1-d array of enum valued gain types
    8574              :         int const spaceIndex)                                      // space index pointer, sum gains only for this space
    8575              :     {
    8576              : 
    8577              :         // SUBROUTINE INFORMATION:
    8578              :         //       AUTHOR         B. Griffith
    8579              :         //       DATE WRITTEN   Nov. 2011cl
    8580              : 
    8581              :         // PURPOSE OF THIS SUBROUTINE:
    8582              :         // worker routine for summing a subset of the internal gain types
    8583              : 
    8584              :         // Return value
    8585     43726266 :         Real64 SumConvGainRate = 0.0;
    8586              : 
    8587     43726266 :         int NumberOfTypes = GainTypeARR.size();
    8588              : 
    8589              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8590     43726266 :         if (spaceIndex > 0) {
    8591     79375644 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8592    527379147 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8593    468717114 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8594     55018012 :                         SumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).ConvectGainRate;
    8595              :                     }
    8596              :                 }
    8597              :             }
    8598              :         } else {
    8599     46203510 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8600     23190855 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8601      2434367 :                     continue;
    8602              :                 }
    8603     86887495 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8604    589542372 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8605    523411365 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8606     56049979 :                             SumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
    8607              :                         }
    8608              :                     }
    8609              :                 }
    8610     23012655 :             }
    8611              :         }
    8612              : 
    8613     43726266 :         return SumConvGainRate;
    8614              :     }
    8615              : 
    8616     64534380 :     Real64 zoneSumAllReturnAirConvectionGains(EnergyPlusData &state,
    8617              :                                               int const zoneNum,      // zone index pointer  to sum gains for
    8618              :                                               int const returnNodeNum // return air node number
    8619              :     )
    8620              :     {
    8621     64534380 :         Real64 zoneSumReturnAirGainRate = 0.0;
    8622    129164368 :         for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    8623     64629988 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8624       871653 :                 continue;
    8625              :             }
    8626     63758335 :             zoneSumReturnAirGainRate += InternalHeatGains::spaceSumAllReturnAirConvectionGains(state, spaceNum, returnNodeNum);
    8627     64534380 :         }
    8628              : 
    8629     64534380 :         return zoneSumReturnAirGainRate;
    8630              :     }
    8631              : 
    8632     63758335 :     Real64 spaceSumAllReturnAirConvectionGains(EnergyPlusData &state,
    8633              :                                                int const spaceNum,     // space index pointer to sum gains for
    8634              :                                                int const returnNodeNum // return air node number
    8635              :     )
    8636              :     {
    8637              : 
    8638              :         // SUBROUTINE INFORMATION:
    8639              :         //       AUTHOR         B. Griffith
    8640              :         //       DATE WRITTEN   Dec. 2011
    8641              : 
    8642              :         // PURPOSE OF THIS SUBROUTINE:
    8643              :         // worker routine for summing all the internal gain types
    8644              : 
    8645     63758335 :         Real64 spaceSumReturnAirGainRate = 0.0;
    8646              : 
    8647    267864268 :         for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8648              :             // If ReturnNodeNum is zero, sum for entire zone, otherwise sum only for specified ReturnNodeNum
    8649    204105933 :             if ((returnNodeNum == 0) || (returnNodeNum == state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirNodeNum)) {
    8650     85860430 :                 spaceSumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate;
    8651              :             }
    8652              :         }
    8653              : 
    8654     63758335 :         return spaceSumReturnAirGainRate;
    8655              :     }
    8656              : 
    8657       635556 :     Real64 SumReturnAirConvectionGainsByTypes(
    8658              :         EnergyPlusData &state,
    8659              :         int const ZoneNum,                                         // zone index pointer for which zone to sum gains for
    8660              :         gsl::span<const DataHeatBalance::IntGainType> GainTypeARR, // variable length 1-d array of integer valued gain types
    8661              :         int const spaceIndex                                       // space index pointer, sum gains only for this space
    8662              :     )
    8663              :     {
    8664              : 
    8665              :         // SUBROUTINE INFORMATION:
    8666              :         //       AUTHOR         B. Griffith
    8667              :         //       DATE WRITTEN   Nov. 2011
    8668              : 
    8669              :         // PURPOSE OF THIS SUBROUTINE:
    8670              :         // worker routine for summing a subset of the internal gain types
    8671              : 
    8672              :         // Return value
    8673       635556 :         Real64 SumReturnAirGainRate(0.0);
    8674              : 
    8675       635556 :         int NumberOfTypes = GainTypeARR.size();
    8676              : 
    8677              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8678       635556 :         if (spaceIndex > 0) {
    8679       137700 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8680       684450 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8681       579150 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8682        14850 :                         SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).ReturnAirConvGainRate;
    8683              :                     }
    8684              :                 }
    8685              :             }
    8686              :         } else {
    8687      1238712 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8688       635556 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8689        82536 :                     continue;
    8690              :                 }
    8691              : 
    8692      2460000 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8693     12395370 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8694              : 
    8695     10488390 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8696       361320 :                             SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate;
    8697              :                         }
    8698              :                     }
    8699              :                 }
    8700       603156 :             }
    8701              :         }
    8702              : 
    8703       635556 :         return SumReturnAirGainRate;
    8704              :     }
    8705              : 
    8706     20584011 :     Real64 SumAllSpaceInternalRadiationGains(EnergyPlusData &state,
    8707              :                                              int const spaceNum // space index pointer for which space to sum gains for
    8708              :     )
    8709              :     {
    8710              : 
    8711              :         // SUBROUTINE INFORMATION:
    8712              :         //       AUTHOR         B. Griffith
    8713              :         //       DATE WRITTEN   Nov. 2011
    8714              : 
    8715              :         // PURPOSE OF THIS SUBROUTINE:
    8716              :         // worker routine for summing all the internal gain types
    8717              : 
    8718              :         // Return value
    8719     20584011 :         Real64 sumRadGainRate(0.0);
    8720              : 
    8721     20584011 :         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8722      2104223 :             sumRadGainRate = 0.0;
    8723      2104223 :             return sumRadGainRate;
    8724              :         }
    8725              : 
    8726     76720621 :         for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8727     58240833 :             sumRadGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate;
    8728              :         }
    8729              : 
    8730     18479788 :         return sumRadGainRate;
    8731              :     }
    8732              : 
    8733              :     Real64
    8734     41119422 :     SumInternalRadiationGainsByTypes(EnergyPlusData &state,
    8735              :                                      int const ZoneNum,                                         // zone index pointer for which zone to sum gains for
    8736              :                                      gsl::span<const DataHeatBalance::IntGainType> GainTypeARR, // variable length 1-d array of enum valued gain types
    8737              :                                      int const spaceIndex)                                      // space index pointer, sum gains only for this space
    8738              :     {
    8739              : 
    8740              :         // SUBROUTINE INFORMATION:
    8741              :         //       AUTHOR         B. Griffith
    8742              :         //       DATE WRITTEN   Dec. 2011
    8743              : 
    8744              :         // PURPOSE OF THIS SUBROUTINE:
    8745              :         // worker routine for summing a subset of the internal gain types
    8746              : 
    8747              :         // Return value
    8748     41119422 :         Real64 SumRadiationGainRate(0.0);
    8749              : 
    8750     41119422 :         int NumberOfTypes = GainTypeARR.size();
    8751              : 
    8752              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8753     41119422 :         if (spaceIndex > 0) {
    8754     78824844 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8755    524167497 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8756    465926664 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8757     54965362 :                         SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).RadiantGainRate;
    8758              :                     }
    8759              :                 }
    8760              :             }
    8761              :         } else {
    8762     41119422 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8763     20584011 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8764      2104223 :                     continue;
    8765              :                 }
    8766     76720621 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8767    524167497 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8768    465926664 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8769     54965362 :                             SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate;
    8770              :                         }
    8771              :                     }
    8772              :                 }
    8773     20535411 :             }
    8774              :         }
    8775              : 
    8776     41119422 :         return SumRadiationGainRate;
    8777              :     }
    8778              : 
    8779      1501140 :     Real64 SumEnclosureInternalRadiationGainsByTypes(
    8780              :         EnergyPlusData &state,
    8781              :         int const enclosureNum,                                    // enclosure to sum gains for
    8782              :         gsl::span<const DataHeatBalance::IntGainType> GainTypeARR) // variable length 1-d array of enum valued gain types
    8783              :     {
    8784              :         // Return value
    8785      1501140 :         Real64 SumRadiationGainRate(0.0);
    8786              : 
    8787      1501140 :         int NumberOfTypes = GainTypeARR.size();
    8788              : 
    8789      3090030 :         for (int spaceNum : state.dataViewFactor->EnclRadInfo(enclosureNum).spaceNums) {
    8790      1588890 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8791       206340 :                 continue;
    8792              :             }
    8793      6150000 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8794     41953560 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8795     37186110 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8796       953490 :                         SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate;
    8797              :                     }
    8798              :                 }
    8799              :             }
    8800      1501140 :         }
    8801              : 
    8802      1501140 :         return SumRadiationGainRate;
    8803              :     }
    8804              : 
    8805     51880223 :     void SumAllInternalLatentGains(EnergyPlusData &state,
    8806              :                                    int const ZoneNum // zone index pointer for which zone to sum gains for
    8807              :     )
    8808              :     {
    8809              : 
    8810              :         // SUBROUTINE INFORMATION:
    8811              :         //       AUTHOR         B. Griffith
    8812              :         //       DATE WRITTEN   Nov. 2011
    8813              : 
    8814              :         // PURPOSE OF THIS SUBROUTINE:
    8815              :         // worker routine for summing all the internal gain types
    8816              : 
    8817     51880223 :         Real64 zoneLatentGainRate = 0.0;
    8818              : 
    8819    103872910 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8820     51992687 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8821      5477697 :                 state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain = 0.0;
    8822      5477697 :                 continue;
    8823              :             }
    8824              : 
    8825     46514990 :             Real64 spaceLatentGainRate = 0.0;
    8826    192618429 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8827    146103439 :                 spaceLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate;
    8828              :             }
    8829     46514990 :             state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain = spaceLatentGainRate;
    8830     46514990 :             zoneLatentGainRate += spaceLatentGainRate;
    8831     51880223 :         }
    8832              : 
    8833     51880223 :         state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).latentGain = zoneLatentGainRate;
    8834     51880223 :     }
    8835              : 
    8836              :     // Added for hybrid model -- calculate the latent gain from all sources except for people
    8837        16308 :     void SumAllInternalLatentGainsExceptPeople(EnergyPlusData &state,
    8838              :                                                int const ZoneNum // zone index pointer for which zone to sum gains for
    8839              :     )
    8840              :     {
    8841        16308 :         Real64 zoneLatentGainRateExceptPeople(0.0);
    8842              : 
    8843        32616 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8844        16308 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8845            0 :                 continue;
    8846              :             }
    8847              : 
    8848        16308 :             Real64 spaceLatentGainRateExceptPeople = 0.0;
    8849        32616 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8850        16308 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
    8851            0 :                     spaceLatentGainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate;
    8852              :                 }
    8853              :             }
    8854        16308 :             state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGainExceptPeople = spaceLatentGainRateExceptPeople;
    8855        16308 :             zoneLatentGainRateExceptPeople += spaceLatentGainRateExceptPeople;
    8856        16308 :         }
    8857              : 
    8858        16308 :         state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).latentGainExceptPeople = zoneLatentGainRateExceptPeople;
    8859        16308 :     }
    8860              : 
    8861              :     Real64
    8862     42390534 :     SumInternalLatentGainsByTypes(EnergyPlusData &state,
    8863              :                                   int const ZoneNum,                                         // zone index pointer for which zone to sum gains for
    8864              :                                   gsl::span<const DataHeatBalance::IntGainType> GainTypeARR, // variable length 1-d array of enum valued gain types
    8865              :                                   int const spaceIndex)                                      // space index pointer, sum gains only for this space
    8866              :     {
    8867              :         // SUBROUTINE INFORMATION:
    8868              :         //       AUTHOR         B. Griffith
    8869              :         //       DATE WRITTEN   Dec. 2011
    8870              : 
    8871              :         // PURPOSE OF THIS SUBROUTINE:
    8872              :         // worker routine for summing a subset of the internal gain types
    8873              : 
    8874              :         // Return value
    8875     42390534 :         Real64 SumLatentGainRate(0.0);
    8876              : 
    8877     42390534 :         int NumberOfTypes = GainTypeARR.size();
    8878              : 
    8879              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8880     42390534 :         if (spaceIndex > 0) {
    8881     79100244 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8882    525483747 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8883    467032314 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8884     55003162 :                         SumLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).LatentGainRate;
    8885              :                     }
    8886              :                 }
    8887              :             }
    8888              :         } else {
    8889     43596846 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8890     21855123 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8891      2269295 :                     continue;
    8892              :                 }
    8893     81640621 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8894    548004747 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8895    485949954 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8896     55557532 :                             SumLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate;
    8897              :                         }
    8898              :                     }
    8899              :                 }
    8900     21741723 :             }
    8901              :         }
    8902              : 
    8903     42390534 :         return SumLatentGainRate;
    8904              :     }
    8905              : 
    8906     53709990 :     Real64 SumAllReturnAirLatentGains(EnergyPlusData &state,
    8907              :                                       int const ZoneNum,      // zone index pointer for which zone to sum gains for
    8908              :                                       int const ReturnNodeNum // return air node number
    8909              :     )
    8910              :     {
    8911              : 
    8912              :         // SUBROUTINE INFORMATION:
    8913              :         //       AUTHOR         B. Griffith
    8914              :         //       DATE WRITTEN   Nov. 2011
    8915              : 
    8916              :         // PURPOSE OF THIS SUBROUTINE:
    8917              :         // worker routine for summing all the internal gain types
    8918              : 
    8919     53709990 :         Real64 SumRetAirLatentGainRate(0.0);
    8920              : 
    8921    107515588 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8922     53805598 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8923       380028 :                 continue;
    8924              :             }
    8925              : 
    8926    225607579 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8927              :                 // If ReturnNodeNum is zero, sum for entire zone, otherwise sum only for specified ReturnNodeNum
    8928    172182009 :                 if ((ReturnNodeNum == 0) || (ReturnNodeNum == state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirNodeNum)) {
    8929     53937226 :                     SumRetAirLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirLatentGainRate;
    8930              :                 }
    8931              :             }
    8932     53709990 :         }
    8933              : 
    8934     53709990 :         return SumRetAirLatentGainRate;
    8935              :     }
    8936              : 
    8937       144831 :     Real64 SumAllInternalCO2Gains(EnergyPlusData &state,
    8938              :                                   int const ZoneNum // zone index pointer for which zone to sum gains for
    8939              :     )
    8940              :     {
    8941              : 
    8942              :         // SUBROUTINE INFORMATION:
    8943              :         //       AUTHOR         B. Griffith
    8944              :         //       DATE WRITTEN   Dec. 2011
    8945              : 
    8946              :         // PURPOSE OF THIS SUBROUTINE:
    8947              :         // worker routine for summing all the internal gain types
    8948              : 
    8949              :         // Return value
    8950       144831 :         Real64 SumCO2GainRate(0.0);
    8951              : 
    8952       289662 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8953       144831 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8954         7440 :                 continue;
    8955              :             }
    8956              : 
    8957       553653 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8958       416262 :                 SumCO2GainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CarbonDioxideGainRate;
    8959              :             }
    8960       144831 :         }
    8961              : 
    8962       144831 :         return SumCO2GainRate;
    8963              :     }
    8964              : 
    8965              :     // Added for hybrid model -- function for calculating CO2 gains except people
    8966         8100 :     Real64 SumAllInternalCO2GainsExceptPeople(EnergyPlusData &state,
    8967              :                                               int const ZoneNum // zone index pointer for which zone to sum gains for
    8968              :     )
    8969              :     {
    8970              :         // Return value
    8971         8100 :         Real64 SumCO2GainRateExceptPeople(0.0);
    8972              : 
    8973        16200 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8974         8100 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8975            0 :                 continue;
    8976              :             }
    8977              : 
    8978        16200 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8979         8100 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
    8980            0 :                     SumCO2GainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CarbonDioxideGainRate;
    8981              :                 }
    8982              :             }
    8983         8100 :         }
    8984              : 
    8985         8100 :         return SumCO2GainRateExceptPeople;
    8986              :     }
    8987              : 
    8988              :     Real64
    8989       144831 :     SumInternalCO2GainsByTypes(EnergyPlusData &state,
    8990              :                                int const ZoneNum,                                        // zone index pointer for which zone to sum gains for
    8991              :                                gsl::span<const DataHeatBalance::IntGainType> GainTypeARR // variable length 1-d array of integer valued gain types
    8992              :     )
    8993              :     {
    8994              : 
    8995              :         // SUBROUTINE INFORMATION:
    8996              :         //       AUTHOR         B. Griffith
    8997              :         //       DATE WRITTEN   Dec. 2011
    8998              : 
    8999              :         // PURPOSE OF THIS SUBROUTINE:
    9000              :         // worker routine for summing a subset of the internal gain types
    9001              : 
    9002              :         // Return value
    9003       144831 :         Real64 SumCO2GainRate(0.0);
    9004              : 
    9005       144831 :         int NumberOfTypes = GainTypeARR.size();
    9006              : 
    9007       289662 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    9008       144831 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    9009         7440 :                 continue;
    9010              :             }
    9011              : 
    9012       553653 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    9013       832524 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    9014              : 
    9015       416262 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    9016       144519 :                         SumCO2GainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CarbonDioxideGainRate;
    9017              :                     }
    9018              :                 }
    9019              :             }
    9020       144831 :         }
    9021              : 
    9022       144831 :         return SumCO2GainRate;
    9023              :     }
    9024              : 
    9025       324838 :     Real64 SumAllInternalGenericContamGains(EnergyPlusData &state,
    9026              :                                             int const ZoneNum // zone index pointer for which zone to sum gains for
    9027              :     )
    9028              :     {
    9029              : 
    9030              :         // SUBROUTINE INFORMATION:
    9031              :         //       AUTHOR         L. Gu
    9032              :         //       DATE WRITTEN   Feb. 2012
    9033              : 
    9034              :         // PURPOSE OF THIS SUBROUTINE:
    9035              :         // worker routine for summing all the internal gain types based on the existing subroutine SumAllInternalCO2Gains
    9036              : 
    9037              :         // Return value
    9038       324838 :         Real64 SumGCGainRate(0.0);
    9039              : 
    9040       649676 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    9041       324838 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    9042         5039 :                 continue;
    9043              :             }
    9044              : 
    9045      1343956 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    9046      1024157 :                 SumGCGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).GenericContamGainRate;
    9047              :             }
    9048       324838 :         }
    9049              : 
    9050       324838 :         return SumGCGainRate;
    9051              :     }
    9052              : 
    9053       830322 :     void GatherComponentLoadsIntGain(EnergyPlusData &state)
    9054              :     {
    9055              :         // SUBROUTINE INFORMATION:
    9056              :         //       AUTHOR         Jason Glazer
    9057              :         //       DATE WRITTEN   September 2012
    9058              :         //       MODIFIED       na
    9059              :         //       RE-ENGINEERED  na
    9060              : 
    9061              :         // PURPOSE OF THIS SUBROUTINE:
    9062              :         //   Gather values during sizing used for loads component report.
    9063              : 
    9064              :         // METHODOLOGY EMPLOYED:
    9065              :         //   Save sequence of values for report during sizing.
    9066              : 
    9067              :         // Using/Aliasing
    9068              :         using namespace DataHeatBalance;
    9069              : 
    9070       830322 :         if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) {
    9071        36642 :             int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep;
    9072       338220 :             for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) {
    9073       301578 :                 auto &znCLDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iZone - 1];
    9074       301578 :                 gatherCompLoadIntGain2(state, znCLDayTS, iZone);
    9075              :             }
    9076       336870 :             for (int iEncl = 1; iEncl <= state.dataViewFactor->NumOfRadiantEnclosures; ++iEncl) {
    9077       300228 :                 auto &enclCLDayTS = state.dataOutRptTab->enclCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].encl[iEncl - 1];
    9078       300228 :                 enclCLDayTS.peopleRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPeople);
    9079       300228 :                 enclCLDayTS.lightLWRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesLight);
    9080       300228 :                 enclCLDayTS.equipRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesEquip);
    9081       300228 :                 enclCLDayTS.hvacLossRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesHvacLoss);
    9082       300228 :                 enclCLDayTS.powerGenRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPowerGen);
    9083              :             }
    9084        36642 :             if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
    9085        18900 :                 for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) {
    9086              :                     auto &spCLDayTS =
    9087        16200 :                         state.dataOutRptTab->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iSpace - 1];
    9088        16200 :                     gatherCompLoadIntGain2(state, spCLDayTS, state.dataHeatBal->space(iSpace).zoneNum, iSpace);
    9089              :                 }
    9090              :             }
    9091              :         }
    9092       830322 :     }
    9093              : 
    9094              :     void
    9095       317778 :     gatherCompLoadIntGain2(EnergyPlusData &state, OutputReportTabular::compLoadsSpaceZone &szCompLoadDayTS, int const zoneNum, int const spaceNum)
    9096              :     {
    9097              :         // Make sure all types of internal gains have been gathered
    9098      2542224 :         assert((int)(size(IntGainTypesPeople) + size(IntGainTypesLight) + size(IntGainTypesEquip) + size(IntGainTypesRefrig) +
    9099              :                      size(IntGainTypesWaterUse) + size(IntGainTypesHvacLoss) + size(IntGainTypesPowerGen) + size(ExcludedIntGainTypes)) ==
    9100              :                (int)DataHeatBalance::IntGainType::Num);
    9101              : 
    9102       317778 :         szCompLoadDayTS.peopleInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum);
    9103       317778 :         szCompLoadDayTS.peopleLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum);
    9104              : 
    9105       317778 :         szCompLoadDayTS.lightInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum);
    9106       317778 :         szCompLoadDayTS.lightRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum);
    9107              : 
    9108       317778 :         szCompLoadDayTS.equipInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum);
    9109       317778 :         szCompLoadDayTS.equipLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum);
    9110              : 
    9111       317778 :         szCompLoadDayTS.refrigInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum);
    9112       317778 :         szCompLoadDayTS.refrigRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum);
    9113       317778 :         szCompLoadDayTS.refrigLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum);
    9114              : 
    9115       317778 :         szCompLoadDayTS.waterUseInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum);
    9116       317778 :         szCompLoadDayTS.waterUseLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum);
    9117              : 
    9118       317778 :         szCompLoadDayTS.hvacLossInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum);
    9119              : 
    9120       317778 :         szCompLoadDayTS.powerGenInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum);
    9121       317778 :     }
    9122              : 
    9123           18 :     int GetInternalGainDeviceIndex(EnergyPlusData &state,
    9124              :                                    int const spaceNum,                             // space index pointer for which space to sum gains for
    9125              :                                    DataHeatBalance::IntGainType const intGainType, // space internal gain type enum
    9126              :                                    std::string_view const intGainName)             // Internal gain name
    9127              :     {
    9128              : 
    9129              :         // SUBROUTINE INFORMATION:
    9130              :         //       AUTHOR         B. Griffith
    9131              :         //       DATE WRITTEN   June 2012
    9132              : 
    9133              :         // PURPOSE OF THIS SUBROUTINE:
    9134              :         // utility to retrieve index pointer to a specific internal gain
    9135              :         // the subroutine returns the index of matched internal gain device or -1 if no match found.
    9136              : 
    9137              :         int DeviceNum;
    9138              :         int DeviceIndex;
    9139           18 :         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    9140            0 :             DeviceIndex = -1;
    9141            0 :             return DeviceIndex;
    9142              :         }
    9143           36 :         for (DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    9144           54 :             if ((Util::SameString(state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompObjectName, intGainName.data())) &&
    9145           18 :                 (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == intGainType)) {
    9146           18 :                 DeviceIndex = DeviceNum;
    9147           18 :                 break;
    9148              :             } else {
    9149           18 :                 DeviceIndex = -1;
    9150              :             }
    9151              :         }
    9152           18 :         return DeviceIndex;
    9153              :     }
    9154              : 
    9155        51891 :     Real64 SumInternalConvectionGainsByIndices(
    9156              :         EnergyPlusData &state,
    9157              :         int const numGains,                // number of device gains to sum
    9158              :         const Array1D_int &deviceSpaceARR, // variable length 1-d array of integer space index pointers to include in summation
    9159              :         const Array1D_int &deviceIndexARR, // variable length 1-d array of integer device index pointers to include in summation
    9160              :         const Array1D<Real64> &fractionARR // array of fractional multipliers to apply to devices
    9161              :     )
    9162              :     {
    9163              : 
    9164              :         // SUBROUTINE INFORMATION:
    9165              :         //       AUTHOR         B. Griffith
    9166              :         //       DATE WRITTEN   June 2012
    9167              : 
    9168              :         // PURPOSE OF THIS SUBROUTINE:
    9169              :         // worker routine for summing a subset of the internal gains by index
    9170              : 
    9171              :         // Return value
    9172        51891 :         Real64 sumConvGainRate(0.0);
    9173              : 
    9174        51891 :         assert(numGains <= isize(deviceSpaceARR));
    9175        51891 :         assert(numGains <= isize(deviceIndexARR));
    9176        51891 :         assert(numGains <= isize(fractionARR));
    9177              : 
    9178       207564 :         for (int loop = 1; loop <= numGains; ++loop) {
    9179       155673 :             int spaceNum = deviceSpaceARR(loop);
    9180       155673 :             int deviceNum = deviceIndexARR(loop);
    9181       155673 :             Real64 deviceFraction = fractionARR(loop);
    9182       155673 :             sumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(deviceNum).ConvectGainRate * deviceFraction;
    9183              :         }
    9184        51891 :         return sumConvGainRate;
    9185              :     }
    9186              : 
    9187        51891 :     Real64 SumInternalLatentGainsByIndices(
    9188              :         EnergyPlusData &state,
    9189              :         int const numGains,                // number of device gains to sum
    9190              :         const Array1D_int &deviceSpaceARR, // variable length 1-d array of integer space index pointers to include in summation
    9191              :         const Array1D_int &deviceIndexARR, // variable length 1-d array of integer device index pointers to include in summation
    9192              :         const Array1D<Real64> &fractionARR // array of fractional multipliers to apply to devices
    9193              :     )
    9194              :     {
    9195              : 
    9196              :         // SUBROUTINE INFORMATION:
    9197              :         //       AUTHOR         B. Griffith
    9198              :         //       DATE WRITTEN   June 2012
    9199              : 
    9200              :         // PURPOSE OF THIS SUBROUTINE:
    9201              :         // worker routine for summing a subset of the internal gains by index
    9202              : 
    9203              :         // Return value
    9204        51891 :         Real64 sumLatentGainRate(0.0);
    9205              : 
    9206        51891 :         assert(numGains <= isize(deviceSpaceARR));
    9207        51891 :         assert(numGains <= isize(deviceIndexARR));
    9208        51891 :         assert(numGains <= isize(fractionARR));
    9209              : 
    9210       207564 :         for (int loop = 1; loop <= numGains; ++loop) {
    9211       155673 :             int spaceNum = deviceSpaceARR(loop);
    9212       155673 :             int deviceNum = deviceIndexARR(loop);
    9213       155673 :             Real64 deviceFraction = fractionARR(loop);
    9214       155673 :             sumLatentGainRate =
    9215       155673 :                 sumLatentGainRate + state.dataHeatBal->spaceIntGainDevices(spaceNum).device(deviceNum).LatentGainRate * deviceFraction;
    9216              :         }
    9217        51891 :         return sumLatentGainRate;
    9218              :     }
    9219              : 
    9220        25718 :     Real64 SumReturnAirConvectionGainsByIndices(
    9221              :         EnergyPlusData &state,
    9222              :         int const numGains,                // number of device gains to sum
    9223              :         const Array1D_int &deviceSpaceARR, // variable length 1-d array of integer space index pointers to include in summation
    9224              :         const Array1D_int &deviceIndexARR, // variable length 1-d array of integer device index pointers to include in summation
    9225              :         const Array1D<Real64> &fractionARR // array of fractional multipliers to apply to devices
    9226              :     )
    9227              :     {
    9228              : 
    9229              :         // SUBROUTINE INFORMATION:
    9230              :         //       AUTHOR         B. Griffith
    9231              :         //       DATE WRITTEN   June 2012
    9232              : 
    9233              :         // PURPOSE OF THIS SUBROUTINE:
    9234              :         // worker routine for summing a subset of the internal gains by index
    9235              : 
    9236              :         // Return value
    9237        25718 :         Real64 sumReturnAirGainRate(0.0);
    9238              : 
    9239        25718 :         assert(numGains <= isize(deviceSpaceARR));
    9240        25718 :         assert(numGains <= isize(deviceIndexARR));
    9241        25718 :         assert(numGains <= isize(fractionARR));
    9242              : 
    9243       102872 :         for (int loop = 1; loop <= numGains; ++loop) {
    9244        77154 :             int spaceNum = deviceSpaceARR(loop);
    9245        77154 :             int deviceNum = deviceIndexARR(loop);
    9246        77154 :             Real64 deviceFraction = fractionARR(loop);
    9247        77154 :             sumReturnAirGainRate =
    9248        77154 :                 sumReturnAirGainRate + state.dataHeatBal->spaceIntGainDevices(spaceNum).device(deviceNum).ReturnAirConvGainRate * deviceFraction;
    9249              :         }
    9250        25718 :         return sumReturnAirGainRate;
    9251              :     }
    9252              : } // namespace InternalHeatGains
    9253              : 
    9254              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1