LCOV - code coverage report
Current view: top level - EnergyPlus - InternalHeatGains.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 80.3 % 4624 3713
Test Date: 2025-06-02 12:03:30 Functions: 81.1 % 37 30

            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       250077 :     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       250077 :         if (state.dataInternalHeatGains->GetInternalHeatGainsInputFlag) {
     205          127 :             GetInternalHeatGainsInput(state);
     206          127 :             state.dataInternalHeatGains->GetInternalHeatGainsInputFlag = false;
     207              :         }
     208              : 
     209       250077 :         if (present(InitOnly)) {
     210       250077 :             if (InitOnly) {
     211          121 :                 return;
     212              :             }
     213              :         }
     214              : 
     215       249956 :         InitInternalHeatGains(state);
     216              : 
     217       249956 :         ReportInternalHeatGains(state);
     218              : 
     219       249956 :         CheckReturnAirHeatGain(state);
     220              : 
     221              :         // for the load component report, gather the load components for each timestep but not when doing pulse
     222       249956 :         if (state.dataGlobal->ZoneSizingCalc) {
     223        83022 :             GatherComponentLoadsIntGain(state);
     224              :         }
     225              :     }
     226              : 
     227          171 :     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          803 :         auto print_and_divide_if_greater_than_zero = [&](const Real64 numerator, const Real64 denominator) {
     286          803 :             if (denominator > 0.0) {
     287          574 :                 print(state.files.eio, "{:.3R},", numerator / denominator);
     288              :             } else {
     289          229 :                 print(state.files.eio, "N/A,");
     290              :             }
     291          803 :         };
     292              : 
     293          171 :         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          171 :         if (!state.dataHeatBal->ZoneIntGain.allocated()) {
     297          158 :             DataHeatBalance::AllocateIntGains(state);
     298              :         }
     299          171 :         state.dataHeatBal->ZoneRpt.allocate(state.dataGlobal->NumOfZones);
     300          171 :         state.dataHeatBal->spaceRpt.allocate(state.dataGlobal->numSpaces);
     301          171 :         state.dataHeatBal->ZoneIntEEuse.allocate(state.dataGlobal->NumOfZones);
     302          171 :         state.dataHeatBal->RefrigCaseCredit.allocate(state.dataGlobal->NumOfZones);
     303              : 
     304          171 :         Array1D_bool RepVarSet;
     305          171 :         RepVarSet.allocate(state.dataGlobal->NumOfZones);
     306          381 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
     307          210 :             RepVarSet(zoneNum) = true;
     308              :         }
     309              : 
     310          342 :         const std::string peopleModuleObject = "People";
     311          342 :         const std::string lightsModuleObject = "Lights";
     312          342 :         const std::string elecEqModuleObject = "ElectricEquipment";
     313          342 :         const std::string gasEqModuleObject = "GasEquipment";
     314          342 :         const std::string hwEqModuleObject = "HotWaterEquipment";
     315          342 :         const std::string stmEqModuleObject = "SteamEquipment";
     316          342 :         const std::string othEqModuleObject = "OtherEquipment";
     317          342 :         const std::string itEqModuleObject = "ElectricEquipment:ITE:AirCooled";
     318          342 :         const std::string bbModuleObject = "ZoneBaseboard:OutdoorTemperatureControlled";
     319          171 :         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          171 :         int IHGNumAlphas = 0;
     324          171 :         int IHGNumNumbers = 0;
     325          171 :         Array1D<Real64> IHGNumbers;
     326          171 :         Array1D_string IHGAlphas;
     327          171 :         Array1D_bool IHGNumericFieldBlanks;
     328          171 :         Array1D_bool IHGAlphaFieldBlanks;
     329          171 :         Array1D_string IHGAlphaFieldNames;
     330          171 :         Array1D_string IHGNumericFieldNames;
     331              : 
     332              :         {
     333          171 :             int MaxAlphas = 0;
     334          171 :             int MaxNums = 0;
     335          171 :             int NumParams = 0;
     336          171 :             for (const auto &moduleName : {peopleModuleObject,
     337              :                                            lightsModuleObject,
     338              :                                            elecEqModuleObject,
     339              :                                            gasEqModuleObject,
     340              :                                            hwEqModuleObject,
     341              :                                            stmEqModuleObject,
     342              :                                            othEqModuleObject,
     343              :                                            itEqModuleObject,
     344              :                                            bbModuleObject,
     345         3762 :                                            contamSSModuleObject}) {
     346         1710 :                 state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, moduleName, NumParams, IHGNumAlphas, IHGNumNumbers);
     347         1710 :                 MaxAlphas = std::max(MaxAlphas, IHGNumAlphas);
     348         1710 :                 MaxNums = std::max(MaxNums, IHGNumNumbers);
     349         1881 :             }
     350          171 :             IHGAlphas.allocate(MaxAlphas);
     351          171 :             IHGAlphaFieldNames.allocate(MaxAlphas);
     352          171 :             IHGAlphaFieldBlanks.dimension(MaxAlphas, true);
     353              : 
     354          171 :             IHGNumbers.dimension(MaxNums, 0.0);
     355          171 :             IHGNumericFieldNames.allocate(MaxNums);
     356          171 :             IHGNumericFieldBlanks.dimension(MaxNums, true);
     357          171 :             IHGNumAlphas = 0;
     358          171 :             IHGNumNumbers = 0;
     359              :         }
     360              : 
     361              :         // PEOPLE: Includes both information related to the heat balance and thermal comfort
     362          171 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> peopleObjects;
     363          171 :         int numPeopleStatements = 0;
     364          171 :         setupIHGZonesAndSpaces(state, peopleModuleObject, peopleObjects, numPeopleStatements, state.dataHeatBal->TotPeople, ErrorsFound);
     365              : 
     366          171 :         if (state.dataHeatBal->TotPeople > 0) {
     367           43 :             state.dataHeatBal->People.allocate(state.dataHeatBal->TotPeople);
     368           43 :             int peopleNum = 0;
     369          118 :             for (int peopleInputNum = 1; peopleInputNum <= numPeopleStatements; ++peopleInputNum) {
     370           75 :                 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           75 :                 ErrorObjectHeader eoh{routineName, peopleModuleObject, IHGAlphas(1)};
     384              :                 // Create one People instance for every space associated with this People input object
     385           75 :                 auto &thisPeopleInput = peopleObjects(peopleInputNum);
     386          151 :                 for (int Item1 = 1; Item1 <= thisPeopleInput.numOfSpaces; ++Item1) {
     387           76 :                     ++peopleNum;
     388           76 :                     auto &thisPeople = state.dataHeatBal->People(peopleNum);
     389           76 :                     int const spaceNum = thisPeopleInput.spaceNums(Item1);
     390           76 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
     391           76 :                     thisPeople.Name = thisPeopleInput.names(Item1);
     392           76 :                     thisPeople.spaceIndex = spaceNum;
     393           76 :                     thisPeople.ZonePtr = zoneNum;
     394              : 
     395           76 :                     thisPeople.sched = Sched::GetSchedule(state, IHGAlphas(3));
     396              : 
     397           76 :                     if (Item1 == 1) { // only show error on first one
     398           75 :                         if (IHGAlphaFieldBlanks(3)) {
     399            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
     400            0 :                             ErrorsFound = true;
     401           75 :                         } else if (thisPeople.sched == nullptr) {
     402            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
     403            0 :                             ErrorsFound = true;
     404           75 :                         } 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           76 :                         std::string const &peopleMethod = IHGAlphas(4);
     413           76 :                         if (peopleMethod == "PEOPLE") {
     414              :                             // Set space load fraction
     415           71 :                             Real64 spaceFrac = 1.0;
     416           71 :                             if (thisPeopleInput.numOfSpaces > 1) {
     417            2 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
     418            2 :                                 if (zoneArea > 0.0) {
     419            2 :                                     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           71 :                             thisPeople.NumberOfPeople = IHGNumbers(1) * spaceFrac;
     430           71 :                             if (IHGNumericFieldBlanks(1)) {
     431            0 :                                 ShowWarningError(state,
     432            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 People will result.",
     433              :                                                         RoutineName,
     434              :                                                         peopleModuleObject,
     435            0 :                                                         thisPeople.Name,
     436              :                                                         IHGNumericFieldNames(1)));
     437              :                             }
     438              : 
     439            5 :                         } else if (peopleMethod == "PEOPLE/AREA") {
     440            2 :                             if (spaceNum != 0) {
     441            2 :                                 if (IHGNumbers(2) >= 0.0) {
     442            2 :                                     thisPeople.NumberOfPeople = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
     443            2 :                                     if ((state.dataHeatBal->space(spaceNum).FloorArea <= 0.0) &&
     444            0 :                                         !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            2 :                             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            3 :                         } else if (peopleMethod == "AREA/PERSON") {
     473            3 :                             if (spaceNum != 0) {
     474            3 :                                 if (IHGNumbers(3) > 0.0) {
     475            3 :                                     thisPeople.NumberOfPeople = state.dataHeatBal->space(spaceNum).FloorArea / IHGNumbers(3);
     476            3 :                                     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            3 :                             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           76 :                     thisPeople.NomMinNumberPeople = thisPeople.NumberOfPeople * thisPeople.sched->getMinVal(state);
     522           76 :                     thisPeople.NomMaxNumberPeople = thisPeople.NumberOfPeople * thisPeople.sched->getMaxVal(state);
     523              : 
     524           76 :                     if (zoneNum > 0) {
     525           76 :                         state.dataHeatBal->Zone(zoneNum).TotOccupants += thisPeople.NumberOfPeople;
     526              :                         // Note that min/max occupants are non-coincident
     527           76 :                         state.dataHeatBal->Zone(zoneNum).minOccupants += thisPeople.NomMinNumberPeople;
     528           76 :                         state.dataHeatBal->Zone(zoneNum).maxOccupants += thisPeople.NomMaxNumberPeople;
     529              :                     }
     530              : 
     531           76 :                     if (spaceNum > 0) {
     532           76 :                         state.dataHeatBal->space(spaceNum).TotOccupants += thisPeople.NumberOfPeople;
     533              :                         // Note that min/max occupants are non-coincident
     534           76 :                         state.dataHeatBal->space(spaceNum).minOccupants += thisPeople.NomMinNumberPeople;
     535           76 :                         state.dataHeatBal->space(spaceNum).maxOccupants += thisPeople.NomMaxNumberPeople;
     536              :                     }
     537           76 :                     thisPeople.FractionRadiant = IHGNumbers(4);
     538           76 :                     thisPeople.FractionConvected = 1.0 - thisPeople.FractionRadiant;
     539           76 :                     if (Item1 == 1) {
     540           75 :                         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           76 :                     if (IHGNumNumbers >= 5 && !IHGNumericFieldBlanks(5)) {
     553           42 :                         thisPeople.UserSpecSensFrac = IHGNumbers(5);
     554              :                     } else {
     555           34 :                         thisPeople.UserSpecSensFrac = Constant::AutoCalculate;
     556              :                     }
     557              : 
     558           76 :                     if (IHGNumNumbers >= 6 && !IHGNumericFieldBlanks(6)) {
     559           14 :                         thisPeople.CO2RateFactor = IHGNumbers(6);
     560              :                     } else {
     561           62 :                         thisPeople.CO2RateFactor = 3.82e-8; // m3/s-W
     562              :                     }
     563              : 
     564           76 :                     if (IHGNumNumbers >= 7 && !IHGNumericFieldBlanks(7)) {
     565            3 :                         thisPeople.ColdStressTempThresh = IHGNumbers(7);
     566              :                     } else {
     567           73 :                         thisPeople.ColdStressTempThresh = 15.56; // degree C
     568              :                     }
     569              : 
     570           76 :                     if (IHGNumNumbers == 8 && !IHGNumericFieldBlanks(8)) {
     571            3 :                         thisPeople.HeatStressTempThresh = IHGNumbers(8);
     572              :                     } else {
     573           73 :                         thisPeople.HeatStressTempThresh = 30.0; // degree C
     574              :                     }
     575              : 
     576           76 :                     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           76 :                     thisPeople.activityLevelSched = Sched::GetSchedule(state, IHGAlphas(5));
     588              : 
     589           76 :                     if (Item1 == 1) {
     590           75 :                         if (IHGAlphaFieldBlanks(5)) {
     591            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(5));
     592            0 :                             ErrorsFound = true;
     593           75 :                         } else if (thisPeople.activityLevelSched == nullptr) {
     594            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5));
     595            0 :                             ErrorsFound = true;
     596           75 :                         } 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           75 :                         } else if (!thisPeople.activityLevelSched->checkMinMaxVals(state, Clusive::In, 70.0, Clusive::In, 1000.0)) {
     600            8 :                             Sched::ShowWarningBadMinMax(state,
     601              :                                                         eoh,
     602            4 :                                                         IHGAlphaFieldNames(5),
     603            4 :                                                         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           76 :                     if (IHGNumAlphas >= 6) {
     614           20 :                         if (BooleanSwitch bs = getYesNoValue(IHGAlphas(6)); bs != BooleanSwitch::Invalid) {
     615           20 :                             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           76 :                     if (IHGNumAlphas > 6) { // Optional parameters present--thermal comfort data follows...
     623           20 :                         int lastOption = 0;
     624           20 :                         bool usingThermalComfort = false;
     625           20 :                         if (IHGNumAlphas > 20) {
     626            3 :                             lastOption = 20;
     627              :                         } else {
     628           17 :                             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           20 :                         int constexpr NumFirstTCModel = 14;
     636           20 :                         if (IHGNumAlphas < NumFirstTCModel) {
     637            1 :                             bool NoTCModelSelectedWithSchedules = false;
     638              :                             NoTCModelSelectedWithSchedules =
     639            1 :                                 CheckThermalComfortSchedules(IHGAlphaFieldBlanks(9), IHGAlphaFieldBlanks(12), IHGAlphaFieldBlanks(13));
     640            1 :                             if (NoTCModelSelectedWithSchedules) {
     641            0 :                                 ShowWarningError(state,
     642            0 :                                                  format("{}{}=\"{}\" has comfort related schedules but no thermal comfort model selected.",
     643              :                                                         RoutineName,
     644              :                                                         peopleModuleObject,
     645              :                                                         IHGAlphas(1)));
     646            0 :                                 ShowContinueError(state,
     647              :                                                   "If schedules are specified for air velocity, clothing insulation, and/or work efficiency but no "
     648              :                                                   "thermal comfort");
     649            0 :                                 ShowContinueError(
     650              :                                     state, "thermal comfort model is selected, the schedules will be listed as unused schedules in the .err file.");
     651            0 :                                 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           57 :                         for (int OptionNum = NumFirstTCModel; OptionNum <= lastOption; ++OptionNum) {
     658              : 
     659              :                             { // Why are we starting a nested scope immediately after opening up a scope?
     660           37 :                                 std::string const &thermalComfortType = IHGAlphas(OptionNum);
     661              : 
     662           37 :                                 if (thermalComfortType == "FANGER") {
     663           15 :                                     thisPeople.Fanger = true;
     664           15 :                                     usingThermalComfort = true;
     665              : 
     666           22 :                                 } else if (thermalComfortType == "PIERCE") {
     667            0 :                                     thisPeople.Pierce = true;
     668            0 :                                     state.dataHeatBal->AnyThermalComfortPierceModel = true;
     669            0 :                                     usingThermalComfort = true;
     670              : 
     671           22 :                                 } else if (thermalComfortType == "KSU") {
     672            0 :                                     thisPeople.KSU = true;
     673            0 :                                     state.dataHeatBal->AnyThermalComfortKSUModel = true;
     674            0 :                                     usingThermalComfort = true;
     675              : 
     676           22 :                                 } else if (thermalComfortType == "ADAPTIVEASH55") {
     677            1 :                                     thisPeople.AdaptiveASH55 = true;
     678            1 :                                     state.dataHeatBal->AdaptiveComfortRequested_ASH55 = true;
     679            1 :                                     usingThermalComfort = true;
     680              : 
     681           21 :                                 } else if (thermalComfortType == "ADAPTIVECEN15251") {
     682            0 :                                     thisPeople.AdaptiveCEN15251 = true;
     683            0 :                                     state.dataHeatBal->AdaptiveComfortRequested_CEN15251 = true;
     684            0 :                                     usingThermalComfort = true;
     685              : 
     686           21 :                                 } else if (thermalComfortType == "COOLINGEFFECTASH55") {
     687            0 :                                     thisPeople.CoolingEffectASH55 = true;
     688            0 :                                     state.dataHeatBal->AnyThermalComfortCoolingEffectModel = true;
     689            0 :                                     usingThermalComfort = true;
     690              : 
     691           21 :                                 } else if (thermalComfortType == "ANKLEDRAFTASH55") {
     692            0 :                                     thisPeople.AnkleDraftASH55 = true;
     693            0 :                                     state.dataHeatBal->AnyThermalComfortAnkleDraftModel = true;
     694            0 :                                     usingThermalComfort = true;
     695              : 
     696           21 :                                 } 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           20 :                         if (usingThermalComfort) {
     710              : 
     711              :                             // Set the default value of MRTCalcType as 'EnclosureAveraged'
     712           16 :                             thisPeople.MRTCalcType = DataHeatBalance::CalcMRT::EnclosureAveraged;
     713              : 
     714            1 :                             bool ModelWithAdditionalInputs = thisPeople.Fanger || thisPeople.Pierce || thisPeople.KSU ||
     715           17 :                                                              thisPeople.CoolingEffectASH55 || thisPeople.AnkleDraftASH55;
     716              : 
     717              :                             // MRT Calculation Type and Surface Name
     718           16 :                             thisPeople.MRTCalcType = static_cast<CalcMRT>(getEnumValue(CalcMRTTypeNamesUC, IHGAlphas(7)));
     719              : 
     720           16 :                             switch (thisPeople.MRTCalcType) {
     721           16 :                             case DataHeatBalance::CalcMRT::EnclosureAveraged: {
     722              :                                 // nothing to do here
     723           16 :                             } break;
     724            0 :                             case DataHeatBalance::CalcMRT::SurfaceWeighted: {
     725            0 :                                 thisPeople.SurfacePtr = Util::FindItemInList(IHGAlphas(8), state.dataSurface->Surface);
     726            0 :                                 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            0 :                                     int const surfRadEnclNum = state.dataSurface->Surface(thisPeople.SurfacePtr).RadEnclIndex;
     740            0 :                                     int const thisPeopleRadEnclNum = state.dataHeatBal->space(thisPeople.spaceIndex).radiantEnclosureNum;
     741            0 :                                     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            0 :                             } break;
     759            0 :                             case DataHeatBalance::CalcMRT::AngleFactor: {
     760            0 :                                 thisPeople.AngleFactorListName = IHGAlphas(8);
     761              : 
     762            0 :                             } 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           16 :                             if (!IHGAlphaFieldBlanks(9)) {
     778           15 :                                 thisPeople.workEffSched = Sched::GetSchedule(state, IHGAlphas(9));
     779              :                             }
     780              : 
     781           16 :                             if (Item1 == 1) {
     782           16 :                                 if (IHGAlphaFieldBlanks(9)) {
     783            1 :                                     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           15 :                                 } else if (thisPeople.workEffSched == nullptr) {
     791            0 :                                     ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(9), IHGAlphas(9));
     792            0 :                                     ErrorsFound = true;
     793           15 :                                 } 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           16 :                             if (IHGAlphas(10).empty()) { // Using IHGAlphaFieldBlanks(10) doesn't work because this value is defaulted
     800           16 :                             } 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           16 :                                 switch (thisPeople.clothingType) {
     808              : 
     809           16 :                                 case ClothingType::InsulationSchedule: {
     810              : 
     811           16 :                                     thisPeople.clothingSched = Sched::GetSchedule(state, IHGAlphas(12));
     812           16 :                                     if (Item1 == 1) {
     813           16 :                                         if (IHGAlphaFieldBlanks(12)) {
     814            1 :                                             if (ModelWithAdditionalInputs) {
     815            0 :                                                 ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(12), IHGAlphaFieldNames(10), IHGAlphas(10));
     816            0 :                                                 ErrorsFound = true;
     817              :                                             }
     818           15 :                                         } else if (thisPeople.clothingSched == nullptr) {
     819            0 :                                             if (ModelWithAdditionalInputs) {
     820            0 :                                                 ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(12), IHGAlphas(12));
     821            0 :                                                 ErrorsFound = true;
     822              :                                             }
     823           15 :                                         } 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           15 :                                         } 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           16 :                                 } break;
     831              : 
     832            0 :                                 case ClothingType::DynamicAshrae55: {
     833            0 :                                 } break; // nothing extra to do, at least for now
     834              : 
     835            0 :                                 case ClothingType::CalculationSchedule: {
     836            0 :                                     thisPeople.clothingMethodSched = Sched::GetSchedule(state, IHGAlphas(11));
     837              : 
     838            0 :                                     if (Item1 == 1) {
     839            0 :                                         if (thisPeople.clothingMethodSched == nullptr) {
     840            0 :                                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(11), IHGAlphas(11));
     841            0 :                                             ErrorsFound = true;
     842              :                                         }
     843              :                                     }
     844              : 
     845            0 :                                     if (thisPeople.clothingMethodSched->hasVal(state, 1)) {
     846            0 :                                         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            0 :                                 } break;
     854              : 
     855            0 :                                 default: {
     856            0 :                                 } break; // nothing to do for the other cases
     857              :                                 } // switch (thisPeople.clothingType)
     858              :                             }
     859              : 
     860           16 :                             if (IHGAlphaFieldBlanks(13)) {
     861              :                             } else {
     862           15 :                                 thisPeople.airVelocitySched = Sched::GetSchedule(state, IHGAlphas(13));
     863              :                             }
     864              : 
     865           16 :                             if (Item1 == 1) {
     866           16 :                                 if (IHGAlphaFieldBlanks(13)) {
     867            1 :                                     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           15 :                                 } else if (thisPeople.airVelocitySched == nullptr) {
     875            0 :                                     ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(13), IHGAlphas(13));
     876            0 :                                     ErrorsFound = true;
     877           15 :                                 } 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           16 :                             if (IHGAlphas(21).empty()) { // Using IHGAlphaFieldBlanks(21) doesn't work because this field has a default
     884              :                             } else {
     885            0 :                                 thisPeople.ankleAirVelocitySched = Sched::GetSchedule(state, IHGAlphas(21));
     886              :                             }
     887              : 
     888           16 :                             if (Item1 == 1) {
     889           16 :                                 if (IHGAlphaFieldBlanks(21)) {
     890           16 :                                     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            0 :                                 } 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           76 :                     if (thisPeople.ZonePtr <= 0) {
     907            0 :                         continue; // Error, will be caught and terminated later
     908              :                     }
     909              :                 }
     910              :             }
     911              : 
     912          119 :             for (int peopleNum2 = 1; peopleNum2 <= state.dataHeatBal->TotPeople; ++peopleNum2) {
     913           76 :                 if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
     914            6 :                     SetupEMSActuator(state,
     915              :                                      "People",
     916            3 :                                      state.dataHeatBal->People(peopleNum2).Name,
     917              :                                      "Number of People",
     918              :                                      "[each]",
     919            3 :                                      state.dataHeatBal->People(peopleNum2).EMSPeopleOn,
     920            3 :                                      state.dataHeatBal->People(peopleNum2).EMSNumberOfPeople);
     921            3 :                     SetupEMSInternalVariable(state,
     922              :                                              "People Count Design Level",
     923            3 :                                              state.dataHeatBal->People(peopleNum2).Name,
     924              :                                              "[each]",
     925            3 :                                              state.dataHeatBal->People(peopleNum2).NumberOfPeople);
     926              :                 }
     927              : 
     928              :                 // setup internal gains
     929           76 :                 if (!ErrorsFound) {
     930          456 :                     SetupSpaceInternalGain(state,
     931           76 :                                            state.dataHeatBal->People(peopleNum2).spaceIndex,
     932              :                                            1.0,
     933           76 :                                            state.dataHeatBal->People(peopleNum2).Name,
     934              :                                            DataHeatBalance::IntGainType::People,
     935           76 :                                            &state.dataHeatBal->People(peopleNum2).ConGainRate,
     936              :                                            nullptr,
     937           76 :                                            &state.dataHeatBal->People(peopleNum2).RadGainRate,
     938           76 :                                            &state.dataHeatBal->People(peopleNum2).LatGainRate,
     939              :                                            nullptr,
     940           76 :                                            &state.dataHeatBal->People(peopleNum2).CO2GainRate);
     941              :                 }
     942              :             }
     943              : 
     944              :             // transfer the nominal number of people in a zone to the tabular reporting
     945          130 :             for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) {
     946           87 :                 if (state.dataHeatBal->Zone(Loop).TotOccupants > 0.0) {
     947          142 :                     if (state.dataHeatBal->Zone(Loop).FloorArea > 0.0 &&
     948           68 :                         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           74 :                     Real64 maxOccupLoad = 0.0;
     961           74 :                     int OptionNum = 0;
     962          258 :                     for (int Loop1 = 1; Loop1 <= state.dataHeatBal->TotPeople; ++Loop1) {
     963          184 :                         auto const &people = state.dataHeatBal->People(Loop1);
     964          184 :                         if (people.ZonePtr != Loop) {
     965          108 :                             continue;
     966              :                         }
     967           76 :                         if (maxOccupLoad < people.sched->getCurrentVal() * people.NumberOfPeople) {
     968           35 :                             maxOccupLoad = people.sched->getCurrentVal() * people.NumberOfPeople;
     969           35 :                             OptionNum = Loop1;
     970              :                         }
     971              :                     }
     972           74 :                     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           87 :                 if (state.dataHeatBal->Zone(Loop).isNominalControlled) { // conditioned zones only
     994           60 :                     if (state.dataHeatBal->Zone(Loop).TotOccupants > 0.0) {
     995           60 :                         state.dataHeatBal->Zone(Loop).isNominalOccupied = true;
     996          120 :                         PreDefTableEntry(state,
     997           60 :                                          state.dataOutRptPredefined->pdchOaoNomNumOcc1,
     998           60 :                                          state.dataHeatBal->Zone(Loop).Name,
     999           60 :                                          state.dataHeatBal->Zone(Loop).TotOccupants);
    1000          120 :                         PreDefTableEntry(state,
    1001           60 :                                          state.dataOutRptPredefined->pdchOaoNomNumOcc2,
    1002           60 :                                          state.dataHeatBal->Zone(Loop).Name,
    1003           60 :                                          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          171 :         int numLightsStatements = 0;
    1012          171 :         Real64 sumArea = 0.0;  // sum of floor area for all lights objects
    1013          171 :         Real64 sumPower = 0.0; // sum of power for all lights objects
    1014          171 :         setupIHGZonesAndSpaces(
    1015          171 :             state, lightsModuleObject, state.dataInternalHeatGains->lightsObjects, numLightsStatements, state.dataHeatBal->TotLights, ErrorsFound);
    1016              : 
    1017          171 :         if (state.dataHeatBal->TotLights > 0) {
    1018           41 :             state.dataHeatBal->Lights.allocate(state.dataHeatBal->TotLights);
    1019           41 :             bool CheckSharedExhaustFlag = false;
    1020           41 :             int lightsNum = 0;
    1021          114 :             for (int lightsInputNum = 1; lightsInputNum <= numLightsStatements; ++lightsInputNum) {
    1022              : 
    1023           73 :                 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           73 :                 ErrorObjectHeader eoh{routineName, lightsModuleObject, IHGAlphas(1)};
    1037              : 
    1038           73 :                 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          147 :                 for (int Item1 = 1; Item1 <= thisLightsInput.numOfSpaces; ++Item1) {
    1042           74 :                     ++lightsNum;
    1043           74 :                     auto &thisLights = state.dataHeatBal->Lights(lightsNum);
    1044           74 :                     int const spaceNum = thisLightsInput.spaceNums(Item1);
    1045           74 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1046           74 :                     thisLights.Name = thisLightsInput.names(Item1);
    1047           74 :                     thisLights.spaceIndex = spaceNum;
    1048           74 :                     thisLights.ZonePtr = zoneNum;
    1049              : 
    1050           74 :                     if (!IHGAlphaFieldBlanks(3)) {
    1051           74 :                         thisLights.sched = Sched::GetSchedule(state, IHGAlphas(3));
    1052              :                     }
    1053              : 
    1054           74 :                     if (Item1 == 1) {
    1055           73 :                         if (IHGAlphaFieldBlanks(3)) {
    1056            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1057            0 :                             ErrorsFound = true;
    1058           73 :                         } else if (thisLights.sched == nullptr) {
    1059            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1060            0 :                             ErrorsFound = true;
    1061           73 :                         } 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           74 :                         std::string const &lightingLevel = IHGAlphas(4);
    1071           74 :                         if (lightingLevel == "LIGHTINGLEVEL") {
    1072           47 :                             Real64 spaceFrac = 1.0;
    1073           47 :                             if (thisLightsInput.numOfSpaces > 1) {
    1074            2 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1075            2 :                                 if (zoneArea > 0.0) {
    1076            2 :                                     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           47 :                             thisLights.DesignLevel = IHGNumbers(1) * spaceFrac;
    1087           47 :                             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           27 :                         } else if (lightingLevel == "WATTS/AREA") {
    1096           27 :                             if (spaceNum != 0) {
    1097           27 :                                 if (IHGNumbers(2) >= 0.0) {
    1098           27 :                                     thisLights.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1099           27 :                                     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           27 :                             if (IHGNumericFieldBlanks(2)) {
    1120            0 :                                 ShowWarningError(state,
    1121            0 :                                                  format("{}{}=\"{}\", specifies {}, but that field is blank.  0 Lights will result.",
    1122              :                                                         RoutineName,
    1123              :                                                         lightsModuleObject,
    1124              :                                                         IHGAlphas(1),
    1125              :                                                         IHGNumericFieldNames(2)));
    1126              :                             }
    1127            0 :                         } else if (lightingLevel == "WATTS/PERSON") {
    1128            0 :                             if (spaceNum != 0) {
    1129            0 :                                 if (IHGNumbers(3) >= 0.0) {
    1130            0 :                                     thisLights.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1131            0 :                                     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            0 :                             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           74 :                     thisLights.NomMinDesignLevel = thisLights.DesignLevel * thisLights.sched->getMinVal(state);
    1175           74 :                     thisLights.NomMaxDesignLevel = thisLights.DesignLevel * thisLights.sched->getMaxVal(state);
    1176              : 
    1177           74 :                     thisLights.FractionReturnAir = IHGNumbers(4);
    1178           74 :                     thisLights.FractionRadiant = IHGNumbers(5);
    1179           74 :                     thisLights.FractionShortWave = IHGNumbers(6);
    1180           74 :                     thisLights.FractionReplaceable = IHGNumbers(7);
    1181           74 :                     thisLights.FractionReturnAirPlenTempCoeff1 = IHGNumbers(8);
    1182           74 :                     thisLights.FractionReturnAirPlenTempCoeff2 = IHGNumbers(9);
    1183              : 
    1184           74 :                     thisLights.FractionConvected = 1.0 - (thisLights.FractionReturnAir + thisLights.FractionRadiant + thisLights.FractionShortWave);
    1185           74 :                     if (std::abs(thisLights.FractionConvected) <= 0.001) {
    1186            2 :                         thisLights.FractionConvected = 0.0;
    1187              :                     }
    1188           74 :                     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           74 :                     if (IHGNumAlphas > 4) {
    1206           70 :                         thisLights.EndUseSubcategory = IHGAlphas(5);
    1207              :                     } else {
    1208            4 :                         thisLights.EndUseSubcategory = "General";
    1209              :                     }
    1210              : 
    1211           74 :                     if (IHGAlphaFieldBlanks(6)) {
    1212           69 :                         thisLights.FractionReturnAirIsCalculated = false;
    1213            5 :                     } 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            5 :                         thisLights.FractionReturnAirIsCalculated = (IHGAlphas(6) == "YES");
    1227              :                     }
    1228              : 
    1229              :                     // Set return air node number
    1230           74 :                     thisLights.ZoneReturnNum = 0;
    1231           74 :                     thisLights.RetNodeName = "";
    1232           74 :                     if (!IHGAlphaFieldBlanks(7)) {
    1233            2 :                         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            2 :                             thisLights.RetNodeName = IHGAlphas(7);
    1243              :                         }
    1244              :                     }
    1245           74 :                     if (thisLights.ZonePtr > 0) {
    1246           74 :                         thisLights.ZoneReturnNum = DataZoneEquipment::GetReturnNumForZone(state, thisLights.ZonePtr, thisLights.RetNodeName);
    1247              :                     }
    1248              : 
    1249           74 :                     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           74 :                     thisLights.ZoneExhaustNodeNum = 0;
    1259           74 :                     if (!IHGAlphaFieldBlanks(8)) {
    1260            2 :                         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            2 :                             bool exhaustNodeError = false;
    1270            2 :                             thisLights.ZoneExhaustNodeNum = GetOnlySingleNode(state,
    1271            2 :                                                                               IHGAlphas(8),
    1272              :                                                                               exhaustNodeError,
    1273              :                                                                               DataLoopNode::ConnectionObjectType::Lights,
    1274            2 :                                                                               thisLights.Name,
    1275              :                                                                               DataLoopNode::NodeFluidType::Air,
    1276              :                                                                               DataLoopNode::ConnectionType::ZoneExhaust,
    1277              :                                                                               NodeInputManager::CompFluidStream::Primary,
    1278              :                                                                               ObjectIsNotParent);
    1279            2 :                             if (!exhaustNodeError) { // GetOnlySingleNode will throw error messages if this is a NodeList Name and for other issues
    1280            2 :                                 exhaustNodeError =
    1281            2 :                                     DataZoneEquipment::VerifyLightsExhaustNodeForZone(state, thisLights.ZonePtr, thisLights.ZoneExhaustNodeNum);
    1282              :                             }
    1283            2 :                             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            2 :                                 if (thisLights.ZoneReturnNum > 0) {
    1295            2 :                                     state.dataZoneEquip->ZoneEquipConfig(thisLights.ZonePtr).ReturnNodeExhaustNodeNum(thisLights.ZoneReturnNum) =
    1296            2 :                                         thisLights.ZoneExhaustNodeNum;
    1297            2 :                                     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            2 :                         if (thisLights.ZonePtr <= 0) {
    1314            0 :                             continue; // Error, will be caught and terminated later
    1315              :                         }
    1316              :                     }
    1317              :                 }
    1318              :             }
    1319           41 :             if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    1320            3 :                 for (int lightsNum2 = 1; lightsNum2 <= state.dataHeatBal->TotLights; ++lightsNum2) {
    1321            4 :                     SetupEMSActuator(state,
    1322              :                                      "Lights",
    1323            2 :                                      state.dataHeatBal->Lights(lightsNum2).Name,
    1324              :                                      "Electricity Rate",
    1325              :                                      "[W]",
    1326            2 :                                      state.dataHeatBal->Lights(lightsNum2).EMSLightsOn,
    1327            2 :                                      state.dataHeatBal->Lights(lightsNum2).EMSLightingPower);
    1328            2 :                     SetupEMSInternalVariable(state,
    1329              :                                              "Lighting Power Design Level",
    1330            2 :                                              state.dataHeatBal->Lights(lightsNum2).Name,
    1331              :                                              "[W]",
    1332            2 :                                              state.dataHeatBal->Lights(lightsNum2).DesignLevel);
    1333              :                 } // EMS
    1334              :             }
    1335          115 :             for (int lightsNum2 = 1; lightsNum2 <= state.dataHeatBal->TotLights; ++lightsNum2) {
    1336           74 :                 int spaceNum = state.dataHeatBal->Lights(lightsNum2).spaceIndex;
    1337           74 :                 int zoneNum = state.dataHeatBal->Lights(lightsNum2).ZonePtr;
    1338              :                 // setup internal gains
    1339           74 :                 int returnNodeNum = 0;
    1340          134 :                 if ((state.dataHeatBal->Lights(lightsNum2).ZoneReturnNum > 0) &&
    1341           60 :                     (state.dataHeatBal->Lights(lightsNum2).ZoneReturnNum <= state.dataZoneEquip->ZoneEquipConfig(zoneNum).NumReturnNodes)) {
    1342           60 :                     returnNodeNum = state.dataZoneEquip->ZoneEquipConfig(zoneNum).ReturnNode(state.dataHeatBal->Lights(lightsNum2).ZoneReturnNum);
    1343              :                 }
    1344           74 :                 if (!ErrorsFound) {
    1345          370 :                     SetupSpaceInternalGain(state,
    1346           74 :                                            state.dataHeatBal->Lights(lightsNum2).spaceIndex,
    1347              :                                            1.0,
    1348           74 :                                            state.dataHeatBal->Lights(lightsNum2).Name,
    1349              :                                            DataHeatBalance::IntGainType::Lights,
    1350           74 :                                            &state.dataHeatBal->Lights(lightsNum2).ConGainRate,
    1351           74 :                                            &state.dataHeatBal->Lights(lightsNum2).RetAirGainRate,
    1352           74 :                                            &state.dataHeatBal->Lights(lightsNum2).RadGainRate,
    1353              :                                            nullptr,
    1354              :                                            nullptr,
    1355              :                                            nullptr,
    1356              :                                            nullptr,
    1357              :                                            returnNodeNum);
    1358              :                 }
    1359              : 
    1360           74 :                 if (state.dataHeatBal->Lights(lightsNum2).FractionReturnAir > 0) {
    1361           28 :                     state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum2).ZonePtr).HasLtsRetAirGain = true;
    1362              :                 }
    1363              :                 // send values to predefined lighting summary report
    1364           74 :                 std::string liteName = state.dataHeatBal->Lights(lightsNum2).Name;
    1365           74 :                 Real64 mult = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier;
    1366           74 :                 Real64 spaceArea = state.dataHeatBal->space(spaceNum).FloorArea;
    1367           74 :                 sumArea += spaceArea * mult;
    1368           74 :                 sumPower += state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult;
    1369           74 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtZone, liteName, state.dataHeatBal->Zone(zoneNum).Name);
    1370           74 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpace, liteName, state.dataHeatBal->space(spaceNum).Name);
    1371           74 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSpaceType, liteName, state.dataHeatBal->space(spaceNum).spaceType);
    1372           74 :                 if (spaceArea > 0.0) {
    1373           73 :                     PreDefTableEntry(
    1374          146 :                         state, state.dataOutRptPredefined->pdchInLtDens, liteName, state.dataHeatBal->Lights(lightsNum2).DesignLevel / spaceArea, 4);
    1375              :                 } else {
    1376            1 :                     PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, liteName, DataPrecisionGlobals::constant_zero, 4);
    1377              :                 }
    1378           74 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, liteName, spaceArea * mult);
    1379          148 :                 PreDefTableEntry(
    1380           74 :                     state, state.dataOutRptPredefined->pdchInLtPower, liteName, state.dataHeatBal->Lights(lightsNum2).DesignLevel * mult);
    1381          148 :                 PreDefTableEntry(
    1382          148 :                     state, state.dataOutRptPredefined->pdchInLtEndUse, liteName, state.dataHeatBal->Lights(lightsNum2).EndUseSubcategory);
    1383           74 :                 PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtSchd, liteName, state.dataHeatBal->Lights(lightsNum2).sched->Name);
    1384           74 :                 PreDefTableEntry(
    1385           74 :                     state, state.dataOutRptPredefined->pdchInLtRetAir, liteName, state.dataHeatBal->Lights(lightsNum2).FractionReturnAir, 4);
    1386           74 :             } // Item1 - Number of Lights instances
    1387           41 :             if (CheckSharedExhaustFlag) {
    1388            2 :                 DataZoneEquipment::CheckSharedExhaust(state);
    1389            2 :                 Array1D_bool ReturnNodeShared; // zone supply air inlet nodes
    1390            2 :                 ReturnNodeShared.allocate(state.dataHeatBal->TotLights);
    1391            2 :                 ReturnNodeShared = false;
    1392           12 :                 for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    1393           10 :                     int ZoneNum = state.dataHeatBal->Lights(Loop).ZonePtr;
    1394           10 :                     int ReturnNum = state.dataHeatBal->Lights(Loop).ZoneReturnNum;
    1395           10 :                     int ExhaustNodeNum = state.dataHeatBal->Lights(Loop).ZoneExhaustNodeNum;
    1396           10 :                     if (ReturnNum == 0 || ExhaustNodeNum == 0) {
    1397            8 :                         continue;
    1398              :                     }
    1399           10 :                     for (int Loop1 = Loop + 1; Loop1 <= state.dataHeatBal->TotLights; ++Loop1) {
    1400            8 :                         if (ZoneNum != state.dataHeatBal->Lights(Loop1).ZonePtr) {
    1401            8 :                             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            2 :                 ReturnNodeShared.deallocate();
    1423            2 :             }
    1424              :         } // TotLights > 0 check
    1425              :         // add total line to lighting summary table
    1426          171 :         if (sumArea > 0.0) {
    1427           40 :             PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", sumPower / sumArea,
    1428           80 :                              4); // line 792
    1429              :         } else {
    1430          131 :             PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtDens, "Interior Lighting Total", DataPrecisionGlobals::constant_zero, 4);
    1431              :         }
    1432          171 :         PreDefTableEntry(state, state.dataOutRptPredefined->pdchInLtArea, "Interior Lighting Total", sumArea);
    1433          171 :         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          171 :         int numZoneElectricStatements = 0;
    1438          171 :         setupIHGZonesAndSpaces(state,
    1439              :                                elecEqModuleObject,
    1440          171 :                                state.dataInternalHeatGains->zoneElectricObjects,
    1441              :                                numZoneElectricStatements,
    1442          171 :                                state.dataHeatBal->TotElecEquip,
    1443              :                                ErrorsFound);
    1444              : 
    1445          171 :         if (state.dataHeatBal->TotElecEquip > 0) {
    1446           43 :             state.dataHeatBal->ZoneElectric.allocate(state.dataHeatBal->TotElecEquip);
    1447           43 :             int elecEqNum = 0;
    1448          139 :             for (int elecEqInputNum = 1; elecEqInputNum <= numZoneElectricStatements; ++elecEqInputNum) {
    1449              : 
    1450           96 :                 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           96 :                 ErrorObjectHeader eoh{routineName, elecEqModuleObject, IHGAlphas(1)};
    1464              : 
    1465           96 :                 auto &thisElecEqInput = state.dataInternalHeatGains->zoneElectricObjects(elecEqInputNum);
    1466          193 :                 for (int Item1 = 1; Item1 <= thisElecEqInput.numOfSpaces; ++Item1) {
    1467           97 :                     ++elecEqNum;
    1468           97 :                     auto &thisZoneElectric = state.dataHeatBal->ZoneElectric(elecEqNum);
    1469           97 :                     int const spaceNum = thisElecEqInput.spaceNums(Item1);
    1470           97 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1471           97 :                     thisZoneElectric.Name = thisElecEqInput.names(Item1);
    1472           97 :                     thisZoneElectric.spaceIndex = spaceNum;
    1473           97 :                     thisZoneElectric.ZonePtr = zoneNum;
    1474              : 
    1475              :                     // Why are error messages not guarded by (Item1 == 1) checks for equipment?
    1476              : 
    1477           97 :                     if (IHGAlphaFieldBlanks(3)) {
    1478            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1479            0 :                         ErrorsFound = true;
    1480           97 :                     } else if ((thisZoneElectric.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    1481            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1482            0 :                         ErrorsFound = true;
    1483           97 :                     } 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           97 :                         std::string const &equipmentLevel = IHGAlphas(4);
    1491           97 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    1492           70 :                             Real64 spaceFrac = 1.0;
    1493           70 :                             if (thisElecEqInput.numOfSpaces > 1) {
    1494            2 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1495            2 :                                 if (zoneArea > 0.0) {
    1496            2 :                                     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           70 :                             thisZoneElectric.DesignLevel = IHGNumbers(1) * spaceFrac;
    1508           70 :                             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           27 :                         } else if (equipmentLevel == "WATTS/AREA") {
    1517           27 :                             if (spaceNum != 0) {
    1518           27 :                                 if (IHGNumbers(2) >= 0.0) {
    1519           27 :                                     thisZoneElectric.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1520           27 :                                     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           27 :                             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            0 :                         } else if (equipmentLevel == "WATTS/PERSON") {
    1551            0 :                             if (spaceNum != 0) {
    1552            0 :                                 if (IHGNumbers(3) >= 0.0) {
    1553            0 :                                     thisZoneElectric.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1554            0 :                                     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            0 :                             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           97 :                     thisZoneElectric.NomMinDesignLevel = thisZoneElectric.DesignLevel * thisZoneElectric.sched->getMinVal(state);
    1600           97 :                     thisZoneElectric.NomMaxDesignLevel = thisZoneElectric.DesignLevel * thisZoneElectric.sched->getMaxVal(state);
    1601              : 
    1602           97 :                     thisZoneElectric.FractionLatent = IHGNumbers(4);
    1603           97 :                     thisZoneElectric.FractionRadiant = IHGNumbers(5);
    1604           97 :                     thisZoneElectric.FractionLost = IHGNumbers(6);
    1605              :                     // FractionConvected is a calculated field
    1606           97 :                     thisZoneElectric.FractionConvected =
    1607           97 :                         1.0 - (thisZoneElectric.FractionLatent + thisZoneElectric.FractionRadiant + thisZoneElectric.FractionLost);
    1608           97 :                     if (std::abs(thisZoneElectric.FractionConvected) <= 0.001) {
    1609            4 :                         thisZoneElectric.FractionConvected = 0.0;
    1610              :                     }
    1611           97 :                     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           97 :                     if (IHGNumAlphas > 4) {
    1617            5 :                         thisZoneElectric.EndUseSubcategory = IHGAlphas(5);
    1618              :                     } else {
    1619           92 :                         thisZoneElectric.EndUseSubcategory = "General";
    1620              :                     }
    1621           97 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    1622            3 :                         SetupEMSActuator(state,
    1623              :                                          "ElectricEquipment",
    1624              :                                          thisZoneElectric.Name,
    1625              :                                          "Electricity Rate",
    1626              :                                          "[W]",
    1627            3 :                                          thisZoneElectric.EMSZoneEquipOverrideOn,
    1628            3 :                                          thisZoneElectric.EMSEquipPower);
    1629            3 :                         SetupEMSInternalVariable(
    1630            3 :                             state, "Plug and Process Power Design Level", thisZoneElectric.Name, "[W]", thisZoneElectric.DesignLevel);
    1631              :                     } // EMS
    1632           97 :                     if (!ErrorsFound) {
    1633           97 :                         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          342 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> zoneGasObjects;
    1649          171 :         int numZoneGasStatements = 0;
    1650          171 :         setupIHGZonesAndSpaces(state, gasEqModuleObject, zoneGasObjects, numZoneGasStatements, state.dataHeatBal->TotGasEquip, ErrorsFound);
    1651              : 
    1652          171 :         if (state.dataHeatBal->TotGasEquip > 0) {
    1653            1 :             state.dataHeatBal->ZoneGas.allocate(state.dataHeatBal->TotGasEquip);
    1654            1 :             int gasEqNum = 0;
    1655            2 :             for (int gasEqInputNum = 1; gasEqInputNum <= numZoneGasStatements; ++gasEqInputNum) {
    1656              : 
    1657            1 :                 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            1 :                 ErrorObjectHeader eoh{routineName, gasEqModuleObject, IHGAlphas(1)};
    1671              : 
    1672            1 :                 auto &thisGasEqInput = zoneGasObjects(gasEqInputNum);
    1673            3 :                 for (int Item1 = 1; Item1 <= thisGasEqInput.numOfSpaces; ++Item1) {
    1674            2 :                     ++gasEqNum;
    1675            2 :                     auto &thisZoneGas = state.dataHeatBal->ZoneGas(gasEqNum);
    1676            2 :                     int const spaceNum = thisGasEqInput.spaceNums(Item1);
    1677            2 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1678            2 :                     thisZoneGas.Name = thisGasEqInput.names(Item1);
    1679            2 :                     thisZoneGas.spaceIndex = spaceNum;
    1680            2 :                     thisZoneGas.ZonePtr = zoneNum;
    1681              : 
    1682            2 :                     if (!IHGAlphaFieldBlanks(3)) {
    1683            2 :                         thisZoneGas.sched = Sched::GetSchedule(state, IHGAlphas(3));
    1684              :                     }
    1685              : 
    1686              :                     // And here for gas, we are guarding with (Item1 == 1) again
    1687            2 :                     if (Item1 == 1) {
    1688            1 :                         if (IHGAlphaFieldBlanks(3)) {
    1689            0 :                             ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1690            0 :                             ErrorsFound = true;
    1691            1 :                         } else if (thisZoneGas.sched == nullptr) {
    1692            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1693            0 :                             ErrorsFound = true;
    1694            1 :                         } 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            2 :                         std::string const &equipmentLevel = IHGAlphas(4);
    1703            2 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    1704            2 :                             Real64 spaceFrac = 1.0;
    1705            2 :                             if (thisGasEqInput.numOfSpaces > 1) {
    1706            2 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1707            2 :                                 if (zoneArea > 0.0) {
    1708            2 :                                     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            2 :                             thisZoneGas.DesignLevel = IHGNumbers(1) * spaceFrac;
    1720            2 :                             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            0 :                         } else if (equipmentLevel == "WATTS/AREA" || equipmentLevel == "POWER/AREA") {
    1729            0 :                             if (spaceNum != 0) {
    1730            0 :                                 if (IHGNumbers(2) >= 0.0) {
    1731            0 :                                     thisZoneGas.DesignLevel = IHGNumbers(2) * state.dataHeatBal->space(spaceNum).FloorArea;
    1732            0 :                                     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            0 :                             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            2 :                     thisZoneGas.NomMinDesignLevel = thisZoneGas.DesignLevel * thisZoneGas.sched->getMinVal(state);
    1803            2 :                     thisZoneGas.NomMaxDesignLevel = thisZoneGas.DesignLevel * thisZoneGas.sched->getMaxVal(state);
    1804              : 
    1805            2 :                     thisZoneGas.FractionLatent = IHGNumbers(4);
    1806            2 :                     thisZoneGas.FractionRadiant = IHGNumbers(5);
    1807            2 :                     thisZoneGas.FractionLost = IHGNumbers(6);
    1808              : 
    1809            2 :                     if ((IHGNumNumbers == 7) || (!IHGNumericFieldBlanks(7))) {
    1810            2 :                         thisZoneGas.CO2RateFactor = IHGNumbers(7);
    1811              :                     }
    1812            2 :                     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            2 :                     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            2 :                     thisZoneGas.FractionConvected = 1.0 - (thisZoneGas.FractionLatent + thisZoneGas.FractionRadiant + thisZoneGas.FractionLost);
    1834            2 :                     if (std::abs(thisZoneGas.FractionConvected) <= 0.001) {
    1835            0 :                         thisZoneGas.FractionConvected = 0.0;
    1836              :                     }
    1837            2 :                     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            2 :                     if (IHGNumAlphas > 4) {
    1846            0 :                         thisZoneGas.EndUseSubcategory = IHGAlphas(5);
    1847              :                     } else {
    1848            2 :                         thisZoneGas.EndUseSubcategory = "General";
    1849              :                     }
    1850              : 
    1851            2 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    1852            0 :                         SetupEMSActuator(state,
    1853              :                                          "GasEquipment",
    1854              :                                          thisZoneGas.Name,
    1855              :                                          "NaturalGas Rate",
    1856              :                                          "[W]",
    1857            0 :                                          thisZoneGas.EMSZoneEquipOverrideOn,
    1858            0 :                                          thisZoneGas.EMSEquipPower);
    1859            0 :                         SetupEMSInternalVariable(state, "Gas Process Power Design Level", thisZoneGas.Name, "[W]", thisZoneGas.DesignLevel);
    1860              :                     } // EMS
    1861              : 
    1862            2 :                     if (!ErrorsFound) {
    1863            2 :                         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          342 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> hotWaterEqObjects;
    1882          171 :         int numHotWaterEqStatements = 0;
    1883          171 :         setupIHGZonesAndSpaces(state, hwEqModuleObject, hotWaterEqObjects, numHotWaterEqStatements, state.dataHeatBal->TotHWEquip, ErrorsFound);
    1884              : 
    1885          171 :         if (state.dataHeatBal->TotHWEquip > 0) {
    1886            1 :             state.dataHeatBal->ZoneHWEq.allocate(state.dataHeatBal->TotHWEquip);
    1887            1 :             int hwEqNum = 0;
    1888            2 :             for (int hwEqInputNum = 1; hwEqInputNum <= numHotWaterEqStatements; ++hwEqInputNum) {
    1889              : 
    1890            1 :                 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            1 :                 ErrorObjectHeader eoh{routineName, hwEqModuleObject, IHGAlphas(1)};
    1904              : 
    1905            1 :                 auto &thisHWEqInput = hotWaterEqObjects(hwEqInputNum);
    1906            3 :                 for (int Item1 = 1; Item1 <= thisHWEqInput.numOfSpaces; ++Item1) {
    1907            2 :                     ++hwEqNum;
    1908            2 :                     auto &thisZoneHWEq = state.dataHeatBal->ZoneHWEq(hwEqNum);
    1909            2 :                     int const spaceNum = thisHWEqInput.spaceNums(Item1);
    1910            2 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    1911            2 :                     thisZoneHWEq.Name = thisHWEqInput.names(Item1);
    1912            2 :                     thisZoneHWEq.spaceIndex = spaceNum;
    1913            2 :                     thisZoneHWEq.ZonePtr = zoneNum;
    1914              : 
    1915            2 :                     if (IHGAlphaFieldBlanks(3)) {
    1916            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    1917            0 :                         ErrorsFound = true;
    1918            2 :                     } else if ((thisZoneHWEq.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    1919            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    1920            0 :                         ErrorsFound = true;
    1921            2 :                     } 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            2 :                         std::string const &equipmentLevel = IHGAlphas(4);
    1929            2 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    1930            2 :                             Real64 spaceFrac = 1.0;
    1931            2 :                             if (thisHWEqInput.numOfSpaces > 1) {
    1932            2 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    1933            2 :                                 if (zoneArea > 0.0) {
    1934            2 :                                     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            2 :                             thisZoneHWEq.DesignLevel = IHGNumbers(1) * spaceFrac;
    1946            2 :                             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            0 :                         } 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            0 :                         } else if (equipmentLevel == "WATTS/PERSON" || equipmentLevel == "POWER/PERSON") {
    1989            0 :                             if (spaceNum != 0) {
    1990            0 :                                 if (IHGNumbers(3) >= 0.0) {
    1991            0 :                                     thisZoneHWEq.DesignLevel = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).TotOccupants;
    1992            0 :                                     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            0 :                             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            2 :                     thisZoneHWEq.NomMinDesignLevel = thisZoneHWEq.DesignLevel * thisZoneHWEq.sched->getMinVal(state);
    2038            2 :                     thisZoneHWEq.NomMaxDesignLevel = thisZoneHWEq.DesignLevel * thisZoneHWEq.sched->getMaxVal(state);
    2039              : 
    2040            2 :                     thisZoneHWEq.FractionLatent = IHGNumbers(4);
    2041            2 :                     thisZoneHWEq.FractionRadiant = IHGNumbers(5);
    2042            2 :                     thisZoneHWEq.FractionLost = IHGNumbers(6);
    2043              :                     // FractionConvected is a calculated field
    2044            2 :                     thisZoneHWEq.FractionConvected = 1.0 - (thisZoneHWEq.FractionLatent + thisZoneHWEq.FractionRadiant + thisZoneHWEq.FractionLost);
    2045            2 :                     if (std::abs(thisZoneHWEq.FractionConvected) <= 0.001) {
    2046            0 :                         thisZoneHWEq.FractionConvected = 0.0;
    2047              :                     }
    2048            2 :                     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            2 :                     if (IHGNumAlphas > 4) {
    2054            0 :                         thisZoneHWEq.EndUseSubcategory = IHGAlphas(5);
    2055              :                     } else {
    2056            2 :                         thisZoneHWEq.EndUseSubcategory = "General";
    2057              :                     }
    2058              : 
    2059            2 :                     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            2 :                     if (!ErrorsFound) {
    2071            2 :                         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          342 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> steamEqObjects;
    2088          171 :         int numSteamEqStatements = 0;
    2089          171 :         setupIHGZonesAndSpaces(state, stmEqModuleObject, steamEqObjects, numSteamEqStatements, state.dataHeatBal->TotStmEquip, ErrorsFound);
    2090              : 
    2091          171 :         if (state.dataHeatBal->TotStmEquip > 0) {
    2092            1 :             state.dataHeatBal->ZoneSteamEq.allocate(state.dataHeatBal->TotStmEquip);
    2093            1 :             int stmEqNum = 0;
    2094            2 :             for (int stmEqInputNum = 1; stmEqInputNum <= numSteamEqStatements; ++stmEqInputNum) {
    2095            1 :                 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            1 :                 ErrorObjectHeader eoh{routineName, stmEqModuleObject, IHGAlphas(1)};
    2109              : 
    2110            1 :                 auto &thisStmEqInput = steamEqObjects(stmEqInputNum);
    2111            3 :                 for (int Item1 = 1; Item1 <= thisStmEqInput.numOfSpaces; ++Item1) {
    2112            2 :                     ++stmEqNum;
    2113            2 :                     auto &thisZoneStmEq = state.dataHeatBal->ZoneSteamEq(stmEqNum);
    2114            2 :                     int const spaceNum = thisStmEqInput.spaceNums(Item1);
    2115            2 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    2116            2 :                     thisZoneStmEq.Name = thisStmEqInput.names(Item1);
    2117            2 :                     thisZoneStmEq.spaceIndex = spaceNum;
    2118            2 :                     thisZoneStmEq.ZonePtr = zoneNum;
    2119              : 
    2120            2 :                     if (IHGAlphaFieldBlanks(3)) {
    2121            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    2122            0 :                         ErrorsFound = true;
    2123            2 :                     } else if ((thisZoneStmEq.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    2124            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    2125            0 :                         ErrorsFound = true;
    2126            2 :                     } 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            2 :                         std::string const &equipmentLevel = IHGAlphas(4);
    2134            2 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    2135            2 :                             Real64 spaceFrac = 1.0;
    2136            2 :                             if (thisStmEqInput.numOfSpaces > 1) {
    2137            2 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    2138            2 :                                 if (zoneArea > 0.0) {
    2139            2 :                                     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            2 :                             thisZoneStmEq.DesignLevel = IHGNumbers(1) * spaceFrac;
    2151            2 :                             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            2 :                     thisZoneStmEq.NomMinDesignLevel = thisZoneStmEq.DesignLevel * thisZoneStmEq.sched->getMinVal(state);
    2242            2 :                     thisZoneStmEq.NomMaxDesignLevel = thisZoneStmEq.DesignLevel * thisZoneStmEq.sched->getMaxVal(state);
    2243              : 
    2244            2 :                     thisZoneStmEq.FractionLatent = IHGNumbers(4);
    2245            2 :                     thisZoneStmEq.FractionRadiant = IHGNumbers(5);
    2246            2 :                     thisZoneStmEq.FractionLost = IHGNumbers(6);
    2247              :                     // FractionConvected is a calculated field
    2248            2 :                     thisZoneStmEq.FractionConvected =
    2249            2 :                         1.0 - (thisZoneStmEq.FractionLatent + thisZoneStmEq.FractionRadiant + thisZoneStmEq.FractionLost);
    2250            2 :                     if (std::abs(thisZoneStmEq.FractionConvected) <= 0.001) {
    2251            0 :                         thisZoneStmEq.FractionConvected = 0.0;
    2252              :                     }
    2253            2 :                     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            2 :                     if (IHGNumAlphas > 4) {
    2259            0 :                         thisZoneStmEq.EndUseSubcategory = IHGAlphas(5);
    2260              :                     } else {
    2261            2 :                         thisZoneStmEq.EndUseSubcategory = "General";
    2262              :                     }
    2263              : 
    2264            2 :                     if (thisZoneStmEq.ZonePtr <= 0) {
    2265            0 :                         continue; // Error, will be caught and terminated later
    2266              :                     }
    2267              : 
    2268            2 :                     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            2 :                     if (!ErrorsFound) {
    2281            2 :                         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          342 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> otherEqObjects;
    2298          171 :         int numOtherEqStatements = 0;
    2299          171 :         setupIHGZonesAndSpaces(state, othEqModuleObject, otherEqObjects, numOtherEqStatements, state.dataHeatBal->TotOthEquip, ErrorsFound);
    2300              : 
    2301          171 :         if (state.dataHeatBal->TotOthEquip > 0) {
    2302           27 :             state.dataHeatBal->ZoneOtherEq.allocate(state.dataHeatBal->TotOthEquip);
    2303           27 :             int othEqNum = 0;
    2304           79 :             for (int othEqInputNum = 1; othEqInputNum <= numOtherEqStatements; ++othEqInputNum) {
    2305              : 
    2306           52 :                 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           52 :                 ErrorObjectHeader eoh{routineName, othEqModuleObject, IHGAlphas(1)};
    2320              : 
    2321           52 :                 auto &thisOthEqInput = otherEqObjects(othEqInputNum);
    2322          106 :                 for (int Item1 = 1; Item1 <= thisOthEqInput.numOfSpaces; ++Item1) {
    2323           54 :                     ++othEqNum;
    2324           54 :                     auto &thisZoneOthEq = state.dataHeatBal->ZoneOtherEq(othEqNum);
    2325           54 :                     int const spaceNum = thisOthEqInput.spaceNums(Item1);
    2326           54 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    2327           54 :                     thisZoneOthEq.Name = thisOthEqInput.names(Item1);
    2328           54 :                     thisZoneOthEq.spaceIndex = spaceNum;
    2329           54 :                     thisZoneOthEq.ZonePtr = zoneNum;
    2330              : 
    2331           54 :                     if (IHGAlphas(2) == "NONE") {
    2332           47 :                         thisZoneOthEq.OtherEquipFuelType = Constant::eFuel::None;
    2333              :                     } else {
    2334            7 :                         thisZoneOthEq.OtherEquipFuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, IHGAlphas(2)));
    2335            7 :                         if (thisZoneOthEq.OtherEquipFuelType == Constant::eFuel::Invalid ||
    2336            7 :                             thisZoneOthEq.OtherEquipFuelType == Constant::eFuel::Water) {
    2337            2 :                             ShowSevereError(state,
    2338            2 :                                             format("{}{}: invalid {} entered={} for {}={}",
    2339              :                                                    RoutineName,
    2340              :                                                    othEqModuleObject,
    2341              :                                                    IHGAlphaFieldNames(2),
    2342              :                                                    IHGAlphas(2),
    2343              :                                                    IHGAlphaFieldNames(1),
    2344            1 :                                                    thisOthEqInput.Name));
    2345            1 :                             ErrorsFound = true;
    2346              :                         }
    2347              : 
    2348              :                         // Build list of fuel types used in each zone and space (excluding Water)
    2349              : 
    2350            7 :                         bool found = false;
    2351            9 :                         for (Constant::eFuel fuelType : state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums) {
    2352            4 :                             if (thisZoneOthEq.OtherEquipFuelType == fuelType) {
    2353            2 :                                 found = true;
    2354            2 :                                 break;
    2355              :                             }
    2356            7 :                         }
    2357            7 :                         if (!found) {
    2358            5 :                             state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums.emplace_back(thisZoneOthEq.OtherEquipFuelType);
    2359              :                             // state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNames.emplace_back(FuelTypeString);
    2360              :                         }
    2361            7 :                         found = false;
    2362            9 :                         for (Constant::eFuel fuelType : state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums) {
    2363            2 :                             if (thisZoneOthEq.OtherEquipFuelType == fuelType) {
    2364            0 :                                 found = true;
    2365            0 :                                 break;
    2366              :                             }
    2367            7 :                         }
    2368            7 :                         if (!found) {
    2369            7 :                             state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums.emplace_back(thisZoneOthEq.OtherEquipFuelType);
    2370              :                             // state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNames.emplace_back(FuelTypeString);
    2371              :                         }
    2372              :                     }
    2373              : 
    2374           54 :                     if (IHGAlphaFieldBlanks(4)) {
    2375            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(4));
    2376            0 :                         ErrorsFound = true;
    2377           54 :                     } else if ((thisZoneOthEq.sched = Sched::GetSchedule(state, IHGAlphas(4))) == nullptr) {
    2378            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(4), IHGAlphas(4));
    2379            0 :                         ErrorsFound = true;
    2380           54 :                     } 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           54 :                         std::string const &equipmentLevel = IHGAlphas(5);
    2389           54 :                         if (equipmentLevel == "EQUIPMENTLEVEL") {
    2390           54 :                             DesignLevelFieldNumber = 1;
    2391           54 :                             Real64 spaceFrac = 1.0;
    2392           54 :                             if (thisOthEqInput.numOfSpaces > 1) {
    2393            4 :                                 Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    2394            4 :                                 if (zoneArea > 0.0) {
    2395            4 :                                     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           54 :                             thisZoneOthEq.DesignLevel = IHGNumbers(1) * spaceFrac;
    2407           54 :                             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           54 :                     if (thisZoneOthEq.DesignLevel < 0.0 && thisZoneOthEq.OtherEquipFuelType != Constant::eFuel::Invalid &&
    2477           24 :                         thisZoneOthEq.OtherEquipFuelType != Constant::eFuel::None) {
    2478            2 :                         ShowSevereError(state,
    2479            3 :                                         format("{}{}=\"{}\", {} is not allowed to be negative",
    2480              :                                                RoutineName,
    2481              :                                                othEqModuleObject,
    2482            1 :                                                thisOthEqInput.Name,
    2483              :                                                IHGNumericFieldNames(DesignLevelFieldNumber)));
    2484            2 :                         ShowContinueError(
    2485            2 :                             state, format("... when a fuel type of {} is specified.", Constant::eFuelNames[(int)thisZoneOthEq.OtherEquipFuelType]));
    2486            1 :                         ErrorsFound = true;
    2487              :                     }
    2488              : 
    2489              :                     // Calculate nominal min/max equipment level
    2490           54 :                     thisZoneOthEq.NomMinDesignLevel = thisZoneOthEq.DesignLevel * thisZoneOthEq.sched->getMinVal(state);
    2491           54 :                     thisZoneOthEq.NomMaxDesignLevel = thisZoneOthEq.DesignLevel * thisZoneOthEq.sched->getMaxVal(state);
    2492              : 
    2493           54 :                     thisZoneOthEq.FractionLatent = IHGNumbers(4);
    2494           54 :                     thisZoneOthEq.FractionRadiant = IHGNumbers(5);
    2495           54 :                     thisZoneOthEq.FractionLost = IHGNumbers(6);
    2496              : 
    2497           54 :                     if ((IHGNumNumbers == 7) || (!IHGNumericFieldBlanks(7))) {
    2498            4 :                         thisZoneOthEq.CO2RateFactor = IHGNumbers(7);
    2499              :                     }
    2500           54 :                     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           54 :                     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           54 :                     thisZoneOthEq.FractionConvected =
    2523           54 :                         1.0 - (thisZoneOthEq.FractionLatent + thisZoneOthEq.FractionRadiant + thisZoneOthEq.FractionLost);
    2524           54 :                     if (std::abs(thisZoneOthEq.FractionConvected) <= 0.001) {
    2525            0 :                         thisZoneOthEq.FractionConvected = 0.0;
    2526              :                     }
    2527           54 :                     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           54 :                     if (IHGNumAlphas > 5) {
    2533            0 :                         thisZoneOthEq.EndUseSubcategory = IHGAlphas(6);
    2534              :                     } else {
    2535           54 :                         thisZoneOthEq.EndUseSubcategory = "General";
    2536              :                     }
    2537              : 
    2538           54 :                     if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2539           40 :                         SetupEMSActuator(state,
    2540              :                                          "OtherEquipment",
    2541              :                                          thisZoneOthEq.Name,
    2542              :                                          "Power Level",
    2543              :                                          "[W]",
    2544           40 :                                          thisZoneOthEq.EMSZoneEquipOverrideOn,
    2545           40 :                                          thisZoneOthEq.EMSEquipPower);
    2546           40 :                         SetupEMSInternalVariable(state, "Other Equipment Design Level", thisZoneOthEq.Name, "[W]", thisZoneOthEq.DesignLevel);
    2547              :                     } // EMS
    2548              : 
    2549           54 :                     if (!ErrorsFound) {
    2550           52 :                         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          342 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> iTEqObjects;
    2567          171 :         int numZoneITEqStatements = 0;
    2568              :         // Note that this object type does not support ZoneList due to node names in input fields
    2569          171 :         bool zoneListNotAllowed = true;
    2570          342 :         setupIHGZonesAndSpaces(
    2571          171 :             state, itEqModuleObject, iTEqObjects, numZoneITEqStatements, state.dataHeatBal->TotITEquip, ErrorsFound, zoneListNotAllowed);
    2572              : 
    2573          171 :         if (state.dataHeatBal->TotITEquip > 0) {
    2574           14 :             state.dataHeatBal->ZoneITEq.allocate(state.dataHeatBal->TotITEquip);
    2575           14 :             int itEqNum = 0;
    2576           28 :             for (int itEqInputNum = 1; itEqInputNum <= numZoneITEqStatements; ++itEqInputNum) {
    2577              : 
    2578           14 :                 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           14 :                 ErrorObjectHeader eoh{routineName, itEqModuleObject, IHGAlphas(1)};
    2592              : 
    2593           14 :                 auto &thisITEqInput = iTEqObjects(itEqInputNum);
    2594           28 :                 for (int Item1 = 1; Item1 <= thisITEqInput.numOfSpaces; ++Item1) {
    2595           14 :                     ++itEqNum;
    2596           14 :                     auto &thisZoneITEq = state.dataHeatBal->ZoneITEq(itEqNum);
    2597           14 :                     int const spaceNum = thisITEqInput.spaceNums(Item1);
    2598           14 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    2599           14 :                     thisZoneITEq.Name = thisITEqInput.names(Item1);
    2600           14 :                     thisZoneITEq.spaceIndex = spaceNum;
    2601           14 :                     thisZoneITEq.ZonePtr = zoneNum;
    2602              : 
    2603              :                     // IT equipment design level calculation method.
    2604           14 :                     if (IHGAlphaFieldBlanks(3)) {
    2605            3 :                         thisZoneITEq.FlowControlWithApproachTemps = false;
    2606              :                     } else {
    2607           11 :                         if (Util::SameString(IHGAlphas(3), "FlowFromSystem")) {
    2608            8 :                             thisZoneITEq.FlowControlWithApproachTemps = false;
    2609            3 :                         } else if (Util::SameString(IHGAlphas(3), "FlowControlWithApproachTemperatures")) {
    2610            3 :                             thisZoneITEq.FlowControlWithApproachTemps = true;
    2611            3 :                             state.dataHeatBal->Zone(thisZoneITEq.ZonePtr).HasAdjustedReturnTempByITE = true;
    2612            3 :                             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           14 :                         std::string const &equipmentLevel = IHGAlphas(4);
    2623           14 :                         if (equipmentLevel == "WATTS/UNIT") {
    2624           14 :                             Real64 spaceFrac = 1.0;
    2625           14 :                             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           14 :                             thisZoneITEq.DesignTotalPower = IHGNumbers(1) * IHGNumbers(2) * spaceFrac;
    2642           14 :                             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           14 :                             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            0 :                         } else if (equipmentLevel == "WATTS/AREA") {
    2660            0 :                             if (thisZoneITEq.ZonePtr != 0) {
    2661            0 :                                 if (IHGNumbers(3) >= 0.0) {
    2662            0 :                                     if (spaceNum > 0) {
    2663            0 :                                         thisZoneITEq.DesignTotalPower = IHGNumbers(3) * state.dataHeatBal->space(spaceNum).FloorArea;
    2664            0 :                                         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            0 :                                 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           14 :                         if (IHGAlphaFieldBlanks(5)) {
    2708            9 :                             thisZoneITEq.operSched = Sched::GetScheduleAlwaysOn(state); // Not an availability schedule, but default is constant-1.0
    2709            5 :                         } else if ((thisZoneITEq.operSched = Sched::GetSchedule(state, IHGAlphas(5))) == nullptr) {
    2710            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(5), IHGAlphas(5));
    2711            0 :                             ErrorsFound = true;
    2712            5 :                         } 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           14 :                         if (IHGAlphaFieldBlanks(6)) {
    2718            9 :                             thisZoneITEq.cpuLoadSched =
    2719            9 :                                 Sched::GetScheduleAlwaysOn(state); // not an availability schedule, but default is constant-1.0
    2720            5 :                         } else if ((thisZoneITEq.cpuLoadSched = Sched::GetSchedule(state, IHGAlphas(6))) == nullptr) {
    2721            0 :                             ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(6), IHGAlphas(6));
    2722            0 :                             ErrorsFound = true;
    2723            5 :                         } 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           14 :                         thisZoneITEq.NomMinDesignLevel = thisZoneITEq.DesignTotalPower * thisZoneITEq.cpuLoadSched->getMinVal(state);
    2730           14 :                         thisZoneITEq.NomMaxDesignLevel = thisZoneITEq.DesignTotalPower * thisZoneITEq.cpuLoadSched->getMaxVal(state);
    2731              : 
    2732           14 :                         thisZoneITEq.DesignFanPowerFrac = IHGNumbers(4);
    2733           14 :                         thisZoneITEq.DesignFanPower = thisZoneITEq.DesignFanPowerFrac * thisZoneITEq.DesignTotalPower;
    2734           14 :                         thisZoneITEq.DesignCPUPower = (1.0 - thisZoneITEq.DesignFanPowerFrac) * thisZoneITEq.DesignTotalPower;
    2735           14 :                         thisZoneITEq.DesignAirVolFlowRate = IHGNumbers(5) * thisZoneITEq.DesignTotalPower;
    2736           14 :                         thisZoneITEq.DesignTAirIn = IHGNumbers(6);
    2737           14 :                         thisZoneITEq.DesignRecircFrac = IHGNumbers(7);
    2738           14 :                         thisZoneITEq.DesignUPSEfficiency = IHGNumbers(8);
    2739           14 :                         thisZoneITEq.UPSLossToZoneFrac = IHGNumbers(9);
    2740           14 :                         thisZoneITEq.SupplyApproachTemp = IHGNumbers(10);
    2741           14 :                         thisZoneITEq.ReturnApproachTemp = IHGNumbers(11);
    2742              : 
    2743           14 :                         bool hasSupplyApproachTemp = !IHGNumericFieldBlanks(10);
    2744           14 :                         bool hasReturnApproachTemp = !IHGNumericFieldBlanks(11);
    2745              : 
    2746              :                         // Performance curves
    2747           14 :                         thisZoneITEq.CPUPowerFLTCurve = GetCurveIndex(state, IHGAlphas(7));
    2748           14 :                         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           14 :                         thisZoneITEq.AirFlowFLTCurve = GetCurveIndex(state, IHGAlphas(8));
    2755           14 :                         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           14 :                         thisZoneITEq.FanPowerFFCurve = GetCurveIndex(state, IHGAlphas(9));
    2762           14 :                         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           14 :                         if (!IHGAlphaFieldBlanks(15)) {
    2769              :                             // If this field isn't blank, it must point to a valid curve
    2770            8 :                             thisZoneITEq.RecircFLTCurve = GetCurveIndex(state, IHGAlphas(15));
    2771            8 :                             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            6 :                             thisZoneITEq.RecircFLTCurve = 0;
    2779              :                         }
    2780              : 
    2781           14 :                         if (!IHGAlphaFieldBlanks(16)) {
    2782              :                             // If this field isn't blank, it must point to a valid curve
    2783            8 :                             thisZoneITEq.UPSEfficFPLRCurve = GetCurveIndex(state, IHGAlphas(16));
    2784            8 :                             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            6 :                             thisZoneITEq.UPSEfficFPLRCurve = 0;
    2792              :                         }
    2793              : 
    2794              :                         // Environmental class
    2795           14 :                         thisZoneITEq.Class = static_cast<ITEClass>(getEnumValue(ITEClassNamesUC, Util::makeUPPER(IHGAlphas(10))));
    2796           14 :                         ErrorsFound = ErrorsFound || (thisZoneITEq.Class == ITEClass::Invalid);
    2797              : 
    2798              :                         // Air and supply inlet connections
    2799           14 :                         thisZoneITEq.AirConnectionType =
    2800           14 :                             static_cast<ITEInletConnection>(getEnumValue(ITEInletConnectionNamesUC, Util::makeUPPER(IHGAlphas(11))));
    2801           14 :                         if (thisZoneITEq.AirConnectionType == ITEInletConnection::RoomAirModel) {
    2802              :                             // ZoneITEq(Loop).AirConnectionType = ITEInletConnection::RoomAirModel;
    2803            4 :                             ShowWarningError(state,
    2804            4 :                                              format("{}{}=\"{}Air Inlet Connection Type = RoomAirModel is not implemented yet, using ZoneAirNode",
    2805              :                                                     RoutineName,
    2806              :                                                     itEqModuleObject,
    2807              :                                                     IHGAlphas(1)));
    2808            2 :                             thisZoneITEq.AirConnectionType = ITEInletConnection::ZoneAirNode;
    2809              :                         }
    2810           14 :                         ErrorsFound = ErrorsFound || (thisZoneITEq.AirConnectionType == ITEInletConnection::Invalid);
    2811              : 
    2812           14 :                         if (IHGAlphaFieldBlanks(14)) {
    2813            5 :                             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            5 :                             } 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           18 :                             thisZoneITEq.SupplyAirNodeNum = GetOnlySingleNode(state,
    2830            9 :                                                                               IHGAlphas(14),
    2831              :                                                                               ErrorsFound,
    2832              :                                                                               DataLoopNode::ConnectionObjectType::ElectricEquipmentITEAirCooled,
    2833            9 :                                                                               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           14 :                         int zoneEqIndex = DataZoneEquipment::GetControlledZoneIndex(state, state.dataHeatBal->Zone(thisZoneITEq.ZonePtr).Name);
    2842           14 :                         if (zoneEqIndex > 0) { // zoneEqIndex could be zero in the case of an uncontrolled zone
    2843            2 :                             auto itStart = state.dataZoneEquip->ZoneEquipConfig(zoneEqIndex).InletNode.begin();
    2844            2 :                             auto itEnd = state.dataZoneEquip->ZoneEquipConfig(zoneEqIndex).InletNode.end();
    2845            2 :                             int key = thisZoneITEq.SupplyAirNodeNum;
    2846            2 :                             thisZoneITEq.inControlledZone = true;
    2847            2 :                             bool supplyNodeFound = false;
    2848            2 :                             if (std::find(itStart, itEnd, key) != itEnd) {
    2849            0 :                                 supplyNodeFound = true;
    2850              :                             }
    2851              : 
    2852            2 :                             if (thisZoneITEq.AirConnectionType == ITEInletConnection::AdjustedSupply && !supplyNodeFound) {
    2853              :                                 // supply air node must match zone equipment supply air node for these conditions
    2854            1 :                                 ShowSevereError(state, format("{}: ElectricEquipment:ITE:AirCooled {}", RoutineName, thisZoneITEq.Name));
    2855            2 :                                 ShowContinueError(state, "Air Inlet Connection Type = AdjustedSupply but no Supply Air Node is specified.");
    2856            1 :                                 ErrorsFound = true;
    2857            1 :                             } else if (thisZoneITEq.FlowControlWithApproachTemps && !supplyNodeFound) {
    2858              :                                 // supply air node must match zone equipment supply air node for these conditions
    2859            1 :                                 ShowSevereError(state, format("{}: ElectricEquipment:ITE:AirCooled {}", RoutineName, thisZoneITEq.Name));
    2860            2 :                                 ShowContinueError(state, "Air Inlet Connection Type = AdjustedSupply but no Supply Air Node is specified.");
    2861            1 :                                 ErrorsFound = true;
    2862            0 :                             } 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           14 :                         if (IHGNumAlphas > 16) {
    2875           14 :                             thisZoneITEq.EndUseSubcategoryCPU = IHGAlphas(17);
    2876              :                         } else {
    2877            0 :                             thisZoneITEq.EndUseSubcategoryCPU = "ITE-CPU";
    2878              :                         }
    2879              : 
    2880           14 :                         if (IHGNumAlphas > 17) {
    2881           14 :                             thisZoneITEq.EndUseSubcategoryFan = IHGAlphas(18);
    2882              :                         } else {
    2883            0 :                             thisZoneITEq.EndUseSubcategoryFan = "ITE-Fans";
    2884              :                         }
    2885           14 :                         if (thisZoneITEq.ZonePtr <= 0) {
    2886            0 :                             continue; // Error, will be caught and terminated later
    2887              :                         }
    2888              : 
    2889           14 :                         if (IHGNumAlphas > 18) {
    2890           14 :                             thisZoneITEq.EndUseSubcategoryUPS = IHGAlphas(19);
    2891              :                         } else {
    2892            0 :                             thisZoneITEq.EndUseSubcategoryUPS = "ITE-UPS";
    2893              :                         }
    2894           14 :                         if (thisZoneITEq.FlowControlWithApproachTemps) {
    2895            3 :                             if (IHGAlphaFieldBlanks(20)) {
    2896            3 :                                 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            3 :                             if (IHGAlphaFieldBlanks(21)) {
    2912            3 :                                 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           14 :                         if (thisZoneITEq.FlowControlWithApproachTemps) {
    2929            3 :                             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            3 :                             SetPointManager::GetSetPointManagerInputs(state);
    2933            3 :                             for (auto *spm : state.dataSetPointManager->spms) {
    2934            0 :                                 if (spm->type != SetPointManager::SPMType::SZCooling) {
    2935            0 :                                     continue;
    2936              :                                 }
    2937            0 :                                 auto const *spmSZC = dynamic_cast<SetPointManager::SPMSingleZoneTemp *>(spm);
    2938            0 :                                 assert(spmSZC != nullptr);
    2939            0 :                                 if (spmSZC->ctrlZoneNum == zoneNum) {
    2940            0 :                                     TAirInSizing = spmSZC->maxSetTemp;
    2941              :                                 }
    2942              :                             }
    2943              : 
    2944            3 :                             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           14 :                         if (!ErrorsFound) {
    2954           12 :                             SetupSpaceInternalGain(state,
    2955              :                                                    thisZoneITEq.spaceIndex,
    2956              :                                                    1.0,
    2957              :                                                    thisZoneITEq.Name,
    2958              :                                                    DataHeatBalance::IntGainType::ElectricEquipmentITEAirCooled,
    2959           12 :                                                    &thisZoneITEq.PowerRpt[(int)PERptVars::ConGainToZone]);
    2960              :                         }
    2961              :                     }
    2962              :                 } // for itEqInputNum.NumOfSpaces
    2963              :             } // for itEqInputNum
    2964           28 :             for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    2965           17 :                 if (state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(Loop).ZonePtr).HasAdjustedReturnTempByITE &&
    2966            3 :                     (!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          342 :         EPVector<InternalHeatGains::GlobalInternalGainMiscObject> zoneBBHeatObjects;
    2982          171 :         int numZoneBBHeatStatements = 0;
    2983          171 :         setupIHGZonesAndSpaces(state, bbModuleObject, zoneBBHeatObjects, numZoneBBHeatStatements, state.dataHeatBal->TotBBHeat, ErrorsFound);
    2984              : 
    2985          171 :         if (state.dataHeatBal->TotBBHeat > 0) {
    2986            1 :             state.dataHeatBal->ZoneBBHeat.allocate(state.dataHeatBal->TotBBHeat);
    2987            1 :             int bbHeatNum = 0;
    2988            2 :             for (int bbHeatInputNum = 1; bbHeatInputNum <= numZoneBBHeatStatements; ++bbHeatInputNum) {
    2989            1 :                 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            1 :                 ErrorObjectHeader eoh{routineName, bbModuleObject, IHGAlphas(1)};
    3003              : 
    3004            1 :                 auto &thisBBHeatInput = zoneBBHeatObjects(bbHeatInputNum);
    3005            3 :                 for (int Item1 = 1; Item1 <= thisBBHeatInput.numOfSpaces; ++Item1) {
    3006            2 :                     ++bbHeatNum;
    3007            2 :                     auto &thisZoneBBHeat = state.dataHeatBal->ZoneBBHeat(bbHeatNum);
    3008            2 :                     int const spaceNum = thisBBHeatInput.spaceNums(Item1);
    3009            2 :                     int const zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    3010            2 :                     thisZoneBBHeat.Name = thisBBHeatInput.names(Item1);
    3011            2 :                     thisZoneBBHeat.spaceIndex = spaceNum;
    3012            2 :                     thisZoneBBHeat.ZonePtr = zoneNum;
    3013              : 
    3014            2 :                     if (IHGAlphaFieldBlanks(3)) {
    3015            0 :                         ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    3016            0 :                         ErrorsFound = true;
    3017            2 :                     } else if ((thisZoneBBHeat.sched = Sched::GetSchedule(state, IHGAlphas(3))) == nullptr) {
    3018            0 :                         ShowSevereItemNotFound(state, eoh, IHGAlphaFieldNames(3), IHGAlphas(3));
    3019            0 :                         ErrorsFound = true;
    3020            2 :                     } 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            2 :                     if (IHGNumAlphas > 3) {
    3026            2 :                         thisZoneBBHeat.EndUseSubcategory = IHGAlphas(4);
    3027              :                     } else {
    3028            0 :                         thisZoneBBHeat.EndUseSubcategory = "General";
    3029              :                     }
    3030              : 
    3031            2 :                     Real64 spaceFrac = 1.0;
    3032            2 :                     if (thisBBHeatInput.numOfSpaces > 1) {
    3033            2 :                         Real64 const zoneArea = state.dataHeatBal->Zone(zoneNum).FloorArea;
    3034            2 :                         if (zoneArea > 0.0) {
    3035            2 :                             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            2 :                     thisZoneBBHeat.CapatLowTemperature = IHGNumbers(1) * spaceFrac;
    3049            2 :                     thisZoneBBHeat.LowTemperature = IHGNumbers(2);
    3050            2 :                     thisZoneBBHeat.CapatHighTemperature = IHGNumbers(3) * spaceFrac;
    3051            2 :                     thisZoneBBHeat.HighTemperature = IHGNumbers(4);
    3052            2 :                     thisZoneBBHeat.FractionRadiant = IHGNumbers(5);
    3053            2 :                     thisZoneBBHeat.FractionConvected = 1.0 - thisZoneBBHeat.FractionRadiant;
    3054            2 :                     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            2 :                     if (thisZoneBBHeat.ZonePtr <= 0) {
    3060            0 :                         continue; // Error, will be caught and terminated later
    3061              :                     }
    3062              : 
    3063            2 :                     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            2 :                     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          171 :         state.dataHeatBal->TotCO2Gen = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, contamSSModuleObject);
    3096          171 :         state.dataHeatBal->ZoneCO2Gen.allocate(state.dataHeatBal->TotCO2Gen);
    3097              : 
    3098          172 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotCO2Gen; ++Loop) {
    3099            1 :             IHGAlphas = "";
    3100            1 :             IHGNumbers = 0.0;
    3101            1 :             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            1 :             ErrorObjectHeader eoh{routineName, contamSSModuleObject, IHGAlphas(1)};
    3115            1 :             Util::IsNameEmpty(state, IHGAlphas(1), contamSSModuleObject, ErrorsFound);
    3116              : 
    3117            1 :             state.dataHeatBal->ZoneCO2Gen(Loop).Name = IHGAlphas(1);
    3118              : 
    3119            1 :             state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr = Util::FindItemInList(IHGAlphas(2), state.dataHeatBal->Zone);
    3120            1 :             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            1 :             if (IHGAlphaFieldBlanks(3)) {
    3129            0 :                 ShowSevereEmptyField(state, eoh, IHGAlphaFieldNames(3));
    3130            0 :                 ErrorsFound = true;
    3131            1 :             } 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            1 :             } 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            1 :             state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate = IHGNumbers(1);
    3140              : 
    3141            1 :             if (state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr <= 0) {
    3142            0 :                 continue; // Error, will be caught and terminated later
    3143              :             }
    3144              : 
    3145              :             // Object report variables
    3146            2 :             SetupOutputVariable(state,
    3147              :                                 "Contaminant Source or Sink CO2 Gain Volume Flow Rate",
    3148              :                                 Constant::Units::m3_s,
    3149            1 :                                 state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate,
    3150              :                                 OutputProcessor::TimeStepType::Zone,
    3151              :                                 OutputProcessor::StoreType::Average,
    3152            1 :                                 state.dataHeatBal->ZoneCO2Gen(Loop).Name);
    3153              : 
    3154              :             // Zone total report variables
    3155            1 :             if (RepVarSet(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr)) {
    3156            1 :                 RepVarSet(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr) = false;
    3157              : 
    3158            2 :                 SetupOutputVariable(state,
    3159              :                                     "Zone Contaminant Source or Sink CO2 Gain Volume Flow Rate",
    3160              :                                     Constant::Units::m3_s,
    3161            1 :                                     state.dataHeatBal->ZoneRpt(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr).CO2Rate,
    3162              :                                     OutputProcessor::TimeStepType::Zone,
    3163              :                                     OutputProcessor::StoreType::Average,
    3164            1 :                                     state.dataHeatBal->Zone(state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr).Name);
    3165              :             }
    3166              : 
    3167            3 :             SetupZoneInternalGain(state,
    3168            1 :                                   state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr,
    3169            1 :                                   state.dataHeatBal->ZoneCO2Gen(Loop).Name,
    3170              :                                   DataHeatBalance::IntGainType::ZoneContaminantSourceAndSinkCarbonDioxide,
    3171              :                                   nullptr,
    3172              :                                   nullptr,
    3173              :                                   nullptr,
    3174              :                                   nullptr,
    3175              :                                   nullptr,
    3176            1 :                                   &state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate);
    3177              :         }
    3178              : 
    3179          171 :         RepVarSet.deallocate();
    3180              : 
    3181          171 :         if (ErrorsFound) {
    3182            8 :             ShowFatalError(state, format("{}Errors found in Getting Internal Gains Input, Program Stopped", RoutineName));
    3183              :         }
    3184          167 :         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          167 :         print(state.files.eio, Format_721);
    3193              : 
    3194          373 :         for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) {
    3195          206 :             auto &zone = state.dataHeatBal->Zone(Loop);
    3196              : 
    3197          206 :             Real64 LightTot = 0.0;
    3198          206 :             Real64 ElecTot = 0.0;
    3199          206 :             Real64 GasTot = 0.0;
    3200          206 :             Real64 OthTot = 0.0;
    3201          206 :             Real64 HWETot = 0.0;
    3202          206 :             Real64 StmTot = 0.0;
    3203          206 :             std::string BBHeatInd = "No"; // Yes if BBHeat in zone, no if not.
    3204              : 
    3205          425 :             for (auto const &lights : state.dataHeatBal->Lights) {
    3206          219 :                 if (lights.ZonePtr == Loop) {
    3207           74 :                     LightTot += lights.DesignLevel;
    3208              :                 }
    3209          206 :             }
    3210          452 :             for (auto const &elecEq : state.dataHeatBal->ZoneElectric) {
    3211          246 :                 if (elecEq.ZonePtr == Loop) {
    3212           97 :                     ElecTot += elecEq.DesignLevel;
    3213              :                 }
    3214          206 :             }
    3215          218 :             for (auto const &itEq : state.dataHeatBal->ZoneITEq) {
    3216           12 :                 if (itEq.ZonePtr == Loop) {
    3217           12 :                     ElecTot += itEq.DesignTotalPower; // Should this not be itTot?
    3218              :                 }
    3219          206 :             }
    3220          208 :             for (auto const &gasEq : state.dataHeatBal->ZoneGas) {
    3221            2 :                 if (gasEq.ZonePtr == Loop) {
    3222            2 :                     GasTot += gasEq.DesignLevel;
    3223              :                 }
    3224          206 :             }
    3225          258 :             for (auto const &otherEq : state.dataHeatBal->ZoneOtherEq) {
    3226           52 :                 if (otherEq.ZonePtr == Loop) {
    3227           52 :                     OthTot += otherEq.DesignLevel;
    3228              :                 }
    3229          206 :             }
    3230          208 :             for (auto const &steamEq : state.dataHeatBal->ZoneSteamEq) {
    3231            2 :                 if (steamEq.ZonePtr == Loop) {
    3232            2 :                     StmTot += steamEq.DesignLevel;
    3233              :                 }
    3234          206 :             }
    3235          208 :             for (auto const &hotWaterEq : state.dataHeatBal->ZoneHWEq) {
    3236            2 :                 if (hotWaterEq.ZonePtr == Loop) {
    3237            2 :                     HWETot += hotWaterEq.DesignLevel;
    3238              :                 }
    3239          206 :             }
    3240          208 :             for (auto const &bbHeat : state.dataHeatBal->ZoneBBHeat) {
    3241            2 :                 if (bbHeat.ZonePtr == Loop) {
    3242            2 :                     BBHeatInd = "Yes";
    3243              :                 }
    3244          206 :             }
    3245              : 
    3246          206 :             zone.InternalHeatGains = LightTot + ElecTot + GasTot + OthTot + HWETot + StmTot;
    3247          206 :             if (zone.FloorArea > 0.0) {
    3248          169 :                 print(state.files.eio, Format_720, zone.Name, zone.FloorArea, zone.TotOccupants);
    3249          169 :                 print_and_divide_if_greater_than_zero(zone.FloorArea, zone.TotOccupants);
    3250          169 :                 print(state.files.eio, "{:.3R},", zone.TotOccupants / zone.FloorArea);
    3251          169 :                 print(state.files.eio, "{:.3R},", LightTot / zone.FloorArea);
    3252          169 :                 print(state.files.eio, "{:.3R},", ElecTot / zone.FloorArea);
    3253          169 :                 print(state.files.eio, "{:.3R},", GasTot / zone.FloorArea);
    3254          169 :                 print(state.files.eio, "{:.3R},", OthTot / zone.FloorArea);
    3255          169 :                 print(state.files.eio, "{:.3R},", HWETot / zone.FloorArea);
    3256          169 :                 print(state.files.eio, "{:.3R},", StmTot / zone.FloorArea);
    3257          169 :                 print(state.files.eio, "{:.3R},{}\n", zone.InternalHeatGains / zone.FloorArea, BBHeatInd);
    3258              :             } else {
    3259           37 :                 print(state.files.eio, Format_720, zone.Name, zone.FloorArea, zone.TotOccupants);
    3260           37 :                 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          206 :         }
    3263              : 
    3264          243 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) {
    3265           76 :             auto &people = state.dataHeatBal->People(Loop);
    3266              : 
    3267           76 :             if (Loop == 1) {
    3268           43 :                 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           43 :                 if (people.Fanger || people.Pierce || people.KSU || people.CoolingEffectASH55 || people.AnkleDraftASH55) {
    3279           13 :                     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           30 :                     print(state.files.eio, "\n");
    3285              :                 }
    3286              :             }
    3287              : 
    3288           76 :             if (people.ZonePtr == 0) {
    3289            0 :                 print(state.files.eio, Format_724, "People-Illegal Zone specified", people.Name);
    3290            0 :                 continue;
    3291              :             }
    3292              : 
    3293           76 :             auto const &zone = state.dataHeatBal->Zone(people.ZonePtr);
    3294              : 
    3295           76 :             print(state.files.eio, Format_722, "People", people.Name, people.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3296           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople);
    3297              : 
    3298           76 :             print_and_divide_if_greater_than_zero(people.NumberOfPeople, zone.FloorArea);
    3299              : 
    3300           76 :             if (people.NumberOfPeople > 0.0) {
    3301           76 :                 print_and_divide_if_greater_than_zero(zone.FloorArea, people.NumberOfPeople);
    3302              :             } else {
    3303            0 :                 print(state.files.eio, "N/A,");
    3304              :             }
    3305              : 
    3306           76 :             print(state.files.eio, "{:.3R},", people.FractionRadiant);
    3307           76 :             print(state.files.eio, "{:.3R},", people.FractionConvected);
    3308           76 :             if (people.UserSpecSensFrac == Constant::AutoCalculate) {
    3309           71 :                 print(state.files.eio, "AutoCalculate,");
    3310              :             } else {
    3311            5 :                 print(state.files.eio, "{:.3R},", people.UserSpecSensFrac);
    3312              :             }
    3313           76 :             print(state.files.eio, "{},", people.activityLevelSched->Name);
    3314              : 
    3315           76 :             print(state.files.eio, "{},", yesNoNames[(int)people.Show55Warning]);
    3316           76 :             print(state.files.eio, "{:.4R},", people.CO2RateFactor);
    3317           76 :             print(state.files.eio, "{:.1R},", people.NomMinNumberPeople);
    3318           76 :             print(state.files.eio, "{:.1R},", people.NomMaxNumberPeople);
    3319              : 
    3320              :             Real64 SchMin, SchMax;
    3321              : 
    3322              :             // weekdays
    3323           76 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3324           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3325           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3326              : 
    3327              :             // weekends/holidays
    3328           76 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3329           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3330           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3331              : 
    3332              :             // summer design days
    3333           76 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3334           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3335           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3336              : 
    3337              :             // winter design days
    3338           76 :             std::tie(SchMin, SchMax) = people.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3339           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMin);
    3340           76 :             print(state.files.eio, "{:.1R},", people.NumberOfPeople * SchMax);
    3341              : 
    3342           76 :             if (people.Fanger || people.Pierce || people.KSU || people.CoolingEffectASH55 || people.AnkleDraftASH55) {
    3343              : 
    3344           15 :                 if (people.MRTCalcType == DataHeatBalance::CalcMRT::EnclosureAveraged) {
    3345           15 :                     print(state.files.eio, "Zone Averaged,");
    3346            0 :                 } else if (people.MRTCalcType == DataHeatBalance::CalcMRT::SurfaceWeighted) {
    3347            0 :                     print(state.files.eio, "Surface Weighted,");
    3348            0 :                 } else if (people.MRTCalcType == DataHeatBalance::CalcMRT::AngleFactor) {
    3349            0 :                     print(state.files.eio, "Angle Factor,");
    3350              :                 } else {
    3351            0 :                     print(state.files.eio, "N/A,");
    3352              :                 }
    3353           15 :                 print(state.files.eio, "{},", people.workEffSched ? people.workEffSched->Name : "");
    3354              : 
    3355           15 :                 print(state.files.eio, clothingTypeEIOStrings[(int)people.clothingType]);
    3356              : 
    3357           15 :                 if (people.clothingType == ClothingType::CalculationSchedule) {
    3358            0 :                     print(state.files.eio, "{},", people.clothingMethodSched->Name);
    3359              :                 } else {
    3360           15 :                     print(state.files.eio, "N/A,");
    3361              :                 }
    3362              : 
    3363           15 :                 print(state.files.eio, "{},", people.clothingSched ? people.clothingSched->Name : "");
    3364           15 :                 print(state.files.eio, "{},", people.airVelocitySched ? people.airVelocitySched->Name : "");
    3365              : 
    3366           15 :                 print(state.files.eio, "{},", yesNoNames[(int)people.Fanger]);
    3367           15 :                 print(state.files.eio, "{},", yesNoNames[(int)people.Pierce]);
    3368           15 :                 print(state.files.eio, "{},", yesNoNames[(int)people.KSU]);
    3369           15 :                 print(state.files.eio, "{},", yesNoNames[(int)people.CoolingEffectASH55]);
    3370           15 :                 print(state.files.eio, "{}", yesNoNames[(int)people.AnkleDraftASH55]);
    3371              :             }
    3372           76 :             print(state.files.eio, "\n");
    3373              :         }
    3374              : 
    3375          241 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    3376           74 :             auto &lights = state.dataHeatBal->Lights(Loop);
    3377              : 
    3378           74 :             if (Loop == 1) {
    3379           41 :                 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           74 :             if (lights.ZonePtr == 0) {
    3392            0 :                 print(state.files.eio, "Lights-Illegal Zone specified", lights.Name);
    3393            0 :                 continue;
    3394              :             }
    3395              : 
    3396           74 :             auto const &zone = state.dataHeatBal->Zone(lights.ZonePtr);
    3397              : 
    3398           74 :             print(state.files.eio, Format_722, "Lights", lights.Name, lights.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3399              : 
    3400           74 :             print(state.files.eio, "{:.3R},", lights.DesignLevel);
    3401              : 
    3402           74 :             print_and_divide_if_greater_than_zero(lights.DesignLevel, zone.FloorArea);
    3403           74 :             print_and_divide_if_greater_than_zero(lights.DesignLevel, zone.TotOccupants);
    3404              : 
    3405           74 :             print(state.files.eio, "{:.3R},", lights.FractionReturnAir);
    3406           74 :             print(state.files.eio, "{:.3R},", lights.FractionRadiant);
    3407           74 :             print(state.files.eio, "{:.3R},", lights.FractionShortWave);
    3408           74 :             print(state.files.eio, "{:.3R},", lights.FractionConvected);
    3409           74 :             print(state.files.eio, "{:.3R},", lights.FractionReplaceable);
    3410           74 :             print(state.files.eio, "{},", lights.EndUseSubcategory);
    3411           74 :             print(state.files.eio, "{:.3R},", lights.NomMinDesignLevel);
    3412           74 :             print(state.files.eio, "{:.3R},", lights.NomMaxDesignLevel);
    3413              : 
    3414           74 :             auto &light = state.dataHeatBal->Lights(Loop);
    3415              : 
    3416              :             Real64 SchMin, SchMax;
    3417              :             // weekdays
    3418           74 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3419           74 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3420           74 :             print(state.files.eio, "{:.1R},", light.DesignLevel * SchMax);
    3421              : 
    3422              :             // weekends/holidays
    3423           74 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3424           74 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3425           74 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMax);
    3426              : 
    3427              :             // summer design days
    3428           74 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3429           74 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3430           74 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMax);
    3431              : 
    3432              :             // winter design days
    3433           74 :             std::tie(SchMin, SchMax) = light.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3434           74 :             print(state.files.eio, "{:.3R},", light.DesignLevel * SchMin);
    3435           74 :             print(state.files.eio, "{:.3R}\n", light.DesignLevel * SchMax);
    3436              :         }
    3437              : 
    3438          264 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) {
    3439           97 :             auto &elecEq = state.dataHeatBal->ZoneElectric(Loop);
    3440              : 
    3441           97 :             if (Loop == 1) {
    3442           43 :                 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           97 :             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           97 :             auto &zone = state.dataHeatBal->Zone(elecEq.ZonePtr);
    3460              : 
    3461           97 :             print(state.files.eio, Format_722, "ElectricEquipment", elecEq.Name, elecEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3462           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel);
    3463              : 
    3464           97 :             print_and_divide_if_greater_than_zero(elecEq.DesignLevel, zone.FloorArea);
    3465           97 :             print_and_divide_if_greater_than_zero(elecEq.DesignLevel, zone.TotOccupants);
    3466              : 
    3467           97 :             print(state.files.eio, "{:.3R},", elecEq.FractionLatent);
    3468           97 :             print(state.files.eio, "{:.3R},", elecEq.FractionRadiant);
    3469           97 :             print(state.files.eio, "{:.3R},", elecEq.FractionLost);
    3470           97 :             print(state.files.eio, "{:.3R},", elecEq.FractionConvected);
    3471           97 :             print(state.files.eio, "{},", elecEq.EndUseSubcategory);
    3472           97 :             print(state.files.eio, "{:.3R},", elecEq.NomMinDesignLevel);
    3473           97 :             print(state.files.eio, "{:.3R},", elecEq.NomMaxDesignLevel);
    3474              : 
    3475              :             Real64 SchMin, SchMax;
    3476              : 
    3477              :             // weekdays
    3478           97 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3479           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3480           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax);
    3481              : 
    3482              :             // weekends/holidays
    3483           97 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3484           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3485           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax);
    3486              : 
    3487              :             // summer design days
    3488           97 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3489           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3490           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMax);
    3491              : 
    3492              :             // winter design days
    3493           97 :             std::tie(SchMin, SchMax) = elecEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3494           97 :             print(state.files.eio, "{:.3R},", elecEq.DesignLevel * SchMin);
    3495           97 :             print(state.files.eio, "{:.3R}\n", elecEq.DesignLevel * SchMax);
    3496              :         }
    3497              : 
    3498          169 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) {
    3499            2 :             auto &gasEq = state.dataHeatBal->ZoneGas(Loop);
    3500              : 
    3501            2 :             if (Loop == 1) {
    3502            1 :                 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            2 :             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            2 :             auto &zone = state.dataHeatBal->Zone(gasEq.ZonePtr);
    3520              : 
    3521            2 :             print(state.files.eio, Format_722, "GasEquipment", gasEq.Name, gasEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3522            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel);
    3523              : 
    3524            2 :             print_and_divide_if_greater_than_zero(gasEq.DesignLevel, zone.FloorArea);
    3525            2 :             print_and_divide_if_greater_than_zero(gasEq.DesignLevel, zone.TotOccupants);
    3526              : 
    3527            2 :             print(state.files.eio, "{:.3R},", gasEq.FractionLatent);
    3528            2 :             print(state.files.eio, "{:.3R},", gasEq.FractionRadiant);
    3529            2 :             print(state.files.eio, "{:.3R},", gasEq.FractionLost);
    3530            2 :             print(state.files.eio, "{:.3R},", gasEq.FractionConvected);
    3531            2 :             print(state.files.eio, "{},", gasEq.EndUseSubcategory);
    3532            2 :             print(state.files.eio, "{:.3R},", gasEq.NomMinDesignLevel);
    3533            2 :             print(state.files.eio, "{:.3R},", gasEq.NomMaxDesignLevel);
    3534              : 
    3535              :             Real64 SchMin, SchMax;
    3536              :             // weekdays
    3537            2 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3538            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3539            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax);
    3540              : 
    3541              :             // weekends/holidays
    3542            2 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3543            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3544            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax);
    3545              : 
    3546              :             // summer design days
    3547            2 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3548            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3549            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMax);
    3550              : 
    3551              :             // winter design days
    3552            2 :             std::tie(SchMin, SchMax) = gasEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3553            2 :             print(state.files.eio, "{:.3R},", gasEq.DesignLevel * SchMin);
    3554            2 :             print(state.files.eio, "{:.3R}\n", gasEq.DesignLevel * SchMax);
    3555              :         }
    3556              : 
    3557          169 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) {
    3558            2 :             auto &hotWaterEq = state.dataHeatBal->ZoneHWEq(Loop);
    3559              : 
    3560            2 :             if (Loop == 1) {
    3561            1 :                 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            2 :             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            2 :             auto const &zone = state.dataHeatBal->Zone(hotWaterEq.ZonePtr);
    3579              : 
    3580            2 :             print(state.files.eio,
    3581              :                   Format_722,
    3582              :                   "HotWaterEquipment",
    3583            2 :                   hotWaterEq.Name,
    3584            2 :                   hotWaterEq.sched->Name,
    3585            2 :                   zone.Name,
    3586            2 :                   zone.FloorArea,
    3587            2 :                   zone.TotOccupants);
    3588              : 
    3589            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel);
    3590              : 
    3591            2 :             print_and_divide_if_greater_than_zero(hotWaterEq.DesignLevel, zone.FloorArea);
    3592            2 :             print_and_divide_if_greater_than_zero(hotWaterEq.DesignLevel, zone.TotOccupants);
    3593              : 
    3594            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionLatent);
    3595            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionRadiant);
    3596            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionLost);
    3597            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.FractionConvected);
    3598            2 :             print(state.files.eio, "{},", hotWaterEq.EndUseSubcategory);
    3599            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.NomMinDesignLevel);
    3600            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.NomMaxDesignLevel);
    3601              : 
    3602              :             Real64 SchMin, SchMax;
    3603              :             // weekdays
    3604            2 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3605            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3606            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax);
    3607              : 
    3608              :             // weekends/holidays
    3609            2 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3610            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3611            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax);
    3612              : 
    3613              :             // summer design days
    3614            2 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3615            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3616            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMax);
    3617              : 
    3618              :             // winter design days
    3619            2 :             std::tie(SchMin, SchMax) = hotWaterEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3620            2 :             print(state.files.eio, "{:.3R},", hotWaterEq.DesignLevel * SchMin);
    3621            2 :             print(state.files.eio, "{:.3R}\n", hotWaterEq.DesignLevel * SchMax);
    3622              :         }
    3623              : 
    3624          169 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) {
    3625            2 :             auto &steamEq = state.dataHeatBal->ZoneSteamEq(Loop);
    3626              : 
    3627            2 :             if (Loop == 1) {
    3628            1 :                 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            2 :             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            2 :             auto &zone = state.dataHeatBal->Zone(steamEq.ZonePtr);
    3646              : 
    3647            2 :             print(state.files.eio, Format_722, "SteamEquipment", steamEq.Name, steamEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3648            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel);
    3649              : 
    3650            2 :             print_and_divide_if_greater_than_zero(steamEq.DesignLevel, zone.FloorArea);
    3651            2 :             print_and_divide_if_greater_than_zero(steamEq.DesignLevel, zone.TotOccupants);
    3652              : 
    3653            2 :             print(state.files.eio, "{:.3R},", steamEq.FractionLatent);
    3654            2 :             print(state.files.eio, "{:.3R},", steamEq.FractionRadiant);
    3655            2 :             print(state.files.eio, "{:.3R},", steamEq.FractionLost);
    3656            2 :             print(state.files.eio, "{:.3R},", steamEq.FractionConvected);
    3657            2 :             print(state.files.eio, "{},", steamEq.EndUseSubcategory);
    3658            2 :             print(state.files.eio, "{:.3R},", steamEq.NomMinDesignLevel);
    3659            2 :             print(state.files.eio, "{:.3R},", steamEq.NomMaxDesignLevel);
    3660              : 
    3661              :             Real64 SchMin, SchMax;
    3662              :             // weekdays
    3663            2 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3664            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3665            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax);
    3666              : 
    3667              :             // weekends/holidays
    3668            2 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3669            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3670            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax);
    3671              : 
    3672              :             // summer design days
    3673            2 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3674            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3675            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMax);
    3676              : 
    3677              :             // winter design days
    3678            2 :             std::tie(SchMin, SchMax) = steamEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3679            2 :             print(state.files.eio, "{:.3R},", steamEq.DesignLevel * SchMin);
    3680            2 :             print(state.files.eio, "{:.3R}\n", steamEq.DesignLevel * SchMax);
    3681              :         }
    3682              : 
    3683          219 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) {
    3684           52 :             if (Loop == 1) {
    3685           25 :                 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           52 :             auto &otherEq = state.dataHeatBal->ZoneOtherEq(Loop);
    3698              : 
    3699           52 :             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           52 :             auto const &zone = state.dataHeatBal->Zone(otherEq.ZonePtr);
    3705              : 
    3706           52 :             print(state.files.eio, Format_722, "OtherEquipment", otherEq.Name, otherEq.sched->Name, zone.Name, zone.FloorArea, zone.TotOccupants);
    3707           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel);
    3708              : 
    3709           52 :             print_and_divide_if_greater_than_zero(otherEq.DesignLevel, zone.FloorArea);
    3710           52 :             print_and_divide_if_greater_than_zero(otherEq.DesignLevel, zone.TotOccupants);
    3711              : 
    3712           52 :             print(state.files.eio, "{:.3R},", otherEq.FractionLatent);
    3713           52 :             print(state.files.eio, "{:.3R},", otherEq.FractionRadiant);
    3714           52 :             print(state.files.eio, "{:.3R},", otherEq.FractionLost);
    3715           52 :             print(state.files.eio, "{:.3R},", otherEq.FractionConvected);
    3716           52 :             print(state.files.eio, "{:.3R},", otherEq.NomMinDesignLevel);
    3717           52 :             print(state.files.eio, "{:.3R},", otherEq.NomMaxDesignLevel);
    3718              : 
    3719              :             Real64 SchMin, SchMax;
    3720              : 
    3721              :             // weekdays
    3722           52 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3723           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3724           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax);
    3725              : 
    3726              :             // weekends/holidays
    3727           52 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3728           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3729           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax);
    3730              : 
    3731              :             // summer design days
    3732           52 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3733           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3734           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMax);
    3735              : 
    3736              :             // winter design days
    3737           52 :             std::tie(SchMin, SchMax) = otherEq.sched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3738           52 :             print(state.files.eio, "{:.3R},", otherEq.DesignLevel * SchMin);
    3739           52 :             print(state.files.eio, "{:.3R}\n", otherEq.DesignLevel * SchMax);
    3740              :         }
    3741              : 
    3742          179 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    3743           12 :             auto &itEq = state.dataHeatBal->ZoneITEq(Loop);
    3744              : 
    3745           12 :             if (Loop == 1) {
    3746           12 :                 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           12 :             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           12 :             auto const &zone = state.dataHeatBal->Zone(itEq.ZonePtr);
    3766           12 :             print(state.files.eio,
    3767              :                   Format_722,
    3768              :                   "ElectricEquipment:ITE:AirCooled",
    3769           12 :                   itEq.Name,
    3770           12 :                   itEq.operSched->Name,
    3771           12 :                   zone.Name,
    3772           12 :                   zone.FloorArea,
    3773           12 :                   zone.TotOccupants);
    3774              : 
    3775           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower);
    3776              : 
    3777           12 :             print_and_divide_if_greater_than_zero(itEq.DesignTotalPower, zone.FloorArea);
    3778           12 :             print_and_divide_if_greater_than_zero(itEq.DesignTotalPower, zone.TotOccupants);
    3779              : 
    3780              :             // ElectricEquipment:ITE:AirCooled is 100% convective
    3781           12 :             print(state.files.eio, "1.0,");
    3782              : 
    3783           12 :             print(state.files.eio, "{},", itEq.EndUseSubcategoryCPU);
    3784           12 :             print(state.files.eio, "{},", itEq.EndUseSubcategoryFan);
    3785           12 :             print(state.files.eio, "{},", itEq.EndUseSubcategoryUPS);
    3786           12 :             print(state.files.eio, "{:.3R},", itEq.NomMinDesignLevel);
    3787           12 :             print(state.files.eio, "{:.3R},", itEq.NomMaxDesignLevel);
    3788              : 
    3789              :             Real64 SchMin, SchMax;
    3790              :             // weekdays
    3791           12 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::Weekday);
    3792           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3793           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3794              : 
    3795              :             // weekends/holidays
    3796           12 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WeekEndHoliday);
    3797           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3798           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3799              : 
    3800              :             // summer design days
    3801           12 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::SummerDesignDay);
    3802           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3803           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3804              : 
    3805              :             // winter design days
    3806           12 :             std::tie(SchMin, SchMax) = itEq.operSched->getMinMaxValsByDayType(state, Sched::DayTypeGroup::WinterDesignDay);
    3807           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMin);
    3808           12 :             print(state.files.eio, "{:.3R},", itEq.DesignTotalPower * SchMax);
    3809              : 
    3810           12 :             print(state.files.eio, "{:.10R}\n", itEq.DesignAirVolFlowRate);
    3811              :         }
    3812              : 
    3813          169 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) {
    3814            2 :             auto &bbHeat = state.dataHeatBal->ZoneBBHeat(Loop);
    3815            2 :             if (Loop == 1) {
    3816            1 :                 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            2 :             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            2 :             auto const &zone = state.dataHeatBal->Zone(bbHeat.ZonePtr);
    3829              : 
    3830            2 :             print(state.files.eio,
    3831              :                   Format_722,
    3832              :                   "Outdoor Controlled Baseboard Heat",
    3833            2 :                   bbHeat.Name,
    3834            2 :                   bbHeat.sched->Name,
    3835            2 :                   zone.Name,
    3836            2 :                   zone.FloorArea,
    3837            2 :                   zone.TotOccupants);
    3838              : 
    3839            2 :             print(state.files.eio, "{:.3R},", bbHeat.CapatLowTemperature);
    3840            2 :             print(state.files.eio, "{:.3R},", bbHeat.LowTemperature);
    3841            2 :             print(state.files.eio, "{:.3R},", bbHeat.CapatHighTemperature);
    3842            2 :             print(state.files.eio, "{:.3R},", bbHeat.HighTemperature);
    3843            2 :             print(state.files.eio, "{:.3R},", bbHeat.FractionRadiant);
    3844            2 :             print(state.files.eio, "{:.3R},", bbHeat.FractionConvected);
    3845            2 :             print(state.files.eio, "{}\n", bbHeat.EndUseSubcategory);
    3846              :         }
    3847          239 :     }
    3848              : 
    3849         2379 :     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         2379 :         constexpr std::string_view routineName = "setupIHGZonesAndSpaces: ";
    3862              : 
    3863         2379 :         auto &ip = state.dataInputProcessing->inputProcessor;
    3864         2379 :         auto const instances = ip->epJSON.find(objectType);
    3865         2379 :         if (instances != ip->epJSON.end()) {
    3866         2379 :             bool localErrFlag = false;
    3867         2379 :             auto const &objectSchemaProps = ip->getObjectSchemaProps(state, objectType);
    3868         2379 :             auto &instancesValue = instances.value();
    3869         2379 :             numInputObjects = int(instancesValue.size());
    3870         2379 :             inputObjects.allocate(numInputObjects);
    3871              : 
    3872         2379 :             numGainInstances = 0;
    3873         2379 :             int counter = 0;
    3874         2767 :             for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
    3875          388 :                 auto const &objectFields = instance.value();
    3876          388 :                 std::string const &thisObjectName = Util::makeUPPER(instance.key());
    3877          388 :                 ip->markObjectAsUsed(objectType, instance.key());
    3878              : 
    3879              :                 // For incoming idf, maintain object order
    3880          388 :                 ++counter;
    3881          388 :                 int objNum = ip->getIDFObjNum(state, objectType, counter);
    3882          388 :                 inputObjects(objNum).Name = thisObjectName;
    3883          388 :                 std::string areaFieldName;
    3884          388 :                 if (zoneListNotAllowed) {
    3885           38 :                     areaFieldName = "zone_or_space_name";
    3886              :                 } else {
    3887          350 :                     areaFieldName = "zone_or_zonelist_or_space_or_spacelist_name";
    3888              :                 }
    3889          388 :                 std::string areaName = ip->getAlphaFieldValue(objectFields, objectSchemaProps, areaFieldName);
    3890              : 
    3891          388 :                 int zoneNum = Util::FindItemInList(areaName, state.dataHeatBal->Zone);
    3892          388 :                 if (zoneNum > 0) {
    3893          344 :                     inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3894          344 :                     int numSpaces = state.dataHeatBal->Zone(zoneNum).numSpaces;
    3895          344 :                     numGainInstances += numSpaces;
    3896          344 :                     inputObjects(objNum).numOfSpaces = numSpaces;
    3897          344 :                     inputObjects(objNum).ZoneListActive = false;
    3898          344 :                     if (numSpaces == 1) {
    3899          331 :                         inputObjects(objNum).spaceNums.emplace_back(state.dataHeatBal->Zone(zoneNum).spaceIndexes(1));
    3900          331 :                         inputObjects(objNum).names.emplace_back(inputObjects(objNum).Name);
    3901              :                     } else {
    3902           39 :                         for (int const spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    3903           26 :                             inputObjects(objNum).spaceNums.emplace_back(spaceNum);
    3904           26 :                             inputObjects(objNum).names.emplace_back(state.dataHeatBal->space(spaceNum).Name + ' ' + inputObjects(objNum).Name);
    3905           13 :                         }
    3906              :                     }
    3907          344 :                     continue;
    3908          344 :                 }
    3909           44 :                 int spaceNum = Util::FindItemInList(areaName, state.dataHeatBal->space);
    3910           44 :                 if (spaceNum > 0) {
    3911           36 :                     inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3912           36 :                     ++numGainInstances;
    3913           36 :                     inputObjects(objNum).numOfSpaces = 1;
    3914           36 :                     inputObjects(objNum).spaceListActive = false;
    3915           36 :                     inputObjects(objNum).spaceOrSpaceListPtr = spaceNum;
    3916           36 :                     inputObjects(objNum).spaceNums.emplace_back(spaceNum);
    3917           36 :                     inputObjects(objNum).names.emplace_back(inputObjects(objNum).Name);
    3918           36 :                     continue;
    3919              :                 }
    3920            8 :                 int zoneListNum = Util::FindItemInList(areaName, state.dataHeatBal->ZoneList);
    3921            8 :                 if (zoneListNum > 0) {
    3922            6 :                     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            6 :                         inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3930            6 :                         int numSpaces = 0;
    3931           15 :                         for (int const listZoneIdx : state.dataHeatBal->ZoneList(zoneListNum).Zone) {
    3932            9 :                             numSpaces += state.dataHeatBal->Zone(listZoneIdx).numSpaces;
    3933           20 :                             for (int const spaceNum2 : state.dataHeatBal->Zone(listZoneIdx).spaceIndexes) {
    3934           11 :                                 inputObjects(objNum).spaceNums.emplace_back(spaceNum2);
    3935           11 :                                 inputObjects(objNum).names.emplace_back(state.dataHeatBal->space(spaceNum2).Name + ' ' + inputObjects(objNum).Name);
    3936            9 :                             }
    3937              :                         }
    3938            6 :                         numGainInstances += numSpaces;
    3939            6 :                         inputObjects(objNum).numOfSpaces = numSpaces;
    3940            6 :                         inputObjects(objNum).ZoneListActive = true;
    3941              :                     }
    3942            6 :                     continue;
    3943            6 :                 }
    3944            2 :                 int spaceListNum = Util::FindItemInList(areaName, state.dataHeatBal->spaceList);
    3945            2 :                 if (spaceListNum > 0) {
    3946            2 :                     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            2 :                         inputObjects(objNum).spaceStartPtr = numGainInstances + 1;
    3953            2 :                         int numSpaces = state.dataHeatBal->spaceList(spaceListNum).numListSpaces;
    3954            2 :                         numGainInstances += numSpaces;
    3955            2 :                         inputObjects(objNum).numOfSpaces = numSpaces;
    3956            2 :                         inputObjects(objNum).spaceListActive = true;
    3957            2 :                         inputObjects(objNum).spaceOrSpaceListPtr = spaceListNum;
    3958            6 :                         for (int const spaceNum2 : state.dataHeatBal->spaceList(spaceListNum).spaces) {
    3959            4 :                             inputObjects(objNum).spaceNums.emplace_back(spaceNum2);
    3960            4 :                             inputObjects(objNum).names.emplace_back(state.dataHeatBal->space(spaceNum2).Name + ' ' + inputObjects(objNum).Name);
    3961            2 :                         }
    3962              :                     }
    3963            2 :                     continue;
    3964            2 :                 }
    3965            0 :                 ShowSevereError(state, format("{}=\"{}\" invalid {}=\"{}\" not found.", objectType, thisObjectName, areaFieldName, areaName));
    3966            0 :                 errors = true;
    3967            0 :                 localErrFlag = true;
    3968         3543 :             }
    3969         2379 :             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         2379 :     }
    3976              : 
    3977          167 :     void setupIHGOutputs(EnergyPlusData &state)
    3978              :     {
    3979          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    3980              :             // Overall Zone Variables
    3981          412 :             SetupOutputVariable(state,
    3982              :                                 "Zone Total Internal Radiant Heating Energy",
    3983              :                                 Constant::Units::J,
    3984          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotRadiantGain,
    3985              :                                 OutputProcessor::TimeStepType::Zone,
    3986              :                                 OutputProcessor::StoreType::Sum,
    3987          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    3988          412 :             SetupOutputVariable(state,
    3989              :                                 "Zone Total Internal Radiant Heating Rate",
    3990              :                                 Constant::Units::W,
    3991          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotRadiantGainRate,
    3992              :                                 OutputProcessor::TimeStepType::Zone,
    3993              :                                 OutputProcessor::StoreType::Average,
    3994          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    3995          412 :             SetupOutputVariable(state,
    3996              :                                 "Zone Total Internal Visible Radiation Heating Energy",
    3997              :                                 Constant::Units::J,
    3998          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotVisHeatGain,
    3999              :                                 OutputProcessor::TimeStepType::Zone,
    4000              :                                 OutputProcessor::StoreType::Sum,
    4001          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4002          412 :             SetupOutputVariable(state,
    4003              :                                 "Zone Total Internal Visible Radiation Heating Rate",
    4004              :                                 Constant::Units::W,
    4005          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotVisHeatGainRate,
    4006              :                                 OutputProcessor::TimeStepType::Zone,
    4007              :                                 OutputProcessor::StoreType::Average,
    4008          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4009          412 :             SetupOutputVariable(state,
    4010              :                                 "Zone Total Internal Convective Heating Energy",
    4011              :                                 Constant::Units::J,
    4012          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotConvectiveGain,
    4013              :                                 OutputProcessor::TimeStepType::Zone,
    4014              :                                 OutputProcessor::StoreType::Sum,
    4015          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4016          412 :             SetupOutputVariable(state,
    4017              :                                 "Zone Total Internal Convective Heating Rate",
    4018              :                                 Constant::Units::W,
    4019          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotConvectiveGainRate,
    4020              :                                 OutputProcessor::TimeStepType::Zone,
    4021              :                                 OutputProcessor::StoreType::Average,
    4022          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4023          412 :             SetupOutputVariable(state,
    4024              :                                 "Zone Total Internal Latent Gain Energy",
    4025              :                                 Constant::Units::J,
    4026          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotLatentGain,
    4027              :                                 OutputProcessor::TimeStepType::Zone,
    4028              :                                 OutputProcessor::StoreType::Sum,
    4029          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4030          412 :             SetupOutputVariable(state,
    4031              :                                 "Zone Total Internal Latent Gain Rate",
    4032              :                                 Constant::Units::W,
    4033          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotLatentGainRate,
    4034              :                                 OutputProcessor::TimeStepType::Zone,
    4035              :                                 OutputProcessor::StoreType::Average,
    4036          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4037          412 :             SetupOutputVariable(state,
    4038              :                                 "Zone Total Internal Total Heating Energy",
    4039              :                                 Constant::Units::J,
    4040          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotTotalHeatGain,
    4041              :                                 OutputProcessor::TimeStepType::Zone,
    4042              :                                 OutputProcessor::StoreType::Sum,
    4043          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4044          412 :             SetupOutputVariable(state,
    4045              :                                 "Zone Total Internal Total Heating Rate",
    4046              :                                 Constant::Units::W,
    4047          206 :                                 state.dataHeatBal->ZoneRpt(zoneNum).TotTotalHeatGainRate,
    4048              :                                 OutputProcessor::TimeStepType::Zone,
    4049              :                                 OutputProcessor::StoreType::Average,
    4050          206 :                                 state.dataHeatBal->Zone(zoneNum).Name);
    4051              :         }
    4052              : 
    4053          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4054              :             // Overall Space Variables
    4055          448 :             SetupOutputVariable(state,
    4056              :                                 "Space Total Internal Radiant Heating Energy",
    4057              :                                 Constant::Units::J,
    4058          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotRadiantGain,
    4059              :                                 OutputProcessor::TimeStepType::Zone,
    4060              :                                 OutputProcessor::StoreType::Sum,
    4061          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4062          448 :             SetupOutputVariable(state,
    4063              :                                 "Space Total Internal Radiant Heating Rate",
    4064              :                                 Constant::Units::W,
    4065          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotRadiantGainRate,
    4066              :                                 OutputProcessor::TimeStepType::Zone,
    4067              :                                 OutputProcessor::StoreType::Average,
    4068          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4069          448 :             SetupOutputVariable(state,
    4070              :                                 "Space Total Internal Visible Radiation Heating Energy",
    4071              :                                 Constant::Units::J,
    4072          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotVisHeatGain,
    4073              :                                 OutputProcessor::TimeStepType::Zone,
    4074              :                                 OutputProcessor::StoreType::Sum,
    4075          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4076          448 :             SetupOutputVariable(state,
    4077              :                                 "Space Total Internal Visible Radiation Heating Rate",
    4078              :                                 Constant::Units::W,
    4079          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotVisHeatGainRate,
    4080              :                                 OutputProcessor::TimeStepType::Zone,
    4081              :                                 OutputProcessor::StoreType::Average,
    4082          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4083          448 :             SetupOutputVariable(state,
    4084              :                                 "Space Total Internal Convective Heating Energy",
    4085              :                                 Constant::Units::J,
    4086          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotConvectiveGain,
    4087              :                                 OutputProcessor::TimeStepType::Zone,
    4088              :                                 OutputProcessor::StoreType::Sum,
    4089          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4090          448 :             SetupOutputVariable(state,
    4091              :                                 "Space Total Internal Convective Heating Rate",
    4092              :                                 Constant::Units::W,
    4093          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotConvectiveGainRate,
    4094              :                                 OutputProcessor::TimeStepType::Zone,
    4095              :                                 OutputProcessor::StoreType::Average,
    4096          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4097          448 :             SetupOutputVariable(state,
    4098              :                                 "Space Total Internal Latent Gain Energy",
    4099              :                                 Constant::Units::J,
    4100          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotLatentGain,
    4101              :                                 OutputProcessor::TimeStepType::Zone,
    4102              :                                 OutputProcessor::StoreType::Sum,
    4103          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4104          448 :             SetupOutputVariable(state,
    4105              :                                 "Space Total Internal Latent Gain Rate",
    4106              :                                 Constant::Units::W,
    4107          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotLatentGainRate,
    4108              :                                 OutputProcessor::TimeStepType::Zone,
    4109              :                                 OutputProcessor::StoreType::Average,
    4110          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4111          448 :             SetupOutputVariable(state,
    4112              :                                 "Space Total Internal Total Heating Energy",
    4113              :                                 Constant::Units::J,
    4114          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotTotalHeatGain,
    4115              :                                 OutputProcessor::TimeStepType::Zone,
    4116              :                                 OutputProcessor::StoreType::Sum,
    4117          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4118          448 :             SetupOutputVariable(state,
    4119              :                                 "Space Total Internal Total Heating Rate",
    4120              :                                 Constant::Units::W,
    4121          224 :                                 state.dataHeatBal->spaceRpt(spaceNum).TotTotalHeatGainRate,
    4122              :                                 OutputProcessor::TimeStepType::Zone,
    4123              :                                 OutputProcessor::StoreType::Average,
    4124          224 :                                 state.dataHeatBal->space(spaceNum).Name);
    4125              :         }
    4126              : 
    4127              :         // Add zone and space outputs only where the particular type of equipment is actually present
    4128          167 :         Array1D_bool addZoneOutputs;
    4129          167 :         addZoneOutputs.dimension(state.dataGlobal->NumOfZones, false);
    4130          167 :         Array1D_bool addSpaceOutputs;
    4131          167 :         addSpaceOutputs.dimension(state.dataGlobal->numSpaces, false);
    4132              : 
    4133          243 :         for (int peopleNum = 1; peopleNum <= state.dataHeatBal->TotPeople; ++peopleNum) {
    4134              :             // Set flags for zone and space total report variables
    4135           76 :             addZoneOutputs(state.dataHeatBal->People(peopleNum).ZonePtr) = true;
    4136           76 :             addSpaceOutputs(state.dataHeatBal->People(peopleNum).spaceIndex) = true;
    4137              :             // Object report variables
    4138          152 :             SetupOutputVariable(state,
    4139              :                                 "People Occupant Count",
    4140              :                                 Constant::Units::None,
    4141           76 :                                 state.dataHeatBal->People(peopleNum).NumOcc,
    4142              :                                 OutputProcessor::TimeStepType::Zone,
    4143              :                                 OutputProcessor::StoreType::Average,
    4144           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4145          152 :             SetupOutputVariable(state,
    4146              :                                 "People Radiant Heating Energy",
    4147              :                                 Constant::Units::J,
    4148           76 :                                 state.dataHeatBal->People(peopleNum).RadGainEnergy,
    4149              :                                 OutputProcessor::TimeStepType::Zone,
    4150              :                                 OutputProcessor::StoreType::Sum,
    4151           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4152          152 :             SetupOutputVariable(state,
    4153              :                                 "People Radiant Heating Rate",
    4154              :                                 Constant::Units::W,
    4155           76 :                                 state.dataHeatBal->People(peopleNum).RadGainRate,
    4156              :                                 OutputProcessor::TimeStepType::Zone,
    4157              :                                 OutputProcessor::StoreType::Average,
    4158           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4159          152 :             SetupOutputVariable(state,
    4160              :                                 "People Convective Heating Energy",
    4161              :                                 Constant::Units::J,
    4162           76 :                                 state.dataHeatBal->People(peopleNum).ConGainEnergy,
    4163              :                                 OutputProcessor::TimeStepType::Zone,
    4164              :                                 OutputProcessor::StoreType::Sum,
    4165           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4166          152 :             SetupOutputVariable(state,
    4167              :                                 "People Convective Heating Rate",
    4168              :                                 Constant::Units::W,
    4169           76 :                                 state.dataHeatBal->People(peopleNum).ConGainRate,
    4170              :                                 OutputProcessor::TimeStepType::Zone,
    4171              :                                 OutputProcessor::StoreType::Average,
    4172           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4173          152 :             SetupOutputVariable(state,
    4174              :                                 "People Sensible Heating Energy",
    4175              :                                 Constant::Units::J,
    4176           76 :                                 state.dataHeatBal->People(peopleNum).SenGainEnergy,
    4177              :                                 OutputProcessor::TimeStepType::Zone,
    4178              :                                 OutputProcessor::StoreType::Sum,
    4179           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4180          152 :             SetupOutputVariable(state,
    4181              :                                 "People Sensible Heating Rate",
    4182              :                                 Constant::Units::W,
    4183           76 :                                 state.dataHeatBal->People(peopleNum).SenGainRate,
    4184              :                                 OutputProcessor::TimeStepType::Zone,
    4185              :                                 OutputProcessor::StoreType::Average,
    4186           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4187          152 :             SetupOutputVariable(state,
    4188              :                                 "People Latent Gain Energy",
    4189              :                                 Constant::Units::J,
    4190           76 :                                 state.dataHeatBal->People(peopleNum).LatGainEnergy,
    4191              :                                 OutputProcessor::TimeStepType::Zone,
    4192              :                                 OutputProcessor::StoreType::Sum,
    4193           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4194          152 :             SetupOutputVariable(state,
    4195              :                                 "People Latent Gain Rate",
    4196              :                                 Constant::Units::W,
    4197           76 :                                 state.dataHeatBal->People(peopleNum).LatGainRate,
    4198              :                                 OutputProcessor::TimeStepType::Zone,
    4199              :                                 OutputProcessor::StoreType::Average,
    4200           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4201          152 :             SetupOutputVariable(state,
    4202              :                                 "People Total Heating Energy",
    4203              :                                 Constant::Units::J,
    4204           76 :                                 state.dataHeatBal->People(peopleNum).TotGainEnergy,
    4205              :                                 OutputProcessor::TimeStepType::Zone,
    4206              :                                 OutputProcessor::StoreType::Sum,
    4207           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4208          152 :             SetupOutputVariable(state,
    4209              :                                 "People Total Heating Rate",
    4210              :                                 Constant::Units::W,
    4211           76 :                                 state.dataHeatBal->People(peopleNum).TotGainRate,
    4212              :                                 OutputProcessor::TimeStepType::Zone,
    4213              :                                 OutputProcessor::StoreType::Average,
    4214           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4215          152 :             SetupOutputVariable(state,
    4216              :                                 "People Air Temperature",
    4217              :                                 Constant::Units::C,
    4218           76 :                                 state.dataHeatBal->People(peopleNum).TemperatureInZone,
    4219              :                                 OutputProcessor::TimeStepType::Zone,
    4220              :                                 OutputProcessor::StoreType::Average,
    4221           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4222          152 :             SetupOutputVariable(state,
    4223              :                                 "People Air Relative Humidity",
    4224              :                                 Constant::Units::Perc,
    4225           76 :                                 state.dataHeatBal->People(peopleNum).RelativeHumidityInZone,
    4226              :                                 OutputProcessor::TimeStepType::Zone,
    4227              :                                 OutputProcessor::StoreType::Average,
    4228           76 :                                 state.dataHeatBal->People(peopleNum).Name);
    4229              :         }
    4230              : 
    4231          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    4232          206 :             if (addZoneOutputs(zoneNum)) {
    4233              :                 // Zone total report variables
    4234          148 :                 SetupOutputVariable(state,
    4235              :                                     "Zone People Occupant Count",
    4236              :                                     Constant::Units::None,
    4237           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleNumOcc,
    4238              :                                     OutputProcessor::TimeStepType::Zone,
    4239              :                                     OutputProcessor::StoreType::Average,
    4240           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4241          148 :                 SetupOutputVariable(state,
    4242              :                                     "Zone People Radiant Heating Energy",
    4243              :                                     Constant::Units::J,
    4244           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleRadGain,
    4245              :                                     OutputProcessor::TimeStepType::Zone,
    4246              :                                     OutputProcessor::StoreType::Sum,
    4247           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4248          148 :                 SetupOutputVariable(state,
    4249              :                                     "Zone People Radiant Heating Rate",
    4250              :                                     Constant::Units::W,
    4251           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleRadGainRate,
    4252              :                                     OutputProcessor::TimeStepType::Zone,
    4253              :                                     OutputProcessor::StoreType::Average,
    4254           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4255          148 :                 SetupOutputVariable(state,
    4256              :                                     "Zone People Convective Heating Energy",
    4257              :                                     Constant::Units::J,
    4258           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleConGain,
    4259              :                                     OutputProcessor::TimeStepType::Zone,
    4260              :                                     OutputProcessor::StoreType::Sum,
    4261           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4262          148 :                 SetupOutputVariable(state,
    4263              :                                     "Zone People Convective Heating Rate",
    4264              :                                     Constant::Units::W,
    4265           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleConGainRate,
    4266              :                                     OutputProcessor::TimeStepType::Zone,
    4267              :                                     OutputProcessor::StoreType::Average,
    4268           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4269          148 :                 SetupOutputVariable(state,
    4270              :                                     "Zone People Sensible Heating Energy",
    4271              :                                     Constant::Units::J,
    4272           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleSenGain,
    4273              :                                     OutputProcessor::TimeStepType::Zone,
    4274              :                                     OutputProcessor::StoreType::Sum,
    4275           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4276          148 :                 SetupOutputVariable(state,
    4277              :                                     "Zone People Sensible Heating Rate",
    4278              :                                     Constant::Units::W,
    4279           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleSenGainRate,
    4280              :                                     OutputProcessor::TimeStepType::Zone,
    4281              :                                     OutputProcessor::StoreType::Average,
    4282           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4283          148 :                 SetupOutputVariable(state,
    4284              :                                     "Zone People Latent Gain Energy",
    4285              :                                     Constant::Units::J,
    4286           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleLatGain,
    4287              :                                     OutputProcessor::TimeStepType::Zone,
    4288              :                                     OutputProcessor::StoreType::Sum,
    4289           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4290          148 :                 SetupOutputVariable(state,
    4291              :                                     "Zone People Latent Gain Rate",
    4292              :                                     Constant::Units::W,
    4293           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleLatGainRate,
    4294              :                                     OutputProcessor::TimeStepType::Zone,
    4295              :                                     OutputProcessor::StoreType::Average,
    4296           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4297          148 :                 SetupOutputVariable(state,
    4298              :                                     "Zone People Total Heating Energy",
    4299              :                                     Constant::Units::J,
    4300           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleTotGain,
    4301              :                                     OutputProcessor::TimeStepType::Zone,
    4302              :                                     OutputProcessor::StoreType::Sum,
    4303           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4304          148 :                 SetupOutputVariable(state,
    4305              :                                     "Zone People Total Heating Rate",
    4306              :                                     Constant::Units::W,
    4307           74 :                                     state.dataHeatBal->ZoneRpt(zoneNum).PeopleTotGainRate,
    4308              :                                     OutputProcessor::TimeStepType::Zone,
    4309              :                                     OutputProcessor::StoreType::Average,
    4310           74 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4311              :             }
    4312              :             // Reset zone output flag
    4313          206 :             addZoneOutputs(zoneNum) = false;
    4314              :         }
    4315              : 
    4316              :         // Space total report variables
    4317          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4318          224 :             if (addSpaceOutputs(spaceNum)) {
    4319          150 :                 SetupOutputVariable(state,
    4320              :                                     "Space People Occupant Count",
    4321              :                                     Constant::Units::None,
    4322           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleNumOcc,
    4323              :                                     OutputProcessor::TimeStepType::Zone,
    4324              :                                     OutputProcessor::StoreType::Average,
    4325           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4326          150 :                 SetupOutputVariable(state,
    4327              :                                     "Space People Radiant Heating Energy",
    4328              :                                     Constant::Units::J,
    4329           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleRadGain,
    4330              :                                     OutputProcessor::TimeStepType::Zone,
    4331              :                                     OutputProcessor::StoreType::Sum,
    4332           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4333          150 :                 SetupOutputVariable(state,
    4334              :                                     "Space People Radiant Heating Rate",
    4335              :                                     Constant::Units::W,
    4336           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleRadGainRate,
    4337              :                                     OutputProcessor::TimeStepType::Zone,
    4338              :                                     OutputProcessor::StoreType::Average,
    4339           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4340          150 :                 SetupOutputVariable(state,
    4341              :                                     "Space People Convective Heating Energy",
    4342              :                                     Constant::Units::J,
    4343           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleConGain,
    4344              :                                     OutputProcessor::TimeStepType::Zone,
    4345              :                                     OutputProcessor::StoreType::Sum,
    4346           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4347          150 :                 SetupOutputVariable(state,
    4348              :                                     "Space People Convective Heating Rate",
    4349              :                                     Constant::Units::W,
    4350           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleConGainRate,
    4351              :                                     OutputProcessor::TimeStepType::Zone,
    4352              :                                     OutputProcessor::StoreType::Average,
    4353           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4354          150 :                 SetupOutputVariable(state,
    4355              :                                     "Space People Sensible Heating Energy",
    4356              :                                     Constant::Units::J,
    4357           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleSenGain,
    4358              :                                     OutputProcessor::TimeStepType::Zone,
    4359              :                                     OutputProcessor::StoreType::Sum,
    4360           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4361          150 :                 SetupOutputVariable(state,
    4362              :                                     "Space People Sensible Heating Rate",
    4363              :                                     Constant::Units::W,
    4364           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleSenGainRate,
    4365              :                                     OutputProcessor::TimeStepType::Zone,
    4366              :                                     OutputProcessor::StoreType::Average,
    4367           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4368          150 :                 SetupOutputVariable(state,
    4369              :                                     "Space People Latent Gain Energy",
    4370              :                                     Constant::Units::J,
    4371           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleLatGain,
    4372              :                                     OutputProcessor::TimeStepType::Zone,
    4373              :                                     OutputProcessor::StoreType::Sum,
    4374           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4375          150 :                 SetupOutputVariable(state,
    4376              :                                     "Space People Latent Gain Rate",
    4377              :                                     Constant::Units::W,
    4378           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleLatGainRate,
    4379              :                                     OutputProcessor::TimeStepType::Zone,
    4380              :                                     OutputProcessor::StoreType::Average,
    4381           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4382          150 :                 SetupOutputVariable(state,
    4383              :                                     "Space People Total Heating Energy",
    4384              :                                     Constant::Units::J,
    4385           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleTotGain,
    4386              :                                     OutputProcessor::TimeStepType::Zone,
    4387              :                                     OutputProcessor::StoreType::Sum,
    4388           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4389          150 :                 SetupOutputVariable(state,
    4390              :                                     "Space People Total Heating Rate",
    4391              :                                     Constant::Units::W,
    4392           75 :                                     state.dataHeatBal->spaceRpt(spaceNum).PeopleTotGainRate,
    4393              :                                     OutputProcessor::TimeStepType::Zone,
    4394              :                                     OutputProcessor::StoreType::Average,
    4395           75 :                                     state.dataHeatBal->space(spaceNum).Name);
    4396              :             }
    4397              :             // Reset space output flag
    4398          224 :             addSpaceOutputs(spaceNum) = false;
    4399              :         }
    4400              : 
    4401          241 :         for (int lightsNum = 1; lightsNum <= state.dataHeatBal->TotLights; ++lightsNum) {
    4402              :             // Set flags for zone and space total report variables
    4403           74 :             addZoneOutputs(state.dataHeatBal->Lights(lightsNum).ZonePtr) = true;
    4404           74 :             addSpaceOutputs(state.dataHeatBal->Lights(lightsNum).spaceIndex) = true;
    4405              :             // Object report variables
    4406          148 :             SetupOutputVariable(state,
    4407              :                                 "Lights Electricity Rate",
    4408              :                                 Constant::Units::W,
    4409           74 :                                 state.dataHeatBal->Lights(lightsNum).Power,
    4410              :                                 OutputProcessor::TimeStepType::Zone,
    4411              :                                 OutputProcessor::StoreType::Average,
    4412           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4413              : 
    4414          148 :             SetupOutputVariable(state,
    4415              :                                 "Lights Radiant Heating Energy",
    4416              :                                 Constant::Units::J,
    4417           74 :                                 state.dataHeatBal->Lights(lightsNum).RadGainEnergy,
    4418              :                                 OutputProcessor::TimeStepType::Zone,
    4419              :                                 OutputProcessor::StoreType::Sum,
    4420           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4421          148 :             SetupOutputVariable(state,
    4422              :                                 "Lights Radiant Heating Rate",
    4423              :                                 Constant::Units::W,
    4424           74 :                                 state.dataHeatBal->Lights(lightsNum).RadGainRate,
    4425              :                                 OutputProcessor::TimeStepType::Zone,
    4426              :                                 OutputProcessor::StoreType::Average,
    4427           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4428          148 :             SetupOutputVariable(state,
    4429              :                                 "Lights Visible Radiation Heating Energy",
    4430              :                                 Constant::Units::J,
    4431           74 :                                 state.dataHeatBal->Lights(lightsNum).VisGainEnergy,
    4432              :                                 OutputProcessor::TimeStepType::Zone,
    4433              :                                 OutputProcessor::StoreType::Sum,
    4434           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4435              : 
    4436          148 :             SetupOutputVariable(state,
    4437              :                                 "Lights Visible Radiation Heating Rate",
    4438              :                                 Constant::Units::W,
    4439           74 :                                 state.dataHeatBal->Lights(lightsNum).VisGainRate,
    4440              :                                 OutputProcessor::TimeStepType::Zone,
    4441              :                                 OutputProcessor::StoreType::Average,
    4442           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4443          148 :             SetupOutputVariable(state,
    4444              :                                 "Lights Convective Heating Energy",
    4445              :                                 Constant::Units::J,
    4446           74 :                                 state.dataHeatBal->Lights(lightsNum).ConGainEnergy,
    4447              :                                 OutputProcessor::TimeStepType::Zone,
    4448              :                                 OutputProcessor::StoreType::Sum,
    4449           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4450          148 :             SetupOutputVariable(state,
    4451              :                                 "Lights Convective Heating Rate",
    4452              :                                 Constant::Units::W,
    4453           74 :                                 state.dataHeatBal->Lights(lightsNum).ConGainRate,
    4454              :                                 OutputProcessor::TimeStepType::Zone,
    4455              :                                 OutputProcessor::StoreType::Average,
    4456           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4457          148 :             SetupOutputVariable(state,
    4458              :                                 "Lights Return Air Heating Energy",
    4459              :                                 Constant::Units::J,
    4460           74 :                                 state.dataHeatBal->Lights(lightsNum).RetAirGainEnergy,
    4461              :                                 OutputProcessor::TimeStepType::Zone,
    4462              :                                 OutputProcessor::StoreType::Sum,
    4463           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4464          148 :             SetupOutputVariable(state,
    4465              :                                 "Lights Return Air Heating Rate",
    4466              :                                 Constant::Units::W,
    4467           74 :                                 state.dataHeatBal->Lights(lightsNum).RetAirGainRate,
    4468              :                                 OutputProcessor::TimeStepType::Zone,
    4469              :                                 OutputProcessor::StoreType::Average,
    4470           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4471          148 :             SetupOutputVariable(state,
    4472              :                                 "Lights Total Heating Energy",
    4473              :                                 Constant::Units::J,
    4474           74 :                                 state.dataHeatBal->Lights(lightsNum).TotGainEnergy,
    4475              :                                 OutputProcessor::TimeStepType::Zone,
    4476              :                                 OutputProcessor::StoreType::Sum,
    4477           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4478          148 :             SetupOutputVariable(state,
    4479              :                                 "Lights Total Heating Rate",
    4480              :                                 Constant::Units::W,
    4481           74 :                                 state.dataHeatBal->Lights(lightsNum).TotGainRate,
    4482              :                                 OutputProcessor::TimeStepType::Zone,
    4483              :                                 OutputProcessor::StoreType::Average,
    4484           74 :                                 state.dataHeatBal->Lights(lightsNum).Name);
    4485          148 :             SetupOutputVariable(state,
    4486              :                                 "Lights Electricity Energy",
    4487              :                                 Constant::Units::J,
    4488           74 :                                 state.dataHeatBal->Lights(lightsNum).Consumption,
    4489              :                                 OutputProcessor::TimeStepType::Zone,
    4490              :                                 OutputProcessor::StoreType::Sum,
    4491           74 :                                 state.dataHeatBal->Lights(lightsNum).Name,
    4492              :                                 Constant::eResource::Electricity,
    4493              :                                 OutputProcessor::Group::Building,
    4494              :                                 OutputProcessor::EndUseCat::InteriorLights,
    4495           74 :                                 state.dataHeatBal->Lights(lightsNum).EndUseSubcategory,
    4496           74 :                                 state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum).ZonePtr).Name,
    4497           74 :                                 state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum).ZonePtr).Multiplier,
    4498           74 :                                 state.dataHeatBal->Zone(state.dataHeatBal->Lights(lightsNum).ZonePtr).ListMultiplier,
    4499           74 :                                 state.dataHeatBal->space(state.dataHeatBal->Lights(lightsNum).spaceIndex).spaceType);
    4500              :         }
    4501              : 
    4502              :         // Zone total report variables
    4503          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    4504          206 :             if (addZoneOutputs(zoneNum)) {
    4505          146 :                 SetupOutputVariable(state,
    4506              :                                     "Zone Lights Electricity Rate",
    4507              :                                     Constant::Units::W,
    4508           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsPower,
    4509              :                                     OutputProcessor::TimeStepType::Zone,
    4510              :                                     OutputProcessor::StoreType::Average,
    4511           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4512          146 :                 SetupOutputVariable(state,
    4513              :                                     "Zone Lights Electricity Energy",
    4514              :                                     Constant::Units::J,
    4515           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsElecConsump,
    4516              :                                     OutputProcessor::TimeStepType::Zone,
    4517              :                                     OutputProcessor::StoreType::Sum,
    4518           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4519          146 :                 SetupOutputVariable(state,
    4520              :                                     "Zone Lights Radiant Heating Energy",
    4521              :                                     Constant::Units::J,
    4522           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRadGain,
    4523              :                                     OutputProcessor::TimeStepType::Zone,
    4524              :                                     OutputProcessor::StoreType::Sum,
    4525           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4526          146 :                 SetupOutputVariable(state,
    4527              :                                     "Zone Lights Radiant Heating Rate",
    4528              :                                     Constant::Units::W,
    4529           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRadGainRate,
    4530              :                                     OutputProcessor::TimeStepType::Zone,
    4531              :                                     OutputProcessor::StoreType::Average,
    4532           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4533          146 :                 SetupOutputVariable(state,
    4534              :                                     "Zone Lights Visible Radiation Heating Energy",
    4535              :                                     Constant::Units::J,
    4536           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsVisGain,
    4537              :                                     OutputProcessor::TimeStepType::Zone,
    4538              :                                     OutputProcessor::StoreType::Sum,
    4539           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4540          146 :                 SetupOutputVariable(state,
    4541              :                                     "Zone Lights Visible Radiation Heating Rate",
    4542              :                                     Constant::Units::W,
    4543           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsVisGainRate,
    4544              :                                     OutputProcessor::TimeStepType::Zone,
    4545              :                                     OutputProcessor::StoreType::Average,
    4546           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4547          146 :                 SetupOutputVariable(state,
    4548              :                                     "Zone Lights Convective Heating Energy",
    4549              :                                     Constant::Units::J,
    4550           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsConGain,
    4551              :                                     OutputProcessor::TimeStepType::Zone,
    4552              :                                     OutputProcessor::StoreType::Sum,
    4553           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4554          146 :                 SetupOutputVariable(state,
    4555              :                                     "Zone Lights Convective Heating Rate",
    4556              :                                     Constant::Units::W,
    4557           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsConGainRate,
    4558              :                                     OutputProcessor::TimeStepType::Zone,
    4559              :                                     OutputProcessor::StoreType::Average,
    4560           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4561          146 :                 SetupOutputVariable(state,
    4562              :                                     "Zone Lights Return Air Heating Energy",
    4563              :                                     Constant::Units::J,
    4564           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRetAirGain,
    4565              :                                     OutputProcessor::TimeStepType::Zone,
    4566              :                                     OutputProcessor::StoreType::Sum,
    4567           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4568          146 :                 SetupOutputVariable(state,
    4569              :                                     "Zone Lights Return Air Heating Rate",
    4570              :                                     Constant::Units::W,
    4571           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsRetAirGainRate,
    4572              :                                     OutputProcessor::TimeStepType::Zone,
    4573              :                                     OutputProcessor::StoreType::Average,
    4574           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4575          146 :                 SetupOutputVariable(state,
    4576              :                                     "Zone Lights Total Heating Energy",
    4577              :                                     Constant::Units::J,
    4578           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsTotGain,
    4579              :                                     OutputProcessor::TimeStepType::Zone,
    4580              :                                     OutputProcessor::StoreType::Sum,
    4581           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4582          146 :                 SetupOutputVariable(state,
    4583              :                                     "Zone Lights Total Heating Rate",
    4584              :                                     Constant::Units::W,
    4585           73 :                                     state.dataHeatBal->ZoneRpt(zoneNum).LtsTotGainRate,
    4586              :                                     OutputProcessor::TimeStepType::Zone,
    4587              :                                     OutputProcessor::StoreType::Average,
    4588           73 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4589              :             }
    4590              :             // Reset zone output flag
    4591          206 :             addZoneOutputs(zoneNum) = false;
    4592              :         }
    4593              : 
    4594              :         // Space total report variables
    4595          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4596          224 :             if (addSpaceOutputs(spaceNum)) {
    4597          148 :                 SetupOutputVariable(state,
    4598              :                                     "Space Lights Electricity Rate",
    4599              :                                     Constant::Units::W,
    4600           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsPower,
    4601              :                                     OutputProcessor::TimeStepType::Zone,
    4602              :                                     OutputProcessor::StoreType::Average,
    4603           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4604          148 :                 SetupOutputVariable(state,
    4605              :                                     "Space Lights Electricity Energy",
    4606              :                                     Constant::Units::J,
    4607           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsElecConsump,
    4608              :                                     OutputProcessor::TimeStepType::Zone,
    4609              :                                     OutputProcessor::StoreType::Sum,
    4610           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4611          148 :                 SetupOutputVariable(state,
    4612              :                                     "Space Lights Radiant Heating Energy",
    4613              :                                     Constant::Units::J,
    4614           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRadGain,
    4615              :                                     OutputProcessor::TimeStepType::Zone,
    4616              :                                     OutputProcessor::StoreType::Sum,
    4617           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4618          148 :                 SetupOutputVariable(state,
    4619              :                                     "Space Lights Radiant Heating Rate",
    4620              :                                     Constant::Units::W,
    4621           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRadGainRate,
    4622              :                                     OutputProcessor::TimeStepType::Zone,
    4623              :                                     OutputProcessor::StoreType::Average,
    4624           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4625          148 :                 SetupOutputVariable(state,
    4626              :                                     "Space Lights Visible Radiation Heating Energy",
    4627              :                                     Constant::Units::J,
    4628           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsVisGain,
    4629              :                                     OutputProcessor::TimeStepType::Zone,
    4630              :                                     OutputProcessor::StoreType::Sum,
    4631           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4632          148 :                 SetupOutputVariable(state,
    4633              :                                     "Space Lights Visible Radiation Heating Rate",
    4634              :                                     Constant::Units::W,
    4635           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsVisGainRate,
    4636              :                                     OutputProcessor::TimeStepType::Zone,
    4637              :                                     OutputProcessor::StoreType::Average,
    4638           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4639          148 :                 SetupOutputVariable(state,
    4640              :                                     "Space Lights Convective Heating Energy",
    4641              :                                     Constant::Units::J,
    4642           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsConGain,
    4643              :                                     OutputProcessor::TimeStepType::Zone,
    4644              :                                     OutputProcessor::StoreType::Sum,
    4645           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4646          148 :                 SetupOutputVariable(state,
    4647              :                                     "Space Lights Convective Heating Rate",
    4648              :                                     Constant::Units::W,
    4649           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsConGainRate,
    4650              :                                     OutputProcessor::TimeStepType::Zone,
    4651              :                                     OutputProcessor::StoreType::Average,
    4652           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4653          148 :                 SetupOutputVariable(state,
    4654              :                                     "Space Lights Return Air Heating Energy",
    4655              :                                     Constant::Units::J,
    4656           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRetAirGain,
    4657              :                                     OutputProcessor::TimeStepType::Zone,
    4658              :                                     OutputProcessor::StoreType::Sum,
    4659           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4660          148 :                 SetupOutputVariable(state,
    4661              :                                     "Space Lights Return Air Heating Rate",
    4662              :                                     Constant::Units::W,
    4663           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsRetAirGainRate,
    4664              :                                     OutputProcessor::TimeStepType::Zone,
    4665              :                                     OutputProcessor::StoreType::Average,
    4666           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4667          148 :                 SetupOutputVariable(state,
    4668              :                                     "Space Lights Total Heating Energy",
    4669              :                                     Constant::Units::J,
    4670           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsTotGain,
    4671              :                                     OutputProcessor::TimeStepType::Zone,
    4672              :                                     OutputProcessor::StoreType::Sum,
    4673           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4674          148 :                 SetupOutputVariable(state,
    4675              :                                     "Space Lights Total Heating Rate",
    4676              :                                     Constant::Units::W,
    4677           74 :                                     state.dataHeatBal->spaceRpt(spaceNum).LtsTotGainRate,
    4678              :                                     OutputProcessor::TimeStepType::Zone,
    4679              :                                     OutputProcessor::StoreType::Average,
    4680           74 :                                     state.dataHeatBal->space(spaceNum).Name);
    4681              :             }
    4682              :             // Reset space output flag
    4683          224 :             addSpaceOutputs(spaceNum) = false;
    4684              :         }
    4685          264 :         for (int elecEqNum = 1; elecEqNum <= state.dataHeatBal->TotElecEquip; ++elecEqNum) {
    4686              :             // Set flags for zone and space total report variables
    4687           97 :             addZoneOutputs(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr) = true;
    4688           97 :             addSpaceOutputs(state.dataHeatBal->ZoneElectric(elecEqNum).spaceIndex) = true;
    4689              :             // Object report variables
    4690          194 :             SetupOutputVariable(state,
    4691              :                                 "Electric Equipment Electricity Rate",
    4692              :                                 Constant::Units::W,
    4693           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Power,
    4694              :                                 OutputProcessor::TimeStepType::Zone,
    4695              :                                 OutputProcessor::StoreType::Average,
    4696           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4697          194 :             SetupOutputVariable(state,
    4698              :                                 "Electric Equipment Electricity Energy",
    4699              :                                 Constant::Units::J,
    4700           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Consumption,
    4701              :                                 OutputProcessor::TimeStepType::Zone,
    4702              :                                 OutputProcessor::StoreType::Sum,
    4703           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name,
    4704              :                                 Constant::eResource::Electricity,
    4705              :                                 OutputProcessor::Group::Building,
    4706              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    4707           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).EndUseSubcategory,
    4708           97 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr).Name,
    4709           97 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr).Multiplier,
    4710           97 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneElectric(elecEqNum).ZonePtr).ListMultiplier,
    4711           97 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneElectric(elecEqNum).spaceIndex).spaceType);
    4712              : 
    4713          194 :             SetupOutputVariable(state,
    4714              :                                 "Electric Equipment Radiant Heating Energy",
    4715              :                                 Constant::Units::J,
    4716           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).RadGainEnergy,
    4717              :                                 OutputProcessor::TimeStepType::Zone,
    4718              :                                 OutputProcessor::StoreType::Sum,
    4719           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4720          194 :             SetupOutputVariable(state,
    4721              :                                 "Electric Equipment Radiant Heating Rate",
    4722              :                                 Constant::Units::W,
    4723           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).RadGainRate,
    4724              :                                 OutputProcessor::TimeStepType::Zone,
    4725              :                                 OutputProcessor::StoreType::Average,
    4726           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4727          194 :             SetupOutputVariable(state,
    4728              :                                 "Electric Equipment Convective Heating Energy",
    4729              :                                 Constant::Units::J,
    4730           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).ConGainEnergy,
    4731              :                                 OutputProcessor::TimeStepType::Zone,
    4732              :                                 OutputProcessor::StoreType::Sum,
    4733           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4734          194 :             SetupOutputVariable(state,
    4735              :                                 "Electric Equipment Convective Heating Rate",
    4736              :                                 Constant::Units::W,
    4737           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).ConGainRate,
    4738              :                                 OutputProcessor::TimeStepType::Zone,
    4739              :                                 OutputProcessor::StoreType::Average,
    4740           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4741          194 :             SetupOutputVariable(state,
    4742              :                                 "Electric Equipment Latent Gain Energy",
    4743              :                                 Constant::Units::J,
    4744           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LatGainEnergy,
    4745              :                                 OutputProcessor::TimeStepType::Zone,
    4746              :                                 OutputProcessor::StoreType::Sum,
    4747           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4748          194 :             SetupOutputVariable(state,
    4749              :                                 "Electric Equipment Latent Gain Rate",
    4750              :                                 Constant::Units::W,
    4751           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LatGainRate,
    4752              :                                 OutputProcessor::TimeStepType::Zone,
    4753              :                                 OutputProcessor::StoreType::Average,
    4754           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4755          194 :             SetupOutputVariable(state,
    4756              :                                 "Electric Equipment Lost Heat Energy",
    4757              :                                 Constant::Units::J,
    4758           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LostEnergy,
    4759              :                                 OutputProcessor::TimeStepType::Zone,
    4760              :                                 OutputProcessor::StoreType::Sum,
    4761           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4762          194 :             SetupOutputVariable(state,
    4763              :                                 "Electric Equipment Lost Heat Rate",
    4764              :                                 Constant::Units::W,
    4765           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).LostRate,
    4766              :                                 OutputProcessor::TimeStepType::Zone,
    4767              :                                 OutputProcessor::StoreType::Average,
    4768           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4769          194 :             SetupOutputVariable(state,
    4770              :                                 "Electric Equipment Total Heating Energy",
    4771              :                                 Constant::Units::J,
    4772           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).TotGainEnergy,
    4773              :                                 OutputProcessor::TimeStepType::Zone,
    4774              :                                 OutputProcessor::StoreType::Sum,
    4775           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4776          194 :             SetupOutputVariable(state,
    4777              :                                 "Electric Equipment Total Heating Rate",
    4778              :                                 Constant::Units::W,
    4779           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).TotGainRate,
    4780              :                                 OutputProcessor::TimeStepType::Zone,
    4781              :                                 OutputProcessor::StoreType::Average,
    4782           97 :                                 state.dataHeatBal->ZoneElectric(elecEqNum).Name);
    4783              :         }
    4784              : 
    4785              :         // Zone total report variables
    4786          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    4787          206 :             if (addZoneOutputs(zoneNum)) {
    4788          152 :                 SetupOutputVariable(state,
    4789              :                                     "Zone Electric Equipment Electricity Rate",
    4790              :                                     Constant::Units::W,
    4791           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecPower,
    4792              :                                     OutputProcessor::TimeStepType::Zone,
    4793              :                                     OutputProcessor::StoreType::Average,
    4794           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4795          152 :                 SetupOutputVariable(state,
    4796              :                                     "Zone Electric Equipment Electricity Energy",
    4797              :                                     Constant::Units::J,
    4798           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecConsump,
    4799              :                                     OutputProcessor::TimeStepType::Zone,
    4800              :                                     OutputProcessor::StoreType::Sum,
    4801           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4802              : 
    4803          152 :                 SetupOutputVariable(state,
    4804              :                                     "Zone Electric Equipment Radiant Heating Energy",
    4805              :                                     Constant::Units::J,
    4806           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecRadGain,
    4807              :                                     OutputProcessor::TimeStepType::Zone,
    4808              :                                     OutputProcessor::StoreType::Sum,
    4809           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4810          152 :                 SetupOutputVariable(state,
    4811              :                                     "Zone Electric Equipment Radiant Heating Rate",
    4812              :                                     Constant::Units::W,
    4813           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecRadGainRate,
    4814              :                                     OutputProcessor::TimeStepType::Zone,
    4815              :                                     OutputProcessor::StoreType::Average,
    4816           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4817          152 :                 SetupOutputVariable(state,
    4818              :                                     "Zone Electric Equipment Convective Heating Energy",
    4819              :                                     Constant::Units::J,
    4820           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecConGain,
    4821              :                                     OutputProcessor::TimeStepType::Zone,
    4822              :                                     OutputProcessor::StoreType::Sum,
    4823           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4824          152 :                 SetupOutputVariable(state,
    4825              :                                     "Zone Electric Equipment Convective Heating Rate",
    4826              :                                     Constant::Units::W,
    4827           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecConGainRate,
    4828              :                                     OutputProcessor::TimeStepType::Zone,
    4829              :                                     OutputProcessor::StoreType::Average,
    4830           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4831          152 :                 SetupOutputVariable(state,
    4832              :                                     "Zone Electric Equipment Latent Gain Energy",
    4833              :                                     Constant::Units::J,
    4834           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLatGain,
    4835              :                                     OutputProcessor::TimeStepType::Zone,
    4836              :                                     OutputProcessor::StoreType::Sum,
    4837           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4838          152 :                 SetupOutputVariable(state,
    4839              :                                     "Zone Electric Equipment Latent Gain Rate",
    4840              :                                     Constant::Units::W,
    4841           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLatGainRate,
    4842              :                                     OutputProcessor::TimeStepType::Zone,
    4843              :                                     OutputProcessor::StoreType::Average,
    4844           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4845          152 :                 SetupOutputVariable(state,
    4846              :                                     "Zone Electric Equipment Lost Heat Energy",
    4847              :                                     Constant::Units::J,
    4848           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLost,
    4849              :                                     OutputProcessor::TimeStepType::Zone,
    4850              :                                     OutputProcessor::StoreType::Sum,
    4851           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4852          152 :                 SetupOutputVariable(state,
    4853              :                                     "Zone Electric Equipment Lost Heat Rate",
    4854              :                                     Constant::Units::W,
    4855           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecLostRate,
    4856              :                                     OutputProcessor::TimeStepType::Zone,
    4857              :                                     OutputProcessor::StoreType::Average,
    4858           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4859          152 :                 SetupOutputVariable(state,
    4860              :                                     "Zone Electric Equipment Total Heating Energy",
    4861              :                                     Constant::Units::J,
    4862           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecTotGain,
    4863              :                                     OutputProcessor::TimeStepType::Zone,
    4864              :                                     OutputProcessor::StoreType::Sum,
    4865           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4866          152 :                 SetupOutputVariable(state,
    4867              :                                     "Zone Electric Equipment Total Heating Rate",
    4868              :                                     Constant::Units::W,
    4869           76 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ElecTotGainRate,
    4870              :                                     OutputProcessor::TimeStepType::Zone,
    4871              :                                     OutputProcessor::StoreType::Average,
    4872           76 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    4873              :             }
    4874              :             // Reset zone output flag
    4875          206 :             addZoneOutputs(zoneNum) = false;
    4876              :         }
    4877              : 
    4878              :         // space total report variables
    4879          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    4880          224 :             if (addSpaceOutputs(spaceNum)) {
    4881          186 :                 SetupOutputVariable(state,
    4882              :                                     "Space Electric Equipment Electricity Rate",
    4883              :                                     Constant::Units::W,
    4884           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecPower,
    4885              :                                     OutputProcessor::TimeStepType::Zone,
    4886              :                                     OutputProcessor::StoreType::Average,
    4887           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4888          186 :                 SetupOutputVariable(state,
    4889              :                                     "Space Electric Equipment Electricity Energy",
    4890              :                                     Constant::Units::J,
    4891           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecConsump,
    4892              :                                     OutputProcessor::TimeStepType::Zone,
    4893              :                                     OutputProcessor::StoreType::Sum,
    4894           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4895              : 
    4896          186 :                 SetupOutputVariable(state,
    4897              :                                     "Space Electric Equipment Radiant Heating Energy",
    4898              :                                     Constant::Units::J,
    4899           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecRadGain,
    4900              :                                     OutputProcessor::TimeStepType::Zone,
    4901              :                                     OutputProcessor::StoreType::Sum,
    4902           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4903          186 :                 SetupOutputVariable(state,
    4904              :                                     "Space Electric Equipment Radiant Heating Rate",
    4905              :                                     Constant::Units::W,
    4906           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecRadGainRate,
    4907              :                                     OutputProcessor::TimeStepType::Zone,
    4908              :                                     OutputProcessor::StoreType::Average,
    4909           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4910          186 :                 SetupOutputVariable(state,
    4911              :                                     "Space Electric Equipment Convective Heating Energy",
    4912              :                                     Constant::Units::J,
    4913           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecConGain,
    4914              :                                     OutputProcessor::TimeStepType::Zone,
    4915              :                                     OutputProcessor::StoreType::Sum,
    4916           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4917          186 :                 SetupOutputVariable(state,
    4918              :                                     "Space Electric Equipment Convective Heating Rate",
    4919              :                                     Constant::Units::W,
    4920           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecConGainRate,
    4921              :                                     OutputProcessor::TimeStepType::Zone,
    4922              :                                     OutputProcessor::StoreType::Average,
    4923           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4924          186 :                 SetupOutputVariable(state,
    4925              :                                     "Space Electric Equipment Latent Gain Energy",
    4926              :                                     Constant::Units::J,
    4927           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLatGain,
    4928              :                                     OutputProcessor::TimeStepType::Zone,
    4929              :                                     OutputProcessor::StoreType::Sum,
    4930           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4931          186 :                 SetupOutputVariable(state,
    4932              :                                     "Space Electric Equipment Latent Gain Rate",
    4933              :                                     Constant::Units::W,
    4934           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLatGainRate,
    4935              :                                     OutputProcessor::TimeStepType::Zone,
    4936              :                                     OutputProcessor::StoreType::Average,
    4937           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4938          186 :                 SetupOutputVariable(state,
    4939              :                                     "Space Electric Equipment Lost Heat Energy",
    4940              :                                     Constant::Units::J,
    4941           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLost,
    4942              :                                     OutputProcessor::TimeStepType::Zone,
    4943              :                                     OutputProcessor::StoreType::Sum,
    4944           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4945          186 :                 SetupOutputVariable(state,
    4946              :                                     "Space Electric Equipment Lost Heat Rate",
    4947              :                                     Constant::Units::W,
    4948           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecLostRate,
    4949              :                                     OutputProcessor::TimeStepType::Zone,
    4950              :                                     OutputProcessor::StoreType::Average,
    4951           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4952          186 :                 SetupOutputVariable(state,
    4953              :                                     "Space Electric Equipment Total Heating Energy",
    4954              :                                     Constant::Units::J,
    4955           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecTotGain,
    4956              :                                     OutputProcessor::TimeStepType::Zone,
    4957              :                                     OutputProcessor::StoreType::Sum,
    4958           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4959          186 :                 SetupOutputVariable(state,
    4960              :                                     "Space Electric Equipment Total Heating Rate",
    4961              :                                     Constant::Units::W,
    4962           93 :                                     state.dataHeatBal->spaceRpt(spaceNum).ElecTotGainRate,
    4963              :                                     OutputProcessor::TimeStepType::Zone,
    4964              :                                     OutputProcessor::StoreType::Average,
    4965           93 :                                     state.dataHeatBal->space(spaceNum).Name);
    4966              :             }
    4967              :             // Reset space output flag
    4968          224 :             addSpaceOutputs(spaceNum) = false;
    4969              :         }
    4970              :         // Object report variables
    4971          169 :         for (int gasEqNum = 1; gasEqNum <= state.dataHeatBal->TotGasEquip; ++gasEqNum) {
    4972              :             // Set flags for zone and space total report variables
    4973            2 :             addZoneOutputs(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr) = true;
    4974            2 :             addSpaceOutputs(state.dataHeatBal->ZoneGas(gasEqNum).spaceIndex) = true;
    4975            4 :             SetupOutputVariable(state,
    4976              :                                 "Gas Equipment NaturalGas Rate",
    4977              :                                 Constant::Units::W,
    4978            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Power,
    4979              :                                 OutputProcessor::TimeStepType::Zone,
    4980              :                                 OutputProcessor::StoreType::Average,
    4981            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    4982            4 :             SetupOutputVariable(state,
    4983              :                                 "Gas Equipment NaturalGas Energy",
    4984              :                                 Constant::Units::J,
    4985            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Consumption,
    4986              :                                 OutputProcessor::TimeStepType::Zone,
    4987              :                                 OutputProcessor::StoreType::Sum,
    4988            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name,
    4989              :                                 Constant::eResource::NaturalGas,
    4990              :                                 OutputProcessor::Group::Building,
    4991              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    4992            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).EndUseSubcategory,
    4993            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr).Name,
    4994            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr).Multiplier,
    4995            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneGas(gasEqNum).ZonePtr).ListMultiplier,
    4996            2 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneGas(gasEqNum).spaceIndex).spaceType);
    4997              : 
    4998            4 :             SetupOutputVariable(state,
    4999              :                                 "Gas Equipment Radiant Heating Energy",
    5000              :                                 Constant::Units::J,
    5001            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).RadGainEnergy,
    5002              :                                 OutputProcessor::TimeStepType::Zone,
    5003              :                                 OutputProcessor::StoreType::Sum,
    5004            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5005            4 :             SetupOutputVariable(state,
    5006              :                                 "Gas Equipment Convective Heating Energy",
    5007              :                                 Constant::Units::J,
    5008            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).ConGainEnergy,
    5009              :                                 OutputProcessor::TimeStepType::Zone,
    5010              :                                 OutputProcessor::StoreType::Sum,
    5011            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5012            4 :             SetupOutputVariable(state,
    5013              :                                 "Gas Equipment Latent Gain Energy",
    5014              :                                 Constant::Units::J,
    5015            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LatGainEnergy,
    5016              :                                 OutputProcessor::TimeStepType::Zone,
    5017              :                                 OutputProcessor::StoreType::Sum,
    5018            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5019            4 :             SetupOutputVariable(state,
    5020              :                                 "Gas Equipment Lost Heat Energy",
    5021              :                                 Constant::Units::J,
    5022            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LostEnergy,
    5023              :                                 OutputProcessor::TimeStepType::Zone,
    5024              :                                 OutputProcessor::StoreType::Sum,
    5025            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5026            4 :             SetupOutputVariable(state,
    5027              :                                 "Gas Equipment Total Heating Energy",
    5028              :                                 Constant::Units::J,
    5029            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).TotGainEnergy,
    5030              :                                 OutputProcessor::TimeStepType::Zone,
    5031              :                                 OutputProcessor::StoreType::Sum,
    5032            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5033            4 :             SetupOutputVariable(state,
    5034              :                                 "Gas Equipment Radiant Heating Rate",
    5035              :                                 Constant::Units::W,
    5036            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).RadGainRate,
    5037              :                                 OutputProcessor::TimeStepType::Zone,
    5038              :                                 OutputProcessor::StoreType::Average,
    5039            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5040            4 :             SetupOutputVariable(state,
    5041              :                                 "Gas Equipment Convective Heating Rate",
    5042              :                                 Constant::Units::W,
    5043            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).ConGainRate,
    5044              :                                 OutputProcessor::TimeStepType::Zone,
    5045              :                                 OutputProcessor::StoreType::Average,
    5046            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5047            4 :             SetupOutputVariable(state,
    5048              :                                 "Gas Equipment Latent Gain Rate",
    5049              :                                 Constant::Units::W,
    5050            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LatGainRate,
    5051              :                                 OutputProcessor::TimeStepType::Zone,
    5052              :                                 OutputProcessor::StoreType::Average,
    5053            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5054            4 :             SetupOutputVariable(state,
    5055              :                                 "Gas Equipment Lost Heat Rate",
    5056              :                                 Constant::Units::W,
    5057            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).LostRate,
    5058              :                                 OutputProcessor::TimeStepType::Zone,
    5059              :                                 OutputProcessor::StoreType::Average,
    5060            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5061            4 :             SetupOutputVariable(state,
    5062              :                                 "Gas Equipment Total Heating Rate",
    5063              :                                 Constant::Units::W,
    5064            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).TotGainRate,
    5065              :                                 OutputProcessor::TimeStepType::Zone,
    5066              :                                 OutputProcessor::StoreType::Average,
    5067            2 :                                 state.dataHeatBal->ZoneGas(gasEqNum).Name);
    5068              :         }
    5069              : 
    5070              :         // Zone total report variables
    5071          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5072          206 :             if (addZoneOutputs(zoneNum)) {
    5073              : 
    5074            2 :                 SetupOutputVariable(state,
    5075              :                                     "Zone Gas Equipment NaturalGas Rate",
    5076              :                                     Constant::Units::W,
    5077            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasPower,
    5078              :                                     OutputProcessor::TimeStepType::Zone,
    5079              :                                     OutputProcessor::StoreType::Average,
    5080            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5081            2 :                 SetupOutputVariable(state,
    5082              :                                     "Zone Gas Equipment NaturalGas Energy",
    5083              :                                     Constant::Units::J,
    5084            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasConsump,
    5085              :                                     OutputProcessor::TimeStepType::Zone,
    5086              :                                     OutputProcessor::StoreType::Sum,
    5087            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5088              : 
    5089            2 :                 SetupOutputVariable(state,
    5090              :                                     "Zone Gas Equipment Radiant Heating Energy",
    5091              :                                     Constant::Units::J,
    5092            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasRadGain,
    5093              :                                     OutputProcessor::TimeStepType::Zone,
    5094              :                                     OutputProcessor::StoreType::Sum,
    5095            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5096            2 :                 SetupOutputVariable(state,
    5097              :                                     "Zone Gas Equipment Radiant Heating Rate",
    5098              :                                     Constant::Units::W,
    5099            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasRadGainRate,
    5100              :                                     OutputProcessor::TimeStepType::Zone,
    5101              :                                     OutputProcessor::StoreType::Average,
    5102            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5103            2 :                 SetupOutputVariable(state,
    5104              :                                     "Zone Gas Equipment Convective Heating Energy",
    5105              :                                     Constant::Units::J,
    5106            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasConGain,
    5107              :                                     OutputProcessor::TimeStepType::Zone,
    5108              :                                     OutputProcessor::StoreType::Sum,
    5109            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5110            2 :                 SetupOutputVariable(state,
    5111              :                                     "Zone Gas Equipment Convective Heating Rate",
    5112              :                                     Constant::Units::W,
    5113            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasConGainRate,
    5114              :                                     OutputProcessor::TimeStepType::Zone,
    5115              :                                     OutputProcessor::StoreType::Average,
    5116            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5117            2 :                 SetupOutputVariable(state,
    5118              :                                     "Zone Gas Equipment Latent Gain Energy",
    5119              :                                     Constant::Units::J,
    5120            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLatGain,
    5121              :                                     OutputProcessor::TimeStepType::Zone,
    5122              :                                     OutputProcessor::StoreType::Sum,
    5123            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5124            2 :                 SetupOutputVariable(state,
    5125              :                                     "Zone Gas Equipment Latent Gain Rate",
    5126              :                                     Constant::Units::W,
    5127            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLatGainRate,
    5128              :                                     OutputProcessor::TimeStepType::Zone,
    5129              :                                     OutputProcessor::StoreType::Average,
    5130            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5131            2 :                 SetupOutputVariable(state,
    5132              :                                     "Zone Gas Equipment Lost Heat Energy",
    5133              :                                     Constant::Units::J,
    5134            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLost,
    5135              :                                     OutputProcessor::TimeStepType::Zone,
    5136              :                                     OutputProcessor::StoreType::Sum,
    5137            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5138            2 :                 SetupOutputVariable(state,
    5139              :                                     "Zone Gas Equipment Lost Heat Rate",
    5140              :                                     Constant::Units::W,
    5141            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasLostRate,
    5142              :                                     OutputProcessor::TimeStepType::Zone,
    5143              :                                     OutputProcessor::StoreType::Average,
    5144            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5145            2 :                 SetupOutputVariable(state,
    5146              :                                     "Zone Gas Equipment Total Heating Energy",
    5147              :                                     Constant::Units::J,
    5148            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasTotGain,
    5149              :                                     OutputProcessor::TimeStepType::Zone,
    5150              :                                     OutputProcessor::StoreType::Sum,
    5151            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5152            2 :                 SetupOutputVariable(state,
    5153              :                                     "Zone Gas Equipment Total Heating Rate",
    5154              :                                     Constant::Units::W,
    5155            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).GasTotGainRate,
    5156              :                                     OutputProcessor::TimeStepType::Zone,
    5157              :                                     OutputProcessor::StoreType::Average,
    5158            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5159              :             }
    5160              :             // Reset zone output flag
    5161          206 :             addZoneOutputs(zoneNum) = false;
    5162              :         }
    5163              : 
    5164              :         // Space total report variables
    5165          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    5166          224 :             if (addSpaceOutputs(spaceNum)) {
    5167              : 
    5168            4 :                 SetupOutputVariable(state,
    5169              :                                     "Space Gas Equipment NaturalGas Rate",
    5170              :                                     Constant::Units::W,
    5171            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasPower,
    5172              :                                     OutputProcessor::TimeStepType::Zone,
    5173              :                                     OutputProcessor::StoreType::Average,
    5174            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5175            4 :                 SetupOutputVariable(state,
    5176              :                                     "Space Gas Equipment NaturalGas Energy",
    5177              :                                     Constant::Units::J,
    5178            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasConsump,
    5179              :                                     OutputProcessor::TimeStepType::Zone,
    5180              :                                     OutputProcessor::StoreType::Sum,
    5181            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5182              : 
    5183            4 :                 SetupOutputVariable(state,
    5184              :                                     "Space Gas Equipment Radiant Heating Energy",
    5185              :                                     Constant::Units::J,
    5186            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasRadGain,
    5187              :                                     OutputProcessor::TimeStepType::Zone,
    5188              :                                     OutputProcessor::StoreType::Sum,
    5189            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5190            4 :                 SetupOutputVariable(state,
    5191              :                                     "Space Gas Equipment Radiant Heating Rate",
    5192              :                                     Constant::Units::W,
    5193            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasRadGainRate,
    5194              :                                     OutputProcessor::TimeStepType::Zone,
    5195              :                                     OutputProcessor::StoreType::Average,
    5196            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5197            4 :                 SetupOutputVariable(state,
    5198              :                                     "Space Gas Equipment Convective Heating Energy",
    5199              :                                     Constant::Units::J,
    5200            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasConGain,
    5201              :                                     OutputProcessor::TimeStepType::Zone,
    5202              :                                     OutputProcessor::StoreType::Sum,
    5203            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5204            4 :                 SetupOutputVariable(state,
    5205              :                                     "Space Gas Equipment Convective Heating Rate",
    5206              :                                     Constant::Units::W,
    5207            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasConGainRate,
    5208              :                                     OutputProcessor::TimeStepType::Zone,
    5209              :                                     OutputProcessor::StoreType::Average,
    5210            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5211            4 :                 SetupOutputVariable(state,
    5212              :                                     "Space Gas Equipment Latent Gain Energy",
    5213              :                                     Constant::Units::J,
    5214            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLatGain,
    5215              :                                     OutputProcessor::TimeStepType::Zone,
    5216              :                                     OutputProcessor::StoreType::Sum,
    5217            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5218            4 :                 SetupOutputVariable(state,
    5219              :                                     "Space Gas Equipment Latent Gain Rate",
    5220              :                                     Constant::Units::W,
    5221            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLatGainRate,
    5222              :                                     OutputProcessor::TimeStepType::Zone,
    5223              :                                     OutputProcessor::StoreType::Average,
    5224            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5225            4 :                 SetupOutputVariable(state,
    5226              :                                     "Space Gas Equipment Lost Heat Energy",
    5227              :                                     Constant::Units::J,
    5228            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLost,
    5229              :                                     OutputProcessor::TimeStepType::Zone,
    5230              :                                     OutputProcessor::StoreType::Sum,
    5231            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5232            4 :                 SetupOutputVariable(state,
    5233              :                                     "Space Gas Equipment Lost Heat Rate",
    5234              :                                     Constant::Units::W,
    5235            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasLostRate,
    5236              :                                     OutputProcessor::TimeStepType::Zone,
    5237              :                                     OutputProcessor::StoreType::Average,
    5238            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5239            4 :                 SetupOutputVariable(state,
    5240              :                                     "Space Gas Equipment Total Heating Energy",
    5241              :                                     Constant::Units::J,
    5242            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasTotGain,
    5243              :                                     OutputProcessor::TimeStepType::Zone,
    5244              :                                     OutputProcessor::StoreType::Sum,
    5245            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5246            4 :                 SetupOutputVariable(state,
    5247              :                                     "Space Gas Equipment Total Heating Rate",
    5248              :                                     Constant::Units::W,
    5249            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).GasTotGainRate,
    5250              :                                     OutputProcessor::TimeStepType::Zone,
    5251              :                                     OutputProcessor::StoreType::Average,
    5252            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5253              :             }
    5254              :             // Reset space output flag
    5255          224 :             addSpaceOutputs(spaceNum) = false;
    5256              :         }
    5257              : 
    5258              :         // Object report variables
    5259          169 :         for (int hwEqNum = 1; hwEqNum <= state.dataHeatBal->TotHWEquip; ++hwEqNum) {
    5260              :             // Set flags for zone and space total report variables
    5261            2 :             addZoneOutputs(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr) = true;
    5262            2 :             addSpaceOutputs(state.dataHeatBal->ZoneHWEq(hwEqNum).spaceIndex) = true;
    5263            4 :             SetupOutputVariable(state,
    5264              :                                 "Hot Water Equipment District Heating Rate",
    5265              :                                 Constant::Units::W,
    5266            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Power,
    5267              :                                 OutputProcessor::TimeStepType::Zone,
    5268              :                                 OutputProcessor::StoreType::Average,
    5269            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5270            4 :             SetupOutputVariable(state,
    5271              :                                 "Hot Water Equipment District Heating Energy",
    5272              :                                 Constant::Units::J,
    5273            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Consumption,
    5274              :                                 OutputProcessor::TimeStepType::Zone,
    5275              :                                 OutputProcessor::StoreType::Sum,
    5276            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name,
    5277              :                                 Constant::eResource::DistrictHeatingWater,
    5278              :                                 OutputProcessor::Group::Building,
    5279              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    5280            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).EndUseSubcategory,
    5281            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr).Name,
    5282            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr).Multiplier,
    5283            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneHWEq(hwEqNum).ZonePtr).ListMultiplier,
    5284            2 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneHWEq(hwEqNum).spaceIndex).spaceType);
    5285              : 
    5286            4 :             SetupOutputVariable(state,
    5287              :                                 "Hot Water Equipment Radiant Heating Energy",
    5288              :                                 Constant::Units::J,
    5289            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).RadGainEnergy,
    5290              :                                 OutputProcessor::TimeStepType::Zone,
    5291              :                                 OutputProcessor::StoreType::Sum,
    5292            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5293            4 :             SetupOutputVariable(state,
    5294              :                                 "Hot Water Equipment Radiant Heating Rate",
    5295              :                                 Constant::Units::W,
    5296            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).RadGainRate,
    5297              :                                 OutputProcessor::TimeStepType::Zone,
    5298              :                                 OutputProcessor::StoreType::Average,
    5299            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5300            4 :             SetupOutputVariable(state,
    5301              :                                 "Hot Water Equipment Convective Heating Energy",
    5302              :                                 Constant::Units::J,
    5303            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).ConGainEnergy,
    5304              :                                 OutputProcessor::TimeStepType::Zone,
    5305              :                                 OutputProcessor::StoreType::Sum,
    5306            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5307            4 :             SetupOutputVariable(state,
    5308              :                                 "Hot Water Equipment Convective Heating Rate",
    5309              :                                 Constant::Units::W,
    5310            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).ConGainRate,
    5311              :                                 OutputProcessor::TimeStepType::Zone,
    5312              :                                 OutputProcessor::StoreType::Average,
    5313            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5314            4 :             SetupOutputVariable(state,
    5315              :                                 "Hot Water Equipment Latent Gain Energy",
    5316              :                                 Constant::Units::J,
    5317            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LatGainEnergy,
    5318              :                                 OutputProcessor::TimeStepType::Zone,
    5319              :                                 OutputProcessor::StoreType::Sum,
    5320            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5321            4 :             SetupOutputVariable(state,
    5322              :                                 "Hot Water Equipment Latent Gain Rate",
    5323              :                                 Constant::Units::W,
    5324            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LatGainRate,
    5325              :                                 OutputProcessor::TimeStepType::Zone,
    5326              :                                 OutputProcessor::StoreType::Average,
    5327            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5328            4 :             SetupOutputVariable(state,
    5329              :                                 "Hot Water Equipment Lost Heat Energy",
    5330              :                                 Constant::Units::J,
    5331            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LostEnergy,
    5332              :                                 OutputProcessor::TimeStepType::Zone,
    5333              :                                 OutputProcessor::StoreType::Sum,
    5334            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5335            4 :             SetupOutputVariable(state,
    5336              :                                 "Hot Water Equipment Lost Heat Rate",
    5337              :                                 Constant::Units::W,
    5338            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).LostRate,
    5339              :                                 OutputProcessor::TimeStepType::Zone,
    5340              :                                 OutputProcessor::StoreType::Average,
    5341            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5342            4 :             SetupOutputVariable(state,
    5343              :                                 "Hot Water Equipment Total Heating Energy",
    5344              :                                 Constant::Units::J,
    5345            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).TotGainEnergy,
    5346              :                                 OutputProcessor::TimeStepType::Zone,
    5347              :                                 OutputProcessor::StoreType::Sum,
    5348            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5349            4 :             SetupOutputVariable(state,
    5350              :                                 "Hot Water Equipment Total Heating Rate",
    5351              :                                 Constant::Units::W,
    5352            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).TotGainRate,
    5353              :                                 OutputProcessor::TimeStepType::Zone,
    5354              :                                 OutputProcessor::StoreType::Average,
    5355            2 :                                 state.dataHeatBal->ZoneHWEq(hwEqNum).Name);
    5356              :         }
    5357              : 
    5358              :         // Zone total report variables
    5359          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5360          206 :             if (addZoneOutputs(zoneNum)) {
    5361            2 :                 SetupOutputVariable(state,
    5362              :                                     "Zone Hot Water Equipment District Heating Rate",
    5363              :                                     Constant::Units::W,
    5364            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWPower,
    5365              :                                     OutputProcessor::TimeStepType::Zone,
    5366              :                                     OutputProcessor::StoreType::Average,
    5367            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5368            2 :                 SetupOutputVariable(state,
    5369              :                                     "Zone Hot Water Equipment District Heating Energy",
    5370              :                                     Constant::Units::J,
    5371            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWConsump,
    5372              :                                     OutputProcessor::TimeStepType::Zone,
    5373              :                                     OutputProcessor::StoreType::Sum,
    5374            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5375              : 
    5376            2 :                 SetupOutputVariable(state,
    5377              :                                     "Zone Hot Water Equipment Radiant Heating Energy",
    5378              :                                     Constant::Units::J,
    5379            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWRadGain,
    5380              :                                     OutputProcessor::TimeStepType::Zone,
    5381              :                                     OutputProcessor::StoreType::Sum,
    5382            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5383            2 :                 SetupOutputVariable(state,
    5384              :                                     "Zone Hot Water Equipment Radiant Heating Rate",
    5385              :                                     Constant::Units::W,
    5386            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWRadGainRate,
    5387              :                                     OutputProcessor::TimeStepType::Zone,
    5388              :                                     OutputProcessor::StoreType::Average,
    5389            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5390            2 :                 SetupOutputVariable(state,
    5391              :                                     "Zone Hot Water Equipment Convective Heating Energy",
    5392              :                                     Constant::Units::J,
    5393            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWConGain,
    5394              :                                     OutputProcessor::TimeStepType::Zone,
    5395              :                                     OutputProcessor::StoreType::Sum,
    5396            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5397            2 :                 SetupOutputVariable(state,
    5398              :                                     "Zone Hot Water Equipment Convective Heating Rate",
    5399              :                                     Constant::Units::W,
    5400            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWConGainRate,
    5401              :                                     OutputProcessor::TimeStepType::Zone,
    5402              :                                     OutputProcessor::StoreType::Average,
    5403            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5404            2 :                 SetupOutputVariable(state,
    5405              :                                     "Zone Hot Water Equipment Latent Gain Energy",
    5406              :                                     Constant::Units::J,
    5407            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLatGain,
    5408              :                                     OutputProcessor::TimeStepType::Zone,
    5409              :                                     OutputProcessor::StoreType::Sum,
    5410            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5411            2 :                 SetupOutputVariable(state,
    5412              :                                     "Zone Hot Water Equipment Latent Gain Rate",
    5413              :                                     Constant::Units::W,
    5414            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLatGainRate,
    5415              :                                     OutputProcessor::TimeStepType::Zone,
    5416              :                                     OutputProcessor::StoreType::Average,
    5417            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5418            2 :                 SetupOutputVariable(state,
    5419              :                                     "Zone Hot Water Equipment Lost Heat Energy",
    5420              :                                     Constant::Units::J,
    5421            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLost,
    5422              :                                     OutputProcessor::TimeStepType::Zone,
    5423              :                                     OutputProcessor::StoreType::Sum,
    5424            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5425            2 :                 SetupOutputVariable(state,
    5426              :                                     "Zone Hot Water Equipment Lost Heat Rate",
    5427              :                                     Constant::Units::W,
    5428            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWLostRate,
    5429              :                                     OutputProcessor::TimeStepType::Zone,
    5430              :                                     OutputProcessor::StoreType::Average,
    5431            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5432            2 :                 SetupOutputVariable(state,
    5433              :                                     "Zone Hot Water Equipment Total Heating Energy",
    5434              :                                     Constant::Units::J,
    5435            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWTotGain,
    5436              :                                     OutputProcessor::TimeStepType::Zone,
    5437              :                                     OutputProcessor::StoreType::Sum,
    5438            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5439            2 :                 SetupOutputVariable(state,
    5440              :                                     "Zone Hot Water Equipment Total Heating Rate",
    5441              :                                     Constant::Units::W,
    5442            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).HWTotGainRate,
    5443              :                                     OutputProcessor::TimeStepType::Zone,
    5444              :                                     OutputProcessor::StoreType::Average,
    5445            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5446              :             }
    5447              :             // Reset zone output flag
    5448          206 :             addZoneOutputs(zoneNum) = false;
    5449              :         }
    5450              : 
    5451              :         // Space total report variables
    5452          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    5453          224 :             if (addSpaceOutputs(spaceNum)) {
    5454            4 :                 SetupOutputVariable(state,
    5455              :                                     "Space Hot Water Equipment District Heating Rate",
    5456              :                                     Constant::Units::W,
    5457            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWPower,
    5458              :                                     OutputProcessor::TimeStepType::Zone,
    5459              :                                     OutputProcessor::StoreType::Average,
    5460            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5461            4 :                 SetupOutputVariable(state,
    5462              :                                     "Space Hot Water Equipment District Heating Energy",
    5463              :                                     Constant::Units::J,
    5464            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWConsump,
    5465              :                                     OutputProcessor::TimeStepType::Zone,
    5466              :                                     OutputProcessor::StoreType::Sum,
    5467            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5468              : 
    5469            4 :                 SetupOutputVariable(state,
    5470              :                                     "Space Hot Water Equipment Radiant Heating Energy",
    5471              :                                     Constant::Units::J,
    5472            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWRadGain,
    5473              :                                     OutputProcessor::TimeStepType::Zone,
    5474              :                                     OutputProcessor::StoreType::Sum,
    5475            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5476            4 :                 SetupOutputVariable(state,
    5477              :                                     "Space Hot Water Equipment Radiant Heating Rate",
    5478              :                                     Constant::Units::W,
    5479            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWRadGainRate,
    5480              :                                     OutputProcessor::TimeStepType::Zone,
    5481              :                                     OutputProcessor::StoreType::Average,
    5482            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5483            4 :                 SetupOutputVariable(state,
    5484              :                                     "Space Hot Water Equipment Convective Heating Energy",
    5485              :                                     Constant::Units::J,
    5486            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWConGain,
    5487              :                                     OutputProcessor::TimeStepType::Zone,
    5488              :                                     OutputProcessor::StoreType::Sum,
    5489            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5490            4 :                 SetupOutputVariable(state,
    5491              :                                     "Space Hot Water Equipment Convective Heating Rate",
    5492              :                                     Constant::Units::W,
    5493            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWConGainRate,
    5494              :                                     OutputProcessor::TimeStepType::Zone,
    5495              :                                     OutputProcessor::StoreType::Average,
    5496            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5497            4 :                 SetupOutputVariable(state,
    5498              :                                     "Space Hot Water Equipment Latent Gain Energy",
    5499              :                                     Constant::Units::J,
    5500            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLatGain,
    5501              :                                     OutputProcessor::TimeStepType::Zone,
    5502              :                                     OutputProcessor::StoreType::Sum,
    5503            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5504            4 :                 SetupOutputVariable(state,
    5505              :                                     "Space Hot Water Equipment Latent Gain Rate",
    5506              :                                     Constant::Units::W,
    5507            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLatGainRate,
    5508              :                                     OutputProcessor::TimeStepType::Zone,
    5509              :                                     OutputProcessor::StoreType::Average,
    5510            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5511            4 :                 SetupOutputVariable(state,
    5512              :                                     "Space Hot Water Equipment Lost Heat Energy",
    5513              :                                     Constant::Units::J,
    5514            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLost,
    5515              :                                     OutputProcessor::TimeStepType::Zone,
    5516              :                                     OutputProcessor::StoreType::Sum,
    5517            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5518            4 :                 SetupOutputVariable(state,
    5519              :                                     "Space Hot Water Equipment Lost Heat Rate",
    5520              :                                     Constant::Units::W,
    5521            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWLostRate,
    5522              :                                     OutputProcessor::TimeStepType::Zone,
    5523              :                                     OutputProcessor::StoreType::Average,
    5524            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5525            4 :                 SetupOutputVariable(state,
    5526              :                                     "Space Hot Water Equipment Total Heating Energy",
    5527              :                                     Constant::Units::J,
    5528            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWTotGain,
    5529              :                                     OutputProcessor::TimeStepType::Zone,
    5530              :                                     OutputProcessor::StoreType::Sum,
    5531            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5532            4 :                 SetupOutputVariable(state,
    5533              :                                     "Space Hot Water Equipment Total Heating Rate",
    5534              :                                     Constant::Units::W,
    5535            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).HWTotGainRate,
    5536              :                                     OutputProcessor::TimeStepType::Zone,
    5537              :                                     OutputProcessor::StoreType::Average,
    5538            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5539              :             }
    5540              :             // Reset space output flag
    5541          224 :             addSpaceOutputs(spaceNum) = false;
    5542              :         }
    5543              : 
    5544              :         // Object report variables
    5545          169 :         for (int stmEqNum = 1; stmEqNum <= state.dataHeatBal->TotStmEquip; ++stmEqNum) {
    5546              :             // Set flags for zone and space total report variables
    5547            2 :             addZoneOutputs(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr) = true;
    5548            2 :             addSpaceOutputs(state.dataHeatBal->ZoneSteamEq(stmEqNum).spaceIndex) = true;
    5549            4 :             SetupOutputVariable(state,
    5550              :                                 "Steam Equipment District Heating Rate",
    5551              :                                 Constant::Units::W,
    5552            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Power,
    5553              :                                 OutputProcessor::TimeStepType::Zone,
    5554              :                                 OutputProcessor::StoreType::Average,
    5555            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5556            4 :             SetupOutputVariable(state,
    5557              :                                 "Steam Equipment District Heating Energy",
    5558              :                                 Constant::Units::J,
    5559            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Consumption,
    5560              :                                 OutputProcessor::TimeStepType::Zone,
    5561              :                                 OutputProcessor::StoreType::Sum,
    5562            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name,
    5563              :                                 Constant::eResource::DistrictHeatingSteam,
    5564              :                                 OutputProcessor::Group::Building,
    5565              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    5566            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).EndUseSubcategory,
    5567            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr).Name,
    5568            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr).Multiplier,
    5569            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneSteamEq(stmEqNum).ZonePtr).ListMultiplier,
    5570            2 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneSteamEq(stmEqNum).spaceIndex).spaceType);
    5571              : 
    5572            4 :             SetupOutputVariable(state,
    5573              :                                 "Steam Equipment Radiant Heating Energy",
    5574              :                                 Constant::Units::J,
    5575            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).RadGainEnergy,
    5576              :                                 OutputProcessor::TimeStepType::Zone,
    5577              :                                 OutputProcessor::StoreType::Sum,
    5578            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5579            4 :             SetupOutputVariable(state,
    5580              :                                 "Steam Equipment Radiant Heating Rate",
    5581              :                                 Constant::Units::W,
    5582            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).RadGainRate,
    5583              :                                 OutputProcessor::TimeStepType::Zone,
    5584              :                                 OutputProcessor::StoreType::Average,
    5585            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5586            4 :             SetupOutputVariable(state,
    5587              :                                 "Steam Equipment Convective Heating Energy",
    5588              :                                 Constant::Units::J,
    5589            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).ConGainEnergy,
    5590              :                                 OutputProcessor::TimeStepType::Zone,
    5591              :                                 OutputProcessor::StoreType::Sum,
    5592            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5593            4 :             SetupOutputVariable(state,
    5594              :                                 "Steam Equipment Convective Heating Rate",
    5595              :                                 Constant::Units::W,
    5596            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).ConGainRate,
    5597              :                                 OutputProcessor::TimeStepType::Zone,
    5598              :                                 OutputProcessor::StoreType::Average,
    5599            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5600            4 :             SetupOutputVariable(state,
    5601              :                                 "Steam Equipment Latent Gain Energy",
    5602              :                                 Constant::Units::J,
    5603            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LatGainEnergy,
    5604              :                                 OutputProcessor::TimeStepType::Zone,
    5605              :                                 OutputProcessor::StoreType::Sum,
    5606            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5607            4 :             SetupOutputVariable(state,
    5608              :                                 "Steam Equipment Latent Gain Rate",
    5609              :                                 Constant::Units::W,
    5610            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LatGainRate,
    5611              :                                 OutputProcessor::TimeStepType::Zone,
    5612              :                                 OutputProcessor::StoreType::Average,
    5613            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5614            4 :             SetupOutputVariable(state,
    5615              :                                 "Steam Equipment Lost Heat Energy",
    5616              :                                 Constant::Units::J,
    5617            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LostEnergy,
    5618              :                                 OutputProcessor::TimeStepType::Zone,
    5619              :                                 OutputProcessor::StoreType::Sum,
    5620            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5621            4 :             SetupOutputVariable(state,
    5622              :                                 "Steam Equipment Lost Heat Rate",
    5623              :                                 Constant::Units::W,
    5624            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).LostRate,
    5625              :                                 OutputProcessor::TimeStepType::Zone,
    5626              :                                 OutputProcessor::StoreType::Average,
    5627            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5628            4 :             SetupOutputVariable(state,
    5629              :                                 "Steam Equipment Total Heating Energy",
    5630              :                                 Constant::Units::J,
    5631            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).TotGainEnergy,
    5632              :                                 OutputProcessor::TimeStepType::Zone,
    5633              :                                 OutputProcessor::StoreType::Sum,
    5634            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5635            4 :             SetupOutputVariable(state,
    5636              :                                 "Steam Equipment Total Heating Rate",
    5637              :                                 Constant::Units::W,
    5638            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).TotGainRate,
    5639              :                                 OutputProcessor::TimeStepType::Zone,
    5640              :                                 OutputProcessor::StoreType::Average,
    5641            2 :                                 state.dataHeatBal->ZoneSteamEq(stmEqNum).Name);
    5642              :         }
    5643              : 
    5644              :         // Zone total report variables
    5645          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5646          206 :             if (addZoneOutputs(zoneNum)) {
    5647            2 :                 SetupOutputVariable(state,
    5648              :                                     "Zone Steam Equipment District Heating Rate",
    5649              :                                     Constant::Units::W,
    5650            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamPower,
    5651              :                                     OutputProcessor::TimeStepType::Zone,
    5652              :                                     OutputProcessor::StoreType::Average,
    5653            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5654            2 :                 SetupOutputVariable(state,
    5655              :                                     "Zone Steam Equipment District Heating Energy",
    5656              :                                     Constant::Units::J,
    5657            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamConsump,
    5658              :                                     OutputProcessor::TimeStepType::Zone,
    5659              :                                     OutputProcessor::StoreType::Sum,
    5660            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5661              : 
    5662            2 :                 SetupOutputVariable(state,
    5663              :                                     "Zone Steam Equipment Radiant Heating Energy",
    5664              :                                     Constant::Units::J,
    5665            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamRadGain,
    5666              :                                     OutputProcessor::TimeStepType::Zone,
    5667              :                                     OutputProcessor::StoreType::Sum,
    5668            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5669            2 :                 SetupOutputVariable(state,
    5670              :                                     "Zone Steam Equipment Radiant Heating Rate",
    5671              :                                     Constant::Units::W,
    5672            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamRadGainRate,
    5673              :                                     OutputProcessor::TimeStepType::Zone,
    5674              :                                     OutputProcessor::StoreType::Average,
    5675            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5676            2 :                 SetupOutputVariable(state,
    5677              :                                     "Zone Steam Equipment Convective Heating Energy",
    5678              :                                     Constant::Units::J,
    5679            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamConGain,
    5680              :                                     OutputProcessor::TimeStepType::Zone,
    5681              :                                     OutputProcessor::StoreType::Sum,
    5682            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5683            2 :                 SetupOutputVariable(state,
    5684              :                                     "Zone Steam Equipment Convective Heating Rate",
    5685              :                                     Constant::Units::W,
    5686            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamConGainRate,
    5687              :                                     OutputProcessor::TimeStepType::Zone,
    5688              :                                     OutputProcessor::StoreType::Average,
    5689            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5690            2 :                 SetupOutputVariable(state,
    5691              :                                     "Zone Steam Equipment Latent Gain Energy",
    5692              :                                     Constant::Units::J,
    5693            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLatGain,
    5694              :                                     OutputProcessor::TimeStepType::Zone,
    5695              :                                     OutputProcessor::StoreType::Sum,
    5696            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5697            2 :                 SetupOutputVariable(state,
    5698              :                                     "Zone Steam Equipment Latent Gain Rate",
    5699              :                                     Constant::Units::W,
    5700            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLatGainRate,
    5701              :                                     OutputProcessor::TimeStepType::Zone,
    5702              :                                     OutputProcessor::StoreType::Average,
    5703            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5704            2 :                 SetupOutputVariable(state,
    5705              :                                     "Zone Steam Equipment Lost Heat Energy",
    5706              :                                     Constant::Units::J,
    5707            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLost,
    5708              :                                     OutputProcessor::TimeStepType::Zone,
    5709              :                                     OutputProcessor::StoreType::Sum,
    5710            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5711            2 :                 SetupOutputVariable(state,
    5712              :                                     "Zone Steam Equipment Lost Heat Rate",
    5713              :                                     Constant::Units::W,
    5714            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamLostRate,
    5715              :                                     OutputProcessor::TimeStepType::Zone,
    5716              :                                     OutputProcessor::StoreType::Average,
    5717            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5718            2 :                 SetupOutputVariable(state,
    5719              :                                     "Zone Steam Equipment Total Heating Energy",
    5720              :                                     Constant::Units::J,
    5721            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamTotGain,
    5722              :                                     OutputProcessor::TimeStepType::Zone,
    5723              :                                     OutputProcessor::StoreType::Sum,
    5724            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5725            2 :                 SetupOutputVariable(state,
    5726              :                                     "Zone Steam Equipment Total Heating Rate",
    5727              :                                     Constant::Units::W,
    5728            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).SteamTotGainRate,
    5729              :                                     OutputProcessor::TimeStepType::Zone,
    5730              :                                     OutputProcessor::StoreType::Average,
    5731            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5732              :             }
    5733              :             // Reset zone output flag
    5734          206 :             addZoneOutputs(zoneNum) = false;
    5735              :         }
    5736              : 
    5737              :         // Space total report variables
    5738          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    5739          224 :             if (addSpaceOutputs(spaceNum)) {
    5740            4 :                 SetupOutputVariable(state,
    5741              :                                     "Space Steam Equipment District Heating Rate",
    5742              :                                     Constant::Units::W,
    5743            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamPower,
    5744              :                                     OutputProcessor::TimeStepType::Zone,
    5745              :                                     OutputProcessor::StoreType::Average,
    5746            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5747            4 :                 SetupOutputVariable(state,
    5748              :                                     "Space Steam Equipment District Heating Energy",
    5749              :                                     Constant::Units::J,
    5750            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamConsump,
    5751              :                                     OutputProcessor::TimeStepType::Zone,
    5752              :                                     OutputProcessor::StoreType::Sum,
    5753            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5754              : 
    5755            4 :                 SetupOutputVariable(state,
    5756              :                                     "Space Steam Equipment Radiant Heating Energy",
    5757              :                                     Constant::Units::J,
    5758            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamRadGain,
    5759              :                                     OutputProcessor::TimeStepType::Zone,
    5760              :                                     OutputProcessor::StoreType::Sum,
    5761            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5762            4 :                 SetupOutputVariable(state,
    5763              :                                     "Space Steam Equipment Radiant Heating Rate",
    5764              :                                     Constant::Units::W,
    5765            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamRadGainRate,
    5766              :                                     OutputProcessor::TimeStepType::Zone,
    5767              :                                     OutputProcessor::StoreType::Average,
    5768            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5769            4 :                 SetupOutputVariable(state,
    5770              :                                     "Space Steam Equipment Convective Heating Energy",
    5771              :                                     Constant::Units::J,
    5772            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamConGain,
    5773              :                                     OutputProcessor::TimeStepType::Zone,
    5774              :                                     OutputProcessor::StoreType::Sum,
    5775            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5776            4 :                 SetupOutputVariable(state,
    5777              :                                     "Space Steam Equipment Convective Heating Rate",
    5778              :                                     Constant::Units::W,
    5779            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamConGainRate,
    5780              :                                     OutputProcessor::TimeStepType::Zone,
    5781              :                                     OutputProcessor::StoreType::Average,
    5782            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5783            4 :                 SetupOutputVariable(state,
    5784              :                                     "Space Steam Equipment Latent Gain Energy",
    5785              :                                     Constant::Units::J,
    5786            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLatGain,
    5787              :                                     OutputProcessor::TimeStepType::Zone,
    5788              :                                     OutputProcessor::StoreType::Sum,
    5789            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5790            4 :                 SetupOutputVariable(state,
    5791              :                                     "Space Steam Equipment Latent Gain Rate",
    5792              :                                     Constant::Units::W,
    5793            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLatGainRate,
    5794              :                                     OutputProcessor::TimeStepType::Zone,
    5795              :                                     OutputProcessor::StoreType::Average,
    5796            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5797            4 :                 SetupOutputVariable(state,
    5798              :                                     "Space Steam Equipment Lost Heat Energy",
    5799              :                                     Constant::Units::J,
    5800            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLost,
    5801              :                                     OutputProcessor::TimeStepType::Zone,
    5802              :                                     OutputProcessor::StoreType::Sum,
    5803            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5804            4 :                 SetupOutputVariable(state,
    5805              :                                     "Space Steam Equipment Lost Heat Rate",
    5806              :                                     Constant::Units::W,
    5807            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamLostRate,
    5808              :                                     OutputProcessor::TimeStepType::Zone,
    5809              :                                     OutputProcessor::StoreType::Average,
    5810            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5811            4 :                 SetupOutputVariable(state,
    5812              :                                     "Space Steam Equipment Total Heating Energy",
    5813              :                                     Constant::Units::J,
    5814            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamTotGain,
    5815              :                                     OutputProcessor::TimeStepType::Zone,
    5816              :                                     OutputProcessor::StoreType::Sum,
    5817            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5818            4 :                 SetupOutputVariable(state,
    5819              :                                     "Space Steam Equipment Total Heating Rate",
    5820              :                                     Constant::Units::W,
    5821            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).SteamTotGainRate,
    5822              :                                     OutputProcessor::TimeStepType::Zone,
    5823              :                                     OutputProcessor::StoreType::Average,
    5824            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    5825              :             }
    5826              :             // Reset space output flag
    5827          224 :             addSpaceOutputs(spaceNum) = false;
    5828              :         }
    5829              : 
    5830              :         // Object report variables
    5831          219 :         for (int othEqNum = 1; othEqNum <= state.dataHeatBal->TotOthEquip; ++othEqNum) {
    5832              :             // Set flags for zone and space total report variables
    5833           52 :             auto &zoneOtherEq = state.dataHeatBal->ZoneOtherEq(othEqNum);
    5834              : 
    5835           52 :             addZoneOutputs(zoneOtherEq.ZonePtr) = true;
    5836           52 :             addSpaceOutputs(zoneOtherEq.spaceIndex) = true;
    5837           52 :             if (zoneOtherEq.OtherEquipFuelType != Constant::eFuel::Invalid && zoneOtherEq.OtherEquipFuelType != Constant::eFuel::None) {
    5838           15 :                 SetupOutputVariable(state,
    5839           10 :                                     format("Other Equipment {} Rate", Constant::eFuelNames[(int)zoneOtherEq.OtherEquipFuelType]),
    5840              :                                     Constant::Units::W,
    5841            5 :                                     zoneOtherEq.Power,
    5842              :                                     OutputProcessor::TimeStepType::Zone,
    5843              :                                     OutputProcessor::StoreType::Average,
    5844            5 :                                     zoneOtherEq.Name);
    5845           10 :                 SetupOutputVariable(state,
    5846           10 :                                     format("Other Equipment {} Energy", Constant::eFuelNames[(int)zoneOtherEq.OtherEquipFuelType]),
    5847              :                                     Constant::Units::J,
    5848            5 :                                     zoneOtherEq.Consumption,
    5849              :                                     OutputProcessor::TimeStepType::Zone,
    5850              :                                     OutputProcessor::StoreType::Sum,
    5851            5 :                                     zoneOtherEq.Name,
    5852            5 :                                     Constant::eFuel2eResource[(int)zoneOtherEq.OtherEquipFuelType],
    5853              :                                     OutputProcessor::Group::Building,
    5854              :                                     OutputProcessor::EndUseCat::InteriorEquipment,
    5855              :                                     zoneOtherEq.EndUseSubcategory,
    5856            5 :                                     state.dataHeatBal->Zone(zoneOtherEq.ZonePtr).Name,
    5857            5 :                                     state.dataHeatBal->Zone(zoneOtherEq.ZonePtr).Multiplier,
    5858            5 :                                     state.dataHeatBal->Zone(zoneOtherEq.ZonePtr).ListMultiplier,
    5859            5 :                                     state.dataHeatBal->space(zoneOtherEq.spaceIndex).spaceType);
    5860              :             }
    5861              : 
    5862          104 :             SetupOutputVariable(state,
    5863              :                                 "Other Equipment Radiant Heating Energy",
    5864              :                                 Constant::Units::J,
    5865           52 :                                 zoneOtherEq.RadGainEnergy,
    5866              :                                 OutputProcessor::TimeStepType::Zone,
    5867              :                                 OutputProcessor::StoreType::Sum,
    5868           52 :                                 zoneOtherEq.Name);
    5869          104 :             SetupOutputVariable(state,
    5870              :                                 "Other Equipment Radiant Heating Rate",
    5871              :                                 Constant::Units::W,
    5872           52 :                                 zoneOtherEq.RadGainRate,
    5873              :                                 OutputProcessor::TimeStepType::Zone,
    5874              :                                 OutputProcessor::StoreType::Average,
    5875           52 :                                 zoneOtherEq.Name);
    5876          104 :             SetupOutputVariable(state,
    5877              :                                 "Other Equipment Convective Heating Energy",
    5878              :                                 Constant::Units::J,
    5879           52 :                                 zoneOtherEq.ConGainEnergy,
    5880              :                                 OutputProcessor::TimeStepType::Zone,
    5881              :                                 OutputProcessor::StoreType::Sum,
    5882           52 :                                 zoneOtherEq.Name);
    5883          104 :             SetupOutputVariable(state,
    5884              :                                 "Other Equipment Convective Heating Rate",
    5885              :                                 Constant::Units::W,
    5886           52 :                                 zoneOtherEq.ConGainRate,
    5887              :                                 OutputProcessor::TimeStepType::Zone,
    5888              :                                 OutputProcessor::StoreType::Average,
    5889           52 :                                 zoneOtherEq.Name);
    5890          104 :             SetupOutputVariable(state,
    5891              :                                 "Other Equipment Latent Gain Energy",
    5892              :                                 Constant::Units::J,
    5893           52 :                                 zoneOtherEq.LatGainEnergy,
    5894              :                                 OutputProcessor::TimeStepType::Zone,
    5895              :                                 OutputProcessor::StoreType::Sum,
    5896           52 :                                 zoneOtherEq.Name);
    5897          104 :             SetupOutputVariable(state,
    5898              :                                 "Other Equipment Latent Gain Rate",
    5899              :                                 Constant::Units::W,
    5900           52 :                                 zoneOtherEq.LatGainRate,
    5901              :                                 OutputProcessor::TimeStepType::Zone,
    5902              :                                 OutputProcessor::StoreType::Average,
    5903           52 :                                 zoneOtherEq.Name);
    5904          104 :             SetupOutputVariable(state,
    5905              :                                 "Other Equipment Lost Heat Energy",
    5906              :                                 Constant::Units::J,
    5907           52 :                                 zoneOtherEq.LostEnergy,
    5908              :                                 OutputProcessor::TimeStepType::Zone,
    5909              :                                 OutputProcessor::StoreType::Sum,
    5910           52 :                                 zoneOtherEq.Name);
    5911          104 :             SetupOutputVariable(state,
    5912              :                                 "Other Equipment Lost Heat Rate",
    5913              :                                 Constant::Units::W,
    5914           52 :                                 zoneOtherEq.LostRate,
    5915              :                                 OutputProcessor::TimeStepType::Zone,
    5916              :                                 OutputProcessor::StoreType::Average,
    5917           52 :                                 zoneOtherEq.Name);
    5918          104 :             SetupOutputVariable(state,
    5919              :                                 "Other Equipment Total Heating Energy",
    5920              :                                 Constant::Units::J,
    5921           52 :                                 zoneOtherEq.TotGainEnergy,
    5922              :                                 OutputProcessor::TimeStepType::Zone,
    5923              :                                 OutputProcessor::StoreType::Sum,
    5924           52 :                                 zoneOtherEq.Name);
    5925          104 :             SetupOutputVariable(state,
    5926              :                                 "Other Equipment Total Heating Rate",
    5927              :                                 Constant::Units::W,
    5928           52 :                                 zoneOtherEq.TotGainRate,
    5929              :                                 OutputProcessor::TimeStepType::Zone,
    5930              :                                 OutputProcessor::StoreType::Average,
    5931           52 :                                 zoneOtherEq.Name);
    5932              :         }
    5933              : 
    5934              :         // Zone total report variables
    5935          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5936          206 :             if (addZoneOutputs(zoneNum)) {
    5937           28 :                 for (size_t i = 0; i < state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums.size(); ++i) {
    5938            3 :                     Constant::eFuel fuelType = state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums[i];
    5939            3 :                     if (fuelType == Constant::eFuel::Invalid || fuelType == Constant::eFuel::None) {
    5940            0 :                         continue;
    5941              :                     }
    5942              : 
    5943            3 :                     std::string_view fuelName = Constant::eFuelNames[(int)state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums[i]];
    5944              : 
    5945            9 :                     SetupOutputVariable(state,
    5946            6 :                                         format("Zone Other Equipment {} Rate", fuelName),
    5947              :                                         Constant::Units::W,
    5948            3 :                                         state.dataHeatBal->ZoneRpt(zoneNum).OtherPower[(int)fuelType],
    5949              :                                         OutputProcessor::TimeStepType::Zone,
    5950              :                                         OutputProcessor::StoreType::Average,
    5951            3 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    5952            9 :                     SetupOutputVariable(state,
    5953            6 :                                         format("Zone Other Equipment {} Energy", fuelName),
    5954              :                                         Constant::Units::J,
    5955            3 :                                         state.dataHeatBal->ZoneRpt(zoneNum).OtherConsump[(int)fuelType],
    5956              :                                         OutputProcessor::TimeStepType::Zone,
    5957              :                                         OutputProcessor::StoreType::Sum,
    5958            3 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    5959              :                 }
    5960              : 
    5961           50 :                 SetupOutputVariable(state,
    5962              :                                     "Zone Other Equipment Radiant Heating Energy",
    5963              :                                     Constant::Units::J,
    5964           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherRadGain,
    5965              :                                     OutputProcessor::TimeStepType::Zone,
    5966              :                                     OutputProcessor::StoreType::Sum,
    5967           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5968           50 :                 SetupOutputVariable(state,
    5969              :                                     "Zone Other Equipment Radiant Heating Rate",
    5970              :                                     Constant::Units::W,
    5971           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherRadGainRate,
    5972              :                                     OutputProcessor::TimeStepType::Zone,
    5973              :                                     OutputProcessor::StoreType::Average,
    5974           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5975           50 :                 SetupOutputVariable(state,
    5976              :                                     "Zone Other Equipment Convective Heating Energy",
    5977              :                                     Constant::Units::J,
    5978           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherConGain,
    5979              :                                     OutputProcessor::TimeStepType::Zone,
    5980              :                                     OutputProcessor::StoreType::Sum,
    5981           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5982           50 :                 SetupOutputVariable(state,
    5983              :                                     "Zone Other Equipment Convective Heating Rate",
    5984              :                                     Constant::Units::W,
    5985           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherConGainRate,
    5986              :                                     OutputProcessor::TimeStepType::Zone,
    5987              :                                     OutputProcessor::StoreType::Average,
    5988           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5989           50 :                 SetupOutputVariable(state,
    5990              :                                     "Zone Other Equipment Latent Gain Energy",
    5991              :                                     Constant::Units::J,
    5992           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLatGain,
    5993              :                                     OutputProcessor::TimeStepType::Zone,
    5994              :                                     OutputProcessor::StoreType::Sum,
    5995           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    5996           50 :                 SetupOutputVariable(state,
    5997              :                                     "Zone Other Equipment Latent Gain Rate",
    5998              :                                     Constant::Units::W,
    5999           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLatGainRate,
    6000              :                                     OutputProcessor::TimeStepType::Zone,
    6001              :                                     OutputProcessor::StoreType::Average,
    6002           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6003           50 :                 SetupOutputVariable(state,
    6004              :                                     "Zone Other Equipment Lost Heat Energy",
    6005              :                                     Constant::Units::J,
    6006           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLost,
    6007              :                                     OutputProcessor::TimeStepType::Zone,
    6008              :                                     OutputProcessor::StoreType::Sum,
    6009           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6010           50 :                 SetupOutputVariable(state,
    6011              :                                     "Zone Other Equipment Lost Heat Rate",
    6012              :                                     Constant::Units::W,
    6013           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherLostRate,
    6014              :                                     OutputProcessor::TimeStepType::Zone,
    6015              :                                     OutputProcessor::StoreType::Average,
    6016           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6017           50 :                 SetupOutputVariable(state,
    6018              :                                     "Zone Other Equipment Total Heating Energy",
    6019              :                                     Constant::Units::J,
    6020           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherTotGain,
    6021              :                                     OutputProcessor::TimeStepType::Zone,
    6022              :                                     OutputProcessor::StoreType::Sum,
    6023           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6024           50 :                 SetupOutputVariable(state,
    6025              :                                     "Zone Other Equipment Total Heating Rate",
    6026              :                                     Constant::Units::W,
    6027           25 :                                     state.dataHeatBal->ZoneRpt(zoneNum).OtherTotGainRate,
    6028              :                                     OutputProcessor::TimeStepType::Zone,
    6029              :                                     OutputProcessor::StoreType::Average,
    6030           25 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6031              :             }
    6032              :             // Reset zone output flag
    6033          206 :             addZoneOutputs(zoneNum) = false;
    6034              :         }
    6035              : 
    6036              :         // Space total report variables
    6037          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    6038          224 :             if (addSpaceOutputs(spaceNum)) {
    6039           31 :                 for (size_t i = 0; i < state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums.size(); ++i) {
    6040            5 :                     Constant::eFuel fuelType = state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums[i];
    6041            5 :                     if (fuelType == Constant::eFuel::Invalid || fuelType == Constant::eFuel::None) {
    6042            0 :                         continue;
    6043              :                     }
    6044              : 
    6045           15 :                     SetupOutputVariable(state,
    6046           10 :                                         format("Space Other Equipment {} Rate", Constant::eFuelNames[(int)fuelType]),
    6047              :                                         Constant::Units::W,
    6048            5 :                                         state.dataHeatBal->spaceRpt(spaceNum).OtherPower[(int)fuelType],
    6049              :                                         OutputProcessor::TimeStepType::Zone,
    6050              :                                         OutputProcessor::StoreType::Average,
    6051            5 :                                         state.dataHeatBal->space(spaceNum).Name);
    6052           15 :                     SetupOutputVariable(state,
    6053           10 :                                         format("Space Other Equipment {} Energy", Constant::eFuelNames[(int)fuelType]),
    6054              :                                         Constant::Units::J,
    6055            5 :                                         state.dataHeatBal->spaceRpt(spaceNum).OtherConsump[(int)fuelType],
    6056              :                                         OutputProcessor::TimeStepType::Zone,
    6057              :                                         OutputProcessor::StoreType::Sum,
    6058            5 :                                         state.dataHeatBal->space(spaceNum).Name);
    6059              :                 }
    6060              : 
    6061           52 :                 SetupOutputVariable(state,
    6062              :                                     "Space Other Equipment Radiant Heating Energy",
    6063              :                                     Constant::Units::J,
    6064           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherRadGain,
    6065              :                                     OutputProcessor::TimeStepType::Zone,
    6066              :                                     OutputProcessor::StoreType::Sum,
    6067           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6068           52 :                 SetupOutputVariable(state,
    6069              :                                     "Space Other Equipment Radiant Heating Rate",
    6070              :                                     Constant::Units::W,
    6071           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherRadGainRate,
    6072              :                                     OutputProcessor::TimeStepType::Zone,
    6073              :                                     OutputProcessor::StoreType::Average,
    6074           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6075           52 :                 SetupOutputVariable(state,
    6076              :                                     "Space Other Equipment Convective Heating Energy",
    6077              :                                     Constant::Units::J,
    6078           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherConGain,
    6079              :                                     OutputProcessor::TimeStepType::Zone,
    6080              :                                     OutputProcessor::StoreType::Sum,
    6081           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6082           52 :                 SetupOutputVariable(state,
    6083              :                                     "Space Other Equipment Convective Heating Rate",
    6084              :                                     Constant::Units::W,
    6085           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherConGainRate,
    6086              :                                     OutputProcessor::TimeStepType::Zone,
    6087              :                                     OutputProcessor::StoreType::Average,
    6088           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6089           52 :                 SetupOutputVariable(state,
    6090              :                                     "Space Other Equipment Latent Gain Energy",
    6091              :                                     Constant::Units::J,
    6092           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLatGain,
    6093              :                                     OutputProcessor::TimeStepType::Zone,
    6094              :                                     OutputProcessor::StoreType::Sum,
    6095           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6096           52 :                 SetupOutputVariable(state,
    6097              :                                     "Space Other Equipment Latent Gain Rate",
    6098              :                                     Constant::Units::W,
    6099           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLatGainRate,
    6100              :                                     OutputProcessor::TimeStepType::Zone,
    6101              :                                     OutputProcessor::StoreType::Average,
    6102           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6103           52 :                 SetupOutputVariable(state,
    6104              :                                     "Space Other Equipment Lost Heat Energy",
    6105              :                                     Constant::Units::J,
    6106           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLost,
    6107              :                                     OutputProcessor::TimeStepType::Zone,
    6108              :                                     OutputProcessor::StoreType::Sum,
    6109           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6110           52 :                 SetupOutputVariable(state,
    6111              :                                     "Space Other Equipment Lost Heat Rate",
    6112              :                                     Constant::Units::W,
    6113           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherLostRate,
    6114              :                                     OutputProcessor::TimeStepType::Zone,
    6115              :                                     OutputProcessor::StoreType::Average,
    6116           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6117           52 :                 SetupOutputVariable(state,
    6118              :                                     "Space Other Equipment Total Heating Energy",
    6119              :                                     Constant::Units::J,
    6120           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherTotGain,
    6121              :                                     OutputProcessor::TimeStepType::Zone,
    6122              :                                     OutputProcessor::StoreType::Sum,
    6123           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6124           52 :                 SetupOutputVariable(state,
    6125              :                                     "Space Other Equipment Total Heating Rate",
    6126              :                                     Constant::Units::W,
    6127           26 :                                     state.dataHeatBal->spaceRpt(spaceNum).OtherTotGainRate,
    6128              :                                     OutputProcessor::TimeStepType::Zone,
    6129              :                                     OutputProcessor::StoreType::Average,
    6130           26 :                                     state.dataHeatBal->space(spaceNum).Name);
    6131              :             }
    6132              :             // Reset space output flag
    6133          224 :             addSpaceOutputs(spaceNum) = false;
    6134              :         }
    6135              :         // Object report variables
    6136          179 :         for (int itEqNum = 1; itEqNum <= state.dataHeatBal->TotITEquip; ++itEqNum) {
    6137              :             // Set flags for zone and space total report variables
    6138           12 :             addZoneOutputs(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr) = true;
    6139           12 :             addSpaceOutputs(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex) = true;
    6140              : 
    6141           12 :             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           96 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6151          168 :                 SetupOutputVariable(state,
    6152           84 :                                     PowerOutputVariableStrings[i],
    6153              :                                     Constant::Units::W,
    6154           84 :                                     state.dataHeatBal->ZoneITEq(itEqNum).PowerRpt[i],
    6155              :                                     OutputProcessor::TimeStepType::Zone,
    6156              :                                     OutputProcessor::StoreType::Average,
    6157           84 :                                     state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6158              :             }
    6159              : 
    6160           24 :             SetupOutputVariable(state,
    6161              :                                 "ITE CPU Electricity Energy",
    6162              :                                 Constant::Units::J,
    6163           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::CPU],
    6164              :                                 OutputProcessor::TimeStepType::Zone,
    6165              :                                 OutputProcessor::StoreType::Sum,
    6166           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name,
    6167              :                                 Constant::eResource::Electricity,
    6168              :                                 OutputProcessor::Group::Building,
    6169              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6170           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EndUseSubcategoryCPU,
    6171           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Name,
    6172           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Multiplier,
    6173           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).ListMultiplier,
    6174           12 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex).spaceType);
    6175              : 
    6176           24 :             SetupOutputVariable(state,
    6177              :                                 "ITE Fan Electricity Energy",
    6178              :                                 Constant::Units::J,
    6179           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::Fan],
    6180              :                                 OutputProcessor::TimeStepType::Zone,
    6181              :                                 OutputProcessor::StoreType::Sum,
    6182           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name,
    6183              :                                 Constant::eResource::Electricity,
    6184              :                                 OutputProcessor::Group::Building,
    6185              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6186           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EndUseSubcategoryFan,
    6187           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Name,
    6188           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Multiplier,
    6189           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).ListMultiplier,
    6190           12 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex).spaceType);
    6191           24 :             SetupOutputVariable(state,
    6192              :                                 "ITE UPS Electricity Energy",
    6193              :                                 Constant::Units::J,
    6194           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::UPS],
    6195              :                                 OutputProcessor::TimeStepType::Zone,
    6196              :                                 OutputProcessor::StoreType::Sum,
    6197           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name,
    6198              :                                 Constant::eResource::Electricity,
    6199              :                                 OutputProcessor::Group::Building,
    6200              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6201           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EndUseSubcategoryUPS,
    6202           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Name,
    6203           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).Multiplier,
    6204           12 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(itEqNum).ZonePtr).ListMultiplier,
    6205           12 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneITEq(itEqNum).spaceIndex).spaceType);
    6206           24 :             SetupOutputVariable(state,
    6207              :                                 "ITE CPU Electricity Energy at Design Inlet Conditions",
    6208              :                                 Constant::Units::J,
    6209           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::CPUAtDesign],
    6210              :                                 OutputProcessor::TimeStepType::Zone,
    6211              :                                 OutputProcessor::StoreType::Sum,
    6212           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6213           24 :             SetupOutputVariable(state,
    6214              :                                 "ITE Fan Electricity Energy at Design Inlet Conditions",
    6215              :                                 Constant::Units::J,
    6216           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::FanAtDesign],
    6217              :                                 OutputProcessor::TimeStepType::Zone,
    6218              :                                 OutputProcessor::StoreType::Sum,
    6219           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6220           24 :             SetupOutputVariable(state,
    6221              :                                 "ITE UPS Heat Gain to Zone Energy",
    6222              :                                 Constant::Units::J,
    6223           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::UPSGainToZone],
    6224              :                                 OutputProcessor::TimeStepType::Zone,
    6225              :                                 OutputProcessor::StoreType::Sum,
    6226           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6227           24 :             SetupOutputVariable(state,
    6228              :                                 "ITE Total Heat Gain to Zone Energy",
    6229              :                                 Constant::Units::J,
    6230           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).EnergyRpt[(int)PERptVars::ConGainToZone],
    6231              :                                 OutputProcessor::TimeStepType::Zone,
    6232              :                                 OutputProcessor::StoreType::Sum,
    6233           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6234              : 
    6235           24 :             SetupOutputVariable(state,
    6236              :                                 "ITE Standard Density Air Volume Flow Rate",
    6237              :                                 Constant::Units::m3_s,
    6238           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirVolFlowStdDensity,
    6239              :                                 OutputProcessor::TimeStepType::Zone,
    6240              :                                 OutputProcessor::StoreType::Average,
    6241           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6242           24 :             SetupOutputVariable(state,
    6243              :                                 "ITE Current Density Air Volume Flow Rate",
    6244              :                                 Constant::Units::m3_s,
    6245           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirVolFlowCurDensity,
    6246              :                                 OutputProcessor::TimeStepType::Zone,
    6247              :                                 OutputProcessor::StoreType::Average,
    6248           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6249           24 :             SetupOutputVariable(state,
    6250              :                                 "ITE Air Mass Flow Rate",
    6251              :                                 Constant::Units::kg_s,
    6252           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirMassFlow,
    6253              :                                 OutputProcessor::TimeStepType::Zone,
    6254              :                                 OutputProcessor::StoreType::Average,
    6255           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6256           24 :             SetupOutputVariable(state,
    6257              :                                 "ITE Air Inlet Dry-Bulb Temperature",
    6258              :                                 Constant::Units::C,
    6259           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirInletDryBulbT,
    6260              :                                 OutputProcessor::TimeStepType::Zone,
    6261              :                                 OutputProcessor::StoreType::Average,
    6262           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6263           24 :             SetupOutputVariable(state,
    6264              :                                 "ITE Air Inlet Dewpoint Temperature",
    6265              :                                 Constant::Units::C,
    6266           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirInletDewpointT,
    6267              :                                 OutputProcessor::TimeStepType::Zone,
    6268              :                                 OutputProcessor::StoreType::Average,
    6269           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6270           24 :             SetupOutputVariable(state,
    6271              :                                 "ITE Air Inlet Relative Humidity",
    6272              :                                 Constant::Units::Perc,
    6273           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirInletRelHum,
    6274              :                                 OutputProcessor::TimeStepType::Zone,
    6275              :                                 OutputProcessor::StoreType::Average,
    6276           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6277           24 :             SetupOutputVariable(state,
    6278              :                                 "ITE Air Outlet Dry-Bulb Temperature",
    6279              :                                 Constant::Units::C,
    6280           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).AirOutletDryBulbT,
    6281              :                                 OutputProcessor::TimeStepType::Zone,
    6282              :                                 OutputProcessor::StoreType::Average,
    6283           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6284           12 :             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           24 :             SetupOutputVariable(state,
    6294              :                                 "ITE Air Inlet Operating Range Exceeded Time",
    6295              :                                 Constant::Units::hr,
    6296           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeOutOfOperRange,
    6297              :                                 OutputProcessor::TimeStepType::Zone,
    6298              :                                 OutputProcessor::StoreType::Sum,
    6299           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6300           24 :             SetupOutputVariable(state,
    6301              :                                 "ITE Air Inlet Dry-Bulb Temperature Above Operating Range Time",
    6302              :                                 Constant::Units::hr,
    6303           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeAboveDryBulbT,
    6304              :                                 OutputProcessor::TimeStepType::Zone,
    6305              :                                 OutputProcessor::StoreType::Sum,
    6306           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6307           24 :             SetupOutputVariable(state,
    6308              :                                 "ITE Air Inlet Dry-Bulb Temperature Below Operating Range Time",
    6309              :                                 Constant::Units::hr,
    6310           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeBelowDryBulbT,
    6311              :                                 OutputProcessor::TimeStepType::Zone,
    6312              :                                 OutputProcessor::StoreType::Sum,
    6313           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6314           24 :             SetupOutputVariable(state,
    6315              :                                 "ITE Air Inlet Dewpoint Temperature Above Operating Range Time",
    6316              :                                 Constant::Units::hr,
    6317           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeAboveDewpointT,
    6318              :                                 OutputProcessor::TimeStepType::Zone,
    6319              :                                 OutputProcessor::StoreType::Sum,
    6320           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6321           24 :             SetupOutputVariable(state,
    6322              :                                 "ITE Air Inlet Dewpoint Temperature Below Operating Range Time",
    6323              :                                 Constant::Units::hr,
    6324           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeBelowDewpointT,
    6325              :                                 OutputProcessor::TimeStepType::Zone,
    6326              :                                 OutputProcessor::StoreType::Sum,
    6327           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6328           24 :             SetupOutputVariable(state,
    6329              :                                 "ITE Air Inlet Relative Humidity Above Operating Range Time",
    6330              :                                 Constant::Units::hr,
    6331           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeAboveRH,
    6332              :                                 OutputProcessor::TimeStepType::Zone,
    6333              :                                 OutputProcessor::StoreType::Sum,
    6334           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6335           24 :             SetupOutputVariable(state,
    6336              :                                 "ITE Air Inlet Relative Humidity Below Operating Range Time",
    6337              :                                 Constant::Units::hr,
    6338           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).TimeBelowRH,
    6339              :                                 OutputProcessor::TimeStepType::Zone,
    6340              :                                 OutputProcessor::StoreType::Sum,
    6341           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6342           24 :             SetupOutputVariable(state,
    6343              :                                 "ITE Air Inlet Dry-Bulb Temperature Difference Above Operating Range",
    6344              :                                 Constant::Units::deltaC,
    6345           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DryBulbTAboveDeltaT,
    6346              :                                 OutputProcessor::TimeStepType::Zone,
    6347              :                                 OutputProcessor::StoreType::Average,
    6348           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6349           24 :             SetupOutputVariable(state,
    6350              :                                 "ITE Air Inlet Dry-Bulb Temperature Difference Below Operating Range",
    6351              :                                 Constant::Units::deltaC,
    6352           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DryBulbTBelowDeltaT,
    6353              :                                 OutputProcessor::TimeStepType::Zone,
    6354              :                                 OutputProcessor::StoreType::Average,
    6355           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6356           24 :             SetupOutputVariable(state,
    6357              :                                 "ITE Air Inlet Dewpoint Temperature Difference Above Operating Range",
    6358              :                                 Constant::Units::deltaC,
    6359           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DewpointTAboveDeltaT,
    6360              :                                 OutputProcessor::TimeStepType::Zone,
    6361              :                                 OutputProcessor::StoreType::Average,
    6362           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6363           24 :             SetupOutputVariable(state,
    6364              :                                 "ITE Air Inlet Dewpoint Temperature Difference Below Operating Range",
    6365              :                                 Constant::Units::deltaC,
    6366           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).DewpointTBelowDeltaT,
    6367              :                                 OutputProcessor::TimeStepType::Zone,
    6368              :                                 OutputProcessor::StoreType::Average,
    6369           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6370           24 :             SetupOutputVariable(state,
    6371              :                                 "ITE Air Inlet Relative Humidity Difference Above Operating Range",
    6372              :                                 Constant::Units::Perc,
    6373           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).RHAboveDeltaRH,
    6374              :                                 OutputProcessor::TimeStepType::Zone,
    6375              :                                 OutputProcessor::StoreType::Average,
    6376           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6377           24 :             SetupOutputVariable(state,
    6378              :                                 "ITE Air Inlet Relative Humidity Difference Below Operating Range",
    6379              :                                 Constant::Units::Perc,
    6380           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).RHBelowDeltaRH,
    6381              :                                 OutputProcessor::TimeStepType::Zone,
    6382              :                                 OutputProcessor::StoreType::Average,
    6383           12 :                                 state.dataHeatBal->ZoneITEq(itEqNum).Name);
    6384              :         }
    6385              : 
    6386              :         // Zone total report variables
    6387          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    6388          206 :             if (addZoneOutputs(zoneNum)) {
    6389              : 
    6390           12 :                 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           96 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6400          168 :                     SetupOutputVariable(state,
    6401           84 :                                         PowerOutputVariableStrings[i],
    6402              :                                         Constant::Units::W,
    6403           84 :                                         state.dataHeatBal->ZoneRpt(zoneNum).PowerRpt[i],
    6404              :                                         OutputProcessor::TimeStepType::Zone,
    6405              :                                         OutputProcessor::StoreType::Average,
    6406           84 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    6407              :                 }
    6408              : 
    6409           24 :                 SetupOutputVariable(state,
    6410              :                                     "Zone ITE Adjusted Return Air Temperature",
    6411              :                                     Constant::Units::C,
    6412           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEAdjReturnTemp,
    6413              :                                     OutputProcessor::TimeStepType::Zone,
    6414              :                                     OutputProcessor::StoreType::Average,
    6415           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6416              : 
    6417           12 :                 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           96 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6427          168 :                     SetupOutputVariable(state,
    6428           84 :                                         EnergyOutputVariableStrings[i],
    6429              :                                         Constant::Units::J,
    6430           84 :                                         state.dataHeatBal->ZoneRpt(zoneNum).EnergyRpt[i],
    6431              :                                         OutputProcessor::TimeStepType::Zone,
    6432              :                                         OutputProcessor::StoreType::Sum,
    6433           84 :                                         state.dataHeatBal->Zone(zoneNum).Name);
    6434              :                 }
    6435              : 
    6436           24 :                 SetupOutputVariable(state,
    6437              :                                     "Zone ITE Standard Density Air Volume Flow Rate",
    6438              :                                     Constant::Units::m3_s,
    6439           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqAirVolFlowStdDensity,
    6440              :                                     OutputProcessor::TimeStepType::Zone,
    6441              :                                     OutputProcessor::StoreType::Average,
    6442           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6443           24 :                 SetupOutputVariable(state,
    6444              :                                     "Zone ITE Air Mass Flow Rate",
    6445              :                                     Constant::Units::kg_s,
    6446           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqAirMassFlow,
    6447              :                                     OutputProcessor::TimeStepType::Zone,
    6448              :                                     OutputProcessor::StoreType::Average,
    6449           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6450           24 :                 SetupOutputVariable(state,
    6451              :                                     "Zone ITE Average Supply Heat Index",
    6452              :                                     Constant::Units::None,
    6453           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqSHI,
    6454              :                                     OutputProcessor::TimeStepType::Zone,
    6455              :                                     OutputProcessor::StoreType::Average,
    6456           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6457           24 :                 SetupOutputVariable(state,
    6458              :                                     "Zone ITE Any Air Inlet Operating Range Exceeded Time",
    6459              :                                     Constant::Units::hr,
    6460           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeOutOfOperRange,
    6461              :                                     OutputProcessor::TimeStepType::Zone,
    6462              :                                     OutputProcessor::StoreType::Sum,
    6463           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6464           24 :                 SetupOutputVariable(state,
    6465              :                                     "Zone ITE Any Air Inlet Dry-Bulb Temperature Above Operating Range Time",
    6466              :                                     Constant::Units::hr,
    6467           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeAboveDryBulbT,
    6468              :                                     OutputProcessor::TimeStepType::Zone,
    6469              :                                     OutputProcessor::StoreType::Sum,
    6470           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6471           24 :                 SetupOutputVariable(state,
    6472              :                                     "Zone ITE Any Air Inlet Dry-Bulb Temperature Below Operating Range Time",
    6473              :                                     Constant::Units::hr,
    6474           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeBelowDryBulbT,
    6475              :                                     OutputProcessor::TimeStepType::Zone,
    6476              :                                     OutputProcessor::StoreType::Sum,
    6477           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6478           24 :                 SetupOutputVariable(state,
    6479              :                                     "Zone ITE Any Air Inlet Dewpoint Temperature Above Operating Range Time",
    6480              :                                     Constant::Units::hr,
    6481           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeAboveDewpointT,
    6482              :                                     OutputProcessor::TimeStepType::Zone,
    6483              :                                     OutputProcessor::StoreType::Sum,
    6484           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6485           24 :                 SetupOutputVariable(state,
    6486              :                                     "Zone ITE Any Air Inlet Dewpoint Temperature Below Operating Range Time",
    6487              :                                     Constant::Units::hr,
    6488           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeBelowDewpointT,
    6489              :                                     OutputProcessor::TimeStepType::Zone,
    6490              :                                     OutputProcessor::StoreType::Sum,
    6491           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6492           24 :                 SetupOutputVariable(state,
    6493              :                                     "Zone ITE Any Air Inlet Relative Humidity Above Operating Range Time",
    6494              :                                     Constant::Units::hr,
    6495           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeAboveRH,
    6496              :                                     OutputProcessor::TimeStepType::Zone,
    6497              :                                     OutputProcessor::StoreType::Sum,
    6498           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6499           24 :                 SetupOutputVariable(state,
    6500              :                                     "Zone ITE Any Air Inlet Relative Humidity Below Operating Range Time",
    6501              :                                     Constant::Units::hr,
    6502           12 :                                     state.dataHeatBal->ZoneRpt(zoneNum).ITEqTimeBelowRH,
    6503              :                                     OutputProcessor::TimeStepType::Zone,
    6504              :                                     OutputProcessor::StoreType::Sum,
    6505           12 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6506              :             }
    6507              :             // Reset zone output flag
    6508          206 :             addZoneOutputs(zoneNum) = false;
    6509              :         }
    6510              : 
    6511              :         // Space total report variables
    6512          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    6513          224 :             if (addSpaceOutputs(spaceNum)) {
    6514           12 :                 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           96 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6524          168 :                     SetupOutputVariable(state,
    6525           84 :                                         PowerOutputVariableStrings[i],
    6526              :                                         Constant::Units::W,
    6527           84 :                                         state.dataHeatBal->spaceRpt(spaceNum).PowerRpt[i],
    6528              :                                         OutputProcessor::TimeStepType::Zone,
    6529              :                                         OutputProcessor::StoreType::Average,
    6530           84 :                                         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           12 :                 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           96 :                 for (int i = 0; i < (int)PERptVars::Num; ++i) {
    6552          168 :                     SetupOutputVariable(state,
    6553           84 :                                         EnergyOutputVariableStrings[i],
    6554              :                                         Constant::Units::J,
    6555           84 :                                         state.dataHeatBal->spaceRpt(spaceNum).EnergyRpt[i],
    6556              :                                         OutputProcessor::TimeStepType::Zone,
    6557              :                                         OutputProcessor::StoreType::Sum,
    6558           84 :                                         state.dataHeatBal->space(spaceNum).Name);
    6559              :                 }
    6560              : 
    6561           24 :                 SetupOutputVariable(state,
    6562              :                                     "Space ITE Standard Density Air Volume Flow Rate",
    6563              :                                     Constant::Units::m3_s,
    6564           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqAirVolFlowStdDensity,
    6565              :                                     OutputProcessor::TimeStepType::Zone,
    6566              :                                     OutputProcessor::StoreType::Average,
    6567           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6568           24 :                 SetupOutputVariable(state,
    6569              :                                     "Space ITE Air Mass Flow Rate",
    6570              :                                     Constant::Units::kg_s,
    6571           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqAirMassFlow,
    6572              :                                     OutputProcessor::TimeStepType::Zone,
    6573              :                                     OutputProcessor::StoreType::Average,
    6574           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6575           24 :                 SetupOutputVariable(state,
    6576              :                                     "Space ITE Average Supply Heat Index",
    6577              :                                     Constant::Units::None,
    6578           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqSHI,
    6579              :                                     OutputProcessor::TimeStepType::Zone,
    6580              :                                     OutputProcessor::StoreType::Average,
    6581           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6582           24 :                 SetupOutputVariable(state,
    6583              :                                     "Space ITE Any Air Inlet Operating Range Exceeded Time",
    6584              :                                     Constant::Units::hr,
    6585           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange,
    6586              :                                     OutputProcessor::TimeStepType::Zone,
    6587              :                                     OutputProcessor::StoreType::Sum,
    6588           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6589           24 :                 SetupOutputVariable(state,
    6590              :                                     "Space ITE Any Air Inlet Dry-Bulb Temperature Above Operating Range Time",
    6591              :                                     Constant::Units::hr,
    6592           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDryBulbT,
    6593              :                                     OutputProcessor::TimeStepType::Zone,
    6594              :                                     OutputProcessor::StoreType::Sum,
    6595           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6596           24 :                 SetupOutputVariable(state,
    6597              :                                     "Space ITE Any Air Inlet Dry-Bulb Temperature Below Operating Range Time",
    6598              :                                     Constant::Units::hr,
    6599           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDryBulbT,
    6600              :                                     OutputProcessor::TimeStepType::Zone,
    6601              :                                     OutputProcessor::StoreType::Sum,
    6602           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6603           24 :                 SetupOutputVariable(state,
    6604              :                                     "Space ITE Any Air Inlet Dewpoint Temperature Above Operating Range Time",
    6605              :                                     Constant::Units::hr,
    6606           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDewpointT,
    6607              :                                     OutputProcessor::TimeStepType::Zone,
    6608              :                                     OutputProcessor::StoreType::Sum,
    6609           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6610           24 :                 SetupOutputVariable(state,
    6611              :                                     "Space ITE Any Air Inlet Dewpoint Temperature Below Operating Range Time",
    6612              :                                     Constant::Units::hr,
    6613           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDewpointT,
    6614              :                                     OutputProcessor::TimeStepType::Zone,
    6615              :                                     OutputProcessor::StoreType::Sum,
    6616           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6617           24 :                 SetupOutputVariable(state,
    6618              :                                     "Space ITE Any Air Inlet Relative Humidity Above Operating Range Time",
    6619              :                                     Constant::Units::hr,
    6620           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveRH,
    6621              :                                     OutputProcessor::TimeStepType::Zone,
    6622              :                                     OutputProcessor::StoreType::Sum,
    6623           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6624           24 :                 SetupOutputVariable(state,
    6625              :                                     "Space ITE Any Air Inlet Relative Humidity Below Operating Range Time",
    6626              :                                     Constant::Units::hr,
    6627           12 :                                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowRH,
    6628              :                                     OutputProcessor::TimeStepType::Zone,
    6629              :                                     OutputProcessor::StoreType::Sum,
    6630           12 :                                     state.dataHeatBal->space(spaceNum).Name);
    6631              :             }
    6632              :             // Reset space output flag
    6633          224 :             addSpaceOutputs(spaceNum) = false;
    6634              :         }
    6635              : 
    6636              :         // Object report variables
    6637          169 :         for (int bbHeatNum = 1; bbHeatNum <= state.dataHeatBal->TotBBHeat; ++bbHeatNum) {
    6638              :             // Set flags for zone and space total report variables
    6639            2 :             addZoneOutputs(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr) = true;
    6640            2 :             addSpaceOutputs(state.dataHeatBal->ZoneBBHeat(bbHeatNum).spaceIndex) = true;
    6641            4 :             SetupOutputVariable(state,
    6642              :                                 "Baseboard Electricity Rate",
    6643              :                                 Constant::Units::W,
    6644            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Power,
    6645              :                                 OutputProcessor::TimeStepType::Zone,
    6646              :                                 OutputProcessor::StoreType::Average,
    6647            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6648            4 :             SetupOutputVariable(state,
    6649              :                                 "Baseboard Electricity Energy",
    6650              :                                 Constant::Units::J,
    6651            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Consumption,
    6652              :                                 OutputProcessor::TimeStepType::Zone,
    6653              :                                 OutputProcessor::StoreType::Sum,
    6654            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name,
    6655              :                                 Constant::eResource::Electricity,
    6656              :                                 OutputProcessor::Group::Building,
    6657              :                                 OutputProcessor::EndUseCat::InteriorEquipment,
    6658            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).EndUseSubcategory,
    6659            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr).Name,
    6660            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr).Multiplier,
    6661            2 :                                 state.dataHeatBal->Zone(state.dataHeatBal->ZoneBBHeat(bbHeatNum).ZonePtr).ListMultiplier,
    6662            2 :                                 state.dataHeatBal->space(state.dataHeatBal->ZoneBBHeat(bbHeatNum).spaceIndex).spaceType);
    6663              : 
    6664            4 :             SetupOutputVariable(state,
    6665              :                                 "Baseboard Radiant Heating Energy",
    6666              :                                 Constant::Units::J,
    6667            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).RadGainEnergy,
    6668              :                                 OutputProcessor::TimeStepType::Zone,
    6669              :                                 OutputProcessor::StoreType::Sum,
    6670            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6671            4 :             SetupOutputVariable(state,
    6672              :                                 "Baseboard Radiant Heating Rate",
    6673              :                                 Constant::Units::W,
    6674            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).RadGainRate,
    6675              :                                 OutputProcessor::TimeStepType::Zone,
    6676              :                                 OutputProcessor::StoreType::Average,
    6677            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6678            4 :             SetupOutputVariable(state,
    6679              :                                 "Baseboard Convective Heating Energy",
    6680              :                                 Constant::Units::J,
    6681            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).ConGainEnergy,
    6682              :                                 OutputProcessor::TimeStepType::Zone,
    6683              :                                 OutputProcessor::StoreType::Sum,
    6684            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6685            4 :             SetupOutputVariable(state,
    6686              :                                 "Baseboard Convective Heating Rate",
    6687              :                                 Constant::Units::W,
    6688            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).ConGainRate,
    6689              :                                 OutputProcessor::TimeStepType::Zone,
    6690              :                                 OutputProcessor::StoreType::Average,
    6691            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6692            4 :             SetupOutputVariable(state,
    6693              :                                 "Baseboard Total Heating Energy",
    6694              :                                 Constant::Units::J,
    6695            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).TotGainEnergy,
    6696              :                                 OutputProcessor::TimeStepType::Zone,
    6697              :                                 OutputProcessor::StoreType::Sum,
    6698            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6699            4 :             SetupOutputVariable(state,
    6700              :                                 "Baseboard Total Heating Rate",
    6701              :                                 Constant::Units::W,
    6702            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).TotGainRate,
    6703              :                                 OutputProcessor::TimeStepType::Zone,
    6704              :                                 OutputProcessor::StoreType::Average,
    6705            2 :                                 state.dataHeatBal->ZoneBBHeat(bbHeatNum).Name);
    6706              :         }
    6707              : 
    6708              :         // Zone total report variables
    6709          373 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    6710          206 :             if (addZoneOutputs(zoneNum)) {
    6711            2 :                 SetupOutputVariable(state,
    6712              :                                     "Zone Baseboard Electricity Rate",
    6713              :                                     Constant::Units::W,
    6714            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatPower,
    6715              :                                     OutputProcessor::TimeStepType::Zone,
    6716              :                                     OutputProcessor::StoreType::Average,
    6717            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6718            2 :                 SetupOutputVariable(state,
    6719              :                                     "Zone Baseboard Electricity Energy",
    6720              :                                     Constant::Units::J,
    6721            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatElecCons,
    6722              :                                     OutputProcessor::TimeStepType::Zone,
    6723              :                                     OutputProcessor::StoreType::Sum,
    6724            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6725              : 
    6726            2 :                 SetupOutputVariable(state,
    6727              :                                     "Zone Baseboard Radiant Heating Energy",
    6728              :                                     Constant::Units::J,
    6729            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatRadGain,
    6730              :                                     OutputProcessor::TimeStepType::Zone,
    6731              :                                     OutputProcessor::StoreType::Sum,
    6732            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6733            2 :                 SetupOutputVariable(state,
    6734              :                                     "Zone Baseboard Radiant Heating Rate",
    6735              :                                     Constant::Units::W,
    6736            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatRadGainRate,
    6737              :                                     OutputProcessor::TimeStepType::Zone,
    6738              :                                     OutputProcessor::StoreType::Average,
    6739            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6740            2 :                 SetupOutputVariable(state,
    6741              :                                     "Zone Baseboard Convective Heating Energy",
    6742              :                                     Constant::Units::J,
    6743            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatConGain,
    6744              :                                     OutputProcessor::TimeStepType::Zone,
    6745              :                                     OutputProcessor::StoreType::Sum,
    6746            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6747            2 :                 SetupOutputVariable(state,
    6748              :                                     "Zone Baseboard Convective Heating Rate",
    6749              :                                     Constant::Units::W,
    6750            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatConGainRate,
    6751              :                                     OutputProcessor::TimeStepType::Zone,
    6752              :                                     OutputProcessor::StoreType::Average,
    6753            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6754            2 :                 SetupOutputVariable(state,
    6755              :                                     "Zone Baseboard Total Heating Energy",
    6756              :                                     Constant::Units::J,
    6757            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatTotGain,
    6758              :                                     OutputProcessor::TimeStepType::Zone,
    6759              :                                     OutputProcessor::StoreType::Sum,
    6760            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6761            2 :                 SetupOutputVariable(state,
    6762              :                                     "Zone Baseboard Total Heating Rate",
    6763              :                                     Constant::Units::W,
    6764            1 :                                     state.dataHeatBal->ZoneRpt(zoneNum).BaseHeatTotGainRate,
    6765              :                                     OutputProcessor::TimeStepType::Zone,
    6766              :                                     OutputProcessor::StoreType::Average,
    6767            1 :                                     state.dataHeatBal->Zone(zoneNum).Name);
    6768              :             }
    6769              :             // Reset zone output flag
    6770          206 :             addZoneOutputs(zoneNum) = false;
    6771              :         }
    6772              : 
    6773              :         // Space total report variables
    6774          391 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    6775          224 :             if (addSpaceOutputs(spaceNum)) {
    6776            4 :                 SetupOutputVariable(state,
    6777              :                                     "Space Baseboard Electricity Rate",
    6778              :                                     Constant::Units::W,
    6779            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatPower,
    6780              :                                     OutputProcessor::TimeStepType::Zone,
    6781              :                                     OutputProcessor::StoreType::Average,
    6782            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6783            4 :                 SetupOutputVariable(state,
    6784              :                                     "Space Baseboard Electricity Energy",
    6785              :                                     Constant::Units::J,
    6786            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatElecCons,
    6787              :                                     OutputProcessor::TimeStepType::Zone,
    6788              :                                     OutputProcessor::StoreType::Sum,
    6789            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6790              : 
    6791            4 :                 SetupOutputVariable(state,
    6792              :                                     "Space Baseboard Radiant Heating Energy",
    6793              :                                     Constant::Units::J,
    6794            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatRadGain,
    6795              :                                     OutputProcessor::TimeStepType::Zone,
    6796              :                                     OutputProcessor::StoreType::Sum,
    6797            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6798            4 :                 SetupOutputVariable(state,
    6799              :                                     "Space Baseboard Radiant Heating Rate",
    6800              :                                     Constant::Units::W,
    6801            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatRadGainRate,
    6802              :                                     OutputProcessor::TimeStepType::Zone,
    6803              :                                     OutputProcessor::StoreType::Average,
    6804            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6805            4 :                 SetupOutputVariable(state,
    6806              :                                     "Space Baseboard Convective Heating Energy",
    6807              :                                     Constant::Units::J,
    6808            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatConGain,
    6809              :                                     OutputProcessor::TimeStepType::Zone,
    6810              :                                     OutputProcessor::StoreType::Sum,
    6811            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6812            4 :                 SetupOutputVariable(state,
    6813              :                                     "Space Baseboard Convective Heating Rate",
    6814              :                                     Constant::Units::W,
    6815            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatConGainRate,
    6816              :                                     OutputProcessor::TimeStepType::Zone,
    6817              :                                     OutputProcessor::StoreType::Average,
    6818            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6819            4 :                 SetupOutputVariable(state,
    6820              :                                     "Space Baseboard Total Heating Energy",
    6821              :                                     Constant::Units::J,
    6822            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatTotGain,
    6823              :                                     OutputProcessor::TimeStepType::Zone,
    6824              :                                     OutputProcessor::StoreType::Sum,
    6825            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6826            4 :                 SetupOutputVariable(state,
    6827              :                                     "Space Baseboard Total Heating Rate",
    6828              :                                     Constant::Units::W,
    6829            2 :                                     state.dataHeatBal->spaceRpt(spaceNum).BaseHeatTotGainRate,
    6830              :                                     OutputProcessor::TimeStepType::Zone,
    6831              :                                     OutputProcessor::StoreType::Average,
    6832            2 :                                     state.dataHeatBal->space(spaceNum).Name);
    6833              :             }
    6834              :             // Reset space output flag
    6835          224 :             addSpaceOutputs(spaceNum) = false;
    6836              :         }
    6837          167 :     }
    6838              : 
    6839       249958 :     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       249958 :         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       620215 :         for (auto &e : state.dataHeatBal->spaceIntGain) {
    6887       370257 :             e.NOFOCC = 0.0;
    6888       370257 :             e.QLTSW = 0.0;
    6889       249958 :         }
    6890              : 
    6891       249958 :         state.dataHeatBal->ZoneIntEEuse = zeroZoneCatEUse; // Set all member arrays to zeros
    6892              : 
    6893       586610 :         for (auto &e : state.dataHeatBal->ZoneRpt) {
    6894       336652 :             e.CO2Rate = 0.0;
    6895       249958 :         }
    6896              : 
    6897       620215 :         for (auto &e : state.dataHeatBal->spaceRpt) {
    6898              :             // People
    6899       370257 :             e.PeopleRadGain = 0.0;
    6900       370257 :             e.PeopleConGain = 0.0;
    6901       370257 :             e.PeopleSenGain = 0.0;
    6902       370257 :             e.PeopleNumOcc = 0.0;
    6903       370257 :             e.PeopleLatGain = 0.0;
    6904       370257 :             e.PeopleTotGain = 0.0;
    6905       370257 :             e.PeopleRadGainRate = 0.0;
    6906       370257 :             e.PeopleConGainRate = 0.0;
    6907       370257 :             e.PeopleSenGainRate = 0.0;
    6908       370257 :             e.PeopleLatGainRate = 0.0;
    6909       370257 :             e.PeopleTotGainRate = 0.0;
    6910              :             // Lights
    6911       370257 :             e.LtsPower = 0.0;
    6912       370257 :             e.LtsElecConsump = 0.0;
    6913       370257 :             e.LtsRadGain = 0.0;
    6914       370257 :             e.LtsVisGain = 0.0;
    6915       370257 :             e.LtsConGain = 0.0;
    6916       370257 :             e.LtsRetAirGain = 0.0;
    6917       370257 :             e.LtsTotGain = 0.0;
    6918       370257 :             e.LtsRadGainRate = 0.0;
    6919       370257 :             e.LtsVisGainRate = 0.0;
    6920       370257 :             e.LtsConGainRate = 0.0;
    6921       370257 :             e.LtsRetAirGainRate = 0.0;
    6922       370257 :             e.LtsTotGainRate = 0.0;
    6923              :             // Baseboard Heat
    6924       370257 :             e.BaseHeatPower = 0.0;
    6925       370257 :             e.BaseHeatElecCons = 0.0;
    6926       370257 :             e.BaseHeatRadGain = 0.0;
    6927       370257 :             e.BaseHeatConGain = 0.0;
    6928       370257 :             e.BaseHeatTotGain = 0.0;
    6929       370257 :             e.BaseHeatRadGainRate = 0.0;
    6930       370257 :             e.BaseHeatConGainRate = 0.0;
    6931       370257 :             e.BaseHeatTotGainRate = 0.0;
    6932              :             // Electric Equipment
    6933       370257 :             e.ElecPower = 0.0;
    6934       370257 :             e.ElecConsump = 0.0;
    6935       370257 :             e.ElecRadGain = 0.0;
    6936       370257 :             e.ElecConGain = 0.0;
    6937       370257 :             e.ElecLatGain = 0.0;
    6938       370257 :             e.ElecLost = 0.0;
    6939       370257 :             e.ElecTotGain = 0.0;
    6940       370257 :             e.ElecRadGainRate = 0.0;
    6941       370257 :             e.ElecConGainRate = 0.0;
    6942       370257 :             e.ElecLatGainRate = 0.0;
    6943       370257 :             e.ElecLostRate = 0.0;
    6944       370257 :             e.ElecTotGainRate = 0.0;
    6945              :             // Gas Equipment
    6946       370257 :             e.GasPower = 0.0;
    6947       370257 :             e.GasConsump = 0.0;
    6948       370257 :             e.GasRadGain = 0.0;
    6949       370257 :             e.GasConGain = 0.0;
    6950       370257 :             e.GasLatGain = 0.0;
    6951       370257 :             e.GasLost = 0.0;
    6952       370257 :             e.GasTotGain = 0.0;
    6953       370257 :             e.GasRadGainRate = 0.0;
    6954       370257 :             e.GasConGainRate = 0.0;
    6955       370257 :             e.GasLatGainRate = 0.0;
    6956       370257 :             e.GasLostRate = 0.0;
    6957       370257 :             e.GasTotGainRate = 0.0;
    6958              :             // Hot Water Equipment
    6959       370257 :             e.HWPower = 0.0;
    6960       370257 :             e.HWConsump = 0.0;
    6961       370257 :             e.HWRadGain = 0.0;
    6962       370257 :             e.HWConGain = 0.0;
    6963       370257 :             e.HWLatGain = 0.0;
    6964       370257 :             e.HWLost = 0.0;
    6965       370257 :             e.HWTotGain = 0.0;
    6966       370257 :             e.HWRadGainRate = 0.0;
    6967       370257 :             e.HWConGainRate = 0.0;
    6968       370257 :             e.HWLatGainRate = 0.0;
    6969       370257 :             e.HWLostRate = 0.0;
    6970       370257 :             e.HWTotGainRate = 0.0;
    6971              :             // Steam Equipment
    6972       370257 :             e.SteamPower = 0.0;
    6973       370257 :             e.SteamConsump = 0.0;
    6974       370257 :             e.SteamRadGain = 0.0;
    6975       370257 :             e.SteamConGain = 0.0;
    6976       370257 :             e.SteamLatGain = 0.0;
    6977       370257 :             e.SteamLost = 0.0;
    6978       370257 :             e.SteamTotGain = 0.0;
    6979       370257 :             e.SteamRadGainRate = 0.0;
    6980       370257 :             e.SteamConGainRate = 0.0;
    6981       370257 :             e.SteamLatGainRate = 0.0;
    6982       370257 :             e.SteamLostRate = 0.0;
    6983       370257 :             e.SteamTotGainRate = 0.0;
    6984              :             // Other Equipment
    6985       370257 :             e.OtherRadGain = 0.0;
    6986       370257 :             e.OtherConGain = 0.0;
    6987       370257 :             e.OtherLatGain = 0.0;
    6988       370257 :             e.OtherLost = 0.0;
    6989       370257 :             e.OtherTotGain = 0.0;
    6990       370257 :             e.OtherRadGainRate = 0.0;
    6991       370257 :             e.OtherConGainRate = 0.0;
    6992       370257 :             e.OtherLatGainRate = 0.0;
    6993       370257 :             e.OtherLostRate = 0.0;
    6994       370257 :             e.OtherTotGainRate = 0.0;
    6995              :             // Overall Zone Variables
    6996       370257 :             e.TotRadiantGain = 0.0;
    6997       370257 :             e.TotVisHeatGain = 0.0;
    6998       370257 :             e.TotConvectiveGain = 0.0;
    6999       370257 :             e.TotLatentGain = 0.0;
    7000       370257 :             e.TotTotalHeatGain = 0.0;
    7001       370257 :             e.TotRadiantGainRate = 0.0;
    7002       370257 :             e.TotVisHeatGainRate = 0.0;
    7003       370257 :             e.TotConvectiveGainRate = 0.0;
    7004       370257 :             e.TotLatentGainRate = 0.0;
    7005       370257 :             e.TotTotalHeatGainRate = 0.0;
    7006              :             // Contaminant
    7007       370257 :             e.CO2Rate = 0.0;
    7008       370257 :             e.GCRate = 0.0;
    7009      5924112 :             for (int i = 0; i < (int)Constant::eFuel::Num; ++i) {
    7010      5553855 :                 e.OtherPower[i] = 0.0;
    7011      5553855 :                 e.OtherConsump[i] = 0.0;
    7012              :             }
    7013       249958 :         }
    7014              : 
    7015       586610 :         for (auto &e : state.dataHeatBal->ZonePreDefRep) {
    7016       336652 :             e.NumOcc = 0.0;
    7017       249958 :         }
    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       371851 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) {
    7034       121893 :             auto &thisPeople = state.dataHeatBal->People(Loop);
    7035       121893 :             int NZ = state.dataHeatBal->People(Loop).ZonePtr;
    7036       121893 :             int spaceNum = thisPeople.spaceIndex;
    7037       121893 :             auto const &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum);
    7038       121893 :             NumberOccupants = thisPeople.NumberOfPeople * thisPeople.sched->getCurrentVal();
    7039              : 
    7040       121893 :             if (thisPeople.EMSPeopleOn) {
    7041            0 :                 NumberOccupants = thisPeople.EMSNumberOfPeople;
    7042              :             }
    7043              : 
    7044       121893 :             TotalPeopleGain = 0.0;
    7045       121893 :             SensiblePeopleGain = 0.0;
    7046              : 
    7047       121893 :             auto &thisZoneRep = state.dataHeatBal->ZonePreDefRep(NZ);
    7048       121893 :             if (NumberOccupants > 0.0) {
    7049        90821 :                 ActivityLevel_WperPerson = thisPeople.activityLevelSched->getCurrentVal();
    7050        90821 :                 TotalPeopleGain = NumberOccupants * ActivityLevel_WperPerson;
    7051              :                 // if the user did not specify a sensible fraction, calculate the sensible heat gain
    7052        90821 :                 if (thisPeople.UserSpecSensFrac == Constant::AutoCalculate) {
    7053        90817 :                     Real64 airTemp = thisSpaceHB.MAT;
    7054        90817 :                     if (state.dataRoomAir->anyNonMixingRoomAirModel) {
    7055            0 :                         if (state.dataRoomAir->IsZoneDispVent3Node(NZ) || state.dataRoomAir->IsZoneUFAD(NZ)) {
    7056            0 :                             airTemp = state.dataRoomAir->TCMF(NZ);
    7057              :                         }
    7058              :                     }
    7059        90817 :                     SensiblePeopleGain =
    7060        90817 :                         NumberOccupants * (C[0] + ActivityLevel_WperPerson * (C[1] + ActivityLevel_WperPerson * C[2]) +
    7061        90817 :                                            airTemp * ((C[3] + ActivityLevel_WperPerson * (C[4] + ActivityLevel_WperPerson * C[5])) +
    7062        90817 :                                                       airTemp * (C[6] + ActivityLevel_WperPerson * (C[7] + ActivityLevel_WperPerson * C[8]))));
    7063              :                 } else { // if the user did specify a sensible fraction, use it
    7064            4 :                     SensiblePeopleGain = TotalPeopleGain * thisPeople.UserSpecSensFrac;
    7065              :                 }
    7066              : 
    7067        90821 :                 if (SensiblePeopleGain > TotalPeopleGain) {
    7068         8078 :                     SensiblePeopleGain = TotalPeopleGain;
    7069              :                 }
    7070        90821 :                 if (SensiblePeopleGain < 0.0) {
    7071          634 :                     SensiblePeopleGain = 0.0;
    7072              :                 }
    7073              : 
    7074              :                 // For predefined tabular reports related to outside air ventilation
    7075        90821 :                 thisZoneRep.isOccupied = true; // set flag to occupied to be used in tabular reporting for ventilation
    7076        90821 :                 thisZoneRep.NumOcc += NumberOccupants;
    7077        90821 :                 thisZoneRep.NumOccAccum += NumberOccupants * state.dataGlobal->TimeStepZone;
    7078        90821 :                 thisZoneRep.NumOccAccumTime += state.dataGlobal->TimeStepZone;
    7079              :             } else {
    7080        31072 :                 state.dataHeatBal->ZonePreDefRep(NZ).isOccupied = false; // set flag to occupied to be used in tabular reporting for ventilation
    7081              :             }
    7082              : 
    7083       121893 :             thisPeople.NumOcc = NumberOccupants;
    7084       121893 :             thisPeople.RadGainRate = SensiblePeopleGain * thisPeople.FractionRadiant;
    7085       121893 :             thisPeople.ConGainRate = SensiblePeopleGain * thisPeople.FractionConvected;
    7086       121893 :             thisPeople.SenGainRate = SensiblePeopleGain;
    7087       121893 :             thisPeople.LatGainRate = TotalPeopleGain - SensiblePeopleGain;
    7088       121893 :             thisPeople.TotGainRate = TotalPeopleGain;
    7089       121893 :             thisPeople.CO2GainRate = TotalPeopleGain * thisPeople.CO2RateFactor;
    7090              : 
    7091       121893 :             auto &thisSpaceIntGain = state.dataHeatBal->spaceIntGain(spaceNum);
    7092       121893 :             thisSpaceIntGain.NOFOCC += thisPeople.NumOcc;
    7093       121893 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(spaceNum);
    7094       121893 :             thisSpaceRpt.PeopleRadGainRate += thisPeople.RadGainRate;
    7095       121893 :             thisSpaceRpt.PeopleConGainRate += thisPeople.ConGainRate;
    7096       121893 :             thisSpaceRpt.PeopleSenGainRate += thisPeople.SenGainRate;
    7097       121893 :             thisSpaceRpt.PeopleLatGainRate += thisPeople.LatGainRate;
    7098       121893 :             thisSpaceRpt.PeopleTotGainRate += thisPeople.TotGainRate;
    7099              :         }
    7100              : 
    7101       376570 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    7102       126612 :             auto &thisLights = state.dataHeatBal->Lights(Loop);
    7103       126612 :             int NZ = thisLights.ZonePtr;
    7104       126612 :             int spaceNum = thisLights.spaceIndex;
    7105       126612 :             Q = thisLights.DesignLevel * thisLights.sched->getCurrentVal();
    7106              : 
    7107       126612 :             if (state.dataDayltg->ZoneDaylight(NZ).totRefPts > 0) {
    7108          676 :                 if (thisLights.FractionReplaceable > 0.0) { // FractionReplaceable can only be 0 or 1 for these models
    7109          676 :                     Q *= state.dataDayltg->spacePowerReductionFactor(spaceNum);
    7110              :                 }
    7111              :             }
    7112              : 
    7113              :             // Reduce lighting power due to demand limiting
    7114       126612 :             if (thisLights.ManageDemand && (Q > thisLights.DemandLimit)) {
    7115            0 :                 Q = thisLights.DemandLimit;
    7116              :             }
    7117              : 
    7118              :             // Set Q to EMS override if being called for by EMs
    7119       126612 :             if (thisLights.EMSLightsOn) {
    7120            0 :                 Q = thisLights.EMSLightingPower;
    7121              :             }
    7122              : 
    7123       126612 :             FractionConvected = thisLights.FractionConvected;
    7124       126612 :             FractionReturnAir = thisLights.FractionReturnAir;
    7125       126612 :             FractionRadiant = thisLights.FractionRadiant;
    7126       126612 :             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       126612 :             thisLights.Power = Q;
    7151       126612 :             thisLights.RadGainRate = Q * FractionRadiant;
    7152       126612 :             thisLights.VisGainRate = Q * thisLights.FractionShortWave;
    7153       126612 :             thisLights.ConGainRate = Q * FractionConvected;
    7154       126612 :             thisLights.RetAirGainRate = Q * FractionReturnAir;
    7155       126612 :             thisLights.TotGainRate = Q;
    7156              : 
    7157       126612 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(spaceNum);
    7158       126612 :             thisSpaceRpt.LtsPower += thisLights.Power;
    7159       126612 :             thisSpaceRpt.LtsRadGainRate += thisLights.RadGainRate;
    7160       126612 :             thisSpaceRpt.LtsVisGainRate += thisLights.VisGainRate;
    7161       126612 :             state.dataHeatBal->spaceIntGain(spaceNum).QLTSW += thisLights.VisGainRate;
    7162       126612 :             thisSpaceRpt.LtsConGainRate += thisLights.ConGainRate;
    7163       126612 :             thisSpaceRpt.LtsRetAirGainRate += thisLights.RetAirGainRate;
    7164       126612 :             thisSpaceRpt.LtsTotGainRate += thisLights.TotGainRate;
    7165              :         }
    7166              : 
    7167       432678 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) {
    7168       182720 :             auto &thisElecEq = state.dataHeatBal->ZoneElectric(Loop);
    7169       182720 :             Q = thisElecEq.DesignLevel * thisElecEq.sched->getCurrentVal();
    7170              : 
    7171              :             // Reduce equipment power due to demand limiting
    7172       182720 :             if (thisElecEq.ManageDemand && (Q > thisElecEq.DemandLimit)) {
    7173            0 :                 Q = thisElecEq.DemandLimit;
    7174              :             }
    7175              : 
    7176              :             // Set Q to EMS override if being called for by EMs
    7177       182720 :             if (thisElecEq.EMSZoneEquipOverrideOn) {
    7178            0 :                 Q = thisElecEq.EMSEquipPower;
    7179              :             }
    7180              : 
    7181       182720 :             thisElecEq.Power = Q;
    7182       182720 :             thisElecEq.RadGainRate = Q * thisElecEq.FractionRadiant;
    7183       182720 :             thisElecEq.ConGainRate = Q * thisElecEq.FractionConvected;
    7184       182720 :             thisElecEq.LatGainRate = Q * thisElecEq.FractionLatent;
    7185       182720 :             thisElecEq.LostRate = Q * thisElecEq.FractionLost;
    7186       182720 :             thisElecEq.TotGainRate = Q - thisElecEq.LostRate;
    7187              : 
    7188       182720 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisElecEq.spaceIndex);
    7189       182720 :             thisSpaceRpt.ElecPower += thisElecEq.Power;
    7190       182720 :             thisSpaceRpt.ElecRadGainRate += thisElecEq.RadGainRate;
    7191       182720 :             thisSpaceRpt.ElecConGainRate += thisElecEq.ConGainRate;
    7192       182720 :             thisSpaceRpt.ElecLatGainRate += thisElecEq.LatGainRate;
    7193       182720 :             thisSpaceRpt.ElecLostRate += thisElecEq.LostRate;
    7194              :         }
    7195              : 
    7196       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) {
    7197            4 :             auto &thisGasEq = state.dataHeatBal->ZoneGas(Loop);
    7198            4 :             Q = thisGasEq.DesignLevel * thisGasEq.sched->getCurrentVal();
    7199              : 
    7200              :             // Set Q to EMS override if being called for by EMs
    7201            4 :             if (thisGasEq.EMSZoneEquipOverrideOn) {
    7202            0 :                 Q = thisGasEq.EMSEquipPower;
    7203              :             }
    7204              : 
    7205            4 :             thisGasEq.Power = Q;
    7206            4 :             thisGasEq.RadGainRate = Q * thisGasEq.FractionRadiant;
    7207            4 :             thisGasEq.ConGainRate = Q * thisGasEq.FractionConvected;
    7208            4 :             thisGasEq.LatGainRate = Q * thisGasEq.FractionLatent;
    7209            4 :             thisGasEq.LostRate = Q * thisGasEq.FractionLost;
    7210            4 :             thisGasEq.TotGainRate = Q - thisGasEq.LostRate;
    7211            4 :             thisGasEq.CO2GainRate = Q * thisGasEq.CO2RateFactor;
    7212              : 
    7213            4 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisGasEq.spaceIndex);
    7214            4 :             thisSpaceRpt.GasPower += thisGasEq.Power;
    7215            4 :             thisSpaceRpt.GasRadGainRate += thisGasEq.RadGainRate;
    7216            4 :             thisSpaceRpt.GasConGainRate += thisGasEq.ConGainRate;
    7217            4 :             thisSpaceRpt.GasLatGainRate += thisGasEq.LatGainRate;
    7218            4 :             thisSpaceRpt.GasLostRate += thisGasEq.LostRate;
    7219              :         }
    7220              : 
    7221       493040 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) {
    7222       243082 :             auto &thisOtherEq = state.dataHeatBal->ZoneOtherEq(Loop);
    7223       243082 :             Q = thisOtherEq.DesignLevel * thisOtherEq.sched->getCurrentVal();
    7224              : 
    7225              :             // Set Q to EMS override if being called for by EMs
    7226       243082 :             if (thisOtherEq.EMSZoneEquipOverrideOn) {
    7227            0 :                 Q = thisOtherEq.EMSEquipPower;
    7228              :             }
    7229              : 
    7230       243082 :             thisOtherEq.Power = Q;
    7231       243082 :             thisOtherEq.RadGainRate = Q * thisOtherEq.FractionRadiant;
    7232       243082 :             thisOtherEq.ConGainRate = Q * thisOtherEq.FractionConvected;
    7233       243082 :             thisOtherEq.LatGainRate = Q * thisOtherEq.FractionLatent;
    7234       243082 :             thisOtherEq.LostRate = Q * thisOtherEq.FractionLost;
    7235       243082 :             thisOtherEq.TotGainRate = Q - thisOtherEq.LostRate;
    7236              : 
    7237       243082 :             int fuelType = (int)thisOtherEq.OtherEquipFuelType;
    7238       243082 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisOtherEq.spaceIndex);
    7239       243082 :             thisSpaceRpt.OtherPower[fuelType] += thisOtherEq.Power;
    7240       243082 :             thisSpaceRpt.OtherTotGainRate += thisOtherEq.TotGainRate;
    7241       243082 :             thisSpaceRpt.OtherRadGainRate += thisOtherEq.RadGainRate;
    7242       243082 :             thisSpaceRpt.OtherConGainRate += thisOtherEq.ConGainRate;
    7243       243082 :             thisSpaceRpt.OtherLatGainRate += thisOtherEq.LatGainRate;
    7244       243082 :             thisSpaceRpt.OtherLostRate += thisOtherEq.LostRate;
    7245              :         }
    7246              : 
    7247       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) {
    7248            4 :             auto &thisHWEq = state.dataHeatBal->ZoneHWEq(Loop);
    7249            4 :             Q = thisHWEq.DesignLevel * thisHWEq.sched->getCurrentVal();
    7250              : 
    7251              :             // Set Q to EMS override if being called for by EMs
    7252            4 :             if (thisHWEq.EMSZoneEquipOverrideOn) {
    7253            0 :                 Q = thisHWEq.EMSEquipPower;
    7254              :             }
    7255              : 
    7256            4 :             thisHWEq.Power = Q;
    7257            4 :             thisHWEq.RadGainRate = Q * thisHWEq.FractionRadiant;
    7258            4 :             thisHWEq.ConGainRate = Q * thisHWEq.FractionConvected;
    7259            4 :             thisHWEq.LatGainRate = Q * thisHWEq.FractionLatent;
    7260            4 :             thisHWEq.LostRate = Q * thisHWEq.FractionLost;
    7261            4 :             thisHWEq.TotGainRate = Q - thisHWEq.LostRate;
    7262              : 
    7263            4 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisHWEq.spaceIndex);
    7264            4 :             thisSpaceRpt.HWPower += thisHWEq.Power;
    7265            4 :             thisSpaceRpt.HWRadGainRate += thisHWEq.RadGainRate;
    7266            4 :             thisSpaceRpt.HWConGainRate += thisHWEq.ConGainRate;
    7267            4 :             thisSpaceRpt.HWLatGainRate += thisHWEq.LatGainRate;
    7268            4 :             thisSpaceRpt.HWLostRate += thisHWEq.LostRate;
    7269              :         }
    7270              : 
    7271       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) {
    7272            4 :             auto &thisSteamEq = state.dataHeatBal->ZoneSteamEq(Loop);
    7273            4 :             Q = thisSteamEq.DesignLevel * thisSteamEq.sched->getCurrentVal();
    7274              : 
    7275              :             // Set Q to EMS override if being called for by EMs
    7276            4 :             if (thisSteamEq.EMSZoneEquipOverrideOn) {
    7277            0 :                 Q = thisSteamEq.EMSEquipPower;
    7278              :             }
    7279              : 
    7280            4 :             thisSteamEq.Power = Q;
    7281            4 :             thisSteamEq.RadGainRate = Q * thisSteamEq.FractionRadiant;
    7282            4 :             thisSteamEq.ConGainRate = Q * thisSteamEq.FractionConvected;
    7283            4 :             thisSteamEq.LatGainRate = Q * thisSteamEq.FractionLatent;
    7284            4 :             thisSteamEq.LostRate = Q * thisSteamEq.FractionLost;
    7285            4 :             thisSteamEq.TotGainRate = Q - thisSteamEq.LostRate;
    7286              : 
    7287            4 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisSteamEq.spaceIndex);
    7288            4 :             thisSpaceRpt.SteamPower += thisSteamEq.Power;
    7289            4 :             thisSpaceRpt.SteamRadGainRate += thisSteamEq.RadGainRate;
    7290            4 :             thisSpaceRpt.SteamConGainRate += thisSteamEq.ConGainRate;
    7291            4 :             thisSpaceRpt.SteamLatGainRate += thisSteamEq.LatGainRate;
    7292            4 :             thisSpaceRpt.SteamLostRate += thisSteamEq.LostRate;
    7293              :         }
    7294              : 
    7295       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) {
    7296            4 :             auto &thisBBHeat = state.dataHeatBal->ZoneBBHeat(Loop);
    7297            4 :             int NZ = thisBBHeat.ZonePtr;
    7298            4 :             if (state.dataHeatBal->Zone(NZ).OutDryBulbTemp >= thisBBHeat.HighTemperature) {
    7299            0 :                 Q = 0.0;
    7300            4 :             } else if (state.dataHeatBal->Zone(NZ).OutDryBulbTemp > thisBBHeat.LowTemperature) {
    7301            0 :                 Q = (state.dataHeatBal->Zone(NZ).OutDryBulbTemp - thisBBHeat.LowTemperature) *
    7302            0 :                         (thisBBHeat.CapatHighTemperature - thisBBHeat.CapatLowTemperature) /
    7303            0 :                         (thisBBHeat.HighTemperature - thisBBHeat.LowTemperature) +
    7304            0 :                     thisBBHeat.CapatLowTemperature;
    7305              :             } else {
    7306            4 :                 Q = thisBBHeat.CapatLowTemperature;
    7307              :             }
    7308            4 :             Q *= thisBBHeat.sched->getCurrentVal();
    7309              : 
    7310              :             // set with EMS value if being called for.
    7311            4 :             if (thisBBHeat.EMSZoneBaseboardOverrideOn) {
    7312            0 :                 Q = thisBBHeat.EMSZoneBaseboardPower;
    7313              :             }
    7314              : 
    7315            4 :             thisBBHeat.Power = Q;
    7316            4 :             thisBBHeat.RadGainRate = Q * thisBBHeat.FractionRadiant;
    7317            4 :             thisBBHeat.ConGainRate = Q * thisBBHeat.FractionConvected;
    7318            4 :             thisBBHeat.TotGainRate = Q;
    7319              : 
    7320            4 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(thisBBHeat.spaceIndex);
    7321            4 :             thisSpaceRpt.BaseHeatPower += thisBBHeat.Power;
    7322            4 :             thisSpaceRpt.BaseHeatRadGainRate += thisBBHeat.RadGainRate;
    7323            4 :             thisSpaceRpt.BaseHeatConGainRate += thisBBHeat.ConGainRate;
    7324              :         }
    7325              : 
    7326       249960 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotCO2Gen; ++Loop) {
    7327            2 :             int NZ = state.dataHeatBal->ZoneCO2Gen(Loop).ZonePtr;
    7328            2 :             state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate =
    7329            2 :                 state.dataHeatBal->ZoneCO2Gen(Loop).CO2DesignRate * state.dataHeatBal->ZoneCO2Gen(Loop).sched->getCurrentVal();
    7330            2 :             state.dataHeatBal->ZoneRpt(NZ).CO2Rate += state.dataHeatBal->ZoneCO2Gen(Loop).CO2GainRate;
    7331              :         }
    7332              : 
    7333       249958 :         if (state.dataHeatBal->TotITEquip > 0) {
    7334            0 :             CalcZoneITEq(state);
    7335              :         }
    7336              : 
    7337       249958 :         CalcWaterThermalTankZoneGains(state);
    7338       249958 :         PipeHeatTransfer::PipeHTData::CalcZonePipesHeatGain(state);
    7339       249958 :         CalcWaterUseZoneGains(state);
    7340       249958 :         FigureFuelCellZoneGains(state);
    7341       249958 :         FigureMicroCHPZoneGains(state);
    7342       249958 :         initializeElectricPowerServiceZoneGains(state);
    7343       249958 :         FigureTDDZoneGains(state);
    7344       249958 :         FigureRefrigerationZoneGains(state);
    7345              : 
    7346              :         // store pointer values to hold generic internal gain values constant for entire timestep
    7347       249958 :         UpdateInternalGainValues(state);
    7348              : 
    7349       586610 :         for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) {
    7350       336652 :             InternalHeatGains::SumAllInternalLatentGains(state, NZ); // Sets zone and space latent gains
    7351              :             // Added for hybrid model
    7352       336652 :             if (state.dataHybridModel->FlagHybridModel_PC) {
    7353            0 :                 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       602832 :         for (int enclosureNum = 1; enclosureNum <= state.dataViewFactor->NumOfRadiantEnclosures; ++enclosureNum) {
    7359       352874 :             auto &thisEnclosure(state.dataViewFactor->EnclRadInfo(enclosureNum));
    7360       352874 :             thisEnclosure.radQThermalRad = 0.0;
    7361       723127 :             for (int const spaceNum : thisEnclosure.spaceNums) {
    7362       370253 :                 Real64 spaceQL = SumAllSpaceInternalRadiationGains(state, spaceNum);
    7363       370253 :                 thisEnclosure.radQThermalRad += spaceQL;
    7364       352874 :             }
    7365              :         }
    7366              : 
    7367       249958 :         pulseMultipler = 0.01; // the W/sqft pulse for the zone
    7368       249958 :         if (state.dataGlobal->CompLoadReportIsReq) {
    7369        19260 :             AllocateLoadComponentArrays(state);
    7370              :         }
    7371       586610 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) { // Loop through all surfaces...
    7372       706909 :             for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    7373       370257 :                 auto const &thisSpace = state.dataHeatBal->space(spaceNum);
    7374       370257 :                 int const firstSurf = thisSpace.HTSurfaceFirst;
    7375       370257 :                 int const lastSurf = thisSpace.HTSurfaceLast;
    7376       370257 :                 if (firstSurf <= 0) {
    7377            4 :                     continue;
    7378              :                 }
    7379      2439169 :                 for (int SurfNum = firstSurf; SurfNum <= lastSurf; ++SurfNum) {
    7380      2068916 :                     auto const &thisEnclosure = state.dataViewFactor->EnclRadInfo(state.dataSurface->Surface(SurfNum).RadEnclIndex);
    7381              : 
    7382      2068916 :                     if (!state.dataGlobal->doLoadComponentPulseNow) {
    7383      2068798 :                         state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) =
    7384      2068798 :                             thisEnclosure.radQThermalRad * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum);
    7385              :                     } else {
    7386              :                         // radiant value prior to adjustment for pulse for load component report
    7387          118 :                         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          118 :                         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          118 :                         state.dataHeatBal->SurfQdotRadIntGainsInPerArea(SurfNum) =
    7396          118 :                             adjQL * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum);
    7397              :                         // store the magnitude and time of the pulse
    7398          118 :                         state.dataOutRptTab->radiantPulseTimestep(state.dataSize->CurOverallSimDay, zoneNum) =
    7399          118 :                             (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep;
    7400          118 :                         state.dataOutRptTab->radiantPulseReceived(state.dataSize->CurOverallSimDay, SurfNum) =
    7401          118 :                             (adjQL - curQL) * thisEnclosure.radThermAbsMult * state.dataHeatBalSurf->SurfAbsThermalInt(SurfNum) *
    7402          118 :                             state.dataSurface->Surface(SurfNum).Area;
    7403              :                     }
    7404              :                 }
    7405       336652 :             }
    7406              :         }
    7407       249958 :     }
    7408              : 
    7409       249956 :     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       586606 :         for (auto const &zone : state.dataHeatBal->Zone) {
    7419       336650 :             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       336650 :             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       249956 :         }
    7430       249956 :     }
    7431              : 
    7432           10 :     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           10 :         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           10 :         std::map<int, std::vector<int>> ZoneITEMap;
    7491              : 
    7492              :         //  Zero out time step variables
    7493              :         // Object report variables
    7494           20 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    7495              : 
    7496           80 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7497           70 :                 state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i] = 0.0;
    7498           70 :                 state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i] = 0.0;
    7499              :             }
    7500              : 
    7501           10 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity = 0.0;
    7502           10 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowCurDensity = 0.0;
    7503           10 :             state.dataHeatBal->ZoneITEq(Loop).AirMassFlow = 0.0;
    7504           10 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDryBulbT = 0.0;
    7505           10 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDewpointT = 0.0;
    7506           10 :             state.dataHeatBal->ZoneITEq(Loop).AirInletRelHum = 0.0;
    7507           10 :             state.dataHeatBal->ZoneITEq(Loop).AirOutletDryBulbT = 0.0;
    7508           10 :             state.dataHeatBal->ZoneITEq(Loop).SHI = 0.0;
    7509           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = 0.0;
    7510           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeAboveDryBulbT = 0.0;
    7511           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeBelowDryBulbT = 0.0;
    7512           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeAboveDewpointT = 0.0;
    7513           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeBelowDewpointT = 0.0;
    7514           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeAboveRH = 0.0;
    7515           10 :             state.dataHeatBal->ZoneITEq(Loop).TimeBelowRH = 0.0;
    7516           10 :             state.dataHeatBal->ZoneITEq(Loop).DryBulbTAboveDeltaT = 0.0;
    7517           10 :             state.dataHeatBal->ZoneITEq(Loop).DryBulbTBelowDeltaT = 0.0;
    7518           10 :             state.dataHeatBal->ZoneITEq(Loop).DewpointTAboveDeltaT = 0.0;
    7519           10 :             state.dataHeatBal->ZoneITEq(Loop).DewpointTBelowDeltaT = 0.0;
    7520           10 :             state.dataHeatBal->ZoneITEq(Loop).RHAboveDeltaRH = 0.0;
    7521           10 :             state.dataHeatBal->ZoneITEq(Loop).RHBelowDeltaRH = 0.0;
    7522              :         } // ZoneITEq init loop
    7523              : 
    7524              :         // Zone total report variables
    7525           20 :         for (int Loop = 1; Loop <= state.dataGlobal->NumOfZones; ++Loop) {
    7526              : 
    7527           80 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7528           70 :                 state.dataHeatBal->ZoneRpt(Loop).PowerRpt[i] = 0.0;
    7529           70 :                 state.dataHeatBal->ZoneRpt(Loop).EnergyRpt[i] = 0.0;
    7530              :             }
    7531              : 
    7532           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEAdjReturnTemp = 0.0;
    7533              : 
    7534           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqAirVolFlowStdDensity = 0.0;
    7535           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqAirMassFlow = 0.0;
    7536           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqSHI = 0.0;
    7537           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeOutOfOperRange = 0.0;
    7538           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeAboveDryBulbT = 0.0;
    7539           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeBelowDryBulbT = 0.0;
    7540           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeAboveDewpointT = 0.0;
    7541           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeBelowDewpointT = 0.0;
    7542           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeAboveRH = 0.0;
    7543           10 :             state.dataHeatBal->ZoneRpt(Loop).ITEqTimeBelowRH = 0.0;
    7544              : 
    7545           10 :             state.dataHeatBal->ZoneRpt(Loop).SumTinMinusTSup = 0.0;
    7546           10 :             state.dataHeatBal->ZoneRpt(Loop).SumToutMinusTSup = 0.0;
    7547              :         } // Zone init loop
    7548              : 
    7549              :         // Space total report variables
    7550           20 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    7551              : 
    7552           80 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7553           70 :                 state.dataHeatBal->spaceRpt(spaceNum).PowerRpt[i] = 0.0;
    7554           70 :                 state.dataHeatBal->spaceRpt(spaceNum).EnergyRpt[i] = 0.0;
    7555              :             }
    7556              : 
    7557           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEAdjReturnTemp = 0.0;
    7558              : 
    7559           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirVolFlowStdDensity = 0.0;
    7560           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirMassFlow = 0.0;
    7561           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqSHI = 0.0;
    7562           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = 0.0;
    7563           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDryBulbT = 0.0;
    7564           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDryBulbT = 0.0;
    7565           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDewpointT = 0.0;
    7566           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDewpointT = 0.0;
    7567           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveRH = 0.0;
    7568           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowRH = 0.0;
    7569              : 
    7570           10 :             state.dataHeatBal->spaceRpt(spaceNum).SumTinMinusTSup = 0.0;
    7571           10 :             state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup = 0.0;
    7572              :         } // Space init spaceNum
    7573              : 
    7574           20 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    7575              :             // Get schedules
    7576           10 :             int NZ = state.dataHeatBal->ZoneITEq(Loop).ZonePtr;
    7577           10 :             auto const &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ);
    7578           10 :             int spaceNum = state.dataHeatBal->ZoneITEq(Loop).spaceIndex;
    7579           10 :             OperSchedFrac = state.dataHeatBal->ZoneITEq(Loop).operSched->getCurrentVal();
    7580           10 :             CPULoadSchedFrac = state.dataHeatBal->ZoneITEq(Loop).cpuLoadSched->getCurrentVal();
    7581              : 
    7582              :             // Determine inlet air temperature and humidity
    7583           10 :             AirConnection = state.dataHeatBal->ZoneITEq(Loop).AirConnectionType;
    7584           10 :             RecircFrac = 0.0;
    7585           10 :             int SupplyNodeNum = state.dataHeatBal->ZoneITEq(Loop).SupplyAirNodeNum;
    7586           10 :             if (state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) {
    7587            1 :                 TSupply = state.dataLoopNodes->Node(SupplyNodeNum).Temp;
    7588            1 :                 WSupply = state.dataLoopNodes->Node(SupplyNodeNum).HumRat;
    7589            1 :                 if (state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched != nullptr) {
    7590            0 :                     TAirIn = TSupply + state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched->getCurrentVal();
    7591              :                 } else {
    7592            1 :                     TAirIn = TSupply + state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTemp;
    7593              :                 }
    7594            1 :                 WAirIn = state.dataLoopNodes->Node(SupplyNodeNum).HumRat;
    7595              :             } else {
    7596            9 :                 if (AirConnection == ITEInletConnection::AdjustedSupply) {
    7597            4 :                     TSupply = state.dataLoopNodes->Node(SupplyNodeNum).Temp;
    7598            4 :                     WSupply = state.dataLoopNodes->Node(SupplyNodeNum).HumRat;
    7599            4 :                     if (state.dataHeatBal->ZoneITEq(Loop).RecircFLTCurve != 0) {
    7600            3 :                         RecircFrac = state.dataHeatBal->ZoneITEq(Loop).DesignRecircFrac *
    7601            3 :                                      CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).RecircFLTCurve, CPULoadSchedFrac, TSupply);
    7602              :                     } else {
    7603            1 :                         RecircFrac = state.dataHeatBal->ZoneITEq(Loop).DesignRecircFrac;
    7604              :                     }
    7605            4 :                     TRecirc = thisZoneHB.MAT;
    7606            4 :                     WRecirc = thisZoneHB.airHumRat;
    7607            4 :                     TAirIn = TRecirc * RecircFrac + TSupply * (1.0 - RecircFrac);
    7608            4 :                     WAirIn = WRecirc * RecircFrac + WSupply * (1.0 - RecircFrac);
    7609            5 :                 } 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            5 :                     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            5 :                         TSupply = thisZoneHB.MAT;
    7621              :                     }
    7622            5 :                     TAirIn = thisZoneHB.MAT;
    7623            5 :                     WAirIn = thisZoneHB.airHumRat;
    7624              :                 }
    7625              :             }
    7626           10 :             TDPAirIn = PsyTdpFnWPb(state, WAirIn, state.dataEnvrn->StdBaroPress, RoutineName);
    7627           10 :             RHAirIn = 100.0 * PsyRhFnTdbWPb(state, TAirIn, WAirIn, state.dataEnvrn->StdBaroPress, RoutineName); // RHAirIn is %
    7628              : 
    7629              :             // Calculate power input and airflow
    7630           10 :             TAirInDesign = state.dataHeatBal->ZoneITEq(Loop).DesignTAirIn;
    7631              : 
    7632           10 :             if (state.dataGlobal->DoingSizing && state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) {
    7633              : 
    7634            0 :                 TAirInDesign = state.dataHeatBal->ZoneITEq(Loop).SizingTAirIn;
    7635            0 :                 if (state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched != nullptr) {
    7636            0 :                     TAirInDesign = TAirInDesign + state.dataHeatBal->ZoneITEq(Loop).supplyApproachTempSched->getCurrentVal();
    7637              :                 } else {
    7638            0 :                     TAirInDesign = TAirInDesign + state.dataHeatBal->ZoneITEq(Loop).SupplyApproachTemp;
    7639              :                 }
    7640            0 :                 OperSchedFrac = state.dataHeatBal->ZoneITEq(Loop).operSched->getCurrentVal();
    7641            0 :                 CPULoadSchedFrac = state.dataHeatBal->ZoneITEq(Loop).cpuLoadSched->getCurrentVal();
    7642              :             }
    7643              : 
    7644           10 :             CPUPower = max(state.dataHeatBal->ZoneITEq(Loop).DesignCPUPower * OperSchedFrac *
    7645           10 :                                CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).CPUPowerFLTCurve, CPULoadSchedFrac, TAirIn),
    7646              :                            0.0);
    7647           10 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPUAtDesign] =
    7648           10 :                 max(state.dataHeatBal->ZoneITEq(Loop).DesignCPUPower * OperSchedFrac *
    7649           10 :                         CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).CPUPowerFLTCurve, CPULoadSchedFrac, TAirInDesign),
    7650              :                     0.0);
    7651              : 
    7652           10 :             AirVolFlowFrac = max(CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).AirFlowFLTCurve, CPULoadSchedFrac, TAirIn), 0.0);
    7653           10 :             AirVolFlowRate = state.dataHeatBal->ZoneITEq(Loop).DesignAirVolFlowRate * OperSchedFrac * AirVolFlowFrac;
    7654           10 :             if (AirVolFlowRate < SmallAirVolFlow) {
    7655            3 :                 AirVolFlowRate = 0.0;
    7656              :             }
    7657           10 :             AirVolFlowFracDesignT = max(CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).AirFlowFLTCurve, CPULoadSchedFrac, TAirInDesign), 0.0);
    7658              : 
    7659           10 :             FanPower = max(state.dataHeatBal->ZoneITEq(Loop).DesignFanPower * OperSchedFrac *
    7660           10 :                                CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).FanPowerFFCurve, AirVolFlowFrac),
    7661              :                            0.0);
    7662           10 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::FanAtDesign] =
    7663           10 :                 max(state.dataHeatBal->ZoneITEq(Loop).DesignFanPower * OperSchedFrac *
    7664           10 :                         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           10 :             if (state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower > 0.0) {
    7669           10 :                 UPSPartLoadRatio = (CPUPower + FanPower) / state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower;
    7670              :             } else {
    7671            0 :                 UPSPartLoadRatio = 0.0;
    7672              :             }
    7673           10 :             if (state.dataHeatBal->ZoneITEq(Loop).UPSEfficFPLRCurve != 0) {
    7674            4 :                 UPSPower =
    7675            4 :                     (CPUPower + FanPower) * max((1.0 - state.dataHeatBal->ZoneITEq(Loop).DesignUPSEfficiency *
    7676            4 :                                                            CurveValue(state, state.dataHeatBal->ZoneITEq(Loop).UPSEfficFPLRCurve, UPSPartLoadRatio)),
    7677              :                                                 0.0);
    7678              :             } else {
    7679            6 :                 UPSPower = (CPUPower + FanPower) * max((1.0 - state.dataHeatBal->ZoneITEq(Loop).DesignUPSEfficiency), 0.0);
    7680              :             }
    7681           10 :             UPSHeatGain = UPSPower * state.dataHeatBal->ZoneITEq(Loop).UPSLossToZoneFrac;
    7682              : 
    7683              :             // Calculate air outlet conditions and convective heat gain to zone
    7684              : 
    7685           10 :             AirMassFlowRate = AirVolFlowRate * PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, TAirIn, WAirIn, RoutineName);
    7686           10 :             if (AirMassFlowRate > 0.0) {
    7687            7 :                 TAirOut = TAirIn + (CPUPower + FanPower) / AirMassFlowRate / PsyCpAirFnW(WAirIn);
    7688              :             } else {
    7689            3 :                 TAirOut = TAirIn;
    7690              :             }
    7691              : 
    7692           10 :             if (std::abs(TAirOut - TSupply) < SmallTempDiff) {
    7693            0 :                 TAirOut = TSupply;
    7694              :             }
    7695              : 
    7696           10 :             if ((SupplyNodeNum != 0) && (TAirOut != TSupply)) {
    7697            5 :                 SupplyHeatIndex = (TAirIn - TSupply) / (TAirOut - TSupply);
    7698              :             } else {
    7699            5 :                 SupplyHeatIndex = 0.0;
    7700              :             }
    7701              : 
    7702           10 :             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           10 :                 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           10 :             if (state.dataHeatBal->Zone(state.dataHeatBal->ZoneITEq(Loop).ZonePtr).HasAdjustedReturnTempByITE) {
    7711            1 :                 ZoneITEMap[state.dataHeatBal->ZoneITEq(Loop).ZonePtr].push_back(Loop);
    7712              :             }
    7713           10 :             if (state.dataGlobal->DoingSizing && state.dataHeatBal->ZoneITEq(Loop).FlowControlWithApproachTemps) {
    7714            0 :                 if (state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::FanAtDesign] +
    7715            0 :                         state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPUAtDesign] >
    7716            0 :                     state.dataHeatBal->ZoneITEq(Loop).DesignTotalPower) {
    7717            0 :                     state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::ConGainToZone] =
    7718            0 :                         state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::FanAtDesign] +
    7719            0 :                         state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPUAtDesign];
    7720              :                 }
    7721              :             }
    7722              :             // Object report variables
    7723           10 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::CPU] = CPUPower;
    7724           10 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::Fan] = FanPower;
    7725           10 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::UPS] = UPSPower;
    7726              :             // ZoneITEq( Loop ).CPUPowerAtDesign = set above
    7727              :             // ZoneITEq( Loop ).FanPowerAtDesign = set above
    7728           10 :             state.dataHeatBal->ZoneITEq(Loop).PowerRpt[(int)PERptVars::UPSGainToZone] = UPSHeatGain; // UPSGainRateToZone = UPSHeatGain;
    7729              :             // ZoneITEq( Loop ).ConGainRateToZone = set above
    7730              : 
    7731           80 :             for (int i = 0; i < (int)PERptVars::Num; ++i) {
    7732           70 :                 state.dataHeatBal->ZoneRpt(NZ).PowerRpt[i] += state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i];
    7733           70 :                 state.dataHeatBal->spaceRpt(spaceNum).PowerRpt[i] += state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i];
    7734           70 :                 state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i] = state.dataHeatBal->ZoneITEq(Loop).PowerRpt[i] * state.dataGlobal->TimeStepZoneSec;
    7735           70 :                 state.dataHeatBal->ZoneRpt(NZ).EnergyRpt[i] += state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i];
    7736           70 :                 state.dataHeatBal->spaceRpt(spaceNum).EnergyRpt[i] += state.dataHeatBal->ZoneITEq(Loop).EnergyRpt[i];
    7737              :             }
    7738              : 
    7739           10 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity = AirMassFlowRate / state.dataEnvrn->StdRhoAir;
    7740           10 :             state.dataHeatBal->ZoneITEq(Loop).AirVolFlowCurDensity = AirVolFlowRate;
    7741           10 :             state.dataHeatBal->ZoneITEq(Loop).AirMassFlow = AirMassFlowRate;
    7742           10 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDryBulbT = TAirIn;
    7743           10 :             state.dataHeatBal->ZoneITEq(Loop).AirInletDewpointT = TDPAirIn;
    7744           10 :             state.dataHeatBal->ZoneITEq(Loop).AirInletRelHum = RHAirIn;
    7745           10 :             state.dataHeatBal->ZoneITEq(Loop).AirOutletDryBulbT = TAirOut;
    7746           10 :             state.dataHeatBal->ZoneITEq(Loop).SHI = SupplyHeatIndex;
    7747              : 
    7748           10 :             state.dataHeatBal->ZoneRpt(NZ).ITEqAirVolFlowStdDensity += state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity;
    7749           10 :             state.dataHeatBal->ZoneRpt(NZ).ITEqAirMassFlow += state.dataHeatBal->ZoneITEq(Loop).AirMassFlow;
    7750           10 :             state.dataHeatBal->ZoneRpt(NZ).SumTinMinusTSup += (TAirIn - TSupply) * AirVolFlowRate;
    7751           10 :             state.dataHeatBal->ZoneRpt(NZ).SumToutMinusTSup += (TAirOut - TSupply) * AirVolFlowRate;
    7752              : 
    7753           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirVolFlowStdDensity += state.dataHeatBal->ZoneITEq(Loop).AirVolFlowStdDensity;
    7754           10 :             state.dataHeatBal->spaceRpt(spaceNum).ITEqAirMassFlow += state.dataHeatBal->ZoneITEq(Loop).AirMassFlow;
    7755           10 :             state.dataHeatBal->spaceRpt(spaceNum).SumTinMinusTSup += (TAirIn - TSupply) * AirVolFlowRate;
    7756           10 :             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           10 :             int EnvClass = static_cast<int>(state.dataHeatBal->ZoneITEq(Loop).Class);
    7761           10 :             if (EnvClass > 0) {
    7762           10 :                 if (TAirIn > DBMax[EnvClass]) {
    7763            5 :                     state.dataHeatBal->ZoneITEq(Loop).TimeAboveDryBulbT = state.dataGlobal->TimeStepZone;
    7764            5 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7765            5 :                     state.dataHeatBal->ZoneITEq(Loop).DryBulbTAboveDeltaT = TAirIn - DBMax[EnvClass];
    7766            5 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeAboveDryBulbT = state.dataGlobal->TimeStepZone;
    7767            5 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7768            5 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDryBulbT = state.dataGlobal->TimeStepZone;
    7769            5 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7770              :                 }
    7771           10 :                 if (TAirIn < DBMin[EnvClass]) {
    7772            3 :                     state.dataHeatBal->ZoneITEq(Loop).TimeBelowDryBulbT = state.dataGlobal->TimeStepZone;
    7773            3 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7774            3 :                     state.dataHeatBal->ZoneITEq(Loop).DryBulbTBelowDeltaT = TAirIn - DBMin[EnvClass];
    7775            3 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeBelowDryBulbT = state.dataGlobal->TimeStepZone;
    7776            3 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7777            3 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDryBulbT = state.dataGlobal->TimeStepZone;
    7778            3 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7779              :                 }
    7780           10 :                 if (TDPAirIn > DPMax[EnvClass]) {
    7781            2 :                     state.dataHeatBal->ZoneITEq(Loop).TimeAboveDewpointT = state.dataGlobal->TimeStepZone;
    7782            2 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7783            2 :                     state.dataHeatBal->ZoneITEq(Loop).DewpointTAboveDeltaT = TDPAirIn - DPMax[EnvClass];
    7784            2 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeAboveDewpointT = state.dataGlobal->TimeStepZone;
    7785            2 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7786            2 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveDewpointT = state.dataGlobal->TimeStepZone;
    7787            2 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7788              :                 }
    7789           10 :                 if (TDPAirIn < DPMin[EnvClass]) {
    7790            5 :                     state.dataHeatBal->ZoneITEq(Loop).TimeBelowDewpointT = state.dataGlobal->TimeStepZone;
    7791            5 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7792            5 :                     state.dataHeatBal->ZoneITEq(Loop).DewpointTBelowDeltaT = TDPAirIn - DPMin[EnvClass];
    7793            5 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeBelowDewpointT = state.dataGlobal->TimeStepZone;
    7794            5 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7795            5 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowDewpointT = state.dataGlobal->TimeStepZone;
    7796            5 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7797              :                 }
    7798           10 :                 if (RHAirIn > RHMax[EnvClass]) {
    7799            0 :                     state.dataHeatBal->ZoneITEq(Loop).TimeAboveRH = state.dataGlobal->TimeStepZone;
    7800            0 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7801            0 :                     state.dataHeatBal->ZoneITEq(Loop).RHAboveDeltaRH = RHAirIn - RHMax[EnvClass];
    7802            0 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeAboveRH = state.dataGlobal->TimeStepZone;
    7803            0 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7804            0 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeAboveRH = state.dataGlobal->TimeStepZone;
    7805            0 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7806              :                 }
    7807           10 :                 if (RHAirIn < RHMin[EnvClass]) {
    7808            2 :                     state.dataHeatBal->ZoneITEq(Loop).TimeBelowRH = state.dataGlobal->TimeStepZone;
    7809            2 :                     state.dataHeatBal->ZoneITEq(Loop).TimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7810            2 :                     state.dataHeatBal->ZoneITEq(Loop).RHBelowDeltaRH = RHAirIn - RHMin[EnvClass];
    7811            2 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeBelowRH = state.dataGlobal->TimeStepZone;
    7812            2 :                     state.dataHeatBal->ZoneRpt(NZ).ITEqTimeOutOfOperRange = state.dataGlobal->TimeStepZone;
    7813            2 :                     state.dataHeatBal->spaceRpt(spaceNum).ITEqTimeBelowRH = state.dataGlobal->TimeStepZone;
    7814            2 :                     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           20 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotITEquip; ++Loop) {
    7822           10 :             int ZN = state.dataHeatBal->ZoneITEq(Loop).ZonePtr;
    7823           10 :             int spaceNum = state.dataHeatBal->ZoneITEq(Loop).spaceIndex;
    7824           10 :             if (state.dataHeatBal->ZoneRpt(ZN).SumToutMinusTSup != 0.0) {
    7825            7 :                 state.dataHeatBal->ZoneRpt(ZN).ITEqSHI =
    7826            7 :                     state.dataHeatBal->ZoneRpt(ZN).SumTinMinusTSup / state.dataHeatBal->ZoneRpt(ZN).SumToutMinusTSup;
    7827              :             }
    7828           10 :             if (state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup != 0.0) {
    7829            7 :                 state.dataHeatBal->spaceRpt(spaceNum).ITEqSHI =
    7830            7 :                     state.dataHeatBal->spaceRpt(spaceNum).SumTinMinusTSup / state.dataHeatBal->spaceRpt(spaceNum).SumToutMinusTSup;
    7831              :             }
    7832              :         }
    7833              : 
    7834           10 :         std::map<int, std::vector<int>>::iterator it = ZoneITEMap.begin();
    7835              :         Real64 totalGain;
    7836              :         Real64 totalRate;
    7837              :         Real64 TAirReturn;
    7838           11 :         while (it != ZoneITEMap.end()) {
    7839            1 :             if (state.dataHeatBal->Zone(it->first).HasAdjustedReturnTempByITE) {
    7840            1 :                 totalGain = 0;
    7841            1 :                 totalRate = 0;
    7842            2 :                 for (int i : it->second) {
    7843            1 :                     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            1 :                         TAirReturn = state.dataHeatBal->ZoneITEq(i).AirOutletDryBulbT + state.dataHeatBal->ZoneITEq(i).ReturnApproachTemp;
    7848              :                     }
    7849            1 :                     totalRate += state.dataHeatBal->ZoneITEq(i).AirMassFlow;
    7850            1 :                     totalGain += state.dataHeatBal->ZoneITEq(i).AirMassFlow * TAirReturn;
    7851            1 :                 }
    7852            1 :                 if (totalRate != 0) {
    7853            1 :                     state.dataHeatBal->Zone(it->first).AdjustedReturnTempByITE = totalGain / totalRate;
    7854            1 :                     state.dataHeatBal->ZoneRpt(it->first).ITEAdjReturnTemp = state.dataHeatBal->Zone(it->first).AdjustedReturnTempByITE;
    7855              :                 }
    7856              :             }
    7857            1 :             ++it;
    7858              :         }
    7859              : 
    7860           10 :     } // End CalcZoneITEq
    7861              : 
    7862       249958 :     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       371851 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotPeople; ++Loop) {
    7893       121893 :             auto &thisPeople = state.dataHeatBal->People(Loop);
    7894       121893 :             thisPeople.RadGainEnergy = thisPeople.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7895       121893 :             thisPeople.ConGainEnergy = thisPeople.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7896       121893 :             thisPeople.SenGainEnergy = thisPeople.SenGainRate * state.dataGlobal->TimeStepZoneSec;
    7897       121893 :             thisPeople.LatGainEnergy = thisPeople.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7898       121893 :             thisPeople.TotGainEnergy = thisPeople.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7899              :         }
    7900              : 
    7901       376570 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    7902       126612 :             auto &thisLights = state.dataHeatBal->Lights(Loop);
    7903       126612 :             thisLights.Consumption = thisLights.Power * state.dataGlobal->TimeStepZoneSec;
    7904       126612 :             thisLights.RadGainEnergy = thisLights.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7905       126612 :             thisLights.VisGainEnergy = thisLights.VisGainRate * state.dataGlobal->TimeStepZoneSec;
    7906       126612 :             thisLights.ConGainEnergy = thisLights.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7907       126612 :             thisLights.RetAirGainEnergy = thisLights.RetAirGainRate * state.dataGlobal->TimeStepZoneSec;
    7908       126612 :             thisLights.TotGainEnergy = thisLights.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7909       126612 :             if (!state.dataGlobal->WarmupFlag) {
    7910        20656 :                 if (state.dataGlobal->DoOutputReporting && state.dataOutRptTab->WriteTabularFiles &&
    7911         2531 :                     (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather)) { // for weather simulations only
    7912              :                     // for tabular report, accumulate the total electricity used for each Light object
    7913            0 :                     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            0 :                     if (thisLights.Power > 0.01 * thisLights.DesignLevel) {
    7916            0 :                         thisLights.SumTimeNotZeroCons += state.dataGlobal->TimeStepZone;
    7917              :                     }
    7918              :                 }
    7919              :             }
    7920              :         }
    7921              : 
    7922       432678 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotElecEquip; ++Loop) {
    7923       182720 :             auto &thisElecEquip = state.dataHeatBal->ZoneElectric(Loop);
    7924       182720 :             thisElecEquip.Consumption = thisElecEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7925       182720 :             thisElecEquip.RadGainEnergy = thisElecEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7926       182720 :             thisElecEquip.ConGainEnergy = thisElecEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7927       182720 :             thisElecEquip.LatGainEnergy = thisElecEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7928       182720 :             thisElecEquip.LostEnergy = thisElecEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7929       182720 :             thisElecEquip.TotGainEnergy = thisElecEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7930              :         }
    7931              : 
    7932       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotGasEquip; ++Loop) {
    7933            4 :             auto &thisGasEquip = state.dataHeatBal->ZoneGas(Loop);
    7934            4 :             thisGasEquip.Consumption = thisGasEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7935            4 :             thisGasEquip.RadGainEnergy = thisGasEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7936            4 :             thisGasEquip.ConGainEnergy = thisGasEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7937            4 :             thisGasEquip.LatGainEnergy = thisGasEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7938            4 :             thisGasEquip.LostEnergy = thisGasEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7939            4 :             thisGasEquip.TotGainEnergy = thisGasEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7940              :         }
    7941              : 
    7942       493040 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotOthEquip; ++Loop) {
    7943       243082 :             auto &thisOtherEquip = state.dataHeatBal->ZoneOtherEq(Loop);
    7944       243082 :             thisOtherEquip.Consumption = thisOtherEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7945       243082 :             thisOtherEquip.RadGainEnergy = thisOtherEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7946       243082 :             thisOtherEquip.ConGainEnergy = thisOtherEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7947       243082 :             thisOtherEquip.LatGainEnergy = thisOtherEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7948       243082 :             thisOtherEquip.LostEnergy = thisOtherEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7949       243082 :             thisOtherEquip.TotGainEnergy = thisOtherEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7950              :         }
    7951              : 
    7952       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotHWEquip; ++Loop) {
    7953            4 :             auto &thisHWEquip = state.dataHeatBal->ZoneHWEq(Loop);
    7954            4 :             thisHWEquip.Consumption = thisHWEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7955            4 :             thisHWEquip.RadGainEnergy = thisHWEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7956            4 :             thisHWEquip.ConGainEnergy = thisHWEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7957            4 :             thisHWEquip.LatGainEnergy = thisHWEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7958            4 :             thisHWEquip.LostEnergy = thisHWEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7959            4 :             thisHWEquip.TotGainEnergy = thisHWEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7960              :         }
    7961              : 
    7962       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotStmEquip; ++Loop) {
    7963            4 :             auto &thisSteamEquip = state.dataHeatBal->ZoneSteamEq(Loop);
    7964            4 :             thisSteamEquip.Consumption = thisSteamEquip.Power * state.dataGlobal->TimeStepZoneSec;
    7965            4 :             thisSteamEquip.RadGainEnergy = thisSteamEquip.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7966            4 :             thisSteamEquip.ConGainEnergy = thisSteamEquip.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7967            4 :             thisSteamEquip.LatGainEnergy = thisSteamEquip.LatGainRate * state.dataGlobal->TimeStepZoneSec;
    7968            4 :             thisSteamEquip.LostEnergy = thisSteamEquip.LostRate * state.dataGlobal->TimeStepZoneSec;
    7969            4 :             thisSteamEquip.TotGainEnergy = thisSteamEquip.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7970              :         }
    7971              : 
    7972       249962 :         for (int Loop = 1; Loop <= state.dataHeatBal->TotBBHeat; ++Loop) {
    7973            4 :             auto &thisBBHeat = state.dataHeatBal->ZoneBBHeat(Loop);
    7974            4 :             thisBBHeat.Consumption = thisBBHeat.Power * state.dataGlobal->TimeStepZoneSec;
    7975            4 :             thisBBHeat.RadGainEnergy = thisBBHeat.RadGainRate * state.dataGlobal->TimeStepZoneSec;
    7976            4 :             thisBBHeat.ConGainEnergy = thisBBHeat.ConGainRate * state.dataGlobal->TimeStepZoneSec;
    7977            4 :             thisBBHeat.TotGainEnergy = thisBBHeat.TotGainRate * state.dataGlobal->TimeStepZoneSec;
    7978              :         }
    7979              : 
    7980              :         // Zero zone-level values
    7981       586610 :         for (auto &e : state.dataHeatBal->ZoneIntGain) {
    7982       336652 :             e.NOFOCC = 0.0;
    7983       336652 :             e.QLTSW = 0.0;
    7984       249958 :         }
    7985              : 
    7986       586610 :         for (auto &e : state.dataHeatBal->ZoneRpt) {
    7987              :             // People
    7988       336652 :             e.PeopleRadGain = 0.0;
    7989       336652 :             e.PeopleConGain = 0.0;
    7990       336652 :             e.PeopleSenGain = 0.0;
    7991       336652 :             e.PeopleNumOcc = 0.0;
    7992       336652 :             e.PeopleLatGain = 0.0;
    7993       336652 :             e.PeopleTotGain = 0.0;
    7994       336652 :             e.PeopleRadGainRate = 0.0;
    7995       336652 :             e.PeopleConGainRate = 0.0;
    7996       336652 :             e.PeopleSenGainRate = 0.0;
    7997       336652 :             e.PeopleLatGainRate = 0.0;
    7998       336652 :             e.PeopleTotGainRate = 0.0;
    7999              :             // Lights
    8000       336652 :             e.LtsPower = 0.0;
    8001       336652 :             e.LtsElecConsump = 0.0;
    8002       336652 :             e.LtsRadGain = 0.0;
    8003       336652 :             e.LtsVisGain = 0.0;
    8004       336652 :             e.LtsConGain = 0.0;
    8005       336652 :             e.LtsRetAirGain = 0.0;
    8006       336652 :             e.LtsTotGain = 0.0;
    8007       336652 :             e.LtsRadGainRate = 0.0;
    8008       336652 :             e.LtsVisGainRate = 0.0;
    8009       336652 :             e.LtsConGainRate = 0.0;
    8010       336652 :             e.LtsRetAirGainRate = 0.0;
    8011       336652 :             e.LtsTotGainRate = 0.0;
    8012              :             // Baseboard Heat
    8013       336652 :             e.BaseHeatPower = 0.0;
    8014       336652 :             e.BaseHeatElecCons = 0.0;
    8015       336652 :             e.BaseHeatRadGain = 0.0;
    8016       336652 :             e.BaseHeatConGain = 0.0;
    8017       336652 :             e.BaseHeatTotGain = 0.0;
    8018       336652 :             e.BaseHeatRadGainRate = 0.0;
    8019       336652 :             e.BaseHeatConGainRate = 0.0;
    8020       336652 :             e.BaseHeatTotGainRate = 0.0;
    8021              :             // Electric Equipment
    8022       336652 :             e.ElecPower = 0.0;
    8023       336652 :             e.ElecConsump = 0.0;
    8024       336652 :             e.ElecRadGain = 0.0;
    8025       336652 :             e.ElecConGain = 0.0;
    8026       336652 :             e.ElecLatGain = 0.0;
    8027       336652 :             e.ElecLost = 0.0;
    8028       336652 :             e.ElecTotGain = 0.0;
    8029       336652 :             e.ElecRadGainRate = 0.0;
    8030       336652 :             e.ElecConGainRate = 0.0;
    8031       336652 :             e.ElecLatGainRate = 0.0;
    8032       336652 :             e.ElecLostRate = 0.0;
    8033       336652 :             e.ElecTotGainRate = 0.0;
    8034              :             // Gas Equipment
    8035       336652 :             e.GasPower = 0.0;
    8036       336652 :             e.GasConsump = 0.0;
    8037       336652 :             e.GasRadGain = 0.0;
    8038       336652 :             e.GasConGain = 0.0;
    8039       336652 :             e.GasLatGain = 0.0;
    8040       336652 :             e.GasLost = 0.0;
    8041       336652 :             e.GasTotGain = 0.0;
    8042       336652 :             e.GasRadGainRate = 0.0;
    8043       336652 :             e.GasConGainRate = 0.0;
    8044       336652 :             e.GasLatGainRate = 0.0;
    8045       336652 :             e.GasLostRate = 0.0;
    8046       336652 :             e.GasTotGainRate = 0.0;
    8047              :             // Hot Water Equipment
    8048       336652 :             e.HWPower = 0.0;
    8049       336652 :             e.HWConsump = 0.0;
    8050       336652 :             e.HWRadGain = 0.0;
    8051       336652 :             e.HWConGain = 0.0;
    8052       336652 :             e.HWLatGain = 0.0;
    8053       336652 :             e.HWLost = 0.0;
    8054       336652 :             e.HWTotGain = 0.0;
    8055       336652 :             e.HWRadGainRate = 0.0;
    8056       336652 :             e.HWConGainRate = 0.0;
    8057       336652 :             e.HWLatGainRate = 0.0;
    8058       336652 :             e.HWLostRate = 0.0;
    8059       336652 :             e.HWTotGainRate = 0.0;
    8060              :             // Steam Equipment
    8061       336652 :             e.SteamPower = 0.0;
    8062       336652 :             e.SteamConsump = 0.0;
    8063       336652 :             e.SteamRadGain = 0.0;
    8064       336652 :             e.SteamConGain = 0.0;
    8065       336652 :             e.SteamLatGain = 0.0;
    8066       336652 :             e.SteamLost = 0.0;
    8067       336652 :             e.SteamTotGain = 0.0;
    8068       336652 :             e.SteamRadGainRate = 0.0;
    8069       336652 :             e.SteamConGainRate = 0.0;
    8070       336652 :             e.SteamLatGainRate = 0.0;
    8071       336652 :             e.SteamLostRate = 0.0;
    8072       336652 :             e.SteamTotGainRate = 0.0;
    8073              :             // Other Equipment
    8074       336652 :             e.OtherRadGain = 0.0;
    8075       336652 :             e.OtherConGain = 0.0;
    8076       336652 :             e.OtherLatGain = 0.0;
    8077       336652 :             e.OtherLost = 0.0;
    8078       336652 :             e.OtherTotGain = 0.0;
    8079       336652 :             e.OtherRadGainRate = 0.0;
    8080       336652 :             e.OtherConGainRate = 0.0;
    8081       336652 :             e.OtherLatGainRate = 0.0;
    8082       336652 :             e.OtherLostRate = 0.0;
    8083       336652 :             e.OtherTotGainRate = 0.0;
    8084              :             // Overall Zone Variables
    8085       336652 :             e.TotRadiantGain = 0.0;
    8086       336652 :             e.TotVisHeatGain = 0.0;
    8087       336652 :             e.TotConvectiveGain = 0.0;
    8088       336652 :             e.TotLatentGain = 0.0;
    8089       336652 :             e.TotTotalHeatGain = 0.0;
    8090       336652 :             e.TotRadiantGainRate = 0.0;
    8091       336652 :             e.TotVisHeatGainRate = 0.0;
    8092       336652 :             e.TotConvectiveGainRate = 0.0;
    8093       336652 :             e.TotLatentGainRate = 0.0;
    8094       336652 :             e.TotTotalHeatGainRate = 0.0;
    8095              :             // Contaminant
    8096              :             // e.CO2Rate = 0.0; - cleared and accumulated in InitInternalHeatGains
    8097       336652 :             e.GCRate = 0.0;
    8098      5386432 :             for (int i = 0; i < (int)Constant::eFuel::Num; ++i) {
    8099      5049780 :                 e.OtherPower[i] = 0.0;
    8100      5049780 :                 e.OtherConsump[i] = 0.0;
    8101              :             }
    8102       249958 :         }
    8103              : 
    8104       620215 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    8105       370257 :             auto &thisSpaceRpt = state.dataHeatBal->spaceRpt(spaceNum);
    8106       370257 :             auto &thisSpaceIntGain = state.dataHeatBal->spaceIntGain(spaceNum);
    8107       370257 :             int zoneNum = state.dataHeatBal->space(spaceNum).zoneNum;
    8108       370257 :             auto &thisZoneRpt = state.dataHeatBal->ZoneRpt(zoneNum);
    8109       370257 :             auto &thisZoneIntGain = state.dataHeatBal->ZoneIntGain(zoneNum);
    8110              :             // People
    8111       370257 :             thisSpaceRpt.PeopleNumOcc = thisSpaceIntGain.NOFOCC;
    8112       370257 :             thisSpaceRpt.PeopleRadGain = thisSpaceRpt.PeopleRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8113       370257 :             thisSpaceRpt.PeopleConGain = thisSpaceRpt.PeopleConGainRate * state.dataGlobal->TimeStepZoneSec;
    8114       370257 :             thisSpaceRpt.PeopleSenGain = thisSpaceRpt.PeopleSenGainRate * state.dataGlobal->TimeStepZoneSec;
    8115       370257 :             thisSpaceRpt.PeopleLatGain = thisSpaceRpt.PeopleLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8116       370257 :             thisSpaceRpt.PeopleTotGain = thisSpaceRpt.PeopleTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8117              : 
    8118       370257 :             thisZoneIntGain.NOFOCC += thisSpaceIntGain.NOFOCC;
    8119       370257 :             thisZoneRpt.PeopleRadGainRate += thisSpaceRpt.PeopleRadGainRate;
    8120       370257 :             thisZoneRpt.PeopleConGainRate += thisSpaceRpt.PeopleConGainRate;
    8121       370257 :             thisZoneRpt.PeopleSenGainRate += thisSpaceRpt.PeopleSenGainRate;
    8122       370257 :             thisZoneRpt.PeopleLatGainRate += thisSpaceRpt.PeopleLatGainRate;
    8123       370257 :             thisZoneRpt.PeopleTotGainRate += thisSpaceRpt.PeopleTotGainRate;
    8124              : 
    8125              :             // General Lights
    8126       370257 :             thisSpaceRpt.LtsElecConsump = thisSpaceRpt.LtsPower * state.dataGlobal->TimeStepZoneSec;
    8127       370257 :             thisSpaceRpt.LtsRetAirGain = thisSpaceRpt.LtsRetAirGainRate * state.dataGlobal->TimeStepZoneSec;
    8128       370257 :             thisSpaceRpt.LtsRadGain = thisSpaceRpt.LtsRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8129       370257 :             thisSpaceRpt.LtsTotGain = thisSpaceRpt.LtsTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8130       370257 :             thisSpaceRpt.LtsConGain = thisSpaceRpt.LtsConGainRate * state.dataGlobal->TimeStepZoneSec;
    8131       370257 :             thisSpaceRpt.LtsVisGain = thisSpaceRpt.LtsVisGainRate * state.dataGlobal->TimeStepZoneSec;
    8132              : 
    8133       370257 :             thisZoneRpt.LtsPower += thisSpaceRpt.LtsPower;
    8134       370257 :             thisZoneRpt.LtsRetAirGainRate += thisSpaceRpt.LtsRetAirGainRate;
    8135       370257 :             thisZoneRpt.LtsRadGainRate += thisSpaceRpt.LtsRadGainRate;
    8136       370257 :             thisZoneRpt.LtsTotGainRate += thisSpaceRpt.LtsTotGainRate;
    8137       370257 :             thisZoneRpt.LtsConGainRate += thisSpaceRpt.LtsConGainRate;
    8138       370257 :             thisZoneRpt.LtsVisGainRate += thisSpaceRpt.LtsVisGainRate;
    8139       370257 :             thisZoneIntGain.QLTSW += thisSpaceIntGain.QLTSW;
    8140              : 
    8141              :             // Electric Equipment
    8142       370257 :             thisSpaceRpt.ElecConsump = thisSpaceRpt.ElecPower * state.dataGlobal->TimeStepZoneSec;
    8143       370257 :             thisSpaceRpt.ElecConGain = thisSpaceRpt.ElecConGainRate * state.dataGlobal->TimeStepZoneSec;
    8144       370257 :             thisSpaceRpt.ElecRadGain = thisSpaceRpt.ElecRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8145       370257 :             thisSpaceRpt.ElecLatGain = thisSpaceRpt.ElecLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8146       370257 :             thisSpaceRpt.ElecLost = thisSpaceRpt.ElecLostRate * state.dataGlobal->TimeStepZoneSec;
    8147       370257 :             thisSpaceRpt.ElecTotGainRate = thisSpaceRpt.ElecConGainRate + thisSpaceRpt.ElecRadGainRate + thisSpaceRpt.ElecLatGainRate;
    8148       370257 :             thisSpaceRpt.ElecTotGain = thisSpaceRpt.ElecTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8149              : 
    8150       370257 :             thisZoneRpt.ElecPower += thisSpaceRpt.ElecPower;
    8151       370257 :             thisZoneRpt.ElecConGainRate += thisSpaceRpt.ElecConGainRate;
    8152       370257 :             thisZoneRpt.ElecRadGainRate += thisSpaceRpt.ElecRadGainRate;
    8153       370257 :             thisZoneRpt.ElecLatGainRate += thisSpaceRpt.ElecLatGainRate;
    8154       370257 :             thisZoneRpt.ElecLostRate += thisSpaceRpt.ElecLostRate;
    8155       370257 :             thisZoneRpt.ElecTotGainRate += thisSpaceRpt.ElecTotGainRate;
    8156              : 
    8157              :             // Gas Equipment
    8158       370257 :             thisSpaceRpt.GasConsump = thisSpaceRpt.GasPower * state.dataGlobal->TimeStepZoneSec;
    8159       370257 :             thisSpaceRpt.GasConGain = thisSpaceRpt.GasConGainRate * state.dataGlobal->TimeStepZoneSec;
    8160       370257 :             thisSpaceRpt.GasRadGain = thisSpaceRpt.GasRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8161       370257 :             thisSpaceRpt.GasLatGain = thisSpaceRpt.GasLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8162       370257 :             thisSpaceRpt.GasLost = thisSpaceRpt.GasLostRate * state.dataGlobal->TimeStepZoneSec;
    8163       370257 :             thisSpaceRpt.GasTotGainRate = thisSpaceRpt.GasConGainRate + thisSpaceRpt.GasRadGainRate + thisSpaceRpt.GasLatGainRate;
    8164       370257 :             thisSpaceRpt.GasTotGain = thisSpaceRpt.GasTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8165              : 
    8166       370257 :             thisZoneRpt.GasPower += thisSpaceRpt.GasPower;
    8167       370257 :             thisZoneRpt.GasConGainRate += thisSpaceRpt.GasConGainRate;
    8168       370257 :             thisZoneRpt.GasRadGainRate += thisSpaceRpt.GasRadGainRate;
    8169       370257 :             thisZoneRpt.GasLatGainRate += thisSpaceRpt.GasLatGainRate;
    8170       370257 :             thisZoneRpt.GasLostRate += thisSpaceRpt.GasLostRate;
    8171       370257 :             thisZoneRpt.GasTotGainRate += thisSpaceRpt.GasTotGainRate;
    8172              : 
    8173              :             // Hot Water Equipment
    8174       370257 :             thisSpaceRpt.HWConsump = thisSpaceRpt.HWPower * state.dataGlobal->TimeStepZoneSec;
    8175       370257 :             thisSpaceRpt.HWConGain = thisSpaceRpt.HWConGainRate * state.dataGlobal->TimeStepZoneSec;
    8176       370257 :             thisSpaceRpt.HWRadGain = thisSpaceRpt.HWRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8177       370257 :             thisSpaceRpt.HWLatGain = thisSpaceRpt.HWLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8178       370257 :             thisSpaceRpt.HWLost = thisSpaceRpt.HWLostRate * state.dataGlobal->TimeStepZoneSec;
    8179       370257 :             thisSpaceRpt.HWTotGainRate = thisSpaceRpt.HWConGainRate + thisSpaceRpt.HWRadGainRate + thisSpaceRpt.HWLatGainRate;
    8180       370257 :             thisSpaceRpt.HWTotGain = thisSpaceRpt.HWTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8181              : 
    8182       370257 :             thisZoneRpt.HWPower += thisSpaceRpt.HWPower;
    8183       370257 :             thisZoneRpt.HWConGainRate += thisSpaceRpt.HWConGainRate;
    8184       370257 :             thisZoneRpt.HWRadGainRate += thisSpaceRpt.HWRadGainRate;
    8185       370257 :             thisZoneRpt.HWLatGainRate += thisSpaceRpt.HWLatGainRate;
    8186       370257 :             thisZoneRpt.HWLostRate += thisSpaceRpt.HWLostRate;
    8187       370257 :             thisZoneRpt.HWTotGainRate += thisSpaceRpt.HWTotGainRate;
    8188              : 
    8189              :             // Steam Equipment
    8190       370257 :             thisSpaceRpt.SteamConsump = thisSpaceRpt.SteamPower * state.dataGlobal->TimeStepZoneSec;
    8191       370257 :             thisSpaceRpt.SteamConGain = thisSpaceRpt.SteamConGainRate * state.dataGlobal->TimeStepZoneSec;
    8192       370257 :             thisSpaceRpt.SteamRadGain = thisSpaceRpt.SteamRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8193       370257 :             thisSpaceRpt.SteamLatGain = thisSpaceRpt.SteamLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8194       370257 :             thisSpaceRpt.SteamLost = thisSpaceRpt.SteamLostRate * state.dataGlobal->TimeStepZoneSec;
    8195       370257 :             thisSpaceRpt.SteamTotGainRate = thisSpaceRpt.SteamConGainRate + thisSpaceRpt.SteamRadGainRate + thisSpaceRpt.SteamLatGainRate;
    8196       370257 :             thisSpaceRpt.SteamTotGain = thisSpaceRpt.SteamTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8197              : 
    8198       370257 :             thisZoneRpt.SteamPower += thisSpaceRpt.SteamPower;
    8199       370257 :             thisZoneRpt.SteamConGainRate += thisSpaceRpt.SteamConGainRate;
    8200       370257 :             thisZoneRpt.SteamRadGainRate += thisSpaceRpt.SteamRadGainRate;
    8201       370257 :             thisZoneRpt.SteamLatGainRate += thisSpaceRpt.SteamLatGainRate;
    8202       370257 :             thisZoneRpt.SteamLostRate += thisSpaceRpt.SteamLostRate;
    8203       370257 :             thisZoneRpt.SteamTotGainRate += thisSpaceRpt.SteamTotGainRate;
    8204              : 
    8205              :             // Other Equipment
    8206       370257 :             thisSpaceRpt.OtherConGain = thisSpaceRpt.OtherConGainRate * state.dataGlobal->TimeStepZoneSec;
    8207       370257 :             thisSpaceRpt.OtherRadGain = thisSpaceRpt.OtherRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8208       370257 :             thisSpaceRpt.OtherLatGain = thisSpaceRpt.OtherLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8209       370257 :             thisSpaceRpt.OtherLost = thisSpaceRpt.OtherLostRate * state.dataGlobal->TimeStepZoneSec;
    8210       370257 :             thisSpaceRpt.OtherTotGainRate = thisSpaceRpt.OtherConGainRate + thisSpaceRpt.OtherRadGainRate + thisSpaceRpt.OtherLatGainRate;
    8211       370257 :             thisSpaceRpt.OtherTotGain = thisSpaceRpt.OtherTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8212              : 
    8213       370257 :             thisZoneRpt.OtherConGainRate += thisSpaceRpt.OtherConGainRate;
    8214       370257 :             thisZoneRpt.OtherRadGainRate += thisSpaceRpt.OtherRadGainRate;
    8215       370257 :             thisZoneRpt.OtherLatGainRate += thisSpaceRpt.OtherLatGainRate;
    8216       370257 :             thisZoneRpt.OtherLostRate += thisSpaceRpt.OtherLostRate;
    8217       370257 :             thisZoneRpt.OtherTotGainRate += thisSpaceRpt.OtherTotGainRate;
    8218              : 
    8219       370265 :             for (Constant::eFuel fuelTypeNum : state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums) {
    8220            8 :                 int fuelIdx = (int)fuelTypeNum;
    8221            8 :                 thisSpaceRpt.OtherConsump[fuelIdx] = thisSpaceRpt.OtherPower[fuelIdx] * state.dataGlobal->TimeStepZoneSec;
    8222            8 :                 thisZoneRpt.OtherPower[fuelIdx] += thisSpaceRpt.OtherPower[fuelIdx];
    8223       370257 :             }
    8224              : 
    8225              :             // Baseboard Heat
    8226       370257 :             thisSpaceRpt.BaseHeatElecCons = thisSpaceRpt.BaseHeatPower * state.dataGlobal->TimeStepZoneSec;
    8227       370257 :             thisSpaceRpt.BaseHeatConGain = thisSpaceRpt.BaseHeatConGainRate * state.dataGlobal->TimeStepZoneSec;
    8228       370257 :             thisSpaceRpt.BaseHeatRadGain = thisSpaceRpt.BaseHeatRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8229       370257 :             thisSpaceRpt.BaseHeatTotGainRate = thisSpaceRpt.BaseHeatConGainRate + thisSpaceRpt.BaseHeatRadGainRate;
    8230       370257 :             thisSpaceRpt.BaseHeatTotGain = thisSpaceRpt.BaseHeatTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8231              : 
    8232       370257 :             thisZoneRpt.BaseHeatPower += thisSpaceRpt.BaseHeatPower;
    8233       370257 :             thisZoneRpt.BaseHeatConGainRate += thisSpaceRpt.BaseHeatConGainRate;
    8234       370257 :             thisZoneRpt.BaseHeatRadGainRate += thisSpaceRpt.BaseHeatRadGainRate;
    8235       370257 :             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       370257 :             thisSpaceRpt.TotVisHeatGain = thisSpaceRpt.LtsVisGain;
    8243       370257 :             thisSpaceRpt.TotVisHeatGainRate = thisSpaceRpt.LtsVisGainRate;
    8244              : 
    8245       370257 :             thisSpaceRpt.TotRadiantGainRate = SumInternalRadiationGainsByTypes(state, zoneNum, TradIntGainTypes, spaceNum);
    8246       370257 :             thisSpaceRpt.TotRadiantGain = thisSpaceRpt.TotRadiantGainRate * state.dataGlobal->TimeStepZoneSec;
    8247              : 
    8248       370257 :             thisSpaceRpt.TotConvectiveGainRate = SumInternalConvectionGainsByTypes(state, zoneNum, TradIntGainTypes, spaceNum);
    8249       370257 :             thisSpaceRpt.TotConvectiveGain = thisSpaceRpt.TotConvectiveGainRate * state.dataGlobal->TimeStepZoneSec;
    8250              : 
    8251       370257 :             thisSpaceRpt.TotLatentGainRate = SumInternalLatentGainsByTypes(state, zoneNum, TradIntGainTypes, spaceNum);
    8252       370257 :             thisSpaceRpt.TotLatentGain = thisSpaceRpt.TotLatentGainRate * state.dataGlobal->TimeStepZoneSec;
    8253              : 
    8254       370257 :             thisSpaceRpt.TotTotalHeatGainRate = thisSpaceRpt.TotLatentGainRate + thisSpaceRpt.TotRadiantGainRate +
    8255       370257 :                                                 thisSpaceRpt.TotConvectiveGainRate + thisSpaceRpt.TotVisHeatGainRate;
    8256       370257 :             thisSpaceRpt.TotTotalHeatGain = thisSpaceRpt.TotTotalHeatGainRate * state.dataGlobal->TimeStepZoneSec;
    8257              :         }
    8258              : 
    8259       586610 :         for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    8260       336652 :             auto &thisZoneRpt = state.dataHeatBal->ZoneRpt(zoneNum);
    8261       336652 :             auto &thisZoneIntGain = state.dataHeatBal->ZoneIntGain(zoneNum);
    8262              : 
    8263              :             // People
    8264       336652 :             thisZoneRpt.PeopleNumOcc = thisZoneIntGain.NOFOCC;
    8265       336652 :             thisZoneRpt.PeopleRadGain = thisZoneRpt.PeopleRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8266       336652 :             thisZoneRpt.PeopleConGain = thisZoneRpt.PeopleConGainRate * state.dataGlobal->TimeStepZoneSec;
    8267       336652 :             thisZoneRpt.PeopleSenGain = thisZoneRpt.PeopleSenGainRate * state.dataGlobal->TimeStepZoneSec;
    8268       336652 :             thisZoneRpt.PeopleLatGain = thisZoneRpt.PeopleLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8269       336652 :             thisZoneRpt.PeopleTotGain = thisZoneRpt.PeopleTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8270              : 
    8271              :             // General Lights
    8272       336652 :             thisZoneRpt.LtsRetAirGain = thisZoneRpt.LtsRetAirGainRate * state.dataGlobal->TimeStepZoneSec;
    8273       336652 :             thisZoneRpt.LtsRadGain = thisZoneRpt.LtsRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8274       336652 :             thisZoneRpt.LtsTotGain = thisZoneRpt.LtsTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8275       336652 :             thisZoneRpt.LtsConGain = thisZoneRpt.LtsConGainRate * state.dataGlobal->TimeStepZoneSec;
    8276       336652 :             thisZoneRpt.LtsVisGain = thisZoneRpt.LtsVisGainRate * state.dataGlobal->TimeStepZoneSec;
    8277       336652 :             thisZoneRpt.LtsElecConsump = thisZoneRpt.LtsPower * state.dataGlobal->TimeStepZoneSec;
    8278              : 
    8279              :             // Electric Equipment
    8280       336652 :             thisZoneRpt.ElecConGain = thisZoneRpt.ElecConGainRate * state.dataGlobal->TimeStepZoneSec;
    8281       336652 :             thisZoneRpt.ElecRadGain = thisZoneRpt.ElecRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8282       336652 :             thisZoneRpt.ElecLatGain = thisZoneRpt.ElecLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8283       336652 :             thisZoneRpt.ElecLost = thisZoneRpt.ElecLostRate * state.dataGlobal->TimeStepZoneSec;
    8284       336652 :             thisZoneRpt.ElecConsump = thisZoneRpt.ElecPower * state.dataGlobal->TimeStepZoneSec;
    8285       336652 :             thisZoneRpt.ElecTotGain = thisZoneRpt.ElecTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8286              : 
    8287              :             // Gas Equipment
    8288       336652 :             thisZoneRpt.GasConGain = thisZoneRpt.GasConGainRate * state.dataGlobal->TimeStepZoneSec;
    8289       336652 :             thisZoneRpt.GasRadGain = thisZoneRpt.GasRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8290       336652 :             thisZoneRpt.GasLatGain = thisZoneRpt.GasLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8291       336652 :             thisZoneRpt.GasLost = thisZoneRpt.GasLostRate * state.dataGlobal->TimeStepZoneSec;
    8292       336652 :             thisZoneRpt.GasConsump = thisZoneRpt.GasPower * state.dataGlobal->TimeStepZoneSec;
    8293       336652 :             thisZoneRpt.GasTotGain = thisZoneRpt.GasTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8294              : 
    8295              :             // Hot Water Equipment
    8296       336652 :             thisZoneRpt.HWConGain = thisZoneRpt.HWConGainRate * state.dataGlobal->TimeStepZoneSec;
    8297       336652 :             thisZoneRpt.HWRadGain = thisZoneRpt.HWRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8298       336652 :             thisZoneRpt.HWLatGain = thisZoneRpt.HWLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8299       336652 :             thisZoneRpt.HWLost = thisZoneRpt.HWLostRate * state.dataGlobal->TimeStepZoneSec;
    8300       336652 :             thisZoneRpt.HWConsump = thisZoneRpt.HWPower * state.dataGlobal->TimeStepZoneSec;
    8301       336652 :             thisZoneRpt.HWTotGain = thisZoneRpt.HWTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8302              : 
    8303              :             // Steam Equipment
    8304       336652 :             thisZoneRpt.SteamConGain = thisZoneRpt.SteamConGainRate * state.dataGlobal->TimeStepZoneSec;
    8305       336652 :             thisZoneRpt.SteamRadGain = thisZoneRpt.SteamRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8306       336652 :             thisZoneRpt.SteamLatGain = thisZoneRpt.SteamLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8307       336652 :             thisZoneRpt.SteamLost = thisZoneRpt.SteamLostRate * state.dataGlobal->TimeStepZoneSec;
    8308       336652 :             thisZoneRpt.SteamConsump = thisZoneRpt.SteamPower * state.dataGlobal->TimeStepZoneSec;
    8309       336652 :             thisZoneRpt.SteamTotGain = thisZoneRpt.SteamTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8310              : 
    8311              :             // Other Equipment
    8312       336652 :             thisZoneRpt.OtherConGain = thisZoneRpt.OtherConGainRate * state.dataGlobal->TimeStepZoneSec;
    8313       336652 :             thisZoneRpt.OtherRadGain = thisZoneRpt.OtherRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8314       336652 :             thisZoneRpt.OtherLatGain = thisZoneRpt.OtherLatGainRate * state.dataGlobal->TimeStepZoneSec;
    8315       336652 :             thisZoneRpt.OtherLost = thisZoneRpt.OtherLostRate * state.dataGlobal->TimeStepZoneSec;
    8316       336652 :             thisZoneRpt.OtherTotGain = thisZoneRpt.OtherTotGainRate * state.dataGlobal->TimeStepZoneSec;
    8317       336656 :             for (Constant::eFuel fuelTypeNum : state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums) {
    8318            4 :                 int fuelIdx = (int)fuelTypeNum;
    8319            4 :                 thisZoneRpt.OtherConsump[fuelIdx] = thisZoneRpt.OtherPower[fuelIdx] * state.dataGlobal->TimeStepZoneSec;
    8320       336652 :             }
    8321              : 
    8322              :             // Baseboard Heat
    8323       336652 :             thisZoneRpt.BaseHeatConGain = thisZoneRpt.BaseHeatConGainRate * state.dataGlobal->TimeStepZoneSec;
    8324       336652 :             thisZoneRpt.BaseHeatRadGain = thisZoneRpt.BaseHeatRadGainRate * state.dataGlobal->TimeStepZoneSec;
    8325       336652 :             thisZoneRpt.BaseHeatElecCons = thisZoneRpt.BaseHeatPower * state.dataGlobal->TimeStepZoneSec;
    8326       336652 :             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       336652 :             thisZoneRpt.TotVisHeatGain = thisZoneRpt.LtsVisGain;
    8334       336652 :             thisZoneRpt.TotVisHeatGainRate = thisZoneRpt.LtsVisGainRate;
    8335              : 
    8336       336652 :             thisZoneRpt.TotRadiantGainRate = SumInternalRadiationGainsByTypes(state, zoneNum, TradIntGainTypes);
    8337       336652 :             thisZoneRpt.TotRadiantGain = thisZoneRpt.TotRadiantGainRate * state.dataGlobal->TimeStepZoneSec;
    8338              : 
    8339       336652 :             thisZoneRpt.TotConvectiveGainRate = SumInternalConvectionGainsByTypes(state, zoneNum, TradIntGainTypes);
    8340       336652 :             thisZoneRpt.TotConvectiveGain = thisZoneRpt.TotConvectiveGainRate * state.dataGlobal->TimeStepZoneSec;
    8341              : 
    8342       336652 :             thisZoneRpt.TotLatentGainRate = SumInternalLatentGainsByTypes(state, zoneNum, TradIntGainTypes);
    8343       336652 :             thisZoneRpt.TotLatentGain = thisZoneRpt.TotLatentGainRate * state.dataGlobal->TimeStepZoneSec;
    8344              : 
    8345       336652 :             thisZoneRpt.TotTotalHeatGainRate =
    8346       336652 :                 thisZoneRpt.TotLatentGainRate + thisZoneRpt.TotRadiantGainRate + thisZoneRpt.TotConvectiveGainRate + thisZoneRpt.TotVisHeatGainRate;
    8347       336652 :             thisZoneRpt.TotTotalHeatGain = thisZoneRpt.TotTotalHeatGainRate * state.dataGlobal->TimeStepZoneSec;
    8348              :         }
    8349       249958 :     }
    8350              : 
    8351           17 :     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           17 :         if (state.dataInternalHeatGains->GetInternalHeatGainsInputFlag) {
    8374            0 :             ShowFatalError(state, "GetDesignLightingLevelForZone: Function called prior to Getting Lights Input.");
    8375              :         }
    8376              : 
    8377           17 :         DesignLightingLevelSum = 0.0;
    8378              : 
    8379           43 :         for (Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    8380           26 :             if (state.dataHeatBal->Lights(Loop).ZonePtr == WhichZone) {
    8381           14 :                 DesignLightingLevelSum += state.dataHeatBal->Lights(Loop).DesignLevel;
    8382              :             }
    8383              :         }
    8384              : 
    8385           17 :         return DesignLightingLevelSum;
    8386              :     }
    8387              : 
    8388            9 :     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            9 :         bool TCSchedsPresent = false;
    8393              : 
    8394            9 :         if (!WorkEffSch || !CloInsSch || !AirVeloSch) {
    8395            7 :             TCSchedsPresent = true;
    8396              :         }
    8397              : 
    8398            9 :         return TCSchedsPresent;
    8399              :     }
    8400              : 
    8401           17 :     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           17 :         if (state.dataInternalHeatGains->GetInternalHeatGainsInputFlag) {
    8428            0 :             ShowFatalError(state, "CheckLightsReplaceableMinMaxForZone: Function called prior to Getting Lights Input.");
    8429              :         }
    8430              : 
    8431           17 :         LightsRepMin = 99999.0;
    8432           17 :         LightsRepMax = -99999.0;
    8433           17 :         NumLights = 0;
    8434              : 
    8435           43 :         for (Loop = 1; Loop <= state.dataHeatBal->TotLights; ++Loop) {
    8436           26 :             if (state.dataHeatBal->Lights(Loop).ZonePtr != WhichZone) {
    8437           12 :                 continue;
    8438              :             }
    8439           14 :             LightsRepMin = min(LightsRepMin, state.dataHeatBal->Lights(Loop).FractionReplaceable);
    8440           14 :             LightsRepMax = max(LightsRepMax, state.dataHeatBal->Lights(Loop).FractionReplaceable);
    8441           14 :             ++NumLights;
    8442           28 :             if ((state.dataDayltg->ZoneDaylight(WhichZone).totRefPts > 0) &&
    8443           14 :                 (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           17 :         if (state.dataDayltg->ZoneDaylight(WhichZone).totRefPts > 0) {
    8454           17 :             if (LightsRepMax == 0.0) {
    8455            0 :                 ShowWarningError(state,
    8456            0 :                                  format("CheckLightsReplaceable: Zone \"{}\" has Daylighting:Controls.", state.dataHeatBal->Zone(WhichZone).Name));
    8457            0 :                 ShowContinueError(state, "but all of the LIGHTS object in that zone have zero Fraction Replaceable.");
    8458            0 :                 ShowContinueError(state, "The daylighting controls will have no effect.");
    8459              :             }
    8460           17 :             if (NumLights == 0) {
    8461            6 :                 ShowWarningError(state,
    8462            6 :                                  format("CheckLightsReplaceable: Zone \"{}\" has Daylighting:Controls.", state.dataHeatBal->Zone(WhichZone).Name));
    8463            6 :                 ShowContinueError(state, "but there are no LIGHTS objects in that zone.");
    8464            9 :                 ShowContinueError(state, "The daylighting controls will have no effect.");
    8465              :             }
    8466              :         }
    8467           17 :     }
    8468              : 
    8469       547216 :     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       547216 :         bool DoRadiationUpdate{!SuppressRadiationUpdate};
    8476              : 
    8477              :         // store pointer values to hold generic internal gain values constant for entire timestep
    8478      1388105 :         for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) {
    8479       840889 :             auto &thisIntGain = state.dataHeatBal->spaceIntGainDevices(spaceNum);
    8480      2246731 :             for (int Loop = 1; Loop <= thisIntGain.numberOfDevices; ++Loop) {
    8481      1405842 :                 thisIntGain.device(Loop).ConvectGainRate = *thisIntGain.device(Loop).PtrConvectGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8482      2811684 :                 thisIntGain.device(Loop).ReturnAirConvGainRate =
    8483      1405842 :                     *thisIntGain.device(Loop).PtrReturnAirConvGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8484      1405842 :                 if (DoRadiationUpdate) {
    8485       675072 :                     thisIntGain.device(Loop).RadiantGainRate = *thisIntGain.device(Loop).PtrRadiantGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8486              :                 }
    8487      1405842 :                 thisIntGain.device(Loop).LatentGainRate = *thisIntGain.device(Loop).PtrLatentGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8488      2811684 :                 thisIntGain.device(Loop).ReturnAirLatentGainRate =
    8489      1405842 :                     *thisIntGain.device(Loop).PtrReturnAirLatentGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8490      2811684 :                 thisIntGain.device(Loop).CarbonDioxideGainRate =
    8491      1405842 :                     *thisIntGain.device(Loop).PtrCarbonDioxideGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8492      1405842 :                 thisIntGain.device(Loop).GenericContamGainRate =
    8493      1405842 :                     *thisIntGain.device(Loop).PtrGenericContamGainRate * thisIntGain.device(Loop).spaceGainFrac;
    8494              :             }
    8495              :         }
    8496       547216 :         if (SumLatentGains) {
    8497       715584 :             for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) {
    8498       418328 :                 InternalHeatGains::SumAllInternalLatentGains(state, NZ);
    8499              :                 // Added for the hybrid model
    8500       418328 :                 if (state.dataHybridModel->FlagHybridModel_PC) {
    8501            0 :                     InternalHeatGains::SumAllInternalLatentGainsExceptPeople(state, NZ);
    8502              :                 }
    8503              :             }
    8504              :         }
    8505              : 
    8506       547216 :         if (state.dataContaminantBalance->Contaminant.GenericContamSimulation && allocated(state.dataContaminantBalance->ZoneGCGain)) {
    8507            0 :             for (int NZ = 1; NZ <= state.dataGlobal->NumOfZones; ++NZ) {
    8508            0 :                 state.dataContaminantBalance->ZoneGCGain(NZ) = InternalHeatGains::SumAllInternalGenericContamGains(state, NZ);
    8509            0 :                 state.dataHeatBal->ZoneRpt(NZ).GCRate = state.dataContaminantBalance->ZoneGCGain(NZ);
    8510              :             }
    8511              :         }
    8512       547216 :     }
    8513              : 
    8514      1310302 :     Real64 zoneSumAllInternalConvectionGains(EnergyPlusData &state,
    8515              :                                              int const zoneNum // zone index pointer to sum gains for
    8516              :     )
    8517              :     {
    8518      1310302 :         Real64 zoneSumConvGainRate(0.0);
    8519              :         // worker routine for summing all the internal gain types
    8520              : 
    8521      2814365 :         for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    8522      1504063 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8523       533823 :                 continue;
    8524              :             }
    8525       970240 :             zoneSumConvGainRate += InternalHeatGains::spaceSumAllInternalConvectionGains(state, spaceNum);
    8526      1310302 :         }
    8527              : 
    8528      1310302 :         return zoneSumConvGainRate;
    8529              :     }
    8530              : 
    8531      1070032 :     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      1070032 :         Real64 spaceSumConvGainRate(0.0);
    8543              : 
    8544      3313241 :         for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8545      2243209 :             spaceSumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
    8546              :         }
    8547      1070032 :         return spaceSumConvGainRate;
    8548              :     }
    8549              : 
    8550              :     // For HybridModel
    8551            0 :     Real64 SumAllInternalConvectionGainsExceptPeople(EnergyPlusData &state, int const ZoneNum)
    8552              :     {
    8553              :         // Return value
    8554            0 :         Real64 SumConvGainRateExceptPeople = 0.0;
    8555              : 
    8556            0 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8557            0 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8558            0 :                 continue;
    8559              :             }
    8560            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8561            0 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
    8562            0 :                     SumConvGainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
    8563              :                 }
    8564              :             }
    8565            0 :         }
    8566              : 
    8567            0 :         return SumConvGainRateExceptPeople;
    8568              :     }
    8569              : 
    8570       820532 :     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       820532 :         Real64 SumConvGainRate = 0.0;
    8586              : 
    8587       820532 :         int NumberOfTypes = GainTypeARR.size();
    8588              : 
    8589              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8590       820532 :         if (spaceIndex > 0) {
    8591      1045258 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8592      6075009 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8593      5400008 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8594       674319 :                         SumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).ConvectGainRate;
    8595              :                     }
    8596              :                 }
    8597              :             }
    8598              :         } else {
    8599       934155 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8600       483880 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8601        90317 :                     continue;
    8602              :                 }
    8603      1323404 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8604      8018479 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8605      7088638 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8606       706178 :                             SumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ConvectGainRate;
    8607              :                         }
    8608              :                     }
    8609              :                 }
    8610       450275 :             }
    8611              :         }
    8612              : 
    8613       820532 :         return SumConvGainRate;
    8614              :     }
    8615              : 
    8616       318125 :     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       318125 :         Real64 zoneSumReturnAirGainRate = 0.0;
    8622       653500 :         for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
    8623       335375 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8624        77344 :                 continue;
    8625              :             }
    8626       258031 :             zoneSumReturnAirGainRate += InternalHeatGains::spaceSumAllReturnAirConvectionGains(state, spaceNum, returnNodeNum);
    8627       318125 :         }
    8628              : 
    8629       318125 :         return zoneSumReturnAirGainRate;
    8630              :     }
    8631              : 
    8632       258031 :     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       258031 :         Real64 spaceSumReturnAirGainRate = 0.0;
    8646              : 
    8647       934278 :         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       676247 :             if ((returnNodeNum == 0) || (returnNodeNum == state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirNodeNum)) {
    8650       283807 :                 spaceSumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate;
    8651              :             }
    8652              :         }
    8653              : 
    8654       258031 :         return spaceSumReturnAirGainRate;
    8655              :     }
    8656              : 
    8657        28406 :     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        28406 :         Real64 SumReturnAirGainRate(0.0);
    8674              : 
    8675        28406 :         int NumberOfTypes = GainTypeARR.size();
    8676              : 
    8677              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8678        28406 :         if (spaceIndex > 0) {
    8679            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8680            0 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8681            0 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8682            0 :                         SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).ReturnAirConvGainRate;
    8683              :                     }
    8684              :                 }
    8685              :             }
    8686              :         } else {
    8687        56812 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8688        28406 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8689         5400 :                     continue;
    8690              :                 }
    8691              : 
    8692        86730 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8693       414206 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8694              : 
    8695       350482 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8696        11513 :                             SumReturnAirGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirConvGainRate;
    8697              :                         }
    8698              :                     }
    8699              :                 }
    8700        28406 :             }
    8701              :         }
    8702              : 
    8703        28406 :         return SumReturnAirGainRate;
    8704              :     }
    8705              : 
    8706       370253 :     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       370253 :         Real64 sumRadGainRate(0.0);
    8720              : 
    8721       370253 :         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8722        68717 :             sumRadGainRate = 0.0;
    8723        68717 :             return sumRadGainRate;
    8724              :         }
    8725              : 
    8726       976497 :         for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8727       674961 :             sumRadGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate;
    8728              :         }
    8729              : 
    8730       301536 :         return sumRadGainRate;
    8731              :     }
    8732              : 
    8733              :     Real64
    8734       706909 :     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       706909 :         Real64 SumRadiationGainRate(0.0);
    8749              : 
    8750       706909 :         int NumberOfTypes = GainTypeARR.size();
    8751              : 
    8752              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8753       706909 :         if (spaceIndex > 0) {
    8754      1045258 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8755      6075009 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8756      5400008 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8757       674319 :                         SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).RadiantGainRate;
    8758              :                     }
    8759              :                 }
    8760              :             }
    8761              :         } else {
    8762       706909 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8763       370257 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8764        68717 :                     continue;
    8765              :                 }
    8766       976541 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8767      6075009 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8768      5400008 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8769       674319 :                             SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate;
    8770              :                         }
    8771              :                     }
    8772              :                 }
    8773       336652 :             }
    8774              :         }
    8775              : 
    8776       706909 :         return SumRadiationGainRate;
    8777              :     }
    8778              : 
    8779        71010 :     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        71010 :         Real64 SumRadiationGainRate(0.0);
    8786              : 
    8787        71010 :         int NumberOfTypes = GainTypeARR.size();
    8788              : 
    8789       142020 :         for (int spaceNum : state.dataViewFactor->EnclRadInfo(enclosureNum).spaceNums) {
    8790        71010 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8791        13500 :                 continue;
    8792              :             }
    8793       216540 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8794      1399464 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8795      1240434 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8796        31806 :                         SumRadiationGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).RadiantGainRate;
    8797              :                     }
    8798              :                 }
    8799              :             }
    8800        71010 :         }
    8801              : 
    8802        71010 :         return SumRadiationGainRate;
    8803              :     }
    8804              : 
    8805       754980 :     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       754980 :         Real64 zoneLatentGainRate = 0.0;
    8818              : 
    8819      1595862 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8820       840882 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8821       215929 :                 state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain = 0.0;
    8822       215929 :                 continue;
    8823              :             }
    8824              : 
    8825       624953 :             Real64 spaceLatentGainRate = 0.0;
    8826      2030724 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8827      1405771 :                 spaceLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate;
    8828              :             }
    8829       624953 :             state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGain = spaceLatentGainRate;
    8830       624953 :             zoneLatentGainRate += spaceLatentGainRate;
    8831       754980 :         }
    8832              : 
    8833       754980 :         state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).latentGain = zoneLatentGainRate;
    8834       754980 :     }
    8835              : 
    8836              :     // Added for hybrid model -- calculate the latent gain from all sources except for people
    8837            0 :     void SumAllInternalLatentGainsExceptPeople(EnergyPlusData &state,
    8838              :                                                int const ZoneNum // zone index pointer for which zone to sum gains for
    8839              :     )
    8840              :     {
    8841            0 :         Real64 zoneLatentGainRateExceptPeople(0.0);
    8842              : 
    8843            0 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8844            0 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8845            0 :                 continue;
    8846              :             }
    8847              : 
    8848            0 :             Real64 spaceLatentGainRateExceptPeople = 0.0;
    8849            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8850            0 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
    8851            0 :                     spaceLatentGainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate;
    8852              :                 }
    8853              :             }
    8854            0 :             state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).latentGainExceptPeople = spaceLatentGainRateExceptPeople;
    8855            0 :             zoneLatentGainRateExceptPeople += spaceLatentGainRateExceptPeople;
    8856            0 :         }
    8857              : 
    8858            0 :         state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).latentGainExceptPeople = zoneLatentGainRateExceptPeople;
    8859            0 :     }
    8860              : 
    8861              :     Real64
    8862       763721 :     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       763721 :         Real64 SumLatentGainRate(0.0);
    8876              : 
    8877       763721 :         int NumberOfTypes = GainTypeARR.size();
    8878              : 
    8879              :         // TODO MJW: This could be refactored to avoid duplicate code, but for now . . . .
    8880       763721 :         if (spaceIndex > 0) {
    8881      1045258 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceIndex).numberOfDevices; ++DeviceNum) {
    8882      6075009 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8883      5400008 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8884       674319 :                         SumLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceIndex).device(DeviceNum).LatentGainRate;
    8885              :                     }
    8886              :                 }
    8887              :             }
    8888              :         } else {
    8889       820533 :             for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8890       427069 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8891        79517 :                     continue;
    8892              :                 }
    8893      1150001 :                 for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8894      6871559 :                     for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    8895      6069110 :                         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    8896       694645 :                             SumLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).LatentGainRate;
    8897              :                         }
    8898              :                     }
    8899              :                 }
    8900       393464 :             }
    8901              :         }
    8902              : 
    8903       763721 :         return SumLatentGainRate;
    8904              :     }
    8905              : 
    8906       268499 :     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       268499 :         Real64 SumRetAirLatentGainRate(0.0);
    8920              : 
    8921       554056 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8922       285557 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8923        63796 :                 continue;
    8924              :             }
    8925              : 
    8926       804222 :             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       582461 :                 if ((ReturnNodeNum == 0) || (ReturnNodeNum == state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirNodeNum)) {
    8929       190021 :                     SumRetAirLatentGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).ReturnAirLatentGainRate;
    8930              :                 }
    8931              :             }
    8932       268499 :         }
    8933              : 
    8934       268499 :         return SumRetAirLatentGainRate;
    8935              :     }
    8936              : 
    8937            0 :     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            0 :         Real64 SumCO2GainRate(0.0);
    8951              : 
    8952            0 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8953            0 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8954            0 :                 continue;
    8955              :             }
    8956              : 
    8957            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8958            0 :                 SumCO2GainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CarbonDioxideGainRate;
    8959              :             }
    8960            0 :         }
    8961              : 
    8962            0 :         return SumCO2GainRate;
    8963              :     }
    8964              : 
    8965              :     // Added for hybrid model -- function for calculating CO2 gains except people
    8966            0 :     Real64 SumAllInternalCO2GainsExceptPeople(EnergyPlusData &state,
    8967              :                                               int const ZoneNum // zone index pointer for which zone to sum gains for
    8968              :     )
    8969              :     {
    8970              :         // Return value
    8971            0 :         Real64 SumCO2GainRateExceptPeople(0.0);
    8972              : 
    8973            0 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    8974            0 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    8975            0 :                 continue;
    8976              :             }
    8977              : 
    8978            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    8979            0 :                 if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType != DataHeatBalance::IntGainType::People) {
    8980            0 :                     SumCO2GainRateExceptPeople += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CarbonDioxideGainRate;
    8981              :                 }
    8982              :             }
    8983            0 :         }
    8984              : 
    8985            0 :         return SumCO2GainRateExceptPeople;
    8986              :     }
    8987              : 
    8988              :     Real64
    8989            0 :     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            0 :         Real64 SumCO2GainRate(0.0);
    9004              : 
    9005            0 :         int NumberOfTypes = GainTypeARR.size();
    9006              : 
    9007            0 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    9008            0 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    9009            0 :                 continue;
    9010              :             }
    9011              : 
    9012            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    9013            0 :                 for (int TypeNum = 0; TypeNum < NumberOfTypes; ++TypeNum) {
    9014              : 
    9015            0 :                     if (state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CompType == GainTypeARR[TypeNum]) {
    9016            0 :                         SumCO2GainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).CarbonDioxideGainRate;
    9017              :                     }
    9018              :                 }
    9019              :             }
    9020            0 :         }
    9021              : 
    9022            0 :         return SumCO2GainRate;
    9023              :     }
    9024              : 
    9025            0 :     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            0 :         Real64 SumGCGainRate(0.0);
    9039              : 
    9040            0 :         for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
    9041            0 :             if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    9042            0 :                 continue;
    9043              :             }
    9044              : 
    9045            0 :             for (int DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    9046            0 :                 SumGCGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(DeviceNum).GenericContamGainRate;
    9047              :             }
    9048            0 :         }
    9049              : 
    9050            0 :         return SumGCGainRate;
    9051              :     }
    9052              : 
    9053        83023 :     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        83023 :         if (state.dataGlobal->CompLoadReportIsReq && !state.dataGlobal->isPulseZoneSizing) {
    9071         7453 :             int TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->TimeStepsInHour + state.dataGlobal->TimeStep;
    9072        21656 :             for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) {
    9073        14203 :                 auto &znCLDayTS = state.dataOutRptTab->znCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iZone - 1];
    9074        14203 :                 gatherCompLoadIntGain2(state, znCLDayTS, iZone);
    9075              :             }
    9076        21655 :             for (int iEncl = 1; iEncl <= state.dataViewFactor->NumOfRadiantEnclosures; ++iEncl) {
    9077        14202 :                 auto &enclCLDayTS = state.dataOutRptTab->enclCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].encl[iEncl - 1];
    9078        14202 :                 enclCLDayTS.peopleRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPeople);
    9079        14202 :                 enclCLDayTS.lightLWRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesLight);
    9080        14202 :                 enclCLDayTS.equipRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesEquip);
    9081        14202 :                 enclCLDayTS.hvacLossRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesHvacLoss);
    9082        14202 :                 enclCLDayTS.powerGenRadSeq = SumEnclosureInternalRadiationGainsByTypes(state, iEncl, IntGainTypesPowerGen);
    9083              :             }
    9084         7453 :             if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
    9085            0 :                 for (int iSpace = 1; iSpace <= state.dataGlobal->NumOfZones; ++iSpace) {
    9086              :                     auto &spCLDayTS =
    9087            0 :                         state.dataOutRptTab->spCompLoads[state.dataSize->CurOverallSimDay - 1].ts[TimeStepInDay - 1].spacezone[iSpace - 1];
    9088            0 :                     gatherCompLoadIntGain2(state, spCLDayTS, state.dataHeatBal->space(iSpace).zoneNum, iSpace);
    9089              :                 }
    9090              :             }
    9091              :         }
    9092        83023 :     }
    9093              : 
    9094              :     void
    9095        14203 :     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       113624 :         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        14203 :         szCompLoadDayTS.peopleInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum);
    9103        14203 :         szCompLoadDayTS.peopleLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesPeople, spaceNum);
    9104              : 
    9105        14203 :         szCompLoadDayTS.lightInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum);
    9106        14203 :         szCompLoadDayTS.lightRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesLight, spaceNum);
    9107              : 
    9108        14203 :         szCompLoadDayTS.equipInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum);
    9109        14203 :         szCompLoadDayTS.equipLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesEquip, spaceNum);
    9110              : 
    9111        14203 :         szCompLoadDayTS.refrigInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum);
    9112        14203 :         szCompLoadDayTS.refrigRetAirSeq = SumReturnAirConvectionGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum);
    9113        14203 :         szCompLoadDayTS.refrigLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesRefrig, spaceNum);
    9114              : 
    9115        14203 :         szCompLoadDayTS.waterUseInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum);
    9116        14203 :         szCompLoadDayTS.waterUseLatentSeq = SumInternalLatentGainsByTypes(state, zoneNum, IntGainTypesWaterUse, spaceNum);
    9117              : 
    9118        14203 :         szCompLoadDayTS.hvacLossInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesHvacLoss, spaceNum);
    9119              : 
    9120        14203 :         szCompLoadDayTS.powerGenInstantSeq = SumInternalConvectionGainsByTypes(state, zoneNum, IntGainTypesPowerGen, spaceNum);
    9121        14203 :     }
    9122              : 
    9123           21 :     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           21 :         if (state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices == 0) {
    9140            0 :             DeviceIndex = -1;
    9141            0 :             return DeviceIndex;
    9142              :         }
    9143           48 :         for (DeviceNum = 1; DeviceNum <= state.dataHeatBal->spaceIntGainDevices(spaceNum).numberOfDevices; ++DeviceNum) {
    9144           63 :             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           27 :                 DeviceIndex = -1;
    9150              :             }
    9151              :         }
    9152           21 :         return DeviceIndex;
    9153              :     }
    9154              : 
    9155            3 :     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            3 :         Real64 sumConvGainRate(0.0);
    9173              : 
    9174            3 :         assert(numGains <= isize(deviceSpaceARR));
    9175            3 :         assert(numGains <= isize(deviceIndexARR));
    9176            3 :         assert(numGains <= isize(fractionARR));
    9177              : 
    9178            6 :         for (int loop = 1; loop <= numGains; ++loop) {
    9179            3 :             int spaceNum = deviceSpaceARR(loop);
    9180            3 :             int deviceNum = deviceIndexARR(loop);
    9181            3 :             Real64 deviceFraction = fractionARR(loop);
    9182            3 :             sumConvGainRate += state.dataHeatBal->spaceIntGainDevices(spaceNum).device(deviceNum).ConvectGainRate * deviceFraction;
    9183              :         }
    9184            3 :         return sumConvGainRate;
    9185              :     }
    9186              : 
    9187            3 :     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            3 :         Real64 sumLatentGainRate(0.0);
    9205              : 
    9206            3 :         assert(numGains <= isize(deviceSpaceARR));
    9207            3 :         assert(numGains <= isize(deviceIndexARR));
    9208            3 :         assert(numGains <= isize(fractionARR));
    9209              : 
    9210            6 :         for (int loop = 1; loop <= numGains; ++loop) {
    9211            3 :             int spaceNum = deviceSpaceARR(loop);
    9212            3 :             int deviceNum = deviceIndexARR(loop);
    9213            3 :             Real64 deviceFraction = fractionARR(loop);
    9214            3 :             sumLatentGainRate =
    9215            3 :                 sumLatentGainRate + state.dataHeatBal->spaceIntGainDevices(spaceNum).device(deviceNum).LatentGainRate * deviceFraction;
    9216              :         }
    9217            3 :         return sumLatentGainRate;
    9218              :     }
    9219              : 
    9220            0 :     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            0 :         Real64 sumReturnAirGainRate(0.0);
    9238              : 
    9239            0 :         assert(numGains <= isize(deviceSpaceARR));
    9240            0 :         assert(numGains <= isize(deviceIndexARR));
    9241            0 :         assert(numGains <= isize(fractionARR));
    9242              : 
    9243            0 :         for (int loop = 1; loop <= numGains; ++loop) {
    9244            0 :             int spaceNum = deviceSpaceARR(loop);
    9245            0 :             int deviceNum = deviceIndexARR(loop);
    9246            0 :             Real64 deviceFraction = fractionARR(loop);
    9247            0 :             sumReturnAirGainRate =
    9248            0 :                 sumReturnAirGainRate + state.dataHeatBal->spaceIntGainDevices(spaceNum).device(deviceNum).ReturnAirConvGainRate * deviceFraction;
    9249              :         }
    9250            0 :         return sumReturnAirGainRate;
    9251              :     }
    9252              : } // namespace InternalHeatGains
    9253              : 
    9254              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1