LCOV - code coverage report
Current view: top level - EnergyPlus - SystemReports.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 81.3 % 2856 2321
Test Date: 2025-06-03 15:18:44 Functions: 86.4 % 22 19

            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 <algorithm>
      50              : #include <cassert>
      51              : #include <cmath>
      52              : #include <string>
      53              : #include <unordered_map>
      54              : 
      55              : // ObjexxFCL Headers
      56              : #include <ObjexxFCL/Array.functions.hh>
      57              : 
      58              : // EnergyPlus Headers
      59              : #include <EnergyPlus/BranchNodeConnections.hh>
      60              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      61              : #include <EnergyPlus/DataAirLoop.hh>
      62              : #include <EnergyPlus/DataAirSystems.hh>
      63              : #include <EnergyPlus/DataDefineEquip.hh>
      64              : #include <EnergyPlus/DataEnvironment.hh>
      65              : #include <EnergyPlus/DataGlobalConstants.hh>
      66              : #include <EnergyPlus/DataHVACGlobals.hh>
      67              : #include <EnergyPlus/DataHeatBalance.hh>
      68              : #include <EnergyPlus/DataLoopNode.hh>
      69              : #include <EnergyPlus/DataSizing.hh>
      70              : #include <EnergyPlus/DataZoneEnergyDemands.hh>
      71              : #include <EnergyPlus/DataZoneEquipment.hh>
      72              : #include <EnergyPlus/DualDuct.hh>
      73              : #include <EnergyPlus/FanCoilUnits.hh>
      74              : #include <EnergyPlus/HVACCooledBeam.hh>
      75              : #include <EnergyPlus/HVACFourPipeBeam.hh>
      76              : #include <EnergyPlus/HVACSingleDuctInduc.hh>
      77              : #include <EnergyPlus/HVACStandAloneERV.hh>
      78              : #include <EnergyPlus/HVACVariableRefrigerantFlow.hh>
      79              : #include <EnergyPlus/HybridUnitaryAirConditioners.hh>
      80              : #include <EnergyPlus/MixedAir.hh>
      81              : #include <EnergyPlus/OutdoorAirUnit.hh>
      82              : #include <EnergyPlus/OutputProcessor.hh>
      83              : #include <EnergyPlus/OutputReportPredefined.hh>
      84              : #include <EnergyPlus/Plant/DataPlant.hh>
      85              : #include <EnergyPlus/PoweredInductionUnits.hh>
      86              : #include <EnergyPlus/Psychrometrics.hh>
      87              : #include <EnergyPlus/PurchasedAirManager.hh>
      88              : #include <EnergyPlus/SystemReports.hh>
      89              : #include <EnergyPlus/UnitVentilator.hh>
      90              : #include <EnergyPlus/UtilityRoutines.hh>
      91              : #include <EnergyPlus/WindowAC.hh>
      92              : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
      93              : 
      94              : namespace EnergyPlus::SystemReports {
      95              : 
      96              : // Module containing the routines dealing with Mechanical Ventilation Loads and Energy Reporting (Outside Air)
      97              : 
      98              : // MODULE INFORMATION:
      99              : //       AUTHOR         Mike Witte, Linda Lawrie, Dan Fisher
     100              : //       DATE WRITTEN   Apr-Jul 2005
     101              : //       MODIFIED       22Aug2010 Craig Wray - added Fan:ComponentModel
     102              : 
     103              : // PURPOSE OF THIS MODULE:
     104              : // This module embodies the scheme(s) for reporting ventilation loads and energy use.
     105              : 
     106              : // Using/Aliasing
     107              : using namespace DataLoopNode;
     108              : using namespace DataAirLoop;
     109              : using namespace DataPlant;
     110              : using namespace DataZoneEquipment;
     111              : using namespace DataAirSystems;
     112              : 
     113              : // Functions
     114              : 
     115       624375 : void InitEnergyReports(EnergyPlusData &state)
     116              : {
     117              : 
     118              :     // SUBROUTINE INFORMATION:
     119              :     //       AUTHOR         Dan Fisher
     120              :     //       DATE WRITTEN   April 2005
     121              : 
     122              :     // PURPOSE OF THIS SUBROUTINE:
     123              :     // Initializes the energy components of the data structures
     124              : 
     125              :     // METHODOLOGY EMPLOYED:
     126              :     // Once all compsets have been established (second iteration) find all components
     127              :     // subcomponents, etc.
     128              : 
     129       624375 :     int constexpr EnergyTransfer(1);
     130              : 
     131       624375 :     if (!state.dataSysRpts->VentReportStructureCreated) {
     132            0 :         return;
     133              :     }
     134              : 
     135       624375 :     if (state.dataSysRpts->OneTimeFlag_InitEnergyReports) {
     136              : 
     137              :         // ***I think we need to preprocess the main components on the branch to get them in order***
     138              :         // This needs to be done before we start in on the component loop
     139              :         // GetChildrenData will put all of the subcomponents in order for us
     140              : 
     141         5988 :         for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
     142         5189 :             auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
     143         5189 :             if (!thisZoneEquipConfig.IsControlled) {
     144          738 :                 continue;
     145              :             }
     146         4451 :             thisZoneEquipConfig.EquipListIndex = Util::FindItemInList(thisZoneEquipConfig.EquipListName, state.dataZoneEquip->ZoneEquipList);
     147         4451 :             auto &thisZoneEquipList = state.dataZoneEquip->ZoneEquipList(thisZoneEquipConfig.EquipListIndex);
     148         9189 :             for (int ZoneInletNodeNum = 1; ZoneInletNodeNum <= thisZoneEquipConfig.NumInletNodes; ++ZoneInletNodeNum) {
     149         4738 :                 int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInletNodeNum);
     150        10613 :                 for (int CompNum = 1; CompNum <= thisZoneEquipList.NumOfEquipTypes; ++CompNum) {
     151        11713 :                     for (int NodeCount = 1; NodeCount <= thisZoneEquipList.EquipData(CompNum).NumOutlets; ++NodeCount) {
     152         5838 :                         if (thisZoneEquipList.EquipData(CompNum).OutletNodeNums(NodeCount) ==
     153         5838 :                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).OutNode) {
     154         3796 :                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirDistUnitIndex = CompNum;
     155         3796 :                             if (thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathExists) {
     156        23766 :                                 for (int SAPNum = 1; SAPNum <= state.dataZoneEquip->NumSupplyAirPaths; ++SAPNum) {
     157       140917 :                                     for (int SAPOutNode = 1; SAPOutNode <= state.dataZoneEquip->SupplyAirPath(SAPNum).NumOutletNodes; ++SAPOutNode) {
     158       120943 :                                         if (thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).InNode ==
     159       120943 :                                             state.dataZoneEquip->SupplyAirPath(SAPNum).OutletNode(SAPOutNode)) {
     160         3792 :                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathIndex = SAPNum;
     161         3792 :                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathOutNodeIndex = SAPOutNode;
     162         7613 :                                             for (int OutNum = 1; OutNum <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes;
     163              :                                                  ++OutNum) {
     164         3821 :                                                 if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(OutNum) ==
     165         3821 :                                                     state.dataZoneEquip->SupplyAirPath(SAPNum).InletNodeNum) {
     166         3792 :                                                     thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirLoopNum = AirLoopNum;
     167         3792 :                                                     thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex =
     168         3792 :                                                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OutletBranchNum[OutNum - 1];
     169         3792 :                                                     if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) {
     170          141 :                                                         for (int MainBranchNum = 1;
     171          141 :                                                              MainBranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches;
     172              :                                                              ++MainBranchNum) {
     173          107 :                                                             if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)
     174          107 :                                                                     .Branch(MainBranchNum)
     175          214 :                                                                     .NodeNumOut ==
     176          107 :                                                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.NodeNumIn) {
     177           34 :                                                                 thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex = MainBranchNum;
     178              :                                                             }
     179              :                                                         }
     180              :                                                     } else { // no splitter
     181         3758 :                                                         thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex =
     182         3758 :                                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex;
     183              :                                                     }
     184              :                                                 }
     185              :                                             }
     186              :                                         }
     187              :                                     }
     188              :                                 }
     189              :                             } else { // no supply air path
     190            4 :                                 if (AirLoopNum > 0) {
     191            8 :                                     for (int NodeIndex = 1; NodeIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes;
     192              :                                          ++NodeIndex) {
     193            4 :                                         if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(NodeIndex) ==
     194            4 :                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).InNode) {
     195            8 :                                             for (int BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches;
     196              :                                                  ++BranchNum) {
     197            4 :                                                 if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).NodeNumOut ==
     198            4 :                                                     state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).AirLoopSupplyNodeNum(NodeIndex)) {
     199            4 :                                                     thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirLoopNum = AirLoopNum;
     200            4 :                                                     thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex = BranchNum;
     201            4 :                                                     if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) {
     202            0 :                                                         for (int MainBranchNum = 1;
     203            0 :                                                              MainBranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches;
     204              :                                                              ++MainBranchNum) {
     205            0 :                                                             if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)
     206            0 :                                                                     .Branch(MainBranchNum)
     207            0 :                                                                     .NodeNumOut ==
     208            0 :                                                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.NodeNumIn) {
     209            0 :                                                                 thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex = MainBranchNum;
     210              :                                                             }
     211              :                                                         }
     212              :                                                     } else { // no splitter
     213            4 :                                                         thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex =
     214            4 :                                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathIndex;
     215              :                                                     }
     216              :                                                 }
     217              :                                             }
     218              :                                         }
     219              :                                     }
     220              :                                 }
     221              :                             }
     222              :                         }
     223         5838 :                         if (thisZoneEquipList.EquipData(CompNum).OutletNodeNums(NodeCount) ==
     224         5838 :                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).OutNode) {
     225          123 :                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirDistUnitIndex = CompNum;
     226          123 :                             if (thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyAirPathExists) {
     227           93 :                                 for (int SAPNum = 1; SAPNum <= state.dataZoneEquip->NumSupplyAirPaths; ++SAPNum) {
     228          324 :                                     for (int SAPOutNode = 1; SAPOutNode <= state.dataZoneEquip->SupplyAirPath(SAPNum).NumOutletNodes; ++SAPOutNode) {
     229          260 :                                         if (thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).InNode ==
     230          260 :                                             state.dataZoneEquip->SupplyAirPath(SAPNum).OutletNode(SAPOutNode)) {
     231           29 :                                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyAirPathIndex = SAPNum;
     232           29 :                                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyAirPathOutNodeIndex = SAPOutNode;
     233           87 :                                             for (int OutNum = 1; OutNum <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes;
     234              :                                                  ++OutNum) {
     235           58 :                                                 if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(OutNum) ==
     236           58 :                                                     state.dataZoneEquip->SupplyAirPath(SAPNum).InletNodeNum) {
     237           29 :                                                     thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirLoopNum = AirLoopNum;
     238           29 :                                                     thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex =
     239           29 :                                                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OutletBranchNum[OutNum - 1];
     240           29 :                                                     if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) {
     241          116 :                                                         for (int MainBranchNum = 1;
     242          116 :                                                              MainBranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches;
     243              :                                                              ++MainBranchNum) {
     244           87 :                                                             if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)
     245           87 :                                                                     .Branch(MainBranchNum)
     246          174 :                                                                     .NodeNumOut ==
     247           87 :                                                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.NodeNumIn) {
     248           29 :                                                                 thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).MainBranchIndex = MainBranchNum;
     249              :                                                             }
     250              :                                                         }
     251              :                                                     } else { // no splitter
     252            0 :                                                         thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).MainBranchIndex =
     253            0 :                                                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex;
     254              :                                                     }
     255              :                                                 }
     256              :                                             }
     257              :                                         }
     258              :                                     }
     259              :                                 }
     260              :                             } else { // no supply air path
     261           94 :                                 if (AirLoopNum > 0) {
     262          188 :                                     for (int NodeIndex = 1; NodeIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes;
     263              :                                          ++NodeIndex) {
     264           94 :                                         if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(NodeIndex) ==
     265           94 :                                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).InNode) {
     266            0 :                                             for (int BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches;
     267              :                                                  ++BranchNum) {
     268            0 :                                                 if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).NodeNumOut ==
     269            0 :                                                     state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).AirLoopSupplyNodeNum(NodeIndex)) {
     270            0 :                                                     thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirLoopNum = AirLoopNum;
     271            0 :                                                     thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex = BranchNum;
     272            0 :                                                     if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.Exists) {
     273            0 :                                                         for (int MainBranchNum = 1;
     274            0 :                                                              MainBranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches;
     275              :                                                              ++MainBranchNum) {
     276            0 :                                                             if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)
     277            0 :                                                                     .Branch(MainBranchNum)
     278            0 :                                                                     .NodeNumOut ==
     279            0 :                                                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Splitter.NodeNumIn) {
     280            0 :                                                                 thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).MainBranchIndex = MainBranchNum;
     281              :                                                             }
     282              :                                                         }
     283              :                                                     } else { // no splitter
     284            0 :                                                         thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).MainBranchIndex =
     285            0 :                                                             thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyAirPathIndex;
     286              :                                                     }
     287              :                                                 }
     288              :                                             }
     289              :                                         }
     290              :                                     }
     291              :                                 }
     292              :                             }
     293              :                         }
     294              :                     }
     295              :                 }
     296              :             }
     297              :         }
     298              : 
     299         5988 :         for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
     300         5189 :             auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
     301         5189 :             if (!thisZoneEquipConfig.IsControlled) {
     302          738 :                 continue;
     303              :             }
     304         4451 :             thisZoneEquipConfig.EquipListIndex = Util::FindItemInList(thisZoneEquipConfig.EquipListName, state.dataZoneEquip->ZoneEquipList);
     305         4451 :             int ListNum = thisZoneEquipConfig.EquipListIndex;
     306              :             // loop over the zone supply air path inlet nodes
     307         9189 :             for (int ZoneInletNodeNum = 1; ZoneInletNodeNum <= thisZoneEquipConfig.NumInletNodes; ++ZoneInletNodeNum) {
     308         4738 :                 int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInletNodeNum);
     309              : 
     310              :                 // 1. Find HVAC component plant loop connections
     311         4738 :                 int MainBranchNum = thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).MainBranchIndex;
     312         4738 :                 MainBranchNum = max(MainBranchNum, thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex);
     313         4738 :                 if (MainBranchNum > 0) {
     314         3792 :                     MatchPlantSys(state, AirLoopNum, MainBranchNum);
     315              :                 }
     316         4738 :                 int SupplyCoolBranchNum = thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex;
     317         4738 :                 if (SupplyCoolBranchNum > 0 && (SupplyCoolBranchNum != MainBranchNum)) {
     318           38 :                     MatchPlantSys(state, AirLoopNum, SupplyCoolBranchNum);
     319              :                 }
     320         4738 :                 int SupplyHeatBranchNum = thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex;
     321         4738 :                 if (SupplyHeatBranchNum > 0 && (SupplyHeatBranchNum != MainBranchNum)) {
     322           29 :                     MatchPlantSys(state, AirLoopNum, SupplyHeatBranchNum);
     323              :                 }
     324              : 
     325         4738 :                 int AirDistUnitNum = thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirDistUnitIndex;
     326         4738 :                 AirDistUnitNum = max(AirDistUnitNum, thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirDistUnitIndex);
     327         4738 :                 if (ListNum > 0 && AirDistUnitNum > 0) {
     328         3796 :                     auto &thisZoneEquipList = state.dataZoneEquip->ZoneEquipList(ListNum);
     329         3796 :                     for (int VarNum = 1; VarNum <= thisZoneEquipList.EquipData(AirDistUnitNum).NumMeteredVars; ++VarNum) {
     330           30 :                         if (thisZoneEquipList.EquipData(AirDistUnitNum).MeteredVar(VarNum).resource == Constant::eResource::EnergyTransfer) {
     331           30 :                             thisZoneEquipList.EquipData(AirDistUnitNum).EnergyTransComp = EnergyTransfer;
     332           30 :                             const std::string &CompType = thisZoneEquipList.EquipData(AirDistUnitNum).TypeOf;
     333           30 :                             const std::string &CompName = thisZoneEquipList.EquipData(AirDistUnitNum).Name;
     334           30 :                             int Idx = 0;
     335           30 :                             int MatchLoop = 0;
     336           30 :                             int MatchLoopType = 0;
     337           30 :                             int MatchBranch = 0;
     338           30 :                             int MatchComp = 0;
     339           30 :                             bool MatchFound = false;
     340           30 :                             FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     341           30 :                             if (MatchFound) {
     342            0 :                                 UpdateZoneCompPtrArray(state, Idx, ListNum, AirDistUnitNum, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     343              :                             }
     344           30 :                             thisZoneEquipList.EquipData(AirDistUnitNum).ZoneEqToPlantPtr = Idx;
     345           30 :                             break;
     346              :                         }
     347              :                     }
     348         7621 :                     for (int SubEquipNum = 1; SubEquipNum <= thisZoneEquipList.EquipData(AirDistUnitNum).NumSubEquip; ++SubEquipNum) {
     349         3825 :                         for (int VarNum = 1; VarNum <= thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).NumMeteredVars;
     350              :                              ++VarNum) {
     351           35 :                             if (thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).MeteredVar(VarNum).resource ==
     352              :                                 Constant::eResource::EnergyTransfer) {
     353           35 :                                 thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).EnergyTransComp = EnergyTransfer;
     354           35 :                                 const std::string &CompType = thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).TypeOf;
     355           35 :                                 const std::string &CompName = thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).Name;
     356           35 :                                 int Idx = 0;
     357           35 :                                 int MatchLoop = 0;
     358           35 :                                 int MatchLoopType = 0;
     359           35 :                                 int MatchBranch = 0;
     360           35 :                                 int MatchComp = 0;
     361           35 :                                 bool MatchFound = false;
     362           35 :                                 FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     363           35 :                                 if (MatchFound) {
     364           35 :                                     UpdateZoneSubCompPtrArray(
     365              :                                         state, Idx, ListNum, AirDistUnitNum, SubEquipNum, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     366              :                                 }
     367           35 :                                 thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).ZoneEqToPlantPtr = Idx;
     368           35 :                                 break;
     369              :                             }
     370              :                         }
     371         6476 :                         for (int SubSubEquipNum = 1;
     372         6476 :                              SubSubEquipNum <= thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).NumSubSubEquip;
     373              :                              ++SubSubEquipNum) {
     374         2716 :                             for (int VarNum = 1;
     375         2716 :                                  VarNum <=
     376         2716 :                                  thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).SubSubEquipData(SubSubEquipNum).NumMeteredVars;
     377              :                                  ++VarNum) {
     378         2651 :                                 if (thisZoneEquipList.EquipData(AirDistUnitNum)
     379         2651 :                                         .SubEquipData(SubEquipNum)
     380         2651 :                                         .SubSubEquipData(SubSubEquipNum)
     381         2651 :                                         .MeteredVar(VarNum)
     382         2651 :                                         .resource == Constant::eResource::EnergyTransfer) {
     383         2586 :                                     thisZoneEquipList.EquipData(AirDistUnitNum)
     384         2586 :                                         .SubEquipData(SubEquipNum)
     385         2586 :                                         .SubSubEquipData(SubSubEquipNum)
     386         2586 :                                         .EnergyTransComp = EnergyTransfer;
     387              :                                     const std::string &CompType =
     388         2586 :                                         thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).SubSubEquipData(SubSubEquipNum).TypeOf;
     389              :                                     const std::string &CompName =
     390         2586 :                                         thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).SubSubEquipData(SubSubEquipNum).Name;
     391         2586 :                                     int Idx = 0;
     392         2586 :                                     int MatchLoop = 0;
     393         2586 :                                     int MatchLoopType = 0;
     394         2586 :                                     int MatchBranch = 0;
     395         2586 :                                     int MatchComp = 0;
     396         2586 :                                     bool MatchFound = false;
     397         2586 :                                     FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     398         2586 :                                     if (MatchFound) {
     399         2218 :                                         UpdateZoneSubSubCompPtrArray(state,
     400              :                                                                      Idx,
     401              :                                                                      ListNum,
     402              :                                                                      AirDistUnitNum,
     403              :                                                                      SubEquipNum,
     404              :                                                                      SubSubEquipNum,
     405              :                                                                      MatchLoopType,
     406              :                                                                      MatchLoop,
     407              :                                                                      MatchBranch,
     408              :                                                                      MatchComp);
     409              :                                     }
     410         5172 :                                     thisZoneEquipList.EquipData(AirDistUnitNum)
     411         2586 :                                         .SubEquipData(SubEquipNum)
     412         2586 :                                         .SubSubEquipData(SubSubEquipNum)
     413         2586 :                                         .ZoneEqToPlantPtr = Idx;
     414         2586 :                                     break;
     415              :                                 }
     416              :                             }
     417              :                         }
     418              :                     }
     419              :                 }
     420              : 
     421         4738 :                 int EquipNum = 0;
     422         4738 :                 int SubEquipNum = 0;
     423         4738 :                 int SubSubEquipNum = 0;
     424         4738 :                 int CompNum = 0;
     425         4738 :                 int SubCompNum = 0;
     426         4738 :                 int SubSubCompNum = 0;
     427              :                 // Eliminate duplicates in the connection arrays
     428         4738 :                 if (allocated(state.dataAirSystemsData->ZoneCompToPlant)) {
     429            0 :                     EquipNum = isize(state.dataAirSystemsData->ZoneCompToPlant);
     430              :                 }
     431         4738 :                 if (allocated(state.dataAirSystemsData->ZoneSubCompToPlant)) {
     432           35 :                     SubEquipNum = isize(state.dataAirSystemsData->ZoneSubCompToPlant);
     433              :                 }
     434         4738 :                 if (allocated(state.dataAirSystemsData->ZoneSubSubCompToPlant)) {
     435         2624 :                     SubSubEquipNum = isize(state.dataAirSystemsData->ZoneSubSubCompToPlant);
     436              :                 }
     437         4738 :                 if (allocated(state.dataAirSystemsData->AirSysCompToPlant)) {
     438         2842 :                     CompNum = isize(state.dataAirSystemsData->AirSysCompToPlant);
     439              :                 }
     440         4738 :                 if (allocated(state.dataAirSystemsData->AirSysSubCompToPlant)) {
     441            0 :                     SubCompNum = isize(state.dataAirSystemsData->AirSysSubCompToPlant);
     442              :                 }
     443         4738 :                 if (allocated(state.dataAirSystemsData->AirSysSubSubCompToPlant)) {
     444            0 :                     SubSubCompNum = isize(state.dataAirSystemsData->AirSysSubSubCompToPlant);
     445              :                 }
     446              : 
     447         4738 :                 if (EquipNum > 0) {
     448            0 :                     int ArrayCount = 0;
     449            0 :                     for (int i = 1; i <= EquipNum; ++i) {
     450            0 :                         auto const &zi = state.dataAirSystemsData->ZoneCompToPlant(i);
     451            0 :                         bool duplicate(false);
     452            0 :                         for (int j = 1; j <= ArrayCount; ++j) {
     453            0 :                             auto const &zj = state.dataAirSystemsData->ZoneCompToPlant(j);
     454            0 :                             if ((zi.ZoneEqListNum == zj.ZoneEqListNum) && (zi.ZoneEqCompNum == zj.ZoneEqCompNum)) { // Duplicate
     455            0 :                                 duplicate = true;
     456            0 :                                 break;
     457              :                             }
     458              :                         }
     459            0 :                         if (!duplicate) {
     460            0 :                             ++ArrayCount;
     461            0 :                             if (i > ArrayCount) { // Copy to lower position
     462            0 :                                 auto &za = state.dataAirSystemsData->ZoneCompToPlant(ArrayCount);
     463            0 :                                 za.ZoneEqListNum = zi.ZoneEqListNum;
     464            0 :                                 za.ZoneEqCompNum = zi.ZoneEqCompNum;
     465            0 :                                 za.PlantLoopType = zi.PlantLoopType;
     466            0 :                                 za.PlantLoopNum = zi.PlantLoopNum;
     467            0 :                                 za.PlantLoopBranch = zi.PlantLoopBranch;
     468            0 :                                 za.PlantLoopComp = zi.PlantLoopComp;
     469            0 :                                 za.FirstDemandSidePtr = zi.FirstDemandSidePtr;
     470            0 :                                 za.LastDemandSidePtr = zi.LastDemandSidePtr;
     471              :                             }
     472              :                         }
     473              :                     }
     474            0 :                     for (int i = ArrayCount + 1; i <= EquipNum; ++i) { // Zero the now-unused entries
     475            0 :                         auto &zi = state.dataAirSystemsData->ZoneCompToPlant(i);
     476            0 :                         zi.ZoneEqListNum = 0;
     477            0 :                         zi.ZoneEqCompNum = 0;
     478            0 :                         zi.PlantLoopType = 0;
     479            0 :                         zi.PlantLoopNum = 0;
     480            0 :                         zi.PlantLoopBranch = 0;
     481            0 :                         zi.PlantLoopComp = 0;
     482            0 :                         zi.FirstDemandSidePtr = 0;
     483            0 :                         zi.LastDemandSidePtr = 0;
     484              :                     }
     485              :                 }
     486              : 
     487         4738 :                 if (SubEquipNum > 0) {
     488           35 :                     int ArrayCount = 0;
     489         3535 :                     for (int i = 1; i <= SubEquipNum; ++i) {
     490         3500 :                         auto const &zi = state.dataAirSystemsData->ZoneSubCompToPlant(i);
     491         3500 :                         bool duplicate(false);
     492        27605 :                         for (int j = 1; j <= ArrayCount; ++j) {
     493        27315 :                             auto const &zj = state.dataAirSystemsData->ZoneSubCompToPlant(j);
     494        27315 :                             if ((zi.ZoneEqListNum == zj.ZoneEqListNum) && (zi.ZoneEqCompNum == zj.ZoneEqCompNum) &&
     495         3210 :                                 (zi.ZoneEqSubCompNum == zj.ZoneEqSubCompNum)) { // Duplicate
     496         3210 :                                 duplicate = true;
     497         3210 :                                 break;
     498              :                             }
     499              :                         }
     500         3500 :                         if (!duplicate) {
     501          290 :                             ++ArrayCount;
     502          290 :                             if (i > ArrayCount) { // Copy to lower position
     503            0 :                                 auto &za = state.dataAirSystemsData->ZoneSubCompToPlant(ArrayCount);
     504            0 :                                 za.ZoneEqListNum = zi.ZoneEqListNum;
     505            0 :                                 za.ZoneEqCompNum = zi.ZoneEqCompNum;
     506            0 :                                 za.ZoneEqSubCompNum = zi.ZoneEqSubCompNum;
     507            0 :                                 za.PlantLoopType = zi.PlantLoopType;
     508            0 :                                 za.PlantLoopNum = zi.PlantLoopNum;
     509            0 :                                 za.PlantLoopBranch = zi.PlantLoopBranch;
     510            0 :                                 za.PlantLoopComp = zi.PlantLoopComp;
     511            0 :                                 za.FirstDemandSidePtr = zi.FirstDemandSidePtr;
     512            0 :                                 za.LastDemandSidePtr = zi.LastDemandSidePtr;
     513              :                             }
     514              :                         }
     515              :                     }
     516         3245 :                     for (int i = ArrayCount + 1; i <= SubEquipNum; ++i) { // Zero the now-unused entries
     517         3210 :                         auto &zi = state.dataAirSystemsData->ZoneSubCompToPlant(i);
     518         3210 :                         zi.ZoneEqListNum = 0;
     519         3210 :                         zi.ZoneEqCompNum = 0;
     520         3210 :                         zi.ZoneEqSubCompNum = 0;
     521         3210 :                         zi.PlantLoopType = 0;
     522         3210 :                         zi.PlantLoopNum = 0;
     523         3210 :                         zi.PlantLoopBranch = 0;
     524         3210 :                         zi.PlantLoopComp = 0;
     525         3210 :                         zi.FirstDemandSidePtr = 0;
     526         3210 :                         zi.LastDemandSidePtr = 0;
     527              :                     }
     528              :                 }
     529              : 
     530         4738 :                 if (SubSubEquipNum > 0) {
     531         2624 :                     int ArrayCount = 0;
     532       271224 :                     for (int i = 1; i <= SubSubEquipNum; ++i) {
     533       268600 :                         auto const &zi = state.dataAirSystemsData->ZoneSubSubCompToPlant(i);
     534       268600 :                         bool duplicate(false);
     535      4121980 :                         for (int j = 1; j <= ArrayCount; ++j) {
     536      4076575 :                             auto const &zj = state.dataAirSystemsData->ZoneSubSubCompToPlant(j);
     537      4076575 :                             if ((zi.ZoneEqListNum == zj.ZoneEqListNum) && (zi.ZoneEqCompNum == zj.ZoneEqCompNum) &&
     538       223209 :                                 (zi.ZoneEqSubCompNum == zj.ZoneEqSubCompNum) && (zi.ZoneEqSubSubCompNum == zj.ZoneEqSubSubCompNum)) { // Duplicate
     539       223195 :                                 duplicate = true;
     540       223195 :                                 break;
     541              :                             }
     542              :                         }
     543       268600 :                         if (!duplicate) {
     544        45405 :                             ++ArrayCount;
     545        45405 :                             if (i > ArrayCount) { // Copy to lower position
     546            0 :                                 auto &za = state.dataAirSystemsData->ZoneSubSubCompToPlant(ArrayCount);
     547            0 :                                 za.ZoneEqListNum = zi.ZoneEqListNum;
     548            0 :                                 za.ZoneEqCompNum = zi.ZoneEqCompNum;
     549            0 :                                 za.ZoneEqSubCompNum = zi.ZoneEqSubCompNum;
     550            0 :                                 za.ZoneEqSubSubCompNum = zi.ZoneEqSubSubCompNum;
     551            0 :                                 za.PlantLoopType = zi.PlantLoopType;
     552            0 :                                 za.PlantLoopNum = zi.PlantLoopNum;
     553            0 :                                 za.PlantLoopBranch = zi.PlantLoopBranch;
     554            0 :                                 za.PlantLoopComp = zi.PlantLoopComp;
     555            0 :                                 za.FirstDemandSidePtr = zi.FirstDemandSidePtr;
     556            0 :                                 za.LastDemandSidePtr = zi.LastDemandSidePtr;
     557              :                             }
     558              :                         }
     559              :                     }
     560       225819 :                     for (int i = ArrayCount + 1; i <= SubSubEquipNum; ++i) { // Zero the now-unused entries
     561       223195 :                         auto &zi = state.dataAirSystemsData->ZoneSubSubCompToPlant(i);
     562       223195 :                         zi.ZoneEqListNum = 0;
     563       223195 :                         zi.ZoneEqCompNum = 0;
     564       223195 :                         zi.ZoneEqSubCompNum = 0;
     565       223195 :                         zi.ZoneEqSubSubCompNum = 0;
     566       223195 :                         zi.PlantLoopType = 0;
     567       223195 :                         zi.PlantLoopNum = 0;
     568       223195 :                         zi.PlantLoopBranch = 0;
     569       223195 :                         zi.PlantLoopComp = 0;
     570       223195 :                         zi.FirstDemandSidePtr = 0;
     571       223195 :                         zi.LastDemandSidePtr = 0;
     572              :                     }
     573              :                 }
     574              : 
     575         4738 :                 if (CompNum > 0) {
     576         2842 :                     int ArrayCount = 0;
     577       521842 :                     for (int i = 1; i <= CompNum; ++i) {
     578       519000 :                         auto const &ai = state.dataAirSystemsData->AirSysCompToPlant(i);
     579       519000 :                         bool duplicate(false);
     580      4552729 :                         for (int j = 1; j <= ArrayCount; ++j) {
     581      4529903 :                             auto const &aj = state.dataAirSystemsData->AirSysCompToPlant(j);
     582      4529903 :                             if ((ai.AirLoopNum == aj.AirLoopNum) && (ai.AirLoopBranch == aj.AirLoopBranch) &&
     583       535118 :                                 (ai.AirLoopComp == aj.AirLoopComp)) { // Duplicate
     584       496174 :                                 duplicate = true;
     585       496174 :                                 break;
     586              :                             }
     587              :                         }
     588       519000 :                         if (!duplicate) {
     589        22826 :                             ++ArrayCount;
     590        22826 :                             if (i > ArrayCount) { // Copy to lower position
     591          430 :                                 auto &aa = state.dataAirSystemsData->AirSysCompToPlant(ArrayCount);
     592          430 :                                 aa.AirLoopNum = ai.AirLoopNum;
     593          430 :                                 aa.AirLoopBranch = ai.AirLoopBranch;
     594          430 :                                 aa.AirLoopComp = ai.AirLoopComp;
     595          430 :                                 aa.PlantLoopType = ai.PlantLoopType;
     596          430 :                                 aa.PlantLoopNum = ai.PlantLoopNum;
     597          430 :                                 aa.PlantLoopBranch = ai.PlantLoopBranch;
     598          430 :                                 aa.PlantLoopComp = ai.PlantLoopComp;
     599          430 :                                 aa.FirstDemandSidePtr = ai.FirstDemandSidePtr;
     600          430 :                                 aa.LastDemandSidePtr = ai.LastDemandSidePtr;
     601              :                             }
     602              :                         }
     603              :                     }
     604       499016 :                     for (int i = ArrayCount + 1; i <= CompNum; ++i) { // Zero the now-unused entries
     605       496174 :                         auto &ai = state.dataAirSystemsData->AirSysCompToPlant(i);
     606       496174 :                         ai.AirLoopNum = 0;
     607       496174 :                         ai.AirLoopBranch = 0;
     608       496174 :                         ai.AirLoopComp = 0;
     609       496174 :                         ai.PlantLoopType = 0;
     610       496174 :                         ai.PlantLoopNum = 0;
     611       496174 :                         ai.PlantLoopBranch = 0;
     612       496174 :                         ai.PlantLoopComp = 0;
     613       496174 :                         ai.FirstDemandSidePtr = 0;
     614       496174 :                         ai.LastDemandSidePtr = 0;
     615              :                     }
     616              :                 }
     617              : 
     618         4738 :                 if (SubCompNum > 0) {
     619            0 :                     int ArrayCount = 0;
     620            0 :                     for (int i = 1; i <= SubCompNum; ++i) {
     621            0 :                         auto const &ai = state.dataAirSystemsData->AirSysSubCompToPlant(i);
     622            0 :                         bool duplicate(false);
     623            0 :                         for (int j = 1; j <= ArrayCount; ++j) {
     624            0 :                             auto const &aj = state.dataAirSystemsData->AirSysSubCompToPlant(j);
     625            0 :                             if ((ai.AirLoopNum == aj.AirLoopNum) && (ai.AirLoopBranch == aj.AirLoopBranch) && (ai.AirLoopComp == aj.AirLoopComp) &&
     626            0 :                                 (ai.AirLoopSubComp == aj.AirLoopSubComp)) { // Duplicate
     627            0 :                                 duplicate = true;
     628            0 :                                 break;
     629              :                             }
     630              :                         }
     631            0 :                         if (!duplicate) {
     632            0 :                             ++ArrayCount;
     633            0 :                             if (i > ArrayCount) { // Copy to lower position
     634            0 :                                 auto &aa = state.dataAirSystemsData->AirSysSubCompToPlant(ArrayCount);
     635            0 :                                 aa.AirLoopNum = ai.AirLoopNum;
     636            0 :                                 aa.AirLoopBranch = ai.AirLoopBranch;
     637            0 :                                 aa.AirLoopComp = ai.AirLoopComp;
     638            0 :                                 aa.AirLoopSubComp = ai.AirLoopSubComp;
     639            0 :                                 aa.PlantLoopType = ai.PlantLoopType;
     640            0 :                                 aa.PlantLoopNum = ai.PlantLoopNum;
     641            0 :                                 aa.PlantLoopBranch = ai.PlantLoopBranch;
     642            0 :                                 aa.PlantLoopComp = ai.PlantLoopComp;
     643            0 :                                 aa.FirstDemandSidePtr = ai.FirstDemandSidePtr;
     644            0 :                                 aa.LastDemandSidePtr = ai.LastDemandSidePtr;
     645              :                             }
     646              :                         }
     647              :                     }
     648            0 :                     for (int i = ArrayCount + 1; i <= SubCompNum; ++i) { // Zero the now-unused entries
     649            0 :                         auto &ai = state.dataAirSystemsData->AirSysSubCompToPlant(i);
     650            0 :                         ai.AirLoopNum = 0;
     651            0 :                         ai.AirLoopBranch = 0;
     652            0 :                         ai.AirLoopComp = 0;
     653            0 :                         ai.AirLoopSubComp = 0;
     654            0 :                         ai.PlantLoopType = 0;
     655            0 :                         ai.PlantLoopNum = 0;
     656            0 :                         ai.PlantLoopBranch = 0;
     657            0 :                         ai.PlantLoopComp = 0;
     658            0 :                         ai.FirstDemandSidePtr = 0;
     659            0 :                         ai.LastDemandSidePtr = 0;
     660              :                     }
     661              :                 }
     662              : 
     663         4738 :                 if (SubSubCompNum > 0) {
     664            0 :                     int ArrayCount = 0;
     665            0 :                     for (int i = 1; i <= SubCompNum; ++i) {
     666            0 :                         auto const &ai = state.dataAirSystemsData->AirSysSubSubCompToPlant(i);
     667            0 :                         bool duplicate = false;
     668            0 :                         for (int j = 1; j <= ArrayCount; ++j) {
     669            0 :                             auto const &aj = state.dataAirSystemsData->AirSysSubSubCompToPlant(j);
     670            0 :                             if ((ai.AirLoopNum == aj.AirLoopNum) && (ai.AirLoopBranch == aj.AirLoopBranch) && (ai.AirLoopComp == aj.AirLoopComp) &&
     671            0 :                                 (ai.AirLoopSubComp == aj.AirLoopSubComp) && (ai.AirLoopSubSubComp == aj.AirLoopSubSubComp)) { // Duplicate
     672            0 :                                 duplicate = true;
     673            0 :                                 break;
     674              :                             }
     675              :                         }
     676            0 :                         if (!duplicate) {
     677            0 :                             ++ArrayCount;
     678            0 :                             if (i > ArrayCount) { // Copy to lower position
     679            0 :                                 auto &aa = state.dataAirSystemsData->AirSysSubSubCompToPlant(ArrayCount);
     680            0 :                                 aa.AirLoopNum = ai.AirLoopNum;
     681            0 :                                 aa.AirLoopBranch = ai.AirLoopBranch;
     682            0 :                                 aa.AirLoopComp = ai.AirLoopComp;
     683            0 :                                 aa.AirLoopSubComp = ai.AirLoopSubComp;
     684            0 :                                 aa.AirLoopSubSubComp = ai.AirLoopSubSubComp;
     685            0 :                                 aa.PlantLoopType = ai.PlantLoopType;
     686            0 :                                 aa.PlantLoopNum = ai.PlantLoopNum;
     687            0 :                                 aa.PlantLoopBranch = ai.PlantLoopBranch;
     688            0 :                                 aa.PlantLoopComp = ai.PlantLoopComp;
     689            0 :                                 aa.FirstDemandSidePtr = ai.FirstDemandSidePtr;
     690            0 :                                 aa.LastDemandSidePtr = ai.LastDemandSidePtr;
     691              :                             }
     692              :                         }
     693              :                     }
     694            0 :                     for (int i = ArrayCount + 1; i <= SubCompNum; ++i) { // Zero the now-unused entries
     695            0 :                         auto &ai = state.dataAirSystemsData->AirSysSubSubCompToPlant(i);
     696            0 :                         ai.AirLoopNum = 0;
     697            0 :                         ai.AirLoopBranch = 0;
     698            0 :                         ai.AirLoopComp = 0;
     699            0 :                         ai.AirLoopSubComp = 0;
     700            0 :                         ai.AirLoopSubSubComp = 0;
     701            0 :                         ai.PlantLoopType = 0;
     702            0 :                         ai.PlantLoopNum = 0;
     703            0 :                         ai.PlantLoopBranch = 0;
     704            0 :                         ai.PlantLoopComp = 0;
     705            0 :                         ai.FirstDemandSidePtr = 0;
     706            0 :                         ai.LastDemandSidePtr = 0;
     707              :                     }
     708              :                 }
     709              : 
     710              :                 // 2. Find Supply Side loop for every demand side component
     711              :                 // The demand side components only need to know what supply side loop
     712              :                 // they are connected to.  The input and plant data structure will
     713              :                 // force the loop numbers to be the same.
     714              : 
     715              :                 // 3. Find Demand Side Component Corresponding to Supply Side Component
     716        13987 :                 for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops; ++PlantLoopNum) {
     717        47163 :                     for (int BranchNum = 1;
     718        47163 :                          BranchNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).TotalBranches;
     719              :                          ++BranchNum) {
     720        37914 :                         for (CompNum = 1;
     721        77131 :                              CompNum <=
     722        77131 :                              state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).Branch(BranchNum).TotalComponents;
     723              :                              ++CompNum) {
     724              :                             {
     725        39217 :                                 auto &thisVentRepComp = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum)
     726        39217 :                                                             .Branch(BranchNum)
     727        39217 :                                                             .Comp(CompNum);
     728        39217 :                                 const std::string &CompType = thisVentRepComp.TypeOf;
     729        39217 :                                 const std::string &CompName = thisVentRepComp.Name;
     730        39217 :                                 int MatchLoop = 0;
     731        39217 :                                 int MatchLoopType = 0;
     732        39217 :                                 int MatchBranch = 0;
     733        39217 :                                 int MatchComp = 0;
     734        39217 :                                 bool MatchFound = false;
     735        39217 :                                 FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     736        39217 :                                 thisVentRepComp.ConnectPlant.LoopType = MatchLoopType;
     737        39217 :                                 thisVentRepComp.ConnectPlant.LoopNum = MatchLoop;
     738        39217 :                                 thisVentRepComp.ConnectPlant.BranchNum = MatchBranch;
     739        39217 :                                 thisVentRepComp.ConnectPlant.CompNum = MatchComp;
     740              :                             }
     741              :                         }
     742              :                     }
     743              :                 }
     744              : 
     745         6969 :                 for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
     746        11349 :                     for (int BranchNum = 1;
     747        11349 :                          BranchNum <= state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).TotalBranches;
     748              :                          ++BranchNum) {
     749         9118 :                         for (CompNum = 1;
     750        18294 :                              CompNum <=
     751        18294 :                              state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).Branch(BranchNum).TotalComponents;
     752              :                              ++CompNum) {
     753              :                             {
     754         9176 :                                 auto &thisVentRepComp = state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum)
     755         9176 :                                                             .Branch(BranchNum)
     756         9176 :                                                             .Comp(CompNum);
     757         9176 :                                 const std::string &CompType = thisVentRepComp.TypeOf;
     758         9176 :                                 const std::string &CompName = thisVentRepComp.Name;
     759         9176 :                                 int MatchLoop = 0;
     760         9176 :                                 int MatchLoopType = 0;
     761         9176 :                                 int MatchBranch = 0;
     762         9176 :                                 int MatchComp = 0;
     763         9176 :                                 bool MatchFound = false;
     764         9176 :                                 FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     765         9176 :                                 thisVentRepComp.ConnectPlant.LoopType = MatchLoopType;
     766         9176 :                                 thisVentRepComp.ConnectPlant.LoopNum = MatchLoop;
     767         9176 :                                 thisVentRepComp.ConnectPlant.BranchNum = MatchBranch;
     768         9176 :                                 thisVentRepComp.ConnectPlant.CompNum = MatchComp;
     769              :                             }
     770              :                         }
     771              :                     }
     772              :                 }
     773              :             }
     774              :         } // Controlled Zone Loop
     775              : 
     776              :         // 4.  Now Load all of the plant supply/demand side connections in a single array with pointers from the
     777              :         //    connection arrays (ZoneCompToPlant, ZoneSubCompToPlant, ZoneSubSubCompToPlant, AirSysCompToPlant, etc.)
     778          799 :         int NumZoneConnectComps = 0;
     779          799 :         int NumZoneConnectSubComps = 0;
     780          799 :         int NumZoneConnectSubSubComps = 0;
     781          799 :         int NumAirSysConnectComps = 0;
     782          799 :         int NumAirSysConnectSubComps = 0;
     783          799 :         int NumAirSysConnectSubSubComps = 0;
     784          799 :         if (allocated(state.dataAirSystemsData->ZoneCompToPlant)) {
     785            0 :             NumZoneConnectComps = isize(state.dataAirSystemsData->ZoneCompToPlant);
     786              :         }
     787          799 :         if (allocated(state.dataAirSystemsData->ZoneSubCompToPlant)) {
     788            3 :             NumZoneConnectSubComps = isize(state.dataAirSystemsData->ZoneSubCompToPlant);
     789              :         }
     790          799 :         if (allocated(state.dataAirSystemsData->ZoneSubSubCompToPlant)) {
     791          270 :             NumZoneConnectSubSubComps = isize(state.dataAirSystemsData->ZoneSubSubCompToPlant);
     792              :         }
     793          799 :         if (allocated(state.dataAirSystemsData->AirSysCompToPlant)) {
     794          293 :             NumAirSysConnectComps = isize(state.dataAirSystemsData->AirSysCompToPlant);
     795              :         }
     796          799 :         if (allocated(state.dataAirSystemsData->AirSysSubCompToPlant)) {
     797            0 :             NumAirSysConnectSubComps = isize(state.dataAirSystemsData->AirSysSubCompToPlant);
     798              :         }
     799          799 :         if (allocated(state.dataAirSystemsData->AirSysSubSubCompToPlant)) {
     800            0 :             NumAirSysConnectSubSubComps = isize(state.dataAirSystemsData->AirSysSubSubCompToPlant);
     801              :         }
     802          799 :         state.dataSysRpts->OneTimeFlag_InitEnergyReports = false;
     803              : 
     804          799 :         int ArrayCount = 0;
     805          799 :         for (int CompNum = 1; CompNum <= NumZoneConnectComps; ++CompNum) {
     806            0 :             int LoopType = state.dataAirSystemsData->ZoneCompToPlant(CompNum).PlantLoopType;
     807            0 :             int LoopNum = state.dataAirSystemsData->ZoneCompToPlant(CompNum).PlantLoopNum;
     808            0 :             int FirstIndex = ArrayCount + 1;
     809            0 :             int LoopCount = 1;
     810            0 :             bool ConnectionFlag = false;
     811              : 
     812            0 :             if (LoopType > 0 && LoopNum > 0) {
     813            0 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     814              :             }
     815              : 
     816            0 :             int LastIndex = ArrayCount;
     817            0 :             if (FirstIndex > LastIndex) {
     818            0 :                 FirstIndex = LastIndex;
     819              :             }
     820            0 :             if (ConnectionFlag) {
     821            0 :                 state.dataAirSystemsData->ZoneCompToPlant(CompNum).FirstDemandSidePtr = FirstIndex;
     822            0 :                 state.dataAirSystemsData->ZoneCompToPlant(CompNum).LastDemandSidePtr = LastIndex;
     823              :             }
     824              :         }
     825              : 
     826         1099 :         for (int SubCompNum = 1; SubCompNum <= NumZoneConnectSubComps; ++SubCompNum) {
     827          300 :             int LoopType = state.dataAirSystemsData->ZoneSubCompToPlant(SubCompNum).PlantLoopType;
     828          300 :             int LoopNum = state.dataAirSystemsData->ZoneSubCompToPlant(SubCompNum).PlantLoopNum;
     829          300 :             int FirstIndex = ArrayCount + 1;
     830          300 :             int LoopCount = 1;
     831              : 
     832          300 :             bool ConnectionFlag = false;
     833          300 :             if (LoopType > 0 && LoopNum > 0) {
     834           35 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     835              :             }
     836              : 
     837          300 :             int LastIndex = ArrayCount;
     838          300 :             if (FirstIndex > LastIndex) {
     839          300 :                 FirstIndex = LastIndex;
     840              :             }
     841          300 :             if (ConnectionFlag) {
     842            0 :                 state.dataAirSystemsData->ZoneSubCompToPlant(SubCompNum).FirstDemandSidePtr = FirstIndex;
     843            0 :                 state.dataAirSystemsData->ZoneSubCompToPlant(SubCompNum).LastDemandSidePtr = LastIndex;
     844              :             }
     845              :         }
     846              : 
     847        27999 :         for (int SubSubCompNum = 1; SubSubCompNum <= NumZoneConnectSubSubComps; ++SubSubCompNum) {
     848        27200 :             int LoopType = state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).PlantLoopType;
     849        27200 :             int LoopNum = state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).PlantLoopNum;
     850        27200 :             int FirstIndex = ArrayCount + 1;
     851        27200 :             int LoopCount = 1;
     852        27200 :             bool ConnectionFlag = false;
     853              : 
     854        27200 :             if (LoopType > 0 && LoopNum > 0) {
     855         2218 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     856              :             }
     857              : 
     858        27200 :             int LastIndex = ArrayCount;
     859        27200 :             if (FirstIndex > LastIndex) {
     860        27200 :                 FirstIndex = LastIndex;
     861              :             }
     862        27200 :             if (ConnectionFlag) {
     863            0 :                 state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).FirstDemandSidePtr = FirstIndex;
     864            0 :                 state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).LastDemandSidePtr = LastIndex;
     865              :             }
     866              :         }
     867        32699 :         for (int CompNum = 1; CompNum <= NumAirSysConnectComps; ++CompNum) {
     868        31900 :             int LoopType = state.dataAirSystemsData->AirSysCompToPlant(CompNum).PlantLoopType;
     869        31900 :             int LoopNum = state.dataAirSystemsData->AirSysCompToPlant(CompNum).PlantLoopNum;
     870        31900 :             int FirstIndex = ArrayCount + 1;
     871        31900 :             int LoopCount = 1;
     872        31900 :             bool ConnectionFlag = false;
     873              : 
     874        31900 :             if (LoopType > 0 && LoopNum > 0) {
     875          838 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     876              :             }
     877              : 
     878        31900 :             int LastIndex = ArrayCount;
     879        31900 :             if (FirstIndex > LastIndex) {
     880        31900 :                 FirstIndex = LastIndex;
     881              :             }
     882        31900 :             if (ConnectionFlag) {
     883            0 :                 state.dataAirSystemsData->AirSysCompToPlant(CompNum).FirstDemandSidePtr = FirstIndex;
     884            0 :                 state.dataAirSystemsData->AirSysCompToPlant(CompNum).LastDemandSidePtr = LastIndex;
     885              :             }
     886              :         }
     887              : 
     888          799 :         for (int SubCompNum = 1; SubCompNum <= NumAirSysConnectSubComps; ++SubCompNum) {
     889            0 :             int LoopType = state.dataAirSystemsData->AirSysSubCompToPlant(SubCompNum).PlantLoopType;
     890            0 :             int LoopNum = state.dataAirSystemsData->AirSysSubCompToPlant(SubCompNum).PlantLoopNum;
     891            0 :             int FirstIndex = ArrayCount + 1;
     892            0 :             int LoopCount = 1;
     893            0 :             bool ConnectionFlag = false;
     894              : 
     895            0 :             if (LoopType > 0 && LoopNum > 0) {
     896            0 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     897              :             }
     898              : 
     899            0 :             int LastIndex = ArrayCount;
     900            0 :             if (FirstIndex > LastIndex) {
     901            0 :                 FirstIndex = LastIndex;
     902              :             }
     903            0 :             if (ConnectionFlag) {
     904            0 :                 state.dataAirSystemsData->AirSysSubCompToPlant(SubCompNum).FirstDemandSidePtr = FirstIndex;
     905            0 :                 state.dataAirSystemsData->AirSysSubCompToPlant(SubCompNum).LastDemandSidePtr = LastIndex;
     906              :             }
     907              :         }
     908              : 
     909          799 :         for (int SubSubCompNum = 1; SubSubCompNum <= NumAirSysConnectSubSubComps; ++SubSubCompNum) {
     910            0 :             int LoopType = state.dataAirSystemsData->AirSysSubSubCompToPlant(SubSubCompNum).PlantLoopType;
     911            0 :             int LoopNum = state.dataAirSystemsData->AirSysSubSubCompToPlant(SubSubCompNum).PlantLoopNum;
     912            0 :             int FirstIndex = ArrayCount + 1;
     913            0 :             int LoopCount = 1;
     914            0 :             bool ConnectionFlag = false;
     915              : 
     916            0 :             if (LoopType > 0 && LoopNum > 0) {
     917            0 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     918              :             }
     919              : 
     920            0 :             int LastIndex = ArrayCount;
     921            0 :             if (FirstIndex > LastIndex) {
     922            0 :                 FirstIndex = LastIndex;
     923              :             }
     924            0 :             if (ConnectionFlag) {
     925            0 :                 state.dataAirSystemsData->AirSysSubSubCompToPlant(SubSubCompNum).FirstDemandSidePtr = FirstIndex;
     926            0 :                 state.dataAirSystemsData->AirSysSubSubCompToPlant(SubSubCompNum).LastDemandSidePtr = LastIndex;
     927              :             }
     928              :         }
     929              : 
     930          799 :         reportAirLoopToplogy(state);
     931              : 
     932          799 :         reportZoneEquipmentToplogy(state);
     933              : 
     934          799 :         reportAirDistributionUnits(state);
     935              : 
     936          799 :         state.dataSysRpts->OneTimeFlag_InitEnergyReports = false;
     937              :     }
     938              : 
     939              :     // On every iteration, load the air loop energy data
     940      1487079 :     for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
     941       862704 :         auto &pas = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum);
     942      1735668 :         for (int BranchNum = 1; BranchNum <= pas.NumBranches; ++BranchNum) {
     943       872964 :             auto &pasBranch = pas.Branch(BranchNum);
     944      3420980 :             for (int CompNum = 1; CompNum <= pasBranch.TotalComponents; ++CompNum) {
     945      2548016 :                 auto &pasBranchComp = pasBranch.Comp(CompNum);
     946      5362455 :                 for (int VarNum = 1; VarNum <= pasBranchComp.NumMeteredVars; ++VarNum) {
     947      2814439 :                     auto &pasBranchCompMeter = pasBranchComp.MeteredVar(VarNum);
     948      2814439 :                     OutputProcessor::VariableType VarType = pasBranchCompMeter.varType;
     949      2814439 :                     int VarIndex = pasBranchCompMeter.num;
     950      2814439 :                     pasBranchCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     951              :                 }
     952      5186476 :                 for (int SubCompNum = 1; SubCompNum <= pasBranchComp.NumSubComps; ++SubCompNum) {
     953      2638460 :                     auto &pasBranchSubComp = pasBranchComp.SubComp(SubCompNum);
     954      7199126 :                     for (int VarNum = 1; VarNum <= pasBranchSubComp.NumMeteredVars; ++VarNum) {
     955      4560666 :                         auto &pasBranchSubCompMeter = pasBranchSubComp.MeteredVar(VarNum);
     956      4560666 :                         OutputProcessor::VariableType VarType = pasBranchSubCompMeter.varType;
     957      4560666 :                         int VarIndex = pasBranchSubCompMeter.num;
     958      4560666 :                         pasBranchSubCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     959              :                     }
     960      2651286 :                     for (int SubSubCompNum = 1; SubSubCompNum <= pasBranchSubComp.NumSubSubComps; ++SubSubCompNum) {
     961        12826 :                         auto &pasBranchSubSubComp = pasBranchSubComp.SubSubComp(SubSubCompNum);
     962        49879 :                         for (int VarNum = 1; VarNum <= pasBranchSubSubComp.NumMeteredVars; ++VarNum) {
     963        37053 :                             auto &pasBranchSubSubCompMeter = pasBranchSubSubComp.MeteredVar(VarNum);
     964        37053 :                             OutputProcessor::VariableType VarType = pasBranchSubSubCompMeter.varType;
     965        37053 :                             int VarIndex = pasBranchSubSubCompMeter.num;
     966        37053 :                             pasBranchSubSubCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     967              :                         }
     968              :                     }
     969              :                 }
     970              :             }
     971              :         }
     972              :     }
     973              : 
     974              :     // On every iteration, load the zone equipment energy data
     975      4136232 :     for (int ListNum = 1; ListNum <= state.dataGlobal->NumOfZones; ++ListNum) {
     976      3511857 :         if (!state.dataZoneEquip->ZoneEquipConfig(ListNum).IsControlled) {
     977       490019 :             continue;
     978              :         }
     979      3021838 :         auto &zel = state.dataZoneEquip->ZoneEquipList(ListNum);
     980      6349844 :         for (int CompNum = 1; CompNum <= zel.NumOfEquipTypes; ++CompNum) {
     981      3328006 :             auto &zelEquipData = zel.EquipData(CompNum);
     982      4732647 :             for (int VarNum = 1; VarNum <= zelEquipData.NumMeteredVars; ++VarNum) {
     983      1404641 :                 auto &zelEquipDataMeter = zelEquipData.MeteredVar(VarNum);
     984      1404641 :                 OutputProcessor::VariableType VarType = zelEquipDataMeter.varType;
     985      1404641 :                 int VarIndex = zelEquipDataMeter.num;
     986      1404641 :                 zelEquipDataMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     987              :             }
     988      6932903 :             for (int SubCompNum = 1; SubCompNum <= zelEquipData.NumSubEquip; ++SubCompNum) {
     989      3604897 :                 auto &zelSubEquipData = zelEquipData.SubEquipData(SubCompNum);
     990      5875610 :                 for (int VarNum = 1; VarNum <= zelSubEquipData.NumMeteredVars; ++VarNum) {
     991      2270713 :                     auto &zelSubEquipDataMeter = zelSubEquipData.MeteredVar(VarNum);
     992      2270713 :                     OutputProcessor::VariableType VarType = zelSubEquipDataMeter.varType;
     993      2270713 :                     int VarIndex = zelSubEquipDataMeter.num;
     994      2270713 :                     zelSubEquipDataMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     995              :                 }
     996      5221714 :                 for (int SubSubCompNum = 1; SubSubCompNum <= zelSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
     997      1616817 :                     auto &zelSubSubEquipData = zelSubEquipData.SubSubEquipData(SubSubCompNum);
     998      4907991 :                     for (int VarNum = 1; VarNum <= zelSubSubEquipData.NumMeteredVars; ++VarNum) {
     999      3291174 :                         auto &zelSubSubEquipDataMeter = zelSubSubEquipData.MeteredVar(VarNum);
    1000      3291174 :                         OutputProcessor::VariableType VarType = zelSubSubEquipDataMeter.varType;
    1001      3291174 :                         int VarIndex = zelSubSubEquipDataMeter.num;
    1002      3291174 :                         zelSubSubEquipDataMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex); // Sankar Corrected zone array
    1003              :                     }
    1004              :                 }
    1005              :             }
    1006              :         }
    1007              :     }
    1008              : 
    1009              :     // On every iteration, load the Plant Supply Side Data and load the Plant Demand Side Data
    1010      1873125 :     for (LoopSideLocation LoopSide : DataPlant::LoopSideKeys) {
    1011      2344110 :         for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops; ++PlantLoopNum) {
    1012      1095360 :             auto &vrp = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSide)](PlantLoopNum);
    1013      8179689 :             for (int BranchNum = 1; BranchNum <= vrp.TotalBranches; ++BranchNum) {
    1014      7084329 :                 auto &vrpBranch = vrp.Branch(BranchNum);
    1015     14186469 :                 for (int CompNum = 1; CompNum <= vrpBranch.TotalComponents; ++CompNum) {
    1016      7102140 :                     auto &vrpBranchComp = vrpBranch.Comp(CompNum);
    1017     17461630 :                     for (int VarNum = 1; VarNum <= vrpBranchComp.NumMeteredVars; ++VarNum) {
    1018     10359490 :                         auto &vrpBranchCompMeter = vrpBranchComp.MeteredVar(VarNum);
    1019     10359490 :                         OutputProcessor::VariableType VarType = vrpBranchCompMeter.varType;
    1020     10359490 :                         int VarIndex = vrpBranchCompMeter.num;
    1021     10359490 :                         vrpBranchCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
    1022              :                     }
    1023              :                 }
    1024              :             }
    1025              :         }
    1026              : 
    1027              :         // On every iteration, load the Condenser Supply Side Data and load the Condenser Demand Side Data
    1028      1461956 :         for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
    1029       213206 :             auto &vrc = state.dataPlnt->VentRepCond[static_cast<int>(LoopSide)](PlantLoopNum);
    1030      1159381 :             for (int BranchNum = 1; BranchNum <= vrc.TotalBranches; ++BranchNum) {
    1031       946175 :                 auto &vrcBranch = vrc.Branch(BranchNum);
    1032      1901612 :                 for (int CompNum = 1; CompNum <= vrcBranch.TotalComponents; ++CompNum) {
    1033       955437 :                     auto &vrcBranchComp = vrcBranch.Comp(CompNum);
    1034      1988759 :                     for (int VarNum = 1; VarNum <= vrcBranchComp.NumMeteredVars; ++VarNum) {
    1035      1033322 :                         auto &vrcBranchCompMeter = vrcBranchComp.MeteredVar(VarNum);
    1036      1033322 :                         OutputProcessor::VariableType VarType = vrcBranchCompMeter.varType;
    1037      1033322 :                         int VarIndex = vrcBranchCompMeter.num;
    1038      1033322 :                         vrcBranchCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
    1039              :                     }
    1040              :                 }
    1041              :             }
    1042              :         }
    1043              :     }
    1044              :     // initialize energy report variables
    1045              : }
    1046              : 
    1047         3091 : void FindFirstLastPtr(EnergyPlusData &state, int &LoopType, int &LoopNum, int &ArrayCount, int &LoopCount, bool &ConnectionFlag)
    1048              : {
    1049              :     // SUBROUTINE INFORMATION:
    1050              :     //       AUTHOR         Dan Fisher
    1051              :     //       DATE WRITTEN   July 2005
    1052              :     //       MODIFIED
    1053              :     //       RE-ENGINEERED  na
    1054              : 
    1055              :     // PURPOSE OF THIS SUBROUTINE:
    1056              :     // Initializes the energy components of the data structures
    1057              : 
    1058              :     // METHODOLOGY EMPLOYED:
    1059              :     // Once all compsets have been established (second iteration) find all components
    1060              :     // subcomponents, etc.
    1061              : 
    1062              :     int DemandSideLoopNum;
    1063              :     int DemandSideBranchNum;
    1064              :     int DemandSideCompNum;
    1065              :     int SupplySideCompNum;
    1066              :     int DemandSideLoopType;
    1067              :     bool found;
    1068              : 
    1069              :     // Object Data
    1070         3091 :     auto &LoopStack = state.dataSysRpts->LoopStack;
    1071              : 
    1072         3091 :     return; // Autodesk:? Is this routine now an intentional NOOP?
    1073              : 
    1074              :     if (state.dataSysRpts->OneTimeFlag_FindFirstLastPtr) {
    1075              :         LoopStack.allocate(state.dataSysRpts->MaxLoopArraySize);
    1076              :         state.dataAirSystemsData->DemandSideConnect.allocate(state.dataSysRpts->MaxCompArraySize);
    1077              : 
    1078              :         state.dataSysRpts->OneTimeFlag_FindFirstLastPtr = false;
    1079              :     }
    1080              :     for (auto &e : LoopStack) {
    1081              :         e.LoopNum = 0;
    1082              :         e.LoopType = 0;
    1083              :     }
    1084              : 
    1085              :     ConnectionFlag = false;
    1086              :     //    countloop=0
    1087              :     //    write(outputfiledebug,*) '1228=lt,lc,lnum,cflag,arrcnt',looptype,loopcount,LoopNum,connectionflag,arraycount
    1088              : 
    1089              :     while (LoopCount > 0) {
    1090              :         //        write(outputfiledebug,*) '1231==lt,lc,lnum,cflag,arrcnt',looptype,loopcount,LoopNum,connectionflag,arraycount
    1091              :         //        write(outputfiledebug,*) 'loop=plname',TRIM(plantloop(LoopNum)%name)
    1092              :         --LoopCount;
    1093              :         //        countloop=countloop+1
    1094              :         //        if (countloop > 100) exit
    1095              :         if (LoopType == 1) {
    1096              :             for (int BranchNum = 1; BranchNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).TotalBranches;
    1097              :                  ++BranchNum) {
    1098              :                 for (int SupplySideCompNum = 1;
    1099              :                      SupplySideCompNum <=
    1100              :                      state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).TotalComponents;
    1101              :                      ++SupplySideCompNum) {
    1102              :                     {
    1103              :                         auto const &thisVentRepComp =
    1104              :                             state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).Comp(
    1105              :                                 SupplySideCompNum);
    1106              :                         DemandSideLoopType = thisVentRepComp.ConnectPlant.LoopType;
    1107              :                         DemandSideLoopNum = thisVentRepComp.ConnectPlant.LoopNum;
    1108              :                         DemandSideBranchNum = thisVentRepComp.ConnectPlant.BranchNum;
    1109              :                         DemandSideCompNum = thisVentRepComp.ConnectPlant.CompNum;
    1110              :                     }
    1111              :                     // If the connection is valid load the connection array
    1112              :                     if (DemandSideLoopType == 1 || DemandSideLoopType == 2) {
    1113              :                         ConnectionFlag = true;
    1114              :                         ++ArrayCount;
    1115              :                         if (ArrayCount > state.dataSysRpts->MaxCompArraySize) {
    1116              :                             state.dataAirSystemsData->DemandSideConnect.redimension(state.dataSysRpts->MaxCompArraySize += 100);
    1117              :                         }
    1118              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).LoopType = DemandSideLoopType;
    1119              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).LoopNum = DemandSideLoopNum;
    1120              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).BranchNum = DemandSideBranchNum;
    1121              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).CompNum = DemandSideCompNum;
    1122              : 
    1123              :                         found = false;
    1124              :                         print(state.files.debug, "1271=lstacksize {}\n", size(LoopStack));
    1125              :                         for (int Idx = 1; Idx <= isize(LoopStack); ++Idx) {
    1126              :                             if (DemandSideLoopNum == LoopStack(Idx).LoopNum && DemandSideLoopType == LoopStack(Idx).LoopType) {
    1127              :                                 found = true;
    1128              :                                 break;
    1129              :                             }
    1130              :                         }
    1131              :                         if (!found) {
    1132              :                             ++LoopCount;
    1133              :                             //       write(outputfiledebug,*) '1280=lc,mxsize',loopcount,maxlooparraysize
    1134              :                             //       write(outputfiledebug,*) '1281=dsloopnum,dslooptype',DemandSideLoopNum,DemandSideLoopType
    1135              :                             if (LoopCount > state.dataSysRpts->MaxLoopArraySize) {
    1136              :                                 LoopStack.redimension(state.dataSysRpts->MaxLoopArraySize += 100);
    1137              :                             }
    1138              :                             //               write(outputfiledebug,*)
    1139              :                             //               '1294=lcnt,dsloopnum,dslooptype',loopcount,DemandSideLoopNum,DemandSideLoopType
    1140              :                             LoopStack(LoopCount).LoopNum = DemandSideLoopNum;
    1141              :                             LoopStack(LoopCount).LoopType = DemandSideLoopType;
    1142              :                         }
    1143              :                     }
    1144              :                 }
    1145              :             }
    1146              :         } else if (LoopType == 2) {
    1147              :             for (int BranchNum = 1; BranchNum <= state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](LoopNum).TotalBranches;
    1148              :                  ++BranchNum) {
    1149              :                 for (SupplySideCompNum = 1;
    1150              :                      SupplySideCompNum <=
    1151              :                      state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).TotalComponents;
    1152              :                      ++SupplySideCompNum) {
    1153              :                     {
    1154              :                         auto const &thisVentRepComp =
    1155              :                             state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).Comp(
    1156              :                                 SupplySideCompNum);
    1157              :                         DemandSideLoopType = thisVentRepComp.ConnectPlant.LoopType;
    1158              :                         DemandSideLoopNum = thisVentRepComp.ConnectPlant.LoopNum;
    1159              :                         DemandSideBranchNum = thisVentRepComp.ConnectPlant.BranchNum;
    1160              :                         DemandSideCompNum = thisVentRepComp.ConnectPlant.CompNum;
    1161              :                     }
    1162              :                     // If the connection is valid load the connection array
    1163              :                     if (DemandSideLoopType == 1 || DemandSideLoopType == 2) {
    1164              :                         ConnectionFlag = true;
    1165              :                         ++ArrayCount;
    1166              :                         if (ArrayCount > state.dataSysRpts->MaxCompArraySize) {
    1167              :                             state.dataAirSystemsData->DemandSideConnect.redimension(state.dataSysRpts->MaxCompArraySize += 100);
    1168              :                         }
    1169              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).LoopType = DemandSideLoopType;
    1170              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).LoopNum = DemandSideLoopNum;
    1171              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).BranchNum = DemandSideBranchNum;
    1172              :                         state.dataAirSystemsData->DemandSideConnect(ArrayCount).CompNum = DemandSideCompNum;
    1173              : 
    1174              :                         found = false;
    1175              :                         for (int Idx = 1; Idx <= isize(LoopStack); ++Idx) {
    1176              :                             if (DemandSideLoopNum == LoopStack(Idx).LoopNum && DemandSideLoopType == LoopStack(Idx).LoopType) {
    1177              :                                 found = true;
    1178              :                                 break;
    1179              :                             }
    1180              :                         }
    1181              :                         if (!found) {
    1182              :                             ++LoopCount;
    1183              :                             //       write(outputfiledebug,*) '1341=lcnt,arrsize',loopcount,maxlooparraysize
    1184              :                             //       write(outputfiledebug,*) '1342=lsloopnum,dslooptype',DemandSideLoopNum,DemandSideLoopType
    1185              :                             if (LoopCount > state.dataSysRpts->MaxLoopArraySize) {
    1186              :                                 LoopStack.redimension(state.dataSysRpts->MaxLoopArraySize += 100);
    1187              :                             }
    1188              :                             LoopStack(LoopCount).LoopNum = DemandSideLoopNum;
    1189              :                             LoopStack(LoopCount).LoopType = DemandSideLoopType;
    1190              :                         }
    1191              :                     }
    1192              :                 }
    1193              :             }
    1194              :         } else {
    1195              :             print(state.files.debug, "{}\n", "1361=error");
    1196              :             // error
    1197              :         }
    1198              : 
    1199              :         // now unload the LoopNum and LoopType arrays
    1200              :         if (LoopCount > 0) {
    1201              :             LoopType = LoopStack(LoopCount).LoopType;
    1202              :             LoopNum = LoopStack(LoopCount).LoopNum;
    1203              :         }
    1204              : 
    1205              :     } // While loop
    1206              : }
    1207              : 
    1208            0 : void UpdateZoneCompPtrArray(EnergyPlusData &state,
    1209              :                             int &Idx,
    1210              :                             int const ListNum,
    1211              :                             int const AirDistUnitNum,
    1212              :                             int const PlantLoopType,
    1213              :                             int const PlantLoop,
    1214              :                             int const PlantBranch,
    1215              :                             int const PlantComp)
    1216              : {
    1217              :     // SUBROUTINE INFORMATION:
    1218              :     //       AUTHOR         Dan Fisher
    1219              :     //       DATE WRITTEN   June 2005
    1220              :     //       MODIFIED       na
    1221              :     //       RE-ENGINEERED  na
    1222              : 
    1223              :     // PURPOSE OF THIS SUBROUTINE:
    1224              :     // Update Zone Component pointers
    1225              : 
    1226            0 :     if (state.dataSysRpts->OneTimeFlag_UpdateZoneCompPtrArray) {
    1227            0 :         state.dataAirSystemsData->ZoneCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateZoneCompPtrArray);
    1228            0 :         for (auto &e : state.dataAirSystemsData->ZoneCompToPlant) {
    1229            0 :             e.ZoneEqListNum = 0;
    1230            0 :             e.ZoneEqCompNum = 0;
    1231            0 :             e.PlantLoopType = 0;
    1232            0 :             e.PlantLoopNum = 0;
    1233            0 :             e.PlantLoopBranch = 0;
    1234            0 :             e.PlantLoopComp = 0;
    1235            0 :             e.FirstDemandSidePtr = 0;
    1236            0 :             e.LastDemandSidePtr = 0;
    1237              :         }
    1238              : 
    1239            0 :         state.dataSysRpts->OneTimeFlag_UpdateZoneCompPtrArray = false;
    1240              :     }
    1241              : 
    1242            0 :     if (state.dataSysRpts->ArrayCounter_UpdateZoneCompPtrArray >= state.dataSysRpts->ArrayLimit_UpdateZoneCompPtrArray) { // Redimension larger
    1243            0 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateZoneCompPtrArray);
    1244            0 :         state.dataAirSystemsData->ZoneCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateZoneCompPtrArray *= 2);
    1245            0 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateZoneCompPtrArray; ++i) {
    1246            0 :             auto &zctp = state.dataAirSystemsData->ZoneCompToPlant(i);
    1247            0 :             zctp.ZoneEqListNum = 0;
    1248            0 :             zctp.ZoneEqCompNum = 0;
    1249            0 :             zctp.PlantLoopType = 0;
    1250            0 :             zctp.PlantLoopNum = 0;
    1251            0 :             zctp.PlantLoopBranch = 0;
    1252            0 :             zctp.PlantLoopComp = 0;
    1253            0 :             zctp.FirstDemandSidePtr = 0;
    1254            0 :             zctp.LastDemandSidePtr = 0;
    1255              :         }
    1256              :     }
    1257              : 
    1258            0 :     Idx = state.dataSysRpts->ArrayCounter_UpdateZoneCompPtrArray;
    1259            0 :     auto &zctp = state.dataAirSystemsData->ZoneCompToPlant(Idx);
    1260            0 :     zctp.ZoneEqListNum = ListNum;
    1261            0 :     zctp.ZoneEqCompNum = AirDistUnitNum;
    1262            0 :     zctp.PlantLoopType = PlantLoopType;
    1263            0 :     zctp.PlantLoopNum = PlantLoop;
    1264            0 :     zctp.PlantLoopBranch = PlantBranch;
    1265            0 :     zctp.PlantLoopComp = PlantComp;
    1266            0 :     ++state.dataSysRpts->ArrayCounter_UpdateZoneCompPtrArray;
    1267            0 : }
    1268              : 
    1269           35 : void UpdateZoneSubCompPtrArray(EnergyPlusData &state,
    1270              :                                int &Idx,
    1271              :                                int const ListNum,
    1272              :                                int const AirDistUnitNum,
    1273              :                                int const SubCompNum,
    1274              :                                int const PlantLoopType,
    1275              :                                int const PlantLoop,
    1276              :                                int const PlantBranch,
    1277              :                                int const PlantComp)
    1278              : {
    1279              :     // SUBROUTINE INFORMATION:
    1280              :     //       AUTHOR         Dan Fisher
    1281              :     //       DATE WRITTEN   June 2005
    1282              :     //       MODIFIED       na
    1283              :     //       RE-ENGINEERED  na
    1284              : 
    1285              :     // PURPOSE OF THIS SUBROUTINE:
    1286              :     // Update Zone Sub Component Pointer Array
    1287              : 
    1288           35 :     if (state.dataSysRpts->OneTimeFlag_UpdateZoneSubCompPtrArray) {
    1289            3 :         state.dataAirSystemsData->ZoneSubCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateZoneSubCompPtrArray);
    1290          303 :         for (auto &e : state.dataAirSystemsData->ZoneSubCompToPlant) {
    1291          300 :             e.ZoneEqListNum = 0;
    1292          300 :             e.ZoneEqCompNum = 0;
    1293          300 :             e.ZoneEqSubCompNum = 0;
    1294          300 :             e.PlantLoopType = 0;
    1295          300 :             e.PlantLoopNum = 0;
    1296          300 :             e.PlantLoopBranch = 0;
    1297          300 :             e.PlantLoopComp = 0;
    1298          300 :             e.FirstDemandSidePtr = 0;
    1299          300 :             e.LastDemandSidePtr = 0;
    1300              :         }
    1301              : 
    1302            3 :         state.dataSysRpts->OneTimeFlag_UpdateZoneSubCompPtrArray = false;
    1303              :     }
    1304              : 
    1305           35 :     if (state.dataSysRpts->ArrayCounter_UpdateZoneSubCompPtrArray >= state.dataSysRpts->ArrayLimit_UpdateZoneSubCompPtrArray) { // Redimension larger
    1306            0 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateZoneSubCompPtrArray);
    1307            0 :         state.dataAirSystemsData->ZoneSubCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateZoneSubCompPtrArray *= 2);
    1308            0 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateZoneSubCompPtrArray; ++i) {
    1309            0 :             auto &zctp = state.dataAirSystemsData->ZoneSubCompToPlant(i);
    1310            0 :             zctp.ZoneEqListNum = 0;
    1311            0 :             zctp.ZoneEqCompNum = 0;
    1312            0 :             zctp.ZoneEqSubCompNum = 0;
    1313            0 :             zctp.PlantLoopType = 0;
    1314            0 :             zctp.PlantLoopNum = 0;
    1315            0 :             zctp.PlantLoopBranch = 0;
    1316            0 :             zctp.PlantLoopComp = 0;
    1317            0 :             zctp.FirstDemandSidePtr = 0;
    1318            0 :             zctp.LastDemandSidePtr = 0;
    1319              :         }
    1320              :     }
    1321              : 
    1322           35 :     Idx = state.dataSysRpts->ArrayCounter_UpdateZoneSubCompPtrArray;
    1323           35 :     auto &zctp = state.dataAirSystemsData->ZoneSubCompToPlant(Idx);
    1324           35 :     zctp.ZoneEqListNum = ListNum;
    1325           35 :     zctp.ZoneEqCompNum = AirDistUnitNum;
    1326           35 :     zctp.ZoneEqSubCompNum = SubCompNum;
    1327           35 :     zctp.PlantLoopType = PlantLoopType;
    1328           35 :     zctp.PlantLoopNum = PlantLoop;
    1329           35 :     zctp.PlantLoopBranch = PlantBranch;
    1330           35 :     zctp.PlantLoopComp = PlantComp;
    1331           35 :     ++state.dataSysRpts->ArrayCounter_UpdateZoneSubCompPtrArray;
    1332           35 : }
    1333              : 
    1334         2218 : void UpdateZoneSubSubCompPtrArray(EnergyPlusData &state,
    1335              :                                   int &Idx,
    1336              :                                   int const ListNum,
    1337              :                                   int const AirDistUnitNum,
    1338              :                                   int const SubCompNum,
    1339              :                                   int const SubSubCompNum,
    1340              :                                   int const PlantLoopType,
    1341              :                                   int const PlantLoop,
    1342              :                                   int const PlantBranch,
    1343              :                                   int const PlantComp)
    1344              : {
    1345              :     // SUBROUTINE INFORMATION:
    1346              :     //       AUTHOR         Dan Fisher
    1347              :     //       DATE WRITTEN   June 2005
    1348              :     //       MODIFIED       na
    1349              :     //       RE-ENGINEERED  na
    1350              : 
    1351              :     // PURPOSE OF THIS SUBROUTINE:
    1352              :     // Update Zone Sub Component Pointer Array
    1353              : 
    1354         2218 :     if (state.dataSysRpts->OneTimeFlag_UpdateZoneSubSubCompPtrArray) {
    1355          270 :         state.dataAirSystemsData->ZoneSubSubCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateZoneSubSubCompPtrArray);
    1356        27270 :         for (auto &e : state.dataAirSystemsData->ZoneSubSubCompToPlant) {
    1357        27000 :             e.ZoneEqListNum = 0;
    1358        27000 :             e.ZoneEqCompNum = 0;
    1359        27000 :             e.ZoneEqSubCompNum = 0;
    1360        27000 :             e.ZoneEqSubSubCompNum = 0;
    1361        27000 :             e.PlantLoopType = 0;
    1362        27000 :             e.PlantLoopNum = 0;
    1363        27000 :             e.PlantLoopBranch = 0;
    1364        27000 :             e.PlantLoopComp = 0;
    1365        27000 :             e.FirstDemandSidePtr = 0;
    1366        27000 :             e.LastDemandSidePtr = 0;
    1367              :         }
    1368              : 
    1369          270 :         state.dataSysRpts->OneTimeFlag_UpdateZoneSubSubCompPtrArray = false;
    1370              :     }
    1371              : 
    1372         2218 :     if (state.dataSysRpts->ArrayCounter_UpdateZoneSubSubCompPtrArray >=
    1373         2218 :         state.dataSysRpts->ArrayLimit_UpdateZoneSubSubCompPtrArray) { // Redimension larger
    1374            2 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateZoneSubSubCompPtrArray);
    1375            2 :         state.dataAirSystemsData->ZoneSubSubCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateZoneSubSubCompPtrArray *= 2);
    1376          202 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateZoneSubSubCompPtrArray; ++i) {
    1377          200 :             auto &zctp = state.dataAirSystemsData->ZoneSubSubCompToPlant(i);
    1378          200 :             zctp.ZoneEqListNum = 0;
    1379          200 :             zctp.ZoneEqCompNum = 0;
    1380          200 :             zctp.ZoneEqSubCompNum = 0;
    1381          200 :             zctp.ZoneEqSubSubCompNum = 0;
    1382          200 :             zctp.PlantLoopType = 0;
    1383          200 :             zctp.PlantLoopNum = 0;
    1384          200 :             zctp.PlantLoopBranch = 0;
    1385          200 :             zctp.PlantLoopComp = 0;
    1386          200 :             zctp.FirstDemandSidePtr = 0;
    1387          200 :             zctp.LastDemandSidePtr = 0;
    1388              :         }
    1389              :     }
    1390              : 
    1391         2218 :     Idx = state.dataSysRpts->ArrayCounter_UpdateZoneSubSubCompPtrArray;
    1392         2218 :     auto &zctp = state.dataAirSystemsData->ZoneSubSubCompToPlant(Idx);
    1393         2218 :     zctp.ZoneEqListNum = ListNum;
    1394         2218 :     zctp.ZoneEqCompNum = AirDistUnitNum;
    1395         2218 :     zctp.ZoneEqSubCompNum = SubCompNum;
    1396         2218 :     zctp.ZoneEqSubSubCompNum = SubSubCompNum;
    1397         2218 :     zctp.PlantLoopType = PlantLoopType;
    1398         2218 :     zctp.PlantLoopNum = PlantLoop;
    1399         2218 :     zctp.PlantLoopBranch = PlantBranch;
    1400         2218 :     zctp.PlantLoopComp = PlantComp;
    1401         2218 :     ++state.dataSysRpts->ArrayCounter_UpdateZoneSubSubCompPtrArray;
    1402         2218 : }
    1403              : 
    1404         6239 : void UpdateAirSysCompPtrArray(EnergyPlusData &state,
    1405              :                               int &Idx,
    1406              :                               int const AirLoopNum,
    1407              :                               int const BranchNum,
    1408              :                               int const CompNum,
    1409              :                               int const PlantLoopType,
    1410              :                               int const PlantLoop,
    1411              :                               int const PlantBranch,
    1412              :                               int const PlantComp)
    1413              : {
    1414              :     // SUBROUTINE INFORMATION:
    1415              :     //       AUTHOR         Dan Fisher
    1416              :     //       DATE WRITTEN   June 2005
    1417              :     //       MODIFIED       na
    1418              :     //       RE-ENGINEERED  na
    1419              : 
    1420              :     // PURPOSE OF THIS SUBROUTINE:
    1421              :     // Update Air System Component Pointer Array
    1422              : 
    1423         6239 :     if (state.dataSysRpts->OneTimeFlag_UpdateAirSysCompPtrArray) {
    1424          293 :         state.dataAirSystemsData->AirSysCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray);
    1425        29593 :         for (auto &e : state.dataAirSystemsData->AirSysCompToPlant) {
    1426        29300 :             e.AirLoopNum = 0;
    1427        29300 :             e.AirLoopBranch = 0;
    1428        29300 :             e.AirLoopComp = 0;
    1429        29300 :             e.PlantLoopType = 0;
    1430        29300 :             e.PlantLoopNum = 0;
    1431        29300 :             e.PlantLoopBranch = 0;
    1432        29300 :             e.PlantLoopComp = 0;
    1433        29300 :             e.FirstDemandSidePtr = 0;
    1434        29300 :             e.LastDemandSidePtr = 0;
    1435              :         }
    1436              : 
    1437          293 :         state.dataSysRpts->OneTimeFlag_UpdateAirSysCompPtrArray = false;
    1438              :     }
    1439              : 
    1440         6239 :     if (state.dataSysRpts->ArrayCounter_UpdateAirSysCompPtrArray >= state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray) { // Redimension larger
    1441           14 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray);
    1442           14 :         state.dataAirSystemsData->AirSysCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray *= 2);
    1443         2614 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray; ++i) {
    1444         2600 :             auto &actp = state.dataAirSystemsData->AirSysCompToPlant(i);
    1445         2600 :             actp.AirLoopNum = 0;
    1446         2600 :             actp.AirLoopBranch = 0;
    1447         2600 :             actp.AirLoopComp = 0;
    1448         2600 :             actp.PlantLoopType = 0;
    1449         2600 :             actp.PlantLoopNum = 0;
    1450         2600 :             actp.PlantLoopBranch = 0;
    1451         2600 :             actp.PlantLoopComp = 0;
    1452         2600 :             actp.FirstDemandSidePtr = 0;
    1453         2600 :             actp.LastDemandSidePtr = 0;
    1454              :         }
    1455              :     }
    1456              : 
    1457         6239 :     Idx = state.dataSysRpts->ArrayCounter_UpdateAirSysCompPtrArray;
    1458         6239 :     auto &actp = state.dataAirSystemsData->AirSysCompToPlant(Idx);
    1459         6239 :     actp.AirLoopNum = AirLoopNum;
    1460         6239 :     actp.AirLoopBranch = BranchNum;
    1461         6239 :     actp.AirLoopComp = CompNum;
    1462         6239 :     actp.PlantLoopType = PlantLoopType;
    1463         6239 :     actp.PlantLoopNum = PlantLoop;
    1464         6239 :     actp.PlantLoopBranch = PlantBranch;
    1465         6239 :     actp.PlantLoopComp = PlantComp;
    1466         6239 :     ++state.dataSysRpts->ArrayCounter_UpdateAirSysCompPtrArray;
    1467         6239 : }
    1468              : 
    1469            0 : void UpdateAirSysSubCompPtrArray(EnergyPlusData &state,
    1470              :                                  int &Idx,
    1471              :                                  int const AirLoopNum,
    1472              :                                  int const BranchNum,
    1473              :                                  int const CompNum,
    1474              :                                  int const SubCompNum,
    1475              :                                  int const PlantLoopType,
    1476              :                                  int const PlantLoop,
    1477              :                                  int const PlantBranch,
    1478              :                                  int const PlantComp)
    1479              : {
    1480              :     // SUBROUTINE INFORMATION:
    1481              :     //       AUTHOR         Dan Fisher
    1482              :     //       DATE WRITTEN   June 2005
    1483              :     //       MODIFIED       na
    1484              :     //       RE-ENGINEERED  na
    1485              : 
    1486              :     // PURPOSE OF THIS SUBROUTINE:
    1487              :     // Update Air System Sub Component Pointer Array
    1488              : 
    1489            0 :     if (state.dataSysRpts->OneTimeFlag_UpdateAirSysSubCompPtrArray) {
    1490            0 :         state.dataAirSystemsData->AirSysSubCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateAirSysSubCompPtrArray);
    1491            0 :         for (auto &e : state.dataAirSystemsData->AirSysSubCompToPlant) {
    1492            0 :             e.AirLoopNum = 0;
    1493            0 :             e.AirLoopBranch = 0;
    1494            0 :             e.AirLoopComp = 0;
    1495            0 :             e.AirLoopSubComp = 0;
    1496            0 :             e.PlantLoopType = 0;
    1497            0 :             e.PlantLoopNum = 0;
    1498            0 :             e.PlantLoopBranch = 0;
    1499            0 :             e.PlantLoopComp = 0;
    1500            0 :             e.FirstDemandSidePtr = 0;
    1501            0 :             e.LastDemandSidePtr = 0;
    1502              :         }
    1503              : 
    1504            0 :         state.dataSysRpts->OneTimeFlag_UpdateAirSysSubCompPtrArray = false;
    1505              :     }
    1506              : 
    1507            0 :     if (state.dataSysRpts->ArrayCounter_UpdateAirSysSubCompPtrArray >=
    1508            0 :         state.dataSysRpts->ArrayLimit_UpdateAirSysSubCompPtrArray) { // Redimension larger
    1509            0 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateAirSysSubCompPtrArray);
    1510            0 :         state.dataAirSystemsData->AirSysSubCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateAirSysSubCompPtrArray *= 2);
    1511            0 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateAirSysSubCompPtrArray; ++i) {
    1512            0 :             auto &actp = state.dataAirSystemsData->AirSysSubCompToPlant(i);
    1513            0 :             actp.AirLoopNum = 0;
    1514            0 :             actp.AirLoopBranch = 0;
    1515            0 :             actp.AirLoopComp = 0;
    1516            0 :             actp.AirLoopSubComp = 0;
    1517            0 :             actp.PlantLoopType = 0;
    1518            0 :             actp.PlantLoopNum = 0;
    1519            0 :             actp.PlantLoopBranch = 0;
    1520            0 :             actp.PlantLoopComp = 0;
    1521            0 :             actp.FirstDemandSidePtr = 0;
    1522            0 :             actp.LastDemandSidePtr = 0;
    1523              :         }
    1524              :     }
    1525              : 
    1526            0 :     Idx = state.dataSysRpts->ArrayCounter_UpdateAirSysSubCompPtrArray;
    1527            0 :     auto &actp = state.dataAirSystemsData->AirSysSubCompToPlant(Idx);
    1528            0 :     actp.AirLoopNum = AirLoopNum;
    1529            0 :     actp.AirLoopBranch = BranchNum;
    1530            0 :     actp.AirLoopComp = CompNum;
    1531            0 :     actp.AirLoopSubComp = SubCompNum;
    1532            0 :     actp.PlantLoopType = PlantLoopType;
    1533            0 :     actp.PlantLoopNum = PlantLoop;
    1534            0 :     actp.PlantLoopBranch = PlantBranch;
    1535            0 :     actp.PlantLoopComp = PlantComp;
    1536            0 :     ++state.dataSysRpts->ArrayCounter_UpdateAirSysSubCompPtrArray;
    1537            0 : }
    1538              : 
    1539            0 : void UpdateAirSysSubSubCompPtrArray(EnergyPlusData &state,
    1540              :                                     int &Idx,
    1541              :                                     int const AirLoopNum,
    1542              :                                     int const BranchNum,
    1543              :                                     int const CompNum,
    1544              :                                     int const SubCompNum,
    1545              :                                     int const SubSubCompNum,
    1546              :                                     int const PlantLoopType,
    1547              :                                     int const PlantLoop,
    1548              :                                     int const PlantBranch,
    1549              :                                     int const PlantComp)
    1550              : {
    1551              :     // SUBROUTINE INFORMATION:
    1552              :     //       AUTHOR         Dan Fisher
    1553              :     //       DATE WRITTEN   June 2005
    1554              :     //       MODIFIED       na
    1555              :     //       RE-ENGINEERED  na
    1556              : 
    1557              :     // PURPOSE OF THIS SUBROUTINE:
    1558              :     // Update Air System Sub Sub Component Pointer Array
    1559              : 
    1560            0 :     if (state.dataSysRpts->OneTimeFlag_UpdateAirSysSubSubCompPtrArray) {
    1561            0 :         state.dataAirSystemsData->AirSysSubSubCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateAirSysSubSubCompPtrArray);
    1562            0 :         for (auto &e : state.dataAirSystemsData->AirSysSubSubCompToPlant) {
    1563            0 :             e.AirLoopNum = 0;
    1564            0 :             e.AirLoopBranch = 0;
    1565            0 :             e.AirLoopComp = 0;
    1566            0 :             e.AirLoopSubComp = 0;
    1567            0 :             e.AirLoopSubSubComp = 0;
    1568            0 :             e.PlantLoopType = 0;
    1569            0 :             e.PlantLoopNum = 0;
    1570            0 :             e.PlantLoopBranch = 0;
    1571            0 :             e.PlantLoopComp = 0;
    1572            0 :             e.FirstDemandSidePtr = 0;
    1573            0 :             e.LastDemandSidePtr = 0;
    1574              :         }
    1575              : 
    1576            0 :         state.dataSysRpts->OneTimeFlag_UpdateAirSysSubSubCompPtrArray = false;
    1577              :     }
    1578              : 
    1579            0 :     if (state.dataSysRpts->ArrayCounter_UpdateAirSysSubSubCompPtrArray >=
    1580            0 :         state.dataSysRpts->ArrayLimit_UpdateAirSysSubSubCompPtrArray) { // Redimension larger
    1581            0 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateAirSysSubSubCompPtrArray);
    1582            0 :         state.dataAirSystemsData->AirSysSubSubCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateAirSysSubSubCompPtrArray *= 2);
    1583            0 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateAirSysSubSubCompPtrArray; ++i) {
    1584            0 :             auto &actp = state.dataAirSystemsData->AirSysSubSubCompToPlant(i);
    1585            0 :             actp.AirLoopNum = 0;
    1586            0 :             actp.AirLoopBranch = 0;
    1587            0 :             actp.AirLoopComp = 0;
    1588            0 :             actp.AirLoopSubComp = 0;
    1589            0 :             actp.AirLoopSubSubComp = 0;
    1590            0 :             actp.PlantLoopType = 0;
    1591            0 :             actp.PlantLoopNum = 0;
    1592            0 :             actp.PlantLoopBranch = 0;
    1593            0 :             actp.PlantLoopComp = 0;
    1594            0 :             actp.FirstDemandSidePtr = 0;
    1595            0 :             actp.LastDemandSidePtr = 0;
    1596              :         }
    1597              :     }
    1598              : 
    1599            0 :     Idx = state.dataSysRpts->ArrayCounter_UpdateAirSysSubSubCompPtrArray;
    1600            0 :     auto &actp = state.dataAirSystemsData->AirSysSubSubCompToPlant(Idx);
    1601            0 :     actp.AirLoopNum = AirLoopNum;
    1602            0 :     actp.AirLoopBranch = BranchNum;
    1603            0 :     actp.AirLoopComp = CompNum;
    1604            0 :     actp.AirLoopSubComp = SubCompNum;
    1605            0 :     actp.AirLoopSubSubComp = SubSubCompNum;
    1606            0 :     actp.PlantLoopType = PlantLoopType;
    1607            0 :     actp.PlantLoopNum = PlantLoop;
    1608            0 :     actp.PlantLoopBranch = PlantBranch;
    1609            0 :     actp.PlantLoopComp = PlantComp;
    1610            0 :     ++state.dataSysRpts->ArrayCounter_UpdateAirSysSubSubCompPtrArray;
    1611            0 : }
    1612              : 
    1613          800 : void AllocateAndSetUpVentReports(EnergyPlusData &state)
    1614              : {
    1615              : 
    1616              :     // SUBROUTINE INFORMATION:
    1617              :     //       AUTHOR         Sankaranarayanan K P
    1618              :     //       DATE WRITTEN   July 2005
    1619              :     //       MODIFIED       na
    1620              :     //       RE-ENGINEERED  na
    1621              : 
    1622          800 :     int NumPrimaryAirSys = state.dataHVACGlobal->NumPrimaryAirSys;
    1623              : 
    1624              :     // PURPOSE OF THIS SUBROUTINE:
    1625              :     // Allocates Arrays and setup output variables related to Ventilation reports.
    1626          800 :     state.dataSysRpts->ZoneVentRepVars.allocate(state.dataGlobal->NumOfZones);
    1627          800 :     state.dataSysRpts->SysLoadRepVars.allocate(NumPrimaryAirSys);
    1628          800 :     state.dataSysRpts->SysVentRepVars.allocate(NumPrimaryAirSys);
    1629          800 :     state.dataSysRpts->SysPreDefRep.allocate(NumPrimaryAirSys);
    1630              : 
    1631         2021 :     for (int sysIndex = 1; sysIndex <= NumPrimaryAirSys; ++sysIndex) {
    1632         1221 :         auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysIndex);
    1633         1221 :         thisSysVentRepVars.MechVentFlow = 0.0;
    1634         1221 :         thisSysVentRepVars.NatVentFlow = 0.0;
    1635         1221 :         thisSysVentRepVars.TargetVentilationFlowVoz = 0.0;
    1636         1221 :         thisSysVentRepVars.TimeBelowVozDyn = 0.0;
    1637         1221 :         thisSysVentRepVars.TimeAtVozDyn = 0.0;
    1638         1221 :         thisSysVentRepVars.TimeAboveVozDyn = 0.0;
    1639         1221 :         thisSysVentRepVars.TimeVentUnocc = 0.0;
    1640         1221 :         thisSysVentRepVars.AnyZoneOccupied = false;
    1641              :     }
    1642              : 
    1643          800 :     if (state.dataSysRpts->AirLoopLoadsReportEnabled) {
    1644         2021 :         for (int sysIndex = 1; sysIndex <= NumPrimaryAirSys; ++sysIndex) {
    1645         1221 :             auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(sysIndex);
    1646         1221 :             auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysIndex);
    1647         1221 :             std::string const primaryAirSysName = state.dataAirSystemsData->PrimaryAirSystems(sysIndex).Name;
    1648              : 
    1649              :             // CurrentModuleObject='AirloopHVAC'
    1650              :             // SYSTEM LOADS REPORT
    1651         2442 :             SetupOutputVariable(state,
    1652              :                                 "Air System Total Heating Energy",
    1653              :                                 Constant::Units::J,
    1654         1221 :                                 thisSysLoadRepVars.TotHTNG,
    1655              :                                 OutputProcessor::TimeStepType::System,
    1656              :                                 OutputProcessor::StoreType::Sum,
    1657              :                                 primaryAirSysName);
    1658              : 
    1659         2442 :             SetupOutputVariable(state,
    1660              :                                 "Air System Total Cooling Energy",
    1661              :                                 Constant::Units::J,
    1662         1221 :                                 thisSysLoadRepVars.TotCLNG,
    1663              :                                 OutputProcessor::TimeStepType::System,
    1664              :                                 OutputProcessor::StoreType::Sum,
    1665              :                                 primaryAirSysName);
    1666              : 
    1667              :             // SYSTEM ENERGY USE REPORT
    1668         2442 :             SetupOutputVariable(state,
    1669              :                                 "Air System Hot Water Energy",
    1670              :                                 Constant::Units::J,
    1671         1221 :                                 thisSysLoadRepVars.TotH2OHOT,
    1672              :                                 OutputProcessor::TimeStepType::System,
    1673              :                                 OutputProcessor::StoreType::Sum,
    1674              :                                 primaryAirSysName);
    1675              : 
    1676         2442 :             SetupOutputVariable(state,
    1677              :                                 "Air System Steam Energy",
    1678              :                                 Constant::Units::J,
    1679         1221 :                                 thisSysLoadRepVars.TotSteam,
    1680              :                                 OutputProcessor::TimeStepType::System,
    1681              :                                 OutputProcessor::StoreType::Sum,
    1682              :                                 primaryAirSysName);
    1683              : 
    1684         2442 :             SetupOutputVariable(state,
    1685              :                                 "Air System Chilled Water Energy",
    1686              :                                 Constant::Units::J,
    1687         1221 :                                 thisSysLoadRepVars.TotH2OCOLD,
    1688              :                                 OutputProcessor::TimeStepType::System,
    1689              :                                 OutputProcessor::StoreType::Sum,
    1690              :                                 primaryAirSysName);
    1691              : 
    1692         2442 :             SetupOutputVariable(state,
    1693              :                                 "Air System Electricity Energy",
    1694              :                                 Constant::Units::J,
    1695         1221 :                                 thisSysLoadRepVars.TotElec,
    1696              :                                 OutputProcessor::TimeStepType::System,
    1697              :                                 OutputProcessor::StoreType::Sum,
    1698              :                                 primaryAirSysName);
    1699              : 
    1700         2442 :             SetupOutputVariable(state,
    1701              :                                 "Air System NaturalGas Energy",
    1702              :                                 Constant::Units::J,
    1703         1221 :                                 thisSysLoadRepVars.TotNaturalGas,
    1704              :                                 OutputProcessor::TimeStepType::System,
    1705              :                                 OutputProcessor::StoreType::Sum,
    1706              :                                 primaryAirSysName);
    1707              : 
    1708         2442 :             SetupOutputVariable(state,
    1709              :                                 "Air System Propane Energy",
    1710              :                                 Constant::Units::J,
    1711         1221 :                                 thisSysLoadRepVars.TotPropane,
    1712              :                                 OutputProcessor::TimeStepType::System,
    1713              :                                 OutputProcessor::StoreType::Sum,
    1714              :                                 primaryAirSysName);
    1715              : 
    1716         2442 :             SetupOutputVariable(state,
    1717              :                                 "Air System Water Volume",
    1718              :                                 Constant::Units::m3,
    1719         1221 :                                 thisSysLoadRepVars.DomesticH2O,
    1720              :                                 OutputProcessor::TimeStepType::System,
    1721              :                                 OutputProcessor::StoreType::Sum,
    1722              :                                 primaryAirSysName);
    1723              : 
    1724              :             // SYSTEM COMPONENT LOAD REPORT
    1725         2442 :             SetupOutputVariable(state,
    1726              :                                 "Air System Fan Air Heating Energy",
    1727              :                                 Constant::Units::J,
    1728         1221 :                                 thisSysLoadRepVars.FANCompHTNG,
    1729              :                                 OutputProcessor::TimeStepType::System,
    1730              :                                 OutputProcessor::StoreType::Sum,
    1731              :                                 primaryAirSysName);
    1732              : 
    1733         2442 :             SetupOutputVariable(state,
    1734              :                                 "Air System Cooling Coil Total Cooling Energy",
    1735              :                                 Constant::Units::J,
    1736         1221 :                                 thisSysLoadRepVars.CCCompCLNG,
    1737              :                                 OutputProcessor::TimeStepType::System,
    1738              :                                 OutputProcessor::StoreType::Sum,
    1739              :                                 primaryAirSysName);
    1740              : 
    1741         2442 :             SetupOutputVariable(state,
    1742              :                                 "Air System Heating Coil Total Heating Energy",
    1743              :                                 Constant::Units::J,
    1744         1221 :                                 thisSysLoadRepVars.HCCompHTNG,
    1745              :                                 OutputProcessor::TimeStepType::System,
    1746              :                                 OutputProcessor::StoreType::Sum,
    1747              :                                 primaryAirSysName);
    1748              : 
    1749         2442 :             SetupOutputVariable(state,
    1750              :                                 "Air System Heat Exchanger Total Heating Energy",
    1751              :                                 Constant::Units::J,
    1752         1221 :                                 thisSysLoadRepVars.HeatExHTNG,
    1753              :                                 OutputProcessor::TimeStepType::System,
    1754              :                                 OutputProcessor::StoreType::Sum,
    1755              :                                 primaryAirSysName);
    1756              : 
    1757         2442 :             SetupOutputVariable(state,
    1758              :                                 "Air System Heat Exchanger Total Cooling Energy",
    1759              :                                 Constant::Units::J,
    1760         1221 :                                 thisSysLoadRepVars.HeatExCLNG,
    1761              :                                 OutputProcessor::TimeStepType::System,
    1762              :                                 OutputProcessor::StoreType::Sum,
    1763              :                                 primaryAirSysName);
    1764              : 
    1765         2442 :             SetupOutputVariable(state,
    1766              :                                 "Air System Solar Collector Total Heating Energy",
    1767              :                                 Constant::Units::J,
    1768         1221 :                                 thisSysLoadRepVars.SolarCollectHeating,
    1769              :                                 OutputProcessor::TimeStepType::System,
    1770              :                                 OutputProcessor::StoreType::Sum,
    1771              :                                 primaryAirSysName);
    1772              : 
    1773         2442 :             SetupOutputVariable(state,
    1774              :                                 "Air System Solar Collector Total Cooling Energy",
    1775              :                                 Constant::Units::J,
    1776         1221 :                                 thisSysLoadRepVars.SolarCollectCooling,
    1777              :                                 OutputProcessor::TimeStepType::System,
    1778              :                                 OutputProcessor::StoreType::Sum,
    1779              :                                 primaryAirSysName);
    1780              : 
    1781         2442 :             SetupOutputVariable(state,
    1782              :                                 "Air System User Defined Air Terminal Total Heating Energy",
    1783              :                                 Constant::Units::J,
    1784         1221 :                                 thisSysLoadRepVars.UserDefinedTerminalHeating,
    1785              :                                 OutputProcessor::TimeStepType::System,
    1786              :                                 OutputProcessor::StoreType::Sum,
    1787              :                                 primaryAirSysName);
    1788              : 
    1789         2442 :             SetupOutputVariable(state,
    1790              :                                 "Air System User Defined Air Terminal Total Cooling Energy",
    1791              :                                 Constant::Units::J,
    1792         1221 :                                 thisSysLoadRepVars.UserDefinedTerminalCooling,
    1793              :                                 OutputProcessor::TimeStepType::System,
    1794              :                                 OutputProcessor::StoreType::Sum,
    1795              :                                 primaryAirSysName);
    1796              : 
    1797         2442 :             SetupOutputVariable(state,
    1798              :                                 "Air System Humidifier Total Heating Energy",
    1799              :                                 Constant::Units::J,
    1800         1221 :                                 thisSysLoadRepVars.HumidHTNG,
    1801              :                                 OutputProcessor::TimeStepType::System,
    1802              :                                 OutputProcessor::StoreType::Sum,
    1803              :                                 primaryAirSysName);
    1804              : 
    1805         2442 :             SetupOutputVariable(state,
    1806              :                                 "Air System Evaporative Cooler Total Cooling Energy",
    1807              :                                 Constant::Units::J,
    1808         1221 :                                 thisSysLoadRepVars.EvapCLNG,
    1809              :                                 OutputProcessor::TimeStepType::System,
    1810              :                                 OutputProcessor::StoreType::Sum,
    1811              :                                 primaryAirSysName);
    1812              : 
    1813         2442 :             SetupOutputVariable(state,
    1814              :                                 "Air System Desiccant Dehumidifier Total Cooling Energy",
    1815              :                                 Constant::Units::J,
    1816         1221 :                                 thisSysLoadRepVars.DesDehumidCLNG,
    1817              :                                 OutputProcessor::TimeStepType::System,
    1818              :                                 OutputProcessor::StoreType::Sum,
    1819              :                                 primaryAirSysName);
    1820              : 
    1821              :             // SYSTEM COMPONENT ENERGY REPORT
    1822         2442 :             SetupOutputVariable(state,
    1823              :                                 "Air System Fan Electricity Energy",
    1824              :                                 Constant::Units::J,
    1825         1221 :                                 thisSysLoadRepVars.FANCompElec,
    1826              :                                 OutputProcessor::TimeStepType::System,
    1827              :                                 OutputProcessor::StoreType::Sum,
    1828              :                                 primaryAirSysName);
    1829              : 
    1830         2442 :             SetupOutputVariable(state,
    1831              :                                 "Air System Heating Coil Hot Water Energy",
    1832              :                                 Constant::Units::J,
    1833         1221 :                                 thisSysLoadRepVars.HCCompH2OHOT,
    1834              :                                 OutputProcessor::TimeStepType::System,
    1835              :                                 OutputProcessor::StoreType::Sum,
    1836              :                                 primaryAirSysName);
    1837              : 
    1838         2442 :             SetupOutputVariable(state,
    1839              :                                 "Air System Cooling Coil Chilled Water Energy",
    1840              :                                 Constant::Units::J,
    1841         1221 :                                 thisSysLoadRepVars.CCCompH2OCOLD,
    1842              :                                 OutputProcessor::TimeStepType::System,
    1843              :                                 OutputProcessor::StoreType::Sum,
    1844              :                                 primaryAirSysName);
    1845              : 
    1846         2442 :             SetupOutputVariable(state,
    1847              :                                 "Air System DX Heating Coil Electricity Energy",
    1848              :                                 Constant::Units::J,
    1849         1221 :                                 thisSysLoadRepVars.HCCompElec,
    1850              :                                 OutputProcessor::TimeStepType::System,
    1851              :                                 OutputProcessor::StoreType::Sum,
    1852              :                                 primaryAirSysName);
    1853              : 
    1854         2442 :             SetupOutputVariable(state,
    1855              :                                 "Air System DX Cooling Coil Electricity Energy",
    1856              :                                 Constant::Units::J,
    1857         1221 :                                 thisSysLoadRepVars.CCCompElec,
    1858              :                                 OutputProcessor::TimeStepType::System,
    1859              :                                 OutputProcessor::StoreType::Sum,
    1860              :                                 primaryAirSysName);
    1861              : 
    1862         2442 :             SetupOutputVariable(state,
    1863              :                                 "Air System Heating Coil Electricity Energy",
    1864              :                                 Constant::Units::J,
    1865         1221 :                                 thisSysLoadRepVars.HCCompElecRes,
    1866              :                                 OutputProcessor::TimeStepType::System,
    1867              :                                 OutputProcessor::StoreType::Sum,
    1868              :                                 primaryAirSysName);
    1869              : 
    1870         2442 :             SetupOutputVariable(state,
    1871              :                                 "Air System Heating Coil NaturalGas Energy",
    1872              :                                 Constant::Units::J,
    1873         1221 :                                 thisSysLoadRepVars.HCCompNaturalGas,
    1874              :                                 OutputProcessor::TimeStepType::System,
    1875              :                                 OutputProcessor::StoreType::Sum,
    1876              :                                 primaryAirSysName);
    1877              : 
    1878         2442 :             SetupOutputVariable(state,
    1879              :                                 "Air System Heating Coil Propane Energy",
    1880              :                                 Constant::Units::J,
    1881         1221 :                                 thisSysLoadRepVars.HCCompPropane,
    1882              :                                 OutputProcessor::TimeStepType::System,
    1883              :                                 OutputProcessor::StoreType::Sum,
    1884              :                                 primaryAirSysName);
    1885              : 
    1886         2442 :             SetupOutputVariable(state,
    1887              :                                 "Air System Heating Coil Steam Energy",
    1888              :                                 Constant::Units::J,
    1889         1221 :                                 thisSysLoadRepVars.HCCompSteam,
    1890              :                                 OutputProcessor::TimeStepType::System,
    1891              :                                 OutputProcessor::StoreType::Sum,
    1892              :                                 primaryAirSysName);
    1893              : 
    1894         2442 :             SetupOutputVariable(state,
    1895              :                                 "Air System Humidifier Electricity Energy",
    1896              :                                 Constant::Units::J,
    1897         1221 :                                 thisSysLoadRepVars.HumidElec,
    1898              :                                 OutputProcessor::TimeStepType::System,
    1899              :                                 OutputProcessor::StoreType::Sum,
    1900              :                                 primaryAirSysName);
    1901              : 
    1902         2442 :             SetupOutputVariable(state,
    1903              :                                 "Air System Humidifier NaturalGas Energy",
    1904              :                                 Constant::Units::J,
    1905         1221 :                                 thisSysLoadRepVars.HumidNaturalGas,
    1906              :                                 OutputProcessor::TimeStepType::System,
    1907              :                                 OutputProcessor::StoreType::Sum,
    1908              :                                 primaryAirSysName);
    1909              : 
    1910         2442 :             SetupOutputVariable(state,
    1911              :                                 "Air System Humidifier Propane Energy",
    1912              :                                 Constant::Units::J,
    1913         1221 :                                 thisSysLoadRepVars.HumidPropane,
    1914              :                                 OutputProcessor::TimeStepType::System,
    1915              :                                 OutputProcessor::StoreType::Sum,
    1916              :                                 primaryAirSysName);
    1917              : 
    1918         2442 :             SetupOutputVariable(state,
    1919              :                                 "Air System Evaporative Cooler Electricity Energy",
    1920              :                                 Constant::Units::J,
    1921         1221 :                                 thisSysLoadRepVars.EvapElec,
    1922              :                                 OutputProcessor::TimeStepType::System,
    1923              :                                 OutputProcessor::StoreType::Sum,
    1924              :                                 primaryAirSysName);
    1925              : 
    1926         2442 :             SetupOutputVariable(state,
    1927              :                                 "Air System Desiccant Dehumidifier Electricity Energy",
    1928              :                                 Constant::Units::J,
    1929         1221 :                                 thisSysLoadRepVars.DesDehumidElec,
    1930              :                                 OutputProcessor::TimeStepType::System,
    1931              :                                 OutputProcessor::StoreType::Sum,
    1932              :                                 primaryAirSysName);
    1933              : 
    1934         2442 :             SetupOutputVariable(state,
    1935              :                                 "Air System Mechanical Ventilation Flow Rate",
    1936              :                                 Constant::Units::m3_s,
    1937         1221 :                                 thisSysVentRepVars.MechVentFlow,
    1938              :                                 OutputProcessor::TimeStepType::System,
    1939              :                                 OutputProcessor::StoreType::Average,
    1940              :                                 primaryAirSysName);
    1941              : 
    1942         2442 :             SetupOutputVariable(state,
    1943              :                                 "Air System Natural Ventilation Flow Rate",
    1944              :                                 Constant::Units::m3_s,
    1945         1221 :                                 thisSysVentRepVars.NatVentFlow,
    1946              :                                 OutputProcessor::TimeStepType::System,
    1947              :                                 OutputProcessor::StoreType::Average,
    1948              :                                 primaryAirSysName);
    1949              : 
    1950         2442 :             SetupOutputVariable(state,
    1951              :                                 "Air System Target Voz Ventilation Flow Rate",
    1952              :                                 Constant::Units::m3_s,
    1953         1221 :                                 thisSysVentRepVars.TargetVentilationFlowVoz,
    1954              :                                 OutputProcessor::TimeStepType::System,
    1955              :                                 OutputProcessor::StoreType::Average,
    1956              :                                 primaryAirSysName);
    1957              : 
    1958         2442 :             SetupOutputVariable(state,
    1959              :                                 "Air System Ventilation Below Target Voz Time",
    1960              :                                 Constant::Units::hr,
    1961         1221 :                                 thisSysVentRepVars.TimeBelowVozDyn,
    1962              :                                 OutputProcessor::TimeStepType::System,
    1963              :                                 OutputProcessor::StoreType::Sum,
    1964              :                                 primaryAirSysName);
    1965              : 
    1966         2442 :             SetupOutputVariable(state,
    1967              :                                 "Air System Ventilation At Target Voz Time",
    1968              :                                 Constant::Units::hr,
    1969         1221 :                                 thisSysVentRepVars.TimeAtVozDyn,
    1970              :                                 OutputProcessor::TimeStepType::System,
    1971              :                                 OutputProcessor::StoreType::Sum,
    1972              :                                 primaryAirSysName);
    1973              : 
    1974         2442 :             SetupOutputVariable(state,
    1975              :                                 "Air System Ventilation Above Target Voz Time",
    1976              :                                 Constant::Units::hr,
    1977         1221 :                                 thisSysVentRepVars.TimeAboveVozDyn,
    1978              :                                 OutputProcessor::TimeStepType::System,
    1979              :                                 OutputProcessor::StoreType::Sum,
    1980              :                                 primaryAirSysName);
    1981              : 
    1982         2442 :             SetupOutputVariable(state,
    1983              :                                 "Air System Ventilation When Unoccupied Time",
    1984              :                                 Constant::Units::hr,
    1985         1221 :                                 thisSysVentRepVars.TimeVentUnocc,
    1986              :                                 OutputProcessor::TimeStepType::System,
    1987              :                                 OutputProcessor::StoreType::Sum,
    1988              :                                 primaryAirSysName);
    1989         1221 :         }
    1990              :     }
    1991         5995 :     for (int ZoneIndex = 1; ZoneIndex <= state.dataGlobal->NumOfZones; ++ZoneIndex) {
    1992         5195 :         if (!state.dataZoneEquip->ZoneEquipConfig(ZoneIndex).IsControlled) {
    1993          739 :             continue;
    1994              :         }
    1995         4456 :         auto &thisZoneVentRepVars = state.dataSysRpts->ZoneVentRepVars(ZoneIndex);
    1996         4456 :         auto &thisZoneName = state.dataZoneEquip->ZoneEquipConfig(ZoneIndex).ZoneName;
    1997              :         // CurrentModuleObject='Zones(Controlled)'
    1998         4456 :         if (state.dataSysRpts->VentLoadsReportEnabled) {
    1999              :             // Cooling Loads
    2000         8912 :             SetupOutputVariable(state,
    2001              :                                 "Zone Mechanical Ventilation No Load Heat Removal Energy",
    2002              :                                 Constant::Units::J,
    2003         4456 :                                 thisZoneVentRepVars.NoLoadCoolingByVent,
    2004              :                                 OutputProcessor::TimeStepType::System,
    2005              :                                 OutputProcessor::StoreType::Sum,
    2006              :                                 thisZoneName);
    2007              : 
    2008         8912 :             SetupOutputVariable(state,
    2009              :                                 "Zone Mechanical Ventilation Cooling Load Increase Energy",
    2010              :                                 Constant::Units::J,
    2011         4456 :                                 thisZoneVentRepVars.CoolingLoadAddedByVent,
    2012              :                                 OutputProcessor::TimeStepType::System,
    2013              :                                 OutputProcessor::StoreType::Sum,
    2014              :                                 thisZoneName);
    2015              : 
    2016         8912 :             SetupOutputVariable(state,
    2017              :                                 "Zone Mechanical Ventilation Cooling Load Increase Due to Overheating Energy",
    2018              :                                 Constant::Units::J,
    2019         4456 :                                 thisZoneVentRepVars.OverheatingByVent,
    2020              :                                 OutputProcessor::TimeStepType::System,
    2021              :                                 OutputProcessor::StoreType::Sum,
    2022              :                                 thisZoneName);
    2023              : 
    2024         8912 :             SetupOutputVariable(state,
    2025              :                                 "Zone Mechanical Ventilation Cooling Load Decrease Energy",
    2026              :                                 Constant::Units::J,
    2027         4456 :                                 thisZoneVentRepVars.CoolingLoadMetByVent,
    2028              :                                 OutputProcessor::TimeStepType::System,
    2029              :                                 OutputProcessor::StoreType::Sum,
    2030              :                                 thisZoneName);
    2031              :             // Heating Loads
    2032         8912 :             SetupOutputVariable(state,
    2033              :                                 "Zone Mechanical Ventilation No Load Heat Addition Energy",
    2034              :                                 Constant::Units::J,
    2035         4456 :                                 thisZoneVentRepVars.NoLoadHeatingByVent,
    2036              :                                 OutputProcessor::TimeStepType::System,
    2037              :                                 OutputProcessor::StoreType::Sum,
    2038              :                                 thisZoneName);
    2039              : 
    2040         8912 :             SetupOutputVariable(state,
    2041              :                                 "Zone Mechanical Ventilation Heating Load Increase Energy",
    2042              :                                 Constant::Units::J,
    2043         4456 :                                 thisZoneVentRepVars.HeatingLoadAddedByVent,
    2044              :                                 OutputProcessor::TimeStepType::System,
    2045              :                                 OutputProcessor::StoreType::Sum,
    2046              :                                 thisZoneName);
    2047              : 
    2048         8912 :             SetupOutputVariable(state,
    2049              :                                 "Zone Mechanical Ventilation Heating Load Increase Due to Overcooling Energy",
    2050              :                                 Constant::Units::J,
    2051         4456 :                                 thisZoneVentRepVars.OvercoolingByVent,
    2052              :                                 OutputProcessor::TimeStepType::System,
    2053              :                                 OutputProcessor::StoreType::Sum,
    2054              :                                 thisZoneName);
    2055              : 
    2056         8912 :             SetupOutputVariable(state,
    2057              :                                 "Zone Mechanical Ventilation Heating Load Decrease Energy",
    2058              :                                 Constant::Units::J,
    2059         4456 :                                 thisZoneVentRepVars.HeatingLoadMetByVent,
    2060              :                                 OutputProcessor::TimeStepType::System,
    2061              :                                 OutputProcessor::StoreType::Sum,
    2062              :                                 thisZoneName);
    2063              :         }
    2064              : 
    2065         8912 :         SetupOutputVariable(state,
    2066              :                             "Zone Mechanical Ventilation Mass Flow Rate",
    2067              :                             Constant::Units::kg_s,
    2068         4456 :                             thisZoneVentRepVars.OAMassFlow,
    2069              :                             OutputProcessor::TimeStepType::System,
    2070              :                             OutputProcessor::StoreType::Average,
    2071              :                             thisZoneName);
    2072              : 
    2073         8912 :         SetupOutputVariable(state,
    2074              :                             "Zone Mechanical Ventilation Mass",
    2075              :                             Constant::Units::kg,
    2076         4456 :                             thisZoneVentRepVars.OAMass,
    2077              :                             OutputProcessor::TimeStepType::System,
    2078              :                             OutputProcessor::StoreType::Sum,
    2079              :                             thisZoneName);
    2080              : 
    2081         8912 :         SetupOutputVariable(state,
    2082              :                             "Zone Mechanical Ventilation Standard Density Volume Flow Rate",
    2083              :                             Constant::Units::m3_s,
    2084         4456 :                             thisZoneVentRepVars.OAVolFlowStdRho,
    2085              :                             OutputProcessor::TimeStepType::System,
    2086              :                             OutputProcessor::StoreType::Average,
    2087              :                             thisZoneName);
    2088              : 
    2089         8912 :         SetupOutputVariable(state,
    2090              :                             "Zone Mechanical Ventilation Standard Density Volume",
    2091              :                             Constant::Units::m3,
    2092         4456 :                             thisZoneVentRepVars.OAVolStdRho,
    2093              :                             OutputProcessor::TimeStepType::System,
    2094              :                             OutputProcessor::StoreType::Sum,
    2095              :                             thisZoneName);
    2096              : 
    2097         8912 :         SetupOutputVariable(state,
    2098              :                             "Zone Mechanical Ventilation Current Density Volume Flow Rate",
    2099              :                             Constant::Units::m3_s,
    2100         4456 :                             thisZoneVentRepVars.OAVolFlowCrntRho,
    2101              :                             OutputProcessor::TimeStepType::System,
    2102              :                             OutputProcessor::StoreType::Average,
    2103              :                             thisZoneName);
    2104              : 
    2105         8912 :         SetupOutputVariable(state,
    2106              :                             "Zone Mechanical Ventilation Current Density Volume",
    2107              :                             Constant::Units::m3,
    2108         4456 :                             thisZoneVentRepVars.OAVolCrntRho,
    2109              :                             OutputProcessor::TimeStepType::System,
    2110              :                             OutputProcessor::StoreType::Sum,
    2111              :                             thisZoneName);
    2112              : 
    2113         8912 :         SetupOutputVariable(state,
    2114              :                             "Zone Mechanical Ventilation Air Changes per Hour",
    2115              :                             Constant::Units::ach,
    2116         4456 :                             thisZoneVentRepVars.MechACH,
    2117              :                             OutputProcessor::TimeStepType::System,
    2118              :                             OutputProcessor::StoreType::Average,
    2119              :                             thisZoneName);
    2120              : 
    2121         8912 :         SetupOutputVariable(state,
    2122              :                             "Zone Target Voz Ventilation Flow Rate",
    2123              :                             Constant::Units::m3_s,
    2124         4456 :                             thisZoneVentRepVars.TargetVentilationFlowVoz,
    2125              :                             OutputProcessor::TimeStepType::System,
    2126              :                             OutputProcessor::StoreType::Average,
    2127              :                             thisZoneName);
    2128              : 
    2129         8912 :         SetupOutputVariable(state,
    2130              :                             "Zone Ventilation Below Target Voz Time",
    2131              :                             Constant::Units::hr,
    2132         4456 :                             thisZoneVentRepVars.TimeBelowVozDyn,
    2133              :                             OutputProcessor::TimeStepType::System,
    2134              :                             OutputProcessor::StoreType::Sum,
    2135              :                             thisZoneName);
    2136              : 
    2137         8912 :         SetupOutputVariable(state,
    2138              :                             "Zone Ventilation At Target Voz Time",
    2139              :                             Constant::Units::hr,
    2140         4456 :                             thisZoneVentRepVars.TimeAtVozDyn,
    2141              :                             OutputProcessor::TimeStepType::System,
    2142              :                             OutputProcessor::StoreType::Sum,
    2143              :                             thisZoneName);
    2144              : 
    2145         8912 :         SetupOutputVariable(state,
    2146              :                             "Zone Ventilation Above Target Voz Time",
    2147              :                             Constant::Units::hr,
    2148         4456 :                             thisZoneVentRepVars.TimeAboveVozDyn,
    2149              :                             OutputProcessor::TimeStepType::System,
    2150              :                             OutputProcessor::StoreType::Sum,
    2151              :                             thisZoneName);
    2152              : 
    2153         8912 :         SetupOutputVariable(state,
    2154              :                             "Zone Ventilation When Unoccupied Time",
    2155              :                             Constant::Units::hr,
    2156         4456 :                             thisZoneVentRepVars.TimeVentUnocc,
    2157              :                             OutputProcessor::TimeStepType::System,
    2158              :                             OutputProcessor::StoreType::Sum,
    2159              :                             thisZoneName);
    2160              :     }
    2161              : 
    2162              :     // Facility outputs
    2163         3200 :     SetupOutputVariable(state,
    2164              :                         "Facility Any Zone Ventilation Below Target Voz Time",
    2165              :                         Constant::Units::hr,
    2166          800 :                         state.dataSysRpts->AnyZoneTimeBelowVozDyn,
    2167              :                         OutputProcessor::TimeStepType::System,
    2168              :                         OutputProcessor::StoreType::Sum,
    2169              :                         "Facility");
    2170              : 
    2171         3200 :     SetupOutputVariable(state,
    2172              :                         "Facility All Zones Ventilation At Target Voz Time",
    2173              :                         Constant::Units::hr,
    2174          800 :                         state.dataSysRpts->AllZonesTimeAtVozDyn,
    2175              :                         OutputProcessor::TimeStepType::System,
    2176              :                         OutputProcessor::StoreType::Sum,
    2177              :                         "Facility");
    2178              : 
    2179         3200 :     SetupOutputVariable(state,
    2180              :                         "Facility Any Zone Ventilation Above Target Voz Time",
    2181              :                         Constant::Units::hr,
    2182          800 :                         state.dataSysRpts->AnyZoneTimeAboveVozDyn,
    2183              :                         OutputProcessor::TimeStepType::System,
    2184              :                         OutputProcessor::StoreType::Sum,
    2185              :                         "Facility");
    2186              : 
    2187         3200 :     SetupOutputVariable(state,
    2188              :                         "Facility Any Zone Ventilation When Unoccupied Time",
    2189              :                         Constant::Units::hr,
    2190          800 :                         state.dataSysRpts->AnyZoneTimeVentUnocc,
    2191              :                         OutputProcessor::TimeStepType::System,
    2192              :                         OutputProcessor::StoreType::Sum,
    2193              :                         "Facility");
    2194          800 : }
    2195              : 
    2196          800 : void CreateEnergyReportStructure(EnergyPlusData &state)
    2197              : {
    2198              : 
    2199              :     // SUBROUTINE INFORMATION:
    2200              :     //       AUTHOR         Dan Fisher/Linda Lawrie
    2201              :     //       DATE WRITTEN   June 2005
    2202              : 
    2203              :     // PURPOSE OF THIS SUBROUTINE:
    2204              :     // Creates the Energy Reporting Structure.  This routine is only called once --
    2205              :     // so string compares have been left in.
    2206              : 
    2207              :     // METHODOLOGY EMPLOYED:
    2208              :     // Once all compsets/nodes/connections have been established find all components
    2209              :     // subcomponents, etc.
    2210              : 
    2211              :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2212              :     int AirLoopNum;
    2213              :     int BranchNum;
    2214              :     int CompNum;
    2215              :     int SubCompNum;
    2216              :     int SubSubCompNum;
    2217              :     int VarNum;
    2218              :     int VarNum1;
    2219              :     int CtrlZoneNum;
    2220              :     bool ErrorsFound;
    2221              :     bool ModeFlagOn;
    2222              :     int NumInlets;
    2223              :     int NumOutlets;
    2224              :     int PlantLoopNum;
    2225              : 
    2226              :     // Dimension GetChildrenData arrays
    2227          800 :     EPVector<DataLoopNode::ConnectionObjectType> SubCompTypes;
    2228          800 :     Array1D_string SubCompNames;
    2229          800 :     Array1D_string InletNodeNames;
    2230          800 :     Array1D_int InletNodeNumbers;
    2231          800 :     Array1D<NodeInputManager::CompFluidStream> InletFluidStreams;
    2232          800 :     Array1D_string OutletNodeNames;
    2233          800 :     Array1D_int OutletNodeNumbers;
    2234          800 :     Array1D<NodeInputManager::CompFluidStream> OutletFluidStreams;
    2235              :     int NumChildren;
    2236              :     int NumGrandChildren;
    2237              :     bool IsParent;
    2238              : 
    2239              :     // Dimension GetMeteredVariables arrays
    2240          800 :     Array1D<OutputProcessor::MeteredVar> meteredVars;
    2241              :     int NumVariables;
    2242              :     int NumLeft; // Counter for deeper components
    2243              : 
    2244              :     // some variables for setting up the plant data structures
    2245              : 
    2246          800 :     state.dataSysRpts->VentReportStructureCreated = true;
    2247         2021 :     for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
    2248         2461 :         for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
    2249         5045 :             for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2250              :                 DataLoopNode::ConnectionObjectType TypeOfComp = static_cast<DataLoopNode::ConnectionObjectType>(
    2251         3805 :                     EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC,
    2252         3805 :                                              state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf));
    2253         3805 :                 std::string &NameOfComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name;
    2254              :                 // Get complete list of components for complex branches
    2255         3805 :                 if (BranchNodeConnections::IsParentObject(state, TypeOfComp, NameOfComp)) {
    2256              : 
    2257         1853 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Parent = true;
    2258         1853 :                     NumChildren = BranchNodeConnections::GetNumChildren(state, TypeOfComp, NameOfComp);
    2259              : 
    2260         1853 :                     SubCompTypes.allocate(NumChildren);
    2261         1853 :                     SubCompNames.allocate(NumChildren);
    2262         1853 :                     InletNodeNames.allocate(NumChildren);
    2263         1853 :                     InletNodeNumbers.allocate(NumChildren);
    2264         1853 :                     OutletNodeNames.allocate(NumChildren);
    2265         1853 :                     OutletNodeNumbers.allocate(NumChildren);
    2266         1853 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp.allocate(NumChildren);
    2267              : 
    2268         1853 :                     BranchNodeConnections::GetChildrenData(state,
    2269              :                                                            TypeOfComp,
    2270              :                                                            NameOfComp,
    2271              :                                                            NumChildren,
    2272              :                                                            SubCompTypes,
    2273              :                                                            SubCompNames,
    2274              :                                                            InletNodeNames,
    2275              :                                                            InletNodeNumbers,
    2276              :                                                            OutletNodeNames,
    2277              :                                                            OutletNodeNumbers,
    2278              :                                                            ErrorsFound);
    2279              : 
    2280         5072 :                     for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2281              :                         {
    2282              :                             auto &thisSubComponent =
    2283         3219 :                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum);
    2284         3219 :                             thisSubComponent.TypeOf = BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubCompNum))];
    2285         3219 :                             thisSubComponent.Name = SubCompNames(SubCompNum);
    2286         3219 :                             thisSubComponent.NodeNameIn = InletNodeNames(SubCompNum);
    2287         3219 :                             thisSubComponent.NodeNameOut = OutletNodeNames(SubCompNum);
    2288         3219 :                             thisSubComponent.NodeNumIn = InletNodeNumbers(SubCompNum);
    2289         3219 :                             thisSubComponent.NodeNumOut = OutletNodeNumbers(SubCompNum);
    2290              :                         }
    2291              :                     }
    2292              : 
    2293         1853 :                     SubCompTypes.deallocate();
    2294         1853 :                     SubCompNames.deallocate();
    2295         1853 :                     InletNodeNames.deallocate();
    2296         1853 :                     InletNodeNumbers.deallocate();
    2297         1853 :                     OutletNodeNames.deallocate();
    2298         1853 :                     OutletNodeNumbers.deallocate();
    2299              : 
    2300              :                 } else {
    2301         1952 :                     NumChildren = 0;
    2302         1952 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Parent = false;
    2303              :                 }
    2304         3805 :                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NumSubComps = NumChildren;
    2305              : 
    2306              :                 // check for 'grandchildren'
    2307         7024 :                 for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2308         3219 :                     DataLoopNode::ConnectionObjectType TypeOfSubComp = static_cast<DataLoopNode::ConnectionObjectType>(EnergyPlus::getEnumValue(
    2309              :                         BranchNodeConnections::ConnectionObjectTypeNamesUC,
    2310         3219 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).TypeOf));
    2311              :                     std::string &NameOfSubComp =
    2312         3219 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).Name;
    2313         3219 :                     if (BranchNodeConnections::IsParentObject(state, TypeOfSubComp, NameOfSubComp)) {
    2314           15 :                         NumGrandChildren = BranchNodeConnections::GetNumChildren(state, TypeOfSubComp, NameOfSubComp);
    2315           15 :                         SubCompTypes.allocate(NumGrandChildren);
    2316           15 :                         SubCompNames.allocate(NumGrandChildren);
    2317           15 :                         InletNodeNames.allocate(NumGrandChildren);
    2318           15 :                         InletNodeNumbers.allocate(NumGrandChildren);
    2319           15 :                         OutletNodeNames.allocate(NumGrandChildren);
    2320           15 :                         OutletNodeNumbers.allocate(NumGrandChildren);
    2321           15 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)
    2322           15 :                             .Branch(BranchNum)
    2323           15 :                             .Comp(CompNum)
    2324           15 :                             .SubComp(SubCompNum)
    2325           15 :                             .SubSubComp.allocate(NumGrandChildren);
    2326              : 
    2327           15 :                         BranchNodeConnections::GetChildrenData(state,
    2328              :                                                                TypeOfSubComp,
    2329              :                                                                NameOfSubComp,
    2330              :                                                                NumGrandChildren,
    2331              :                                                                SubCompTypes,
    2332              :                                                                SubCompNames,
    2333              :                                                                InletNodeNames,
    2334              :                                                                InletNodeNumbers,
    2335              :                                                                OutletNodeNames,
    2336              :                                                                OutletNodeNumbers,
    2337              :                                                                ErrorsFound);
    2338              : 
    2339           51 :                         for (SubSubCompNum = 1; SubSubCompNum <= NumGrandChildren; ++SubSubCompNum) {
    2340              :                             {
    2341           36 :                                 auto &thisSubSubComponent = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)
    2342           36 :                                                                 .Branch(BranchNum)
    2343           36 :                                                                 .Comp(CompNum)
    2344           36 :                                                                 .SubComp(SubCompNum)
    2345           36 :                                                                 .SubSubComp(SubSubCompNum);
    2346           72 :                                 thisSubSubComponent.TypeOf = static_cast<std::string>(
    2347           72 :                                     BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubSubCompNum))]);
    2348           36 :                                 thisSubSubComponent.Name = SubCompNames(SubSubCompNum);
    2349           36 :                                 thisSubSubComponent.NodeNameIn = InletNodeNames(SubSubCompNum);
    2350           36 :                                 thisSubSubComponent.NodeNameOut = OutletNodeNames(SubSubCompNum);
    2351           36 :                                 thisSubSubComponent.NodeNumIn = InletNodeNumbers(SubSubCompNum);
    2352           36 :                                 thisSubSubComponent.NodeNumOut = OutletNodeNumbers(SubSubCompNum);
    2353           36 :                                 NumLeft = BranchNodeConnections::GetNumChildren(state, SubCompTypes(SubSubCompNum), SubCompNames(SubSubCompNum));
    2354           36 :                                 if (NumLeft > 0) {
    2355            0 :                                     ShowSevereError(
    2356              :                                         state,
    2357            0 :                                         format("Hanging Children for component={}:{}", thisSubSubComponent.TypeOf, SubCompNames(SubSubCompNum)));
    2358              :                                 }
    2359              :                             }
    2360              :                         }
    2361              : 
    2362           15 :                         SubCompTypes.deallocate();
    2363           15 :                         SubCompNames.deallocate();
    2364           15 :                         InletNodeNames.deallocate();
    2365           15 :                         InletNodeNumbers.deallocate();
    2366           15 :                         OutletNodeNames.deallocate();
    2367           15 :                         OutletNodeNumbers.deallocate();
    2368              :                     } else {
    2369         3204 :                         NumGrandChildren = 0;
    2370         3204 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).Parent = false;
    2371              :                     }
    2372              : 
    2373         3219 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).NumSubSubComps =
    2374              :                         NumGrandChildren;
    2375              :                 }
    2376              :             }
    2377              :         }
    2378              :     }
    2379              : 
    2380         2021 :     for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
    2381         2461 :         for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
    2382         5045 :             for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2383              :                 // Get complete list of components for complex branches
    2384              :                 {
    2385         3805 :                     auto &thisComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum);
    2386         3805 :                     std::string &TypeOfComp = thisComp.TypeOf;
    2387         3805 :                     std::string &NameOfComp = thisComp.Name;
    2388         3805 :                     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    2389         3805 :                     if (NumVariables > 0) {
    2390         2070 :                         meteredVars.allocate(NumVariables);
    2391         2070 :                         thisComp.MeteredVar.allocate(NumVariables);
    2392              : 
    2393         2070 :                         thisComp.NumMeteredVars = NumVariables;
    2394         2070 :                         GetMeteredVariables(state, NameOfComp, meteredVars);
    2395         2070 :                         ModeFlagOn = true;
    2396         6034 :                         for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2397              :                             {
    2398         3964 :                                 thisComp.MeteredVar(VarNum) = meteredVars(VarNum); // Copy
    2399         3964 :                                 auto &thisVar = thisComp.MeteredVar(VarNum);
    2400         3964 :                                 if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2401         2546 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2402         1861 :                                         thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2403              :                                     }
    2404          685 :                                     ModeFlagOn = false;
    2405         3279 :                                 } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2406         1311 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2407          874 :                                         thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2408              :                                     }
    2409          437 :                                     ModeFlagOn = false;
    2410         2842 :                                 } else if (ModeFlagOn) {
    2411         1229 :                                     thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2412              :                                 }
    2413              :                             }
    2414              :                         }
    2415              : 
    2416         2070 :                         meteredVars.deallocate();
    2417              :                     }
    2418         7024 :                     for (SubCompNum = 1; SubCompNum <= thisComp.NumSubComps; ++SubCompNum) {
    2419              :                         // Get complete list of components for complex branches
    2420         3219 :                         std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf;
    2421         3219 :                         std::string &NameOfSubComp = thisComp.SubComp(SubCompNum).Name;
    2422         3219 :                         NumVariables = GetNumMeteredVariables(state, TypeOfSubComp, NameOfSubComp);
    2423         3219 :                         if (NumVariables > 0) {
    2424         2134 :                             meteredVars.allocate(NumVariables);
    2425         2134 :                             thisComp.SubComp(SubCompNum).MeteredVar.allocate(NumVariables);
    2426              : 
    2427         2134 :                             GetMeteredVariables(state, NameOfSubComp, meteredVars);
    2428         2134 :                             ModeFlagOn = true;
    2429         7648 :                             for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2430              :                                 {
    2431         5514 :                                     thisComp.SubComp(SubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2432         5514 :                                     auto &thisVar = thisComp.SubComp(SubCompNum).MeteredVar(VarNum);
    2433         5514 :                                     if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2434         3334 :                                         for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2435         2567 :                                             thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2436              :                                         }
    2437          767 :                                         ModeFlagOn = false;
    2438         4747 :                                     } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2439         3067 :                                         for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2440         2267 :                                             thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2441              :                                         }
    2442          800 :                                         ModeFlagOn = false;
    2443         3947 :                                     } else if (ModeFlagOn) {
    2444          988 :                                         thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2445              :                                     }
    2446              :                                 }
    2447              :                             }
    2448              : 
    2449         2134 :                             meteredVars.deallocate();
    2450              :                         }
    2451              : 
    2452         3219 :                         thisComp.SubComp(SubCompNum).NumMeteredVars = NumVariables;
    2453              : 
    2454         3255 :                         for (SubSubCompNum = 1; SubSubCompNum <= thisComp.SubComp(SubCompNum).NumSubSubComps; ++SubSubCompNum) {
    2455              :                             // Get complete list of components for complex branches
    2456           36 :                             std::string &TypeOfSubSubComp = thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).TypeOf;
    2457           36 :                             std::string &NameOfSubSubComp = thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).Name;
    2458           36 :                             NumVariables = GetNumMeteredVariables(state, TypeOfSubSubComp, NameOfSubSubComp);
    2459           36 :                             if (NumVariables > 0) {
    2460           36 :                                 meteredVars.allocate(NumVariables);
    2461           36 :                                 thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).MeteredVar.allocate(NumVariables);
    2462              : 
    2463           36 :                                 GetMeteredVariables(state, NameOfSubSubComp, meteredVars);
    2464           36 :                                 ModeFlagOn = true;
    2465          138 :                                 for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2466              :                                     {
    2467          102 :                                         thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2468          102 :                                         auto &thisVar = thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).MeteredVar(VarNum);
    2469          102 :                                         if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2470           43 :                                             for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2471           34 :                                                 thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).MeteredVar(VarNum1).heatOrCool =
    2472              :                                                     Constant::HeatOrCool::HeatingOnly;
    2473              :                                             }
    2474            9 :                                             ModeFlagOn = false;
    2475           93 :                                         } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2476           37 :                                             for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2477           27 :                                                 thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).MeteredVar(VarNum1).heatOrCool =
    2478              :                                                     Constant::HeatOrCool::CoolingOnly;
    2479              :                                             }
    2480           10 :                                             ModeFlagOn = false;
    2481           83 :                                         } else if (ModeFlagOn) {
    2482           47 :                                             thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2483              :                                         }
    2484              :                                     }
    2485              :                                 }
    2486              : 
    2487           36 :                                 meteredVars.deallocate();
    2488              :                             }
    2489           36 :                             thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum).NumMeteredVars = NumVariables;
    2490              :                         }
    2491              :                     }
    2492              :                 }
    2493              :             }
    2494              :         }
    2495              :     }
    2496              : 
    2497              :     // Allocate the system serving zone equipment component arrays
    2498         5995 :     for (CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    2499         5195 :         if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) {
    2500          739 :             continue;
    2501              :         }
    2502              :         // Set index of air loop serving zone
    2503         9642 :         for (CompNum = 1; CompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).NumOfEquipTypes; ++CompNum) {
    2504         5186 :             std::string &TypeOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipTypeName(CompNum);
    2505         5186 :             std::string &NameOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipName(CompNum);
    2506              :             DataLoopNode::ConnectionObjectType TypeOfCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2507         5186 :                 EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp));
    2508         5186 :             BranchNodeConnections::GetComponentData(state,
    2509              :                                                     TypeOfCompNum,
    2510              :                                                     NameOfComp,
    2511              :                                                     IsParent,
    2512              :                                                     NumInlets,
    2513              :                                                     InletNodeNames,
    2514              :                                                     InletNodeNumbers,
    2515              :                                                     InletFluidStreams,
    2516              :                                                     NumOutlets,
    2517              :                                                     OutletNodeNames,
    2518              :                                                     OutletNodeNumbers,
    2519              :                                                     OutletFluidStreams);
    2520              :             {
    2521         5186 :                 auto &thisEquipData = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipData(CompNum);
    2522         5186 :                 thisEquipData.TypeOf = TypeOfComp;
    2523         5186 :                 thisEquipData.Name = NameOfComp;
    2524         5186 :                 thisEquipData.OutletNodeNums.allocate(NumOutlets);
    2525         5186 :                 thisEquipData.NumOutlets = NumOutlets;
    2526         5186 :                 thisEquipData.OutletNodeNums = OutletNodeNumbers;
    2527         5186 :                 thisEquipData.InletNodeNums.allocate(NumInlets);
    2528         5186 :                 thisEquipData.NumInlets = NumInlets;
    2529         5186 :                 thisEquipData.InletNodeNums = InletNodeNumbers;
    2530         5186 :                 thisEquipData.Parent = IsParent;
    2531         5186 :                 NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    2532         5186 :                 thisEquipData.NumMeteredVars = NumVariables;
    2533         5186 :                 if (NumVariables > 0) {
    2534          753 :                     InletNodeNames.deallocate();
    2535          753 :                     InletNodeNumbers.deallocate();
    2536          753 :                     InletFluidStreams.deallocate();
    2537          753 :                     OutletNodeNames.deallocate();
    2538          753 :                     OutletNodeNumbers.deallocate();
    2539          753 :                     OutletFluidStreams.deallocate();
    2540              : 
    2541          753 :                     meteredVars.allocate(NumVariables);
    2542          753 :                     thisEquipData.MeteredVar.allocate(NumVariables);
    2543              : 
    2544          753 :                     GetMeteredVariables(state, NameOfComp, meteredVars);
    2545              : 
    2546          753 :                     ModeFlagOn = true;
    2547         2219 :                     for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2548              :                         {
    2549         1466 :                             thisEquipData.MeteredVar(VarNum) = meteredVars(VarNum);
    2550         1466 :                             auto &thisVar = thisEquipData.MeteredVar(VarNum);
    2551         1466 :                             if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2552          449 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2553          357 :                                     thisEquipData.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2554              :                                 }
    2555           92 :                                 ModeFlagOn = false;
    2556         1374 :                             } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2557          178 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2558          107 :                                     thisEquipData.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2559              :                                 }
    2560           71 :                                 ModeFlagOn = false;
    2561         1303 :                             } else if (ModeFlagOn) {
    2562         1011 :                                 thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2563              :                             }
    2564              :                         }
    2565              :                     }
    2566              : 
    2567          753 :                     meteredVars.deallocate();
    2568              :                 }
    2569              : 
    2570         5186 :                 if (BranchNodeConnections::IsParentObject(state, TypeOfCompNum, NameOfComp)) {
    2571         4579 :                     NumChildren = BranchNodeConnections::GetNumChildren(state, TypeOfCompNum, NameOfComp);
    2572         4579 :                     thisEquipData.NumSubEquip = NumChildren;
    2573              : 
    2574         4579 :                     SubCompTypes.allocate(NumChildren);
    2575         4579 :                     SubCompNames.allocate(NumChildren);
    2576         4579 :                     InletNodeNames.allocate(NumChildren);
    2577         4579 :                     InletNodeNumbers.allocate(NumChildren);
    2578         4579 :                     OutletNodeNames.allocate(NumChildren);
    2579         4579 :                     OutletNodeNumbers.allocate(NumChildren);
    2580         4579 :                     thisEquipData.SubEquipData.allocate(NumChildren);
    2581              : 
    2582         4579 :                     BranchNodeConnections::GetChildrenData(state,
    2583              :                                                            TypeOfCompNum,
    2584              :                                                            NameOfComp,
    2585              :                                                            NumChildren,
    2586              :                                                            SubCompTypes,
    2587              :                                                            SubCompNames,
    2588              :                                                            InletNodeNames,
    2589              :                                                            InletNodeNumbers,
    2590              :                                                            OutletNodeNames,
    2591              :                                                            OutletNodeNumbers,
    2592              :                                                            ErrorsFound);
    2593              : 
    2594        11268 :                     for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2595         6689 :                         thisEquipData.SubEquipData(SubCompNum).TypeOf =
    2596        13378 :                             BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubCompNum))];
    2597         6689 :                         thisEquipData.SubEquipData(SubCompNum).Name = SubCompNames(SubCompNum);
    2598         6689 :                         thisEquipData.SubEquipData(SubCompNum).OutletNodeNum = OutletNodeNumbers(SubCompNum);
    2599         6689 :                         thisEquipData.SubEquipData(SubCompNum).InletNodeNum = InletNodeNumbers(SubCompNum);
    2600              :                     }
    2601              : 
    2602         4579 :                     SubCompTypes.deallocate();
    2603         4579 :                     SubCompNames.deallocate();
    2604         4579 :                     InletNodeNames.deallocate();
    2605         4579 :                     InletNodeNumbers.deallocate();
    2606         4579 :                     OutletNodeNames.deallocate();
    2607         4579 :                     OutletNodeNumbers.deallocate();
    2608              :                 } else {
    2609          607 :                     NumChildren = 0;
    2610              :                 }
    2611              : 
    2612        11875 :                 for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2613         6689 :                     std::string &TypeOfSubComp = thisEquipData.SubEquipData(SubCompNum).TypeOf;
    2614         6689 :                     std::string &NameOfSubComp = thisEquipData.SubEquipData(SubCompNum).Name;
    2615              :                     DataLoopNode::ConnectionObjectType TypeOfSubCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2616         6689 :                         EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp));
    2617         6689 :                     if (BranchNodeConnections::IsParentObject(state, TypeOfSubCompNum, NameOfSubComp)) {
    2618         2596 :                         NumGrandChildren = BranchNodeConnections::GetNumChildren(state, TypeOfSubCompNum, NameOfSubComp);
    2619         2596 :                         thisEquipData.SubEquipData(SubCompNum).NumSubSubEquip = NumGrandChildren;
    2620         2596 :                         SubCompTypes.allocate(NumGrandChildren);
    2621         2596 :                         SubCompNames.allocate(NumGrandChildren);
    2622         2596 :                         InletNodeNames.allocate(NumGrandChildren);
    2623         2596 :                         InletNodeNumbers.allocate(NumGrandChildren);
    2624         2596 :                         OutletNodeNames.allocate(NumGrandChildren);
    2625         2596 :                         OutletNodeNumbers.allocate(NumGrandChildren);
    2626         2596 :                         thisEquipData.SubEquipData(SubCompNum).SubSubEquipData.allocate(NumGrandChildren);
    2627              :                         // Sankar added the array number for EquipData
    2628         2596 :                         BranchNodeConnections::GetChildrenData(state,
    2629              :                                                                TypeOfSubCompNum,
    2630              :                                                                NameOfSubComp,
    2631              :                                                                NumGrandChildren,
    2632              :                                                                SubCompTypes,
    2633              :                                                                SubCompNames,
    2634              :                                                                InletNodeNames,
    2635              :                                                                InletNodeNumbers,
    2636              :                                                                OutletNodeNames,
    2637              :                                                                OutletNodeNumbers,
    2638              :                                                                ErrorsFound);
    2639              : 
    2640         5267 :                         for (SubSubCompNum = 1; SubSubCompNum <= NumGrandChildren; ++SubSubCompNum) {
    2641         2671 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).TypeOf =
    2642         5342 :                                 BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubSubCompNum))];
    2643         2671 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).Name = SubCompNames(SubSubCompNum);
    2644         2671 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).OutletNodeNum = OutletNodeNumbers(SubSubCompNum);
    2645         2671 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).InletNodeNum = InletNodeNumbers(SubSubCompNum);
    2646              :                         }
    2647         2596 :                         SubCompTypes.deallocate();
    2648         2596 :                         SubCompNames.deallocate();
    2649         2596 :                         InletNodeNames.deallocate();
    2650         2596 :                         InletNodeNumbers.deallocate();
    2651         2596 :                         OutletNodeNames.deallocate();
    2652         2596 :                         OutletNodeNumbers.deallocate();
    2653              :                     } else {
    2654         4093 :                         NumGrandChildren = 0;
    2655              :                     }
    2656              :                 } // for (SubCompNum)
    2657              :             }
    2658              :         } // for (CompNum)
    2659              :     } // for (CtrlZoneNum)
    2660              : 
    2661         5995 :     for (CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    2662         5195 :         if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) {
    2663          739 :             continue;
    2664              :         }
    2665         9642 :         for (CompNum = 1; CompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).NumOfEquipTypes; ++CompNum) {
    2666        11875 :             for (SubCompNum = 1; SubCompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipData(CompNum).NumSubEquip; ++SubCompNum) {
    2667         6689 :                 auto &thisSubEquipData = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipData(CompNum).SubEquipData(SubCompNum);
    2668         6689 :                 std::string &TypeOfSubComp = thisSubEquipData.TypeOf;
    2669         6689 :                 std::string &NameOfSubComp = thisSubEquipData.Name;
    2670              : 
    2671         6689 :                 NumVariables = GetNumMeteredVariables(state, TypeOfSubComp, NameOfSubComp);
    2672         6689 :                 thisSubEquipData.NumMeteredVars = NumVariables; // Sankar added this line
    2673         6689 :                 if (NumVariables > 0) {
    2674         2442 :                     meteredVars.allocate(NumVariables);
    2675         2442 :                     thisSubEquipData.MeteredVar.allocate(NumVariables);
    2676              : 
    2677         2442 :                     GetMeteredVariables(state, NameOfSubComp, meteredVars);
    2678              : 
    2679         2442 :                     ModeFlagOn = true;
    2680         7472 :                     for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2681         5030 :                         thisSubEquipData.MeteredVar(VarNum) = meteredVars(VarNum);
    2682         5030 :                         auto &thisVar = thisSubEquipData.MeteredVar(VarNum);
    2683         5030 :                         if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2684         2881 :                             for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2685         2100 :                                 thisSubEquipData.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2686              :                             }
    2687          781 :                             ModeFlagOn = false;
    2688         4249 :                         } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2689         2049 :                             for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2690         1465 :                                 thisSubEquipData.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2691              :                             }
    2692          584 :                             ModeFlagOn = false;
    2693         3665 :                         } else if (ModeFlagOn) {
    2694         1791 :                             thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2695              :                         }
    2696              :                     }
    2697              : 
    2698         2442 :                     meteredVars.deallocate();
    2699              :                 } // if (NumVariables > 0)
    2700              : 
    2701         9360 :                 for (SubSubCompNum = 1; SubSubCompNum <= thisSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
    2702         2671 :                     std::string &TypeOfSubSubComp = thisSubEquipData.SubSubEquipData(SubSubCompNum).TypeOf;
    2703         2671 :                     std::string &NameOfSubSubComp = thisSubEquipData.SubSubEquipData(SubSubCompNum).Name;
    2704              : 
    2705         2671 :                     NumVariables = GetNumMeteredVariables(state, TypeOfSubSubComp, NameOfSubSubComp);
    2706         2671 :                     thisSubEquipData.SubSubEquipData(SubSubCompNum).NumMeteredVars = NumVariables; // Sankar added this line
    2707         2671 :                     if (NumVariables > 0) {
    2708         2671 :                         meteredVars.allocate(NumVariables);
    2709         2671 :                         thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar.allocate(NumVariables);
    2710              : 
    2711         2671 :                         GetMeteredVariables(state, NameOfSubSubComp, meteredVars);
    2712         2671 :                         ModeFlagOn = true;
    2713         8160 :                         for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2714         5489 :                             thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2715         5489 :                             auto &thisVar = thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum);
    2716         5489 :                             if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2717         7938 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2718         5353 :                                     thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum1).heatOrCool =
    2719              :                                         Constant::HeatOrCool::HeatingOnly;
    2720              :                                 }
    2721         2585 :                                 ModeFlagOn = false;
    2722         2904 :                             } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2723           80 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2724           63 :                                     thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum1).heatOrCool =
    2725              :                                         Constant::HeatOrCool::CoolingOnly;
    2726              :                                 }
    2727           17 :                                 ModeFlagOn = false;
    2728         2887 :                             } else if (ModeFlagOn) {
    2729           73 :                                 thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2730              :                             }
    2731              :                         }
    2732              : 
    2733         2671 :                         meteredVars.deallocate();
    2734              :                     } // if (NumVariables > 0)
    2735              :                 } // for (SubSubCompNum)
    2736              :             } // for (SubCompNum)
    2737              :         } // for (CompNum)
    2738              :     } // for (CtrlZoneNum)
    2739              : 
    2740              :     //***Plant Loops
    2741              : 
    2742              :     // previously, four separate huge DO loops all looking very very similar were used here
    2743              :     // each individual block would operate on a single type of loop-side (plant demand, cond supply, etc.)
    2744              :     // now, a bigger DO loop is applied iterating over all loops
    2745              :     // a pointer (ThisReportData) is then directed to a particular item in the appropriate array
    2746              :     // by operating on the pointer directly, we are actually operating on the item in the TARGET array item
    2747              :     // in making this change, over 700 lines of code were dropped down to a single block
    2748              : 
    2749         1957 :     for (PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
    2750         3471 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2751              : 
    2752              :             // Report selection
    2753         2314 :             ReportLoopData *select_ThisReportData(nullptr);
    2754              : 
    2755         2314 :             assert(LoopSideNum == LoopSideLocation::Demand || LoopSideNum == LoopSideLocation::Supply);
    2756         2314 :             if (PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops) {
    2757         1794 :                 select_ThisReportData = &state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideNum)](PlantLoopNum);
    2758              :             } else { // CondLoop
    2759              :                 select_ThisReportData =
    2760          520 :                     &state.dataPlnt->VentRepCond[static_cast<int>(LoopSideNum)](PlantLoopNum - state.dataHVACGlobal->NumPlantLoops);
    2761              :             }
    2762              : 
    2763              :             // Object Data
    2764         2314 :             ReportLoopData &ThisReportData(*select_ThisReportData);
    2765              : 
    2766        16262 :             for (BranchNum = 1; BranchNum <= ThisReportData.TotalBranches; ++BranchNum) {
    2767        27982 :                 for (CompNum = 1; CompNum <= ThisReportData.Branch(BranchNum).TotalComponents; ++CompNum) {
    2768              :                     {
    2769        14034 :                         auto &thisComp = ThisReportData.Branch(BranchNum).Comp(CompNum);
    2770        14034 :                         std::string &TypeOfComp = thisComp.TypeOf;
    2771        14034 :                         std::string &NameOfComp = thisComp.Name;
    2772              :                         DataLoopNode::ConnectionObjectType TypeOfCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2773        14034 :                             EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp));
    2774              :                         // Get complete list of components for complex branches
    2775        14034 :                         if (BranchNodeConnections::IsParentObject(state, TypeOfCompNum, NameOfComp)) {
    2776              : 
    2777           10 :                             NumChildren = BranchNodeConnections::GetNumChildren(state, TypeOfCompNum, NameOfComp);
    2778              : 
    2779           10 :                             SubCompTypes.allocate(NumChildren);
    2780           10 :                             SubCompNames.allocate(NumChildren);
    2781           10 :                             InletNodeNames.allocate(NumChildren);
    2782           10 :                             InletNodeNumbers.allocate(NumChildren);
    2783           10 :                             OutletNodeNames.allocate(NumChildren);
    2784           10 :                             OutletNodeNumbers.allocate(NumChildren);
    2785           10 :                             thisComp.SubComp.allocate(NumChildren);
    2786              : 
    2787           10 :                             BranchNodeConnections::GetChildrenData(state,
    2788              :                                                                    TypeOfCompNum,
    2789              :                                                                    NameOfComp,
    2790              :                                                                    NumChildren,
    2791              :                                                                    SubCompTypes,
    2792              :                                                                    SubCompNames,
    2793              :                                                                    InletNodeNames,
    2794              :                                                                    InletNodeNumbers,
    2795              :                                                                    OutletNodeNames,
    2796              :                                                                    OutletNodeNumbers,
    2797              :                                                                    ErrorsFound);
    2798              : 
    2799           50 :                             for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2800           40 :                                 thisComp.SubComp(SubCompNum).TypeOf =
    2801           80 :                                     BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubCompNum))];
    2802           40 :                                 thisComp.SubComp(SubCompNum).Name = SubCompNames(SubCompNum);
    2803           40 :                                 thisComp.SubComp(SubCompNum).NodeNameIn = InletNodeNames(SubCompNum);
    2804           40 :                                 thisComp.SubComp(SubCompNum).NodeNameOut = OutletNodeNames(SubCompNum);
    2805           40 :                                 thisComp.SubComp(SubCompNum).NodeNumIn = InletNodeNumbers(SubCompNum);
    2806           40 :                                 thisComp.SubComp(SubCompNum).NodeNumOut = OutletNodeNumbers(SubCompNum);
    2807              :                             }
    2808              : 
    2809           10 :                             SubCompTypes.deallocate();
    2810           10 :                             SubCompNames.deallocate();
    2811           10 :                             InletNodeNames.deallocate();
    2812           10 :                             InletNodeNumbers.deallocate();
    2813           10 :                             OutletNodeNames.deallocate();
    2814           10 :                             OutletNodeNumbers.deallocate();
    2815              : 
    2816              :                         } else {
    2817        14024 :                             NumChildren = 0;
    2818              :                         }
    2819        14034 :                         thisComp.NumSubComps = NumChildren;
    2820              : 
    2821              :                         // check for 'grandchildren'
    2822        14074 :                         for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2823           40 :                             std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf;
    2824           40 :                             std::string NameOfSubComp = thisComp.SubComp(SubCompNum).Name;
    2825              :                             DataLoopNode::ConnectionObjectType TypeOfSubCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2826           40 :                                 EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp));
    2827           40 :                             if (BranchNodeConnections::IsParentObject(state, TypeOfSubCompNum, NameOfSubComp)) {
    2828            0 :                                 NumGrandChildren = BranchNodeConnections::GetNumChildren(state, TypeOfSubCompNum, NameOfSubComp);
    2829            0 :                                 SubCompTypes.allocate(NumGrandChildren);
    2830            0 :                                 SubCompNames.allocate(NumGrandChildren);
    2831            0 :                                 InletNodeNames.allocate(NumGrandChildren);
    2832            0 :                                 InletNodeNumbers.allocate(NumGrandChildren);
    2833            0 :                                 OutletNodeNames.allocate(NumGrandChildren);
    2834            0 :                                 OutletNodeNumbers.allocate(NumGrandChildren);
    2835            0 :                                 thisComp.SubComp(SubCompNum).SubSubComp.allocate(NumGrandChildren);
    2836              : 
    2837            0 :                                 BranchNodeConnections::GetChildrenData(state,
    2838              :                                                                        TypeOfSubCompNum,
    2839              :                                                                        NameOfSubComp,
    2840              :                                                                        NumGrandChildren,
    2841              :                                                                        SubCompTypes,
    2842              :                                                                        SubCompNames,
    2843              :                                                                        InletNodeNames,
    2844              :                                                                        InletNodeNumbers,
    2845              :                                                                        OutletNodeNames,
    2846              :                                                                        OutletNodeNumbers,
    2847              :                                                                        ErrorsFound);
    2848              : 
    2849            0 :                                 for (SubSubCompNum = 1; SubSubCompNum <= NumGrandChildren; ++SubSubCompNum) {
    2850              :                                     {
    2851            0 :                                         auto &thisSubSubComp = thisComp.SubComp(SubCompNum).SubSubComp(SubSubCompNum);
    2852              :                                         thisSubSubComp.TypeOf =
    2853            0 :                                             BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubSubCompNum))];
    2854            0 :                                         thisSubSubComp.Name = SubCompNames(SubSubCompNum);
    2855            0 :                                         thisSubSubComp.NodeNameIn = InletNodeNames(SubSubCompNum);
    2856            0 :                                         thisSubSubComp.NodeNameOut = OutletNodeNames(SubSubCompNum);
    2857            0 :                                         thisSubSubComp.NodeNumIn = InletNodeNumbers(SubSubCompNum);
    2858            0 :                                         thisSubSubComp.NodeNumOut = OutletNodeNumbers(SubSubCompNum);
    2859              :                                     }
    2860              :                                 }
    2861              : 
    2862            0 :                                 SubCompTypes.deallocate();
    2863            0 :                                 SubCompNames.deallocate();
    2864            0 :                                 InletNodeNames.deallocate();
    2865            0 :                                 InletNodeNumbers.deallocate();
    2866            0 :                                 OutletNodeNames.deallocate();
    2867            0 :                                 OutletNodeNumbers.deallocate();
    2868              :                             } else {
    2869           40 :                                 NumGrandChildren = 0;
    2870           40 :                                 thisComp.SubComp(SubCompNum).Parent = false;
    2871              :                             }
    2872              : 
    2873           40 :                             thisComp.SubComp(SubCompNum).NumSubSubComps = NumGrandChildren;
    2874           40 :                         }
    2875              :                     }
    2876              :                 }
    2877              :             }
    2878              :         }
    2879              :     }
    2880              : 
    2881         1957 :     for (PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
    2882              : 
    2883         3471 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2884              : 
    2885              :             // Report selection
    2886         2314 :             ReportLoopData *select_ThisReportData(nullptr);
    2887              : 
    2888         2314 :             assert(LoopSideNum == LoopSideLocation::Demand || LoopSideNum == LoopSideLocation::Supply);
    2889         2314 :             if (PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops) {
    2890         1794 :                 select_ThisReportData = &state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideNum)](PlantLoopNum);
    2891              :             } else { // CondLoop
    2892              :                 select_ThisReportData =
    2893          520 :                     &state.dataPlnt->VentRepCond[static_cast<int>(LoopSideNum)](PlantLoopNum - state.dataHVACGlobal->NumPlantLoops);
    2894              :             }
    2895              : 
    2896              :             // Object Data
    2897         2314 :             ReportLoopData &ThisReportData(*select_ThisReportData);
    2898              : 
    2899        16262 :             for (BranchNum = 1; BranchNum <= ThisReportData.TotalBranches; ++BranchNum) {
    2900        27982 :                 for (CompNum = 1; CompNum <= ThisReportData.Branch(BranchNum).TotalComponents; ++CompNum) {
    2901              :                     // Get complete list of components for complex branches
    2902        14034 :                     auto &thisComp = ThisReportData.Branch(BranchNum).Comp(CompNum);
    2903        14034 :                     std::string &TypeOfComp = thisComp.TypeOf;
    2904        14034 :                     std::string &NameOfComp = thisComp.Name;
    2905        14034 :                     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    2906        14034 :                     if (NumVariables > 0) {
    2907         8379 :                         meteredVars.allocate(NumVariables);
    2908         8379 :                         thisComp.MeteredVar.allocate(NumVariables);
    2909              : 
    2910         8379 :                         thisComp.NumMeteredVars = NumVariables;
    2911         8379 :                         GetMeteredVariables(state, NameOfComp, meteredVars);
    2912         8379 :                         ModeFlagOn = true;
    2913              : 
    2914        28698 :                         for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2915        20319 :                             thisComp.MeteredVar(VarNum) = meteredVars(VarNum);
    2916        20319 :                             auto &thisVar = thisComp.MeteredVar(VarNum);
    2917        20319 :                             if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2918        10270 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2919         7051 :                                     thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2920              :                                 }
    2921         3219 :                                 ModeFlagOn = false;
    2922        17100 :                             } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2923         3195 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2924         2231 :                                     thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2925              :                                 }
    2926          964 :                                 ModeFlagOn = false;
    2927        16136 :                             } else if (ModeFlagOn) {
    2928        11643 :                                 thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2929              :                             }
    2930              :                         }
    2931              : 
    2932         8379 :                         meteredVars.deallocate();
    2933              :                     } // if (NumVariables > 0)
    2934              : 
    2935        14074 :                     for (SubCompNum = 1; SubCompNum <= thisComp.NumSubComps; ++SubCompNum) {
    2936              :                         // Get complete list of components for complex branches
    2937           40 :                         std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf;
    2938           40 :                         std::string &NameOfSubComp = thisComp.SubComp(SubCompNum).Name;
    2939           40 :                         NumVariables = GetNumMeteredVariables(state, TypeOfSubComp, NameOfSubComp);
    2940           40 :                         if (NumVariables > 0) {
    2941           40 :                             meteredVars.allocate(NumVariables);
    2942           40 :                             thisComp.SubComp(SubCompNum).MeteredVar.allocate(NumVariables);
    2943              : 
    2944           40 :                             GetMeteredVariables(state, NameOfSubComp, meteredVars);
    2945           40 :                             ModeFlagOn = true;
    2946              : 
    2947          176 :                             for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2948          136 :                                 thisComp.SubComp(SubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2949          136 :                                 auto &thisVar = thisComp.SubComp(SubCompNum).MeteredVar(VarNum);
    2950          136 :                                 if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2951           24 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2952           20 :                                         thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2953              :                                     }
    2954            4 :                                     ModeFlagOn = false;
    2955          132 :                                 } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2956           56 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2957           42 :                                         thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2958              :                                     }
    2959           14 :                                     ModeFlagOn = false;
    2960          118 :                                 } else if (ModeFlagOn) {
    2961           78 :                                     thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2962              :                                 }
    2963              :                             }
    2964              : 
    2965           40 :                             meteredVars.deallocate();
    2966              :                         } // if (NumVariables > 0)
    2967              : 
    2968           40 :                         thisComp.SubComp(SubCompNum).NumMeteredVars = NumVariables;
    2969              :                     } // for (SubCompNum)
    2970              :                 } // for (CompNum)
    2971              :             } // for (BranchNum)
    2972              :         } // for (LoopSide)
    2973              :     } // for (PlantLoopNum)
    2974          800 : } // CreateEnergyReportStructure()
    2975              : 
    2976              : // End Initialization Section of the Module
    2977              : //******************************************************************************
    2978              : 
    2979              : // Beginning of Reporting subroutines for the SimAir Module
    2980              : // *****************************************************************************
    2981              : 
    2982       624375 : void ReportSystemEnergyUse(EnergyPlusData &state)
    2983              : {
    2984              :     // SUBROUTINE INFORMATION:
    2985              :     //       AUTHOR         Dan Fisher
    2986              :     //       DATE WRITTEN   November 2005
    2987              : 
    2988              :     // PURPOSE OF THIS SUBROUTINE:
    2989              :     // calculate and report system loads and energy
    2990              : 
    2991              :     // METHODOLOGY EMPLOYED:
    2992              :     // Accumulate meter data to appropriate report variables
    2993              : 
    2994              :     int Idx;          // loop counter
    2995              :     int nodes;        // loop counter
    2996              :     int BranchNum;    // counter for zone air distribution inlets
    2997              :     int EquipListNum; // counter for zone air distribution inlets
    2998              :     int VarNum;       // counter for zone air distribution inlets
    2999              :     int CompNum;
    3000              :     int SubCompNum;
    3001              :     int SubSubCompNum;
    3002              :     Constant::HeatOrCool CompMode;
    3003              :     int InletNodeNum;
    3004              :     int OutletNodeNum;
    3005              :     int ADUNum;
    3006              :     int ADUCoolNum;
    3007              :     int ADUHeatNum;
    3008              :     int AirDistCoolInletNodeNum;
    3009              :     int AirDistHeatInletNodeNum;
    3010              :     Constant::eResource EnergyType;
    3011              :     Real64 CompEnergyUse;
    3012              :     Real64 ZoneLoad;
    3013              :     Real64 CompLoad;
    3014              :     Real64 ADUCoolFlowrate;
    3015              :     Real64 ADUHeatFlowrate;
    3016              :     bool CompLoadFlag;
    3017              : 
    3018       624375 :     Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
    3019       624375 :     if (!state.dataSysRpts->AirLoopLoadsReportEnabled) {
    3020            0 :         return;
    3021              :     }
    3022              : 
    3023      1487079 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    3024       862704 :         auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(airLoopNum);
    3025              :         // SYSTEM LOADS REPORT
    3026       862704 :         thisSysLoadRepVars.TotHTNG = 0.0;
    3027       862704 :         thisSysLoadRepVars.TotCLNG = 0.0;
    3028              : 
    3029              :         // SYSTEM ENERGY USE REPORT
    3030       862704 :         thisSysLoadRepVars.TotElec = 0.0;
    3031       862704 :         thisSysLoadRepVars.TotNaturalGas = 0.0;
    3032       862704 :         thisSysLoadRepVars.TotPropane = 0.0;
    3033       862704 :         thisSysLoadRepVars.TotSteam = 0.0;
    3034       862704 :         thisSysLoadRepVars.TotH2OCOLD = 0.0;
    3035       862704 :         thisSysLoadRepVars.TotH2OHOT = 0.0;
    3036              : 
    3037              :         // SYSTEM COMPONENT LOADS REPORT
    3038       862704 :         thisSysLoadRepVars.FANCompHTNG = 0.0;
    3039       862704 :         thisSysLoadRepVars.CCCompCLNG = 0.0;
    3040       862704 :         thisSysLoadRepVars.HCCompHTNG = 0.0;
    3041       862704 :         thisSysLoadRepVars.HeatExHTNG = 0.0;
    3042       862704 :         thisSysLoadRepVars.HeatExCLNG = 0.0;
    3043       862704 :         thisSysLoadRepVars.SolarCollectHeating = 0.0;
    3044       862704 :         thisSysLoadRepVars.SolarCollectCooling = 0.0;
    3045       862704 :         thisSysLoadRepVars.UserDefinedTerminalHeating = 0.0;
    3046       862704 :         thisSysLoadRepVars.UserDefinedTerminalCooling = 0.0;
    3047       862704 :         thisSysLoadRepVars.HumidHTNG = 0.0;
    3048       862704 :         thisSysLoadRepVars.EvapCLNG = 0.0;
    3049       862704 :         thisSysLoadRepVars.DesDehumidCLNG = 0.0;
    3050       862704 :         thisSysLoadRepVars.DomesticH2O = 0.0;
    3051              : 
    3052              :         // SYSTEM COMPONENT ENERGY REPORT
    3053       862704 :         thisSysLoadRepVars.FANCompElec = 0.0;
    3054       862704 :         thisSysLoadRepVars.HCCompH2OHOT = 0.0;
    3055       862704 :         thisSysLoadRepVars.CCCompH2OCOLD = 0.0;
    3056       862704 :         thisSysLoadRepVars.HCCompElec = 0.0;
    3057       862704 :         thisSysLoadRepVars.CCCompElec = 0.0;
    3058       862704 :         thisSysLoadRepVars.HCCompElecRes = 0.0;
    3059       862704 :         thisSysLoadRepVars.HCCompNaturalGas = 0.0;
    3060       862704 :         thisSysLoadRepVars.HCCompPropane = 0.0;
    3061       862704 :         thisSysLoadRepVars.HCCompSteam = 0.0;
    3062       862704 :         thisSysLoadRepVars.HumidElec = 0.0;
    3063       862704 :         thisSysLoadRepVars.HumidNaturalGas = 0.0;
    3064       862704 :         thisSysLoadRepVars.HumidPropane = 0.0;
    3065       862704 :         thisSysLoadRepVars.DesDehumidElec = 0.0;
    3066       862704 :         thisSysLoadRepVars.EvapElec = 0.0;
    3067              :     }
    3068              : 
    3069       624375 :     auto &Node = state.dataLoopNodes->Node;
    3070              : 
    3071      1487079 :     for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
    3072       862704 :         auto const &pas = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum);
    3073      1735668 :         for (BranchNum = 1; BranchNum <= pas.NumBranches; ++BranchNum) {
    3074       872964 :             auto const &pasBranch = pas.Branch(BranchNum);
    3075       872964 :             if (Node(pasBranch.NodeNumOut).MassFlowRate <= 0.0) {
    3076       275308 :                 continue;
    3077              :             }
    3078      2413353 :             for (CompNum = 1; CompNum <= pasBranch.TotalComponents; ++CompNum) {
    3079      1815697 :                 auto const &pasBranchComp = pasBranch.Comp(CompNum);
    3080      1815697 :                 InletNodeNum = pasBranchComp.NodeNumIn;
    3081      1815697 :                 OutletNodeNum = pasBranchComp.NodeNumOut;
    3082      1815697 :                 if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3083            0 :                     continue;
    3084              :                 }
    3085      1815697 :                 CompLoad = Node(OutletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3086      1815697 :                                                                Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3087      1815697 :                 CompLoad *= TimeStepSysSec;
    3088      1815697 :                 CompEnergyUse = 0.0;
    3089      1815697 :                 EnergyType = Constant::eResource::Invalid;
    3090      1815697 :                 CompLoadFlag = true;
    3091      1815697 :                 CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3092      1815697 :                 CompLoadFlag = false;
    3093      3820914 :                 for (VarNum = 1; VarNum <= pasBranchComp.NumMeteredVars; ++VarNum) {
    3094      2005217 :                     auto const &pasBranchCompMeter = pasBranchComp.MeteredVar(VarNum);
    3095      2005217 :                     CompMode = pasBranchCompMeter.heatOrCool;
    3096      2005217 :                     CompEnergyUse = pasBranchCompMeter.curMeterReading;
    3097      2005217 :                     EnergyType = pasBranchCompMeter.resource;
    3098      2005217 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3099              :                 }
    3100              : 
    3101      3559454 :                 for (SubCompNum = 1; SubCompNum <= pasBranchComp.NumSubComps; ++SubCompNum) {
    3102      1743757 :                     auto const &pasBranchSubComp = pasBranchComp.SubComp(SubCompNum);
    3103      1743757 :                     InletNodeNum = pasBranchSubComp.NodeNumIn;
    3104      1743757 :                     OutletNodeNum = pasBranchSubComp.NodeNumOut;
    3105      1743757 :                     if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3106            0 :                         continue;
    3107              :                     }
    3108      1743757 :                     CompLoad = Node(OutletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3109      1743757 :                                                                    Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3110      1743757 :                     CompLoad *= TimeStepSysSec;
    3111      1743757 :                     CompEnergyUse = 0.0;
    3112      1743757 :                     EnergyType = Constant::eResource::Invalid;
    3113      1743757 :                     CompLoadFlag = true;
    3114      1743757 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchSubComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3115      1743757 :                     CompLoadFlag = false;
    3116      4735616 :                     for (VarNum = 1; VarNum <= pasBranchSubComp.NumMeteredVars; ++VarNum) {
    3117      2991859 :                         auto const &pasBranchSubCompMeter = pasBranchSubComp.MeteredVar(VarNum);
    3118      2991859 :                         CompMode = pasBranchSubCompMeter.heatOrCool;
    3119      2991859 :                         CompEnergyUse = pasBranchSubCompMeter.curMeterReading;
    3120      2991859 :                         EnergyType = pasBranchSubCompMeter.resource;
    3121      2991859 :                         CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchSubComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3122              :                     }
    3123              : 
    3124      1754180 :                     for (SubSubCompNum = 1; SubSubCompNum <= pasBranchSubComp.NumSubSubComps; ++SubSubCompNum) {
    3125        10423 :                         auto const &pasBranchSubSubComp = pasBranchSubComp.SubSubComp(SubSubCompNum);
    3126        10423 :                         InletNodeNum = pasBranchSubSubComp.NodeNumIn;
    3127        10423 :                         OutletNodeNum = pasBranchSubSubComp.NodeNumOut;
    3128        10423 :                         if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3129            0 :                             continue;
    3130              :                         }
    3131        10423 :                         CompLoad =
    3132        10423 :                             Node(OutletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3133        10423 :                                                                 Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3134        10423 :                         CompLoad *= TimeStepSysSec;
    3135        10423 :                         CompEnergyUse = 0.0;
    3136        10423 :                         EnergyType = Constant::eResource::Invalid;
    3137        10423 :                         CompLoadFlag = true;
    3138        10423 :                         CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchSubSubComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3139        10423 :                         CompLoadFlag = false;
    3140        40687 :                         for (VarNum = 1; VarNum <= pasBranchSubSubComp.NumMeteredVars; ++VarNum) {
    3141        30264 :                             auto const &pasBranchSubSubCompMeter = pasBranchSubSubComp.MeteredVar(VarNum);
    3142        30264 :                             CompMode = pasBranchSubSubCompMeter.heatOrCool;
    3143        30264 :                             CompEnergyUse = pasBranchSubSubCompMeter.curMeterReading;
    3144        30264 :                             EnergyType = pasBranchSubSubCompMeter.resource;
    3145        30264 :                             CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchSubSubComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3146              :                         }
    3147              :                     } // for (SubSubCompNum)
    3148              :                 } // for (SubCompNum)
    3149              :             } // for (CompNum)
    3150              :         } // for (BranchNum)
    3151              :     } // for (AirLoopNum)
    3152              : 
    3153      4136232 :     for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    3154      3511857 :         auto const &zecCtrlZone = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
    3155      3511857 :         if (!zecCtrlZone.IsControlled) {
    3156       490019 :             continue;
    3157              :         }
    3158              : 
    3159      3021838 :         ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    3160              : 
    3161              :         // if system operating in deadband reset zone load
    3162      3021838 :         if (state.dataZoneEnergyDemand->DeadBandOrSetback(CtrlZoneNum)) {
    3163      1101001 :             ZoneLoad = 0.0;
    3164              :         }
    3165              : 
    3166              :         // loop over the zone supply air path inlet nodes
    3167      6150940 :         for (int ZoneInNum = 1; ZoneInNum <= zecCtrlZone.NumInletNodes; ++ZoneInNum) {
    3168              :             // retrieve air loop indexes
    3169      3129102 :             int AirLoopNum = zecCtrlZone.InletNodeAirLoopNum(ZoneInNum);
    3170      3129102 :             if (AirLoopNum == 0) {
    3171       765095 :                 continue;
    3172              :             }
    3173              : 
    3174      2364007 :             auto const &zecCtrlZoneCool = zecCtrlZone.AirDistUnitCool(ZoneInNum);
    3175      2364007 :             auto const &zecCtrlZoneHeat = zecCtrlZone.AirDistUnitHeat(ZoneInNum);
    3176              : 
    3177      2364007 :             AirDistCoolInletNodeNum = max(zecCtrlZoneCool.InNode, 0);
    3178      2364007 :             AirDistHeatInletNodeNum = max(zecCtrlZoneHeat.InNode, 0);
    3179              : 
    3180              :             // Set for cooling or heating path
    3181      2364007 :             if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum == 0) {
    3182      2311910 :                 ADUCoolFlowrate = max(Node(zecCtrlZoneCool.InNode).MassFlowRate, 0.0);
    3183        52097 :             } else if (AirDistHeatInletNodeNum > 0 && AirDistCoolInletNodeNum == 0) {
    3184            0 :                 ADUHeatFlowrate = max(Node(zecCtrlZoneHeat.InNode).MassFlowRate, 0.0);
    3185              :             } else {
    3186        52097 :                 ADUCoolFlowrate = 0.0;
    3187        52097 :                 ADUHeatFlowrate = 0.0;
    3188              :             }
    3189              : 
    3190      2364007 :             EquipListNum = zecCtrlZone.EquipListIndex;
    3191      2364007 :             auto const &zel = state.dataZoneEquip->ZoneEquipList(EquipListNum);
    3192              : 
    3193      7092021 :             for (Idx = 1; Idx <= 2; ++Idx) {
    3194      4728014 :                 if (Idx == 1) {
    3195      2364007 :                     ADUCoolNum = max(zecCtrlZoneCool.AirDistUnitIndex, 0);
    3196      2364007 :                     if (ADUCoolNum == 0) {
    3197            0 :                         continue;
    3198              :                     }
    3199      2364007 :                     ADUNum = ADUCoolNum;
    3200              :                 } else { //(Idx =2)THEN
    3201      2364007 :                     ADUHeatNum = max(zecCtrlZoneHeat.AirDistUnitIndex, 0);
    3202      2364007 :                     if (ADUHeatNum == 0) {
    3203      2311910 :                         continue;
    3204              :                     }
    3205        52097 :                     ADUNum = ADUHeatNum;
    3206              :                 }
    3207              : 
    3208      2416104 :                 auto const &zelEquipData = zel.EquipData(ADUNum);
    3209              : 
    3210      2416104 :                 CompLoad = 0.0;
    3211      2416104 :                 if (zelEquipData.NumInlets > 0) {
    3212            0 :                     for (nodes = 1; nodes <= zelEquipData.NumInlets; ++nodes) {
    3213            0 :                         InletNodeNum = zelEquipData.InletNodeNums(Idx);
    3214            0 :                         CompLoad +=
    3215            0 :                             (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) * Node(InletNodeNum).MassFlowRate);
    3216              :                     }
    3217            0 :                     for (nodes = 1; nodes <= zelEquipData.NumOutlets; ++nodes) {
    3218            0 :                         OutletNodeNum = zelEquipData.OutletNodeNums(Idx);
    3219            0 :                         CompLoad -=
    3220            0 :                             (Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat) * Node(OutletNodeNum).MassFlowRate);
    3221              :                     }
    3222              :                 }
    3223      2416104 :                 CompLoad *= TimeStepSysSec;
    3224      2416104 :                 CompEnergyUse = 0.0;
    3225      2416104 :                 EnergyType = Constant::eResource::Invalid;
    3226      2416104 :                 CompLoadFlag = true;
    3227      2416104 :                 CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3228      2416104 :                 CompLoadFlag = false;
    3229      2497704 :                 for (VarNum = 1; VarNum <= zelEquipData.NumMeteredVars; ++VarNum) {
    3230        81600 :                     CompEnergyUse = zelEquipData.MeteredVar(VarNum).curMeterReading;
    3231        81600 :                     EnergyType = zelEquipData.MeteredVar(VarNum).resource;
    3232        81600 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3233              :                 }
    3234              : 
    3235      4864034 :                 for (SubCompNum = 1; SubCompNum <= zelEquipData.NumSubEquip; ++SubCompNum) {
    3236      2447930 :                     auto const &zelSubEquipData = zelEquipData.SubEquipData(SubCompNum);
    3237      2447930 :                     InletNodeNum = zelSubEquipData.InletNodeNum;
    3238      2447930 :                     OutletNodeNum = zelSubEquipData.OutletNodeNum;
    3239      2447930 :                     if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3240            0 :                         continue;
    3241              :                     }
    3242      2447930 :                     CompLoad = Node(InletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3243      2447930 :                                                                   Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3244      2447930 :                     CompLoad *= TimeStepSysSec;
    3245      2447930 :                     CompEnergyUse = 0.0;
    3246      2447930 :                     EnergyType = Constant::eResource::Invalid;
    3247      2447930 :                     CompLoadFlag = true;
    3248      2447930 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3249      2447930 :                     CompLoadFlag = false;
    3250      2533370 :                     for (VarNum = 1; VarNum <= zelSubEquipData.NumMeteredVars; ++VarNum) {
    3251        85440 :                         CompEnergyUse = zelSubEquipData.MeteredVar(VarNum).curMeterReading;
    3252        85440 :                         EnergyType = zelSubEquipData.MeteredVar(VarNum).resource;
    3253        85440 :                         CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3254              :                     }
    3255              : 
    3256      4057041 :                     for (SubSubCompNum = 1; SubSubCompNum <= zelSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
    3257      1609111 :                         auto const &zelSubSubEquipData = zelSubEquipData.SubSubEquipData(SubSubCompNum);
    3258      1609111 :                         InletNodeNum = zelSubSubEquipData.InletNodeNum;
    3259      1609111 :                         OutletNodeNum = zelSubSubEquipData.OutletNodeNum;
    3260      1609111 :                         if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3261            0 :                             continue;
    3262              :                         }
    3263      1609111 :                         CompLoad =
    3264      1609111 :                             Node(InletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3265      1609111 :                                                                Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3266      1609111 :                         CompLoad *= TimeStepSysSec;
    3267      1609111 :                         CompEnergyUse = 0.0;
    3268      1609111 :                         EnergyType = Constant::eResource::Invalid;
    3269      1609111 :                         CompLoadFlag = true;
    3270      1609111 :                         CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3271      1609111 :                         CompLoadFlag = false;
    3272      4865126 :                         for (VarNum = 1; VarNum <= zelSubSubEquipData.NumMeteredVars; ++VarNum) {
    3273      3256015 :                             CompEnergyUse = zelSubSubEquipData.MeteredVar(VarNum).curMeterReading;
    3274      3256015 :                             EnergyType = zelSubSubEquipData.MeteredVar(VarNum).resource;
    3275      3256015 :                             CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3276              :                         }
    3277              :                     } // SubSubCompNum
    3278              :                 } // SubCompNum
    3279              :             } // Idx
    3280              :         } // ZoneInNum
    3281              :     } // Controlled Zone Loop
    3282              : 
    3283      1487079 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    3284       862704 :         auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(airLoopNum);
    3285       862704 :         thisSysLoadRepVars.TotHTNG = thisSysLoadRepVars.FANCompHTNG + thisSysLoadRepVars.HCCompHTNG + thisSysLoadRepVars.HeatExHTNG +
    3286       862704 :                                      thisSysLoadRepVars.HumidHTNG + thisSysLoadRepVars.SolarCollectHeating +
    3287       862704 :                                      thisSysLoadRepVars.UserDefinedTerminalHeating;
    3288       862704 :         thisSysLoadRepVars.TotCLNG = thisSysLoadRepVars.CCCompCLNG + thisSysLoadRepVars.HeatExCLNG + thisSysLoadRepVars.EvapCLNG +
    3289       862704 :                                      thisSysLoadRepVars.DesDehumidCLNG + thisSysLoadRepVars.SolarCollectCooling +
    3290       862704 :                                      thisSysLoadRepVars.UserDefinedTerminalCooling;
    3291       862704 :         thisSysLoadRepVars.TotElec = thisSysLoadRepVars.FANCompElec + thisSysLoadRepVars.HCCompElec + thisSysLoadRepVars.CCCompElec +
    3292       862704 :                                      thisSysLoadRepVars.HCCompElecRes + thisSysLoadRepVars.HumidElec + thisSysLoadRepVars.DesDehumidElec +
    3293       862704 :                                      thisSysLoadRepVars.EvapElec;
    3294       862704 :         thisSysLoadRepVars.TotNaturalGas = thisSysLoadRepVars.HCCompNaturalGas + thisSysLoadRepVars.HumidNaturalGas;
    3295       862704 :         thisSysLoadRepVars.TotPropane = thisSysLoadRepVars.HCCompPropane + thisSysLoadRepVars.HumidPropane;
    3296       862704 :         thisSysLoadRepVars.TotSteam = thisSysLoadRepVars.HCCompSteam;
    3297       862704 :         thisSysLoadRepVars.TotH2OCOLD = thisSysLoadRepVars.CCCompH2OCOLD;
    3298       862704 :         thisSysLoadRepVars.TotH2OHOT = thisSysLoadRepVars.HCCompH2OHOT;
    3299              :     }
    3300              : }
    3301              : 
    3302     18493417 : void CalcSystemEnergyUse(EnergyPlusData &state,
    3303              :                          bool const CompLoadFlag,
    3304              :                          int const AirLoopNum,
    3305              :                          std::string const &CompType,
    3306              :                          Constant::eResource const EnergyType,
    3307              :                          Real64 const CompLoad,
    3308              :                          Real64 const CompEnergy)
    3309              : {
    3310              :     // SUBROUTINE INFORMATION:
    3311              :     //       AUTHOR         Dan Fisher
    3312              :     //       DATE WRITTEN   Nov. 2005
    3313              : 
    3314              :     // PURPOSE OF THIS SUBROUTINE:
    3315              :     // accumulate system loads and energy to report variables
    3316              : 
    3317              :     // Tuned String comparisons were a big performance hit
    3318              :     // ComponentTypes and component_strings must remain in sync
    3319              :     enum ComponentTypes
    3320              :     { // Using older enum style to avoid the name scoping cruft
    3321              :         AIRLOOPHVAC_OUTDOORAIRSYSTEM,
    3322              :         AIRLOOPHVAC_UNITARY_FURNACE_HEATCOOL,
    3323              :         AIRLOOPHVAC_UNITARY_FURNACE_HEATONLY,
    3324              :         AIRLOOPHVAC_UNITARYHEATCOOL,
    3325              :         AIRLOOPHVAC_UNITARYHEATCOOL_VAVCHANGEOVERBYPASS,
    3326              :         AIRLOOPHVAC_UNITARYHEATONLY,
    3327              :         AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR,
    3328              :         AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR_MULTISPEED,
    3329              :         AIRLOOPHVAC_UNITARYHEATPUMP_WATERTOAIR,
    3330              :         AIRLOOPHVAC_UNITARYSYSTEM,
    3331              :         AIRTERMINAL_DUALDUCT_CONSTANTVOLUME_COOL,
    3332              :         AIRTERMINAL_DUALDUCT_CONSTANTVOLUME_HEAT,
    3333              :         AIRTERMINAL_DUALDUCT_VAV_COOL,
    3334              :         AIRTERMINAL_DUALDUCT_VAV_HEAT,
    3335              :         AIRTERMINAL_DUALDUCT_VAV_OUTDOORAIR_OUTDOORAIR,
    3336              :         AIRTERMINAL_DUALDUCT_VAV_OUTDOORAIR_RECIRCULATEDAIR,
    3337              :         AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_COOLEDBEAM,
    3338              :         AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_FOURPIPEBEAM,
    3339              :         AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_FOURPIPEINDUCTION,
    3340              :         AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_REHEAT,
    3341              :         AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_NOREHEAT,
    3342              :         AIRTERMINAL_SINGLEDUCT_MIXER,
    3343              :         AIRTERMINAL_SINGLEDUCT_PARALLELPIU_REHEAT,
    3344              :         AIRTERMINAL_SINGLEDUCT_SERIESPIU_REHEAT,
    3345              :         AIRTERMINAL_SINGLEDUCT_USERDEFINED,
    3346              :         AIRTERMINAL_SINGLEDUCT_VAV_HEATANDCOOL_NOREHEAT,
    3347              :         AIRTERMINAL_SINGLEDUCT_VAV_HEATANDCOOL_REHEAT,
    3348              :         AIRTERMINAL_SINGLEDUCT_VAV_NOREHEAT,
    3349              :         AIRTERMINAL_SINGLEDUCT_VAV_REHEAT,
    3350              :         AIRTERMINAL_SINGLEDUCT_VAV_REHEAT_VARIABLESPEEDFAN,
    3351              :         COIL_COOLING_DX,
    3352              :         COIL_COOLING_DX_MULTISPEED,
    3353              :         COIL_COOLING_DX_SINGLESPEED,
    3354              :         COIL_COOLING_DX_SINGLESPEED_THERMALSTORAGE,
    3355              :         COIL_COOLING_DX_TWOSPEED,
    3356              :         COIL_COOLING_DX_TWOSTAGEWITHHUMIDITYCONTROLMODE,
    3357              :         COIL_COOLING_DX_VARIABLESPEED,
    3358              :         COIL_INTEGRATED_DX_VARIABLESPEED,
    3359              :         COIL_COOLING_WATER,
    3360              :         COIL_COOLING_WATER_DETAILEDGEOMETRY,
    3361              :         COIL_COOLING_WATERTOAIRHEATPUMP_EQUATIONFIT,
    3362              :         COIL_COOLING_WATERTOAIRHEATPUMP_PARAMETERESTIMATION,
    3363              :         COIL_COOLING_WATERTOAIRHEATPUMP_VARIABLESPEEDEQUATIONFIT,
    3364              :         COIL_HEATING_DESUPERHEATER,
    3365              :         COIL_HEATING_DX_MULTISPEED,
    3366              :         COIL_HEATING_DX_SINGLESPEED,
    3367              :         COIL_HEATING_DX_VARIABLESPEED,
    3368              :         COIL_HEATING_ELECTRIC,
    3369              :         COIL_HEATING_ELECTRIC_MULTISTAGE,
    3370              :         COIL_HEATING_GAS,
    3371              :         COIL_HEATING_GAS_MULTISTAGE,
    3372              :         COIL_HEATING_STEAM,
    3373              :         COIL_HEATING_WATER,
    3374              :         COIL_HEATING_WATERTOAIRHEATPUMP_EQUATIONFIT,
    3375              :         COIL_HEATING_WATERTOAIRHEATPUMP_PARAMETERESTIMATION,
    3376              :         COIL_HEATING_WATERTOAIRHEATPUMP_VARIABLESPEEDEQUATIONFIT,
    3377              :         COIL_WATERHEATING_AIRTOWATERHEATPUMP_VARIABLESPEED,
    3378              :         COIL_USERDEFINED,
    3379              :         COILSYSTEM_COOLING_DX,
    3380              :         COILSYSTEM_COOLING_DX_HEATEXCHANGERASSISTED,
    3381              :         COILSYSTEM_COOLING_WATER_HEATEXCHANGERASSISTED,
    3382              :         COILSYSTEM_COOLING_WATER,
    3383              :         COILSYSTEM_HEATING_DX,
    3384              :         DEHUMIDIFIER_DESICCANT_NOFANS,
    3385              :         DEHUMIDIFIER_DESICCANT_SYSTEM,
    3386              :         DUCT,
    3387              :         EVAPORATIVECOOLER_DIRECT_CELDEKPAD,
    3388              :         EVAPORATIVECOOLER_DIRECT_RESEARCHSPECIAL,
    3389              :         EVAPORATIVECOOLER_INDIRECT_CELDEKPAD,
    3390              :         EVAPORATIVECOOLER_INDIRECT_RESEARCHSPECIAL,
    3391              :         EVAPORATIVECOOLER_INDIRECT_WETCOIL,
    3392              :         FAN_COMPONENTMODEL,
    3393              :         FAN_SYSTEMMODEL,
    3394              :         FAN_CONSTANTVOLUME,
    3395              :         FAN_ONOFF,
    3396              :         FAN_VARIABLEVOLUME,
    3397              :         HEATEXCHANGER_AIRTOAIR_FLATPLATE,
    3398              :         HEATEXCHANGER_AIRTOAIR_SENSIBLEANDLATENT,
    3399              :         HEATEXCHANGER_DESICCANT_BALANCEDFLOW,
    3400              :         HUMIDIFIER_STEAM_ELECTRIC,
    3401              :         HUMIDIFIER_STEAM_GAS,
    3402              :         OUTDOORAIR_MIXER,
    3403              :         SOLARCOLLECTOR_FLATPLATE_PHOTOVOLTAICTHERMAL,
    3404              :         SOLARCOLLECTOR_UNGLAZEDTRANSPIRED,
    3405              :         ZONEHVAC_AIRDISTRIBUTIONUNIT,
    3406              :         ZONEHVAC_TERMINALUNIT_VRF,
    3407              :         COIL_COOLING_VRF,
    3408              :         COIL_HEATING_VRF,
    3409              :         COIL_COOLING_VRF_FTC,
    3410              :         COIL_HEATING_VRF_FTC,
    3411              :         n_ComponentTypes,
    3412              :         Unknown_ComponentType
    3413              :     };
    3414              : 
    3415              :     static std::unordered_map<std::string, ComponentTypes> const component_map = {
    3416            0 :         {"AIRLOOPHVAC:OUTDOORAIRSYSTEM", AIRLOOPHVAC_OUTDOORAIRSYSTEM},
    3417            0 :         {"AIRLOOPHVAC:UNITARY:FURNACE:HEATCOOL", AIRLOOPHVAC_UNITARY_FURNACE_HEATCOOL},
    3418            0 :         {"AIRLOOPHVAC:UNITARY:FURNACE:HEATONLY", AIRLOOPHVAC_UNITARY_FURNACE_HEATONLY},
    3419            0 :         {"AIRLOOPHVAC:UNITARYHEATCOOL", AIRLOOPHVAC_UNITARYHEATCOOL},
    3420            0 :         {"AIRLOOPHVAC:UNITARYHEATCOOL:VAVCHANGEOVERBYPASS", AIRLOOPHVAC_UNITARYHEATCOOL_VAVCHANGEOVERBYPASS},
    3421            0 :         {"AIRLOOPHVAC:UNITARYHEATONLY", AIRLOOPHVAC_UNITARYHEATONLY},
    3422            0 :         {"AIRLOOPHVAC:UNITARYHEATPUMP:AIRTOAIR", AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR},
    3423            0 :         {"AIRLOOPHVAC:UNITARYHEATPUMP:AIRTOAIR:MULTISPEED", AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR_MULTISPEED},
    3424            0 :         {"AIRLOOPHVAC:UNITARYHEATPUMP:WATERTOAIR", AIRLOOPHVAC_UNITARYHEATPUMP_WATERTOAIR},
    3425            0 :         {"AIRLOOPHVAC:UNITARYSYSTEM", AIRLOOPHVAC_UNITARYSYSTEM},
    3426            0 :         {"AIRTERMINAL:DUALDUCT:CONSTANTVOLUME:COOL", AIRTERMINAL_DUALDUCT_CONSTANTVOLUME_COOL},
    3427            0 :         {"AIRTERMINAL:DUALDUCT:CONSTANTVOLUME:HEAT", AIRTERMINAL_DUALDUCT_CONSTANTVOLUME_HEAT},
    3428            0 :         {"AIRTERMINAL:DUALDUCT:VAV:COOL", AIRTERMINAL_DUALDUCT_VAV_COOL},
    3429            0 :         {"AIRTERMINAL:DUALDUCT:VAV:HEAT", AIRTERMINAL_DUALDUCT_VAV_HEAT},
    3430            0 :         {"AIRTERMINAL:DUALDUCT:VAV:OUTDOORAIR:OUTDOORAIR", AIRTERMINAL_DUALDUCT_VAV_OUTDOORAIR_OUTDOORAIR},
    3431            0 :         {"AIRTERMINAL:DUALDUCT:VAV:OUTDOORAIR:RECIRCULATEDAIR", AIRTERMINAL_DUALDUCT_VAV_OUTDOORAIR_RECIRCULATEDAIR},
    3432            0 :         {"AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:COOLEDBEAM", AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_COOLEDBEAM},
    3433            0 :         {"AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:FOURPIPEBEAM", AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_FOURPIPEBEAM},
    3434            0 :         {"AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:FOURPIPEINDUCTION", AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_FOURPIPEINDUCTION},
    3435            0 :         {"AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:REHEAT", AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_REHEAT},
    3436            0 :         {"AIRTERMINAL:SINGLEDUCT:CONSTANTVOLUME:NOREHEAT", AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_NOREHEAT},
    3437            0 :         {"AIRTERMINAL:SINGLEDUCT:MIXER", AIRTERMINAL_SINGLEDUCT_MIXER},
    3438            0 :         {"AIRTERMINAL:SINGLEDUCT:PARALLELPIU:REHEAT", AIRTERMINAL_SINGLEDUCT_PARALLELPIU_REHEAT},
    3439            0 :         {"AIRTERMINAL:SINGLEDUCT:SERIESPIU:REHEAT", AIRTERMINAL_SINGLEDUCT_SERIESPIU_REHEAT},
    3440            0 :         {"AIRTERMINAL:SINGLEDUCT:USERDEFINED", AIRTERMINAL_SINGLEDUCT_USERDEFINED},
    3441            0 :         {"AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:NOREHEAT", AIRTERMINAL_SINGLEDUCT_VAV_HEATANDCOOL_NOREHEAT},
    3442            0 :         {"AIRTERMINAL:SINGLEDUCT:VAV:HEATANDCOOL:REHEAT", AIRTERMINAL_SINGLEDUCT_VAV_HEATANDCOOL_REHEAT},
    3443            0 :         {"AIRTERMINAL:SINGLEDUCT:VAV:NOREHEAT", AIRTERMINAL_SINGLEDUCT_VAV_NOREHEAT},
    3444            0 :         {"AIRTERMINAL:SINGLEDUCT:VAV:REHEAT", AIRTERMINAL_SINGLEDUCT_VAV_REHEAT},
    3445            0 :         {"AIRTERMINAL:SINGLEDUCT:VAV:REHEAT:VARIABLESPEEDFAN", AIRTERMINAL_SINGLEDUCT_VAV_REHEAT_VARIABLESPEEDFAN},
    3446            0 :         {"COIL:COOLING:DX", COIL_COOLING_DX},
    3447            0 :         {"COIL:COOLING:DX:MULTISPEED", COIL_COOLING_DX_MULTISPEED},
    3448            0 :         {"COIL:COOLING:DX:SINGLESPEED", COIL_COOLING_DX_SINGLESPEED},
    3449            0 :         {"COIL:COOLING:DX:SINGLESPEED:THERMALSTORAGE", COIL_COOLING_DX_SINGLESPEED_THERMALSTORAGE},
    3450            0 :         {"COIL:COOLING:DX:TWOSPEED", COIL_COOLING_DX_TWOSPEED},
    3451            0 :         {"COIL:COOLING:DX:TWOSTAGEWITHHUMIDITYCONTROLMODE", COIL_COOLING_DX_TWOSTAGEWITHHUMIDITYCONTROLMODE},
    3452            0 :         {"COIL:COOLING:DX:VARIABLESPEED", COIL_COOLING_DX_VARIABLESPEED},
    3453            0 :         {"COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE", COIL_INTEGRATED_DX_VARIABLESPEED},
    3454            0 :         {"COIL:COOLING:WATER", COIL_COOLING_WATER},
    3455            0 :         {"COIL:COOLING:WATER:DETAILEDGEOMETRY", COIL_COOLING_WATER_DETAILEDGEOMETRY},
    3456            0 :         {"COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT", COIL_COOLING_WATERTOAIRHEATPUMP_EQUATIONFIT},
    3457            0 :         {"COIL:COOLING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION", COIL_COOLING_WATERTOAIRHEATPUMP_PARAMETERESTIMATION},
    3458            0 :         {"COIL:COOLING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", COIL_COOLING_WATERTOAIRHEATPUMP_VARIABLESPEEDEQUATIONFIT},
    3459            0 :         {"COIL:HEATING:DESUPERHEATER", COIL_HEATING_DESUPERHEATER},
    3460            0 :         {"COIL:HEATING:DX:MULTISPEED", COIL_HEATING_DX_MULTISPEED},
    3461            0 :         {"COIL:HEATING:DX:SINGLESPEED", COIL_HEATING_DX_SINGLESPEED},
    3462            0 :         {"COIL:HEATING:DX:VARIABLESPEED", COIL_HEATING_DX_VARIABLESPEED},
    3463            0 :         {"COIL:HEATING:ELECTRIC", COIL_HEATING_ELECTRIC},
    3464            0 :         {"COIL:HEATING:ELECTRIC:MULTISTAGE", COIL_HEATING_ELECTRIC_MULTISTAGE},
    3465            0 :         {"COIL:HEATING:FUEL", COIL_HEATING_GAS},
    3466            0 :         {"COIL:HEATING:GAS:MULTISTAGE", COIL_HEATING_GAS_MULTISTAGE},
    3467            0 :         {"COIL:HEATING:STEAM", COIL_HEATING_STEAM},
    3468            0 :         {"COIL:HEATING:WATER", COIL_HEATING_WATER},
    3469            0 :         {"COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT", COIL_HEATING_WATERTOAIRHEATPUMP_EQUATIONFIT},
    3470            0 :         {"COIL:HEATING:WATERTOAIRHEATPUMP:PARAMETERESTIMATION", COIL_HEATING_WATERTOAIRHEATPUMP_PARAMETERESTIMATION},
    3471            0 :         {"COIL:HEATING:WATERTOAIRHEATPUMP:VARIABLESPEEDEQUATIONFIT", COIL_HEATING_WATERTOAIRHEATPUMP_VARIABLESPEEDEQUATIONFIT},
    3472            0 :         {"COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED", COIL_WATERHEATING_AIRTOWATERHEATPUMP_VARIABLESPEED},
    3473            0 :         {"COIL:USERDEFINED", COIL_USERDEFINED},
    3474            0 :         {"COILSYSTEM:COOLING:DX", COILSYSTEM_COOLING_DX},
    3475            0 :         {"COILSYSTEM:COOLING:DX:HEATEXCHANGERASSISTED", COILSYSTEM_COOLING_DX_HEATEXCHANGERASSISTED},
    3476            0 :         {"COILSYSTEM:COOLING:WATER:HEATEXCHANGERASSISTED", COILSYSTEM_COOLING_WATER_HEATEXCHANGERASSISTED},
    3477            0 :         {"COILSYSTEM:COOLING:WATER", COILSYSTEM_COOLING_WATER},
    3478            0 :         {"COILSYSTEM:HEATING:DX", COILSYSTEM_HEATING_DX},
    3479            0 :         {"DEHUMIDIFIER:DESICCANT:NOFANS", DEHUMIDIFIER_DESICCANT_NOFANS},
    3480            0 :         {"DEHUMIDIFIER:DESICCANT:SYSTEM", DEHUMIDIFIER_DESICCANT_SYSTEM},
    3481            0 :         {"DUCT", DUCT},
    3482            0 :         {"EVAPORATIVECOOLER:DIRECT:CELDEKPAD", EVAPORATIVECOOLER_DIRECT_CELDEKPAD},
    3483            0 :         {"EVAPORATIVECOOLER:DIRECT:RESEARCHSPECIAL", EVAPORATIVECOOLER_DIRECT_RESEARCHSPECIAL},
    3484            0 :         {"EVAPORATIVECOOLER:INDIRECT:CELDEKPAD", EVAPORATIVECOOLER_INDIRECT_CELDEKPAD},
    3485            0 :         {"EVAPORATIVECOOLER:INDIRECT:RESEARCHSPECIAL", EVAPORATIVECOOLER_INDIRECT_RESEARCHSPECIAL},
    3486            0 :         {"EVAPORATIVECOOLER:INDIRECT:WETCOIL", EVAPORATIVECOOLER_INDIRECT_WETCOIL},
    3487            0 :         {"FAN:COMPONENTMODEL", FAN_COMPONENTMODEL},
    3488            0 :         {"FAN:SYSTEMMODEL", FAN_SYSTEMMODEL},
    3489            0 :         {"FAN:CONSTANTVOLUME", FAN_CONSTANTVOLUME},
    3490            0 :         {"FAN:ONOFF", FAN_ONOFF},
    3491            0 :         {"FAN:VARIABLEVOLUME", FAN_VARIABLEVOLUME},
    3492            0 :         {"HEATEXCHANGER:AIRTOAIR:FLATPLATE", HEATEXCHANGER_AIRTOAIR_FLATPLATE},
    3493            0 :         {"HEATEXCHANGER:AIRTOAIR:SENSIBLEANDLATENT", HEATEXCHANGER_AIRTOAIR_SENSIBLEANDLATENT},
    3494            0 :         {"HEATEXCHANGER:DESICCANT:BALANCEDFLOW", HEATEXCHANGER_DESICCANT_BALANCEDFLOW},
    3495            0 :         {"HUMIDIFIER:STEAM:ELECTRIC", HUMIDIFIER_STEAM_ELECTRIC},
    3496            0 :         {"HUMIDIFIER:STEAM:GAS", HUMIDIFIER_STEAM_GAS},
    3497            0 :         {"OUTDOORAIR:MIXER", OUTDOORAIR_MIXER},
    3498            0 :         {"SOLARCOLLECTOR:FLATPLATE:PHOTOVOLTAICTHERMAL", SOLARCOLLECTOR_FLATPLATE_PHOTOVOLTAICTHERMAL},
    3499            0 :         {"SOLARCOLLECTOR:UNGLAZEDTRANSPIRED", SOLARCOLLECTOR_UNGLAZEDTRANSPIRED},
    3500            0 :         {"ZONEHVAC:AIRDISTRIBUTIONUNIT", ZONEHVAC_AIRDISTRIBUTIONUNIT},
    3501            0 :         {"ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW", ZONEHVAC_TERMINALUNIT_VRF},
    3502            0 :         {"COIL:COOLING:DX:VARIABLEREFRIGERANTFLOW", COIL_COOLING_VRF},
    3503            0 :         {"COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW", COIL_HEATING_VRF},
    3504            0 :         {"COIL:COOLING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", COIL_COOLING_VRF_FTC},
    3505     18543557 :         {"COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", COIL_HEATING_VRF_FTC}};
    3506     18493417 :     assert(component_map.size() == n_ComponentTypes);
    3507              : 
    3508     18493417 :     if (!state.dataSysRpts->AirLoopLoadsReportEnabled) {
    3509            0 :         return;
    3510              :     }
    3511     18493417 :     auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(AirLoopNum);
    3512              : 
    3513              :     // Find enum for the component type string
    3514              :     ComponentTypes comp_type;
    3515     18493417 :     auto const it = component_map.find(CompType);
    3516     18493417 :     if (it != component_map.end()) {
    3517     18493417 :         comp_type = it->second;
    3518              :     } else {
    3519            0 :         comp_type = Unknown_ComponentType;
    3520              :     }
    3521              : 
    3522     18493417 :     switch (comp_type) {
    3523       540315 :     case AIRLOOPHVAC_OUTDOORAIRSYSTEM: // Outside Air System
    3524              :         // Not reported
    3525       540315 :         break;
    3526       541320 :     case OUTDOORAIR_MIXER: // Outdoor Air Mixer
    3527              :         // No energy transfers to account for
    3528       541320 :         break;
    3529        27248 :     case AIRTERMINAL_SINGLEDUCT_MIXER:
    3530              :         // No energy transfers to account for
    3531        27248 :         break;
    3532      1225914 :     case FAN_CONSTANTVOLUME:
    3533              :     case FAN_VARIABLEVOLUME:
    3534              :     case FAN_ONOFF:
    3535              :     case FAN_SYSTEMMODEL:
    3536              :     case FAN_COMPONENTMODEL:
    3537              : 
    3538      1225914 :         if (CompLoadFlag) {
    3539       612957 :             thisSysLoadRepVars.FANCompHTNG += std::abs(CompLoad);
    3540              :         }
    3541      1225914 :         thisSysLoadRepVars.FANCompElec += CompEnergy;
    3542              : 
    3543              :         // Cooling Coil Types for the air sys simulation
    3544      1225914 :         break;
    3545      2313256 :     case COILSYSTEM_COOLING_DX_HEATEXCHANGERASSISTED:
    3546              :     case COIL_COOLING_DX_SINGLESPEED:
    3547              :     case COIL_COOLING_DX_TWOSPEED:
    3548              :     case COIL_COOLING_DX_TWOSTAGEWITHHUMIDITYCONTROLMODE:
    3549              :     case COIL_COOLING_DX:
    3550              :     case COIL_COOLING_DX_MULTISPEED:
    3551              :     case COIL_COOLING_WATERTOAIRHEATPUMP_EQUATIONFIT:
    3552              :     case COIL_COOLING_WATERTOAIRHEATPUMP_PARAMETERESTIMATION:
    3553              :     case COIL_COOLING_WATERTOAIRHEATPUMP_VARIABLESPEEDEQUATIONFIT:
    3554              :     case COIL_COOLING_DX_VARIABLESPEED:
    3555              :     case COILSYSTEM_COOLING_WATER_HEATEXCHANGERASSISTED:
    3556              :     case COILSYSTEM_COOLING_WATER:
    3557              :     case COIL_COOLING_WATER_DETAILEDGEOMETRY:
    3558              :     case COIL_COOLING_WATER:
    3559              :     case COIL_COOLING_DX_SINGLESPEED_THERMALSTORAGE:
    3560              :     case COIL_COOLING_VRF:
    3561              :     case COIL_COOLING_VRF_FTC:
    3562              :     case COIL_WATERHEATING_AIRTOWATERHEATPUMP_VARIABLESPEED:
    3563              : 
    3564      2313256 :         if (CompLoadFlag) {
    3565       669340 :             thisSysLoadRepVars.CCCompCLNG += std::abs(CompLoad);
    3566              :         }
    3567      2313256 :         if ((EnergyType == Constant::eResource::PlantLoopCoolingDemand) || (EnergyType == Constant::eResource::DistrictCooling)) {
    3568       322404 :             thisSysLoadRepVars.CCCompH2OCOLD += CompEnergy;
    3569      1990852 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3570       650880 :             thisSysLoadRepVars.CCCompElec += CompEnergy;
    3571              :         }
    3572              : 
    3573              :         // Heating Coil Types for the air sys simulation
    3574      2313256 :         break;
    3575      7231886 :     case COIL_HEATING_WATER:
    3576              :     case COIL_HEATING_DX_SINGLESPEED:
    3577              :     case COIL_HEATING_DX_MULTISPEED:
    3578              :     case COIL_HEATING_WATERTOAIRHEATPUMP_EQUATIONFIT:
    3579              :     case COIL_HEATING_WATERTOAIRHEATPUMP_PARAMETERESTIMATION:
    3580              :     case COIL_HEATING_WATERTOAIRHEATPUMP_VARIABLESPEEDEQUATIONFIT:
    3581              :     case COIL_HEATING_DX_VARIABLESPEED:
    3582              :     case COIL_HEATING_STEAM:
    3583              :     case COIL_HEATING_GAS:
    3584              :     case COIL_HEATING_GAS_MULTISTAGE:
    3585              :     case COIL_HEATING_DESUPERHEATER:
    3586              : 
    3587      7231886 :         if (CompLoadFlag) {
    3588      2145387 :             thisSysLoadRepVars.HCCompHTNG += std::abs(CompLoad);
    3589              :         }
    3590      7231886 :         if ((EnergyType == Constant::eResource::PlantLoopHeatingDemand) || (EnergyType == Constant::eResource::DistrictHeatingWater)) {
    3591      1756123 :             thisSysLoadRepVars.HCCompH2OHOT += CompEnergy;
    3592      5475763 :         } else if (EnergyType == Constant::eResource::DistrictHeatingSteam) {
    3593            0 :             thisSysLoadRepVars.HCCompSteam += CompEnergy;
    3594      5475763 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3595       570501 :             thisSysLoadRepVars.HCCompElec += CompEnergy;
    3596      4905262 :         } else if (EnergyType == Constant::eResource::NaturalGas) {
    3597       613834 :             thisSysLoadRepVars.HCCompNaturalGas += CompEnergy;
    3598      4291428 :         } else if (EnergyType == Constant::eResource::Propane) {
    3599            0 :             thisSysLoadRepVars.HCCompPropane += CompEnergy;
    3600              :         }
    3601              : 
    3602      7231886 :         break;
    3603       722955 :     case COIL_HEATING_ELECTRIC:
    3604              :     case COIL_HEATING_ELECTRIC_MULTISTAGE:
    3605              : 
    3606       722955 :         if (CompLoadFlag) {
    3607       240985 :             thisSysLoadRepVars.HCCompHTNG += std::abs(CompLoad);
    3608              :         }
    3609       722955 :         if (EnergyType == Constant::eResource::Electricity) {
    3610       240985 :             thisSysLoadRepVars.HCCompElecRes += CompEnergy;
    3611              :         }
    3612              : 
    3613       722955 :         break;
    3614         4536 :     case COIL_USERDEFINED:
    3615              : 
    3616         4536 :         if (CompLoadFlag) {
    3617         4536 :             if (CompLoad > 0.0) {
    3618         2640 :                 thisSysLoadRepVars.CCCompCLNG += std::abs(CompLoad);
    3619              :             } else {
    3620         1896 :                 thisSysLoadRepVars.HCCompHTNG += std::abs(CompLoad);
    3621              :             }
    3622              :         }
    3623         4536 :         if ((EnergyType == Constant::eResource::PlantLoopHeatingDemand) || (EnergyType == Constant::eResource::DistrictHeatingWater)) {
    3624            0 :             thisSysLoadRepVars.HCCompH2OHOT += CompEnergy;
    3625         4536 :         } else if ((EnergyType == Constant::eResource::PlantLoopCoolingDemand) || (EnergyType == Constant::eResource::DistrictCooling)) {
    3626            0 :             thisSysLoadRepVars.CCCompH2OCOLD += CompEnergy;
    3627         4536 :         } else if (EnergyType == Constant::eResource::DistrictHeatingSteam) {
    3628            0 :             thisSysLoadRepVars.HCCompSteam += CompEnergy;
    3629         4536 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3630            0 :             if (CompLoad > 0.0) {
    3631            0 :                 thisSysLoadRepVars.CCCompElec += CompEnergy;
    3632              :             } else {
    3633            0 :                 thisSysLoadRepVars.HCCompElec += CompEnergy;
    3634              :             }
    3635         4536 :         } else if (EnergyType == Constant::eResource::NaturalGas) {
    3636            0 :             thisSysLoadRepVars.HCCompNaturalGas += CompEnergy;
    3637         4536 :         } else if (EnergyType == Constant::eResource::Propane) {
    3638            0 :             thisSysLoadRepVars.HCCompPropane += CompEnergy;
    3639              :         }
    3640              : 
    3641              :         // DX Systems
    3642         4536 :         break;
    3643       476338 :     case COIL_HEATING_VRF:
    3644              :     case COIL_HEATING_VRF_FTC:
    3645              :     case AIRLOOPHVAC_UNITARYSYSTEM:
    3646              :         // All energy transfers accounted for in subcomponent models
    3647       476338 :         break;
    3648         9785 :     case AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR:
    3649              :         // All energy transfers accounted for in subcomponent models
    3650         9785 :         break;
    3651        27572 :     case AIRLOOPHVAC_UNITARYHEATPUMP_WATERTOAIR:
    3652              :         // All energy transfers accounted for in subcomponent models
    3653        27572 :         break;
    3654       107441 :     case COILSYSTEM_COOLING_DX:
    3655              :         // All energy transfers accounted for in subcomponent models
    3656       107441 :         break;
    3657          576 :     case COILSYSTEM_HEATING_DX:
    3658              :         // All energy transfers accounted for in subcomponent models
    3659          576 :         break;
    3660          727 :     case AIRLOOPHVAC_UNITARY_FURNACE_HEATONLY:
    3661              :         // All energy transfers accounted for in subcomponent models
    3662          727 :         break;
    3663        25253 :     case AIRLOOPHVAC_UNITARY_FURNACE_HEATCOOL:
    3664              :         // All energy transfers accounted for in subcomponent models
    3665        25253 :         break;
    3666           73 :     case AIRLOOPHVAC_UNITARYHEATONLY:
    3667              :         // All energy transfers accounted for in subcomponent models
    3668           73 :         break;
    3669        37079 :     case AIRLOOPHVAC_UNITARYHEATCOOL:
    3670              :         // All energy transfers accounted for in subcomponent models
    3671        37079 :         break;
    3672          939 :     case AIRLOOPHVAC_UNITARYHEATCOOL_VAVCHANGEOVERBYPASS:
    3673              :         // All energy transfers accounted for in subcomponent models
    3674          939 :         break;
    3675        16887 :     case AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR_MULTISPEED:
    3676              :         // All energy transfers accounted for in subcomponent models
    3677        16887 :         break;
    3678          396 :     case ZONEHVAC_TERMINALUNIT_VRF:
    3679              :         // All energy transfers accounted for in subcomponent models
    3680          396 :         break;
    3681              :         // Humidifier Types for the air system simulation
    3682        58422 :     case HUMIDIFIER_STEAM_GAS:
    3683              :     case HUMIDIFIER_STEAM_ELECTRIC:
    3684        58422 :         if (CompLoadFlag) {
    3685        14553 :             thisSysLoadRepVars.HumidHTNG += std::abs(CompLoad);
    3686              :         }
    3687        58422 :         if (EnergyType == Constant::eResource::Water) {
    3688        14553 :             thisSysLoadRepVars.DomesticH2O += std::abs(CompEnergy);
    3689        43869 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3690        14553 :             thisSysLoadRepVars.HumidElec += CompEnergy;
    3691        29316 :         } else if (EnergyType == Constant::eResource::NaturalGas) {
    3692          210 :             thisSysLoadRepVars.HumidNaturalGas += CompEnergy;
    3693        29106 :         } else if (EnergyType == Constant::eResource::Propane) {
    3694            0 :             thisSysLoadRepVars.HumidPropane += CompEnergy;
    3695              :         }
    3696              : 
    3697              :         // Evap Cooler Types for the air system simulation
    3698        58422 :         break;
    3699        53936 :     case EVAPORATIVECOOLER_DIRECT_CELDEKPAD:
    3700              :     case EVAPORATIVECOOLER_INDIRECT_CELDEKPAD:
    3701              :     case EVAPORATIVECOOLER_INDIRECT_WETCOIL:
    3702              :     case EVAPORATIVECOOLER_DIRECT_RESEARCHSPECIAL:
    3703              :     case EVAPORATIVECOOLER_INDIRECT_RESEARCHSPECIAL:
    3704        53936 :         if (CompLoadFlag) {
    3705        13484 :             thisSysLoadRepVars.EvapCLNG += std::abs(CompLoad);
    3706              :         }
    3707        53936 :         if (EnergyType == Constant::eResource::Water) {
    3708        13484 :             thisSysLoadRepVars.DomesticH2O += std::abs(CompEnergy);
    3709        40452 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3710        13484 :             thisSysLoadRepVars.EvapElec += CompEnergy;
    3711              :         }
    3712              : 
    3713              :         // Desiccant Dehumidifier Types for the air system simulation
    3714        53936 :         break;
    3715         4244 :     case DEHUMIDIFIER_DESICCANT_NOFANS:
    3716              :     case DEHUMIDIFIER_DESICCANT_SYSTEM:
    3717         4244 :         if (CompLoadFlag) {
    3718         2501 :             thisSysLoadRepVars.DesDehumidCLNG += std::abs(CompLoad);
    3719              :         }
    3720         4244 :         if (EnergyType == Constant::eResource::Electricity) {
    3721         1743 :             thisSysLoadRepVars.DesDehumidElec += CompEnergy;
    3722              :         }
    3723              : 
    3724              :         // Heat Exchanger Types
    3725         4244 :         break;
    3726        50444 :     case HEATEXCHANGER_AIRTOAIR_FLATPLATE:
    3727              :     case HEATEXCHANGER_AIRTOAIR_SENSIBLEANDLATENT:
    3728              :     case HEATEXCHANGER_DESICCANT_BALANCEDFLOW:
    3729        50444 :         if (CompLoadFlag) {
    3730        12611 :             if (CompLoad > 0.0) {
    3731         4373 :                 thisSysLoadRepVars.HeatExCLNG += std::abs(CompLoad);
    3732              :             } else {
    3733         8238 :                 thisSysLoadRepVars.HeatExHTNG += std::abs(CompLoad);
    3734              :             }
    3735              :         }
    3736              : 
    3737              :         // Air Terminal Types
    3738        50444 :         break;
    3739      4996266 :     case AIRTERMINAL_DUALDUCT_CONSTANTVOLUME_COOL:
    3740              :     case AIRTERMINAL_DUALDUCT_CONSTANTVOLUME_HEAT:
    3741              :     case AIRTERMINAL_DUALDUCT_VAV_COOL:
    3742              :     case AIRTERMINAL_DUALDUCT_VAV_HEAT:
    3743              :     case AIRTERMINAL_DUALDUCT_VAV_OUTDOORAIR_OUTDOORAIR:
    3744              :     case AIRTERMINAL_DUALDUCT_VAV_OUTDOORAIR_RECIRCULATEDAIR:
    3745              :     case AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_FOURPIPEINDUCTION:
    3746              :     case AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_REHEAT:
    3747              :     case AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_NOREHEAT:
    3748              :     case AIRTERMINAL_SINGLEDUCT_PARALLELPIU_REHEAT:
    3749              :     case AIRTERMINAL_SINGLEDUCT_SERIESPIU_REHEAT:
    3750              :     case AIRTERMINAL_SINGLEDUCT_VAV_HEATANDCOOL_NOREHEAT:
    3751              :     case AIRTERMINAL_SINGLEDUCT_VAV_HEATANDCOOL_REHEAT:
    3752              :     case AIRTERMINAL_SINGLEDUCT_VAV_NOREHEAT:
    3753              :     case AIRTERMINAL_SINGLEDUCT_VAV_REHEAT:
    3754              :     case AIRTERMINAL_SINGLEDUCT_VAV_REHEAT_VARIABLESPEEDFAN:
    3755              :     case AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_COOLEDBEAM:
    3756              :     case AIRTERMINAL_SINGLEDUCT_CONSTANTVOLUME_FOURPIPEBEAM:
    3757              :     case ZONEHVAC_AIRDISTRIBUTIONUNIT:
    3758              :         // All energy transfers accounted for in component models
    3759              : 
    3760              :         // Duct Types
    3761      4996266 :         break;
    3762          881 :     case DUCT:
    3763              :         // duct losses should be accounted for here ???
    3764              :         // requires addition of a new variable to sum duct losses
    3765              :         // Example:
    3766              :         //      IF(CompLoad > 0.0d0)THEN
    3767              :         //        SysDuctHTNG =  SysDuctHTNG + ABS(CompLoad)
    3768              :         //      ELSE
    3769              :         //        SysDuctCLNG =  SysDuctCLNG + ABS(CompLoad)
    3770              :         //      ENDIF
    3771              : 
    3772              :         // Solar Collector Types
    3773          881 :         break;
    3774        10556 :     case SOLARCOLLECTOR_FLATPLATE_PHOTOVOLTAICTHERMAL:
    3775              :     case SOLARCOLLECTOR_UNGLAZEDTRANSPIRED:
    3776        10556 :         if (CompLoadFlag) {
    3777         5278 :             if (CompLoad > 0.0) {
    3778          886 :                 thisSysLoadRepVars.SolarCollectCooling += std::abs(CompLoad);
    3779              :             } else {
    3780         4392 :                 thisSysLoadRepVars.SolarCollectHeating += std::abs(CompLoad);
    3781              :             }
    3782              :         }
    3783              : 
    3784        10556 :         break;
    3785         7560 :     case AIRTERMINAL_SINGLEDUCT_USERDEFINED:
    3786              :         // User component model energy use should be accounted for here
    3787         7560 :         if (CompLoadFlag) {
    3788         7560 :             if (CompLoad > 0.0) {
    3789            0 :                 thisSysLoadRepVars.UserDefinedTerminalCooling += std::abs(CompLoad);
    3790              :             } else {
    3791         7560 :                 thisSysLoadRepVars.UserDefinedTerminalHeating += std::abs(CompLoad);
    3792              :             }
    3793              :         }
    3794         7560 :         if ((EnergyType == Constant::eResource::PlantLoopHeatingDemand) || (EnergyType == Constant::eResource::DistrictHeatingWater)) {
    3795            0 :             thisSysLoadRepVars.HCCompH2OHOT += CompEnergy;
    3796         7560 :         } else if ((EnergyType == Constant::eResource::PlantLoopCoolingDemand) || (EnergyType == Constant::eResource::DistrictCooling)) {
    3797            0 :             thisSysLoadRepVars.CCCompH2OCOLD += CompEnergy;
    3798         7560 :         } else if (EnergyType == Constant::eResource::DistrictHeatingSteam) {
    3799            0 :             thisSysLoadRepVars.HCCompSteam += CompEnergy;
    3800         7560 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3801            0 :             if (CompLoad > 0.0) {
    3802            0 :                 thisSysLoadRepVars.CCCompElec += CompEnergy;
    3803              :             } else {
    3804            0 :                 thisSysLoadRepVars.HCCompElec += CompEnergy;
    3805              :             }
    3806         7560 :         } else if (EnergyType == Constant::eResource::NaturalGas) {
    3807            0 :             thisSysLoadRepVars.HCCompNaturalGas += CompEnergy;
    3808         7560 :         } else if (EnergyType == Constant::eResource::Propane) {
    3809            0 :             thisSysLoadRepVars.HCCompPropane += CompEnergy;
    3810              :         }
    3811              :         // Recurring warning for unaccounted equipment types
    3812              :         // (should never happen, when this does happen enter appropriate equipment CASE statement above)
    3813         7560 :         break;
    3814          612 :     case COIL_INTEGRATED_DX_VARIABLESPEED:
    3815              :         // All energy transfers accounted for in component models
    3816          612 :         break;
    3817            0 :     default:
    3818            0 :         int found = 0;
    3819            0 :         if (state.dataSysRpts->NumCompTypes > 0) {
    3820            0 :             found = Util::FindItemInList(CompType, state.dataSysRpts->CompTypeErrors, &CompTypeError::CompType, state.dataSysRpts->NumCompTypes);
    3821              :         }
    3822            0 :         if (found == 0) {
    3823            0 :             state.dataSysRpts->CompTypeErrors(++state.dataSysRpts->NumCompTypes).CompType = CompType;
    3824            0 :             found = state.dataSysRpts->NumCompTypes;
    3825              :         }
    3826            0 :         ShowRecurringSevereErrorAtEnd(state,
    3827            0 :                                       "CalcSystemEnergyUse: Component Type=" + CompType + " not logged as one of allowable Component Types.",
    3828            0 :                                       state.dataSysRpts->CompTypeErrors(found).CompErrIndex);
    3829            0 :         break;
    3830              :     } // switch
    3831     18493962 : }
    3832              : 
    3833       624375 : void ReportVentilationLoads(EnergyPlusData &state)
    3834              : {
    3835              :     // SUBROUTINE INFORMATION:
    3836              :     //       AUTHOR         Dan Fisher (with minor assistance from RKS)
    3837              :     //       DATE WRITTEN   July 2004
    3838              :     //       MODIFIED       Dec. 2006, BG. reengineered to add zone forced air units to vent rates and loads
    3839              : 
    3840              :     // PURPOSE OF THIS SUBROUTINE:
    3841              :     // calculate and report zone ventilation loads
    3842              : 
    3843              :     // METHODOLOGY EMPLOYED:
    3844              :     // calculate energy contribution of outside air through mixing box and pro-rate to
    3845              :     // zones according to zone mass flow rates.
    3846              : 
    3847       624375 :     Real64 constexpr SmallLoad(0.1); // (W)
    3848              : 
    3849       624375 :     auto &Node = state.dataLoopNodes->Node;
    3850       624375 :     Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys;
    3851       624375 :     Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
    3852              : 
    3853       624375 :     if (!state.dataSysRpts->VentReportStructureCreated) {
    3854            0 :         return;
    3855              :     }
    3856       624375 :     if (!state.dataSysRpts->VentLoadsReportEnabled) {
    3857            0 :         return;
    3858              :     }
    3859              :     // following inits are array assignments across all controlled zones.
    3860      4136232 :     for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    3861      3511857 :         auto &thisZoneVentRepVars = state.dataSysRpts->ZoneVentRepVars(zoneNum);
    3862      3511857 :         if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) {
    3863       490019 :             continue;
    3864              :         }
    3865      3021838 :         thisZoneVentRepVars.OAMassFlow = 0.0;
    3866      3021838 :         thisZoneVentRepVars.OAMass = 0.0;
    3867      3021838 :         thisZoneVentRepVars.OAVolFlowStdRho = 0.0;
    3868      3021838 :         thisZoneVentRepVars.OAVolStdRho = 0.0;
    3869      3021838 :         thisZoneVentRepVars.OAVolFlowCrntRho = 0.0;
    3870      3021838 :         thisZoneVentRepVars.OAVolCrntRho = 0.0;
    3871      3021838 :         thisZoneVentRepVars.MechACH = 0.0;
    3872      3021838 :         thisZoneVentRepVars.TargetVentilationFlowVoz = 0.0;
    3873      3021838 :         thisZoneVentRepVars.TimeBelowVozDyn = 0.0;
    3874      3021838 :         thisZoneVentRepVars.TimeAtVozDyn = 0.0;
    3875      3021838 :         thisZoneVentRepVars.TimeAboveVozDyn = 0.0;
    3876      3021838 :         thisZoneVentRepVars.TimeVentUnocc = 0.0;
    3877      3021838 :         thisZoneVentRepVars.CoolingLoadMetByVent = 0.0;
    3878      3021838 :         thisZoneVentRepVars.CoolingLoadAddedByVent = 0.0;
    3879      3021838 :         thisZoneVentRepVars.OvercoolingByVent = 0.0;
    3880      3021838 :         thisZoneVentRepVars.HeatingLoadMetByVent = 0.0;
    3881      3021838 :         thisZoneVentRepVars.HeatingLoadAddedByVent = 0.0;
    3882      3021838 :         thisZoneVentRepVars.OverheatingByVent = 0.0;
    3883      3021838 :         thisZoneVentRepVars.NoLoadHeatingByVent = 0.0;
    3884      3021838 :         thisZoneVentRepVars.NoLoadCoolingByVent = 0.0;
    3885              :     }
    3886              : 
    3887       624375 :     state.dataSysRpts->AnyZoneTimeBelowVozDyn = 0.0;
    3888       624375 :     state.dataSysRpts->AllZonesTimeAtVozDyn = 0.0;
    3889       624375 :     state.dataSysRpts->AnyZoneTimeAboveVozDyn = 0.0;
    3890       624375 :     state.dataSysRpts->AnyZoneTimeVentUnocc = 0.0;
    3891       624375 :     state.dataSysRpts->AnyZoneTimeBelowVozDynOcc = 0.0;
    3892       624375 :     state.dataSysRpts->AllZonesTimeAtVozDynOcc = 0.0;
    3893       624375 :     state.dataSysRpts->AnyZoneTimeAboveVozDynOcc = 0.0;
    3894              : 
    3895      1487079 :     for (int sysNum = 1; sysNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++sysNum) {
    3896       862704 :         auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysNum);
    3897       862704 :         thisSysVentRepVars.MechVentFlow = 0.0;
    3898       862704 :         thisSysVentRepVars.NatVentFlow = 0.0;
    3899       862704 :         thisSysVentRepVars.TargetVentilationFlowVoz = 0.0;
    3900       862704 :         thisSysVentRepVars.TimeBelowVozDyn = 0.0;
    3901       862704 :         thisSysVentRepVars.TimeAtVozDyn = 0.0;
    3902       862704 :         thisSysVentRepVars.TimeAboveVozDyn = 0.0;
    3903       862704 :         thisSysVentRepVars.TimeVentUnocc = 0.0;
    3904       862704 :         thisSysVentRepVars.AnyZoneOccupied = false;
    3905              :     }
    3906              : 
    3907      4136232 :     for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    3908      3511857 :         auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
    3909      3511857 :         if (!thisZoneEquipConfig.IsControlled) {
    3910       490019 :             continue;
    3911              :         }
    3912              : 
    3913      3021838 :         Real64 ZAirSysZoneVentLoad = 0.0; // ventilation load attributed to a particular zone from all primary air systems serving the zone [J]
    3914      3021838 :         Real64 ZAirSysOutAirFlow = 0.0;   // outside air flow rate for zone from all primary air systems serving the zone [kg/s]
    3915      3021838 :         Real64 ZFAUFlowRate = 0.0;        // Zone forced Air unit air mass flow rate [kg/s]
    3916      3021838 :         Real64 ZFAUZoneVentLoad = 0.0;    // ventilation load attributed to a particular zone from zone forced air units [J]
    3917      3021838 :         Real64 ZFAUOutAirFlow = 0.0;      // outside air flow rate for zone from zone forced air units. [kg/s]
    3918      3021838 :         Real64 OutAirFlow = 0.0;          // Total outside air mass flow from zone equipment and air loop equipment [kg/s]
    3919      3021838 :         Real64 ZoneFlowFrac = 0.0;        // fraction of mixed air flowing to a zone
    3920      3021838 :         Real64 ZFAUEnthReturnAir = 0.0;   // Zone forced Air unit enthalpy of the return air [kJ/kgK]
    3921      3021838 :         Real64 ZFAUTempMixedAir = 0.0;    // Zone forced Air unit dry-bulb temperature of the mixed air [C]
    3922      3021838 :         Real64 ZFAUHumRatMixedAir = 0.0;  // Zone forced Air unit humidity ratio of the mixed air [kg/kg]
    3923      3021838 :         Real64 ZFAUEnthMixedAir = 0.0;    // Zone forced Air unit enthalpy of the mixed air [kJ/kgK]
    3924      3021838 :         Real64 ZFAUEnthOutdoorAir = 0.0;  // Zone forced Air unit enthalpy of the outdoor air [kJ/kgK]
    3925              : 
    3926              :         // retrieve the zone load for each zone
    3927      3021838 :         Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    3928      3021838 :         auto const &thisZone = state.dataHeatBal->Zone(CtrlZoneNum);
    3929      3021838 :         int const zoneMult = thisZone.Multiplier * thisZone.ListMultiplier;
    3930      3021838 :         Real64 const ZoneVolume = thisZone.Volume * zoneMult; // CR 7170
    3931              : 
    3932      3021838 :         bool constexpr UseOccSchFlag = true;
    3933      3021838 :         bool constexpr UseMinOASchFlag = true;
    3934              : 
    3935      3021838 :         auto &thisZonePredefRep = state.dataHeatBal->ZonePreDefRep(CtrlZoneNum);
    3936      3021838 :         auto &thisZoneVentRepVars = state.dataSysRpts->ZoneVentRepVars(CtrlZoneNum);
    3937      3021838 :         thisZoneVentRepVars.TargetVentilationFlowVoz = DataSizing::calcDesignSpecificationOutdoorAir(
    3938              :             state, thisZoneEquipConfig.ZoneDesignSpecOAIndex, CtrlZoneNum, UseOccSchFlag, UseMinOASchFlag);
    3939      3021838 :         if (thisZoneEquipConfig.ZoneAirDistributionIndex > 0) {
    3940       421271 :             thisZoneVentRepVars.TargetVentilationFlowVoz =
    3941       842542 :                 thisZoneVentRepVars.TargetVentilationFlowVoz /
    3942       421271 :                 state.dataSize->ZoneAirDistribution(thisZoneEquipConfig.ZoneAirDistributionIndex).calculateEz(state, CtrlZoneNum);
    3943              :         }
    3944              : 
    3945              :         // if system operating in deadband reset zone load
    3946      3021838 :         if (state.dataZoneEnergyDemand->DeadBandOrSetback(CtrlZoneNum)) {
    3947      1101001 :             ZoneLoad = 0.0;
    3948              :         }
    3949              : 
    3950              :         // first deal with any (and all) Zone Forced Air Units that might have outside air.
    3951      3021838 :         auto &thisZoneEquipList = state.dataZoneEquip->ZoneEquipList(thisZoneEquipConfig.EquipListIndex);
    3952      6349844 :         for (int thisZoneEquipNum = 1; thisZoneEquipNum <= thisZoneEquipList.NumOfEquipTypes; ++thisZoneEquipNum) {
    3953      3328006 :             auto &thisEquipIndex = thisZoneEquipList.EquipIndex(thisZoneEquipNum);
    3954              : 
    3955      3328006 :             switch (thisZoneEquipList.EquipType(thisZoneEquipNum)) {
    3956              :                 // case statement to cover all possible zone forced air units that could have outside air
    3957              : 
    3958        16914 :             case DataZoneEquipment::ZoneEquipType::WindowAirConditioner: { // Window Air Conditioner
    3959        16914 :                 int OutAirNode = WindowAC::GetWindowACOutAirNode(state, thisEquipIndex);
    3960        16914 :                 if (OutAirNode > 0) {
    3961        16914 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    3962              :                 }
    3963              : 
    3964        16914 :                 int ZoneInletAirNode = WindowAC::GetWindowACZoneInletAirNode(state, thisEquipIndex);
    3965        16914 :                 if (ZoneInletAirNode > 0) {
    3966        16914 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    3967              :                 }
    3968        16914 :                 int MixedAirNode = WindowAC::GetWindowACMixedAirNode(state, thisEquipIndex);
    3969        16914 :                 int ReturnAirNode = WindowAC::GetWindowACReturnAirNode(state, thisEquipIndex);
    3970        16914 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    3971        16914 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    3972        16914 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    3973              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    3974        16914 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    3975              :                 } else {
    3976            0 :                     ZFAUZoneVentLoad += 0.0;
    3977              :                 }
    3978        16914 :             } break;
    3979              : 
    3980        14810 :             case DataZoneEquipment::ZoneEquipType::VariableRefrigerantFlowTerminal: {
    3981        14810 :                 int OutAirNode = HVACVariableRefrigerantFlow::GetVRFTUOutAirNode(state, thisEquipIndex);
    3982        14810 :                 if (OutAirNode > 0) {
    3983        12790 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    3984              :                 }
    3985        14810 :                 int ZoneInletAirNode = HVACVariableRefrigerantFlow::GetVRFTUZoneInletAirNode(state, thisEquipIndex);
    3986        14810 :                 if (ZoneInletAirNode > 0) {
    3987        14810 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    3988              :                 }
    3989        14810 :                 int MixedAirNode = HVACVariableRefrigerantFlow::GetVRFTUMixedAirNode(state, thisEquipIndex);
    3990        14810 :                 int ReturnAirNode = HVACVariableRefrigerantFlow::GetVRFTUReturnAirNode(state, thisEquipIndex);
    3991        14810 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    3992        12790 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    3993        12790 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    3994              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    3995        12790 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    3996              :                 } else {
    3997         2020 :                     ZFAUZoneVentLoad += 0.0;
    3998              :                 }
    3999        14810 :             } break;
    4000              : 
    4001       167266 :             case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPump:
    4002              :             case DataZoneEquipment::ZoneEquipType::PackagedTerminalAirConditioner:
    4003              :             case DataZoneEquipment::ZoneEquipType::PackagedTerminalHeatPumpWaterToAir: {
    4004              :                 // loop index accesses correct pointer to equipment on this equipment list, DataZoneEquipment::GetZoneEquipmentData
    4005              :                 // thisEquipIndex (EquipIndex) is used to access specific equipment for a single class of equipment (e.g., PTAC 1, 2 and 3)
    4006       167266 :                 int OutAirNode = thisZoneEquipList.compPointer[thisZoneEquipNum]->getMixerOANode();
    4007       167266 :                 if (OutAirNode > 0) {
    4008       160661 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4009              :                 }
    4010       167266 :                 int ZoneInletAirNode = thisZoneEquipList.compPointer[thisZoneEquipNum]->getAirOutletNode();
    4011       167266 :                 if (ZoneInletAirNode > 0) {
    4012       167266 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4013              :                 }
    4014       167266 :                 int MixedAirNode = thisZoneEquipList.compPointer[thisZoneEquipNum]->getMixerMixNode();
    4015       167266 :                 int ReturnAirNode = thisZoneEquipList.compPointer[thisZoneEquipNum]->getMixerRetNode();
    4016       167266 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    4017       160661 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4018       160661 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4019              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4020       160661 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4021              :                 }
    4022       167266 :             } break;
    4023              : 
    4024        25404 :             case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: {
    4025        25404 :                 int OutAirNode = FanCoilUnits::GetFanCoilOutAirNode(state, thisEquipIndex);
    4026        25404 :                 if (OutAirNode > 0) {
    4027        23174 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4028              :                 }
    4029              : 
    4030        25404 :                 int ZoneInletAirNode = FanCoilUnits::GetFanCoilZoneInletAirNode(state, thisEquipIndex);
    4031        25404 :                 if (ZoneInletAirNode > 0) {
    4032        25404 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4033              :                 }
    4034        25404 :                 int MixedAirNode = FanCoilUnits::GetFanCoilMixedAirNode(state, thisEquipIndex);
    4035        25404 :                 int ReturnAirNode = FanCoilUnits::GetFanCoilReturnAirNode(state, thisEquipIndex);
    4036        25404 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    4037        23174 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4038        23174 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4039              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4040        23174 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4041              :                 } else {
    4042         2230 :                     ZFAUZoneVentLoad += 0.0;
    4043              :                 }
    4044        25404 :             } break;
    4045              : 
    4046         8595 :             case DataZoneEquipment::ZoneEquipType::UnitVentilator: {
    4047         8595 :                 int OutAirNode = UnitVentilator::GetUnitVentilatorOutAirNode(state, thisEquipIndex);
    4048         8595 :                 if (OutAirNode > 0) {
    4049         8595 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4050              :                 }
    4051              : 
    4052         8595 :                 int ZoneInletAirNode = UnitVentilator::GetUnitVentilatorZoneInletAirNode(state, thisEquipIndex);
    4053         8595 :                 if (ZoneInletAirNode > 0) {
    4054         8595 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4055              :                 }
    4056         8595 :                 int MixedAirNode = UnitVentilator::GetUnitVentilatorMixedAirNode(state, thisEquipIndex);
    4057         8595 :                 int ReturnAirNode = UnitVentilator::GetUnitVentilatorReturnAirNode(state, thisEquipIndex);
    4058         8595 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    4059         8595 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4060         8595 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4061              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4062         8595 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4063              :                 } else {
    4064            0 :                     ZFAUZoneVentLoad += 0.0;
    4065              :                 }
    4066         8595 :             } break;
    4067              : 
    4068       457859 :             case DataZoneEquipment::ZoneEquipType::PurchasedAir: {
    4069       457859 :                 ZFAUOutAirFlow += PurchasedAirManager::GetPurchasedAirOutAirMassFlow(state, thisEquipIndex);
    4070       457859 :                 int ZoneInletAirNode = PurchasedAirManager::GetPurchasedAirZoneInletAirNode(state, thisEquipIndex);
    4071       457859 :                 if (ZoneInletAirNode > 0) {
    4072       457859 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4073              :                 }
    4074       457859 :                 ZFAUTempMixedAir = PurchasedAirManager::GetPurchasedAirMixedAirTemp(state, thisEquipIndex);
    4075       457859 :                 ZFAUHumRatMixedAir = PurchasedAirManager::GetPurchasedAirMixedAirHumRat(state, thisEquipIndex);
    4076       457859 :                 int ReturnAirNode = PurchasedAirManager::GetPurchasedAirReturnAirNode(state, thisEquipIndex);
    4077       457859 :                 if ((ZFAUFlowRate > 0) && (ReturnAirNode > 0)) {
    4078       241278 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(ZFAUTempMixedAir, ZFAUHumRatMixedAir);
    4079       241278 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4080              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4081       241278 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4082              :                 } else {
    4083       216581 :                     ZFAUZoneVentLoad += 0.0;
    4084              :                 }
    4085       457859 :             } break;
    4086              : 
    4087        21418 :             case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: {
    4088        21418 :                 int OutAirNode = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, thisEquipIndex);
    4089        21418 :                 if (OutAirNode > 0) {
    4090        21418 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4091              :                 }
    4092              : 
    4093        21418 :                 int ZoneInletAirNode = HVACStandAloneERV::GetStandAloneERVZoneInletAirNode(state, thisEquipIndex);
    4094        21418 :                 if (ZoneInletAirNode > 0) {
    4095        21418 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4096              :                 }
    4097        21418 :                 int MixedAirNode = ZoneInletAirNode;
    4098        21418 :                 int ReturnAirNode = HVACStandAloneERV::GetStandAloneERVReturnAirNode(state, thisEquipIndex);
    4099        21418 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    4100        21418 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4101        21418 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4102              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4103        21418 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4104              :                 } else {
    4105            0 :                     ZFAUZoneVentLoad += 0.0;
    4106              :                 }
    4107        21418 :             } break;
    4108              : 
    4109         9780 :             case DataZoneEquipment::ZoneEquipType::UnitarySystem: {
    4110              :                 // add accounting for OA when unitary system is used as zone equipment
    4111         9780 :             } break;
    4112              : 
    4113         3474 :             case DataZoneEquipment::ZoneEquipType::OutdoorAirUnit: {
    4114         3474 :                 int OutAirNode = OutdoorAirUnit::GetOutdoorAirUnitOutAirNode(state, thisEquipIndex);
    4115         3474 :                 if (OutAirNode > 0) {
    4116         3474 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4117              :                 }
    4118              : 
    4119         3474 :                 int ZoneInletAirNode = OutdoorAirUnit::GetOutdoorAirUnitZoneInletNode(state, thisEquipIndex);
    4120         3474 :                 if (ZoneInletAirNode > 0) {
    4121         3474 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4122              :                 }
    4123         3474 :                 int ReturnAirNode = OutdoorAirUnit::GetOutdoorAirUnitReturnAirNode(state, thisEquipIndex);
    4124         3474 :                 if ((OutAirNode > 0) && (ReturnAirNode > 0)) {
    4125         3474 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4126         3474 :                     ZFAUEnthOutdoorAir = Psychrometrics::PsyHFnTdbW(Node(OutAirNode).Temp, Node(OutAirNode).HumRat);
    4127              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4128         3474 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthOutdoorAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4129              :                 } else {
    4130            0 :                     ZFAUZoneVentLoad += 0.0;
    4131              :                 }
    4132         3474 :             } break;
    4133              : 
    4134          771 :             case DataZoneEquipment::ZoneEquipType::HybridEvaporativeCooler: {
    4135          771 :                 int OutAirNode = HybridUnitaryAirConditioners::GetHybridUnitaryACOutAirNode(state, thisEquipIndex);
    4136          771 :                 if (OutAirNode > 0) {
    4137          771 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4138              :                 }
    4139              : 
    4140          771 :                 int ZoneInletAirNode = HybridUnitaryAirConditioners::GetHybridUnitaryACZoneInletNode(state, thisEquipIndex);
    4141          771 :                 if (ZoneInletAirNode > 0) {
    4142          771 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4143              :                 }
    4144              : 
    4145          771 :                 int ReturnAirNode = HybridUnitaryAirConditioners::GetHybridUnitaryACReturnAirNode(state, thisEquipIndex);
    4146          771 :                 if ((OutAirNode > 0) && (ReturnAirNode > 0)) {
    4147          771 :                     ZFAUEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4148          771 :                     ZFAUEnthOutdoorAir = Psychrometrics::PsyHFnTdbW(Node(OutAirNode).Temp, Node(OutAirNode).HumRat);
    4149              :                     // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4150              : 
    4151          771 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthOutdoorAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4152              :                 } else {
    4153            0 :                     ZFAUZoneVentLoad += 0.0;
    4154              :                 }
    4155          771 :             } break;
    4156              : 
    4157      2601715 :             case DataZoneEquipment::ZoneEquipType::UnitHeater:
    4158              :             case DataZoneEquipment::ZoneEquipType::VentilatedSlab:
    4159              :                 //    ZoneHVAC:EvaporativeCoolerUnit ?????
    4160              :             case DataZoneEquipment::ZoneEquipType::EvaporativeCooler:
    4161              :             case DataZoneEquipment::ZoneEquipType::AirDistributionUnit:
    4162              :             case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater:
    4163              :             case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric:
    4164              :             case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant:
    4165              :                 //    not sure how HeatExchanger:* could be used as zone equipment ?????
    4166              :             case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantConstFlow:
    4167              :             case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantVarFlow:
    4168              :             case DataZoneEquipment::ZoneEquipType::LowTemperatureRadiantElectric:
    4169              :             case DataZoneEquipment::ZoneEquipType::ExhaustFan:
    4170              :             case DataZoneEquipment::ZoneEquipType::HeatExchanger:
    4171              :                 // HPWaterHeater can be used as zone equipment
    4172              :             case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeaterPumpedCondenser:
    4173              :             case DataZoneEquipment::ZoneEquipType::HeatPumpWaterHeaterWrappedCondenser:
    4174              :             case DataZoneEquipment::ZoneEquipType::BaseboardWater:
    4175              :             case DataZoneEquipment::ZoneEquipType::DehumidifierDX:
    4176              :             case DataZoneEquipment::ZoneEquipType::BaseboardSteam:
    4177              :             case DataZoneEquipment::ZoneEquipType::BaseboardElectric:
    4178              :             case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet:
    4179              :             case DataZoneEquipment::ZoneEquipType::UserDefinedHVACForcedAir:
    4180              :             case DataZoneEquipment::ZoneEquipType::CoolingPanel: {
    4181              :                 // do nothing, OA not included
    4182      2601715 :             } break;
    4183              : 
    4184            0 :             default: {
    4185            0 :                 ShowFatalError(state,
    4186              :                                "ReportMaxVentilationLoads: Developer must either create accounting for OA or include in final else if "
    4187              :                                "to do nothing");
    4188              : 
    4189            0 :                 break;
    4190              :             }
    4191              :             }
    4192              :         }
    4193              : 
    4194              :         // loop over the zone supply air path inlet nodes
    4195      6150940 :         for (int ZoneInNum = 1; ZoneInNum <= thisZoneEquipConfig.NumInletNodes; ++ZoneInNum) {
    4196      3129102 :             Real64 AirSysEnthReturnAir = 0.0;    // enthalpy of the return air (mixing box inlet node, return side) [kJ/kgK]
    4197      3129102 :             Real64 AirSysEnthMixedAir = 0.0;     // enthalpy of the mixed air (mixing box outlet node, mixed air side) [kJ/kgK]
    4198      3129102 :             Real64 AirSysZoneVentLoad = 0.0;     // ventilation load attributed to a particular zone from primary air system [J]
    4199      3129102 :             Real64 ADUCoolFlowrate = 0.0;        // Air distribution unit cooling air mass flow rate [kg/s]
    4200      3129102 :             Real64 ADUHeatFlowrate = 0.0;        // Air distribution unit heating air mass flow rate [kg/s]
    4201      3129102 :             Real64 AirSysTotalMixFlowRate = 0.0; // Mixed air mass flow rate [kg/s]
    4202      3129102 :             Real64 AirSysOutAirFlow = 0.0;       // outside air flow rate for zone from primary air system [kg/s]
    4203              :             // retrieve air loop index
    4204      3129102 :             int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInNum);
    4205      3129102 :             int MixedAirNode = 0;
    4206      3129102 :             int ReturnAirNode = 0;
    4207      3129102 :             int AirDistCoolInletNodeNum = 0;
    4208      3129102 :             int AirDistHeatInletNodeNum = 0;
    4209      3129102 :             if (AirLoopNum != 0) { // deal with primary air system
    4210      2364007 :                 AirDistCoolInletNodeNum = max(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode, 0);
    4211      2364007 :                 AirDistHeatInletNodeNum = max(thisZoneEquipConfig.AirDistUnitHeat(ZoneInNum).InNode, 0);
    4212              :                 // Set for cooling or heating path
    4213      2364007 :                 if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum == 0) {
    4214      2311910 :                     ADUCoolFlowrate = max(Node(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode).MassFlowRate,
    4215              :                                           0.0); // CR7244 need to accumulate flow across multiple inlets
    4216        52097 :                 } else if (AirDistHeatInletNodeNum > 0 && AirDistCoolInletNodeNum == 0) {
    4217            0 :                     ADUHeatFlowrate = max(Node(thisZoneEquipConfig.AirDistUnitHeat(ZoneInNum).InNode).MassFlowRate,
    4218              :                                           0.0); // CR7244 need to accumulate flow across multiple inlets
    4219        52097 :                 } else if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum > 0 && AirDistCoolInletNodeNum != AirDistHeatInletNodeNum) {
    4220              :                     // dual ducts! CR7244 need to accumulate flow across multiple inlets (don't count same inlet twice)
    4221        15913 :                     ADUHeatFlowrate = max(Node(thisZoneEquipConfig.AirDistUnitHeat(ZoneInNum).InNode).MassFlowRate,
    4222              :                                           0.0); // CR7244 need to accumulate flow across multiple inlets
    4223        15913 :                     ADUCoolFlowrate = max(Node(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode).MassFlowRate,
    4224              :                                           0.0); // CR7244 need to accumulate flow across multiple inlets
    4225        36184 :                 } else if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum > 0) {
    4226              :                     // dual ducts! CR7244 need to accumulate flow across multiple inlets (don't count same inlet twice)
    4227        36184 :                     ADUCoolFlowrate = max(Node(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode).MassFlowRate,
    4228              :                                           0.0); // CR7244 need to accumulate flow across multiple inlets
    4229              :                 } else {
    4230              :                     // do nothing (already inits)
    4231              :                 }
    4232              :                 // Find the mixed air node and return air node of the system that supplies the zone
    4233      2364007 :                 MixedAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysOutletNodeNum;
    4234      2364007 :                 ReturnAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysInletNodeNum;
    4235              : 
    4236              :                 // Collect air loop Voz-dyn and natural ventilation
    4237      2364007 :                 int ADUNum = thisZoneEquipConfig.InletNodeADUNum(ZoneInNum);
    4238      2364007 :                 Real64 termUnitOAFrac = 1.0;
    4239      2364007 :                 if (ADUNum > 0) {
    4240      2355916 :                     int termUnitSizingNum = state.dataDefineEquipment->AirDistUnit(ADUNum).TermUnitSizingNum;
    4241      2355916 :                     if (termUnitSizingNum > 0) {
    4242      2355916 :                         termUnitOAFrac = state.dataSize->TermUnitSizing(termUnitSizingNum).SpecMinOAFrac;
    4243              :                     }
    4244              :                 }
    4245      2364007 :                 state.dataSysRpts->SysVentRepVars(AirLoopNum).TargetVentilationFlowVoz +=
    4246      2364007 :                     termUnitOAFrac * thisZoneVentRepVars.TargetVentilationFlowVoz;
    4247              : 
    4248      2364007 :                 Real64 naturalVentFlow = (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity + thisZonePredefRep.AFNVentVolStdDen) *
    4249      2364007 :                                          zoneMult / TimeStepSysSec;
    4250      2364007 :                 state.dataSysRpts->SysVentRepVars(AirLoopNum).NatVentFlow += termUnitOAFrac * naturalVentFlow;
    4251              : 
    4252      2364007 :                 if (thisZonePredefRep.isOccupied) {
    4253       860706 :                     state.dataSysRpts->SysVentRepVars(AirLoopNum).AnyZoneOccupied = true;
    4254              :                 }
    4255              :             }
    4256              : 
    4257      3129102 :             if (MixedAirNode == 0 || ReturnAirNode == 0) {
    4258       919919 :                 AirSysZoneVentLoad = 0.0;
    4259       919919 :                 AirSysOutAirFlow = 0.0;
    4260              :             } else {
    4261              :                 // Calculate return and mixed air enthalpies
    4262      2209183 :                 AirSysEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4263      2209183 :                 AirSysEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4264              : 
    4265      2209183 :                 if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysExists) {
    4266      2209183 :                     int OutAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OAMixOAInNodeNum;
    4267      2209183 :                     AirSysOutAirFlow = Node(OutAirNode).MassFlowRate;
    4268              :                 } else {
    4269            0 :                     AirSysOutAirFlow = 0.0;
    4270              :                 }
    4271              : 
    4272      2209183 :                 AirSysTotalMixFlowRate = Node(MixedAirNode).MassFlowRate;
    4273              : 
    4274      2209183 :                 if (AirSysTotalMixFlowRate != 0.0) {
    4275      1694093 :                     ZoneFlowFrac = (ADUCoolFlowrate + ADUHeatFlowrate) / AirSysTotalMixFlowRate;
    4276      1694093 :                     AirSysOutAirFlow *= ZoneFlowFrac;
    4277              :                 } else {
    4278       515090 :                     ZoneFlowFrac = 0.0;
    4279       515090 :                     AirSysOutAirFlow = 0.0;
    4280              :                 }
    4281              :                 // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4282      2209183 :                 AirSysZoneVentLoad = (ADUCoolFlowrate + ADUHeatFlowrate) * (AirSysEnthMixedAir - AirSysEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4283              :             }
    4284      3129102 :             ZAirSysZoneVentLoad += AirSysZoneVentLoad;
    4285      3129102 :             ZAirSysOutAirFlow += AirSysOutAirFlow;
    4286              :         } // primary air system present
    4287              : 
    4288              :         // now combine OA flow from zone forced air units with primary air system
    4289      3021838 :         OutAirFlow = ZAirSysOutAirFlow + ZFAUOutAirFlow;
    4290              :         // assign report variables
    4291      3021838 :         thisZoneVentRepVars.OAMassFlow = OutAirFlow;
    4292      3021838 :         thisZoneVentRepVars.OAMass = thisZoneVentRepVars.OAMassFlow * TimeStepSysSec;
    4293              : 
    4294              :         // determine volumetric values from mass flow using standard density (adjusted for elevation)
    4295      3021838 :         thisZoneVentRepVars.OAVolFlowStdRho = thisZoneVentRepVars.OAMassFlow / state.dataEnvrn->StdRhoAir;
    4296      3021838 :         thisZoneVentRepVars.OAVolStdRho = thisZoneVentRepVars.OAVolFlowStdRho * TimeStepSysSec;
    4297              : 
    4298              :         // set time mechanical+natural ventilation is below, at, or above target Voz-dyn
    4299              :         Real64 totMechNatVentVolStdRho =
    4300      3021838 :             thisZoneVentRepVars.OAVolStdRho +
    4301      3021838 :             (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity + thisZonePredefRep.AFNVentVolStdDen) * zoneMult;
    4302      3021838 :         Real64 targetVoz = thisZoneVentRepVars.TargetVentilationFlowVoz * TimeStepSysSec;
    4303              :         // Allow 1% tolerance
    4304      3021838 :         if (totMechNatVentVolStdRho < (0.99 * targetVoz)) {
    4305       750986 :             thisZoneVentRepVars.TimeBelowVozDyn = TimeStepSys;
    4306       750986 :             state.dataSysRpts->AnyZoneTimeBelowVozDyn = TimeStepSys;
    4307      2270852 :         } else if (totMechNatVentVolStdRho > (1.01 * targetVoz)) {
    4308       924776 :             thisZoneVentRepVars.TimeAboveVozDyn = TimeStepSys;
    4309       924776 :             state.dataSysRpts->AnyZoneTimeAboveVozDyn = TimeStepSys;
    4310      1346076 :         } else if (totMechNatVentVolStdRho > HVAC::SmallAirVolFlow) {
    4311       283750 :             thisZoneVentRepVars.TimeAtVozDyn = TimeStepSys;
    4312       283750 :             state.dataSysRpts->AllZonesTimeAtVozDyn = TimeStepSys;
    4313              :         }
    4314              : 
    4315              :         // determine volumetric values from mass flow using current air density for zone (adjusted for elevation)
    4316              :         Real64 currentZoneAirDensity =
    4317      6043676 :             Psychrometrics::PsyRhoAirFnPbTdbW(state,
    4318      3021838 :                                               state.dataEnvrn->OutBaroPress,
    4319      3021838 :                                               state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).MAT,
    4320      3021838 :                                               state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).airHumRatAvg);
    4321      3021838 :         if (currentZoneAirDensity > 0.0) {
    4322      3021838 :             thisZoneVentRepVars.OAVolFlowCrntRho = thisZoneVentRepVars.OAMassFlow / currentZoneAirDensity;
    4323              :         }
    4324      3021838 :         thisZoneVentRepVars.OAVolCrntRho = thisZoneVentRepVars.OAVolFlowCrntRho * TimeStepSysSec;
    4325      3021838 :         if (ZoneVolume > 0.0) {
    4326      3021838 :             thisZoneVentRepVars.MechACH = (thisZoneVentRepVars.OAVolCrntRho / TimeStepSys) / ZoneVolume;
    4327              :         }
    4328              : 
    4329              :         // store data for predefined tabular report on outside air
    4330      3021838 :         if (thisZonePredefRep.isOccupied) {
    4331              :             // accumulate the occupied time
    4332      1126502 :             thisZonePredefRep.TotTimeOcc += TimeStepSys;
    4333              :             // mechanical ventilation
    4334      1126502 :             thisZonePredefRep.MechVentVolTotalOcc += thisZoneVentRepVars.OAVolCrntRho;
    4335      1126502 :             if ((thisZoneVentRepVars.OAVolCrntRho / TimeStepSys) < thisZonePredefRep.MechVentVolMin) {
    4336        48903 :                 thisZonePredefRep.MechVentVolMin = thisZoneVentRepVars.OAVolCrntRho / TimeStepSys;
    4337              :             }
    4338      1126502 :             thisZonePredefRep.MechVentVolTotalOccStdDen += thisZoneVentRepVars.OAVolStdRho;
    4339              :             // infiltration
    4340      1126502 :             thisZonePredefRep.InfilVolTotalOcc += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeCurDensity;
    4341      1126502 :             if (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeCurDensity < thisZonePredefRep.InfilVolMin) {
    4342        26779 :                 thisZonePredefRep.InfilVolMin = state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeCurDensity;
    4343              :             }
    4344      1126502 :             thisZonePredefRep.InfilVolTotalOccStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeStdDensity;
    4345              :             // 'simple' natural ventilation
    4346      1126502 :             thisZonePredefRep.SimpVentVolTotalOcc += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeCurDensity;
    4347      1126502 :             if (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeCurDensity < thisZonePredefRep.SimpVentVolMin) {
    4348         3940 :                 thisZonePredefRep.SimpVentVolMin = state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeCurDensity;
    4349              :             }
    4350      1126502 :             thisZonePredefRep.SimpVentVolTotalOccStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity;
    4351              :             // target ventilation Voz-dyn
    4352      1126502 :             state.dataSysRpts->AnyZoneTimeBelowVozDynOcc = state.dataSysRpts->AnyZoneTimeBelowVozDyn;
    4353      1126502 :             state.dataSysRpts->AllZonesTimeAtVozDynOcc = state.dataSysRpts->AllZonesTimeAtVozDyn;
    4354      1126502 :             state.dataSysRpts->AnyZoneTimeAboveVozDynOcc = state.dataSysRpts->AnyZoneTimeAboveVozDyn;
    4355      1126502 :             thisZonePredefRep.VozTargetTotalOcc += targetVoz;
    4356              : 
    4357              :             // time mechanical+natural ventilation is below, at, or above target Voz-dyn
    4358      1126502 :             thisZonePredefRep.VozTargetTimeBelowOcc += thisZoneVentRepVars.TimeBelowVozDyn;
    4359      1126502 :             thisZonePredefRep.VozTargetTimeAtOcc += thisZoneVentRepVars.TimeAtVozDyn;
    4360      1126502 :             thisZonePredefRep.VozTargetTimeAboveOcc += thisZoneVentRepVars.TimeAboveVozDyn;
    4361      1895336 :         } else if (totMechNatVentVolStdRho > HVAC::SmallAirVolFlow) {
    4362       875439 :             thisZoneVentRepVars.TimeVentUnocc = TimeStepSys;
    4363       875439 :             state.dataSysRpts->AnyZoneTimeVentUnocc = TimeStepSys;
    4364       875439 :             thisZonePredefRep.TotVentTimeNonZeroUnocc += thisZoneVentRepVars.TimeVentUnocc;
    4365              :         }
    4366              :         // accumulate during occupancy or not
    4367      3021838 :         thisZonePredefRep.MechVentVolTotalStdDen += thisZoneVentRepVars.OAVolStdRho;
    4368      3021838 :         thisZonePredefRep.InfilVolTotalStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeStdDensity;
    4369      3021838 :         thisZonePredefRep.SimpVentVolTotalStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity;
    4370      3021838 :         thisZonePredefRep.VozTargetTotal += targetVoz;
    4371      3021838 :         thisZonePredefRep.VozTargetTimeBelow += thisZoneVentRepVars.TimeBelowVozDyn;
    4372      3021838 :         thisZonePredefRep.VozTargetTimeAt += thisZoneVentRepVars.TimeAtVozDyn;
    4373      3021838 :         thisZonePredefRep.VozTargetTimeAbove += thisZoneVentRepVars.TimeAboveVozDyn;
    4374              : 
    4375              :         // now combine Vent load from zone forced air units with primary air system
    4376      3021838 :         Real64 ZoneVentLoad = ZAirSysZoneVentLoad + ZFAUZoneVentLoad;
    4377              :         // cycle if ZoneVentLoad is small
    4378      3021838 :         if (std::abs(ZoneVentLoad) < SmallLoad) {
    4379      1365493 :             continue; // orig. had RETURN here, BG changed to CYCLE for next controlled zone in do loop.
    4380              :         }
    4381              : 
    4382              :         // Ventilation Heating
    4383      1656345 :         if (ZoneVentLoad > SmallLoad) {
    4384              :             // Zone cooling load
    4385       641463 :             if (ZoneLoad < -SmallLoad) {
    4386       441879 :                 thisZoneVentRepVars.CoolingLoadAddedByVent += std::abs(ZoneVentLoad);
    4387              :                 // Zone heating load
    4388       199584 :             } else if (ZoneLoad > SmallLoad) {
    4389         3554 :                 if (ZoneVentLoad > ZoneLoad) {
    4390         3419 :                     thisZoneVentRepVars.HeatingLoadMetByVent += std::abs(ZoneLoad);
    4391         3419 :                     thisZoneVentRepVars.OverheatingByVent += (ZoneVentLoad - ZoneLoad);
    4392              :                 } else {
    4393          135 :                     thisZoneVentRepVars.HeatingLoadMetByVent += std::abs(ZoneVentLoad);
    4394              :                 }
    4395              :                 // No Zone Load
    4396              :             } else {
    4397       196030 :                 thisZoneVentRepVars.NoLoadHeatingByVent += std::abs(ZoneVentLoad);
    4398              :             }
    4399              : 
    4400              :             // Ventilation Cooling
    4401      1014882 :         } else if (ZoneVentLoad < -SmallLoad) {
    4402              :             // Zone cooling load
    4403      1014882 :             if (ZoneLoad < -SmallLoad) {
    4404       174153 :                 if (ZoneVentLoad < ZoneLoad) {
    4405       172638 :                     thisZoneVentRepVars.CoolingLoadMetByVent += std::abs(ZoneLoad);
    4406       172638 :                     thisZoneVentRepVars.OvercoolingByVent += std::abs(ZoneVentLoad - ZoneLoad);
    4407              :                 } else {
    4408         1515 :                     thisZoneVentRepVars.CoolingLoadMetByVent += std::abs(ZoneVentLoad);
    4409              :                 }
    4410              :                 // Zone heating load
    4411       840729 :             } else if (ZoneLoad > SmallLoad) {
    4412       592664 :                 thisZoneVentRepVars.HeatingLoadAddedByVent += std::abs(ZoneVentLoad);
    4413              :                 // No Zone Load
    4414              :             } else {
    4415       248065 :                 thisZoneVentRepVars.NoLoadCoolingByVent += std::abs(ZoneVentLoad);
    4416              :             }
    4417              : 
    4418              :             // Ventilation No Load
    4419              :         } else {
    4420              :         }
    4421              :     } // loop over controlled zones
    4422              : 
    4423              :     // loop over air loops
    4424      1487079 :     for (int sysNum = 1; sysNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++sysNum) {
    4425       862704 :         auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysNum);
    4426       862704 :         auto &thisSysPreDefRep = state.dataSysRpts->SysPreDefRep(sysNum);
    4427       862704 :         Real64 mechVentFlow = state.dataAirLoop->AirLoopFlow(sysNum).OAFlow / state.dataEnvrn->StdRhoAir;
    4428       862704 :         thisSysVentRepVars.MechVentFlow = mechVentFlow;
    4429       862704 :         thisSysPreDefRep.MechVentTotal += mechVentFlow * TimeStepSysSec;
    4430       862704 :         thisSysPreDefRep.NatVentTotal += thisSysVentRepVars.NatVentFlow * TimeStepSysSec;
    4431              : 
    4432              :         // set time mechanical+natural ventilation is below, at, or above target Voz-dyn
    4433       862704 :         Real64 totMechNatVentVolFlowStdRho = mechVentFlow + thisSysVentRepVars.NatVentFlow;
    4434              : 
    4435       862704 :         Real64 targetFlowVoz = thisSysVentRepVars.TargetVentilationFlowVoz;
    4436       862704 :         thisSysPreDefRep.TargetVentTotalVoz += targetFlowVoz * TimeStepSysSec;
    4437              :         // Allow 1% tolerance
    4438       862704 :         if (totMechNatVentVolFlowStdRho < (0.99 * targetFlowVoz)) {
    4439       196258 :             thisSysVentRepVars.TimeBelowVozDyn = TimeStepSys;
    4440       196258 :             thisSysPreDefRep.TimeBelowVozDynTotal += TimeStepSys;
    4441       666446 :         } else if (totMechNatVentVolFlowStdRho > (1.01 * targetFlowVoz)) {
    4442       233966 :             thisSysVentRepVars.TimeAboveVozDyn = TimeStepSys;
    4443       233966 :             thisSysPreDefRep.TimeAboveVozDynTotal += TimeStepSys;
    4444       432480 :         } else if (totMechNatVentVolFlowStdRho > HVAC::SmallAirVolFlow) {
    4445       131003 :             thisSysVentRepVars.TimeAtVozDyn = TimeStepSys;
    4446       131003 :             thisSysPreDefRep.TimeAtVozDynTotal += TimeStepSys;
    4447              :         }
    4448              : 
    4449       862704 :         if (thisSysVentRepVars.AnyZoneOccupied) {
    4450       336843 :             thisSysPreDefRep.TimeOccupiedTotal += TimeStepSys;
    4451       336843 :             thisSysPreDefRep.MechVentTotalOcc += mechVentFlow * TimeStepSysSec;
    4452       336843 :             thisSysPreDefRep.NatVentTotalOcc += thisSysVentRepVars.NatVentFlow * TimeStepSysSec;
    4453       336843 :             thisSysPreDefRep.TargetVentTotalVozOcc += targetFlowVoz * TimeStepSysSec;
    4454       336843 :             thisSysPreDefRep.TimeBelowVozDynTotalOcc += thisSysVentRepVars.TimeBelowVozDyn;
    4455       336843 :             thisSysPreDefRep.TimeAboveVozDynTotalOcc += thisSysVentRepVars.TimeAboveVozDyn;
    4456       336843 :             thisSysPreDefRep.TimeAtVozDynTotalOcc += thisSysVentRepVars.TimeAtVozDyn;
    4457       525861 :         } else if (totMechNatVentVolFlowStdRho > HVAC::SmallAirVolFlow) {
    4458       194773 :             thisSysVentRepVars.TimeVentUnocc = TimeStepSys;
    4459       194773 :             thisSysPreDefRep.TimeVentUnoccTotal += TimeStepSys;
    4460              :         }
    4461              : 
    4462              :         // set time at OA limiting factors
    4463       862704 :         if (mechVentFlow > HVAC::SmallAirVolFlow) {
    4464       449172 :             int thisOAControlNum = state.dataAirLoop->AirLoopControlInfo(sysNum).OACtrlNum;
    4465       449172 :             if (thisOAControlNum > 0) {
    4466       448932 :                 int limitFactorIndex = static_cast<int>(state.dataMixedAir->OAController(thisOAControlNum).OALimitingFactor);
    4467       448932 :                 thisSysPreDefRep.TimeAtOALimit[limitFactorIndex] += TimeStepSys;
    4468       448932 :                 if (thisSysVentRepVars.AnyZoneOccupied) {
    4469       258649 :                     thisSysPreDefRep.TimeAtOALimitOcc[limitFactorIndex] += TimeStepSys;
    4470       258649 :                     thisSysPreDefRep.MechVentTotAtLimitOcc[limitFactorIndex] += mechVentFlow * TimeStepSysSec;
    4471              :                 }
    4472              :             }
    4473              :         }
    4474              :     }
    4475              :     // Accumulate facility totals
    4476       624375 :     state.dataOutRptPredefined->TotalAnyZoneBelowVozDynForOA += state.dataSysRpts->AnyZoneTimeBelowVozDyn;
    4477       624375 :     state.dataOutRptPredefined->TotalAllZonesAtVozDynForOA += state.dataSysRpts->AllZonesTimeAtVozDyn;
    4478       624375 :     state.dataOutRptPredefined->TotalAnyZoneAboveVozDynForOA += state.dataSysRpts->AnyZoneTimeAboveVozDyn;
    4479       624375 :     state.dataOutRptPredefined->TotalAnyZoneVentUnoccForOA += state.dataSysRpts->AnyZoneTimeVentUnocc;
    4480       624375 :     state.dataOutRptPredefined->TotalAnyZoneBelowVozDynOccForOA += state.dataSysRpts->AnyZoneTimeBelowVozDynOcc;
    4481       624375 :     state.dataOutRptPredefined->TotalAllZonesAtVozDynOccForOA += state.dataSysRpts->AllZonesTimeAtVozDynOcc;
    4482       624375 :     state.dataOutRptPredefined->TotalAnyZoneAboveVozDynOccForOA += state.dataSysRpts->AnyZoneTimeAboveVozDynOcc;
    4483              : }
    4484              : 
    4485         3859 : void MatchPlantSys(EnergyPlusData &state,
    4486              :                    int const AirLoopNum, // counter for zone air distribution inlets
    4487              :                    int const BranchNum   // counter for zone air distribution inlets
    4488              : )
    4489              : {
    4490              :     // SUBROUTINE INFORMATION:
    4491              :     //       AUTHOR         Dan Fisher
    4492              :     //       DATE WRITTEN   May 2005
    4493              : 
    4494              :     // PURPOSE OF THIS SUBROUTINE:
    4495              :     // calculate and report zone ventilation loads
    4496              : 
    4497              :     // METHODOLOGY EMPLOYED:
    4498              :     // calculate energy contribution of outside air through mixing box and pro-rate to
    4499              :     // zones according to zone mass flow rates.
    4500              : 
    4501         3859 :     int constexpr EnergyTrans(1);
    4502              : 
    4503        19378 :     for (int CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    4504              :         {
    4505        15519 :             auto &thisComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum);
    4506        20954 :             for (int VarNum = 1; VarNum <= thisComp.NumMeteredVars; ++VarNum) {
    4507        12261 :                 if (thisComp.MeteredVar(VarNum).resource == Constant::eResource::EnergyTransfer) {
    4508         6826 :                     thisComp.EnergyTransComp = EnergyTrans;
    4509         6826 :                     const std::string &CompType = thisComp.TypeOf;
    4510         6826 :                     const std::string &CompName = thisComp.Name;
    4511         6826 :                     bool MatchFound = false; // Set to .TRUE. when a match is found
    4512         6826 :                     int MatchLoop = 0;       // Loop number of the match
    4513         6826 :                     int MatchBranch = 0;     // Branch number of the match
    4514         6826 :                     int MatchComp = 0;       // Component number of the match
    4515         6826 :                     int MatchLoopType = 0;
    4516         6826 :                     int Idx = 0;
    4517         6826 :                     FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4518         6826 :                     if (MatchFound) {
    4519         6239 :                         UpdateAirSysCompPtrArray(state, Idx, AirLoopNum, BranchNum, CompNum, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4520              :                     }
    4521         6826 :                     thisComp.AirSysToPlantPtr = Idx;
    4522         6826 :                     break;
    4523              :                 }
    4524              :             }
    4525        22562 :             for (int SubCompNum = 1; SubCompNum <= thisComp.NumSubComps; ++SubCompNum) {
    4526              :                 //!!!!          IF(SysVentLoad == 0.0d0)EXIT
    4527              :                 {
    4528         7043 :                     auto &thisSubComp(thisComp.SubComp(SubCompNum));
    4529         8121 :                     for (int VarNum = 1; VarNum <= thisSubComp.NumMeteredVars; ++VarNum) {
    4530         3942 :                         if (thisSubComp.MeteredVar(VarNum).resource == Constant::eResource::EnergyTransfer) {
    4531         2864 :                             thisSubComp.EnergyTransComp = EnergyTrans;
    4532         2864 :                             const std::string &CompType = thisComp.TypeOf;
    4533         2864 :                             const std::string &CompName = thisComp.Name;
    4534         2864 :                             bool MatchFound = false; // Set to .TRUE. when a match is found
    4535         2864 :                             int MatchLoop = 0;       // Loop number of the match
    4536         2864 :                             int MatchBranch = 0;     // Branch number of the match
    4537         2864 :                             int MatchComp = 0;       // Component number of the match
    4538         2864 :                             int MatchLoopType = 0;
    4539         2864 :                             int Idx = 0;
    4540         2864 :                             FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4541         2864 :                             if (MatchFound) {
    4542            0 :                                 UpdateAirSysSubCompPtrArray(
    4543              :                                     state, Idx, AirLoopNum, BranchNum, CompNum, SubCompNum, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4544              :                             }
    4545         2864 :                             thisSubComp.AirSysToPlantPtr = Idx;
    4546         2864 :                             break;
    4547              :                         }
    4548              :                     }
    4549         7175 :                     for (int SubSubCompNum = 1; SubSubCompNum <= thisSubComp.NumSubSubComps; ++SubSubCompNum) {
    4550              :                         //!!!!            IF(SysVentLoad == 0.0d0)EXIT
    4551              :                         {
    4552          132 :                             auto &thisSubSubComp = thisSubComp.SubSubComp(SubSubCompNum);
    4553          172 :                             for (int VarNum = 1; VarNum <= thisSubSubComp.NumMeteredVars; ++VarNum) {
    4554          155 :                                 if (thisSubSubComp.MeteredVar(VarNum).resource == Constant::eResource::EnergyTransfer) {
    4555          115 :                                     thisSubSubComp.EnergyTransComp = EnergyTrans;
    4556          115 :                                     const std::string &CompType = thisComp.TypeOf;
    4557          115 :                                     const std::string &CompName = thisComp.Name;
    4558          115 :                                     bool MatchFound = false; // Set to .TRUE. when a match is found
    4559          115 :                                     int MatchLoop = 0;       // Loop number of the match
    4560          115 :                                     int MatchBranch = 0;     // Branch number of the match
    4561          115 :                                     int MatchComp = 0;       // Component number of the match
    4562          115 :                                     int MatchLoopType = 0;
    4563          115 :                                     int Idx = 0;
    4564          115 :                                     FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4565          115 :                                     if (MatchFound) {
    4566            0 :                                         UpdateAirSysSubSubCompPtrArray(state,
    4567              :                                                                        Idx,
    4568              :                                                                        AirLoopNum,
    4569              :                                                                        BranchNum,
    4570              :                                                                        CompNum,
    4571              :                                                                        SubCompNum,
    4572              :                                                                        SubSubCompNum,
    4573              :                                                                        MatchLoopType,
    4574              :                                                                        MatchLoop,
    4575              :                                                                        MatchBranch,
    4576              :                                                                        MatchComp);
    4577              :                                     }
    4578          115 :                                     thisSubSubComp.AirSysToPlantPtr = Idx;
    4579          115 :                                     break;
    4580              :                                 }
    4581              :                             }
    4582              :                         }
    4583              :                     }
    4584              :                 }
    4585              :             }
    4586              :         }
    4587              :     }
    4588         3859 : }
    4589              : 
    4590        60849 : void FindDemandSideMatch(EnergyPlusData &state,
    4591              :                          std::string const &CompType, // Inlet node of the component to find the match of
    4592              :                          std::string_view CompName,   // Outlet node of the component to find the match of
    4593              :                          bool &MatchFound,            // Set to .TRUE. when a match is found
    4594              :                          int &MatchLoopType,          // Loop number of the match
    4595              :                          int &MatchLoop,              // Loop number of the match
    4596              :                          int &MatchBranch,            // Branch number of the match
    4597              :                          int &MatchComp               // Component number of the match
    4598              : )
    4599              : {
    4600              : 
    4601              :     // SUBROUTINE INFORMATION:
    4602              :     //       AUTHOR         Rick Strand
    4603              :     //       DATE WRITTEN   September 2004
    4604              : 
    4605              :     // PURPOSE OF THIS SUBROUTINE:
    4606              :     // This subroutine initializes the connections between various loops.
    4607              :     // Due to the fact that this requires numerous string compares, it
    4608              :     // is much more efficient to find this information once and then
    4609              :     // store it in module level variables (LoopConnect derived type).
    4610              : 
    4611              :     // METHODOLOGY EMPLOYED:
    4612              :     // Simply cycles through the plant and condenser demand sides until
    4613              :     // a component is found that matches the component type and name
    4614              : 
    4615              :     // Initialize all of the output variables
    4616              : 
    4617        60849 :     MatchFound = false;
    4618        60849 :     MatchLoopType = 0;
    4619        60849 :     MatchLoop = 0;
    4620        60849 :     MatchLoop = 0;
    4621        60849 :     MatchBranch = 0;
    4622        60849 :     MatchComp = 0;
    4623              : 
    4624              :     // Now cycle through all of the demand side loops to see if we can find
    4625              :     // a match for the component type and name.  Once a match is found,
    4626              :     // record the type of loop and the loop, branch, and component numbers.
    4627        60849 :     if (!MatchFound) { // Go through the plant demand side loops
    4628       215324 :         for (int PassLoopNum = 1; PassLoopNum <= state.dataHVACGlobal->NumPlantLoops; ++PassLoopNum) {
    4629      6966418 :             for (int PassBranchNum = 1;
    4630      6966418 :                  PassBranchNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).TotalBranches;
    4631              :                  ++PassBranchNum) {
    4632     13616464 :                 for (int PassCompNum = 1;
    4633     13616464 :                      PassCompNum <=
    4634     13616464 :                      state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).Branch(PassBranchNum).TotalComponents;
    4635              :                      ++PassCompNum) {
    4636      6813798 :                     if (Util::SameString(CompType,
    4637      6813798 :                                          state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4638      6813798 :                                              .Branch(PassBranchNum)
    4639      6813798 :                                              .Comp(PassCompNum)
    4640      7252744 :                                              .TypeOf) &&
    4641       438946 :                         Util::SameString(CompName,
    4642       438946 :                                          state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4643       438946 :                                              .Branch(PassBranchNum)
    4644       438946 :                                              .Comp(PassCompNum)
    4645              :                                              .Name)) {
    4646              :                         // Found a match on the plant demand side--increment the counter
    4647         9277 :                         MatchFound = true;
    4648         9277 :                         MatchLoopType = 1;
    4649         9277 :                         MatchLoop = PassLoopNum;
    4650         9277 :                         MatchBranch = PassBranchNum;
    4651         9277 :                         MatchComp = PassCompNum;
    4652         9277 :                         break; // PassCompNum DO loop
    4653              :                     }
    4654              :                 }
    4655      6811943 :                 if (MatchFound) {
    4656         9277 :                     break; // PassBranchNum DO loop
    4657              :                 }
    4658              :             }
    4659       163752 :             if (MatchFound) {
    4660         9277 :                 break; // PassLoopNum DO loop
    4661              :             }
    4662              :         }
    4663              :     }
    4664              : 
    4665        60849 :     if (!MatchFound) { // Go through the condenser demand side loops
    4666        88386 :         for (int PassLoopNum = 1; PassLoopNum <= state.dataHVACGlobal->NumCondLoops; ++PassLoopNum) {
    4667       212714 :             for (int PassBranchNum = 1;
    4668       212714 :                  PassBranchNum <= state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).TotalBranches;
    4669              :                  ++PassBranchNum) {
    4670       348734 :                 for (int PassCompNum = 1;
    4671       348734 :                      PassCompNum <=
    4672       348734 :                      state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).Branch(PassBranchNum).TotalComponents;
    4673              :                      ++PassCompNum) {
    4674       175900 :                     if (Util::SameString(CompType,
    4675       175900 :                                          state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4676       175900 :                                              .Branch(PassBranchNum)
    4677       175900 :                                              .Comp(PassCompNum)
    4678       236188 :                                              .TypeOf) &&
    4679        60288 :                         Util::SameString(CompName,
    4680        60288 :                                          state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4681        60288 :                                              .Branch(PassBranchNum)
    4682        60288 :                                              .Comp(PassCompNum)
    4683              :                                              .Name)) {
    4684              :                         // Found a match on the plant demand side--increment the counter
    4685         3066 :                         MatchFound = true;
    4686         3066 :                         MatchLoopType = 2;
    4687         3066 :                         MatchLoop = PassLoopNum;
    4688         3066 :                         MatchBranch = PassBranchNum;
    4689         3066 :                         MatchComp = PassCompNum;
    4690         3066 :                         break; // PassCompNum DO loop
    4691              :                     }
    4692              :                 }
    4693       175900 :                 if (MatchFound) {
    4694         3066 :                     break; // PassBranchNum DO loop
    4695              :                 }
    4696              :             }
    4697        39880 :             if (MatchFound) {
    4698         3066 :                 break; // PassLoopNum DO loop
    4699              :             }
    4700              :         }
    4701              :     }
    4702        60849 : }
    4703              : 
    4704          800 : void ReportAirLoopConnections(EnergyPlusData &state)
    4705              : {
    4706              : 
    4707              :     // SUBROUTINE INFORMATION:
    4708              :     //       AUTHOR         Michael J. Witte, Linda K. Lawrie
    4709              :     //       DATE WRITTEN   February 2004 (moved from BranchInputManager ReportLoopConnections)
    4710              : 
    4711              :     // PURPOSE OF THIS SUBROUTINE:
    4712              :     // Report air loop splitter connections to the BND file.
    4713              : 
    4714              :     static constexpr std::string_view errstring("**error**");
    4715              : 
    4716              :     static constexpr std::string_view Format_706("! <#AirLoopHVACs>,<Number of AirLoopHVACs>");
    4717              :     static constexpr std::string_view Format_708(
    4718              :         "! <AirLoopHVAC>,<Air Loop Name>,<# Return Nodes>,<# Supply Nodes>,<# Zones Cooled>,<# Zones Heated>,<Outdoor Air Used>");
    4719              :     static constexpr std::string_view Format_709(
    4720              :         "! <AirLoop Return Connections>,<Connection Count>,<AirLoopHVAC Name>,<Zn Eqp Return Node #>,<Zn Eqp Return "
    4721              :         "Node Name>,<AirLoop Return Node #>,<Air Loop Return Node Name>");
    4722              :     static constexpr std::string_view Format_710(
    4723              :         "! <AirLoop Supply Connections>,<Connection Count>,<AirLoopHVAC Name>,<Zn Eqp Supply Node #>,<Zn Eqp Supply "
    4724              :         "Node Name>,<AirLoop Supply Node #>,<Air Loop Supply Node Name>");
    4725              :     static constexpr std::string_view Format_711(
    4726              :         "! <Cooled Zone Info>,<Cooled Zone Count>,<Cooled Zone Name>,<Cooled Zone Inlet Node #>,<Cooled Zone Inlet "
    4727              :         "Node Name>,<AirLoopHVAC Name>");
    4728              :     static constexpr std::string_view Format_712(
    4729              :         "! <Heated Zone Info>,<Heated Zone Count>,<Heated Zone Name>,<Heated Zone Inlet Node #>,<Heated Zone Inlet "
    4730              :         "Node Name>,<AirLoopHVAC Name>");
    4731              :     static constexpr std::string_view Format_714(
    4732              :         "! <Outdoor Air Connections>,<OA Inlet Node #>,<OA Return Air Inlet Node Name>,<OA Outlet Node #>,<OA Mixed "
    4733              :         "Air Outlet Node Name>,<AirLoopHVAC Name>");
    4734              : 
    4735          800 :     auto const &NodeID = state.dataLoopNodes->NodeID;
    4736              : 
    4737          800 :     print(state.files.bnd, "{}\n", "! ===============================================================");
    4738          800 :     print(state.files.bnd, "{}\n", Format_706);
    4739          800 :     print(state.files.bnd, " #AirLoopHVACs,{}\n", state.dataHVACGlobal->NumPrimaryAirSys);
    4740          800 :     print(state.files.bnd, "{}\n", Format_708);
    4741          800 :     print(state.files.bnd, "{}\n", Format_709);
    4742          800 :     print(state.files.bnd, "{}\n", Format_710);
    4743          800 :     print(state.files.bnd, "{}\n", Format_711);
    4744          800 :     print(state.files.bnd, "{}\n", Format_712);
    4745          800 :     print(state.files.bnd, "{}\n", Format_714);
    4746          800 :     print(state.files.bnd, "{}\n", "! <AirLoopHVAC Connector>,<Connector Type>,<Connector Name>,<Loop Name>,<Loop Type>,<Number of Inlets/Outlets>");
    4747          800 :     print(state.files.bnd,
    4748              :           "{}\n",
    4749              :           "! <AirLoopHVAC Connector Branches>,<Connector Node Count>,<Connector Type>,<Connector Name>,<Inlet Branch>,<Outlet Branch>,<Loop "
    4750              :           "Name>,<Loop Type>");
    4751          800 :     print(state.files.bnd,
    4752              :           "{}\n",
    4753              :           "! <AirLoopHVAC Connector Nodes>,<Connector Node Count>,<Connector Type>,<Connector Name>,<Inlet Node>,<Outlet Node>,<Loop Name>,<Loop "
    4754              :           "Type>");
    4755         2021 :     for (int Count = 1; Count <= state.dataHVACGlobal->NumPrimaryAirSys; ++Count) {
    4756            0 :         const auto oaSysExists = [&]() {
    4757         1221 :             if (state.dataAirLoop->AirToOANodeInfo(Count).OASysExists) {
    4758         1071 :                 return "Yes";
    4759              :             } else {
    4760          150 :                 return "No";
    4761              :             }
    4762         1221 :         }();
    4763              : 
    4764         1221 :         print(state.files.bnd,
    4765              :               " AirLoopHVAC,{},{},{},{},{},{}\n",
    4766         1221 :               state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName,
    4767         1221 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumReturnNodes,
    4768         1221 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumSupplyNodes,
    4769         1221 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesCooled,
    4770         1221 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesHeated,
    4771              :               oaSysExists);
    4772         2442 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumReturnNodes; ++Count1) {
    4773         1221 :             print(state.files.bnd, "   AirLoop Return Connections,{},{},", Count1, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4774         1221 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipReturnNodeNum(Count1) > 0) {
    4775         1217 :                 print(state.files.bnd,
    4776              :                       "{},{},",
    4777         1217 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipReturnNodeNum(Count1),
    4778         1217 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipReturnNodeNum(Count1)));
    4779              :             } else {
    4780            4 :                 print(state.files.bnd, "{},{},", errstring, errstring);
    4781              :             }
    4782         1221 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopReturnNodeNum(Count1) > 0) {
    4783         1221 :                 print(state.files.bnd,
    4784              :                       "{},{}\n",
    4785         1221 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopReturnNodeNum(Count1),
    4786         1221 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopReturnNodeNum(Count1)));
    4787              :             } else {
    4788            0 :                 print(state.files.bnd, "{},{}\n", errstring, errstring);
    4789              :             }
    4790              :         }
    4791         2450 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumSupplyNodes; ++Count1) {
    4792         1229 :             print(state.files.bnd, "   AirLoop Supply Connections,{},{},", Count1, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4793         1229 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipSupplyNodeNum(Count1) > 0) {
    4794         1229 :                 print(state.files.bnd,
    4795              :                       "{},{},",
    4796         1229 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipSupplyNodeNum(Count1),
    4797         1229 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipSupplyNodeNum(Count1)));
    4798              :             } else {
    4799            0 :                 print(state.files.bnd, "{},{},", errstring, errstring);
    4800              :             }
    4801         1229 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopSupplyNodeNum(Count1) > 0) {
    4802         1229 :                 print(state.files.bnd,
    4803              :                       "{},{}\n",
    4804         1229 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopSupplyNodeNum(Count1),
    4805         1229 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopSupplyNodeNum(Count1)));
    4806              :             } else {
    4807            0 :                 print(state.files.bnd, "{},{}\n", errstring, errstring);
    4808              :             }
    4809              :         }
    4810              : 
    4811         5022 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesCooled; ++Count1) {
    4812         3801 :             const int CtrldZoneNum = state.dataAirLoop->AirToZoneNodeInfo(Count).CoolCtrlZoneNums(Count1);
    4813         3801 :             print(state.files.bnd, "   Cooled Zone Info,{},{},", Count1, state.dataHeatBal->Zone(CtrldZoneNum).Name);
    4814         3801 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).CoolZoneInletNodes(Count1) > 0) {
    4815         3801 :                 print(state.files.bnd,
    4816              :                       "{},{},{}\n",
    4817         3801 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).CoolZoneInletNodes(Count1),
    4818         3801 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).CoolZoneInletNodes(Count1)),
    4819         3801 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4820              :             } else {
    4821            0 :                 print(state.files.bnd, "{},{},{}\n", errstring, errstring, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4822              :             }
    4823              :         }
    4824         1250 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesHeated; ++Count1) {
    4825           29 :             const int CtrldZoneNum = state.dataAirLoop->AirToZoneNodeInfo(Count).HeatCtrlZoneNums(Count1);
    4826           29 :             print(state.files.bnd, "   Heated Zone Info,{},{},", Count1, state.dataHeatBal->Zone(CtrldZoneNum).Name);
    4827           29 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).HeatZoneInletNodes(Count1) > 0) {
    4828           29 :                 print(state.files.bnd,
    4829              :                       "{},{},{}\n",
    4830           29 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).HeatZoneInletNodes(Count1),
    4831           29 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).HeatZoneInletNodes(Count1)),
    4832           29 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4833              :             } else {
    4834            0 :                 print(state.files.bnd, "{},{},{}\n", errstring, errstring, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4835              :             }
    4836              :         }
    4837         1221 :         if (state.dataAirLoop->AirToOANodeInfo(Count).OASysExists) {
    4838         1071 :             std::string ChrOut;
    4839         1071 :             std::string ChrOut2;
    4840         1071 :             if (state.dataAirLoop->AirToOANodeInfo(Count).OASysInletNodeNum > 0) {
    4841         1071 :                 ChrOut = fmt::to_string(state.dataAirLoop->AirToOANodeInfo(Count).OASysInletNodeNum);
    4842              :             } else {
    4843            0 :                 ChrOut = errstring;
    4844              :             }
    4845         1071 :             if (state.dataAirLoop->AirToOANodeInfo(Count).OASysOutletNodeNum > 0) {
    4846         1071 :                 ChrOut2 = fmt::to_string(state.dataAirLoop->AirToOANodeInfo(Count).OASysOutletNodeNum);
    4847              :             } else {
    4848            0 :                 ChrOut2 = errstring;
    4849              :             }
    4850              : 
    4851         1071 :             print(state.files.bnd, "   Outdoor Air Connections,{},", ChrOut);
    4852         1071 :             if (ChrOut != errstring) {
    4853         1071 :                 print(state.files.bnd, "{},", NodeID(state.dataAirLoop->AirToOANodeInfo(Count).OASysInletNodeNum));
    4854              :             } else {
    4855            0 :                 print(state.files.bnd, "{},", errstring);
    4856              :             }
    4857         1071 :             if (ChrOut2 != errstring) {
    4858         1071 :                 print(state.files.bnd,
    4859              :                       "{},{},{}\n",
    4860              :                       ChrOut2,
    4861         1071 :                       NodeID(state.dataAirLoop->AirToOANodeInfo(Count).OASysOutletNodeNum),
    4862         1071 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4863              :             } else {
    4864            0 :                 print(state.files.bnd, "{},{},{}\n", errstring, errstring, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4865              :             }
    4866         1071 :         }
    4867              :         //  Report HVAC Air Loop Splitter to BND file
    4868         1221 :         if (state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.Exists) {
    4869            9 :             print(state.files.bnd,
    4870              :                   "   AirLoopHVAC Connector,Splitter,{},{},Air,{}\n",
    4871            9 :                   state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.Name,
    4872            9 :                   state.dataAirSystemsData->PrimaryAirSystems(Count).Name,
    4873            9 :                   state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.TotalOutletNodes);
    4874           27 :             for (int Count1 = 1; Count1 <= state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.TotalOutletNodes; ++Count1) {
    4875           18 :                 print(state.files.bnd,
    4876              :                       "     AirLoopHVAC Connector Branches,{},Splitter,{},",
    4877              :                       Count1,
    4878           18 :                       state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.Name);
    4879              : 
    4880           18 :                 if (state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.BranchNumIn <= 0) {
    4881            0 :                     print(state.files.bnd, "{},", errstring);
    4882              :                 } else {
    4883           18 :                     print(state.files.bnd,
    4884              :                           "{},",
    4885           18 :                           state.dataAirSystemsData->PrimaryAirSystems(Count)
    4886           18 :                               .Branch(state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.BranchNumIn)
    4887           18 :                               .Name);
    4888              :                 }
    4889              : 
    4890           18 :                 if (state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.BranchNumOut(Count1) <= 0) {
    4891            0 :                     print(state.files.bnd, "{},{},Air\n", errstring, state.dataAirSystemsData->PrimaryAirSystems(Count).Name);
    4892              :                 } else {
    4893           18 :                     print(state.files.bnd,
    4894              :                           "{},{},Air\n",
    4895           18 :                           state.dataAirSystemsData->PrimaryAirSystems(Count)
    4896           18 :                               .Branch(state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.BranchNumOut(Count1))
    4897           18 :                               .Name,
    4898           18 :                           state.dataAirSystemsData->PrimaryAirSystems(Count).Name);
    4899              :                 }
    4900              : 
    4901           18 :                 print(state.files.bnd,
    4902              :                       "     AirLoopHVAC Connector Nodes,   {},Splitter,{},{},{},{},Air\n",
    4903              :                       Count1,
    4904           18 :                       state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.Name,
    4905           18 :                       state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.NodeNameIn,
    4906           18 :                       state.dataAirSystemsData->PrimaryAirSystems(Count).Splitter.NodeNameOut(Count1),
    4907           18 :                       state.dataAirSystemsData->PrimaryAirSystems(Count).Name);
    4908              :             }
    4909              :         }
    4910              :     }
    4911          800 : }
    4912              : 
    4913          799 : void reportAirLoopToplogy(EnergyPlusData &state)
    4914              : {
    4915              :     // s->pdstTopAirLoop = newPreDefSubTable(state, s->pdrTopology, "Air Loop Supply Side Component Arrangement");
    4916              :     // s->pdchTopAirLoopName = newPreDefColumn(state, s->pdstTopAirLoop, "Airloop Name");
    4917              :     // s->pdchTopAirSplitName = newPreDefColumn(state, s->pdstTopAirLoop, "Splitter Name");
    4918              :     // s->pdchTopAirBranchName = newPreDefColumn(state, s->pdstTopAirLoop, "Supply Branch Name");
    4919              :     // s->pdchTopAirSupplyBranchType = newPreDefColumn(state, s->pdstTopAirLoop, "Supply Branch Type");
    4920              :     // s->pdchTopAirCompType = newPreDefColumn(state, s->pdstTopAirLoop, "Component Type");
    4921              :     // s->pdchTopAirCompName = newPreDefColumn(state, s->pdstTopAirLoop, "Component Name");
    4922              :     // s->pdchTopAirSubCompType = newPreDefColumn(state, s->pdstTopAirLoop, "Sub-Component Type");
    4923              :     // s->pdchTopAirSubCompName = newPreDefColumn(state, s->pdstTopAirLoop, "Sub-Component Name");
    4924              :     // s->pdchTopAirSubSubCompType = newPreDefColumn(state, s->pdstTopAirLoop, "Sub-Sub-Component Type");
    4925              :     // s->pdchTopAirSubSubCompName = newPreDefColumn(state, s->pdstTopAirLoop, "Sub-Sub-Component Name");
    4926              :     // s->pdchTopAirMixName = newPreDefColumn(state, s->pdstTopAirLoop, "Mixer Name");
    4927              : 
    4928          799 :     auto &orp = state.dataOutRptPredefined;
    4929          799 :     int rowCounter = 1;
    4930         2015 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    4931         1216 :         auto &pas = state.dataAirSystemsData->PrimaryAirSystems(airLoopNum);
    4932         1216 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirLoopName, format("{}", rowCounter), pas.Name);
    4933         1216 :         ++rowCounter;
    4934         2451 :         for (int BranchNum = 1; BranchNum <= pas.NumBranches; ++BranchNum) {
    4935         1235 :             auto &pasBranch = pas.Branch(BranchNum);
    4936         1235 :             if (pas.Splitter.Exists) {
    4937           57 :                 for (int outNum : pas.Splitter.BranchNumOut) {
    4938           47 :                     if (outNum == BranchNum) {
    4939           18 :                         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSplitName, format("{}", rowCounter), pas.Splitter.Name);
    4940           18 :                         break;
    4941              :                     }
    4942              :                 }
    4943              :             }
    4944         5020 :             for (int CompNum = 1; CompNum <= pasBranch.TotalComponents; ++CompNum) {
    4945         3785 :                 auto &pasBranchComp = pasBranch.Comp(CompNum);
    4946         3785 :                 fillAirloopToplogyComponentRow(
    4947              :                     state, pas.Name, pasBranch.Name, pasBranch.DuctType, pasBranchComp.TypeOf, pasBranchComp.Name, rowCounter);
    4948         6994 :                 for (int SubCompNum = 1; SubCompNum <= pasBranchComp.NumSubComps; ++SubCompNum) {
    4949         3209 :                     auto &pasBranchSubComp = pasBranchComp.SubComp(SubCompNum);
    4950         3209 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSubCompType, format("{}", rowCounter), pasBranchSubComp.TypeOf);
    4951         3209 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSubCompName, format("{}", rowCounter), pasBranchSubComp.Name);
    4952         3209 :                     fillAirloopToplogyComponentRow(
    4953              :                         state, pas.Name, pasBranch.Name, pasBranch.DuctType, pasBranchComp.TypeOf, pasBranchComp.Name, rowCounter);
    4954         3245 :                     for (int SubSubCompNum = 1; SubSubCompNum <= pasBranchSubComp.NumSubSubComps; ++SubSubCompNum) {
    4955           36 :                         auto &pasBranchSubSubComp = pasBranchSubComp.SubSubComp(SubSubCompNum);
    4956          108 :                         OutputReportPredefined::PreDefTableEntry(
    4957          108 :                             state, orp->pdchTopAirSubCompType, format("{}", rowCounter), pasBranchSubComp.TypeOf);
    4958           36 :                         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSubCompName, format("{}", rowCounter), pasBranchSubComp.Name);
    4959          108 :                         OutputReportPredefined::PreDefTableEntry(
    4960          108 :                             state, orp->pdchTopAirSubSubCompType, format("{}", rowCounter), pasBranchSubSubComp.TypeOf);
    4961          108 :                         OutputReportPredefined::PreDefTableEntry(
    4962          108 :                             state, orp->pdchTopAirSubSubCompName, format("{}", rowCounter), pasBranchSubSubComp.Name);
    4963           36 :                         fillAirloopToplogyComponentRow(
    4964              :                             state, pas.Name, pasBranch.Name, pasBranch.DuctType, pasBranchComp.TypeOf, pasBranchComp.Name, rowCounter);
    4965              :                     }
    4966              :                 }
    4967              :             }
    4968         1235 :             if (pas.Mixer.Exists) {
    4969            9 :                 for (int inNum : pas.Mixer.BranchNumIn) {
    4970            7 :                     if (inNum == BranchNum) {
    4971            2 :                         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirMixName, format("{}", rowCounter - 1), pas.Mixer.Name);
    4972            2 :                         break;
    4973              :                     }
    4974              :                 }
    4975              :             }
    4976              :         }
    4977              :     }
    4978              : 
    4979              :     // s->pdstTopAirDemand = newPreDefSubTable(state, s->pdrTopology, "Air Loop Demand Side Component Arrangement");
    4980              :     // s->pdchTopAirDemandName = newPreDefColumn(state, s->pdstTopAirDemand, "Airloop Name");
    4981              :     // s->pdchTopAirSupplyBranchName = newPreDefColumn(state, s->pdstTopAirDemand, "Supply Branch Name");
    4982              :     // s->pdchTopAirSupplyPCompType = newPreDefColumn(state, s->pdstTopAirDemand, "Supply Path Component Type");
    4983              :     // s->pdchTopAirSupplyPCompName = newPreDefColumn(state, s->pdstTopAirDemand, "Supply Path Component Name");
    4984              :     // s->pdchTopAirZoneName = newPreDefColumn(state, s->pdstTopAirDemand, "Zone Name");
    4985              :     // s->pdchTopAirTermUnitType = newPreDefColumn(state, s->pdstTopAirDemand, "Terminal Unit Type");
    4986              :     // s->pdchTopAirTermUnitName = newPreDefColumn(state, s->pdstTopAirDemand, "Terminal Unit Name");
    4987              :     // s->pdchTopAirReturnPCompType = newPreDefColumn(state, s->pdstTopAirDemand, "Return Path Component Type");
    4988              :     // s->pdchTopAirReturnPCompName = newPreDefColumn(state, s->pdstTopAirDemand, "Return Path Component Name");
    4989              : 
    4990          799 :     rowCounter = 1;
    4991         2015 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    4992         1216 :         auto &pas = state.dataAirSystemsData->PrimaryAirSystems(airLoopNum);
    4993         1216 :         auto &thisAtoZInfo = state.dataAirLoop->AirToZoneNodeInfo(airLoopNum);
    4994         1216 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    4995         1216 :         ++rowCounter;
    4996         2440 :         for (int ductNum = 1; ductNum <= thisAtoZInfo.NumSupplyNodes; ++ductNum) {
    4997         1224 :             auto &thisBranch = pas.Branch(thisAtoZInfo.SupplyDuctBranchNum(ductNum));
    4998         1224 :             if (thisAtoZInfo.SupplyAirPathNum(ductNum) > 0) {
    4999         1220 :                 auto &thisSupplyPath = state.dataZoneEquip->SupplyAirPath(thisAtoZInfo.SupplyAirPathNum(ductNum));
    5000         2447 :                 for (int compNum = 1; compNum <= thisSupplyPath.NumOfComponents; ++compNum) {
    5001         1227 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5002         1227 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5003         2454 :                     OutputReportPredefined::PreDefTableEntry(
    5004         3681 :                         state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5005         2454 :                     OutputReportPredefined::PreDefTableEntry(
    5006         3681 :                         state, orp->pdchTopAirSupplyPCompType, format("{}", rowCounter), thisSupplyPath.ComponentType(compNum));
    5007         2454 :                     OutputReportPredefined::PreDefTableEntry(
    5008         3681 :                         state, orp->pdchTopAirSupplyPCompName, format("{}", rowCounter), thisSupplyPath.ComponentName(compNum));
    5009         1227 :                     ++rowCounter;
    5010              :                 }
    5011         1220 :                 if (thisBranch.DuctType == HVAC::AirDuctType::Cooling || thisBranch.DuctType == HVAC::AirDuctType::Main) {
    5012         5004 :                     for (int zoneNum : thisAtoZInfo.CoolCtrlZoneNums) {
    5013         3792 :                         auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum);
    5014         3792 :                         auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum);
    5015         7967 :                         for (auto &thisCoolADU : thisZoneEquipConfig.AirDistUnitCool) {
    5016         4175 :                             if (thisCoolADU.AirLoopNum != airLoopNum) {
    5017          383 :                                 continue;
    5018              :                             }
    5019         3792 :                             if (thisCoolADU.SupplyBranchIndex != thisAtoZInfo.SupplyDuctBranchNum(ductNum)) {
    5020            0 :                                 continue;
    5021              :                             }
    5022         3792 :                             if (thisCoolADU.SupplyAirPathExists) {
    5023         3792 :                                 int spCompNum = thisSupplyPath.OutletNodeSupplyPathCompNum(thisCoolADU.SupplyAirPathOutNodeIndex);
    5024         7584 :                                 OutputReportPredefined::PreDefTableEntry(
    5025        11376 :                                     state, orp->pdchTopAirSupplyPCompType, format("{}", rowCounter), thisSupplyPath.ComponentType(spCompNum));
    5026         7584 :                                 OutputReportPredefined::PreDefTableEntry(
    5027        11376 :                                     state, orp->pdchTopAirSupplyPCompName, format("{}", rowCounter), thisSupplyPath.ComponentName(spCompNum));
    5028              :                             }
    5029        11376 :                             OutputReportPredefined::PreDefTableEntry(
    5030        11376 :                                 state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5031        11376 :                             OutputReportPredefined::PreDefTableEntry(
    5032        11376 :                                 state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5033         7584 :                             OutputReportPredefined::PreDefTableEntry(
    5034        11376 :                                 state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5035        11376 :                             OutputReportPredefined::PreDefTableEntry(
    5036        11376 :                                 state, orp->pdchTopAirZoneName, format("{}", rowCounter), thisZoneEquipConfig.ZoneName);
    5037         3792 :                             auto &aduIndex = zel.EquipIndex(thisCoolADU.AirDistUnitIndex);
    5038         7584 :                             OutputReportPredefined::PreDefTableEntry(state,
    5039         3792 :                                                                      orp->pdchTopAirTermUnitType,
    5040         7584 :                                                                      format("{}", rowCounter),
    5041         3792 :                                                                      state.dataDefineEquipment->AirDistUnit(aduIndex).EquipType(1));
    5042         7584 :                             OutputReportPredefined::PreDefTableEntry(state,
    5043         3792 :                                                                      orp->pdchTopAirTermUnitName,
    5044         7584 :                                                                      format("{}", rowCounter),
    5045         3792 :                                                                      state.dataDefineEquipment->AirDistUnit(aduIndex).EquipName(1));
    5046         3792 :                             if (thisAtoZInfo.ReturnAirPathNum(1) > 0) {
    5047         3767 :                                 auto &thisReturnPath = state.dataZoneEquip->ReturnAirPath(thisAtoZInfo.ReturnAirPathNum(1));
    5048         3772 :                                 for (int retNodeNum = 1; retNodeNum <= thisZoneEquipConfig.NumReturnNodes; ++retNodeNum) {
    5049         3772 :                                     if (thisZoneEquipConfig.ReturnNodeAirLoopNum(retNodeNum) == airLoopNum) {
    5050         3767 :                                         int retPathCompNum = thisZoneEquipConfig.ReturnNodeRetPathCompNum(retNodeNum);
    5051         3767 :                                         if (retPathCompNum > 0) {
    5052         7534 :                                             OutputReportPredefined::PreDefTableEntry(state,
    5053         3767 :                                                                                      orp->pdchTopAirReturnPCompType,
    5054         7534 :                                                                                      format("{}", rowCounter),
    5055         3767 :                                                                                      thisReturnPath.ComponentType(retPathCompNum));
    5056         7534 :                                             OutputReportPredefined::PreDefTableEntry(state,
    5057         3767 :                                                                                      orp->pdchTopAirReturnPCompName,
    5058         7534 :                                                                                      format("{}", rowCounter),
    5059         3767 :                                                                                      thisReturnPath.ComponentName(retPathCompNum));
    5060              :                                         }
    5061         3767 :                                         break;
    5062              :                                     }
    5063              :                                 }
    5064              :                             }
    5065         3792 :                             ++rowCounter;
    5066              :                         }
    5067              :                     }
    5068         1220 :                 } else if (thisBranch.DuctType == HVAC::AirDuctType::Heating) {
    5069           37 :                     for (int zoneNum : thisAtoZInfo.HeatCtrlZoneNums) {
    5070           29 :                         auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum);
    5071           29 :                         auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum);
    5072           58 :                         for (auto &thisHeatADU : thisZoneEquipConfig.AirDistUnitHeat) {
    5073           29 :                             if (thisHeatADU.AirLoopNum != airLoopNum) {
    5074            0 :                                 continue;
    5075              :                             }
    5076           29 :                             if (thisHeatADU.SupplyBranchIndex != thisAtoZInfo.SupplyDuctBranchNum(ductNum)) {
    5077            0 :                                 continue;
    5078              :                             }
    5079           29 :                             if (thisHeatADU.SupplyAirPathExists) {
    5080           29 :                                 int spCompNum = thisSupplyPath.OutletNodeSupplyPathCompNum(thisHeatADU.SupplyAirPathOutNodeIndex);
    5081           58 :                                 OutputReportPredefined::PreDefTableEntry(
    5082           87 :                                     state, orp->pdchTopAirSupplyPCompType, format("{}", rowCounter), thisSupplyPath.ComponentType(spCompNum));
    5083           58 :                                 OutputReportPredefined::PreDefTableEntry(
    5084           87 :                                     state, orp->pdchTopAirSupplyPCompName, format("{}", rowCounter), thisSupplyPath.ComponentName(spCompNum));
    5085              :                             }
    5086           87 :                             OutputReportPredefined::PreDefTableEntry(
    5087           87 :                                 state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5088           87 :                             OutputReportPredefined::PreDefTableEntry(
    5089           87 :                                 state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5090           58 :                             OutputReportPredefined::PreDefTableEntry(
    5091           87 :                                 state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5092           87 :                             OutputReportPredefined::PreDefTableEntry(
    5093           87 :                                 state, orp->pdchTopAirZoneName, format("{}", rowCounter), thisZoneEquipConfig.ZoneName);
    5094           29 :                             auto &aduIndex = zel.EquipIndex(thisHeatADU.AirDistUnitIndex);
    5095           58 :                             OutputReportPredefined::PreDefTableEntry(state,
    5096           29 :                                                                      orp->pdchTopAirTermUnitType,
    5097           58 :                                                                      format("{}", rowCounter),
    5098           29 :                                                                      state.dataDefineEquipment->AirDistUnit(aduIndex).EquipType(1));
    5099           58 :                             OutputReportPredefined::PreDefTableEntry(state,
    5100           29 :                                                                      orp->pdchTopAirTermUnitName,
    5101           58 :                                                                      format("{}", rowCounter),
    5102           29 :                                                                      state.dataDefineEquipment->AirDistUnit(aduIndex).EquipName(1));
    5103           29 :                             if (thisAtoZInfo.ReturnAirPathNum(1) > 0) {
    5104           29 :                                 auto &thisReturnPath = state.dataZoneEquip->ReturnAirPath(thisAtoZInfo.ReturnAirPathNum(1));
    5105           58 :                                 for (int retNodeNum = 1; retNodeNum <= thisZoneEquipConfig.NumReturnNodes; ++retNodeNum) {
    5106           29 :                                     int retPathCompNum = thisZoneEquipConfig.ReturnNodeRetPathCompNum(retNodeNum);
    5107           29 :                                     if (retPathCompNum > 0) {
    5108           58 :                                         OutputReportPredefined::PreDefTableEntry(state,
    5109           29 :                                                                                  orp->pdchTopAirReturnPCompType,
    5110           58 :                                                                                  format("{}", rowCounter),
    5111           29 :                                                                                  thisReturnPath.ComponentType(retPathCompNum));
    5112           58 :                                         OutputReportPredefined::PreDefTableEntry(state,
    5113           29 :                                                                                  orp->pdchTopAirReturnPCompName,
    5114           58 :                                                                                  format("{}", rowCounter),
    5115           29 :                                                                                  thisReturnPath.ComponentName(retPathCompNum));
    5116              :                                     }
    5117              :                                 }
    5118              :                             }
    5119           29 :                             ++rowCounter;
    5120              :                         }
    5121              :                     }
    5122              :                 }
    5123              : 
    5124              :             } else {
    5125            4 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5126            4 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5127            8 :                 OutputReportPredefined::PreDefTableEntry(
    5128           12 :                     state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5129            4 :                 ++rowCounter;
    5130              :             }
    5131              :         }
    5132         1216 :         if (thisAtoZInfo.ReturnAirPathNum(1) > 0) {
    5133         1203 :             auto &thisReturnPath = state.dataZoneEquip->ReturnAirPath(thisAtoZInfo.ReturnAirPathNum(1));
    5134         2522 :             for (int compNum = 1; compNum <= thisReturnPath.NumOfComponents; ++compNum) {
    5135         1319 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5136         1319 :                 if (compNum == thisReturnPath.OutletRetPathCompNum) {
    5137         1203 :                     auto &thisBranch = pas.Branch(pas.InletBranchNum[0]);
    5138         1203 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5139         2406 :                     OutputReportPredefined::PreDefTableEntry(
    5140         3609 :                         state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5141              :                 }
    5142         2638 :                 OutputReportPredefined::PreDefTableEntry(
    5143         3957 :                     state, orp->pdchTopAirReturnPCompType, format("{}", rowCounter), thisReturnPath.ComponentType(compNum));
    5144         2638 :                 OutputReportPredefined::PreDefTableEntry(
    5145         3957 :                     state, orp->pdchTopAirReturnPCompName, format("{}", rowCounter), thisReturnPath.ComponentName(compNum));
    5146         1319 :                 ++rowCounter;
    5147              :             }
    5148              :         }
    5149              :     }
    5150          799 : }
    5151              : 
    5152         7030 : void fillAirloopToplogyComponentRow(EnergyPlusData &state,
    5153              :                                     const std::string_view &loopName,
    5154              :                                     const std::string_view &branchName,
    5155              :                                     const HVAC::AirDuctType ductType,
    5156              :                                     const std::string_view &compType,
    5157              :                                     const std::string_view &compName,
    5158              :                                     int &rowCounter)
    5159              : {
    5160         7030 :     auto &orp = state.dataOutRptPredefined;
    5161              :     // s->pdchTopAirLoopName = newPreDefColumn(state, s->pdstTopAirLoop, "Airloop Name");
    5162              :     // s->pdchTopAirBranchName = newPreDefColumn(state, s->pdstTopAirLoop, "Branch Name");
    5163              :     // s->pdchTopAirCompType = newPreDefColumn(state, s->pdstTopAirLoop, "Component Type");
    5164              :     // s->pdchTopAirCompName = newPreDefColumn(state, s->pdstTopAirLoop, "Component Name");
    5165         7030 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirLoopName, format("{}", rowCounter), loopName);
    5166         7030 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirBranchName, format("{}", rowCounter), branchName);
    5167         7030 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)ductType]);
    5168         7030 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirCompType, format("{}", rowCounter), compType);
    5169         7030 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirCompName, format("{}", rowCounter), compName);
    5170         7030 :     ++rowCounter;
    5171         7030 : }
    5172              : 
    5173          799 : void reportZoneEquipmentToplogy(EnergyPlusData &state)
    5174              : {
    5175              :     // s->pdstTopZnEqp = newPreDefSubTable(state, s->pdrTopology, "Zone Equipment Component Arrangement");
    5176              :     // s->pdchTopZnEqpName = newPreDefColumn(state, s->pdstTopZnEqp, "Zone Name");
    5177              :     // s->pdchTopZnEqpCompType = newPreDefColumn(state, s->pdstTopZnEqp, "Component Type");
    5178              :     // s->pdchTopZnEqpCompName = newPreDefColumn(state, s->pdstTopZnEqp, "Component Name");
    5179              :     // s->pdchTopZnEqpSubCompType = newPreDefColumn(state, s->pdstTopZnEqp, "Sub-Component Type");
    5180              :     // s->pdchTopZnEqpSubCompName = newPreDefColumn(state, s->pdstTopZnEqp, "Sub-Component Name");
    5181              :     // s->pdchTopZnEqpSubSubCompType = newPreDefColumn(state, s->pdstTopZnEqp, "Sub-Sub-Component Type");
    5182              :     // s->pdchTopZnEqpSubSubCompName = newPreDefColumn(state, s->pdstTopZnEqp, "Sub-Sub-Component Name");
    5183              : 
    5184          799 :     auto &orp = state.dataOutRptPredefined;
    5185          799 :     int rowCounter = 1;
    5186         5988 :     for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5187         5189 :         const std::string_view zoneName = state.dataHeatBal->Zone(zoneNum).Name;
    5188         5189 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpName, format("{}", rowCounter), zoneName);
    5189         5189 :         ++rowCounter;
    5190         5189 :         if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) {
    5191          738 :             continue;
    5192              :         }
    5193         4451 :         auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum);
    5194         9632 :         for (int CompNum = 1; CompNum <= zel.NumOfEquipTypes; ++CompNum) {
    5195         5181 :             auto &zelEquipData = zel.EquipData(CompNum);
    5196         5181 :             fillZoneEquipToplogyComponentRow(state, zoneName, zelEquipData.TypeOf, zelEquipData.Name, rowCounter);
    5197        11865 :             for (int SubCompNum = 1; SubCompNum <= zelEquipData.NumSubEquip; ++SubCompNum) {
    5198         6684 :                 auto &zelSubEquipData = zelEquipData.SubEquipData(SubCompNum);
    5199         6684 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompType, format("{}", rowCounter), zelSubEquipData.TypeOf);
    5200         6684 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompName, format("{}", rowCounter), zelSubEquipData.Name);
    5201         6684 :                 fillZoneEquipToplogyComponentRow(state, zoneName, zelEquipData.TypeOf, zelEquipData.Name, rowCounter);
    5202         9355 :                 for (int SubSubCompNum = 1; SubSubCompNum <= zelSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
    5203         2671 :                     auto &zelSubSubEquipData = zelSubEquipData.SubSubEquipData(SubSubCompNum);
    5204         2671 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompType, format("{}", rowCounter), zelSubEquipData.TypeOf);
    5205         2671 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompName, format("{}", rowCounter), zelSubEquipData.Name);
    5206         8013 :                     OutputReportPredefined::PreDefTableEntry(
    5207         8013 :                         state, orp->pdchTopZnEqpSubSubCompType, format("{}", rowCounter), zelSubSubEquipData.TypeOf);
    5208         8013 :                     OutputReportPredefined::PreDefTableEntry(
    5209         8013 :                         state, orp->pdchTopZnEqpSubSubCompName, format("{}", rowCounter), zelSubSubEquipData.Name);
    5210         2671 :                     fillZoneEquipToplogyComponentRow(state, zoneName, zelEquipData.TypeOf, zelEquipData.Name, rowCounter);
    5211              :                 }
    5212              :             }
    5213              :         }
    5214              :     }
    5215          799 : }
    5216              : 
    5217        14536 : void fillZoneEquipToplogyComponentRow(
    5218              :     EnergyPlusData &state, const std::string_view &zoneName, const std::string_view &compType, const std::string_view &compName, int &rowCounter)
    5219              : {
    5220        14536 :     auto &orp = state.dataOutRptPredefined;
    5221              :     // s->pdstTopZnEqp = newPreDefSubTable(state, s->pdrTopology, "Zone Equipment Component Arrangement");
    5222              :     // s->pdchTopZnEqpName = newPreDefColumn(state, s->pdstTopZnEqp, "Zone Name");
    5223              :     // s->pdchTopZnEqpCompType = newPreDefColumn(state, s->pdstTopZnEqp, "Component Type");
    5224              :     // s->pdchTopZnEqpCompName = newPreDefColumn(state, s->pdstTopZnEqp, "Component Name");
    5225        14536 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpName, format("{}", rowCounter), zoneName);
    5226        14536 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpCompType, format("{}", rowCounter), compType);
    5227        14536 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpCompName, format("{}", rowCounter), compName);
    5228        14536 :     ++rowCounter;
    5229        14536 : }
    5230              : 
    5231          799 : void reportAirDistributionUnits(EnergyPlusData &state)
    5232              : {
    5233              :     // populate the predefined tabular report for Equipment Summary - Air Terminals
    5234              : 
    5235          799 :     auto &orp = state.dataOutRptPredefined;
    5236         4595 :     for (auto &adu : state.dataDefineEquipment->AirDistUnit) {
    5237         3796 :         constexpr int aduCompNum = 1;
    5238         3796 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermZoneName, adu.Name, state.dataHeatBal->Zone(adu.ZoneNum).Name);
    5239         3796 :         switch (adu.EquipTypeEnum(aduCompNum)) {
    5240           34 :         case DataDefineEquip::ZnAirLoopEquipType::DualDuctConstVolume:
    5241              :         case DataDefineEquip::ZnAirLoopEquipType::DualDuctVAV:
    5242              :         case DataDefineEquip::ZnAirLoopEquipType::DualDuctVAVOutdoorAir:
    5243           34 :             state.dataDualDuct->dd_airterminal(adu.EquipIndex(aduCompNum)).reportTerminalUnit(state);
    5244           34 :             break;
    5245         3597 :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctConstVolReheat:
    5246              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctConstVolNoReheat:
    5247              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctVAVReheat:
    5248              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctVAVNoReheat:
    5249              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctVAVReheatVSFan:
    5250              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctCBVAVReheat:
    5251              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctCBVAVNoReheat:
    5252         3597 :             state.dataSingleDuct->sd_airterminal(adu.EquipIndex(aduCompNum)).reportTerminalUnit(state);
    5253         3597 :             break;
    5254           57 :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuct_SeriesPIU_Reheat:
    5255              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuct_ParallelPIU_Reheat:
    5256           57 :             state.dataPowerInductionUnits->PIU(adu.EquipIndex(aduCompNum)).reportTerminalUnit(state);
    5257           57 :             break;
    5258            4 :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuct_ConstVol_4PipeInduc:
    5259            4 :             state.dataHVACSingleDuctInduc->IndUnit(adu.EquipIndex(aduCompNum)).reportTerminalUnit(state);
    5260            4 :             break;
    5261            5 :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctConstVolCooledBeam:
    5262            5 :             state.dataHVACCooledBeam->CoolBeam(adu.EquipIndex(aduCompNum)).reportTerminalUnit(state);
    5263            5 :             break;
    5264           30 :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctConstVolFourPipeBeam:
    5265           30 :             adu.airTerminalPtr->reportTerminalUnit(state);
    5266           30 :             break;
    5267           69 :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctUserDefined:
    5268              :         case DataDefineEquip::ZnAirLoopEquipType::SingleDuctATMixer:
    5269           69 :             break;
    5270            0 :         default:
    5271            0 :             break;
    5272              :         } // end switch
    5273              :     }
    5274          799 : }
    5275              : 
    5276              : //        End of Reporting subroutines for the SimAir Module
    5277              : // *****************************************************************************
    5278              : 
    5279              : } // namespace EnergyPlus::SystemReports
        

Generated by: LCOV version 2.0-1