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-07-17 05:04:31 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       616704 : 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       616704 :     int constexpr EnergyTransfer(1);
     130              : 
     131       616704 :     if (!state.dataSysRpts->VentReportStructureCreated) {
     132            0 :         return;
     133              :     }
     134              : 
     135       616704 :     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         5620 :         for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
     142         4839 :             auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
     143         4839 :             if (!thisZoneEquipConfig.IsControlled) {
     144          726 :                 continue;
     145              :             }
     146         4113 :             thisZoneEquipConfig.EquipListIndex = Util::FindItemInList(thisZoneEquipConfig.EquipListName, state.dataZoneEquip->ZoneEquipList);
     147         4113 :             auto &thisZoneEquipList = state.dataZoneEquip->ZoneEquipList(thisZoneEquipConfig.EquipListIndex);
     148         8498 :             for (int ZoneInletNodeNum = 1; ZoneInletNodeNum <= thisZoneEquipConfig.NumInletNodes; ++ZoneInletNodeNum) {
     149         4385 :                 int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInletNodeNum);
     150         9825 :                 for (int CompNum = 1; CompNum <= thisZoneEquipList.NumOfEquipTypes; ++CompNum) {
     151        10829 :                     for (int NodeCount = 1; NodeCount <= thisZoneEquipList.EquipData(CompNum).NumOutlets; ++NodeCount) {
     152         5389 :                         if (thisZoneEquipList.EquipData(CompNum).OutletNodeNums(NodeCount) ==
     153         5389 :                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).OutNode) {
     154         3458 :                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirDistUnitIndex = CompNum;
     155         3458 :                             if (thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathExists) {
     156        21426 :                                 for (int SAPNum = 1; SAPNum <= state.dataZoneEquip->NumSupplyAirPaths; ++SAPNum) {
     157       125201 :                                     for (int SAPOutNode = 1; SAPOutNode <= state.dataZoneEquip->SupplyAirPath(SAPNum).NumOutletNodes; ++SAPOutNode) {
     158       107229 :                                         if (thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).InNode ==
     159       107229 :                                             state.dataZoneEquip->SupplyAirPath(SAPNum).OutletNode(SAPOutNode)) {
     160         3454 :                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathIndex = SAPNum;
     161         3454 :                                             thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyAirPathOutNodeIndex = SAPOutNode;
     162         6937 :                                             for (int OutNum = 1; OutNum <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumSupplyNodes;
     163              :                                                  ++OutNum) {
     164         3483 :                                                 if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).ZoneEquipSupplyNodeNum(OutNum) ==
     165         3483 :                                                     state.dataZoneEquip->SupplyAirPath(SAPNum).InletNodeNum) {
     166         3454 :                                                     thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirLoopNum = AirLoopNum;
     167         3454 :                                                     thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex =
     168         3454 :                                                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OutletBranchNum[OutNum - 1];
     169         3454 :                                                     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         3420 :                                                         thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex =
     182         3420 :                                                             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         5389 :                         if (thisZoneEquipList.EquipData(CompNum).OutletNodeNums(NodeCount) ==
     224         5389 :                             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         5620 :         for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
     300         4839 :             auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
     301         4839 :             if (!thisZoneEquipConfig.IsControlled) {
     302          726 :                 continue;
     303              :             }
     304         4113 :             thisZoneEquipConfig.EquipListIndex = Util::FindItemInList(thisZoneEquipConfig.EquipListName, state.dataZoneEquip->ZoneEquipList);
     305         4113 :             int ListNum = thisZoneEquipConfig.EquipListIndex;
     306              :             // loop over the zone supply air path inlet nodes
     307         8498 :             for (int ZoneInletNodeNum = 1; ZoneInletNodeNum <= thisZoneEquipConfig.NumInletNodes; ++ZoneInletNodeNum) {
     308         4385 :                 int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInletNodeNum);
     309              : 
     310              :                 // 1. Find HVAC component plant loop connections
     311         4385 :                 int MainBranchNum = thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).MainBranchIndex;
     312         4385 :                 MainBranchNum = max(MainBranchNum, thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).MainBranchIndex);
     313         4385 :                 if (MainBranchNum > 0) {
     314         3454 :                     MatchPlantSys(state, AirLoopNum, MainBranchNum);
     315              :                 }
     316         4385 :                 int SupplyCoolBranchNum = thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).SupplyBranchIndex;
     317         4385 :                 if (SupplyCoolBranchNum > 0 && (SupplyCoolBranchNum != MainBranchNum)) {
     318           38 :                     MatchPlantSys(state, AirLoopNum, SupplyCoolBranchNum);
     319              :                 }
     320         4385 :                 int SupplyHeatBranchNum = thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).SupplyBranchIndex;
     321         4385 :                 if (SupplyHeatBranchNum > 0 && (SupplyHeatBranchNum != MainBranchNum)) {
     322           29 :                     MatchPlantSys(state, AirLoopNum, SupplyHeatBranchNum);
     323              :                 }
     324              : 
     325         4385 :                 int AirDistUnitNum = thisZoneEquipConfig.AirDistUnitCool(ZoneInletNodeNum).AirDistUnitIndex;
     326         4385 :                 AirDistUnitNum = max(AirDistUnitNum, thisZoneEquipConfig.AirDistUnitHeat(ZoneInletNodeNum).AirDistUnitIndex);
     327         4385 :                 if (ListNum > 0 && AirDistUnitNum > 0) {
     328         3458 :                     auto &thisZoneEquipList = state.dataZoneEquip->ZoneEquipList(ListNum);
     329         3458 :                     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         6945 :                     for (int SubEquipNum = 1; SubEquipNum <= thisZoneEquipList.EquipData(AirDistUnitNum).NumSubEquip; ++SubEquipNum) {
     349         3487 :                         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         5835 :                         for (int SubSubEquipNum = 1;
     372         5835 :                              SubSubEquipNum <= thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).NumSubSubEquip;
     373              :                              ++SubSubEquipNum) {
     374         2413 :                             for (int VarNum = 1;
     375         2413 :                                  VarNum <=
     376         2413 :                                  thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).SubSubEquipData(SubSubEquipNum).NumMeteredVars;
     377              :                                  ++VarNum) {
     378         2348 :                                 if (thisZoneEquipList.EquipData(AirDistUnitNum)
     379         2348 :                                         .SubEquipData(SubEquipNum)
     380         2348 :                                         .SubSubEquipData(SubSubEquipNum)
     381         2348 :                                         .MeteredVar(VarNum)
     382         2348 :                                         .resource == Constant::eResource::EnergyTransfer) {
     383         2283 :                                     thisZoneEquipList.EquipData(AirDistUnitNum)
     384         2283 :                                         .SubEquipData(SubEquipNum)
     385         2283 :                                         .SubSubEquipData(SubSubEquipNum)
     386         2283 :                                         .EnergyTransComp = EnergyTransfer;
     387              :                                     const std::string &CompType =
     388         2283 :                                         thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).SubSubEquipData(SubSubEquipNum).TypeOf;
     389              :                                     const std::string &CompName =
     390         2283 :                                         thisZoneEquipList.EquipData(AirDistUnitNum).SubEquipData(SubEquipNum).SubSubEquipData(SubSubEquipNum).Name;
     391         2283 :                                     int Idx = 0;
     392         2283 :                                     int MatchLoop = 0;
     393         2283 :                                     int MatchLoopType = 0;
     394         2283 :                                     int MatchBranch = 0;
     395         2283 :                                     int MatchComp = 0;
     396         2283 :                                     bool MatchFound = false;
     397         2283 :                                     FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     398         2283 :                                     if (MatchFound) {
     399         1915 :                                         UpdateZoneSubSubCompPtrArray(state,
     400              :                                                                      Idx,
     401              :                                                                      ListNum,
     402              :                                                                      AirDistUnitNum,
     403              :                                                                      SubEquipNum,
     404              :                                                                      SubSubEquipNum,
     405              :                                                                      MatchLoopType,
     406              :                                                                      MatchLoop,
     407              :                                                                      MatchBranch,
     408              :                                                                      MatchComp);
     409              :                                     }
     410         4566 :                                     thisZoneEquipList.EquipData(AirDistUnitNum)
     411         2283 :                                         .SubEquipData(SubEquipNum)
     412         2283 :                                         .SubSubEquipData(SubSubEquipNum)
     413         2283 :                                         .ZoneEqToPlantPtr = Idx;
     414         2283 :                                     break;
     415              :                                 }
     416              :                             }
     417              :                         }
     418              :                     }
     419              :                 }
     420              : 
     421         4385 :                 int EquipNum = 0;
     422         4385 :                 int SubEquipNum = 0;
     423         4385 :                 int SubSubEquipNum = 0;
     424         4385 :                 int CompNum = 0;
     425         4385 :                 int SubCompNum = 0;
     426         4385 :                 int SubSubCompNum = 0;
     427              :                 // Eliminate duplicates in the connection arrays
     428         4385 :                 if (allocated(state.dataAirSystemsData->ZoneCompToPlant)) {
     429            0 :                     EquipNum = isize(state.dataAirSystemsData->ZoneCompToPlant);
     430              :                 }
     431         4385 :                 if (allocated(state.dataAirSystemsData->ZoneSubCompToPlant)) {
     432           35 :                     SubEquipNum = isize(state.dataAirSystemsData->ZoneSubCompToPlant);
     433              :                 }
     434         4385 :                 if (allocated(state.dataAirSystemsData->ZoneSubSubCompToPlant)) {
     435         2286 :                     SubSubEquipNum = isize(state.dataAirSystemsData->ZoneSubSubCompToPlant);
     436              :                 }
     437         4385 :                 if (allocated(state.dataAirSystemsData->AirSysCompToPlant)) {
     438         2504 :                     CompNum = isize(state.dataAirSystemsData->AirSysCompToPlant);
     439              :                 }
     440         4385 :                 if (allocated(state.dataAirSystemsData->AirSysSubCompToPlant)) {
     441            0 :                     SubCompNum = isize(state.dataAirSystemsData->AirSysSubCompToPlant);
     442              :                 }
     443         4385 :                 if (allocated(state.dataAirSystemsData->AirSysSubSubCompToPlant)) {
     444            0 :                     SubSubCompNum = isize(state.dataAirSystemsData->AirSysSubSubCompToPlant);
     445              :                 }
     446              : 
     447         4385 :                 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         4385 :                 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         4385 :                 if (SubSubEquipNum > 0) {
     531         2286 :                     int ArrayCount = 0;
     532       237086 :                     for (int i = 1; i <= SubSubEquipNum; ++i) {
     533       234800 :                         auto const &zi = state.dataAirSystemsData->ZoneSubSubCompToPlant(i);
     534       234800 :                         bool duplicate(false);
     535      3517910 :                         for (int j = 1; j <= ArrayCount; ++j) {
     536      3479623 :                             auto const &zj = state.dataAirSystemsData->ZoneSubSubCompToPlant(j);
     537      3479623 :                             if ((zi.ZoneEqListNum == zj.ZoneEqListNum) && (zi.ZoneEqCompNum == zj.ZoneEqCompNum) &&
     538       196527 :                                 (zi.ZoneEqSubCompNum == zj.ZoneEqSubCompNum) && (zi.ZoneEqSubSubCompNum == zj.ZoneEqSubSubCompNum)) { // Duplicate
     539       196513 :                                 duplicate = true;
     540       196513 :                                 break;
     541              :                             }
     542              :                         }
     543       234800 :                         if (!duplicate) {
     544        38287 :                             ++ArrayCount;
     545        38287 :                             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       198799 :                     for (int i = ArrayCount + 1; i <= SubSubEquipNum; ++i) { // Zero the now-unused entries
     561       196513 :                         auto &zi = state.dataAirSystemsData->ZoneSubSubCompToPlant(i);
     562       196513 :                         zi.ZoneEqListNum = 0;
     563       196513 :                         zi.ZoneEqCompNum = 0;
     564       196513 :                         zi.ZoneEqSubCompNum = 0;
     565       196513 :                         zi.ZoneEqSubSubCompNum = 0;
     566       196513 :                         zi.PlantLoopType = 0;
     567       196513 :                         zi.PlantLoopNum = 0;
     568       196513 :                         zi.PlantLoopBranch = 0;
     569       196513 :                         zi.PlantLoopComp = 0;
     570       196513 :                         zi.FirstDemandSidePtr = 0;
     571       196513 :                         zi.LastDemandSidePtr = 0;
     572              :                     }
     573              :                 }
     574              : 
     575         4385 :                 if (CompNum > 0) {
     576         2504 :                     int ArrayCount = 0;
     577       486504 :                     for (int i = 1; i <= CompNum; ++i) {
     578       484000 :                         auto const &ai = state.dataAirSystemsData->AirSysCompToPlant(i);
     579       484000 :                         bool duplicate(false);
     580      4446580 :                         for (int j = 1; j <= ArrayCount; ++j) {
     581      4425961 :                             auto const &aj = state.dataAirSystemsData->AirSysCompToPlant(j);
     582      4425961 :                             if ((ai.AirLoopNum == aj.AirLoopNum) && (ai.AirLoopBranch == aj.AirLoopBranch) &&
     583       501173 :                                 (ai.AirLoopComp == aj.AirLoopComp)) { // Duplicate
     584       463381 :                                 duplicate = true;
     585       463381 :                                 break;
     586              :                             }
     587              :                         }
     588       484000 :                         if (!duplicate) {
     589        20619 :                             ++ArrayCount;
     590        20619 :                             if (i > ArrayCount) { // Copy to lower position
     591          380 :                                 auto &aa = state.dataAirSystemsData->AirSysCompToPlant(ArrayCount);
     592          380 :                                 aa.AirLoopNum = ai.AirLoopNum;
     593          380 :                                 aa.AirLoopBranch = ai.AirLoopBranch;
     594          380 :                                 aa.AirLoopComp = ai.AirLoopComp;
     595          380 :                                 aa.PlantLoopType = ai.PlantLoopType;
     596          380 :                                 aa.PlantLoopNum = ai.PlantLoopNum;
     597          380 :                                 aa.PlantLoopBranch = ai.PlantLoopBranch;
     598          380 :                                 aa.PlantLoopComp = ai.PlantLoopComp;
     599          380 :                                 aa.FirstDemandSidePtr = ai.FirstDemandSidePtr;
     600          380 :                                 aa.LastDemandSidePtr = ai.LastDemandSidePtr;
     601              :                             }
     602              :                         }
     603              :                     }
     604       465885 :                     for (int i = ArrayCount + 1; i <= CompNum; ++i) { // Zero the now-unused entries
     605       463381 :                         auto &ai = state.dataAirSystemsData->AirSysCompToPlant(i);
     606       463381 :                         ai.AirLoopNum = 0;
     607       463381 :                         ai.AirLoopBranch = 0;
     608       463381 :                         ai.AirLoopComp = 0;
     609       463381 :                         ai.PlantLoopType = 0;
     610       463381 :                         ai.PlantLoopNum = 0;
     611       463381 :                         ai.PlantLoopBranch = 0;
     612       463381 :                         ai.PlantLoopComp = 0;
     613       463381 :                         ai.FirstDemandSidePtr = 0;
     614       463381 :                         ai.LastDemandSidePtr = 0;
     615              :                     }
     616              :                 }
     617              : 
     618         4385 :                 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         4385 :                 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        12600 :                 for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops; ++PlantLoopNum) {
     717        42078 :                     for (int BranchNum = 1;
     718        42078 :                          BranchNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).TotalBranches;
     719              :                          ++BranchNum) {
     720        33863 :                         for (CompNum = 1;
     721        68779 :                              CompNum <=
     722        68779 :                              state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).Branch(BranchNum).TotalComponents;
     723              :                              ++CompNum) {
     724              :                             {
     725        34916 :                                 auto &thisVentRepComp = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum)
     726        34916 :                                                             .Branch(BranchNum)
     727        34916 :                                                             .Comp(CompNum);
     728        34916 :                                 const std::string &CompType = thisVentRepComp.TypeOf;
     729        34916 :                                 const std::string &CompName = thisVentRepComp.Name;
     730        34916 :                                 int MatchLoop = 0;
     731        34916 :                                 int MatchLoopType = 0;
     732        34916 :                                 int MatchBranch = 0;
     733        34916 :                                 int MatchComp = 0;
     734        34916 :                                 bool MatchFound = false;
     735        34916 :                                 FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     736        34916 :                                 thisVentRepComp.ConnectPlant.LoopType = MatchLoopType;
     737        34916 :                                 thisVentRepComp.ConnectPlant.LoopNum = MatchLoop;
     738        34916 :                                 thisVentRepComp.ConnectPlant.BranchNum = MatchBranch;
     739        34916 :                                 thisVentRepComp.ConnectPlant.CompNum = MatchComp;
     740              :                             }
     741              :                         }
     742              :                     }
     743              :                 }
     744              : 
     745         6536 :                 for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
     746        10949 :                     for (int BranchNum = 1;
     747        10949 :                          BranchNum <= state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).TotalBranches;
     748              :                          ++BranchNum) {
     749         8798 :                         for (CompNum = 1;
     750        17654 :                              CompNum <=
     751        17654 :                              state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum).Branch(BranchNum).TotalComponents;
     752              :                              ++CompNum) {
     753              :                             {
     754         8856 :                                 auto &thisVentRepComp = state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](PlantLoopNum)
     755         8856 :                                                             .Branch(BranchNum)
     756         8856 :                                                             .Comp(CompNum);
     757         8856 :                                 const std::string &CompType = thisVentRepComp.TypeOf;
     758         8856 :                                 const std::string &CompName = thisVentRepComp.Name;
     759         8856 :                                 int MatchLoop = 0;
     760         8856 :                                 int MatchLoopType = 0;
     761         8856 :                                 int MatchBranch = 0;
     762         8856 :                                 int MatchComp = 0;
     763         8856 :                                 bool MatchFound = false;
     764         8856 :                                 FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
     765         8856 :                                 thisVentRepComp.ConnectPlant.LoopType = MatchLoopType;
     766         8856 :                                 thisVentRepComp.ConnectPlant.LoopNum = MatchLoop;
     767         8856 :                                 thisVentRepComp.ConnectPlant.BranchNum = MatchBranch;
     768         8856 :                                 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          781 :         int NumZoneConnectComps = 0;
     779          781 :         int NumZoneConnectSubComps = 0;
     780          781 :         int NumZoneConnectSubSubComps = 0;
     781          781 :         int NumAirSysConnectComps = 0;
     782          781 :         int NumAirSysConnectSubComps = 0;
     783          781 :         int NumAirSysConnectSubSubComps = 0;
     784          781 :         if (allocated(state.dataAirSystemsData->ZoneCompToPlant)) {
     785            0 :             NumZoneConnectComps = isize(state.dataAirSystemsData->ZoneCompToPlant);
     786              :         }
     787          781 :         if (allocated(state.dataAirSystemsData->ZoneSubCompToPlant)) {
     788            3 :             NumZoneConnectSubComps = isize(state.dataAirSystemsData->ZoneSubCompToPlant);
     789              :         }
     790          781 :         if (allocated(state.dataAirSystemsData->ZoneSubSubCompToPlant)) {
     791          256 :             NumZoneConnectSubSubComps = isize(state.dataAirSystemsData->ZoneSubSubCompToPlant);
     792              :         }
     793          781 :         if (allocated(state.dataAirSystemsData->AirSysCompToPlant)) {
     794          279 :             NumAirSysConnectComps = isize(state.dataAirSystemsData->AirSysCompToPlant);
     795              :         }
     796          781 :         if (allocated(state.dataAirSystemsData->AirSysSubCompToPlant)) {
     797            0 :             NumAirSysConnectSubComps = isize(state.dataAirSystemsData->AirSysSubCompToPlant);
     798              :         }
     799          781 :         if (allocated(state.dataAirSystemsData->AirSysSubSubCompToPlant)) {
     800            0 :             NumAirSysConnectSubSubComps = isize(state.dataAirSystemsData->AirSysSubSubCompToPlant);
     801              :         }
     802          781 :         state.dataSysRpts->OneTimeFlag_InitEnergyReports = false;
     803              : 
     804          781 :         int ArrayCount = 0;
     805          781 :         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         1081 :         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        26581 :         for (int SubSubCompNum = 1; SubSubCompNum <= NumZoneConnectSubSubComps; ++SubSubCompNum) {
     848        25800 :             int LoopType = state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).PlantLoopType;
     849        25800 :             int LoopNum = state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).PlantLoopNum;
     850        25800 :             int FirstIndex = ArrayCount + 1;
     851        25800 :             int LoopCount = 1;
     852        25800 :             bool ConnectionFlag = false;
     853              : 
     854        25800 :             if (LoopType > 0 && LoopNum > 0) {
     855         1915 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     856              :             }
     857              : 
     858        25800 :             int LastIndex = ArrayCount;
     859        25800 :             if (FirstIndex > LastIndex) {
     860        25800 :                 FirstIndex = LastIndex;
     861              :             }
     862        25800 :             if (ConnectionFlag) {
     863            0 :                 state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).FirstDemandSidePtr = FirstIndex;
     864            0 :                 state.dataAirSystemsData->ZoneSubSubCompToPlant(SubSubCompNum).LastDemandSidePtr = LastIndex;
     865              :             }
     866              :         }
     867        31081 :         for (int CompNum = 1; CompNum <= NumAirSysConnectComps; ++CompNum) {
     868        30300 :             int LoopType = state.dataAirSystemsData->AirSysCompToPlant(CompNum).PlantLoopType;
     869        30300 :             int LoopNum = state.dataAirSystemsData->AirSysCompToPlant(CompNum).PlantLoopNum;
     870        30300 :             int FirstIndex = ArrayCount + 1;
     871        30300 :             int LoopCount = 1;
     872        30300 :             bool ConnectionFlag = false;
     873              : 
     874        30300 :             if (LoopType > 0 && LoopNum > 0) {
     875          774 :                 FindFirstLastPtr(state, LoopType, LoopNum, ArrayCount, LoopCount, ConnectionFlag);
     876              :             }
     877              : 
     878        30300 :             int LastIndex = ArrayCount;
     879        30300 :             if (FirstIndex > LastIndex) {
     880        30300 :                 FirstIndex = LastIndex;
     881              :             }
     882        30300 :             if (ConnectionFlag) {
     883            0 :                 state.dataAirSystemsData->AirSysCompToPlant(CompNum).FirstDemandSidePtr = FirstIndex;
     884            0 :                 state.dataAirSystemsData->AirSysCompToPlant(CompNum).LastDemandSidePtr = LastIndex;
     885              :             }
     886              :         }
     887              : 
     888          781 :         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          781 :         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          781 :         reportAirLoopToplogy(state);
     931              : 
     932          781 :         reportZoneEquipmentToplogy(state);
     933              : 
     934          781 :         reportAirDistributionUnits(state);
     935              : 
     936          781 :         state.dataSysRpts->OneTimeFlag_InitEnergyReports = false;
     937              :     }
     938              : 
     939              :     // On every iteration, load the air loop energy data
     940      1443168 :     for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
     941       826464 :         auto &pas = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum);
     942      1663188 :         for (int BranchNum = 1; BranchNum <= pas.NumBranches; ++BranchNum) {
     943       836724 :             auto &pasBranch = pas.Branch(BranchNum);
     944      3241828 :             for (int CompNum = 1; CompNum <= pasBranch.TotalComponents; ++CompNum) {
     945      2405104 :                 auto &pasBranchComp = pasBranch.Comp(CompNum);
     946      5051975 :                 for (int VarNum = 1; VarNum <= pasBranchComp.NumMeteredVars; ++VarNum) {
     947      2646871 :                     auto &pasBranchCompMeter = pasBranchComp.MeteredVar(VarNum);
     948      2646871 :                     OutputProcessor::VariableType VarType = pasBranchCompMeter.varType;
     949      2646871 :                     int VarIndex = pasBranchCompMeter.num;
     950      2646871 :                     pasBranchCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     951              :                 }
     952      4980540 :                 for (int SubCompNum = 1; SubCompNum <= pasBranchComp.NumSubComps; ++SubCompNum) {
     953      2575436 :                     auto &pasBranchSubComp = pasBranchComp.SubComp(SubCompNum);
     954      7068426 :                     for (int VarNum = 1; VarNum <= pasBranchSubComp.NumMeteredVars; ++VarNum) {
     955      4492990 :                         auto &pasBranchSubCompMeter = pasBranchSubComp.MeteredVar(VarNum);
     956      4492990 :                         OutputProcessor::VariableType VarType = pasBranchSubCompMeter.varType;
     957      4492990 :                         int VarIndex = pasBranchSubCompMeter.num;
     958      4492990 :                         pasBranchSubCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     959              :                     }
     960      2588262 :                     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      3959453 :     for (int ListNum = 1; ListNum <= state.dataGlobal->NumOfZones; ++ListNum) {
     976      3342749 :         if (!state.dataZoneEquip->ZoneEquipConfig(ListNum).IsControlled) {
     977       486357 :             continue;
     978              :         }
     979      2856392 :         auto &zel = state.dataZoneEquip->ZoneEquipList(ListNum);
     980      5992313 :         for (int CompNum = 1; CompNum <= zel.NumOfEquipTypes; ++CompNum) {
     981      3135921 :             auto &zelEquipData = zel.EquipData(CompNum);
     982      4519227 :             for (int VarNum = 1; VarNum <= zelEquipData.NumMeteredVars; ++VarNum) {
     983      1383306 :                 auto &zelEquipDataMeter = zelEquipData.MeteredVar(VarNum);
     984      1383306 :                 OutputProcessor::VariableType VarType = zelEquipDataMeter.varType;
     985      1383306 :                 int VarIndex = zelEquipDataMeter.num;
     986      1383306 :                 zelEquipDataMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     987              :             }
     988      6550129 :             for (int SubCompNum = 1; SubCompNum <= zelEquipData.NumSubEquip; ++SubCompNum) {
     989      3414208 :                 auto &zelSubEquipData = zelEquipData.SubEquipData(SubCompNum);
     990      5646401 :                 for (int VarNum = 1; VarNum <= zelSubEquipData.NumMeteredVars; ++VarNum) {
     991      2232193 :                     auto &zelSubEquipDataMeter = zelSubEquipData.MeteredVar(VarNum);
     992      2232193 :                     OutputProcessor::VariableType VarType = zelSubEquipDataMeter.varType;
     993      2232193 :                     int VarIndex = zelSubEquipDataMeter.num;
     994      2232193 :                     zelSubEquipDataMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
     995              :                 }
     996      4887695 :                 for (int SubSubCompNum = 1; SubSubCompNum <= zelSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
     997      1473487 :                     auto &zelSubSubEquipData = zelSubEquipData.SubSubEquipData(SubSubCompNum);
     998      4478001 :                     for (int VarNum = 1; VarNum <= zelSubSubEquipData.NumMeteredVars; ++VarNum) {
     999      3004514 :                         auto &zelSubSubEquipDataMeter = zelSubSubEquipData.MeteredVar(VarNum);
    1000      3004514 :                         OutputProcessor::VariableType VarType = zelSubSubEquipDataMeter.varType;
    1001      3004514 :                         int VarIndex = zelSubSubEquipDataMeter.num;
    1002      3004514 :                         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      1850112 :     for (LoopSideLocation LoopSide : DataPlant::LoopSideKeys) {
    1011      2294896 :         for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops; ++PlantLoopNum) {
    1012      1061488 :             auto &vrp = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSide)](PlantLoopNum);
    1013      7810156 :             for (int BranchNum = 1; BranchNum <= vrp.TotalBranches; ++BranchNum) {
    1014      6748668 :                 auto &vrpBranch = vrp.Branch(BranchNum);
    1015     13512943 :                 for (int CompNum = 1; CompNum <= vrpBranch.TotalComponents; ++CompNum) {
    1016      6764275 :                     auto &vrpBranchComp = vrpBranch.Comp(CompNum);
    1017     16531417 :                     for (int VarNum = 1; VarNum <= vrpBranchComp.NumMeteredVars; ++VarNum) {
    1018      9767142 :                         auto &vrpBranchCompMeter = vrpBranchComp.MeteredVar(VarNum);
    1019      9767142 :                         OutputProcessor::VariableType VarType = vrpBranchCompMeter.varType;
    1020      9767142 :                         int VarIndex = vrpBranchCompMeter.num;
    1021      9767142 :                         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      1443984 :         for (int PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
    1029       210576 :             auto &vrc = state.dataPlnt->VentRepCond[static_cast<int>(LoopSide)](PlantLoopNum);
    1030      1146011 :             for (int BranchNum = 1; BranchNum <= vrc.TotalBranches; ++BranchNum) {
    1031       935435 :                 auto &vrcBranch = vrc.Branch(BranchNum);
    1032      1880132 :                 for (int CompNum = 1; CompNum <= vrcBranch.TotalComponents; ++CompNum) {
    1033       944697 :                     auto &vrcBranchComp = vrcBranch.Comp(CompNum);
    1034      1968154 :                     for (int VarNum = 1; VarNum <= vrcBranchComp.NumMeteredVars; ++VarNum) {
    1035      1023457 :                         auto &vrcBranchCompMeter = vrcBranchComp.MeteredVar(VarNum);
    1036      1023457 :                         OutputProcessor::VariableType VarType = vrcBranchCompMeter.varType;
    1037      1023457 :                         int VarIndex = vrcBranchCompMeter.num;
    1038      1023457 :                         vrcBranchCompMeter.curMeterReading = GetInternalVariableValue(state, VarType, VarIndex);
    1039              :                     }
    1040              :                 }
    1041              :             }
    1042              :         }
    1043              :     }
    1044              :     // initialize energy report variables
    1045              : }
    1046              : 
    1047         2724 : 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         2724 :     auto &LoopStack = state.dataSysRpts->LoopStack;
    1071              : 
    1072         2724 :     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         1915 : 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         1915 :     if (state.dataSysRpts->OneTimeFlag_UpdateZoneSubSubCompPtrArray) {
    1355          256 :         state.dataAirSystemsData->ZoneSubSubCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateZoneSubSubCompPtrArray);
    1356        25856 :         for (auto &e : state.dataAirSystemsData->ZoneSubSubCompToPlant) {
    1357        25600 :             e.ZoneEqListNum = 0;
    1358        25600 :             e.ZoneEqCompNum = 0;
    1359        25600 :             e.ZoneEqSubCompNum = 0;
    1360        25600 :             e.ZoneEqSubSubCompNum = 0;
    1361        25600 :             e.PlantLoopType = 0;
    1362        25600 :             e.PlantLoopNum = 0;
    1363        25600 :             e.PlantLoopBranch = 0;
    1364        25600 :             e.PlantLoopComp = 0;
    1365        25600 :             e.FirstDemandSidePtr = 0;
    1366        25600 :             e.LastDemandSidePtr = 0;
    1367              :         }
    1368              : 
    1369          256 :         state.dataSysRpts->OneTimeFlag_UpdateZoneSubSubCompPtrArray = false;
    1370              :     }
    1371              : 
    1372         1915 :     if (state.dataSysRpts->ArrayCounter_UpdateZoneSubSubCompPtrArray >=
    1373         1915 :         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         1915 :     Idx = state.dataSysRpts->ArrayCounter_UpdateZoneSubSubCompPtrArray;
    1392         1915 :     auto &zctp = state.dataAirSystemsData->ZoneSubSubCompToPlant(Idx);
    1393         1915 :     zctp.ZoneEqListNum = ListNum;
    1394         1915 :     zctp.ZoneEqCompNum = AirDistUnitNum;
    1395         1915 :     zctp.ZoneEqSubCompNum = SubCompNum;
    1396         1915 :     zctp.ZoneEqSubSubCompNum = SubSubCompNum;
    1397         1915 :     zctp.PlantLoopType = PlantLoopType;
    1398         1915 :     zctp.PlantLoopNum = PlantLoop;
    1399         1915 :     zctp.PlantLoopBranch = PlantBranch;
    1400         1915 :     zctp.PlantLoopComp = PlantComp;
    1401         1915 :     ++state.dataSysRpts->ArrayCounter_UpdateZoneSubSubCompPtrArray;
    1402         1915 : }
    1403              : 
    1404         5637 : 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         5637 :     if (state.dataSysRpts->OneTimeFlag_UpdateAirSysCompPtrArray) {
    1424          279 :         state.dataAirSystemsData->AirSysCompToPlant.allocate(state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray);
    1425        28179 :         for (auto &e : state.dataAirSystemsData->AirSysCompToPlant) {
    1426        27900 :             e.AirLoopNum = 0;
    1427        27900 :             e.AirLoopBranch = 0;
    1428        27900 :             e.AirLoopComp = 0;
    1429        27900 :             e.PlantLoopType = 0;
    1430        27900 :             e.PlantLoopNum = 0;
    1431        27900 :             e.PlantLoopBranch = 0;
    1432        27900 :             e.PlantLoopComp = 0;
    1433        27900 :             e.FirstDemandSidePtr = 0;
    1434        27900 :             e.LastDemandSidePtr = 0;
    1435              :         }
    1436              : 
    1437          279 :         state.dataSysRpts->OneTimeFlag_UpdateAirSysCompPtrArray = false;
    1438              :     }
    1439              : 
    1440         5637 :     if (state.dataSysRpts->ArrayCounter_UpdateAirSysCompPtrArray >= state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray) { // Redimension larger
    1441           12 :         int const OldArrayLimit(state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray);
    1442           12 :         state.dataAirSystemsData->AirSysCompToPlant.redimension(state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray *= 2);
    1443         2412 :         for (int i = OldArrayLimit + 1; i <= state.dataSysRpts->ArrayLimit_UpdateAirSysCompPtrArray; ++i) {
    1444         2400 :             auto &actp = state.dataAirSystemsData->AirSysCompToPlant(i);
    1445         2400 :             actp.AirLoopNum = 0;
    1446         2400 :             actp.AirLoopBranch = 0;
    1447         2400 :             actp.AirLoopComp = 0;
    1448         2400 :             actp.PlantLoopType = 0;
    1449         2400 :             actp.PlantLoopNum = 0;
    1450         2400 :             actp.PlantLoopBranch = 0;
    1451         2400 :             actp.PlantLoopComp = 0;
    1452         2400 :             actp.FirstDemandSidePtr = 0;
    1453         2400 :             actp.LastDemandSidePtr = 0;
    1454              :         }
    1455              :     }
    1456              : 
    1457         5637 :     Idx = state.dataSysRpts->ArrayCounter_UpdateAirSysCompPtrArray;
    1458         5637 :     auto &actp = state.dataAirSystemsData->AirSysCompToPlant(Idx);
    1459         5637 :     actp.AirLoopNum = AirLoopNum;
    1460         5637 :     actp.AirLoopBranch = BranchNum;
    1461         5637 :     actp.AirLoopComp = CompNum;
    1462         5637 :     actp.PlantLoopType = PlantLoopType;
    1463         5637 :     actp.PlantLoopNum = PlantLoop;
    1464         5637 :     actp.PlantLoopBranch = PlantBranch;
    1465         5637 :     actp.PlantLoopComp = PlantComp;
    1466         5637 :     ++state.dataSysRpts->ArrayCounter_UpdateAirSysCompPtrArray;
    1467         5637 : }
    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          782 : 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          782 :     int NumPrimaryAirSys = state.dataHVACGlobal->NumPrimaryAirSys;
    1623              : 
    1624              :     // PURPOSE OF THIS SUBROUTINE:
    1625              :     // Allocates Arrays and setup output variables related to Ventilation reports.
    1626          782 :     state.dataSysRpts->ZoneVentRepVars.allocate(state.dataGlobal->NumOfZones);
    1627          782 :     state.dataSysRpts->SysLoadRepVars.allocate(NumPrimaryAirSys);
    1628          782 :     state.dataSysRpts->SysVentRepVars.allocate(NumPrimaryAirSys);
    1629          782 :     state.dataSysRpts->SysPreDefRep.allocate(NumPrimaryAirSys);
    1630              : 
    1631         1939 :     for (int sysIndex = 1; sysIndex <= NumPrimaryAirSys; ++sysIndex) {
    1632         1157 :         auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysIndex);
    1633         1157 :         thisSysVentRepVars.MechVentFlow = 0.0;
    1634         1157 :         thisSysVentRepVars.NatVentFlow = 0.0;
    1635         1157 :         thisSysVentRepVars.TargetVentilationFlowVoz = 0.0;
    1636         1157 :         thisSysVentRepVars.TimeBelowVozDyn = 0.0;
    1637         1157 :         thisSysVentRepVars.TimeAtVozDyn = 0.0;
    1638         1157 :         thisSysVentRepVars.TimeAboveVozDyn = 0.0;
    1639         1157 :         thisSysVentRepVars.TimeVentUnocc = 0.0;
    1640         1157 :         thisSysVentRepVars.AnyZoneOccupied = false;
    1641              :     }
    1642              : 
    1643          782 :     if (state.dataSysRpts->AirLoopLoadsReportEnabled) {
    1644         1939 :         for (int sysIndex = 1; sysIndex <= NumPrimaryAirSys; ++sysIndex) {
    1645         1157 :             auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(sysIndex);
    1646         1157 :             auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysIndex);
    1647         1157 :             std::string const primaryAirSysName = state.dataAirSystemsData->PrimaryAirSystems(sysIndex).Name;
    1648              : 
    1649              :             // CurrentModuleObject='AirloopHVAC'
    1650              :             // SYSTEM LOADS REPORT
    1651         2314 :             SetupOutputVariable(state,
    1652              :                                 "Air System Total Heating Energy",
    1653              :                                 Constant::Units::J,
    1654         1157 :                                 thisSysLoadRepVars.TotHTNG,
    1655              :                                 OutputProcessor::TimeStepType::System,
    1656              :                                 OutputProcessor::StoreType::Sum,
    1657              :                                 primaryAirSysName);
    1658              : 
    1659         2314 :             SetupOutputVariable(state,
    1660              :                                 "Air System Total Cooling Energy",
    1661              :                                 Constant::Units::J,
    1662         1157 :                                 thisSysLoadRepVars.TotCLNG,
    1663              :                                 OutputProcessor::TimeStepType::System,
    1664              :                                 OutputProcessor::StoreType::Sum,
    1665              :                                 primaryAirSysName);
    1666              : 
    1667              :             // SYSTEM ENERGY USE REPORT
    1668         2314 :             SetupOutputVariable(state,
    1669              :                                 "Air System Hot Water Energy",
    1670              :                                 Constant::Units::J,
    1671         1157 :                                 thisSysLoadRepVars.TotH2OHOT,
    1672              :                                 OutputProcessor::TimeStepType::System,
    1673              :                                 OutputProcessor::StoreType::Sum,
    1674              :                                 primaryAirSysName);
    1675              : 
    1676         2314 :             SetupOutputVariable(state,
    1677              :                                 "Air System Steam Energy",
    1678              :                                 Constant::Units::J,
    1679         1157 :                                 thisSysLoadRepVars.TotSteam,
    1680              :                                 OutputProcessor::TimeStepType::System,
    1681              :                                 OutputProcessor::StoreType::Sum,
    1682              :                                 primaryAirSysName);
    1683              : 
    1684         2314 :             SetupOutputVariable(state,
    1685              :                                 "Air System Chilled Water Energy",
    1686              :                                 Constant::Units::J,
    1687         1157 :                                 thisSysLoadRepVars.TotH2OCOLD,
    1688              :                                 OutputProcessor::TimeStepType::System,
    1689              :                                 OutputProcessor::StoreType::Sum,
    1690              :                                 primaryAirSysName);
    1691              : 
    1692         2314 :             SetupOutputVariable(state,
    1693              :                                 "Air System Electricity Energy",
    1694              :                                 Constant::Units::J,
    1695         1157 :                                 thisSysLoadRepVars.TotElec,
    1696              :                                 OutputProcessor::TimeStepType::System,
    1697              :                                 OutputProcessor::StoreType::Sum,
    1698              :                                 primaryAirSysName);
    1699              : 
    1700         2314 :             SetupOutputVariable(state,
    1701              :                                 "Air System NaturalGas Energy",
    1702              :                                 Constant::Units::J,
    1703         1157 :                                 thisSysLoadRepVars.TotNaturalGas,
    1704              :                                 OutputProcessor::TimeStepType::System,
    1705              :                                 OutputProcessor::StoreType::Sum,
    1706              :                                 primaryAirSysName);
    1707              : 
    1708         2314 :             SetupOutputVariable(state,
    1709              :                                 "Air System Propane Energy",
    1710              :                                 Constant::Units::J,
    1711         1157 :                                 thisSysLoadRepVars.TotPropane,
    1712              :                                 OutputProcessor::TimeStepType::System,
    1713              :                                 OutputProcessor::StoreType::Sum,
    1714              :                                 primaryAirSysName);
    1715              : 
    1716         2314 :             SetupOutputVariable(state,
    1717              :                                 "Air System Water Volume",
    1718              :                                 Constant::Units::m3,
    1719         1157 :                                 thisSysLoadRepVars.DomesticH2O,
    1720              :                                 OutputProcessor::TimeStepType::System,
    1721              :                                 OutputProcessor::StoreType::Sum,
    1722              :                                 primaryAirSysName);
    1723              : 
    1724              :             // SYSTEM COMPONENT LOAD REPORT
    1725         2314 :             SetupOutputVariable(state,
    1726              :                                 "Air System Fan Air Heating Energy",
    1727              :                                 Constant::Units::J,
    1728         1157 :                                 thisSysLoadRepVars.FANCompHTNG,
    1729              :                                 OutputProcessor::TimeStepType::System,
    1730              :                                 OutputProcessor::StoreType::Sum,
    1731              :                                 primaryAirSysName);
    1732              : 
    1733         2314 :             SetupOutputVariable(state,
    1734              :                                 "Air System Cooling Coil Total Cooling Energy",
    1735              :                                 Constant::Units::J,
    1736         1157 :                                 thisSysLoadRepVars.CCCompCLNG,
    1737              :                                 OutputProcessor::TimeStepType::System,
    1738              :                                 OutputProcessor::StoreType::Sum,
    1739              :                                 primaryAirSysName);
    1740              : 
    1741         2314 :             SetupOutputVariable(state,
    1742              :                                 "Air System Heating Coil Total Heating Energy",
    1743              :                                 Constant::Units::J,
    1744         1157 :                                 thisSysLoadRepVars.HCCompHTNG,
    1745              :                                 OutputProcessor::TimeStepType::System,
    1746              :                                 OutputProcessor::StoreType::Sum,
    1747              :                                 primaryAirSysName);
    1748              : 
    1749         2314 :             SetupOutputVariable(state,
    1750              :                                 "Air System Heat Exchanger Total Heating Energy",
    1751              :                                 Constant::Units::J,
    1752         1157 :                                 thisSysLoadRepVars.HeatExHTNG,
    1753              :                                 OutputProcessor::TimeStepType::System,
    1754              :                                 OutputProcessor::StoreType::Sum,
    1755              :                                 primaryAirSysName);
    1756              : 
    1757         2314 :             SetupOutputVariable(state,
    1758              :                                 "Air System Heat Exchanger Total Cooling Energy",
    1759              :                                 Constant::Units::J,
    1760         1157 :                                 thisSysLoadRepVars.HeatExCLNG,
    1761              :                                 OutputProcessor::TimeStepType::System,
    1762              :                                 OutputProcessor::StoreType::Sum,
    1763              :                                 primaryAirSysName);
    1764              : 
    1765         2314 :             SetupOutputVariable(state,
    1766              :                                 "Air System Solar Collector Total Heating Energy",
    1767              :                                 Constant::Units::J,
    1768         1157 :                                 thisSysLoadRepVars.SolarCollectHeating,
    1769              :                                 OutputProcessor::TimeStepType::System,
    1770              :                                 OutputProcessor::StoreType::Sum,
    1771              :                                 primaryAirSysName);
    1772              : 
    1773         2314 :             SetupOutputVariable(state,
    1774              :                                 "Air System Solar Collector Total Cooling Energy",
    1775              :                                 Constant::Units::J,
    1776         1157 :                                 thisSysLoadRepVars.SolarCollectCooling,
    1777              :                                 OutputProcessor::TimeStepType::System,
    1778              :                                 OutputProcessor::StoreType::Sum,
    1779              :                                 primaryAirSysName);
    1780              : 
    1781         2314 :             SetupOutputVariable(state,
    1782              :                                 "Air System User Defined Air Terminal Total Heating Energy",
    1783              :                                 Constant::Units::J,
    1784         1157 :                                 thisSysLoadRepVars.UserDefinedTerminalHeating,
    1785              :                                 OutputProcessor::TimeStepType::System,
    1786              :                                 OutputProcessor::StoreType::Sum,
    1787              :                                 primaryAirSysName);
    1788              : 
    1789         2314 :             SetupOutputVariable(state,
    1790              :                                 "Air System User Defined Air Terminal Total Cooling Energy",
    1791              :                                 Constant::Units::J,
    1792         1157 :                                 thisSysLoadRepVars.UserDefinedTerminalCooling,
    1793              :                                 OutputProcessor::TimeStepType::System,
    1794              :                                 OutputProcessor::StoreType::Sum,
    1795              :                                 primaryAirSysName);
    1796              : 
    1797         2314 :             SetupOutputVariable(state,
    1798              :                                 "Air System Humidifier Total Heating Energy",
    1799              :                                 Constant::Units::J,
    1800         1157 :                                 thisSysLoadRepVars.HumidHTNG,
    1801              :                                 OutputProcessor::TimeStepType::System,
    1802              :                                 OutputProcessor::StoreType::Sum,
    1803              :                                 primaryAirSysName);
    1804              : 
    1805         2314 :             SetupOutputVariable(state,
    1806              :                                 "Air System Evaporative Cooler Total Cooling Energy",
    1807              :                                 Constant::Units::J,
    1808         1157 :                                 thisSysLoadRepVars.EvapCLNG,
    1809              :                                 OutputProcessor::TimeStepType::System,
    1810              :                                 OutputProcessor::StoreType::Sum,
    1811              :                                 primaryAirSysName);
    1812              : 
    1813         2314 :             SetupOutputVariable(state,
    1814              :                                 "Air System Desiccant Dehumidifier Total Cooling Energy",
    1815              :                                 Constant::Units::J,
    1816         1157 :                                 thisSysLoadRepVars.DesDehumidCLNG,
    1817              :                                 OutputProcessor::TimeStepType::System,
    1818              :                                 OutputProcessor::StoreType::Sum,
    1819              :                                 primaryAirSysName);
    1820              : 
    1821              :             // SYSTEM COMPONENT ENERGY REPORT
    1822         2314 :             SetupOutputVariable(state,
    1823              :                                 "Air System Fan Electricity Energy",
    1824              :                                 Constant::Units::J,
    1825         1157 :                                 thisSysLoadRepVars.FANCompElec,
    1826              :                                 OutputProcessor::TimeStepType::System,
    1827              :                                 OutputProcessor::StoreType::Sum,
    1828              :                                 primaryAirSysName);
    1829              : 
    1830         2314 :             SetupOutputVariable(state,
    1831              :                                 "Air System Heating Coil Hot Water Energy",
    1832              :                                 Constant::Units::J,
    1833         1157 :                                 thisSysLoadRepVars.HCCompH2OHOT,
    1834              :                                 OutputProcessor::TimeStepType::System,
    1835              :                                 OutputProcessor::StoreType::Sum,
    1836              :                                 primaryAirSysName);
    1837              : 
    1838         2314 :             SetupOutputVariable(state,
    1839              :                                 "Air System Cooling Coil Chilled Water Energy",
    1840              :                                 Constant::Units::J,
    1841         1157 :                                 thisSysLoadRepVars.CCCompH2OCOLD,
    1842              :                                 OutputProcessor::TimeStepType::System,
    1843              :                                 OutputProcessor::StoreType::Sum,
    1844              :                                 primaryAirSysName);
    1845              : 
    1846         2314 :             SetupOutputVariable(state,
    1847              :                                 "Air System DX Heating Coil Electricity Energy",
    1848              :                                 Constant::Units::J,
    1849         1157 :                                 thisSysLoadRepVars.HCCompElec,
    1850              :                                 OutputProcessor::TimeStepType::System,
    1851              :                                 OutputProcessor::StoreType::Sum,
    1852              :                                 primaryAirSysName);
    1853              : 
    1854         2314 :             SetupOutputVariable(state,
    1855              :                                 "Air System DX Cooling Coil Electricity Energy",
    1856              :                                 Constant::Units::J,
    1857         1157 :                                 thisSysLoadRepVars.CCCompElec,
    1858              :                                 OutputProcessor::TimeStepType::System,
    1859              :                                 OutputProcessor::StoreType::Sum,
    1860              :                                 primaryAirSysName);
    1861              : 
    1862         2314 :             SetupOutputVariable(state,
    1863              :                                 "Air System Heating Coil Electricity Energy",
    1864              :                                 Constant::Units::J,
    1865         1157 :                                 thisSysLoadRepVars.HCCompElecRes,
    1866              :                                 OutputProcessor::TimeStepType::System,
    1867              :                                 OutputProcessor::StoreType::Sum,
    1868              :                                 primaryAirSysName);
    1869              : 
    1870         2314 :             SetupOutputVariable(state,
    1871              :                                 "Air System Heating Coil NaturalGas Energy",
    1872              :                                 Constant::Units::J,
    1873         1157 :                                 thisSysLoadRepVars.HCCompNaturalGas,
    1874              :                                 OutputProcessor::TimeStepType::System,
    1875              :                                 OutputProcessor::StoreType::Sum,
    1876              :                                 primaryAirSysName);
    1877              : 
    1878         2314 :             SetupOutputVariable(state,
    1879              :                                 "Air System Heating Coil Propane Energy",
    1880              :                                 Constant::Units::J,
    1881         1157 :                                 thisSysLoadRepVars.HCCompPropane,
    1882              :                                 OutputProcessor::TimeStepType::System,
    1883              :                                 OutputProcessor::StoreType::Sum,
    1884              :                                 primaryAirSysName);
    1885              : 
    1886         2314 :             SetupOutputVariable(state,
    1887              :                                 "Air System Heating Coil Steam Energy",
    1888              :                                 Constant::Units::J,
    1889         1157 :                                 thisSysLoadRepVars.HCCompSteam,
    1890              :                                 OutputProcessor::TimeStepType::System,
    1891              :                                 OutputProcessor::StoreType::Sum,
    1892              :                                 primaryAirSysName);
    1893              : 
    1894         2314 :             SetupOutputVariable(state,
    1895              :                                 "Air System Humidifier Electricity Energy",
    1896              :                                 Constant::Units::J,
    1897         1157 :                                 thisSysLoadRepVars.HumidElec,
    1898              :                                 OutputProcessor::TimeStepType::System,
    1899              :                                 OutputProcessor::StoreType::Sum,
    1900              :                                 primaryAirSysName);
    1901              : 
    1902         2314 :             SetupOutputVariable(state,
    1903              :                                 "Air System Humidifier NaturalGas Energy",
    1904              :                                 Constant::Units::J,
    1905         1157 :                                 thisSysLoadRepVars.HumidNaturalGas,
    1906              :                                 OutputProcessor::TimeStepType::System,
    1907              :                                 OutputProcessor::StoreType::Sum,
    1908              :                                 primaryAirSysName);
    1909              : 
    1910         2314 :             SetupOutputVariable(state,
    1911              :                                 "Air System Humidifier Propane Energy",
    1912              :                                 Constant::Units::J,
    1913         1157 :                                 thisSysLoadRepVars.HumidPropane,
    1914              :                                 OutputProcessor::TimeStepType::System,
    1915              :                                 OutputProcessor::StoreType::Sum,
    1916              :                                 primaryAirSysName);
    1917              : 
    1918         2314 :             SetupOutputVariable(state,
    1919              :                                 "Air System Evaporative Cooler Electricity Energy",
    1920              :                                 Constant::Units::J,
    1921         1157 :                                 thisSysLoadRepVars.EvapElec,
    1922              :                                 OutputProcessor::TimeStepType::System,
    1923              :                                 OutputProcessor::StoreType::Sum,
    1924              :                                 primaryAirSysName);
    1925              : 
    1926         2314 :             SetupOutputVariable(state,
    1927              :                                 "Air System Desiccant Dehumidifier Electricity Energy",
    1928              :                                 Constant::Units::J,
    1929         1157 :                                 thisSysLoadRepVars.DesDehumidElec,
    1930              :                                 OutputProcessor::TimeStepType::System,
    1931              :                                 OutputProcessor::StoreType::Sum,
    1932              :                                 primaryAirSysName);
    1933              : 
    1934         2314 :             SetupOutputVariable(state,
    1935              :                                 "Air System Mechanical Ventilation Flow Rate",
    1936              :                                 Constant::Units::m3_s,
    1937         1157 :                                 thisSysVentRepVars.MechVentFlow,
    1938              :                                 OutputProcessor::TimeStepType::System,
    1939              :                                 OutputProcessor::StoreType::Average,
    1940              :                                 primaryAirSysName);
    1941              : 
    1942         2314 :             SetupOutputVariable(state,
    1943              :                                 "Air System Natural Ventilation Flow Rate",
    1944              :                                 Constant::Units::m3_s,
    1945         1157 :                                 thisSysVentRepVars.NatVentFlow,
    1946              :                                 OutputProcessor::TimeStepType::System,
    1947              :                                 OutputProcessor::StoreType::Average,
    1948              :                                 primaryAirSysName);
    1949              : 
    1950         2314 :             SetupOutputVariable(state,
    1951              :                                 "Air System Target Voz Ventilation Flow Rate",
    1952              :                                 Constant::Units::m3_s,
    1953         1157 :                                 thisSysVentRepVars.TargetVentilationFlowVoz,
    1954              :                                 OutputProcessor::TimeStepType::System,
    1955              :                                 OutputProcessor::StoreType::Average,
    1956              :                                 primaryAirSysName);
    1957              : 
    1958         2314 :             SetupOutputVariable(state,
    1959              :                                 "Air System Ventilation Below Target Voz Time",
    1960              :                                 Constant::Units::hr,
    1961         1157 :                                 thisSysVentRepVars.TimeBelowVozDyn,
    1962              :                                 OutputProcessor::TimeStepType::System,
    1963              :                                 OutputProcessor::StoreType::Sum,
    1964              :                                 primaryAirSysName);
    1965              : 
    1966         2314 :             SetupOutputVariable(state,
    1967              :                                 "Air System Ventilation At Target Voz Time",
    1968              :                                 Constant::Units::hr,
    1969         1157 :                                 thisSysVentRepVars.TimeAtVozDyn,
    1970              :                                 OutputProcessor::TimeStepType::System,
    1971              :                                 OutputProcessor::StoreType::Sum,
    1972              :                                 primaryAirSysName);
    1973              : 
    1974         2314 :             SetupOutputVariable(state,
    1975              :                                 "Air System Ventilation Above Target Voz Time",
    1976              :                                 Constant::Units::hr,
    1977         1157 :                                 thisSysVentRepVars.TimeAboveVozDyn,
    1978              :                                 OutputProcessor::TimeStepType::System,
    1979              :                                 OutputProcessor::StoreType::Sum,
    1980              :                                 primaryAirSysName);
    1981              : 
    1982         2314 :             SetupOutputVariable(state,
    1983              :                                 "Air System Ventilation When Unoccupied Time",
    1984              :                                 Constant::Units::hr,
    1985         1157 :                                 thisSysVentRepVars.TimeVentUnocc,
    1986              :                                 OutputProcessor::TimeStepType::System,
    1987              :                                 OutputProcessor::StoreType::Sum,
    1988              :                                 primaryAirSysName);
    1989         1157 :         }
    1990              :     }
    1991         5627 :     for (int ZoneIndex = 1; ZoneIndex <= state.dataGlobal->NumOfZones; ++ZoneIndex) {
    1992         4845 :         if (!state.dataZoneEquip->ZoneEquipConfig(ZoneIndex).IsControlled) {
    1993          727 :             continue;
    1994              :         }
    1995         4118 :         auto &thisZoneVentRepVars = state.dataSysRpts->ZoneVentRepVars(ZoneIndex);
    1996         4118 :         auto &thisZoneName = state.dataZoneEquip->ZoneEquipConfig(ZoneIndex).ZoneName;
    1997              :         // CurrentModuleObject='Zones(Controlled)'
    1998         4118 :         if (state.dataSysRpts->VentLoadsReportEnabled) {
    1999              :             // Cooling Loads
    2000         8236 :             SetupOutputVariable(state,
    2001              :                                 "Zone Mechanical Ventilation No Load Heat Removal Energy",
    2002              :                                 Constant::Units::J,
    2003         4118 :                                 thisZoneVentRepVars.NoLoadCoolingByVent,
    2004              :                                 OutputProcessor::TimeStepType::System,
    2005              :                                 OutputProcessor::StoreType::Sum,
    2006              :                                 thisZoneName);
    2007              : 
    2008         8236 :             SetupOutputVariable(state,
    2009              :                                 "Zone Mechanical Ventilation Cooling Load Increase Energy",
    2010              :                                 Constant::Units::J,
    2011         4118 :                                 thisZoneVentRepVars.CoolingLoadAddedByVent,
    2012              :                                 OutputProcessor::TimeStepType::System,
    2013              :                                 OutputProcessor::StoreType::Sum,
    2014              :                                 thisZoneName);
    2015              : 
    2016         8236 :             SetupOutputVariable(state,
    2017              :                                 "Zone Mechanical Ventilation Cooling Load Increase Due to Overheating Energy",
    2018              :                                 Constant::Units::J,
    2019         4118 :                                 thisZoneVentRepVars.OverheatingByVent,
    2020              :                                 OutputProcessor::TimeStepType::System,
    2021              :                                 OutputProcessor::StoreType::Sum,
    2022              :                                 thisZoneName);
    2023              : 
    2024         8236 :             SetupOutputVariable(state,
    2025              :                                 "Zone Mechanical Ventilation Cooling Load Decrease Energy",
    2026              :                                 Constant::Units::J,
    2027         4118 :                                 thisZoneVentRepVars.CoolingLoadMetByVent,
    2028              :                                 OutputProcessor::TimeStepType::System,
    2029              :                                 OutputProcessor::StoreType::Sum,
    2030              :                                 thisZoneName);
    2031              :             // Heating Loads
    2032         8236 :             SetupOutputVariable(state,
    2033              :                                 "Zone Mechanical Ventilation No Load Heat Addition Energy",
    2034              :                                 Constant::Units::J,
    2035         4118 :                                 thisZoneVentRepVars.NoLoadHeatingByVent,
    2036              :                                 OutputProcessor::TimeStepType::System,
    2037              :                                 OutputProcessor::StoreType::Sum,
    2038              :                                 thisZoneName);
    2039              : 
    2040         8236 :             SetupOutputVariable(state,
    2041              :                                 "Zone Mechanical Ventilation Heating Load Increase Energy",
    2042              :                                 Constant::Units::J,
    2043         4118 :                                 thisZoneVentRepVars.HeatingLoadAddedByVent,
    2044              :                                 OutputProcessor::TimeStepType::System,
    2045              :                                 OutputProcessor::StoreType::Sum,
    2046              :                                 thisZoneName);
    2047              : 
    2048         8236 :             SetupOutputVariable(state,
    2049              :                                 "Zone Mechanical Ventilation Heating Load Increase Due to Overcooling Energy",
    2050              :                                 Constant::Units::J,
    2051         4118 :                                 thisZoneVentRepVars.OvercoolingByVent,
    2052              :                                 OutputProcessor::TimeStepType::System,
    2053              :                                 OutputProcessor::StoreType::Sum,
    2054              :                                 thisZoneName);
    2055              : 
    2056         8236 :             SetupOutputVariable(state,
    2057              :                                 "Zone Mechanical Ventilation Heating Load Decrease Energy",
    2058              :                                 Constant::Units::J,
    2059         4118 :                                 thisZoneVentRepVars.HeatingLoadMetByVent,
    2060              :                                 OutputProcessor::TimeStepType::System,
    2061              :                                 OutputProcessor::StoreType::Sum,
    2062              :                                 thisZoneName);
    2063              :         }
    2064              : 
    2065         8236 :         SetupOutputVariable(state,
    2066              :                             "Zone Mechanical Ventilation Mass Flow Rate",
    2067              :                             Constant::Units::kg_s,
    2068         4118 :                             thisZoneVentRepVars.OAMassFlow,
    2069              :                             OutputProcessor::TimeStepType::System,
    2070              :                             OutputProcessor::StoreType::Average,
    2071              :                             thisZoneName);
    2072              : 
    2073         8236 :         SetupOutputVariable(state,
    2074              :                             "Zone Mechanical Ventilation Mass",
    2075              :                             Constant::Units::kg,
    2076         4118 :                             thisZoneVentRepVars.OAMass,
    2077              :                             OutputProcessor::TimeStepType::System,
    2078              :                             OutputProcessor::StoreType::Sum,
    2079              :                             thisZoneName);
    2080              : 
    2081         8236 :         SetupOutputVariable(state,
    2082              :                             "Zone Mechanical Ventilation Standard Density Volume Flow Rate",
    2083              :                             Constant::Units::m3_s,
    2084         4118 :                             thisZoneVentRepVars.OAVolFlowStdRho,
    2085              :                             OutputProcessor::TimeStepType::System,
    2086              :                             OutputProcessor::StoreType::Average,
    2087              :                             thisZoneName);
    2088              : 
    2089         8236 :         SetupOutputVariable(state,
    2090              :                             "Zone Mechanical Ventilation Standard Density Volume",
    2091              :                             Constant::Units::m3,
    2092         4118 :                             thisZoneVentRepVars.OAVolStdRho,
    2093              :                             OutputProcessor::TimeStepType::System,
    2094              :                             OutputProcessor::StoreType::Sum,
    2095              :                             thisZoneName);
    2096              : 
    2097         8236 :         SetupOutputVariable(state,
    2098              :                             "Zone Mechanical Ventilation Current Density Volume Flow Rate",
    2099              :                             Constant::Units::m3_s,
    2100         4118 :                             thisZoneVentRepVars.OAVolFlowCrntRho,
    2101              :                             OutputProcessor::TimeStepType::System,
    2102              :                             OutputProcessor::StoreType::Average,
    2103              :                             thisZoneName);
    2104              : 
    2105         8236 :         SetupOutputVariable(state,
    2106              :                             "Zone Mechanical Ventilation Current Density Volume",
    2107              :                             Constant::Units::m3,
    2108         4118 :                             thisZoneVentRepVars.OAVolCrntRho,
    2109              :                             OutputProcessor::TimeStepType::System,
    2110              :                             OutputProcessor::StoreType::Sum,
    2111              :                             thisZoneName);
    2112              : 
    2113         8236 :         SetupOutputVariable(state,
    2114              :                             "Zone Mechanical Ventilation Air Changes per Hour",
    2115              :                             Constant::Units::ach,
    2116         4118 :                             thisZoneVentRepVars.MechACH,
    2117              :                             OutputProcessor::TimeStepType::System,
    2118              :                             OutputProcessor::StoreType::Average,
    2119              :                             thisZoneName);
    2120              : 
    2121         8236 :         SetupOutputVariable(state,
    2122              :                             "Zone Target Voz Ventilation Flow Rate",
    2123              :                             Constant::Units::m3_s,
    2124         4118 :                             thisZoneVentRepVars.TargetVentilationFlowVoz,
    2125              :                             OutputProcessor::TimeStepType::System,
    2126              :                             OutputProcessor::StoreType::Average,
    2127              :                             thisZoneName);
    2128              : 
    2129         8236 :         SetupOutputVariable(state,
    2130              :                             "Zone Ventilation Below Target Voz Time",
    2131              :                             Constant::Units::hr,
    2132         4118 :                             thisZoneVentRepVars.TimeBelowVozDyn,
    2133              :                             OutputProcessor::TimeStepType::System,
    2134              :                             OutputProcessor::StoreType::Sum,
    2135              :                             thisZoneName);
    2136              : 
    2137         8236 :         SetupOutputVariable(state,
    2138              :                             "Zone Ventilation At Target Voz Time",
    2139              :                             Constant::Units::hr,
    2140         4118 :                             thisZoneVentRepVars.TimeAtVozDyn,
    2141              :                             OutputProcessor::TimeStepType::System,
    2142              :                             OutputProcessor::StoreType::Sum,
    2143              :                             thisZoneName);
    2144              : 
    2145         8236 :         SetupOutputVariable(state,
    2146              :                             "Zone Ventilation Above Target Voz Time",
    2147              :                             Constant::Units::hr,
    2148         4118 :                             thisZoneVentRepVars.TimeAboveVozDyn,
    2149              :                             OutputProcessor::TimeStepType::System,
    2150              :                             OutputProcessor::StoreType::Sum,
    2151              :                             thisZoneName);
    2152              : 
    2153         8236 :         SetupOutputVariable(state,
    2154              :                             "Zone Ventilation When Unoccupied Time",
    2155              :                             Constant::Units::hr,
    2156         4118 :                             thisZoneVentRepVars.TimeVentUnocc,
    2157              :                             OutputProcessor::TimeStepType::System,
    2158              :                             OutputProcessor::StoreType::Sum,
    2159              :                             thisZoneName);
    2160              :     }
    2161              : 
    2162              :     // Facility outputs
    2163         3128 :     SetupOutputVariable(state,
    2164              :                         "Facility Any Zone Ventilation Below Target Voz Time",
    2165              :                         Constant::Units::hr,
    2166          782 :                         state.dataSysRpts->AnyZoneTimeBelowVozDyn,
    2167              :                         OutputProcessor::TimeStepType::System,
    2168              :                         OutputProcessor::StoreType::Sum,
    2169              :                         "Facility");
    2170              : 
    2171         3128 :     SetupOutputVariable(state,
    2172              :                         "Facility All Zones Ventilation At Target Voz Time",
    2173              :                         Constant::Units::hr,
    2174          782 :                         state.dataSysRpts->AllZonesTimeAtVozDyn,
    2175              :                         OutputProcessor::TimeStepType::System,
    2176              :                         OutputProcessor::StoreType::Sum,
    2177              :                         "Facility");
    2178              : 
    2179         3128 :     SetupOutputVariable(state,
    2180              :                         "Facility Any Zone Ventilation Above Target Voz Time",
    2181              :                         Constant::Units::hr,
    2182          782 :                         state.dataSysRpts->AnyZoneTimeAboveVozDyn,
    2183              :                         OutputProcessor::TimeStepType::System,
    2184              :                         OutputProcessor::StoreType::Sum,
    2185              :                         "Facility");
    2186              : 
    2187         3128 :     SetupOutputVariable(state,
    2188              :                         "Facility Any Zone Ventilation When Unoccupied Time",
    2189              :                         Constant::Units::hr,
    2190          782 :                         state.dataSysRpts->AnyZoneTimeVentUnocc,
    2191              :                         OutputProcessor::TimeStepType::System,
    2192              :                         OutputProcessor::StoreType::Sum,
    2193              :                         "Facility");
    2194          782 : }
    2195              : 
    2196          782 : 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          782 :     EPVector<DataLoopNode::ConnectionObjectType> SubCompTypes;
    2228          782 :     Array1D_string SubCompNames;
    2229          782 :     Array1D_string InletNodeNames;
    2230          782 :     Array1D_int InletNodeNumbers;
    2231          782 :     Array1D<NodeInputManager::CompFluidStream> InletFluidStreams;
    2232          782 :     Array1D_string OutletNodeNames;
    2233          782 :     Array1D_int OutletNodeNumbers;
    2234          782 :     Array1D<NodeInputManager::CompFluidStream> OutletFluidStreams;
    2235              :     int NumChildren;
    2236              :     int NumGrandChildren;
    2237              :     bool IsParent;
    2238              : 
    2239              :     // Dimension GetMeteredVariables arrays
    2240          782 :     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          782 :     state.dataSysRpts->VentReportStructureCreated = true;
    2247         1939 :     for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
    2248         2333 :         for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
    2249         4733 :             for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2250              :                 DataLoopNode::ConnectionObjectType TypeOfComp = static_cast<DataLoopNode::ConnectionObjectType>(
    2251         3557 :                     EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC,
    2252         3557 :                                              state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf));
    2253         3557 :                 std::string &NameOfComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Name;
    2254              :                 // Get complete list of components for complex branches
    2255         3557 :                 if (BranchNodeConnections::IsParentObject(state, TypeOfComp, NameOfComp)) {
    2256              : 
    2257         1757 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Parent = true;
    2258         1757 :                     NumChildren = BranchNodeConnections::GetNumChildren(state, TypeOfComp, NameOfComp);
    2259              : 
    2260         1757 :                     SubCompTypes.allocate(NumChildren);
    2261         1757 :                     SubCompNames.allocate(NumChildren);
    2262         1757 :                     InletNodeNames.allocate(NumChildren);
    2263         1757 :                     InletNodeNumbers.allocate(NumChildren);
    2264         1757 :                     OutletNodeNames.allocate(NumChildren);
    2265         1757 :                     OutletNodeNumbers.allocate(NumChildren);
    2266         1757 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp.allocate(NumChildren);
    2267              : 
    2268         1757 :                     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         4866 :                     for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2281              :                         {
    2282              :                             auto &thisSubComponent =
    2283         3109 :                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum);
    2284         3109 :                             thisSubComponent.TypeOf = BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubCompNum))];
    2285         3109 :                             thisSubComponent.Name = SubCompNames(SubCompNum);
    2286         3109 :                             thisSubComponent.NodeNameIn = InletNodeNames(SubCompNum);
    2287         3109 :                             thisSubComponent.NodeNameOut = OutletNodeNames(SubCompNum);
    2288         3109 :                             thisSubComponent.NodeNumIn = InletNodeNumbers(SubCompNum);
    2289         3109 :                             thisSubComponent.NodeNumOut = OutletNodeNumbers(SubCompNum);
    2290              :                         }
    2291              :                     }
    2292              : 
    2293         1757 :                     SubCompTypes.deallocate();
    2294         1757 :                     SubCompNames.deallocate();
    2295         1757 :                     InletNodeNames.deallocate();
    2296         1757 :                     InletNodeNumbers.deallocate();
    2297         1757 :                     OutletNodeNames.deallocate();
    2298         1757 :                     OutletNodeNumbers.deallocate();
    2299              : 
    2300              :                 } else {
    2301         1800 :                     NumChildren = 0;
    2302         1800 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).Parent = false;
    2303              :                 }
    2304         3557 :                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NumSubComps = NumChildren;
    2305              : 
    2306              :                 // check for 'grandchildren'
    2307         6666 :                 for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2308         3109 :                     DataLoopNode::ConnectionObjectType TypeOfSubComp = static_cast<DataLoopNode::ConnectionObjectType>(EnergyPlus::getEnumValue(
    2309              :                         BranchNodeConnections::ConnectionObjectTypeNamesUC,
    2310         3109 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).TypeOf));
    2311              :                     std::string &NameOfSubComp =
    2312         3109 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).Name;
    2313         3109 :                     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         3094 :                         NumGrandChildren = 0;
    2370         3094 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).Parent = false;
    2371              :                     }
    2372              : 
    2373         3109 :                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).SubComp(SubCompNum).NumSubSubComps =
    2374              :                         NumGrandChildren;
    2375              :                 }
    2376              :             }
    2377              :         }
    2378              :     }
    2379              : 
    2380         1939 :     for (AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
    2381         2333 :         for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
    2382         4733 :             for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2383              :                 // Get complete list of components for complex branches
    2384              :                 {
    2385         3557 :                     auto &thisComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum);
    2386         3557 :                     std::string &TypeOfComp = thisComp.TypeOf;
    2387         3557 :                     std::string &NameOfComp = thisComp.Name;
    2388         3557 :                     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    2389         3557 :                     if (NumVariables > 0) {
    2390         1915 :                         meteredVars.allocate(NumVariables);
    2391         1915 :                         thisComp.MeteredVar.allocate(NumVariables);
    2392              : 
    2393         1915 :                         thisComp.NumMeteredVars = NumVariables;
    2394         1915 :                         GetMeteredVariables(state, NameOfComp, meteredVars);
    2395         1915 :                         ModeFlagOn = true;
    2396         5574 :                         for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2397              :                             {
    2398         3659 :                                 thisComp.MeteredVar(VarNum) = meteredVars(VarNum); // Copy
    2399         3659 :                                 auto &thisVar = thisComp.MeteredVar(VarNum);
    2400         3659 :                                 if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2401         2319 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2402         1693 :                                         thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2403              :                                     }
    2404          626 :                                     ModeFlagOn = false;
    2405         3033 :                                 } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2406         1221 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2407          814 :                                         thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2408              :                                     }
    2409          407 :                                     ModeFlagOn = false;
    2410         2626 :                                 } else if (ModeFlagOn) {
    2411         1152 :                                     thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2412              :                                 }
    2413              :                             }
    2414              :                         }
    2415              : 
    2416         1915 :                         meteredVars.deallocate();
    2417              :                     }
    2418         6666 :                     for (SubCompNum = 1; SubCompNum <= thisComp.NumSubComps; ++SubCompNum) {
    2419              :                         // Get complete list of components for complex branches
    2420         3109 :                         std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf;
    2421         3109 :                         std::string &NameOfSubComp = thisComp.SubComp(SubCompNum).Name;
    2422         3109 :                         NumVariables = GetNumMeteredVariables(state, TypeOfSubComp, NameOfSubComp);
    2423         3109 :                         if (NumVariables > 0) {
    2424         2086 :                             meteredVars.allocate(NumVariables);
    2425         2086 :                             thisComp.SubComp(SubCompNum).MeteredVar.allocate(NumVariables);
    2426              : 
    2427         2086 :                             GetMeteredVariables(state, NameOfSubComp, meteredVars);
    2428         2086 :                             ModeFlagOn = true;
    2429         7489 :                             for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2430              :                                 {
    2431         5403 :                                     thisComp.SubComp(SubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2432         5403 :                                     auto &thisVar = thisComp.SubComp(SubCompNum).MeteredVar(VarNum);
    2433         5403 :                                     if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2434         3307 :                                         for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2435         2547 :                                             thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2436              :                                         }
    2437          760 :                                         ModeFlagOn = false;
    2438         4643 :                                     } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2439         2945 :                                         for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2440         2181 :                                             thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2441              :                                         }
    2442          764 :                                         ModeFlagOn = false;
    2443         3879 :                                     } else if (ModeFlagOn) {
    2444          984 :                                         thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2445              :                                     }
    2446              :                                 }
    2447              :                             }
    2448              : 
    2449         2086 :                             meteredVars.deallocate();
    2450              :                         }
    2451              : 
    2452         3109 :                         thisComp.SubComp(SubCompNum).NumMeteredVars = NumVariables;
    2453              : 
    2454         3145 :                         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         5627 :     for (CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    2499         4845 :         if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) {
    2500          727 :             continue;
    2501              :         }
    2502              :         // Set index of air loop serving zone
    2503         8912 :         for (CompNum = 1; CompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).NumOfEquipTypes; ++CompNum) {
    2504         4794 :             std::string &TypeOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipTypeName(CompNum);
    2505         4794 :             std::string &NameOfComp = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipName(CompNum);
    2506              :             DataLoopNode::ConnectionObjectType TypeOfCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2507         4794 :                 EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp));
    2508         4794 :             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         4794 :                 auto &thisEquipData = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipData(CompNum);
    2522         4794 :                 thisEquipData.TypeOf = TypeOfComp;
    2523         4794 :                 thisEquipData.Name = NameOfComp;
    2524         4794 :                 thisEquipData.OutletNodeNums.allocate(NumOutlets);
    2525         4794 :                 thisEquipData.NumOutlets = NumOutlets;
    2526         4794 :                 thisEquipData.OutletNodeNums = OutletNodeNumbers;
    2527         4794 :                 thisEquipData.InletNodeNums.allocate(NumInlets);
    2528         4794 :                 thisEquipData.NumInlets = NumInlets;
    2529         4794 :                 thisEquipData.InletNodeNums = InletNodeNumbers;
    2530         4794 :                 thisEquipData.Parent = IsParent;
    2531         4794 :                 NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    2532         4794 :                 thisEquipData.NumMeteredVars = NumVariables;
    2533         4794 :                 if (NumVariables > 0) {
    2534          711 :                     InletNodeNames.deallocate();
    2535          711 :                     InletNodeNumbers.deallocate();
    2536          711 :                     InletFluidStreams.deallocate();
    2537          711 :                     OutletNodeNames.deallocate();
    2538          711 :                     OutletNodeNumbers.deallocate();
    2539          711 :                     OutletFluidStreams.deallocate();
    2540              : 
    2541          711 :                     meteredVars.allocate(NumVariables);
    2542          711 :                     thisEquipData.MeteredVar.allocate(NumVariables);
    2543              : 
    2544          711 :                     GetMeteredVariables(state, NameOfComp, meteredVars);
    2545              : 
    2546          711 :                     ModeFlagOn = true;
    2547         2133 :                     for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2548              :                         {
    2549         1422 :                             thisEquipData.MeteredVar(VarNum) = meteredVars(VarNum);
    2550         1422 :                             auto &thisVar = thisEquipData.MeteredVar(VarNum);
    2551         1422 :                             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         1330 :                             } 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         1259 :                             } else if (ModeFlagOn) {
    2562          967 :                                 thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2563              :                             }
    2564              :                         }
    2565              :                     }
    2566              : 
    2567          711 :                     meteredVars.deallocate();
    2568              :                 }
    2569              : 
    2570         4794 :                 if (BranchNodeConnections::IsParentObject(state, TypeOfCompNum, NameOfComp)) {
    2571         4227 :                     NumChildren = BranchNodeConnections::GetNumChildren(state, TypeOfCompNum, NameOfComp);
    2572         4227 :                     thisEquipData.NumSubEquip = NumChildren;
    2573              : 
    2574         4227 :                     SubCompTypes.allocate(NumChildren);
    2575         4227 :                     SubCompNames.allocate(NumChildren);
    2576         4227 :                     InletNodeNames.allocate(NumChildren);
    2577         4227 :                     InletNodeNumbers.allocate(NumChildren);
    2578         4227 :                     OutletNodeNames.allocate(NumChildren);
    2579         4227 :                     OutletNodeNumbers.allocate(NumChildren);
    2580         4227 :                     thisEquipData.SubEquipData.allocate(NumChildren);
    2581              : 
    2582         4227 :                     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        10526 :                     for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2595         6299 :                         thisEquipData.SubEquipData(SubCompNum).TypeOf =
    2596        12598 :                             BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubCompNum))];
    2597         6299 :                         thisEquipData.SubEquipData(SubCompNum).Name = SubCompNames(SubCompNum);
    2598         6299 :                         thisEquipData.SubEquipData(SubCompNum).OutletNodeNum = OutletNodeNumbers(SubCompNum);
    2599         6299 :                         thisEquipData.SubEquipData(SubCompNum).InletNodeNum = InletNodeNumbers(SubCompNum);
    2600              :                     }
    2601              : 
    2602         4227 :                     SubCompTypes.deallocate();
    2603         4227 :                     SubCompNames.deallocate();
    2604         4227 :                     InletNodeNames.deallocate();
    2605         4227 :                     InletNodeNumbers.deallocate();
    2606         4227 :                     OutletNodeNames.deallocate();
    2607         4227 :                     OutletNodeNumbers.deallocate();
    2608              :                 } else {
    2609          567 :                     NumChildren = 0;
    2610              :                 }
    2611              : 
    2612        11093 :                 for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2613         6299 :                     std::string &TypeOfSubComp = thisEquipData.SubEquipData(SubCompNum).TypeOf;
    2614         6299 :                     std::string &NameOfSubComp = thisEquipData.SubEquipData(SubCompNum).Name;
    2615              :                     DataLoopNode::ConnectionObjectType TypeOfSubCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2616         6299 :                         EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp));
    2617         6299 :                     if (BranchNodeConnections::IsParentObject(state, TypeOfSubCompNum, NameOfSubComp)) {
    2618         2293 :                         NumGrandChildren = BranchNodeConnections::GetNumChildren(state, TypeOfSubCompNum, NameOfSubComp);
    2619         2293 :                         thisEquipData.SubEquipData(SubCompNum).NumSubSubEquip = NumGrandChildren;
    2620         2293 :                         SubCompTypes.allocate(NumGrandChildren);
    2621         2293 :                         SubCompNames.allocate(NumGrandChildren);
    2622         2293 :                         InletNodeNames.allocate(NumGrandChildren);
    2623         2293 :                         InletNodeNumbers.allocate(NumGrandChildren);
    2624         2293 :                         OutletNodeNames.allocate(NumGrandChildren);
    2625         2293 :                         OutletNodeNumbers.allocate(NumGrandChildren);
    2626         2293 :                         thisEquipData.SubEquipData(SubCompNum).SubSubEquipData.allocate(NumGrandChildren);
    2627              :                         // Sankar added the array number for EquipData
    2628         2293 :                         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         4661 :                         for (SubSubCompNum = 1; SubSubCompNum <= NumGrandChildren; ++SubSubCompNum) {
    2641         2368 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).TypeOf =
    2642         4736 :                                 BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubSubCompNum))];
    2643         2368 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).Name = SubCompNames(SubSubCompNum);
    2644         2368 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).OutletNodeNum = OutletNodeNumbers(SubSubCompNum);
    2645         2368 :                             thisEquipData.SubEquipData(SubCompNum).SubSubEquipData(SubSubCompNum).InletNodeNum = InletNodeNumbers(SubSubCompNum);
    2646              :                         }
    2647         2293 :                         SubCompTypes.deallocate();
    2648         2293 :                         SubCompNames.deallocate();
    2649         2293 :                         InletNodeNames.deallocate();
    2650         2293 :                         InletNodeNumbers.deallocate();
    2651         2293 :                         OutletNodeNames.deallocate();
    2652         2293 :                         OutletNodeNumbers.deallocate();
    2653              :                     } else {
    2654         4006 :                         NumGrandChildren = 0;
    2655              :                     }
    2656              :                 } // for (SubCompNum)
    2657              :             }
    2658              :         } // for (CompNum)
    2659              :     } // for (CtrlZoneNum)
    2660              : 
    2661         5627 :     for (CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    2662         4845 :         if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) {
    2663          727 :             continue;
    2664              :         }
    2665         8912 :         for (CompNum = 1; CompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).NumOfEquipTypes; ++CompNum) {
    2666        11093 :             for (SubCompNum = 1; SubCompNum <= state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipData(CompNum).NumSubEquip; ++SubCompNum) {
    2667         6299 :                 auto &thisSubEquipData = state.dataZoneEquip->ZoneEquipList(CtrlZoneNum).EquipData(CompNum).SubEquipData(SubCompNum);
    2668         6299 :                 std::string &TypeOfSubComp = thisSubEquipData.TypeOf;
    2669         6299 :                 std::string &NameOfSubComp = thisSubEquipData.Name;
    2670              : 
    2671         6299 :                 NumVariables = GetNumMeteredVariables(state, TypeOfSubComp, NameOfSubComp);
    2672         6299 :                 thisSubEquipData.NumMeteredVars = NumVariables; // Sankar added this line
    2673         6299 :                 if (NumVariables > 0) {
    2674         2399 :                     meteredVars.allocate(NumVariables);
    2675         2399 :                     thisSubEquipData.MeteredVar.allocate(NumVariables);
    2676              : 
    2677         2399 :                     GetMeteredVariables(state, NameOfSubComp, meteredVars);
    2678              : 
    2679         2399 :                     ModeFlagOn = true;
    2680         7345 :                     for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2681         4946 :                         thisSubEquipData.MeteredVar(VarNum) = meteredVars(VarNum);
    2682         4946 :                         auto &thisVar = thisSubEquipData.MeteredVar(VarNum);
    2683         4946 :                         if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2684         2851 :                             for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2685         2080 :                                 thisSubEquipData.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2686              :                             }
    2687          771 :                             ModeFlagOn = false;
    2688         4175 :                         } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2689         2006 :                             for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2690         1435 :                                 thisSubEquipData.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2691              :                             }
    2692          571 :                             ModeFlagOn = false;
    2693         3604 :                         } else if (ModeFlagOn) {
    2694         1757 :                             thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2695              :                         }
    2696              :                     }
    2697              : 
    2698         2399 :                     meteredVars.deallocate();
    2699              :                 } // if (NumVariables > 0)
    2700              : 
    2701         8667 :                 for (SubSubCompNum = 1; SubSubCompNum <= thisSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
    2702         2368 :                     std::string &TypeOfSubSubComp = thisSubEquipData.SubSubEquipData(SubSubCompNum).TypeOf;
    2703         2368 :                     std::string &NameOfSubSubComp = thisSubEquipData.SubSubEquipData(SubSubCompNum).Name;
    2704              : 
    2705         2368 :                     NumVariables = GetNumMeteredVariables(state, TypeOfSubSubComp, NameOfSubSubComp);
    2706         2368 :                     thisSubEquipData.SubSubEquipData(SubSubCompNum).NumMeteredVars = NumVariables; // Sankar added this line
    2707         2368 :                     if (NumVariables > 0) {
    2708         2368 :                         meteredVars.allocate(NumVariables);
    2709         2368 :                         thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar.allocate(NumVariables);
    2710              : 
    2711         2368 :                         GetMeteredVariables(state, NameOfSubSubComp, meteredVars);
    2712         2368 :                         ModeFlagOn = true;
    2713         7251 :                         for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2714         4883 :                             thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2715         4883 :                             auto &thisVar = thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum);
    2716         4883 :                             if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2717         7029 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2718         4747 :                                     thisSubEquipData.SubSubEquipData(SubSubCompNum).MeteredVar(VarNum1).heatOrCool =
    2719              :                                         Constant::HeatOrCool::HeatingOnly;
    2720              :                                 }
    2721         2282 :                                 ModeFlagOn = false;
    2722         2601 :                             } 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         2584 :                             } else if (ModeFlagOn) {
    2729           73 :                                 thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2730              :                             }
    2731              :                         }
    2732              : 
    2733         2368 :                         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         1892 :     for (PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
    2750         3330 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2751              : 
    2752              :             // Report selection
    2753         2220 :             ReportLoopData *select_ThisReportData(nullptr);
    2754              : 
    2755         2220 :             assert(LoopSideNum == LoopSideLocation::Demand || LoopSideNum == LoopSideLocation::Supply);
    2756         2220 :             if (PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops) {
    2757         1712 :                 select_ThisReportData = &state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideNum)](PlantLoopNum);
    2758              :             } else { // CondLoop
    2759              :                 select_ThisReportData =
    2760          508 :                     &state.dataPlnt->VentRepCond[static_cast<int>(LoopSideNum)](PlantLoopNum - state.dataHVACGlobal->NumPlantLoops);
    2761              :             }
    2762              : 
    2763              :             // Object Data
    2764         2220 :             ReportLoopData &ThisReportData(*select_ThisReportData);
    2765              : 
    2766        15350 :             for (BranchNum = 1; BranchNum <= ThisReportData.TotalBranches; ++BranchNum) {
    2767        26336 :                 for (CompNum = 1; CompNum <= ThisReportData.Branch(BranchNum).TotalComponents; ++CompNum) {
    2768              :                     {
    2769        13206 :                         auto &thisComp = ThisReportData.Branch(BranchNum).Comp(CompNum);
    2770        13206 :                         std::string &TypeOfComp = thisComp.TypeOf;
    2771        13206 :                         std::string &NameOfComp = thisComp.Name;
    2772              :                         DataLoopNode::ConnectionObjectType TypeOfCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2773        13206 :                             EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfComp));
    2774              :                         // Get complete list of components for complex branches
    2775        13206 :                         if (BranchNodeConnections::IsParentObject(state, TypeOfCompNum, NameOfComp)) {
    2776              : 
    2777            8 :                             NumChildren = BranchNodeConnections::GetNumChildren(state, TypeOfCompNum, NameOfComp);
    2778              : 
    2779            8 :                             SubCompTypes.allocate(NumChildren);
    2780            8 :                             SubCompNames.allocate(NumChildren);
    2781            8 :                             InletNodeNames.allocate(NumChildren);
    2782            8 :                             InletNodeNumbers.allocate(NumChildren);
    2783            8 :                             OutletNodeNames.allocate(NumChildren);
    2784            8 :                             OutletNodeNumbers.allocate(NumChildren);
    2785            8 :                             thisComp.SubComp.allocate(NumChildren);
    2786              : 
    2787            8 :                             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           40 :                             for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2800           32 :                                 thisComp.SubComp(SubCompNum).TypeOf =
    2801           64 :                                     BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(SubCompTypes(SubCompNum))];
    2802           32 :                                 thisComp.SubComp(SubCompNum).Name = SubCompNames(SubCompNum);
    2803           32 :                                 thisComp.SubComp(SubCompNum).NodeNameIn = InletNodeNames(SubCompNum);
    2804           32 :                                 thisComp.SubComp(SubCompNum).NodeNameOut = OutletNodeNames(SubCompNum);
    2805           32 :                                 thisComp.SubComp(SubCompNum).NodeNumIn = InletNodeNumbers(SubCompNum);
    2806           32 :                                 thisComp.SubComp(SubCompNum).NodeNumOut = OutletNodeNumbers(SubCompNum);
    2807              :                             }
    2808              : 
    2809            8 :                             SubCompTypes.deallocate();
    2810            8 :                             SubCompNames.deallocate();
    2811            8 :                             InletNodeNames.deallocate();
    2812            8 :                             InletNodeNumbers.deallocate();
    2813            8 :                             OutletNodeNames.deallocate();
    2814            8 :                             OutletNodeNumbers.deallocate();
    2815              : 
    2816              :                         } else {
    2817        13198 :                             NumChildren = 0;
    2818              :                         }
    2819        13206 :                         thisComp.NumSubComps = NumChildren;
    2820              : 
    2821              :                         // check for 'grandchildren'
    2822        13238 :                         for (SubCompNum = 1; SubCompNum <= NumChildren; ++SubCompNum) {
    2823           32 :                             std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf;
    2824           32 :                             std::string NameOfSubComp = thisComp.SubComp(SubCompNum).Name;
    2825              :                             DataLoopNode::ConnectionObjectType TypeOfSubCompNum = static_cast<DataLoopNode::ConnectionObjectType>(
    2826           32 :                                 EnergyPlus::getEnumValue(BranchNodeConnections::ConnectionObjectTypeNamesUC, TypeOfSubComp));
    2827           32 :                             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           32 :                                 NumGrandChildren = 0;
    2870           32 :                                 thisComp.SubComp(SubCompNum).Parent = false;
    2871              :                             }
    2872              : 
    2873           32 :                             thisComp.SubComp(SubCompNum).NumSubSubComps = NumGrandChildren;
    2874           32 :                         }
    2875              :                     }
    2876              :                 }
    2877              :             }
    2878              :         }
    2879              :     }
    2880              : 
    2881         1892 :     for (PlantLoopNum = 1; PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops; ++PlantLoopNum) {
    2882              : 
    2883         3330 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2884              : 
    2885              :             // Report selection
    2886         2220 :             ReportLoopData *select_ThisReportData(nullptr);
    2887              : 
    2888         2220 :             assert(LoopSideNum == LoopSideLocation::Demand || LoopSideNum == LoopSideLocation::Supply);
    2889         2220 :             if (PlantLoopNum <= state.dataHVACGlobal->NumPlantLoops) {
    2890         1712 :                 select_ThisReportData = &state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideNum)](PlantLoopNum);
    2891              :             } else { // CondLoop
    2892              :                 select_ThisReportData =
    2893          508 :                     &state.dataPlnt->VentRepCond[static_cast<int>(LoopSideNum)](PlantLoopNum - state.dataHVACGlobal->NumPlantLoops);
    2894              :             }
    2895              : 
    2896              :             // Object Data
    2897         2220 :             ReportLoopData &ThisReportData(*select_ThisReportData);
    2898              : 
    2899        15350 :             for (BranchNum = 1; BranchNum <= ThisReportData.TotalBranches; ++BranchNum) {
    2900        26336 :                 for (CompNum = 1; CompNum <= ThisReportData.Branch(BranchNum).TotalComponents; ++CompNum) {
    2901              :                     // Get complete list of components for complex branches
    2902        13206 :                     auto &thisComp = ThisReportData.Branch(BranchNum).Comp(CompNum);
    2903        13206 :                     std::string &TypeOfComp = thisComp.TypeOf;
    2904        13206 :                     std::string &NameOfComp = thisComp.Name;
    2905        13206 :                     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    2906        13206 :                     if (NumVariables > 0) {
    2907         7775 :                         meteredVars.allocate(NumVariables);
    2908         7775 :                         thisComp.MeteredVar.allocate(NumVariables);
    2909              : 
    2910         7775 :                         thisComp.NumMeteredVars = NumVariables;
    2911         7775 :                         GetMeteredVariables(state, NameOfComp, meteredVars);
    2912         7775 :                         ModeFlagOn = true;
    2913              : 
    2914        26674 :                         for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2915        18899 :                             thisComp.MeteredVar(VarNum) = meteredVars(VarNum);
    2916        18899 :                             auto &thisVar = thisComp.MeteredVar(VarNum);
    2917        18899 :                             if (thisVar.endUseCat == OutputProcessor::EndUseCat::HeatingCoils && ModeFlagOn) {
    2918         9226 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2919         6355 :                                     thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::HeatingOnly;
    2920              :                                 }
    2921         2871 :                                 ModeFlagOn = false;
    2922        16028 :                             } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2923         3072 :                                 for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2924         2149 :                                     thisComp.MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2925              :                                 }
    2926          923 :                                 ModeFlagOn = false;
    2927        15105 :                             } else if (ModeFlagOn) {
    2928        11001 :                                 thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2929              :                             }
    2930              :                         }
    2931              : 
    2932         7775 :                         meteredVars.deallocate();
    2933              :                     } // if (NumVariables > 0)
    2934              : 
    2935        13238 :                     for (SubCompNum = 1; SubCompNum <= thisComp.NumSubComps; ++SubCompNum) {
    2936              :                         // Get complete list of components for complex branches
    2937           32 :                         std::string &TypeOfSubComp = thisComp.SubComp(SubCompNum).TypeOf;
    2938           32 :                         std::string &NameOfSubComp = thisComp.SubComp(SubCompNum).Name;
    2939           32 :                         NumVariables = GetNumMeteredVariables(state, TypeOfSubComp, NameOfSubComp);
    2940           32 :                         if (NumVariables > 0) {
    2941           32 :                             meteredVars.allocate(NumVariables);
    2942           32 :                             thisComp.SubComp(SubCompNum).MeteredVar.allocate(NumVariables);
    2943              : 
    2944           32 :                             GetMeteredVariables(state, NameOfSubComp, meteredVars);
    2945           32 :                             ModeFlagOn = true;
    2946              : 
    2947          142 :                             for (VarNum = 1; VarNum <= NumVariables; ++VarNum) {
    2948          110 :                                 thisComp.SubComp(SubCompNum).MeteredVar(VarNum) = meteredVars(VarNum);
    2949          110 :                                 auto &thisVar = thisComp.SubComp(SubCompNum).MeteredVar(VarNum);
    2950          110 :                                 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          106 :                                 } else if (thisVar.endUseCat == OutputProcessor::EndUseCat::CoolingCoils && ModeFlagOn) {
    2956           40 :                                     for (VarNum1 = 1; VarNum1 <= NumVariables; ++VarNum1) {
    2957           30 :                                         thisComp.SubComp(SubCompNum).MeteredVar(VarNum1).heatOrCool = Constant::HeatOrCool::CoolingOnly;
    2958              :                                     }
    2959           10 :                                     ModeFlagOn = false;
    2960           96 :                                 } else if (ModeFlagOn) {
    2961           64 :                                     thisVar.heatOrCool = Constant::HeatOrCool::NoHeatNoCool;
    2962              :                                 }
    2963              :                             }
    2964              : 
    2965           32 :                             meteredVars.deallocate();
    2966              :                         } // if (NumVariables > 0)
    2967              : 
    2968           32 :                         thisComp.SubComp(SubCompNum).NumMeteredVars = NumVariables;
    2969              :                     } // for (SubCompNum)
    2970              :                 } // for (CompNum)
    2971              :             } // for (BranchNum)
    2972              :         } // for (LoopSide)
    2973              :     } // for (PlantLoopNum)
    2974          782 : } // CreateEnergyReportStructure()
    2975              : 
    2976              : // End Initialization Section of the Module
    2977              : //******************************************************************************
    2978              : 
    2979              : // Beginning of Reporting subroutines for the SimAir Module
    2980              : // *****************************************************************************
    2981              : 
    2982       616704 : 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       616704 :     Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
    3019       616704 :     if (!state.dataSysRpts->AirLoopLoadsReportEnabled) {
    3020            0 :         return;
    3021              :     }
    3022              : 
    3023      1443168 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    3024       826464 :         auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(airLoopNum);
    3025              :         // SYSTEM LOADS REPORT
    3026       826464 :         thisSysLoadRepVars.TotHTNG = 0.0;
    3027       826464 :         thisSysLoadRepVars.TotCLNG = 0.0;
    3028              : 
    3029              :         // SYSTEM ENERGY USE REPORT
    3030       826464 :         thisSysLoadRepVars.TotElec = 0.0;
    3031       826464 :         thisSysLoadRepVars.TotNaturalGas = 0.0;
    3032       826464 :         thisSysLoadRepVars.TotPropane = 0.0;
    3033       826464 :         thisSysLoadRepVars.TotSteam = 0.0;
    3034       826464 :         thisSysLoadRepVars.TotH2OCOLD = 0.0;
    3035       826464 :         thisSysLoadRepVars.TotH2OHOT = 0.0;
    3036              : 
    3037              :         // SYSTEM COMPONENT LOADS REPORT
    3038       826464 :         thisSysLoadRepVars.FANCompHTNG = 0.0;
    3039       826464 :         thisSysLoadRepVars.CCCompCLNG = 0.0;
    3040       826464 :         thisSysLoadRepVars.HCCompHTNG = 0.0;
    3041       826464 :         thisSysLoadRepVars.HeatExHTNG = 0.0;
    3042       826464 :         thisSysLoadRepVars.HeatExCLNG = 0.0;
    3043       826464 :         thisSysLoadRepVars.SolarCollectHeating = 0.0;
    3044       826464 :         thisSysLoadRepVars.SolarCollectCooling = 0.0;
    3045       826464 :         thisSysLoadRepVars.UserDefinedTerminalHeating = 0.0;
    3046       826464 :         thisSysLoadRepVars.UserDefinedTerminalCooling = 0.0;
    3047       826464 :         thisSysLoadRepVars.HumidHTNG = 0.0;
    3048       826464 :         thisSysLoadRepVars.EvapCLNG = 0.0;
    3049       826464 :         thisSysLoadRepVars.DesDehumidCLNG = 0.0;
    3050       826464 :         thisSysLoadRepVars.DomesticH2O = 0.0;
    3051              : 
    3052              :         // SYSTEM COMPONENT ENERGY REPORT
    3053       826464 :         thisSysLoadRepVars.FANCompElec = 0.0;
    3054       826464 :         thisSysLoadRepVars.HCCompH2OHOT = 0.0;
    3055       826464 :         thisSysLoadRepVars.CCCompH2OCOLD = 0.0;
    3056       826464 :         thisSysLoadRepVars.HCCompElec = 0.0;
    3057       826464 :         thisSysLoadRepVars.CCCompElec = 0.0;
    3058       826464 :         thisSysLoadRepVars.HCCompElecRes = 0.0;
    3059       826464 :         thisSysLoadRepVars.HCCompNaturalGas = 0.0;
    3060       826464 :         thisSysLoadRepVars.HCCompPropane = 0.0;
    3061       826464 :         thisSysLoadRepVars.HCCompSteam = 0.0;
    3062       826464 :         thisSysLoadRepVars.HumidElec = 0.0;
    3063       826464 :         thisSysLoadRepVars.HumidNaturalGas = 0.0;
    3064       826464 :         thisSysLoadRepVars.HumidPropane = 0.0;
    3065       826464 :         thisSysLoadRepVars.DesDehumidElec = 0.0;
    3066       826464 :         thisSysLoadRepVars.EvapElec = 0.0;
    3067              :     }
    3068              : 
    3069       616704 :     auto &Node = state.dataLoopNodes->Node;
    3070              : 
    3071      1443168 :     for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
    3072       826464 :         auto const &pas = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum);
    3073      1663188 :         for (BranchNum = 1; BranchNum <= pas.NumBranches; ++BranchNum) {
    3074       836724 :             auto const &pasBranch = pas.Branch(BranchNum);
    3075       836724 :             if (Node(pasBranch.NodeNumOut).MassFlowRate <= 0.0) {
    3076       263099 :                 continue;
    3077              :             }
    3078      2294772 :             for (CompNum = 1; CompNum <= pasBranch.TotalComponents; ++CompNum) {
    3079      1721147 :                 auto const &pasBranchComp = pasBranch.Comp(CompNum);
    3080      1721147 :                 InletNodeNum = pasBranchComp.NodeNumIn;
    3081      1721147 :                 OutletNodeNum = pasBranchComp.NodeNumOut;
    3082      1721147 :                 if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3083            0 :                     continue;
    3084              :                 }
    3085      1721147 :                 CompLoad = Node(OutletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3086      1721147 :                                                                Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3087      1721147 :                 CompLoad *= TimeStepSysSec;
    3088      1721147 :                 CompEnergyUse = 0.0;
    3089      1721147 :                 EnergyType = Constant::eResource::Invalid;
    3090      1721147 :                 CompLoadFlag = true;
    3091      1721147 :                 CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3092      1721147 :                 CompLoadFlag = false;
    3093      3614643 :                 for (VarNum = 1; VarNum <= pasBranchComp.NumMeteredVars; ++VarNum) {
    3094      1893496 :                     auto const &pasBranchCompMeter = pasBranchComp.MeteredVar(VarNum);
    3095      1893496 :                     CompMode = pasBranchCompMeter.heatOrCool;
    3096      1893496 :                     CompEnergyUse = pasBranchCompMeter.curMeterReading;
    3097      1893496 :                     EnergyType = pasBranchCompMeter.resource;
    3098      1893496 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3099              :                 }
    3100              : 
    3101      3424286 :                 for (SubCompNum = 1; SubCompNum <= pasBranchComp.NumSubComps; ++SubCompNum) {
    3102      1703139 :                     auto const &pasBranchSubComp = pasBranchComp.SubComp(SubCompNum);
    3103      1703139 :                     InletNodeNum = pasBranchSubComp.NodeNumIn;
    3104      1703139 :                     OutletNodeNum = pasBranchSubComp.NodeNumOut;
    3105      1703139 :                     if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3106            0 :                         continue;
    3107              :                     }
    3108      1703139 :                     CompLoad = Node(OutletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3109      1703139 :                                                                    Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3110      1703139 :                     CompLoad *= TimeStepSysSec;
    3111      1703139 :                     CompEnergyUse = 0.0;
    3112      1703139 :                     EnergyType = Constant::eResource::Invalid;
    3113      1703139 :                     CompLoadFlag = true;
    3114      1703139 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchSubComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3115      1703139 :                     CompLoadFlag = false;
    3116      4653682 :                     for (VarNum = 1; VarNum <= pasBranchSubComp.NumMeteredVars; ++VarNum) {
    3117      2950543 :                         auto const &pasBranchSubCompMeter = pasBranchSubComp.MeteredVar(VarNum);
    3118      2950543 :                         CompMode = pasBranchSubCompMeter.heatOrCool;
    3119      2950543 :                         CompEnergyUse = pasBranchSubCompMeter.curMeterReading;
    3120      2950543 :                         EnergyType = pasBranchSubCompMeter.resource;
    3121      2950543 :                         CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, pasBranchSubComp.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3122              :                     }
    3123              : 
    3124      1713562 :                     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      3959453 :     for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    3154      3342749 :         auto const &zecCtrlZone = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
    3155      3342749 :         if (!zecCtrlZone.IsControlled) {
    3156       486357 :             continue;
    3157              :         }
    3158              : 
    3159      2856392 :         ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    3160              : 
    3161              :         // if system operating in deadband reset zone load
    3162      2856392 :         if (state.dataZoneEnergyDemand->DeadBandOrSetback(CtrlZoneNum)) {
    3163      1061304 :             ZoneLoad = 0.0;
    3164              :         }
    3165              : 
    3166              :         // loop over the zone supply air path inlet nodes
    3167      5812928 :         for (int ZoneInNum = 1; ZoneInNum <= zecCtrlZone.NumInletNodes; ++ZoneInNum) {
    3168              :             // retrieve air loop indexes
    3169      2956536 :             int AirLoopNum = zecCtrlZone.InletNodeAirLoopNum(ZoneInNum);
    3170      2956536 :             if (AirLoopNum == 0) {
    3171       757972 :                 continue;
    3172              :             }
    3173              : 
    3174      2198564 :             auto const &zecCtrlZoneCool = zecCtrlZone.AirDistUnitCool(ZoneInNum);
    3175      2198564 :             auto const &zecCtrlZoneHeat = zecCtrlZone.AirDistUnitHeat(ZoneInNum);
    3176              : 
    3177      2198564 :             AirDistCoolInletNodeNum = max(zecCtrlZoneCool.InNode, 0);
    3178      2198564 :             AirDistHeatInletNodeNum = max(zecCtrlZoneHeat.InNode, 0);
    3179              : 
    3180              :             // Set for cooling or heating path
    3181      2198564 :             if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum == 0) {
    3182      2146467 :                 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      2198564 :             EquipListNum = zecCtrlZone.EquipListIndex;
    3191      2198564 :             auto const &zel = state.dataZoneEquip->ZoneEquipList(EquipListNum);
    3192              : 
    3193      6595692 :             for (Idx = 1; Idx <= 2; ++Idx) {
    3194      4397128 :                 if (Idx == 1) {
    3195      2198564 :                     ADUCoolNum = max(zecCtrlZoneCool.AirDistUnitIndex, 0);
    3196      2198564 :                     if (ADUCoolNum == 0) {
    3197            0 :                         continue;
    3198              :                     }
    3199      2198564 :                     ADUNum = ADUCoolNum;
    3200              :                 } else { //(Idx =2)THEN
    3201      2198564 :                     ADUHeatNum = max(zecCtrlZoneHeat.AirDistUnitIndex, 0);
    3202      2198564 :                     if (ADUHeatNum == 0) {
    3203      2146467 :                         continue;
    3204              :                     }
    3205        52097 :                     ADUNum = ADUHeatNum;
    3206              :                 }
    3207              : 
    3208      2250661 :                 auto const &zelEquipData = zel.EquipData(ADUNum);
    3209              : 
    3210      2250661 :                 CompLoad = 0.0;
    3211      2250661 :                 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      2250661 :                 CompLoad *= TimeStepSysSec;
    3224      2250661 :                 CompEnergyUse = 0.0;
    3225      2250661 :                 EnergyType = Constant::eResource::Invalid;
    3226      2250661 :                 CompLoadFlag = true;
    3227      2250661 :                 CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3228      2250661 :                 CompLoadFlag = false;
    3229      2332261 :                 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      4533148 :                 for (SubCompNum = 1; SubCompNum <= zelEquipData.NumSubEquip; ++SubCompNum) {
    3236      2282487 :                     auto const &zelSubEquipData = zelEquipData.SubEquipData(SubCompNum);
    3237      2282487 :                     InletNodeNum = zelSubEquipData.InletNodeNum;
    3238      2282487 :                     OutletNodeNum = zelSubEquipData.OutletNodeNum;
    3239      2282487 :                     if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3240            0 :                         continue;
    3241              :                     }
    3242      2282487 :                     CompLoad = Node(InletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3243      2282487 :                                                                   Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3244      2282487 :                     CompLoad *= TimeStepSysSec;
    3245      2282487 :                     CompEnergyUse = 0.0;
    3246      2282487 :                     EnergyType = Constant::eResource::Invalid;
    3247      2282487 :                     CompLoadFlag = true;
    3248      2282487 :                     CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3249      2282487 :                     CompLoadFlag = false;
    3250      2367927 :                     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      3748268 :                     for (SubSubCompNum = 1; SubSubCompNum <= zelSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
    3257      1465781 :                         auto const &zelSubSubEquipData = zelSubEquipData.SubSubEquipData(SubSubCompNum);
    3258      1465781 :                         InletNodeNum = zelSubSubEquipData.InletNodeNum;
    3259      1465781 :                         OutletNodeNum = zelSubSubEquipData.OutletNodeNum;
    3260      1465781 :                         if (InletNodeNum <= 0 || OutletNodeNum <= 0) {
    3261            0 :                             continue;
    3262              :                         }
    3263      1465781 :                         CompLoad =
    3264      1465781 :                             Node(InletNodeNum).MassFlowRate * (Psychrometrics::PsyHFnTdbW(Node(InletNodeNum).Temp, Node(InletNodeNum).HumRat) -
    3265      1465781 :                                                                Psychrometrics::PsyHFnTdbW(Node(OutletNodeNum).Temp, Node(OutletNodeNum).HumRat));
    3266      1465781 :                         CompLoad *= TimeStepSysSec;
    3267      1465781 :                         CompEnergyUse = 0.0;
    3268      1465781 :                         EnergyType = Constant::eResource::Invalid;
    3269      1465781 :                         CompLoadFlag = true;
    3270      1465781 :                         CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3271      1465781 :                         CompLoadFlag = false;
    3272      4435136 :                         for (VarNum = 1; VarNum <= zelSubSubEquipData.NumMeteredVars; ++VarNum) {
    3273      2969355 :                             CompEnergyUse = zelSubSubEquipData.MeteredVar(VarNum).curMeterReading;
    3274      2969355 :                             EnergyType = zelSubSubEquipData.MeteredVar(VarNum).resource;
    3275      2969355 :                             CalcSystemEnergyUse(state, CompLoadFlag, AirLoopNum, zelSubSubEquipData.TypeOf, EnergyType, CompLoad, CompEnergyUse);
    3276              :                         }
    3277              :                     } // SubSubCompNum
    3278              :                 } // SubCompNum
    3279              :             } // Idx
    3280              :         } // ZoneInNum
    3281              :     } // Controlled Zone Loop
    3282              : 
    3283      1443168 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    3284       826464 :         auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(airLoopNum);
    3285       826464 :         thisSysLoadRepVars.TotHTNG = thisSysLoadRepVars.FANCompHTNG + thisSysLoadRepVars.HCCompHTNG + thisSysLoadRepVars.HeatExHTNG +
    3286       826464 :                                      thisSysLoadRepVars.HumidHTNG + thisSysLoadRepVars.SolarCollectHeating +
    3287       826464 :                                      thisSysLoadRepVars.UserDefinedTerminalHeating;
    3288       826464 :         thisSysLoadRepVars.TotCLNG = thisSysLoadRepVars.CCCompCLNG + thisSysLoadRepVars.HeatExCLNG + thisSysLoadRepVars.EvapCLNG +
    3289       826464 :                                      thisSysLoadRepVars.DesDehumidCLNG + thisSysLoadRepVars.SolarCollectCooling +
    3290       826464 :                                      thisSysLoadRepVars.UserDefinedTerminalCooling;
    3291       826464 :         thisSysLoadRepVars.TotElec = thisSysLoadRepVars.FANCompElec + thisSysLoadRepVars.HCCompElec + thisSysLoadRepVars.CCCompElec +
    3292       826464 :                                      thisSysLoadRepVars.HCCompElecRes + thisSysLoadRepVars.HumidElec + thisSysLoadRepVars.DesDehumidElec +
    3293       826464 :                                      thisSysLoadRepVars.EvapElec;
    3294       826464 :         thisSysLoadRepVars.TotNaturalGas = thisSysLoadRepVars.HCCompNaturalGas + thisSysLoadRepVars.HumidNaturalGas;
    3295       826464 :         thisSysLoadRepVars.TotPropane = thisSysLoadRepVars.HCCompPropane + thisSysLoadRepVars.HumidPropane;
    3296       826464 :         thisSysLoadRepVars.TotSteam = thisSysLoadRepVars.HCCompSteam;
    3297       826464 :         thisSysLoadRepVars.TotH2OCOLD = thisSysLoadRepVars.CCCompH2OCOLD;
    3298       826464 :         thisSysLoadRepVars.TotH2OHOT = thisSysLoadRepVars.HCCompH2OHOT;
    3299              :     }
    3300              : }
    3301              : 
    3302     17444336 : 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     17492820 :         {"COIL:HEATING:DX:VARIABLEREFRIGERANTFLOW:FLUIDTEMPERATURECONTROL", COIL_HEATING_VRF_FTC}};
    3506     17444336 :     assert(component_map.size() == n_ComponentTypes);
    3507              : 
    3508     17444336 :     if (!state.dataSysRpts->AirLoopLoadsReportEnabled) {
    3509            0 :         return;
    3510              :     }
    3511     17444336 :     auto &thisSysLoadRepVars = state.dataSysRpts->SysLoadRepVars(AirLoopNum);
    3512              : 
    3513              :     // Find enum for the component type string
    3514              :     ComponentTypes comp_type;
    3515     17444336 :     auto const it = component_map.find(CompType);
    3516     17444336 :     if (it != component_map.end()) {
    3517     17444336 :         comp_type = it->second;
    3518              :     } else {
    3519            0 :         comp_type = Unknown_ComponentType;
    3520              :     }
    3521              : 
    3522     17444336 :     switch (comp_type) {
    3523       516982 :     case AIRLOOPHVAC_OUTDOORAIRSYSTEM: // Outside Air System
    3524              :         // Not reported
    3525       516982 :         break;
    3526       517987 :     case OUTDOORAIR_MIXER: // Outdoor Air Mixer
    3527              :         // No energy transfers to account for
    3528       517987 :         break;
    3529        27248 :     case AIRTERMINAL_SINGLEDUCT_MIXER:
    3530              :         // No energy transfers to account for
    3531        27248 :         break;
    3532      1177852 :     case FAN_CONSTANTVOLUME:
    3533              :     case FAN_VARIABLEVOLUME:
    3534              :     case FAN_ONOFF:
    3535              :     case FAN_SYSTEMMODEL:
    3536              :     case FAN_COMPONENTMODEL:
    3537              : 
    3538      1177852 :         if (CompLoadFlag) {
    3539       588926 :             thisSysLoadRepVars.FANCompHTNG += std::abs(CompLoad);
    3540              :         }
    3541      1177852 :         thisSysLoadRepVars.FANCompElec += CompEnergy;
    3542              : 
    3543              :         // Cooling Coil Types for the air sys simulation
    3544      1177852 :         break;
    3545      2232816 :     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      2232816 :         if (CompLoadFlag) {
    3565       644864 :             thisSysLoadRepVars.CCCompCLNG += std::abs(CompLoad);
    3566              :         }
    3567      2232816 :         if ((EnergyType == Constant::eResource::PlantLoopCoolingDemand) || (EnergyType == Constant::eResource::DistrictCooling)) {
    3568       312434 :             thisSysLoadRepVars.CCCompH2OCOLD += CompEnergy;
    3569      1920382 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3570       629362 :             thisSysLoadRepVars.CCCompElec += CompEnergy;
    3571              :         }
    3572              : 
    3573              :         // Heating Coil Types for the air sys simulation
    3574      2232816 :         break;
    3575      6709395 :     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      6709395 :         if (CompLoadFlag) {
    3588      1978156 :             thisSysLoadRepVars.HCCompHTNG += std::abs(CompLoad);
    3589              :         }
    3590      6709395 :         if ((EnergyType == Constant::eResource::PlantLoopHeatingDemand) || (EnergyType == Constant::eResource::DistrictHeatingWater)) {
    3591      1599291 :             thisSysLoadRepVars.HCCompH2OHOT += CompEnergy;
    3592      5110104 :         } else if (EnergyType == Constant::eResource::DistrictHeatingSteam) {
    3593            0 :             thisSysLoadRepVars.HCCompSteam += CompEnergy;
    3594      5110104 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3595       559860 :             thisSysLoadRepVars.HCCompElec += CompEnergy;
    3596      4550244 :         } else if (EnergyType == Constant::eResource::NaturalGas) {
    3597       593278 :             thisSysLoadRepVars.HCCompNaturalGas += CompEnergy;
    3598      3956966 :         } else if (EnergyType == Constant::eResource::Propane) {
    3599            0 :             thisSysLoadRepVars.HCCompPropane += CompEnergy;
    3600              :         }
    3601              : 
    3602      6709395 :         break;
    3603       720867 :     case COIL_HEATING_ELECTRIC:
    3604              :     case COIL_HEATING_ELECTRIC_MULTISTAGE:
    3605              : 
    3606       720867 :         if (CompLoadFlag) {
    3607       240289 :             thisSysLoadRepVars.HCCompHTNG += std::abs(CompLoad);
    3608              :         }
    3609       720867 :         if (EnergyType == Constant::eResource::Electricity) {
    3610       240289 :             thisSysLoadRepVars.HCCompElecRes += CompEnergy;
    3611              :         }
    3612              : 
    3613       720867 :         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       475777 :     case COIL_HEATING_VRF:
    3644              :     case COIL_HEATING_VRF_FTC:
    3645              :     case AIRLOOPHVAC_UNITARYSYSTEM:
    3646              :         // All energy transfers accounted for in subcomponent models
    3647       475777 :         break;
    3648         9088 :     case AIRLOOPHVAC_UNITARYHEATPUMP_AIRTOAIR:
    3649              :         // All energy transfers accounted for in subcomponent models
    3650         9088 :         break;
    3651        27572 :     case AIRLOOPHVAC_UNITARYHEATPUMP_WATERTOAIR:
    3652              :         // All energy transfers accounted for in subcomponent models
    3653        27572 :         break;
    3654        93819 :     case COILSYSTEM_COOLING_DX:
    3655              :         // All energy transfers accounted for in subcomponent models
    3656        93819 :         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        54854 :     case HUMIDIFIER_STEAM_GAS:
    3683              :     case HUMIDIFIER_STEAM_ELECTRIC:
    3684        54854 :         if (CompLoadFlag) {
    3685        13661 :             thisSysLoadRepVars.HumidHTNG += std::abs(CompLoad);
    3686              :         }
    3687        54854 :         if (EnergyType == Constant::eResource::Water) {
    3688        13661 :             thisSysLoadRepVars.DomesticH2O += std::abs(CompEnergy);
    3689        41193 :         } else if (EnergyType == Constant::eResource::Electricity) {
    3690        13661 :             thisSysLoadRepVars.HumidElec += CompEnergy;
    3691        27532 :         } else if (EnergyType == Constant::eResource::NaturalGas) {
    3692          210 :             thisSysLoadRepVars.HumidNaturalGas += CompEnergy;
    3693        27322 :         } else if (EnergyType == Constant::eResource::Propane) {
    3694            0 :             thisSysLoadRepVars.HumidPropane += CompEnergy;
    3695              :         }
    3696              : 
    3697              :         // Evap Cooler Types for the air system simulation
    3698        54854 :         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      4665380 :     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      4665380 :         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     17444863 : }
    3832              : 
    3833       616704 : 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       616704 :     Real64 constexpr SmallLoad(0.1); // (W)
    3848              : 
    3849       616704 :     auto &Node = state.dataLoopNodes->Node;
    3850       616704 :     Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys;
    3851       616704 :     Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
    3852              : 
    3853       616704 :     if (!state.dataSysRpts->VentReportStructureCreated) {
    3854            0 :         return;
    3855              :     }
    3856       616704 :     if (!state.dataSysRpts->VentLoadsReportEnabled) {
    3857            0 :         return;
    3858              :     }
    3859              :     // following inits are array assignments across all controlled zones.
    3860      3959453 :     for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    3861      3342749 :         auto &thisZoneVentRepVars = state.dataSysRpts->ZoneVentRepVars(zoneNum);
    3862      3342749 :         if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) {
    3863       486357 :             continue;
    3864              :         }
    3865      2856392 :         thisZoneVentRepVars.OAMassFlow = 0.0;
    3866      2856392 :         thisZoneVentRepVars.OAMass = 0.0;
    3867      2856392 :         thisZoneVentRepVars.OAVolFlowStdRho = 0.0;
    3868      2856392 :         thisZoneVentRepVars.OAVolStdRho = 0.0;
    3869      2856392 :         thisZoneVentRepVars.OAVolFlowCrntRho = 0.0;
    3870      2856392 :         thisZoneVentRepVars.OAVolCrntRho = 0.0;
    3871      2856392 :         thisZoneVentRepVars.MechACH = 0.0;
    3872      2856392 :         thisZoneVentRepVars.TargetVentilationFlowVoz = 0.0;
    3873      2856392 :         thisZoneVentRepVars.TimeBelowVozDyn = 0.0;
    3874      2856392 :         thisZoneVentRepVars.TimeAtVozDyn = 0.0;
    3875      2856392 :         thisZoneVentRepVars.TimeAboveVozDyn = 0.0;
    3876      2856392 :         thisZoneVentRepVars.TimeVentUnocc = 0.0;
    3877      2856392 :         thisZoneVentRepVars.CoolingLoadMetByVent = 0.0;
    3878      2856392 :         thisZoneVentRepVars.CoolingLoadAddedByVent = 0.0;
    3879      2856392 :         thisZoneVentRepVars.OvercoolingByVent = 0.0;
    3880      2856392 :         thisZoneVentRepVars.HeatingLoadMetByVent = 0.0;
    3881      2856392 :         thisZoneVentRepVars.HeatingLoadAddedByVent = 0.0;
    3882      2856392 :         thisZoneVentRepVars.OverheatingByVent = 0.0;
    3883      2856392 :         thisZoneVentRepVars.NoLoadHeatingByVent = 0.0;
    3884      2856392 :         thisZoneVentRepVars.NoLoadCoolingByVent = 0.0;
    3885              :     }
    3886              : 
    3887       616704 :     state.dataSysRpts->AnyZoneTimeBelowVozDyn = 0.0;
    3888       616704 :     state.dataSysRpts->AllZonesTimeAtVozDyn = 0.0;
    3889       616704 :     state.dataSysRpts->AnyZoneTimeAboveVozDyn = 0.0;
    3890       616704 :     state.dataSysRpts->AnyZoneTimeVentUnocc = 0.0;
    3891       616704 :     state.dataSysRpts->AnyZoneTimeBelowVozDynOcc = 0.0;
    3892       616704 :     state.dataSysRpts->AllZonesTimeAtVozDynOcc = 0.0;
    3893       616704 :     state.dataSysRpts->AnyZoneTimeAboveVozDynOcc = 0.0;
    3894              : 
    3895      1443168 :     for (int sysNum = 1; sysNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++sysNum) {
    3896       826464 :         auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysNum);
    3897       826464 :         thisSysVentRepVars.MechVentFlow = 0.0;
    3898       826464 :         thisSysVentRepVars.NatVentFlow = 0.0;
    3899       826464 :         thisSysVentRepVars.TargetVentilationFlowVoz = 0.0;
    3900       826464 :         thisSysVentRepVars.TimeBelowVozDyn = 0.0;
    3901       826464 :         thisSysVentRepVars.TimeAtVozDyn = 0.0;
    3902       826464 :         thisSysVentRepVars.TimeAboveVozDyn = 0.0;
    3903       826464 :         thisSysVentRepVars.TimeVentUnocc = 0.0;
    3904       826464 :         thisSysVentRepVars.AnyZoneOccupied = false;
    3905              :     }
    3906              : 
    3907      3959453 :     for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
    3908      3342749 :         auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
    3909      3342749 :         if (!thisZoneEquipConfig.IsControlled) {
    3910       486357 :             continue;
    3911              :         }
    3912              : 
    3913      2856392 :         Real64 ZAirSysZoneVentLoad = 0.0; // ventilation load attributed to a particular zone from all primary air systems serving the zone [J]
    3914      2856392 :         Real64 ZAirSysOutAirFlow = 0.0;   // outside air flow rate for zone from all primary air systems serving the zone [kg/s]
    3915      2856392 :         Real64 ZFAUFlowRate = 0.0;        // Zone forced Air unit air mass flow rate [kg/s]
    3916      2856392 :         Real64 ZFAUZoneVentLoad = 0.0;    // ventilation load attributed to a particular zone from zone forced air units [J]
    3917      2856392 :         Real64 ZFAUOutAirFlow = 0.0;      // outside air flow rate for zone from zone forced air units. [kg/s]
    3918      2856392 :         Real64 OutAirFlow = 0.0;          // Total outside air mass flow from zone equipment and air loop equipment [kg/s]
    3919      2856392 :         Real64 ZoneFlowFrac = 0.0;        // fraction of mixed air flowing to a zone
    3920      2856392 :         Real64 ZFAUEnthReturnAir = 0.0;   // Zone forced Air unit enthalpy of the return air [kJ/kgK]
    3921      2856392 :         Real64 ZFAUTempMixedAir = 0.0;    // Zone forced Air unit dry-bulb temperature of the mixed air [C]
    3922      2856392 :         Real64 ZFAUHumRatMixedAir = 0.0;  // Zone forced Air unit humidity ratio of the mixed air [kg/kg]
    3923      2856392 :         Real64 ZFAUEnthMixedAir = 0.0;    // Zone forced Air unit enthalpy of the mixed air [kJ/kgK]
    3924      2856392 :         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      2856392 :         Real64 ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    3928      2856392 :         auto const &thisZone = state.dataHeatBal->Zone(CtrlZoneNum);
    3929      2856392 :         int const zoneMult = thisZone.Multiplier * thisZone.ListMultiplier;
    3930      2856392 :         Real64 const ZoneVolume = thisZone.Volume * zoneMult; // CR 7170
    3931              : 
    3932      2856392 :         bool constexpr UseOccSchFlag = true;
    3933      2856392 :         bool constexpr UseMinOASchFlag = true;
    3934              : 
    3935      2856392 :         auto &thisZonePredefRep = state.dataHeatBal->ZonePreDefRep(CtrlZoneNum);
    3936      2856392 :         auto &thisZoneVentRepVars = state.dataSysRpts->ZoneVentRepVars(CtrlZoneNum);
    3937      2856392 :         thisZoneVentRepVars.TargetVentilationFlowVoz = DataSizing::calcDesignSpecificationOutdoorAir(
    3938              :             state, thisZoneEquipConfig.ZoneDesignSpecOAIndex, CtrlZoneNum, UseOccSchFlag, UseMinOASchFlag);
    3939      2856392 :         if (thisZoneEquipConfig.ZoneAirDistributionIndex > 0) {
    3940       413399 :             thisZoneVentRepVars.TargetVentilationFlowVoz =
    3941       826798 :                 thisZoneVentRepVars.TargetVentilationFlowVoz /
    3942       413399 :                 state.dataSize->ZoneAirDistribution(thisZoneEquipConfig.ZoneAirDistributionIndex).calculateEz(state, CtrlZoneNum);
    3943              :         }
    3944              : 
    3945              :         // if system operating in deadband reset zone load
    3946      2856392 :         if (state.dataZoneEnergyDemand->DeadBandOrSetback(CtrlZoneNum)) {
    3947      1061304 :             ZoneLoad = 0.0;
    3948              :         }
    3949              : 
    3950              :         // first deal with any (and all) Zone Forced Air Units that might have outside air.
    3951      2856392 :         auto &thisZoneEquipList = state.dataZoneEquip->ZoneEquipList(thisZoneEquipConfig.EquipListIndex);
    3952      5992313 :         for (int thisZoneEquipNum = 1; thisZoneEquipNum <= thisZoneEquipList.NumOfEquipTypes; ++thisZoneEquipNum) {
    3953      3135921 :             auto &thisEquipIndex = thisZoneEquipList.EquipIndex(thisZoneEquipNum);
    3954              : 
    3955      3135921 :             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        20625 :             case DataZoneEquipment::ZoneEquipType::FourPipeFanCoil: {
    4025        20625 :                 int OutAirNode = FanCoilUnits::GetFanCoilOutAirNode(state, thisEquipIndex);
    4026        20625 :                 if (OutAirNode > 0) {
    4027        18395 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4028              :                 }
    4029              : 
    4030        20625 :                 int ZoneInletAirNode = FanCoilUnits::GetFanCoilZoneInletAirNode(state, thisEquipIndex);
    4031        20625 :                 if (ZoneInletAirNode > 0) {
    4032        20625 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4033              :                 }
    4034        20625 :                 int MixedAirNode = FanCoilUnits::GetFanCoilMixedAirNode(state, thisEquipIndex);
    4035        20625 :                 int ReturnAirNode = FanCoilUnits::GetFanCoilReturnAirNode(state, thisEquipIndex);
    4036        20625 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    4037        18395 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4038        18395 :                     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        18395 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4041              :                 } else {
    4042         2230 :                     ZFAUZoneVentLoad += 0.0;
    4043              :                 }
    4044        20625 :             } 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       457856 :             case DataZoneEquipment::ZoneEquipType::PurchasedAir: {
    4069       457856 :                 ZFAUOutAirFlow += PurchasedAirManager::GetPurchasedAirOutAirMassFlow(state, thisEquipIndex);
    4070       457856 :                 int ZoneInletAirNode = PurchasedAirManager::GetPurchasedAirZoneInletAirNode(state, thisEquipIndex);
    4071       457856 :                 if (ZoneInletAirNode > 0) {
    4072       457856 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4073              :                 }
    4074       457856 :                 ZFAUTempMixedAir = PurchasedAirManager::GetPurchasedAirMixedAirTemp(state, thisEquipIndex);
    4075       457856 :                 ZFAUHumRatMixedAir = PurchasedAirManager::GetPurchasedAirMixedAirHumRat(state, thisEquipIndex);
    4076       457856 :                 int ReturnAirNode = PurchasedAirManager::GetPurchasedAirReturnAirNode(state, thisEquipIndex);
    4077       457856 :                 if ((ZFAUFlowRate > 0) && (ReturnAirNode > 0)) {
    4078       241291 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(ZFAUTempMixedAir, ZFAUHumRatMixedAir);
    4079       241291 :                     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       241291 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4082              :                 } else {
    4083       216565 :                     ZFAUZoneVentLoad += 0.0;
    4084              :                 }
    4085       457856 :             } break;
    4086              : 
    4087        20694 :             case DataZoneEquipment::ZoneEquipType::EnergyRecoveryVentilator: {
    4088        20694 :                 int OutAirNode = HVACStandAloneERV::GetStandAloneERVOutAirNode(state, thisEquipIndex);
    4089        20694 :                 if (OutAirNode > 0) {
    4090        20694 :                     ZFAUOutAirFlow += Node(OutAirNode).MassFlowRate;
    4091              :                 }
    4092              : 
    4093        20694 :                 int ZoneInletAirNode = HVACStandAloneERV::GetStandAloneERVZoneInletAirNode(state, thisEquipIndex);
    4094        20694 :                 if (ZoneInletAirNode > 0) {
    4095        20694 :                     ZFAUFlowRate = max(Node(ZoneInletAirNode).MassFlowRate, 0.0);
    4096              :                 }
    4097        20694 :                 int MixedAirNode = ZoneInletAirNode;
    4098        20694 :                 int ReturnAirNode = HVACStandAloneERV::GetStandAloneERVReturnAirNode(state, thisEquipIndex);
    4099        20694 :                 if ((MixedAirNode > 0) && (ReturnAirNode > 0)) {
    4100        20694 :                     ZFAUEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4101        20694 :                     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        20694 :                     ZFAUZoneVentLoad += (ZFAUFlowRate) * (ZFAUEnthMixedAir - ZFAUEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4104              :                 } else {
    4105            0 :                     ZFAUZoneVentLoad += 0.0;
    4106              :                 }
    4107        20694 :             } 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      2415136 :             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      2415136 :             } 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      5812928 :         for (int ZoneInNum = 1; ZoneInNum <= thisZoneEquipConfig.NumInletNodes; ++ZoneInNum) {
    4196      2956536 :             Real64 AirSysEnthReturnAir = 0.0;    // enthalpy of the return air (mixing box inlet node, return side) [kJ/kgK]
    4197      2956536 :             Real64 AirSysEnthMixedAir = 0.0;     // enthalpy of the mixed air (mixing box outlet node, mixed air side) [kJ/kgK]
    4198      2956536 :             Real64 AirSysZoneVentLoad = 0.0;     // ventilation load attributed to a particular zone from primary air system [J]
    4199      2956536 :             Real64 ADUCoolFlowrate = 0.0;        // Air distribution unit cooling air mass flow rate [kg/s]
    4200      2956536 :             Real64 ADUHeatFlowrate = 0.0;        // Air distribution unit heating air mass flow rate [kg/s]
    4201      2956536 :             Real64 AirSysTotalMixFlowRate = 0.0; // Mixed air mass flow rate [kg/s]
    4202      2956536 :             Real64 AirSysOutAirFlow = 0.0;       // outside air flow rate for zone from primary air system [kg/s]
    4203              :             // retrieve air loop index
    4204      2956536 :             int AirLoopNum = thisZoneEquipConfig.InletNodeAirLoopNum(ZoneInNum);
    4205      2956536 :             int MixedAirNode = 0;
    4206      2956536 :             int ReturnAirNode = 0;
    4207      2956536 :             int AirDistCoolInletNodeNum = 0;
    4208      2956536 :             int AirDistHeatInletNodeNum = 0;
    4209      2956536 :             if (AirLoopNum != 0) { // deal with primary air system
    4210      2198564 :                 AirDistCoolInletNodeNum = max(thisZoneEquipConfig.AirDistUnitCool(ZoneInNum).InNode, 0);
    4211      2198564 :                 AirDistHeatInletNodeNum = max(thisZoneEquipConfig.AirDistUnitHeat(ZoneInNum).InNode, 0);
    4212              :                 // Set for cooling or heating path
    4213      2198564 :                 if (AirDistCoolInletNodeNum > 0 && AirDistHeatInletNodeNum == 0) {
    4214      2146467 :                     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      2198564 :                 MixedAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysOutletNodeNum;
    4234      2198564 :                 ReturnAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysInletNodeNum;
    4235              : 
    4236              :                 // Collect air loop Voz-dyn and natural ventilation
    4237      2198564 :                 int ADUNum = thisZoneEquipConfig.InletNodeADUNum(ZoneInNum);
    4238      2198564 :                 Real64 termUnitOAFrac = 1.0;
    4239      2198564 :                 if (ADUNum > 0) {
    4240      2190473 :                     int termUnitSizingNum = state.dataDefineEquipment->AirDistUnit(ADUNum).TermUnitSizingNum;
    4241      2190473 :                     if (termUnitSizingNum > 0) {
    4242      2190473 :                         termUnitOAFrac = state.dataSize->TermUnitSizing(termUnitSizingNum).SpecMinOAFrac;
    4243              :                     }
    4244              :                 }
    4245      2198564 :                 state.dataSysRpts->SysVentRepVars(AirLoopNum).TargetVentilationFlowVoz +=
    4246      2198564 :                     termUnitOAFrac * thisZoneVentRepVars.TargetVentilationFlowVoz;
    4247              : 
    4248      2198564 :                 Real64 naturalVentFlow = (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity + thisZonePredefRep.AFNVentVolStdDen) *
    4249      2198564 :                                          zoneMult / TimeStepSysSec;
    4250      2198564 :                 state.dataSysRpts->SysVentRepVars(AirLoopNum).NatVentFlow += termUnitOAFrac * naturalVentFlow;
    4251              : 
    4252      2198564 :                 if (thisZonePredefRep.isOccupied) {
    4253       818048 :                     state.dataSysRpts->SysVentRepVars(AirLoopNum).AnyZoneOccupied = true;
    4254              :                 }
    4255              :             }
    4256              : 
    4257      2956536 :             if (MixedAirNode == 0 || ReturnAirNode == 0) {
    4258       912072 :                 AirSysZoneVentLoad = 0.0;
    4259       912072 :                 AirSysOutAirFlow = 0.0;
    4260              :             } else {
    4261              :                 // Calculate return and mixed air enthalpies
    4262      2044464 :                 AirSysEnthReturnAir = Psychrometrics::PsyHFnTdbW(Node(ReturnAirNode).Temp, Node(ReturnAirNode).HumRat);
    4263      2044464 :                 AirSysEnthMixedAir = Psychrometrics::PsyHFnTdbW(Node(MixedAirNode).Temp, Node(MixedAirNode).HumRat);
    4264              : 
    4265      2044464 :                 if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysExists) {
    4266      2044464 :                     int OutAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OAMixOAInNodeNum;
    4267      2044464 :                     AirSysOutAirFlow = Node(OutAirNode).MassFlowRate;
    4268              :                 } else {
    4269            0 :                     AirSysOutAirFlow = 0.0;
    4270              :                 }
    4271              : 
    4272      2044464 :                 AirSysTotalMixFlowRate = Node(MixedAirNode).MassFlowRate;
    4273              : 
    4274      2044464 :                 if (AirSysTotalMixFlowRate != 0.0) {
    4275      1574582 :                     ZoneFlowFrac = (ADUCoolFlowrate + ADUHeatFlowrate) / AirSysTotalMixFlowRate;
    4276      1574582 :                     AirSysOutAirFlow *= ZoneFlowFrac;
    4277              :                 } else {
    4278       469882 :                     ZoneFlowFrac = 0.0;
    4279       469882 :                     AirSysOutAirFlow = 0.0;
    4280              :                 }
    4281              :                 // Calculate the zone ventilation load for this supply air path (i.e. zone inlet)
    4282      2044464 :                 AirSysZoneVentLoad = (ADUCoolFlowrate + ADUHeatFlowrate) * (AirSysEnthMixedAir - AirSysEnthReturnAir) * TimeStepSysSec; //*KJperJ
    4283              :             }
    4284      2956536 :             ZAirSysZoneVentLoad += AirSysZoneVentLoad;
    4285      2956536 :             ZAirSysOutAirFlow += AirSysOutAirFlow;
    4286              :         } // primary air system present
    4287              : 
    4288              :         // now combine OA flow from zone forced air units with primary air system
    4289      2856392 :         OutAirFlow = ZAirSysOutAirFlow + ZFAUOutAirFlow;
    4290              :         // assign report variables
    4291      2856392 :         thisZoneVentRepVars.OAMassFlow = OutAirFlow;
    4292      2856392 :         thisZoneVentRepVars.OAMass = thisZoneVentRepVars.OAMassFlow * TimeStepSysSec;
    4293              : 
    4294              :         // determine volumetric values from mass flow using standard density (adjusted for elevation)
    4295      2856392 :         thisZoneVentRepVars.OAVolFlowStdRho = thisZoneVentRepVars.OAMassFlow / state.dataEnvrn->StdRhoAir;
    4296      2856392 :         thisZoneVentRepVars.OAVolStdRho = thisZoneVentRepVars.OAVolFlowStdRho * TimeStepSysSec;
    4297              : 
    4298              :         // set time mechanical+natural ventilation is below, at, or above target Voz-dyn
    4299              :         Real64 totMechNatVentVolStdRho =
    4300      2856392 :             thisZoneVentRepVars.OAVolStdRho +
    4301      2856392 :             (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity + thisZonePredefRep.AFNVentVolStdDen) * zoneMult;
    4302      2856392 :         Real64 targetVoz = thisZoneVentRepVars.TargetVentilationFlowVoz * TimeStepSysSec;
    4303              :         // Allow 1% tolerance
    4304      2856392 :         if (totMechNatVentVolStdRho < (0.99 * targetVoz)) {
    4305       706120 :             thisZoneVentRepVars.TimeBelowVozDyn = TimeStepSys;
    4306       706120 :             state.dataSysRpts->AnyZoneTimeBelowVozDyn = TimeStepSys;
    4307      2150272 :         } else if (totMechNatVentVolStdRho > (1.01 * targetVoz)) {
    4308       848752 :             thisZoneVentRepVars.TimeAboveVozDyn = TimeStepSys;
    4309       848752 :             state.dataSysRpts->AnyZoneTimeAboveVozDyn = TimeStepSys;
    4310      1301520 :         } else if (totMechNatVentVolStdRho > HVAC::SmallAirVolFlow) {
    4311       276823 :             thisZoneVentRepVars.TimeAtVozDyn = TimeStepSys;
    4312       276823 :             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      5712784 :             Psychrometrics::PsyRhoAirFnPbTdbW(state,
    4318      2856392 :                                               state.dataEnvrn->OutBaroPress,
    4319      2856392 :                                               state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).MAT,
    4320      2856392 :                                               state.dataZoneTempPredictorCorrector->zoneHeatBalance(CtrlZoneNum).airHumRatAvg);
    4321      2856392 :         if (currentZoneAirDensity > 0.0) {
    4322      2856392 :             thisZoneVentRepVars.OAVolFlowCrntRho = thisZoneVentRepVars.OAMassFlow / currentZoneAirDensity;
    4323              :         }
    4324      2856392 :         thisZoneVentRepVars.OAVolCrntRho = thisZoneVentRepVars.OAVolFlowCrntRho * TimeStepSysSec;
    4325      2856392 :         if (ZoneVolume > 0.0) {
    4326      2856392 :             thisZoneVentRepVars.MechACH = (thisZoneVentRepVars.OAVolCrntRho / TimeStepSys) / ZoneVolume;
    4327              :         }
    4328              : 
    4329              :         // store data for predefined tabular report on outside air
    4330      2856392 :         if (thisZonePredefRep.isOccupied) {
    4331              :             // accumulate the occupied time
    4332      1083844 :             thisZonePredefRep.TotTimeOcc += TimeStepSys;
    4333              :             // mechanical ventilation
    4334      1083844 :             thisZonePredefRep.MechVentVolTotalOcc += thisZoneVentRepVars.OAVolCrntRho;
    4335      1083844 :             if ((thisZoneVentRepVars.OAVolCrntRho / TimeStepSys) < thisZonePredefRep.MechVentVolMin) {
    4336        45314 :                 thisZonePredefRep.MechVentVolMin = thisZoneVentRepVars.OAVolCrntRho / TimeStepSys;
    4337              :             }
    4338      1083844 :             thisZonePredefRep.MechVentVolTotalOccStdDen += thisZoneVentRepVars.OAVolStdRho;
    4339              :             // infiltration
    4340      1083844 :             thisZonePredefRep.InfilVolTotalOcc += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeCurDensity;
    4341      1083844 :             if (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeCurDensity < thisZonePredefRep.InfilVolMin) {
    4342        24300 :                 thisZonePredefRep.InfilVolMin = state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeCurDensity;
    4343              :             }
    4344      1083844 :             thisZonePredefRep.InfilVolTotalOccStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeStdDensity;
    4345              :             // 'simple' natural ventilation
    4346      1083844 :             thisZonePredefRep.SimpVentVolTotalOcc += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeCurDensity;
    4347      1083844 :             if (state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeCurDensity < thisZonePredefRep.SimpVentVolMin) {
    4348         3637 :                 thisZonePredefRep.SimpVentVolMin = state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeCurDensity;
    4349              :             }
    4350      1083844 :             thisZonePredefRep.SimpVentVolTotalOccStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity;
    4351              :             // target ventilation Voz-dyn
    4352      1083844 :             state.dataSysRpts->AnyZoneTimeBelowVozDynOcc = state.dataSysRpts->AnyZoneTimeBelowVozDyn;
    4353      1083844 :             state.dataSysRpts->AllZonesTimeAtVozDynOcc = state.dataSysRpts->AllZonesTimeAtVozDyn;
    4354      1083844 :             state.dataSysRpts->AnyZoneTimeAboveVozDynOcc = state.dataSysRpts->AnyZoneTimeAboveVozDyn;
    4355      1083844 :             thisZonePredefRep.VozTargetTotalOcc += targetVoz;
    4356              : 
    4357              :             // time mechanical+natural ventilation is below, at, or above target Voz-dyn
    4358      1083844 :             thisZonePredefRep.VozTargetTimeBelowOcc += thisZoneVentRepVars.TimeBelowVozDyn;
    4359      1083844 :             thisZonePredefRep.VozTargetTimeAtOcc += thisZoneVentRepVars.TimeAtVozDyn;
    4360      1083844 :             thisZonePredefRep.VozTargetTimeAboveOcc += thisZoneVentRepVars.TimeAboveVozDyn;
    4361      1772548 :         } else if (totMechNatVentVolStdRho > HVAC::SmallAirVolFlow) {
    4362       803215 :             thisZoneVentRepVars.TimeVentUnocc = TimeStepSys;
    4363       803215 :             state.dataSysRpts->AnyZoneTimeVentUnocc = TimeStepSys;
    4364       803215 :             thisZonePredefRep.TotVentTimeNonZeroUnocc += thisZoneVentRepVars.TimeVentUnocc;
    4365              :         }
    4366              :         // accumulate during occupancy or not
    4367      2856392 :         thisZonePredefRep.MechVentVolTotalStdDen += thisZoneVentRepVars.OAVolStdRho;
    4368      2856392 :         thisZonePredefRep.InfilVolTotalStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).InfilVolumeStdDensity;
    4369      2856392 :         thisZonePredefRep.SimpVentVolTotalStdDen += state.dataHeatBal->ZnAirRpt(CtrlZoneNum).VentilVolumeStdDensity;
    4370      2856392 :         thisZonePredefRep.VozTargetTotal += targetVoz;
    4371      2856392 :         thisZonePredefRep.VozTargetTimeBelow += thisZoneVentRepVars.TimeBelowVozDyn;
    4372      2856392 :         thisZonePredefRep.VozTargetTimeAt += thisZoneVentRepVars.TimeAtVozDyn;
    4373      2856392 :         thisZonePredefRep.VozTargetTimeAbove += thisZoneVentRepVars.TimeAboveVozDyn;
    4374              : 
    4375              :         // now combine Vent load from zone forced air units with primary air system
    4376      2856392 :         Real64 ZoneVentLoad = ZAirSysZoneVentLoad + ZFAUZoneVentLoad;
    4377              :         // cycle if ZoneVentLoad is small
    4378      2856392 :         if (std::abs(ZoneVentLoad) < SmallLoad) {
    4379      1312390 :             continue; // orig. had RETURN here, BG changed to CYCLE for next controlled zone in do loop.
    4380              :         }
    4381              : 
    4382              :         // Ventilation Heating
    4383      1544002 :         if (ZoneVentLoad > SmallLoad) {
    4384              :             // Zone cooling load
    4385       596431 :             if (ZoneLoad < -SmallLoad) {
    4386       414122 :                 thisZoneVentRepVars.CoolingLoadAddedByVent += std::abs(ZoneVentLoad);
    4387              :                 // Zone heating load
    4388       182309 :             } else if (ZoneLoad > SmallLoad) {
    4389         3463 :                 if (ZoneVentLoad > ZoneLoad) {
    4390         3328 :                     thisZoneVentRepVars.HeatingLoadMetByVent += std::abs(ZoneLoad);
    4391         3328 :                     thisZoneVentRepVars.OverheatingByVent += (ZoneVentLoad - ZoneLoad);
    4392              :                 } else {
    4393          135 :                     thisZoneVentRepVars.HeatingLoadMetByVent += std::abs(ZoneVentLoad);
    4394              :                 }
    4395              :                 // No Zone Load
    4396              :             } else {
    4397       178846 :                 thisZoneVentRepVars.NoLoadHeatingByVent += std::abs(ZoneVentLoad);
    4398              :             }
    4399              : 
    4400              :             // Ventilation Cooling
    4401       947571 :         } else if (ZoneVentLoad < -SmallLoad) {
    4402              :             // Zone cooling load
    4403       947571 :             if (ZoneLoad < -SmallLoad) {
    4404       170914 :                 if (ZoneVentLoad < ZoneLoad) {
    4405       169835 :                     thisZoneVentRepVars.CoolingLoadMetByVent += std::abs(ZoneLoad);
    4406       169835 :                     thisZoneVentRepVars.OvercoolingByVent += std::abs(ZoneVentLoad - ZoneLoad);
    4407              :                 } else {
    4408         1079 :                     thisZoneVentRepVars.CoolingLoadMetByVent += std::abs(ZoneVentLoad);
    4409              :                 }
    4410              :                 // Zone heating load
    4411       776657 :             } else if (ZoneLoad > SmallLoad) {
    4412       534398 :                 thisZoneVentRepVars.HeatingLoadAddedByVent += std::abs(ZoneVentLoad);
    4413              :                 // No Zone Load
    4414              :             } else {
    4415       242259 :                 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      1443168 :     for (int sysNum = 1; sysNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++sysNum) {
    4425       826464 :         auto &thisSysVentRepVars = state.dataSysRpts->SysVentRepVars(sysNum);
    4426       826464 :         auto &thisSysPreDefRep = state.dataSysRpts->SysPreDefRep(sysNum);
    4427       826464 :         Real64 mechVentFlow = state.dataAirLoop->AirLoopFlow(sysNum).OAFlow / state.dataEnvrn->StdRhoAir;
    4428       826464 :         thisSysVentRepVars.MechVentFlow = mechVentFlow;
    4429       826464 :         thisSysPreDefRep.MechVentTotal += mechVentFlow * TimeStepSysSec;
    4430       826464 :         thisSysPreDefRep.NatVentTotal += thisSysVentRepVars.NatVentFlow * TimeStepSysSec;
    4431              : 
    4432              :         // set time mechanical+natural ventilation is below, at, or above target Voz-dyn
    4433       826464 :         Real64 totMechNatVentVolFlowStdRho = mechVentFlow + thisSysVentRepVars.NatVentFlow;
    4434              : 
    4435       826464 :         Real64 targetFlowVoz = thisSysVentRepVars.TargetVentilationFlowVoz;
    4436       826464 :         thisSysPreDefRep.TargetVentTotalVoz += targetFlowVoz * TimeStepSysSec;
    4437              :         // Allow 1% tolerance
    4438       826464 :         if (totMechNatVentVolFlowStdRho < (0.99 * targetFlowVoz)) {
    4439       184668 :             thisSysVentRepVars.TimeBelowVozDyn = TimeStepSys;
    4440       184668 :             thisSysPreDefRep.TimeBelowVozDynTotal += TimeStepSys;
    4441       641796 :         } else if (totMechNatVentVolFlowStdRho > (1.01 * targetFlowVoz)) {
    4442       220584 :             thisSysVentRepVars.TimeAboveVozDyn = TimeStepSys;
    4443       220584 :             thisSysPreDefRep.TimeAboveVozDynTotal += TimeStepSys;
    4444       421212 :         } else if (totMechNatVentVolFlowStdRho > HVAC::SmallAirVolFlow) {
    4445       128279 :             thisSysVentRepVars.TimeAtVozDyn = TimeStepSys;
    4446       128279 :             thisSysPreDefRep.TimeAtVozDynTotal += TimeStepSys;
    4447              :         }
    4448              : 
    4449       826464 :         if (thisSysVentRepVars.AnyZoneOccupied) {
    4450       327449 :             thisSysPreDefRep.TimeOccupiedTotal += TimeStepSys;
    4451       327449 :             thisSysPreDefRep.MechVentTotalOcc += mechVentFlow * TimeStepSysSec;
    4452       327449 :             thisSysPreDefRep.NatVentTotalOcc += thisSysVentRepVars.NatVentFlow * TimeStepSysSec;
    4453       327449 :             thisSysPreDefRep.TargetVentTotalVozOcc += targetFlowVoz * TimeStepSysSec;
    4454       327449 :             thisSysPreDefRep.TimeBelowVozDynTotalOcc += thisSysVentRepVars.TimeBelowVozDyn;
    4455       327449 :             thisSysPreDefRep.TimeAboveVozDynTotalOcc += thisSysVentRepVars.TimeAboveVozDyn;
    4456       327449 :             thisSysPreDefRep.TimeAtVozDynTotalOcc += thisSysVentRepVars.TimeAtVozDyn;
    4457       499015 :         } else if (totMechNatVentVolFlowStdRho > HVAC::SmallAirVolFlow) {
    4458       182420 :             thisSysVentRepVars.TimeVentUnocc = TimeStepSys;
    4459       182420 :             thisSysPreDefRep.TimeVentUnoccTotal += TimeStepSys;
    4460              :         }
    4461              : 
    4462              :         // set time at OA limiting factors
    4463       826464 :         if (mechVentFlow > HVAC::SmallAirVolFlow) {
    4464       429429 :             int thisOAControlNum = state.dataAirLoop->AirLoopControlInfo(sysNum).OACtrlNum;
    4465       429429 :             if (thisOAControlNum > 0) {
    4466       429189 :                 int limitFactorIndex = static_cast<int>(state.dataMixedAir->OAController(thisOAControlNum).OALimitingFactor);
    4467       429189 :                 thisSysPreDefRep.TimeAtOALimit[limitFactorIndex] += TimeStepSys;
    4468       429189 :                 if (thisSysVentRepVars.AnyZoneOccupied) {
    4469       251259 :                     thisSysPreDefRep.TimeAtOALimitOcc[limitFactorIndex] += TimeStepSys;
    4470       251259 :                     thisSysPreDefRep.MechVentTotAtLimitOcc[limitFactorIndex] += mechVentFlow * TimeStepSysSec;
    4471              :                 }
    4472              :             }
    4473              :         }
    4474              :     }
    4475              :     // Accumulate facility totals
    4476       616704 :     state.dataOutRptPredefined->TotalAnyZoneBelowVozDynForOA += state.dataSysRpts->AnyZoneTimeBelowVozDyn;
    4477       616704 :     state.dataOutRptPredefined->TotalAllZonesAtVozDynForOA += state.dataSysRpts->AllZonesTimeAtVozDyn;
    4478       616704 :     state.dataOutRptPredefined->TotalAnyZoneAboveVozDynForOA += state.dataSysRpts->AnyZoneTimeAboveVozDyn;
    4479       616704 :     state.dataOutRptPredefined->TotalAnyZoneVentUnoccForOA += state.dataSysRpts->AnyZoneTimeVentUnocc;
    4480       616704 :     state.dataOutRptPredefined->TotalAnyZoneBelowVozDynOccForOA += state.dataSysRpts->AnyZoneTimeBelowVozDynOcc;
    4481       616704 :     state.dataOutRptPredefined->TotalAllZonesAtVozDynOccForOA += state.dataSysRpts->AllZonesTimeAtVozDynOcc;
    4482       616704 :     state.dataOutRptPredefined->TotalAnyZoneAboveVozDynOccForOA += state.dataSysRpts->AnyZoneTimeAboveVozDynOcc;
    4483              : }
    4484              : 
    4485         3521 : 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         3521 :     int constexpr EnergyTrans(1);
    4502              : 
    4503        17648 :     for (int CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    4504              :         {
    4505        14127 :             auto &thisComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum);
    4506        19095 :             for (int VarNum = 1; VarNum <= thisComp.NumMeteredVars; ++VarNum) {
    4507        11167 :                 if (thisComp.MeteredVar(VarNum).resource == Constant::eResource::EnergyTransfer) {
    4508         6199 :                     thisComp.EnergyTransComp = EnergyTrans;
    4509         6199 :                     const std::string &CompType = thisComp.TypeOf;
    4510         6199 :                     const std::string &CompName = thisComp.Name;
    4511         6199 :                     bool MatchFound = false; // Set to .TRUE. when a match is found
    4512         6199 :                     int MatchLoop = 0;       // Loop number of the match
    4513         6199 :                     int MatchBranch = 0;     // Branch number of the match
    4514         6199 :                     int MatchComp = 0;       // Component number of the match
    4515         6199 :                     int MatchLoopType = 0;
    4516         6199 :                     int Idx = 0;
    4517         6199 :                     FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4518         6199 :                     if (MatchFound) {
    4519         5637 :                         UpdateAirSysCompPtrArray(state, Idx, AirLoopNum, BranchNum, CompNum, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4520              :                     }
    4521         6199 :                     thisComp.AirSysToPlantPtr = Idx;
    4522         6199 :                     break;
    4523              :                 }
    4524              :             }
    4525        20768 :             for (int SubCompNum = 1; SubCompNum <= thisComp.NumSubComps; ++SubCompNum) {
    4526              :                 //!!!!          IF(SysVentLoad == 0.0d0)EXIT
    4527              :                 {
    4528         6641 :                     auto &thisSubComp(thisComp.SubComp(SubCompNum));
    4529         7721 :                     for (int VarNum = 1; VarNum <= thisSubComp.NumMeteredVars; ++VarNum) {
    4530         3879 :                         if (thisSubComp.MeteredVar(VarNum).resource == Constant::eResource::EnergyTransfer) {
    4531         2799 :                             thisSubComp.EnergyTransComp = EnergyTrans;
    4532         2799 :                             const std::string &CompType = thisComp.TypeOf;
    4533         2799 :                             const std::string &CompName = thisComp.Name;
    4534         2799 :                             bool MatchFound = false; // Set to .TRUE. when a match is found
    4535         2799 :                             int MatchLoop = 0;       // Loop number of the match
    4536         2799 :                             int MatchBranch = 0;     // Branch number of the match
    4537         2799 :                             int MatchComp = 0;       // Component number of the match
    4538         2799 :                             int MatchLoopType = 0;
    4539         2799 :                             int Idx = 0;
    4540         2799 :                             FindDemandSideMatch(state, CompType, CompName, MatchFound, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4541         2799 :                             if (MatchFound) {
    4542            0 :                                 UpdateAirSysSubCompPtrArray(
    4543              :                                     state, Idx, AirLoopNum, BranchNum, CompNum, SubCompNum, MatchLoopType, MatchLoop, MatchBranch, MatchComp);
    4544              :                             }
    4545         2799 :                             thisSubComp.AirSysToPlantPtr = Idx;
    4546         2799 :                             break;
    4547              :                         }
    4548              :                     }
    4549         6773 :                     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         3521 : }
    4589              : 
    4590        55233 : 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        55233 :     MatchFound = false;
    4618        55233 :     MatchLoopType = 0;
    4619        55233 :     MatchLoop = 0;
    4620        55233 :     MatchLoop = 0;
    4621        55233 :     MatchBranch = 0;
    4622        55233 :     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        55233 :     if (!MatchFound) { // Go through the plant demand side loops
    4628       195017 :         for (int PassLoopNum = 1; PassLoopNum <= state.dataHVACGlobal->NumPlantLoops; ++PassLoopNum) {
    4629      6598694 :             for (int PassBranchNum = 1;
    4630      6598694 :                  PassBranchNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).TotalBranches;
    4631              :                  ++PassBranchNum) {
    4632     12911468 :                 for (int PassCompNum = 1;
    4633     12911468 :                      PassCompNum <=
    4634     12911468 :                      state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).Branch(PassBranchNum).TotalComponents;
    4635              :                      ++PassCompNum) {
    4636      6460765 :                     if (Util::SameString(CompType,
    4637      6460765 :                                          state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4638      6460765 :                                              .Branch(PassBranchNum)
    4639      6460765 :                                              .Comp(PassCompNum)
    4640      6862456 :                                              .TypeOf) &&
    4641       401691 :                         Util::SameString(CompName,
    4642       401691 :                                          state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4643       401691 :                                              .Branch(PassBranchNum)
    4644       401691 :                                              .Comp(PassCompNum)
    4645              :                                              .Name)) {
    4646              :                         // Found a match on the plant demand side--increment the counter
    4647         8207 :                         MatchFound = true;
    4648         8207 :                         MatchLoopType = 1;
    4649         8207 :                         MatchLoop = PassLoopNum;
    4650         8207 :                         MatchBranch = PassBranchNum;
    4651         8207 :                         MatchComp = PassCompNum;
    4652         8207 :                         break; // PassCompNum DO loop
    4653              :                     }
    4654              :                 }
    4655      6458910 :                 if (MatchFound) {
    4656         8207 :                     break; // PassBranchNum DO loop
    4657              :                 }
    4658              :             }
    4659       147991 :             if (MatchFound) {
    4660         8207 :                 break; // PassLoopNum DO loop
    4661              :             }
    4662              :         }
    4663              :     }
    4664              : 
    4665        55233 :     if (!MatchFound) { // Go through the condenser demand side loops
    4666        82715 :         for (int PassLoopNum = 1; PassLoopNum <= state.dataHVACGlobal->NumCondLoops; ++PassLoopNum) {
    4667       206854 :             for (int PassBranchNum = 1;
    4668       206854 :                  PassBranchNum <= state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).TotalBranches;
    4669              :                  ++PassBranchNum) {
    4670       339349 :                 for (int PassCompNum = 1;
    4671       339349 :                      PassCompNum <=
    4672       339349 :                      state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum).Branch(PassBranchNum).TotalComponents;
    4673              :                      ++PassCompNum) {
    4674       171165 :                     if (Util::SameString(CompType,
    4675       171165 :                                          state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4676       171165 :                                              .Branch(PassBranchNum)
    4677       171165 :                                              .Comp(PassCompNum)
    4678       229593 :                                              .TypeOf) &&
    4679        58428 :                         Util::SameString(CompName,
    4680        58428 :                                          state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](PassLoopNum)
    4681        58428 :                                              .Branch(PassBranchNum)
    4682        58428 :                                              .Comp(PassCompNum)
    4683              :                                              .Name)) {
    4684              :                         // Found a match on the plant demand side--increment the counter
    4685         2981 :                         MatchFound = true;
    4686         2981 :                         MatchLoopType = 2;
    4687         2981 :                         MatchLoop = PassLoopNum;
    4688         2981 :                         MatchBranch = PassBranchNum;
    4689         2981 :                         MatchComp = PassCompNum;
    4690         2981 :                         break; // PassCompNum DO loop
    4691              :                     }
    4692              :                 }
    4693       171165 :                 if (MatchFound) {
    4694         2981 :                     break; // PassBranchNum DO loop
    4695              :                 }
    4696              :             }
    4697        38670 :             if (MatchFound) {
    4698         2981 :                 break; // PassLoopNum DO loop
    4699              :             }
    4700              :         }
    4701              :     }
    4702        55233 : }
    4703              : 
    4704          782 : 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          782 :     auto const &NodeID = state.dataLoopNodes->NodeID;
    4736              : 
    4737          782 :     print(state.files.bnd, "{}\n", "! ===============================================================");
    4738          782 :     print(state.files.bnd, "{}\n", Format_706);
    4739          782 :     print(state.files.bnd, " #AirLoopHVACs,{}\n", state.dataHVACGlobal->NumPrimaryAirSys);
    4740          782 :     print(state.files.bnd, "{}\n", Format_708);
    4741          782 :     print(state.files.bnd, "{}\n", Format_709);
    4742          782 :     print(state.files.bnd, "{}\n", Format_710);
    4743          782 :     print(state.files.bnd, "{}\n", Format_711);
    4744          782 :     print(state.files.bnd, "{}\n", Format_712);
    4745          782 :     print(state.files.bnd, "{}\n", Format_714);
    4746          782 :     print(state.files.bnd, "{}\n", "! <AirLoopHVAC Connector>,<Connector Type>,<Connector Name>,<Loop Name>,<Loop Type>,<Number of Inlets/Outlets>");
    4747          782 :     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          782 :     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         1939 :     for (int Count = 1; Count <= state.dataHVACGlobal->NumPrimaryAirSys; ++Count) {
    4756            0 :         const auto oaSysExists = [&]() {
    4757         1157 :             if (state.dataAirLoop->AirToOANodeInfo(Count).OASysExists) {
    4758         1009 :                 return "Yes";
    4759              :             } else {
    4760          148 :                 return "No";
    4761              :             }
    4762         1157 :         }();
    4763              : 
    4764         1157 :         print(state.files.bnd,
    4765              :               " AirLoopHVAC,{},{},{},{},{},{}\n",
    4766         1157 :               state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName,
    4767         1157 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumReturnNodes,
    4768         1157 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumSupplyNodes,
    4769         1157 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesCooled,
    4770         1157 :               state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesHeated,
    4771              :               oaSysExists);
    4772         2314 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumReturnNodes; ++Count1) {
    4773         1157 :             print(state.files.bnd, "   AirLoop Return Connections,{},{},", Count1, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4774         1157 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipReturnNodeNum(Count1) > 0) {
    4775         1153 :                 print(state.files.bnd,
    4776              :                       "{},{},",
    4777         1153 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipReturnNodeNum(Count1),
    4778         1153 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipReturnNodeNum(Count1)));
    4779              :             } else {
    4780            4 :                 print(state.files.bnd, "{},{},", errstring, errstring);
    4781              :             }
    4782         1157 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopReturnNodeNum(Count1) > 0) {
    4783         1157 :                 print(state.files.bnd,
    4784              :                       "{},{}\n",
    4785         1157 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopReturnNodeNum(Count1),
    4786         1157 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopReturnNodeNum(Count1)));
    4787              :             } else {
    4788            0 :                 print(state.files.bnd, "{},{}\n", errstring, errstring);
    4789              :             }
    4790              :         }
    4791         2322 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumSupplyNodes; ++Count1) {
    4792         1165 :             print(state.files.bnd, "   AirLoop Supply Connections,{},{},", Count1, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4793         1165 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipSupplyNodeNum(Count1) > 0) {
    4794         1165 :                 print(state.files.bnd,
    4795              :                       "{},{},",
    4796         1165 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipSupplyNodeNum(Count1),
    4797         1165 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).ZoneEquipSupplyNodeNum(Count1)));
    4798              :             } else {
    4799            0 :                 print(state.files.bnd, "{},{},", errstring, errstring);
    4800              :             }
    4801         1165 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopSupplyNodeNum(Count1) > 0) {
    4802         1165 :                 print(state.files.bnd,
    4803              :                       "{},{}\n",
    4804         1165 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopSupplyNodeNum(Count1),
    4805         1165 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopSupplyNodeNum(Count1)));
    4806              :             } else {
    4807            0 :                 print(state.files.bnd, "{},{}\n", errstring, errstring);
    4808              :             }
    4809              :         }
    4810              : 
    4811         4620 :         for (int Count1 = 1; Count1 <= state.dataAirLoop->AirToZoneNodeInfo(Count).NumZonesCooled; ++Count1) {
    4812         3463 :             const int CtrldZoneNum = state.dataAirLoop->AirToZoneNodeInfo(Count).CoolCtrlZoneNums(Count1);
    4813         3463 :             print(state.files.bnd, "   Cooled Zone Info,{},{},", Count1, state.dataHeatBal->Zone(CtrldZoneNum).Name);
    4814         3463 :             if (state.dataAirLoop->AirToZoneNodeInfo(Count).CoolZoneInletNodes(Count1) > 0) {
    4815         3463 :                 print(state.files.bnd,
    4816              :                       "{},{},{}\n",
    4817         3463 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).CoolZoneInletNodes(Count1),
    4818         3463 :                       NodeID(state.dataAirLoop->AirToZoneNodeInfo(Count).CoolZoneInletNodes(Count1)),
    4819         3463 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4820              :             } else {
    4821            0 :                 print(state.files.bnd, "{},{},{}\n", errstring, errstring, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4822              :             }
    4823              :         }
    4824         1186 :         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         1157 :         if (state.dataAirLoop->AirToOANodeInfo(Count).OASysExists) {
    4838         1009 :             std::string ChrOut;
    4839         1009 :             std::string ChrOut2;
    4840         1009 :             if (state.dataAirLoop->AirToOANodeInfo(Count).OASysInletNodeNum > 0) {
    4841         1009 :                 ChrOut = fmt::to_string(state.dataAirLoop->AirToOANodeInfo(Count).OASysInletNodeNum);
    4842              :             } else {
    4843            0 :                 ChrOut = errstring;
    4844              :             }
    4845         1009 :             if (state.dataAirLoop->AirToOANodeInfo(Count).OASysOutletNodeNum > 0) {
    4846         1009 :                 ChrOut2 = fmt::to_string(state.dataAirLoop->AirToOANodeInfo(Count).OASysOutletNodeNum);
    4847              :             } else {
    4848            0 :                 ChrOut2 = errstring;
    4849              :             }
    4850              : 
    4851         1009 :             print(state.files.bnd, "   Outdoor Air Connections,{},", ChrOut);
    4852         1009 :             if (ChrOut != errstring) {
    4853         1009 :                 print(state.files.bnd, "{},", NodeID(state.dataAirLoop->AirToOANodeInfo(Count).OASysInletNodeNum));
    4854              :             } else {
    4855            0 :                 print(state.files.bnd, "{},", errstring);
    4856              :             }
    4857         1009 :             if (ChrOut2 != errstring) {
    4858         1009 :                 print(state.files.bnd,
    4859              :                       "{},{},{}\n",
    4860              :                       ChrOut2,
    4861         1009 :                       NodeID(state.dataAirLoop->AirToOANodeInfo(Count).OASysOutletNodeNum),
    4862         1009 :                       state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4863              :             } else {
    4864            0 :                 print(state.files.bnd, "{},{},{}\n", errstring, errstring, state.dataAirLoop->AirToZoneNodeInfo(Count).AirLoopName);
    4865              :             }
    4866         1009 :         }
    4867              :         //  Report HVAC Air Loop Splitter to BND file
    4868         1157 :         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          782 : }
    4912              : 
    4913          781 : 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          781 :     auto &orp = state.dataOutRptPredefined;
    4929          781 :     int rowCounter = 1;
    4930         1933 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    4931         1152 :         auto &pas = state.dataAirSystemsData->PrimaryAirSystems(airLoopNum);
    4932         1152 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirLoopName, format("{}", rowCounter), pas.Name);
    4933         1152 :         ++rowCounter;
    4934         2323 :         for (int BranchNum = 1; BranchNum <= pas.NumBranches; ++BranchNum) {
    4935         1171 :             auto &pasBranch = pas.Branch(BranchNum);
    4936         1171 :             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         4708 :             for (int CompNum = 1; CompNum <= pasBranch.TotalComponents; ++CompNum) {
    4945         3537 :                 auto &pasBranchComp = pasBranch.Comp(CompNum);
    4946         3537 :                 fillAirloopToplogyComponentRow(
    4947              :                     state, pas.Name, pasBranch.Name, pasBranch.DuctType, pasBranchComp.TypeOf, pasBranchComp.Name, rowCounter);
    4948         6636 :                 for (int SubCompNum = 1; SubCompNum <= pasBranchComp.NumSubComps; ++SubCompNum) {
    4949         3099 :                     auto &pasBranchSubComp = pasBranchComp.SubComp(SubCompNum);
    4950         3099 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSubCompType, format("{}", rowCounter), pasBranchSubComp.TypeOf);
    4951         3099 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSubCompName, format("{}", rowCounter), pasBranchSubComp.Name);
    4952         3099 :                     fillAirloopToplogyComponentRow(
    4953              :                         state, pas.Name, pasBranch.Name, pasBranch.DuctType, pasBranchComp.TypeOf, pasBranchComp.Name, rowCounter);
    4954         3135 :                     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         1171 :             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          781 :     rowCounter = 1;
    4991         1933 :     for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
    4992         1152 :         auto &pas = state.dataAirSystemsData->PrimaryAirSystems(airLoopNum);
    4993         1152 :         auto &thisAtoZInfo = state.dataAirLoop->AirToZoneNodeInfo(airLoopNum);
    4994         1152 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    4995         1152 :         ++rowCounter;
    4996         2312 :         for (int ductNum = 1; ductNum <= thisAtoZInfo.NumSupplyNodes; ++ductNum) {
    4997         1160 :             auto &thisBranch = pas.Branch(thisAtoZInfo.SupplyDuctBranchNum(ductNum));
    4998         1160 :             if (thisAtoZInfo.SupplyAirPathNum(ductNum) > 0) {
    4999         1156 :                 auto &thisSupplyPath = state.dataZoneEquip->SupplyAirPath(thisAtoZInfo.SupplyAirPathNum(ductNum));
    5000         2319 :                 for (int compNum = 1; compNum <= thisSupplyPath.NumOfComponents; ++compNum) {
    5001         1163 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5002         1163 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5003         2326 :                     OutputReportPredefined::PreDefTableEntry(
    5004         3489 :                         state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5005         2326 :                     OutputReportPredefined::PreDefTableEntry(
    5006         3489 :                         state, orp->pdchTopAirSupplyPCompType, format("{}", rowCounter), thisSupplyPath.ComponentType(compNum));
    5007         2326 :                     OutputReportPredefined::PreDefTableEntry(
    5008         3489 :                         state, orp->pdchTopAirSupplyPCompName, format("{}", rowCounter), thisSupplyPath.ComponentName(compNum));
    5009         1163 :                     ++rowCounter;
    5010              :                 }
    5011         1156 :                 if (thisBranch.DuctType == HVAC::AirDuctType::Cooling || thisBranch.DuctType == HVAC::AirDuctType::Main) {
    5012         4602 :                     for (int zoneNum : thisAtoZInfo.CoolCtrlZoneNums) {
    5013         3454 :                         auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum);
    5014         3454 :                         auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum);
    5015         7276 :                         for (auto &thisCoolADU : thisZoneEquipConfig.AirDistUnitCool) {
    5016         3822 :                             if (thisCoolADU.AirLoopNum != airLoopNum) {
    5017          368 :                                 continue;
    5018              :                             }
    5019         3454 :                             if (thisCoolADU.SupplyBranchIndex != thisAtoZInfo.SupplyDuctBranchNum(ductNum)) {
    5020            0 :                                 continue;
    5021              :                             }
    5022         3454 :                             if (thisCoolADU.SupplyAirPathExists) {
    5023         3454 :                                 int spCompNum = thisSupplyPath.OutletNodeSupplyPathCompNum(thisCoolADU.SupplyAirPathOutNodeIndex);
    5024         6908 :                                 OutputReportPredefined::PreDefTableEntry(
    5025        10362 :                                     state, orp->pdchTopAirSupplyPCompType, format("{}", rowCounter), thisSupplyPath.ComponentType(spCompNum));
    5026         6908 :                                 OutputReportPredefined::PreDefTableEntry(
    5027        10362 :                                     state, orp->pdchTopAirSupplyPCompName, format("{}", rowCounter), thisSupplyPath.ComponentName(spCompNum));
    5028              :                             }
    5029        10362 :                             OutputReportPredefined::PreDefTableEntry(
    5030        10362 :                                 state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5031        10362 :                             OutputReportPredefined::PreDefTableEntry(
    5032        10362 :                                 state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5033         6908 :                             OutputReportPredefined::PreDefTableEntry(
    5034        10362 :                                 state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5035        10362 :                             OutputReportPredefined::PreDefTableEntry(
    5036        10362 :                                 state, orp->pdchTopAirZoneName, format("{}", rowCounter), thisZoneEquipConfig.ZoneName);
    5037         3454 :                             auto &aduIndex = zel.EquipIndex(thisCoolADU.AirDistUnitIndex);
    5038         6908 :                             OutputReportPredefined::PreDefTableEntry(state,
    5039         3454 :                                                                      orp->pdchTopAirTermUnitType,
    5040         6908 :                                                                      format("{}", rowCounter),
    5041         3454 :                                                                      state.dataDefineEquipment->AirDistUnit(aduIndex).EquipType(1));
    5042         6908 :                             OutputReportPredefined::PreDefTableEntry(state,
    5043         3454 :                                                                      orp->pdchTopAirTermUnitName,
    5044         6908 :                                                                      format("{}", rowCounter),
    5045         3454 :                                                                      state.dataDefineEquipment->AirDistUnit(aduIndex).EquipName(1));
    5046         3454 :                             if (thisAtoZInfo.ReturnAirPathNum(1) > 0) {
    5047         3429 :                                 auto &thisReturnPath = state.dataZoneEquip->ReturnAirPath(thisAtoZInfo.ReturnAirPathNum(1));
    5048         3434 :                                 for (int retNodeNum = 1; retNodeNum <= thisZoneEquipConfig.NumReturnNodes; ++retNodeNum) {
    5049         3434 :                                     if (thisZoneEquipConfig.ReturnNodeAirLoopNum(retNodeNum) == airLoopNum) {
    5050         3429 :                                         int retPathCompNum = thisZoneEquipConfig.ReturnNodeRetPathCompNum(retNodeNum);
    5051         3429 :                                         if (retPathCompNum > 0) {
    5052         6858 :                                             OutputReportPredefined::PreDefTableEntry(state,
    5053         3429 :                                                                                      orp->pdchTopAirReturnPCompType,
    5054         6858 :                                                                                      format("{}", rowCounter),
    5055         3429 :                                                                                      thisReturnPath.ComponentType(retPathCompNum));
    5056         6858 :                                             OutputReportPredefined::PreDefTableEntry(state,
    5057         3429 :                                                                                      orp->pdchTopAirReturnPCompName,
    5058         6858 :                                                                                      format("{}", rowCounter),
    5059         3429 :                                                                                      thisReturnPath.ComponentName(retPathCompNum));
    5060              :                                         }
    5061         3429 :                                         break;
    5062              :                                     }
    5063              :                                 }
    5064              :                             }
    5065         3454 :                             ++rowCounter;
    5066              :                         }
    5067              :                     }
    5068         1156 :                 } 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         1152 :         if (thisAtoZInfo.ReturnAirPathNum(1) > 0) {
    5133         1139 :             auto &thisReturnPath = state.dataZoneEquip->ReturnAirPath(thisAtoZInfo.ReturnAirPathNum(1));
    5134         2394 :             for (int compNum = 1; compNum <= thisReturnPath.NumOfComponents; ++compNum) {
    5135         1255 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirDemandName, format("{}", rowCounter), thisAtoZInfo.AirLoopName);
    5136         1255 :                 if (compNum == thisReturnPath.OutletRetPathCompNum) {
    5137         1139 :                     auto &thisBranch = pas.Branch(pas.InletBranchNum[0]);
    5138         1139 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchName, format("{}", rowCounter), thisBranch.Name);
    5139         2278 :                     OutputReportPredefined::PreDefTableEntry(
    5140         3417 :                         state, orp->pdchTopAirSupplyDuctType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)thisBranch.DuctType]);
    5141              :                 }
    5142         2510 :                 OutputReportPredefined::PreDefTableEntry(
    5143         3765 :                     state, orp->pdchTopAirReturnPCompType, format("{}", rowCounter), thisReturnPath.ComponentType(compNum));
    5144         2510 :                 OutputReportPredefined::PreDefTableEntry(
    5145         3765 :                     state, orp->pdchTopAirReturnPCompName, format("{}", rowCounter), thisReturnPath.ComponentName(compNum));
    5146         1255 :                 ++rowCounter;
    5147              :             }
    5148              :         }
    5149              :     }
    5150          781 : }
    5151              : 
    5152         6672 : 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         6672 :     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         6672 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirLoopName, format("{}", rowCounter), loopName);
    5166         6672 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirBranchName, format("{}", rowCounter), branchName);
    5167         6672 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirSupplyBranchType, format("{}", rowCounter), HVAC::airDuctTypeNames[(int)ductType]);
    5168         6672 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirCompType, format("{}", rowCounter), compType);
    5169         6672 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopAirCompName, format("{}", rowCounter), compName);
    5170         6672 :     ++rowCounter;
    5171         6672 : }
    5172              : 
    5173          781 : 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          781 :     auto &orp = state.dataOutRptPredefined;
    5185          781 :     int rowCounter = 1;
    5186         5620 :     for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
    5187         4839 :         const std::string_view zoneName = state.dataHeatBal->Zone(zoneNum).Name;
    5188         4839 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpName, format("{}", rowCounter), zoneName);
    5189         4839 :         ++rowCounter;
    5190         4839 :         if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) {
    5191          726 :             continue;
    5192              :         }
    5193         4113 :         auto &zel = state.dataZoneEquip->ZoneEquipList(zoneNum);
    5194         8902 :         for (int CompNum = 1; CompNum <= zel.NumOfEquipTypes; ++CompNum) {
    5195         4789 :             auto &zelEquipData = zel.EquipData(CompNum);
    5196         4789 :             fillZoneEquipToplogyComponentRow(state, zoneName, zelEquipData.TypeOf, zelEquipData.Name, rowCounter);
    5197        11083 :             for (int SubCompNum = 1; SubCompNum <= zelEquipData.NumSubEquip; ++SubCompNum) {
    5198         6294 :                 auto &zelSubEquipData = zelEquipData.SubEquipData(SubCompNum);
    5199         6294 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompType, format("{}", rowCounter), zelSubEquipData.TypeOf);
    5200         6294 :                 OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompName, format("{}", rowCounter), zelSubEquipData.Name);
    5201         6294 :                 fillZoneEquipToplogyComponentRow(state, zoneName, zelEquipData.TypeOf, zelEquipData.Name, rowCounter);
    5202         8662 :                 for (int SubSubCompNum = 1; SubSubCompNum <= zelSubEquipData.NumSubSubEquip; ++SubSubCompNum) {
    5203         2368 :                     auto &zelSubSubEquipData = zelSubEquipData.SubSubEquipData(SubSubCompNum);
    5204         2368 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompType, format("{}", rowCounter), zelSubEquipData.TypeOf);
    5205         2368 :                     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpSubCompName, format("{}", rowCounter), zelSubEquipData.Name);
    5206         7104 :                     OutputReportPredefined::PreDefTableEntry(
    5207         7104 :                         state, orp->pdchTopZnEqpSubSubCompType, format("{}", rowCounter), zelSubSubEquipData.TypeOf);
    5208         7104 :                     OutputReportPredefined::PreDefTableEntry(
    5209         7104 :                         state, orp->pdchTopZnEqpSubSubCompName, format("{}", rowCounter), zelSubSubEquipData.Name);
    5210         2368 :                     fillZoneEquipToplogyComponentRow(state, zoneName, zelEquipData.TypeOf, zelEquipData.Name, rowCounter);
    5211              :                 }
    5212              :             }
    5213              :         }
    5214              :     }
    5215          781 : }
    5216              : 
    5217        13451 : void fillZoneEquipToplogyComponentRow(
    5218              :     EnergyPlusData &state, const std::string_view &zoneName, const std::string_view &compType, const std::string_view &compName, int &rowCounter)
    5219              : {
    5220        13451 :     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        13451 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpName, format("{}", rowCounter), zoneName);
    5226        13451 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpCompType, format("{}", rowCounter), compType);
    5227        13451 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopZnEqpCompName, format("{}", rowCounter), compName);
    5228        13451 :     ++rowCounter;
    5229        13451 : }
    5230              : 
    5231          781 : void reportAirDistributionUnits(EnergyPlusData &state)
    5232              : {
    5233              :     // populate the predefined tabular report for Equipment Summary - Air Terminals
    5234              : 
    5235          781 :     auto &orp = state.dataOutRptPredefined;
    5236         4239 :     for (auto &adu : state.dataDefineEquipment->AirDistUnit) {
    5237         3458 :         constexpr int aduCompNum = 1;
    5238         3458 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchAirTermZoneName, adu.Name, state.dataHeatBal->Zone(adu.ZoneNum).Name);
    5239         3458 :         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         3259 :         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         3259 :             state.dataSingleDuct->sd_airterminal(adu.EquipIndex(aduCompNum)).reportTerminalUnit(state);
    5253         3259 :             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          781 : }
    5275              : 
    5276              : //        End of Reporting subroutines for the SimAir Module
    5277              : // *****************************************************************************
    5278              : 
    5279              : } // namespace EnergyPlus::SystemReports
        

Generated by: LCOV version 2.0-1