LCOV - code coverage report
Current view: top level - EnergyPlus/Plant - PlantManager.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 2283 2620 87.1 %
Date: 2024-08-23 23:50:59 Functions: 23 24 95.8 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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             : 
      52             : // ObjexxFCL Headers
      53             : #include <ObjexxFCL/Array.functions.hh>
      54             : #include <ObjexxFCL/Fmath.hh>
      55             : #include <ObjexxFCL/string.functions.hh>
      56             : 
      57             : // EnergyPlus Headers
      58             : #include <EnergyPlus/Autosizing/Base.hh>
      59             : #include <EnergyPlus/BoilerSteam.hh>
      60             : #include <EnergyPlus/Boilers.hh>
      61             : #include <EnergyPlus/BranchInputManager.hh>
      62             : #include <EnergyPlus/CTElectricGenerator.hh>
      63             : #include <EnergyPlus/ChillerAbsorption.hh>
      64             : #include <EnergyPlus/ChillerElectricASHRAE205.hh>
      65             : #include <EnergyPlus/ChillerElectricEIR.hh>
      66             : #include <EnergyPlus/ChillerExhaustAbsorption.hh>
      67             : #include <EnergyPlus/ChillerGasAbsorption.hh>
      68             : #include <EnergyPlus/ChillerIndirectAbsorption.hh>
      69             : #include <EnergyPlus/ChillerReformulatedEIR.hh>
      70             : #include <EnergyPlus/CondenserLoopTowers.hh>
      71             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      72             : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      73             : #include <EnergyPlus/DataEnvironment.hh>
      74             : #include <EnergyPlus/DataErrorTracking.hh>
      75             : #include <EnergyPlus/DataHVACGlobals.hh>
      76             : #include <EnergyPlus/DataIPShortCuts.hh>
      77             : #include <EnergyPlus/DataLoopNode.hh>
      78             : #include <EnergyPlus/DataSizing.hh>
      79             : #include <EnergyPlus/EMSManager.hh>
      80             : #include <EnergyPlus/EvaporativeFluidCoolers.hh>
      81             : #include <EnergyPlus/FluidCoolers.hh>
      82             : #include <EnergyPlus/FluidProperties.hh>
      83             : #include <EnergyPlus/FuelCellElectricGenerator.hh>
      84             : #include <EnergyPlus/GroundHeatExchangers.hh>
      85             : #include <EnergyPlus/HVACInterfaceManager.hh>
      86             : #include <EnergyPlus/HVACVariableRefrigerantFlow.hh>
      87             : #include <EnergyPlus/HeatPumpWaterToWaterCOOLING.hh>
      88             : #include <EnergyPlus/HeatPumpWaterToWaterHEATING.hh>
      89             : #include <EnergyPlus/HeatPumpWaterToWaterSimple.hh>
      90             : #include <EnergyPlus/ICEngineElectricGenerator.hh>
      91             : #include <EnergyPlus/IceThermalStorage.hh>
      92             : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      93             : #include <EnergyPlus/MicroCHPElectricGenerator.hh>
      94             : #include <EnergyPlus/MicroturbineElectricGenerator.hh>
      95             : #include <EnergyPlus/NodeInputManager.hh>
      96             : #include <EnergyPlus/OutputProcessor.hh>
      97             : #include <EnergyPlus/OutputReportPredefined.hh>
      98             : #include <EnergyPlus/OutsideEnergySources.hh>
      99             : #include <EnergyPlus/PhotovoltaicThermalCollectors.hh>
     100             : #include <EnergyPlus/PipeHeatTransfer.hh>
     101             : #include <EnergyPlus/Pipes.hh>
     102             : #include <EnergyPlus/Plant/PlantManager.hh>
     103             : #include <EnergyPlus/PlantCentralGSHP.hh>
     104             : #include <EnergyPlus/PlantChillers.hh>
     105             : #include <EnergyPlus/PlantComponentTemperatureSources.hh>
     106             : #include <EnergyPlus/PlantHeatExchangerFluidToFluid.hh>
     107             : #include <EnergyPlus/PlantLoadProfile.hh>
     108             : #include <EnergyPlus/PlantLoopHeatPumpEIR.hh>
     109             : #include <EnergyPlus/PlantPipingSystemsManager.hh>
     110             : #include <EnergyPlus/PlantUtilities.hh>
     111             : #include <EnergyPlus/PlantValves.hh>
     112             : #include <EnergyPlus/PondGroundHeatExchanger.hh>
     113             : #include <EnergyPlus/RefrigeratedCase.hh>
     114             : #include <EnergyPlus/ScheduleManager.hh>
     115             : #include <EnergyPlus/SetPointManager.hh>
     116             : #include <EnergyPlus/SolarCollectors.hh>
     117             : #include <EnergyPlus/SurfaceGroundHeatExchanger.hh>
     118             : #include <EnergyPlus/SwimmingPool.hh>
     119             : #include <EnergyPlus/SystemAvailabilityManager.hh>
     120             : #include <EnergyPlus/UserDefinedComponents.hh>
     121             : #include <EnergyPlus/UtilityRoutines.hh>
     122             : #include <EnergyPlus/WaterThermalTanks.hh>
     123             : #include <EnergyPlus/WaterUse.hh>
     124             : 
     125             : namespace EnergyPlus::PlantManager {
     126             : 
     127             : // MODULE INFORMATION:
     128             : //       AUTHOR         Sankaranarayanan K P, Rich Liesen
     129             : //       DATE WRITTEN   May 2005
     130             : //       MODIFIED
     131             : //       RE-ENGINEERED  Sept. 2010 D. Fisher, Edwin Lee, Brent Griffith
     132             : //                      major plant upgrades:
     133             : //                         Single half loop solver
     134             : //                         Automated branch control types
     135             : //                         new loop sequencing structure
     136             : //                         Temperature out range checks
     137             : 
     138             : // PURPOSE OF THIS MODULE:
     139             : // This module serves as the driver for the plant simulation. All necessary iterations and update related to plant
     140             : // connections are performed in this module.
     141             : 
     142             : // Using/Aliasing
     143             : using namespace DataPlant;
     144             : using namespace DataBranchAirLoopPlant;
     145             : using namespace DataLoopNode;
     146             : 
     147             : static constexpr std::string_view fluidNameSteam("STEAM");
     148             : 
     149     5744020 : void ManagePlantLoops(EnergyPlusData &state,
     150             :                       bool const FirstHVACIteration,
     151             :                       bool &SimAirLoops,                          // True when the air loops need to be (re)simulated
     152             :                       bool &SimZoneEquipment,                     // True when zone equipment components need to be (re)simulated
     153             :                       [[maybe_unused]] bool &SimNonZoneEquipment, // True when non-zone equipment components need to be (re)simulated
     154             :                       bool &SimPlantLoops,                        // True when some part of Plant needs to be (re)simulated
     155             :                       bool &SimElecCircuits                       // True when electic circuits need to be (re)simulated
     156             : )
     157             : {
     158             : 
     159             :     // SUBROUTINE INFORMATION:
     160             :     //       AUTHOR         Sankaranarayanan K P
     161             :     //       DATE WRITTEN   Apr 2005
     162             :     //       MODIFIED
     163             :     //       RE-ENGINEERED  B. Griffith, Feb. 2010
     164             : 
     165             :     // PURPOSE OF THIS SUBROUTINE:
     166             :     // This subroutine manages the plant loop simulation
     167             : 
     168             :     // METHODOLOGY EMPLOYED:
     169             :     // Set up the while iteration block for the plant loop simulation.
     170             :     // Calls half loop sides to be simulated in predetermined order.
     171             :     // Reset the flags as necessary
     172             : 
     173             :     // Using/Aliasing
     174             :     using PlantUtilities::LogPlantConvergencePoints;
     175             : 
     176             :     // SUBROUTINE VARIABLE DEFINITIONS
     177             :     int IterPlant;
     178             :     int LoopNum;
     179             :     DataPlant::LoopSideLocation LoopSide;
     180             :     DataPlant::LoopSideLocation OtherSide;
     181             :     bool SimHalfLoopFlag;
     182             :     int HalfLoopNum;
     183             :     int CurntMinPlantSubIterations;
     184             : 
     185     5744020 :     if (std::any_of(state.dataPlnt->PlantLoop.begin(), state.dataPlnt->PlantLoop.end(), [](DataPlant::PlantLoopData const &e) {
     186     7659085 :             return (e.CommonPipeType == DataPlant::CommonPipeType::Single) || (e.CommonPipeType == DataPlant::CommonPipeType::TwoWay);
     187             :         })) {
     188       49047 :         CurntMinPlantSubIterations = max(7, state.dataConvergeParams->MinPlantSubIterations);
     189             :     } else {
     190     5694973 :         CurntMinPlantSubIterations = state.dataConvergeParams->MinPlantSubIterations;
     191             :     }
     192             : 
     193     5744020 :     if (state.dataPlnt->TotNumLoops <= 0) { // quick return if no plant in model
     194     2799942 :         SimPlantLoops = false;
     195     2799942 :         return;
     196             :     }
     197             : 
     198     2944078 :     IterPlant = 0;
     199     2944078 :     InitializeLoops(state, FirstHVACIteration);
     200             : 
     201     9722996 :     while ((SimPlantLoops) && (IterPlant <= state.dataConvergeParams->MaxPlantSubIterations)) {
     202             :         // go through half loops in predetermined calling order
     203    43234882 :         for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
     204             : 
     205    36455964 :             LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
     206    36455964 :             LoopSide = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
     207    36455964 :             OtherSide = LoopSideOther[static_cast<int>(LoopSide)]; // will give us 1 if LoopSide is 2, or 2 if LoopSide is 1
     208             : 
     209    36455964 :             auto &this_loop(state.dataPlnt->PlantLoop(LoopNum));
     210    36455964 :             auto &this_loop_side(this_loop.LoopSide(LoopSide));
     211    36455964 :             auto &other_loop_side(this_loop.LoopSide(OtherSide));
     212             : 
     213    36455964 :             SimHalfLoopFlag = this_loop_side.SimLoopSideNeeded; // set half loop sim flag
     214             : 
     215    36455964 :             if (SimHalfLoopFlag || IterPlant <= CurntMinPlantSubIterations) {
     216             : 
     217    36200510 :                 this_loop_side.solve(state, FirstHVACIteration, other_loop_side.SimLoopSideNeeded);
     218             : 
     219             :                 // Always set this side to false,  so that it won't keep being turned on just because of first hvac
     220    36200510 :                 this_loop_side.SimLoopSideNeeded = false;
     221             : 
     222             :                 // If we did the demand side, turn on the supply side (only if we need to do it last)
     223    36200510 :                 if (LoopSide == LoopSideLocation::Demand) {
     224    18105180 :                     if (this_loop.HasPressureComponents) {
     225       10530 :                         other_loop_side.SimLoopSideNeeded = false;
     226             :                     }
     227             :                 }
     228             : 
     229             :                 // Update the report variable
     230    36200510 :                 this_loop.LastLoopSideSimulated = static_cast<int>(LoopSide);
     231             : 
     232    36200510 :                 ++state.dataPlnt->PlantManageHalfLoopCalls;
     233             :             }
     234             : 
     235             :         } // half loop based calling order...
     236             : 
     237             :         // decide new status for SimPlantLoops flag
     238     6778918 :         SimPlantLoops = false;
     239    23903734 :         for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
     240    51967691 :             for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
     241    34842875 :                 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).SimLoopSideNeeded) {
     242      586759 :                     SimPlantLoops = true;
     243      586759 :                     goto LoopLevel_exit;
     244             :                 }
     245             :             }
     246             :         }
     247     6192159 :     LoopLevel_exit:;
     248             : 
     249     6778918 :         ++IterPlant; // Increment the iteration counter
     250     6778918 :         if (IterPlant < CurntMinPlantSubIterations) SimPlantLoops = true;
     251     6778918 :         ++state.dataPlnt->PlantManageSubIterations; // these are summed across all half loops for reporting
     252             :     }                                               // while
     253             : 
     254             :     // add check for non-plant system sim flag updates
     255             :     //  could set SimAirLoops, SimElecCircuits, SimZoneEquipment flags for now
     256    10646247 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
     257    23106507 :         for (DataPlant::LoopSideLocation LoopSide : DataPlant::LoopSideKeys) {
     258    15404338 :             auto &this_loop_side(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSide));
     259    15404338 :             if (this_loop_side.SimAirLoopsNeeded) SimAirLoops = true;
     260    15404338 :             if (this_loop_side.SimZoneEquipNeeded) SimZoneEquipment = true;
     261             :             //  IF (this_loop_side.SimNonZoneEquipNeeded) SimNonZoneEquipment = .TRUE.
     262    15404338 :             if (this_loop_side.SimElectLoadCentrNeeded) SimElecCircuits = true;
     263             :         }
     264             :     }
     265             : 
     266             :     // Also log the convergence history of all loopsides once complete
     267     2944078 :     LogPlantConvergencePoints(state, FirstHVACIteration);
     268             : }
     269             : 
     270         796 : void GetPlantLoopData(EnergyPlusData &state)
     271             : {
     272             : 
     273             :     // SUBROUTINE INFORMATION:
     274             :     //       AUTHOR         Sankaranarayanan K P
     275             :     //       DATE WRITTEN   April 2005
     276             :     //       MODIFIED       na
     277             :     //       RE-ENGINEERED  na
     278             : 
     279             :     // PURPOSE OF THIS SUBROUTINE:
     280             :     // This subroutine reads the primary plant loop
     281             :     // attributes from the input file
     282             : 
     283             :     // METHODOLOGY EMPLOYED:
     284             :     // calls the Input Processor to retrieve data from input file.
     285             : 
     286             :     // Using/Aliasing
     287             :     using ScheduleManager::GetScheduleIndex;
     288             :     using SetPointManager::IsNodeOnSetPtManager;
     289         796 :     HVAC::CtrlVarType localTempSetPt = HVAC::CtrlVarType::Temp;
     290             :     using NodeInputManager::GetOnlySingleNode;
     291             :     using namespace BranchInputManager;
     292             :     using DataSizing::AutoSize;
     293             : 
     294             :     // SUBROUTINE PARAMETER DEFINITIONS:
     295             :     static constexpr std::string_view RoutineName("GetPlant/CondenserLoopData: ");
     296             : 
     297             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     298             :     int LoopNum;   // DO loop counter for loops
     299             :     int NumAlphas; // Number of elements in the alpha array
     300             :     int NumNums;   // Number of elements in the numeric array
     301             :     int IOStat;    // IO Status when calling get input subroutine
     302             :     int NumFluids; // number of fluids in sim
     303             :     int PlantLoopNum;
     304             :     int CondLoopNum;
     305         796 :     Array1D_string Alpha(18); // dimension to num of alpha fields in input
     306         796 :     Array1D<Real64> Num(30);  // dimension to num of numeric data fields in input
     307         796 :     bool ErrorsFound(false);
     308         796 :     std::string LoadingScheme;
     309             :     bool ErrFound;
     310         796 :     std::string CurrentModuleObject; // for ease in renaming.
     311             :     bool MatchedPressureString;
     312             :     int PressSimAlphaIndex;
     313             : 
     314         796 :     CurrentModuleObject = "PlantLoop";
     315        1592 :     state.dataHVACGlobal->NumPlantLoops =
     316         796 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state,
     317             :                                                                       CurrentModuleObject); // Get the number of primary plant loops
     318         796 :     CurrentModuleObject = "CondenserLoop";
     319        1592 :     state.dataHVACGlobal->NumCondLoops =
     320         796 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); // Get the number of Condenser loops
     321         796 :     state.dataPlnt->TotNumLoops = state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops;
     322             : 
     323         796 :     if (state.dataPlnt->TotNumLoops > 0) {
     324         459 :         state.dataPlnt->PlantLoop.allocate(state.dataPlnt->TotNumLoops);
     325         459 :         state.dataConvergeParams->PlantConvergence.allocate(state.dataPlnt->TotNumLoops);
     326         459 :         if (!allocated(state.dataAvail->PlantAvailMgr)) {
     327         459 :             state.dataAvail->PlantAvailMgr.allocate(state.dataPlnt->TotNumLoops);
     328             :         }
     329             :     } else {
     330         337 :         return;
     331             :     }
     332             : 
     333        1607 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
     334        1148 :         Alpha = "";
     335        1148 :         Num = 0.0;
     336             : 
     337             :         // set up some references
     338        1148 :         auto &this_loop(state.dataPlnt->PlantLoop(LoopNum));
     339        1148 :         auto &this_demand_side(this_loop.LoopSide(DataPlant::LoopSideLocation::Demand));
     340        1148 :         auto &this_supply_side(this_loop.LoopSide(DataPlant::LoopSideLocation::Supply));
     341             :         DataLoopNode::ConnectionObjectType objType;
     342        1148 :         if (LoopNum <= state.dataHVACGlobal->NumPlantLoops) {
     343         890 :             PlantLoopNum = LoopNum;
     344         890 :             this_loop.TypeOfLoop = LoopType::Plant;
     345         890 :             CurrentModuleObject = "PlantLoop";
     346         890 :             objType = DataLoopNode::ConnectionObjectType::PlantLoop;
     347        1780 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     348             :                                                                      CurrentModuleObject,
     349             :                                                                      PlantLoopNum,
     350             :                                                                      Alpha,
     351             :                                                                      NumAlphas,
     352             :                                                                      Num,
     353             :                                                                      NumNums,
     354             :                                                                      IOStat,
     355         890 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     356         890 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     357         890 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     358         890 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     359             :         } else {
     360         258 :             CondLoopNum = LoopNum - state.dataHVACGlobal->NumPlantLoops;
     361         258 :             this_loop.TypeOfLoop = LoopType::Condenser;
     362         258 :             CurrentModuleObject = "CondenserLoop";
     363         258 :             objType = DataLoopNode::ConnectionObjectType::CondenserLoop;
     364         774 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     365             :                                                                      CurrentModuleObject,
     366             :                                                                      CondLoopNum,
     367             :                                                                      Alpha,
     368             :                                                                      NumAlphas,
     369             :                                                                      Num,
     370             :                                                                      NumNums,
     371             :                                                                      IOStat,
     372         258 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     373             :                                                                      _,
     374         258 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     375         258 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     376             :         }
     377        1148 :         Util::IsNameEmpty(state, Alpha(1), CurrentModuleObject, ErrorsFound);
     378        1148 :         this_loop.Name = Alpha(1); // Load the Plant Loop Name
     379             : 
     380        1148 :         if (Util::SameString(Alpha(2), "STEAM")) {
     381           9 :             this_loop.FluidType = DataLoopNode::NodeFluidType::Steam;
     382           9 :             this_loop.FluidName = Alpha(2);
     383        1139 :         } else if (Util::SameString(Alpha(2), "WATER")) {
     384        1113 :             this_loop.FluidType = DataLoopNode::NodeFluidType::Water;
     385        1113 :             this_loop.FluidName = Alpha(2);
     386        1113 :             this_loop.FluidIndex = FluidProperties::GetGlycolNum(state, Alpha(2));
     387          26 :         } else if (Util::SameString(Alpha(2), "USERDEFINEDFLUIDTYPE")) {
     388          26 :             this_loop.FluidType = DataLoopNode::NodeFluidType::Water;
     389          26 :             this_loop.FluidName = Alpha(3);
     390             :             // check for valid fluid name
     391          26 :             NumFluids = FluidProperties::CheckFluidPropertyName(state, Alpha(3));
     392          26 :             if (NumFluids == 0) {
     393           0 :                 ShowSevereError(state, CurrentModuleObject + "=\"" + Alpha(1) + "\", missing fluid data for Plant loop.");
     394           0 :                 ErrorsFound = true;
     395             :             } else {
     396          26 :                 this_loop.FluidIndex = FluidProperties::GetGlycolNum(state, Alpha(3));
     397          26 :                 if (this_loop.FluidIndex == 0) {
     398           0 :                     ShowSevereError(state, CurrentModuleObject + "=\"" + Alpha(1) + "\", invalid glycol fluid data for Plant loop.");
     399           0 :                     ErrorsFound = true;
     400             :                 }
     401             :             }
     402             :         } else {
     403           0 :             ShowWarningError(state,
     404           0 :                              "Input error: " + state.dataIPShortCut->cAlphaFieldNames(2) + '=' + Alpha(2) + " entered, in " + CurrentModuleObject +
     405           0 :                                  '=' + Alpha(1));
     406           0 :             ShowContinueError(state, "Will default to Water.");
     407             : 
     408           0 :             this_loop.FluidType = DataLoopNode::NodeFluidType::Water;
     409           0 :             this_loop.FluidName = "WATER";
     410           0 :             this_loop.FluidIndex = FluidProperties::GetGlycolNum(state, "WATER");
     411             :         }
     412             : 
     413        1148 :         this_loop.OperationScheme = Alpha(4); // Load the Plant Control Scheme Priority List
     414             : 
     415             :         // Load the temperature and flow rate maximum and minimum limits
     416        1148 :         this_loop.MaxTemp = Num(1);
     417        1148 :         this_loop.MinTemp = Num(2);
     418        1148 :         this_loop.MaxVolFlowRate = Num(3);
     419        1148 :         if (this_loop.MaxVolFlowRate == AutoSize) {
     420         718 :             this_loop.MaxVolFlowRateWasAutoSized = true;
     421             :         }
     422        1148 :         this_loop.MinVolFlowRate = Num(4);
     423             : 
     424             :         // The Plant loop volume for both halves of the loop is read in and used in this module for the
     425             :         // correct loop temperature step.  Loop data is read in supply side, but the volume is not used in
     426             :         // a calculation there.
     427        1148 :         this_loop.Volume = Num(5);
     428        1148 :         if (state.dataIPShortCut->lNumericFieldBlanks(5)) this_loop.Volume = Constant::AutoCalculate;
     429        1148 :         if (this_loop.Volume == Constant::AutoCalculate) {
     430        1110 :             this_loop.VolumeWasAutoSized = true;
     431             :         }
     432             :         // circulation time used to autocalculate loop volume
     433        1148 :         if (state.dataIPShortCut->lNumericFieldBlanks(6)) {
     434        1134 :             this_loop.CirculationTime = 2.0; // default
     435             :         } else {
     436          14 :             this_loop.CirculationTime = Num(6);
     437             :         }
     438             : 
     439             :         // Load the Loop Inlet and Outlet Nodes and Connection Info (Alpha(7-10) are related to the supply side)
     440        1148 :         this_supply_side.NodeNameIn = Alpha(6);
     441        1148 :         this_supply_side.NodeNameOut = Alpha(7);
     442        1148 :         this_supply_side.BranchList = Alpha(8);
     443        1148 :         this_supply_side.ConnectList = Alpha(9);
     444        1148 :         this_demand_side.NodeNameIn = Alpha(10);
     445        1148 :         this_demand_side.NodeNameOut = Alpha(11);
     446        1148 :         this_demand_side.BranchList = Alpha(12);
     447        1148 :         this_demand_side.ConnectList = Alpha(13);
     448             : 
     449        1148 :         this_supply_side.NodeNumIn = GetOnlySingleNode(state,
     450        1148 :                                                        Alpha(6),
     451             :                                                        ErrorsFound,
     452             :                                                        objType,
     453        1148 :                                                        Alpha(1),
     454             :                                                        this_loop.FluidType,
     455             :                                                        DataLoopNode::ConnectionType::Inlet,
     456             :                                                        NodeInputManager::CompFluidStream::Primary,
     457             :                                                        ObjectIsParent);
     458        1148 :         this_supply_side.NodeNumOut = GetOnlySingleNode(state,
     459        1148 :                                                         Alpha(7),
     460             :                                                         ErrorsFound,
     461             :                                                         objType,
     462        1148 :                                                         Alpha(1),
     463             :                                                         this_loop.FluidType,
     464             :                                                         DataLoopNode::ConnectionType::Outlet,
     465             :                                                         NodeInputManager::CompFluidStream::Primary,
     466             :                                                         ObjectIsParent);
     467        1148 :         this_demand_side.NodeNumIn = GetOnlySingleNode(state,
     468        1148 :                                                        Alpha(10),
     469             :                                                        ErrorsFound,
     470             :                                                        objType,
     471        1148 :                                                        Alpha(1),
     472             :                                                        this_loop.FluidType,
     473             :                                                        DataLoopNode::ConnectionType::Inlet,
     474             :                                                        NodeInputManager::CompFluidStream::Primary,
     475             :                                                        ObjectIsParent);
     476        1148 :         this_demand_side.NodeNumOut = GetOnlySingleNode(state,
     477        1148 :                                                         Alpha(11),
     478             :                                                         ErrorsFound,
     479             :                                                         objType,
     480        1148 :                                                         Alpha(1),
     481             :                                                         this_loop.FluidType,
     482             :                                                         DataLoopNode::ConnectionType::Outlet,
     483             :                                                         NodeInputManager::CompFluidStream::Primary,
     484             :                                                         ObjectIsParent);
     485             : 
     486        1148 :         this_demand_side.InletNodeSetPt = IsNodeOnSetPtManager(state, this_demand_side.NodeNumIn, localTempSetPt);
     487        1148 :         this_demand_side.OutletNodeSetPt = IsNodeOnSetPtManager(state, this_demand_side.NodeNumOut, localTempSetPt);
     488        1148 :         this_supply_side.InletNodeSetPt = IsNodeOnSetPtManager(state, this_supply_side.NodeNumIn, localTempSetPt);
     489        1148 :         this_supply_side.OutletNodeSetPt = IsNodeOnSetPtManager(state, this_supply_side.NodeNumOut, localTempSetPt);
     490        1148 :         this_loop.TempSetPointNodeNum = GetOnlySingleNode(state,
     491        1148 :                                                           Alpha(5),
     492             :                                                           ErrorsFound,
     493             :                                                           objType,
     494        1148 :                                                           Alpha(1),
     495             :                                                           this_loop.FluidType,
     496             :                                                           DataLoopNode::ConnectionType::Sensor,
     497             :                                                           NodeInputManager::CompFluidStream::Primary,
     498             :                                                           ObjectIsParent);
     499             : 
     500             :         // Load the load distribution scheme.
     501        1148 :         LoadingScheme = Alpha(14);
     502        1148 :         if (Util::SameString(LoadingScheme, "Optimal")) {
     503         560 :             this_loop.LoadDistribution = DataPlant::LoadingScheme::Optimal;
     504         588 :         } else if (Util::SameString(LoadingScheme, "SequentialLoad")) {
     505         558 :             this_loop.LoadDistribution = DataPlant::LoadingScheme::Sequential;
     506          30 :         } else if (Util::SameString(LoadingScheme, "UniformLoad")) {
     507          30 :             this_loop.LoadDistribution = DataPlant::LoadingScheme::Uniform;
     508           0 :         } else if (Util::SameString(LoadingScheme, "UniformPLR")) {
     509           0 :             this_loop.LoadDistribution = DataPlant::LoadingScheme::UniformPLR;
     510           0 :         } else if (Util::SameString(LoadingScheme, "SequentialUniformPLR")) {
     511           0 :             this_loop.LoadDistribution = DataPlant::LoadingScheme::SequentialUniformPLR;
     512             :         } else {
     513           0 :             ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
     514           0 :             ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(14) + "=\"" + Alpha(14) + "\".");
     515           0 :             ShowContinueError(state, "Will default to SequentialLoad."); // TODO rename point
     516           0 :             this_loop.LoadDistribution = DataPlant::LoadingScheme::Sequential;
     517             :         }
     518             : 
     519             :         // When dual setpoint is allowed in condenser loop modify this code.
     520        1148 :         if (this_loop.TypeOfLoop == LoopType::Plant) {
     521             :             // Get the Loop Demand Calculation Scheme
     522         890 :             if (Util::SameString(Alpha(16), "SingleSetpoint")) {
     523         875 :                 this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
     524          15 :             } else if (Util::SameString(Alpha(16), "DualSetpointDeadband")) {
     525          15 :                 if (this_loop.FluidType == DataLoopNode::NodeFluidType::Steam) {
     526           0 :                     ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
     527           0 :                     ShowContinueError(state,
     528           0 :                                       state.dataIPShortCut->cAlphaFieldNames(16) + "=\"" + Alpha(16) + "\" not valid for " +
     529           0 :                                           state.dataIPShortCut->cAlphaFieldNames(2) + "= Steam");
     530           0 :                     ShowContinueError(state,
     531           0 :                                       "Will reset " + state.dataIPShortCut->cAlphaFieldNames(16) + " = SingleSetPoint and simulation will continue.");
     532           0 :                     this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
     533             :                 } else {
     534          15 :                     this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand;
     535             :                 }
     536           0 :             } else if (Util::SameString(Alpha(16), "")) {
     537           0 :                 this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
     538             :             } else {
     539           0 :                 ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
     540           0 :                 ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(16) + "=\"" + Alpha(16) + "\".");
     541           0 :                 ShowContinueError(state, "Will default to SingleSetPoint."); // TODO rename point
     542           0 :                 this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
     543             :             }
     544         258 :         } else if (this_loop.TypeOfLoop == LoopType::Condenser) {
     545         258 :             this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
     546             :         }
     547             : 
     548             :         // When Commonpipe is allowed in condenser loop modify this code. Sankar 06/29/2009
     549        1148 :         if (this_loop.TypeOfLoop == LoopType::Plant) {
     550         890 :             if (Util::SameString(Alpha(17), "CommonPipe")) {
     551           4 :                 this_loop.CommonPipeType = DataPlant::CommonPipeType::Single;
     552         886 :             } else if (Util::SameString(Alpha(17), "TwoWayCommonPipe")) {
     553          10 :                 this_loop.CommonPipeType = DataPlant::CommonPipeType::TwoWay;
     554         876 :             } else if (Util::SameString(Alpha(17), "None") || state.dataIPShortCut->lAlphaFieldBlanks(17)) {
     555         876 :                 this_loop.CommonPipeType = DataPlant::CommonPipeType::No;
     556             :             } else {
     557           0 :                 ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
     558           0 :                 ShowContinueError(state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(17) + "=\"" + Alpha(17) + "\".");
     559           0 :                 ShowContinueError(state, "Refer to I/O reference document for more details.");
     560           0 :                 ErrorsFound = true;
     561             :             }
     562         258 :         } else if (this_loop.TypeOfLoop == LoopType::Condenser) {
     563         258 :             this_loop.CommonPipeType = DataPlant::CommonPipeType::No;
     564             :         }
     565             : 
     566        1148 :         if (this_loop.CommonPipeType == DataPlant::CommonPipeType::TwoWay) {
     567          10 :             if (this_demand_side.InletNodeSetPt && this_supply_side.InletNodeSetPt) {
     568           0 :                 ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     569           0 :                 ShowContinueError(state,
     570             :                                   "While using a two way common pipe there can be setpoint on only one node other than Plant Supply Outlet node.");
     571           0 :                 ShowContinueError(state, "Currently both Plant Demand inlet and plant supply inlet have setpoints.");
     572           0 :                 ShowContinueError(state, "Select one of the two nodes and rerun the simulation.");
     573           0 :                 ErrorsFound = true;
     574             :             }
     575          10 :             if (!this_demand_side.InletNodeSetPt && !this_supply_side.InletNodeSetPt) {
     576           0 :                 ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     577           0 :                 ShowContinueError(state, "While using a two way common pipe there must be a setpoint in addition to the Plant Supply Outlet node.");
     578           0 :                 ShowContinueError(state, "Currently neither plant demand inlet nor plant supply inlet have setpoints.");
     579           0 :                 ShowContinueError(state, "Select one of the two nodes and rerun the simulation.");
     580           0 :                 ErrorsFound = true;
     581             :             }
     582             :         }
     583             : 
     584             :         // Pressure Simulation Type Input
     585             :         // First set the alpha index in the object as it is different for plant/condenser
     586             :         // When CommonPipe, etc., is allowed in condenser loop, modify this code.  Edwin/Sankar 08/12/2009
     587        1148 :         if (this_loop.TypeOfLoop == LoopType::Plant) {
     588         890 :             PressSimAlphaIndex = 18;
     589             :         } else {
     590         258 :             PressSimAlphaIndex = 15;
     591             :         }
     592             : 
     593        1148 :         if (NumAlphas >= PressSimAlphaIndex) {
     594          17 :             MatchedPressureString = false;
     595             : 
     596          17 :             this_loop.PressureSimType =
     597          17 :                 static_cast<DataPlant::PressSimType>(getEnumValue(PressureSimTypeNamesUC, Util::makeUPPER(Alpha(PressSimAlphaIndex))));
     598             : 
     599          17 :             switch (this_loop.PressureSimType) {
     600             :                 // Check all types
     601          17 :             case DataPlant::PressSimType::NoPressure:
     602             :             case DataPlant::PressSimType::FlowCorrection:
     603             :             case DataPlant::PressSimType::PumpPowerCorrection:
     604             :             case DataPlant::PressSimType::FlowSimulation: {
     605          17 :                 MatchedPressureString = true;
     606          17 :                 break;
     607             :             }
     608           0 :             default:
     609           0 :                 break;
     610             :             }
     611             : 
     612             :             // If we found a match, check to make sure it is one of the valid
     613             :             // ones for this phase of pressure implementation
     614          17 :             if (MatchedPressureString) {
     615          17 :                 if ((this_loop.PressureSimType == DataPlant::PressSimType::NoPressure) ||
     616           3 :                     (this_loop.PressureSimType == DataPlant::PressSimType::PumpPowerCorrection) ||
     617           2 :                     (this_loop.PressureSimType == DataPlant::PressSimType::FlowCorrection)) {
     618             :                     // We are OK here, move on
     619             :                 } else {
     620             :                     // We have an erroneous input, alert user
     621           0 :                     ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
     622           0 :                     ShowContinueError(
     623           0 :                         state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(PressSimAlphaIndex) + "=\"" + Alpha(PressSimAlphaIndex) + "\".");
     624           0 :                     ShowContinueError(state, "Currently only options are: ");
     625           0 :                     ShowContinueError(state, "  - " + format("{}", PressureSimTypeNamesUC[static_cast<int>(DataPlant::PressSimType::NoPressure)]));
     626           0 :                     ShowContinueError(state,
     627           0 :                                       "  - " + format("{}", PressureSimTypeNamesUC[static_cast<int>(DataPlant::PressSimType::PumpPowerCorrection)]));
     628           0 :                     ShowContinueError(state,
     629           0 :                                       "  - " + format("{}", PressureSimTypeNamesUC[static_cast<int>(DataPlant::PressSimType::FlowCorrection)]));
     630           0 :                     ErrorsFound = true;
     631             :                 }
     632             :             }
     633             : 
     634             :             // if we made it this far and didn't get a match, check for blank
     635          17 :             if (!MatchedPressureString) {
     636           0 :                 if (Alpha(PressSimAlphaIndex).empty()) {
     637           0 :                     this_loop.PressureSimType = DataPlant::PressSimType::NoPressure;
     638           0 :                     break;
     639             :                 }
     640             :             }
     641             : 
     642             :             // if we made it this far, there was no match, and it wasn't blank
     643          17 :             if (!MatchedPressureString) {
     644           0 :                 ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     645           0 :                 ShowContinueError(
     646           0 :                     state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(PressSimAlphaIndex) + "=\"" + Alpha(PressSimAlphaIndex) + "\".");
     647           0 :                 ErrorsFound = true;
     648             :             }
     649             :         }
     650             : 
     651        1148 :         ErrFound = false;
     652             : 
     653        1148 :         if (this_loop.TypeOfLoop == LoopType::Plant) {
     654         890 :             Avail::GetPlantAvailabilityManager(state, Alpha(15), LoopNum, state.dataPlnt->TotNumLoops, ErrFound);
     655             :         }
     656             : 
     657        1148 :         if (ErrFound) {
     658           0 :             ShowContinueError(state, "Input errors in  " + CurrentModuleObject + '=' + Alpha(1));
     659           0 :             ErrorsFound = true;
     660             :         }
     661             : 
     662        1148 :         if (GetFirstBranchInletNodeName(state, this_demand_side.BranchList) != this_demand_side.NodeNameIn) {
     663           0 :             ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     664           0 :             ShowContinueError(state,
     665           0 :                               "The inlet node of the first branch in the " + state.dataIPShortCut->cAlphaFieldNames(12) + '=' +
     666           0 :                                   Alpha(12)); //"Plant Demand Side Branch List"
     667           0 :             ShowContinueError(state,
     668           0 :                               "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(10) + '=' +
     669           0 :                                   Alpha(10)); // "Plant Demand Side Inlet Node Name"
     670           0 :             ShowContinueError(state,
     671           0 :                               "Branch List Inlet Node Name=" + GetFirstBranchInletNodeName(state, this_demand_side.BranchList)); // TODO rename point
     672           0 :             ShowContinueError(
     673             :                 state,
     674             :                 "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch."); // TODO
     675             :             // rename
     676             :             // point
     677           0 :             ErrorsFound = true;
     678             :         }
     679             : 
     680        1148 :         if (GetLastBranchOutletNodeName(state, this_demand_side.BranchList) != this_demand_side.NodeNameOut) {
     681             :             //"Plant Demand Side Branch List"
     682           0 :             ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     683           0 :             ShowContinueError(state, "The outlet node of the last branch in the " + state.dataIPShortCut->cAlphaFieldNames(12) + '=' + Alpha(12));
     684             :             //"Plant Demand Side Outlet Node Name"
     685           0 :             ShowContinueError(state, "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(11) + '=' + Alpha(11));
     686           0 :             ShowContinueError(state,
     687           0 :                               "Branch List Outlet Node Name=" + GetLastBranchOutletNodeName(state, this_demand_side.BranchList)); // TODO rename point
     688             :             // TODO rename point
     689           0 :             ShowContinueError(state,
     690             :                               "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch.");
     691           0 :             ErrorsFound = true;
     692             :         }
     693             : 
     694        1148 :         if (GetFirstBranchInletNodeName(state, this_supply_side.BranchList) != this_supply_side.NodeNameIn) {
     695             :             //"Plant Supply Side Branch List"
     696           0 :             ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     697           0 :             ShowContinueError(state, "The inlet node of the first branch in the " + state.dataIPShortCut->cAlphaFieldNames(8) + '=' + Alpha(8));
     698             :             //"Plant Supply Side Inlet Node Name
     699           0 :             ShowContinueError(state, "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(6) + '=' + Alpha(6));
     700           0 :             ShowContinueError(state,
     701           0 :                               "Branch List Inlet Node Name=" + GetFirstBranchInletNodeName(state, this_supply_side.BranchList)); // TODO rename point
     702             :             // TODO rename point
     703           0 :             ShowContinueError(state,
     704             :                               "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch.");
     705           0 :             ErrorsFound = true;
     706             :         }
     707             : 
     708        1148 :         if (GetLastBranchOutletNodeName(state, this_supply_side.BranchList) != this_supply_side.NodeNameOut) {
     709             :             //"Plant Supply Side Branch List"
     710           0 :             ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
     711           0 :             ShowContinueError(state, "The outlet node of the last branch in the " + state.dataIPShortCut->cAlphaFieldNames(8) + '=' + Alpha(8));
     712             :             //"Plant Supply Side Outlet Node Name"
     713           0 :             ShowContinueError(state, "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(7) + '=' + Alpha(7));
     714           0 :             ShowContinueError(state,
     715           0 :                               "Branch List Outlet Node Name=" + GetLastBranchOutletNodeName(state, this_supply_side.BranchList)); // TODO rename point
     716             :             // TODO rename point
     717           0 :             ShowContinueError(state,
     718             :                               "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch.");
     719           0 :             ErrorsFound = true;
     720             :         }
     721             :     }
     722             : 
     723         459 :     if (ErrorsFound) {
     724           0 :         ShowFatalError(state, std::string{RoutineName} + "Errors found in processing input. Preceding conditions cause termination.");
     725             :     }
     726             : 
     727             :     // set up loop status (set by system availability managers) report variables
     728             :     // Condenser loop does not have availability manager yet. Once implemented, move the setup output variable to
     729             :     // outside the IF statement.
     730        1607 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
     731             : 
     732        1148 :         SetupOutputVariable(state,
     733             :                             "Plant System Cycle On Off Status",
     734             :                             Constant::Units::None,
     735        1148 :                             (int &)state.dataAvail->PlantAvailMgr(LoopNum).availStatus,
     736             :                             OutputProcessor::TimeStepType::System,
     737             :                             OutputProcessor::StoreType::Average,
     738        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
     739             :     }
     740        1807 : }
     741             : 
     742         796 : void GetPlantInput(EnergyPlusData &state)
     743             : {
     744             : 
     745             :     // SUBROUTINE INFORMATION:
     746             :     //       AUTHOR         Sankaranarayanan K P
     747             :     //       DATE WRITTEN   April 2005
     748             :     //       MODIFIED
     749             :     //       RE-ENGINEERED  na
     750             : 
     751             :     // PURPOSE OF THIS SUBROUTINE:
     752             :     // This subroutine gets input either through the Plant Loop derived type
     753             :     // or by calls out to the branch manager to obtain data.  By the end of
     754             :     // the routine the module level derived type Loop should be fully allocated
     755             :     // and fully populated.
     756             : 
     757             :     // Using/Aliasing
     758             :     using namespace NodeInputManager;
     759             :     using namespace BranchInputManager;
     760             : 
     761             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     762             :     int LoopNum; // DO loop counter for loops
     763             :     int HalfLoopNum;
     764             :     int NumOfPipesInLoop;
     765             :     int BranchNum; // DO loop counter for branches
     766             :     int CompNum;   // DO loop counter for components
     767             :     int NodeNum;   // DO loop counter for nodes
     768             :     int Outlet;
     769             :     int Inlet;
     770             :     int NumParams;
     771             :     int NumAlphas;
     772             :     int NumNumbers;
     773             :     int SplitNum;
     774             :     int MixNum;
     775             :     int NumConnectorsInLoop;
     776             :     int ConnNum;
     777             :     int TotCompsOnBranch;
     778             :     int MaxNumAlphas;
     779             : 
     780             :     bool SplitInBranch;
     781             :     bool MixerOutBranch;
     782         796 :     bool ErrorsFound(false);
     783             :     bool ASeriesBranchHasPump;
     784             :     bool AParallelBranchHasPump;
     785             : 
     786         796 :     std::string LoopIdentifier;
     787             : 
     788         796 :     Array1D_string BranchNames;     // Branch names from GetBranchList call
     789         796 :     Array1D_string CompTypes;       // Branch names from GetBranchList call
     790         796 :     Array1D_string CompNames;       // Branch names from GetBranchList call
     791         796 :     Array1D_int CompCtrls;          // Branch names from GetBranchList call
     792         796 :     Array1D_string InletNodeNames;  // Node names from GetBranchData call
     793         796 :     Array1D_string OutletNodeNames; // Node names from GetBranchData call
     794         796 :     Array1D_int InletNodeNumbers;   // Node numbers from GetBranchData call
     795         796 :     Array1D_int OutletNodeNumbers;  // Node numbers from GetBranchData call
     796         796 :     Array1D_bool SplitOutBranch;
     797         796 :     Array1D_bool MixerInBranch;
     798             :     bool errFlag;
     799             :     int LoopNumInArray;
     800             : 
     801         796 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Connector:Splitter", NumParams, NumAlphas, NumNumbers);
     802         796 :     MaxNumAlphas = NumAlphas;
     803         796 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Connector:Mixer", NumParams, NumAlphas, NumNumbers);
     804         796 :     MaxNumAlphas = max(MaxNumAlphas, NumAlphas);
     805         796 :     HalfLoopNum = 0;
     806             : 
     807        1944 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
     808        1148 :         auto &plantLoop = state.dataPlnt->PlantLoop(LoopNum);
     809        1148 :         plantLoop.LoopHasConnectionComp = false;
     810             : 
     811        3444 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
     812        2296 :             auto &loopSide = plantLoop.LoopSide(LoopSideNum);
     813        2296 :             ASeriesBranchHasPump = false;
     814        2296 :             AParallelBranchHasPump = false;
     815        2296 :             NumOfPipesInLoop = 0; // Initialization
     816        2296 :             ++HalfLoopNum;
     817        2296 :             loopSide.BypassExists = false;
     818        2296 :             if (plantLoop.TypeOfLoop == LoopType::Plant && LoopSideNum == LoopSideLocation::Demand) {
     819         890 :                 LoopIdentifier = "Plant Demand";
     820        1406 :             } else if (plantLoop.TypeOfLoop == LoopType::Plant && LoopSideNum == LoopSideLocation::Supply) {
     821         890 :                 LoopIdentifier = "Plant Supply";
     822         516 :             } else if (plantLoop.TypeOfLoop == LoopType::Condenser && LoopSideNum == LoopSideLocation::Demand) {
     823         258 :                 LoopIdentifier = "Condenser Demand";
     824         258 :             } else if (plantLoop.TypeOfLoop == LoopType::Condenser && LoopSideNum == LoopSideLocation::Supply) {
     825         258 :                 LoopIdentifier = "Condenser Supply";
     826             :             }
     827             : 
     828             :             // Get the branch list and size the Branch portion of the Loop derived type
     829        2296 :             loopSide.TotalBranches = NumBranchesInBranchList(state, loopSide.BranchList);
     830        2296 :             BranchNames.allocate(loopSide.TotalBranches);
     831        2296 :             BranchNames = "";
     832        2296 :             GetBranchList(state, plantLoop.Name, loopSide.BranchList, loopSide.TotalBranches, BranchNames, LoopIdentifier);
     833        2296 :             loopSide.Branch.allocate(loopSide.TotalBranches);
     834             : 
     835             :             // Cycle through all of the branches and set up the node data
     836       15746 :             for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
     837       13450 :                 auto &branch = loopSide.Branch(BranchNum);
     838       13450 :                 branch.Name = BranchNames(BranchNum);
     839       13450 :                 branch.TotalComponents = NumCompsInBranch(state, BranchNames(BranchNum));
     840       13450 :                 branch.IsBypass = false;
     841             : 
     842       13450 :                 CompTypes.allocate(branch.TotalComponents);
     843       13450 :                 CompNames.allocate(branch.TotalComponents);
     844       13450 :                 CompCtrls.dimension(branch.TotalComponents, 0);
     845       13450 :                 InletNodeNames.allocate(branch.TotalComponents);
     846       13450 :                 InletNodeNumbers.dimension(branch.TotalComponents, 0);
     847       13450 :                 OutletNodeNames.allocate(branch.TotalComponents);
     848       13450 :                 OutletNodeNumbers.dimension(branch.TotalComponents, 0);
     849             : 
     850       13450 :                 GetBranchData(state,
     851       13450 :                               plantLoop.Name,
     852       13450 :                               BranchNames(BranchNum),
     853       13450 :                               branch.PressureCurveType,
     854       13450 :                               branch.PressureCurveIndex,
     855       13450 :                               branch.TotalComponents,
     856             :                               CompTypes,
     857             :                               CompNames,
     858             :                               InletNodeNames,
     859             :                               InletNodeNumbers,
     860             :                               OutletNodeNames,
     861             :                               OutletNodeNumbers,
     862             :                               ErrorsFound);
     863             : 
     864       13450 :                 branch.Comp.allocate(branch.TotalComponents);
     865             : 
     866       26984 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
     867             :                     // set up some references
     868       13534 :                     auto &this_comp_type(CompTypes(CompNum));
     869       13534 :                     auto &this_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum));
     870             : 
     871       13534 :                     this_comp.CurOpSchemeType = OpScheme::Invalid;
     872       13534 :                     this_comp.TypeOf = this_comp_type;
     873       13534 :                     this_comp.location = EnergyPlus::PlantLocation(LoopNum, LoopSideNum, BranchNum, CompNum);
     874             : 
     875       13534 :                     this_comp.Type = static_cast<PlantEquipmentType>(getEnumValue(PlantEquipTypeNamesUC, Util::makeUPPER(this_comp_type)));
     876             : 
     877       13534 :                     switch (this_comp.Type) {
     878        5497 :                     case PlantEquipmentType::Pipe: {
     879        5497 :                         this_comp.CurOpSchemeType = OpScheme::NoControl;
     880        5497 :                         this_comp.compPtr = Pipes::LocalPipeData::factory(state, PlantEquipmentType::Pipe, CompNames(CompNum));
     881        5497 :                         break;
     882             :                     }
     883          39 :                     case PlantEquipmentType::PipeSteam: {
     884          39 :                         this_comp.CurOpSchemeType = OpScheme::NoControl;
     885          39 :                         this_comp.compPtr = Pipes::LocalPipeData::factory(state, PlantEquipmentType::PipeSteam, CompNames(CompNum));
     886          39 :                         break;
     887             :                     }
     888           1 :                     case PlantEquipmentType::PipeExterior: {
     889           1 :                         this_comp.CurOpSchemeType = OpScheme::NoControl;
     890           1 :                         this_comp.compPtr = PipeHeatTransfer::PipeHTData::factory(state, PlantEquipmentType::PipeExterior, CompNames(CompNum));
     891           1 :                         break;
     892             :                     }
     893           2 :                     case PlantEquipmentType::PipeInterior: {
     894           2 :                         this_comp.CurOpSchemeType = OpScheme::NoControl;
     895           2 :                         this_comp.compPtr = PipeHeatTransfer::PipeHTData::factory(state, PlantEquipmentType::PipeInterior, CompNames(CompNum));
     896           2 :                         break;
     897             :                     }
     898           1 :                     case PlantEquipmentType::PipeUnderground: {
     899           1 :                         this_comp.CurOpSchemeType = OpScheme::NoControl;
     900           1 :                         this_comp.compPtr = PipeHeatTransfer::PipeHTData::factory(state, PlantEquipmentType::PipeUnderground, CompNames(CompNum));
     901           1 :                         break;
     902             :                     }
     903           4 :                     case PlantEquipmentType::PipingSystemPipeCircuit: {
     904           4 :                         this_comp.CurOpSchemeType = OpScheme::NoControl;
     905           4 :                         this_comp.compPtr =
     906           4 :                             PlantPipingSystemsManager::Circuit::factory(state, PlantEquipmentType::PipingSystemPipeCircuit, CompNames(CompNum));
     907           4 :                         break;
     908             :                     }
     909        1170 :                     case PlantEquipmentType::PumpCondensate:
     910             :                     case PlantEquipmentType::PumpConstantSpeed:
     911             :                     case PlantEquipmentType::PumpVariableSpeed:
     912             :                     case PlantEquipmentType::PumpBankConstantSpeed:
     913             :                     case PlantEquipmentType::PumpBankVariableSpeed: {
     914        1170 :                         this_comp.compPtr = &state.dataPlantMgr->dummyPlantComponent;
     915        1170 :                         this_comp.CurOpSchemeType = OpScheme::Pump;
     916        1170 :                         if (BranchNum == 1 || BranchNum == state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches) {
     917        1154 :                             ASeriesBranchHasPump = true;
     918             :                         } else {
     919          16 :                             AParallelBranchHasPump = true;
     920             :                         }
     921        1170 :                         LoopSidePumpInformation p;
     922        1170 :                         p.PumpName = CompNames(CompNum);
     923        1170 :                         p.BranchNum = BranchNum;
     924        1170 :                         p.CompNum = CompNum;
     925        1170 :                         p.PumpOutletNode = OutletNodeNumbers(CompNum);
     926        1170 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).BranchPumpsExist = AParallelBranchHasPump;
     927        1170 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Pumps.push_back(p);
     928        1170 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalPumps++;
     929        1170 :                         break;
     930        1170 :                     }
     931         132 :                     case PlantEquipmentType::WtrHeaterMixed:
     932             :                     case PlantEquipmentType::WtrHeaterStratified: {
     933         132 :                         if (LoopSideNum == LoopSideLocation::Demand) {
     934           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
     935         129 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
     936         129 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
     937             :                         }
     938         132 :                         this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(state, CompNames(CompNum));
     939         132 :                         break;
     940             :                     }
     941           3 :                     case PlantEquipmentType::Chiller_DFAbsorption: {
     942           3 :                         this_comp.compPtr = ChillerGasAbsorption::GasAbsorberSpecs::factory(state, CompNames(CompNum));
     943           3 :                         break;
     944             :                     }
     945           3 :                     case PlantEquipmentType::Chiller_ExhFiredAbsorption: {
     946           3 :                         this_comp.compPtr = ChillerExhaustAbsorption::ExhaustAbsorberSpecs::factory(state, CompNames(CompNum));
     947           3 :                         break;
     948             :                     }
     949          10 :                     case PlantEquipmentType::ChilledWaterTankMixed:
     950             :                     case PlantEquipmentType::ChilledWaterTankStratified: {
     951          10 :                         if (LoopSideNum == LoopSideLocation::Demand) {
     952           4 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
     953           6 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
     954           6 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
     955             :                         }
     956          10 :                         this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(state, CompNames(CompNum));
     957          10 :                         break;
     958             :                     }
     959         913 :                     case PlantEquipmentType::WaterUseConnection: {
     960         913 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
     961         913 :                         this_comp.compPtr = WaterUse::WaterConnectionsType::factory(state, CompNames(CompNum));
     962         913 :                         break;
     963             :                     }
     964          10 :                     case PlantEquipmentType::SolarCollectorFlatPlate:
     965             :                     case PlantEquipmentType::SolarCollectorICS: {
     966          10 :                         if (LoopSideNum == LoopSideLocation::Demand) {
     967          10 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
     968           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
     969           0 :                             this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
     970             :                         }
     971          10 :                         this_comp.compPtr = SolarCollectors::CollectorData::factory(state, CompNames(CompNum));
     972          10 :                         break;
     973             :                     }
     974          28 :                     case PlantEquipmentType::PlantLoadProfile: {
     975          28 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
     976          28 :                         this_comp.compPtr = PlantLoadProfile::PlantProfileData::factory(state, CompNames(CompNum));
     977          28 :                         break;
     978             :                     }
     979          23 :                     case PlantEquipmentType::GrndHtExchgSystem: {
     980          23 :                         this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
     981          23 :                         this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory(state, PlantEquipmentType::GrndHtExchgSystem, CompNames(CompNum));
     982          23 :                         break;
     983             :                     }
     984           1 :                     case PlantEquipmentType::GrndHtExchgSurface: {
     985           1 :                         this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
     986           1 :                         this_comp.compPtr = SurfaceGroundHeatExchanger::SurfaceGroundHeatExchangerData::factory(
     987           1 :                             state, PlantEquipmentType::GrndHtExchgSurface, CompNames(CompNum));
     988           1 :                         break;
     989             :                     }
     990           3 :                     case PlantEquipmentType::GrndHtExchgPond: {
     991           3 :                         this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
     992           3 :                         this_comp.compPtr = PondGroundHeatExchanger::PondGroundHeatExchangerData::factory(state, CompNames(CompNum));
     993           3 :                         break;
     994             :                     }
     995           1 :                     case PlantEquipmentType::GrndHtExchgSlinky: {
     996           1 :                         this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
     997           1 :                         this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory(state, PlantEquipmentType::GrndHtExchgSlinky, CompNames(CompNum));
     998           1 :                         break;
     999             :                     }
    1000          97 :                     case PlantEquipmentType::Chiller_ElectricEIR: {
    1001          97 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1002          45 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1003          52 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1004          52 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1005             :                         }
    1006          97 :                         this_comp.compPtr = ChillerElectricEIR::ElectricEIRChillerSpecs::factory(state, CompNames(CompNum));
    1007          97 :                         break;
    1008             :                     }
    1009          82 :                     case PlantEquipmentType::Chiller_ElectricReformEIR: {
    1010          82 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1011          41 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1012          41 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1013          41 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1014             :                         }
    1015          82 :                         this_comp.compPtr = ChillerReformulatedEIR::ReformulatedEIRChillerSpecs::factory(state, CompNames(CompNum));
    1016          82 :                         break;
    1017             :                     }
    1018         378 :                     case PlantEquipmentType::Chiller_Electric: {
    1019         378 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1020         163 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1021         215 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1022         215 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1023             :                         }
    1024         378 :                         this_comp.compPtr = PlantChillers::ElectricChillerSpecs::factory(state, CompNames(CompNum));
    1025         378 :                         break;
    1026             :                     }
    1027          14 :                     case PlantEquipmentType::Chiller_ElectricASHRAE205: {
    1028          14 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1029           9 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1030           5 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1031           5 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1032             :                         }
    1033          14 :                         this_comp.compPtr = ChillerElectricASHRAE205::ASHRAE205ChillerSpecs::factory(state, CompNames(CompNum));
    1034          14 :                         break;
    1035             :                     }
    1036          27 :                     case PlantEquipmentType::Chiller_EngineDriven: {
    1037          27 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1038          15 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1039          12 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1040          12 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1041             :                         }
    1042          27 :                         this_comp.compPtr = PlantChillers::EngineDrivenChillerSpecs::factory(state, CompNames(CompNum));
    1043          27 :                         break;
    1044             :                     }
    1045           5 :                     case PlantEquipmentType::Chiller_CombTurbine: {
    1046           5 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1047           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1048           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1049           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1050             :                         }
    1051           5 :                         this_comp.compPtr = PlantChillers::GTChillerSpecs::factory(state, CompNames(CompNum));
    1052           5 :                         break;
    1053             :                     }
    1054         185 :                     case PlantEquipmentType::Chiller_ConstCOP: {
    1055         185 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1056          91 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1057          94 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1058          94 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1059             :                         }
    1060         185 :                         this_comp.compPtr = PlantChillers::ConstCOPChillerSpecs::factory(state, CompNames(CompNum));
    1061         185 :                         break;
    1062             :                     }
    1063         208 :                     case PlantEquipmentType::Boiler_Simple: {
    1064         208 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1065         208 :                         this_comp.compPtr = Boilers::BoilerSpecs::factory(state, CompNames(CompNum));
    1066         208 :                         break;
    1067             :                     }
    1068           8 :                     case PlantEquipmentType::Boiler_Steam: {
    1069           8 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1070           8 :                         this_comp.compPtr = BoilerSteam::BoilerSpecs::factory(state, CompNames(CompNum));
    1071           8 :                         break;
    1072             :                     }
    1073           5 :                     case PlantEquipmentType::Chiller_Indirect_Absorption: {
    1074           5 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1075           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1076           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1077           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1078             :                         }
    1079           5 :                         this_comp.compPtr = ChillerIndirectAbsorption::IndirectAbsorberSpecs::factory(state, CompNames(CompNum));
    1080           5 :                         break;
    1081             :                     }
    1082           4 :                     case PlantEquipmentType::Chiller_Absorption: {
    1083           4 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1084           2 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1085           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1086           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1087             :                         }
    1088           4 :                         this_comp.compPtr = ChillerAbsorption::BLASTAbsorberSpecs::factory(state, CompNames(CompNum));
    1089           4 :                         break;
    1090             :                     }
    1091         244 :                     case PlantEquipmentType::CoolingTower_SingleSpd:
    1092             :                     case PlantEquipmentType::CoolingTower_TwoSpd: {
    1093         244 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1094         244 :                         this_comp.compPtr = CondenserLoopTowers::CoolingTower::factory(state, CompNames(CompNum));
    1095         244 :                         break;
    1096             :                     }
    1097          26 :                     case PlantEquipmentType::CoolingTower_VarSpd:
    1098             :                     case PlantEquipmentType::CoolingTower_VarSpdMerkel: {
    1099          26 :                         this_comp.compPtr = CondenserLoopTowers::CoolingTower::factory(state, CompNames(CompNum));
    1100          26 :                         break;
    1101             :                     }
    1102           2 :                     case PlantEquipmentType::Generator_FCExhaust: {
    1103           2 :                         this_comp.compPtr = FuelCellElectricGenerator::FCDataStruct::factory_exhaust(state, CompNames(CompNum));
    1104           2 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1105           0 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1106           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1107           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1108             :                         }
    1109           2 :                         break;
    1110             :                     }
    1111          10 :                     case PlantEquipmentType::HeatPumpWtrHeaterPumped:
    1112             :                     case PlantEquipmentType::HeatPumpWtrHeaterWrapped: {
    1113          10 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
    1114          10 :                         this_comp.compPtr = WaterThermalTanks::HeatPumpWaterHeaterData::factory(state, CompNames(CompNum));
    1115          10 :                         break;
    1116             :                     }
    1117           4 :                     case PlantEquipmentType::HPWaterEFCooling: {
    1118           4 :                         this_comp.compPtr =
    1119           4 :                             HeatPumpWaterToWaterSimple::GshpSpecs::factory(state, PlantEquipmentType::HPWaterEFCooling, CompNames(CompNum));
    1120           4 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1121           2 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1122           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1123           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1124             :                         }
    1125           4 :                         break;
    1126             :                     }
    1127           4 :                     case PlantEquipmentType::HPWaterEFHeating: {
    1128           4 :                         this_comp.compPtr =
    1129           4 :                             HeatPumpWaterToWaterSimple::GshpSpecs::factory(state, PlantEquipmentType::HPWaterEFHeating, CompNames(CompNum));
    1130           4 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1131           2 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1132           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1133           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1134             :                         }
    1135           4 :                         break;
    1136             :                     }
    1137           6 :                     case PlantEquipmentType::HPWaterPEHeating: {
    1138           6 :                         this_comp.compPtr = HeatPumpWaterToWaterHEATING::GshpPeHeatingSpecs::factory(state, CompNames(CompNum));
    1139           6 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1140           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1141           3 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1142           3 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1143             :                         }
    1144           6 :                         break;
    1145             :                     }
    1146           6 :                     case PlantEquipmentType::HPWaterPECooling: {
    1147           6 :                         this_comp.compPtr = HeatPumpWaterToWaterCOOLING::GshpPeCoolingSpecs::factory(state, CompNames(CompNum));
    1148           6 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1149           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1150           3 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1151           3 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1152             :                         }
    1153           6 :                         break;
    1154             :                     }
    1155          11 :                     case PlantEquipmentType::HeatPumpEIRHeating: {
    1156          11 :                         this_comp.compPtr =
    1157          11 :                             EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::factory(state, PlantEquipmentType::HeatPumpEIRHeating, CompNames(CompNum));
    1158          11 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1159           2 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1160           9 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1161           9 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1162             :                         }
    1163          11 :                         break;
    1164             :                     }
    1165          12 :                     case PlantEquipmentType::HeatPumpEIRCooling: {
    1166          12 :                         this_comp.compPtr =
    1167          12 :                             EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::factory(state, PlantEquipmentType::HeatPumpEIRCooling, CompNames(CompNum));
    1168          12 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1169           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1170           9 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1171           9 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1172             :                         }
    1173          12 :                         break;
    1174             :                     }
    1175           1 :                     case PlantEquipmentType::HeatPumpFuelFiredHeating: {
    1176           2 :                         this_comp.compPtr = EIRPlantLoopHeatPumps::EIRFuelFiredHeatPump::factory(
    1177           1 :                             state, PlantEquipmentType::HeatPumpFuelFiredHeating, CompNames(CompNum));
    1178           1 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1179           1 :                         break;
    1180             :                     }
    1181           1 :                     case PlantEquipmentType::HeatPumpFuelFiredCooling: {
    1182           2 :                         this_comp.compPtr = EIRPlantLoopHeatPumps::EIRFuelFiredHeatPump::factory(
    1183           1 :                             state, PlantEquipmentType::HeatPumpFuelFiredCooling, CompNames(CompNum));
    1184           1 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1185           1 :                         break;
    1186             :                     }
    1187           1 :                     case PlantEquipmentType::HeatPumpVRF: {
    1188           1 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1189           1 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1190           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1191           0 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1192             :                         }
    1193           1 :                         this_comp.compPtr = HVACVariableRefrigerantFlow::VRFCondenserEquipment::factory(state, CompNames(CompNum));
    1194           1 :                         break;
    1195             :                     }
    1196         133 :                     case PlantEquipmentType::PurchChilledWater: {
    1197         133 :                         this_comp.compPtr =
    1198         133 :                             OutsideEnergySources::OutsideEnergySourceSpecs::factory(state, PlantEquipmentType::PurchChilledWater, CompNames(CompNum));
    1199         133 :                         break;
    1200             :                     }
    1201         144 :                     case PlantEquipmentType::PurchHotWater: {
    1202         144 :                         this_comp.compPtr =
    1203         144 :                             OutsideEnergySources::OutsideEnergySourceSpecs::factory(state, PlantEquipmentType::PurchHotWater, CompNames(CompNum));
    1204         144 :                         break;
    1205             :                     }
    1206           1 :                     case PlantEquipmentType::PurchSteam: {
    1207           1 :                         this_comp.compPtr =
    1208           1 :                             OutsideEnergySources::OutsideEnergySourceSpecs::factory(state, PlantEquipmentType::PurchSteam, CompNames(CompNum));
    1209           1 :                         break;
    1210             :                     }
    1211           2 :                     case PlantEquipmentType::TS_IceSimple: {
    1212           2 :                         this_comp.compPtr = IceThermalStorage::SimpleIceStorageData::factory(state, CompNames(CompNum));
    1213           2 :                         break;
    1214             :                     }
    1215           7 :                     case PlantEquipmentType::TS_IceDetailed: {
    1216           7 :                         this_comp.compPtr = IceThermalStorage::DetailedIceStorageData::factory(state, CompNames(CompNum));
    1217           7 :                         break;
    1218             :                     }
    1219           2 :                     case PlantEquipmentType::ValveTempering: {
    1220           2 :                         this_comp.compPtr = PlantValves::TemperValveData::factory(state, CompNames(CompNum));
    1221           2 :                         break;
    1222             :                     }
    1223          64 :                     case PlantEquipmentType::FluidToFluidPlantHtExchg: {
    1224          64 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1225          32 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1226          32 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1227          32 :                             this_comp.CurOpSchemeType = OpScheme::FreeRejection;
    1228             :                         }
    1229          64 :                         this_comp.compPtr = PlantHeatExchangerFluidToFluid::HeatExchangerStruct::factory(state, CompNames(CompNum));
    1230          64 :                         break;
    1231             :                     }
    1232           2 :                     case PlantEquipmentType::Generator_MicroTurbine: {
    1233           2 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1234           2 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1235           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1236           0 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1237             :                         }
    1238           2 :                         this_comp.compPtr = MicroturbineElectricGenerator::MTGeneratorSpecs::factory(state, CompNames(CompNum));
    1239           2 :                         break;
    1240             :                     }
    1241           3 :                     case PlantEquipmentType::Generator_ICEngine: {
    1242           3 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1243           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1244           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1245           0 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1246             :                         }
    1247           3 :                         this_comp.compPtr = ICEngineElectricGenerator::ICEngineGeneratorSpecs::factory(state, CompNames(CompNum));
    1248             : 
    1249           3 :                         break;
    1250             :                     }
    1251           3 :                     case PlantEquipmentType::Generator_CTurbine: {
    1252           3 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1253           3 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1254           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1255           0 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1256             :                         }
    1257           3 :                         this_comp.compPtr = CTElectricGenerator::CTGeneratorData::factory(state, CompNames(CompNum));
    1258           3 :                         break;
    1259             :                     }
    1260           2 :                     case PlantEquipmentType::Generator_MicroCHP: {
    1261           2 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1262           0 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1263           2 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1264           2 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1265             :                         }
    1266           2 :                         this_comp.compPtr = MicroCHPElectricGenerator::MicroCHPDataStruct::factory(state, CompNames(CompNum));
    1267           2 :                         break;
    1268             :                     }
    1269           0 :                     case PlantEquipmentType::Generator_FCStackCooler: {
    1270           0 :                         this_comp.compPtr = FuelCellElectricGenerator::FCDataStruct::factory(state, CompNames(CompNum));
    1271           0 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1272           0 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1273           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1274           0 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1275             :                         }
    1276           0 :                         break;
    1277             :                     }
    1278           1 :                     case PlantEquipmentType::FluidCooler_SingleSpd: {
    1279           1 :                         this_comp.compPtr =
    1280           1 :                             FluidCoolers::FluidCoolerspecs::factory(state, PlantEquipmentType::FluidCooler_SingleSpd, CompNames(CompNum));
    1281           1 :                         break;
    1282             :                     }
    1283           5 :                     case PlantEquipmentType::FluidCooler_TwoSpd: {
    1284           5 :                         this_comp.compPtr =
    1285           5 :                             FluidCoolers::FluidCoolerspecs::factory(state, PlantEquipmentType::FluidCooler_TwoSpd, CompNames(CompNum));
    1286           5 :                         break;
    1287             :                     }
    1288           1 :                     case PlantEquipmentType::EvapFluidCooler_SingleSpd: {
    1289           2 :                         this_comp.compPtr = EvaporativeFluidCoolers::EvapFluidCoolerSpecs::factory(
    1290           1 :                             state, PlantEquipmentType::EvapFluidCooler_SingleSpd, CompNames(CompNum));
    1291           1 :                         break;
    1292             :                     }
    1293           2 :                     case PlantEquipmentType::EvapFluidCooler_TwoSpd: {
    1294           4 :                         this_comp.compPtr = EvaporativeFluidCoolers::EvapFluidCoolerSpecs::factory(
    1295           2 :                             state, PlantEquipmentType::EvapFluidCooler_TwoSpd, CompNames(CompNum));
    1296           2 :                         break;
    1297             :                     }
    1298          10 :                     case PlantEquipmentType::PVTSolarCollectorFlatPlate: {
    1299          10 :                         if (LoopSideNum == LoopSideLocation::Demand) {
    1300          10 :                             this_comp.CurOpSchemeType = OpScheme::Demand;
    1301           0 :                         } else if (LoopSideNum == LoopSideLocation::Supply) {
    1302           0 :                             this_comp.CurOpSchemeType = OpScheme::Invalid;
    1303             :                         }
    1304          10 :                         this_comp.compPtr = PhotovoltaicThermalCollectors::PVTCollectorStruct::factory(state, CompNames(CompNum));
    1305          10 :                         break;
    1306             :                     }
    1307           6 :                     case PlantEquipmentType::CentralGroundSourceHeatPump: {
    1308           6 :                         this_comp.compPtr = PlantCentralGSHP::WrapperSpecs::factory(state, CompNames(CompNum));
    1309             :                         // now deal with demand components of the ZoneHVAC type served by ControlCompOutput
    1310           6 :                         break;
    1311             :                     }
    1312           2 :                     case PlantEquipmentType::SwimmingPool_Indoor: {
    1313           2 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
    1314           2 :                         this_comp.compPtr = SwimmingPool::SwimmingPoolData::factory(state, CompNames(CompNum));
    1315           2 :                         break;
    1316             :                     }
    1317        3940 :                     case PlantEquipmentType::PackagedTESCoolingCoil:
    1318             :                     case PlantEquipmentType::CoilWaterCooling:
    1319             :                     case PlantEquipmentType::CoilWaterDetailedFlatCooling:
    1320             :                     case PlantEquipmentType::CoilWaterSimpleHeating:
    1321             :                     case PlantEquipmentType::CoilSteamAirHeating:
    1322             :                     case PlantEquipmentType::Baseboard_Rad_Conv_Water:
    1323             :                     case PlantEquipmentType::Baseboard_Conv_Water:
    1324             :                     case PlantEquipmentType::Baseboard_Rad_Conv_Steam:
    1325             :                     case PlantEquipmentType::CoolingPanel_Simple:
    1326             :                     case PlantEquipmentType::LowTempRadiant_VarFlow:
    1327             :                     case PlantEquipmentType::LowTempRadiant_ConstFlow:
    1328             :                     case PlantEquipmentType::CooledBeamAirTerminal:
    1329             :                     case PlantEquipmentType::FourPipeBeamAirTerminal:
    1330             :                     case PlantEquipmentType::MultiSpeedHeatPumpRecovery:
    1331             :                     case PlantEquipmentType::UnitarySysRecovery:
    1332             :                     case PlantEquipmentType::CoilWAHPHeatingEquationFit:
    1333             :                     case PlantEquipmentType::CoilWAHPCoolingEquationFit:
    1334             :                     case PlantEquipmentType::CoilVSWAHPHeatingEquationFit:
    1335             :                     case PlantEquipmentType::CoilVSWAHPCoolingEquationFit:
    1336             :                     case PlantEquipmentType::CoilWAHPHeatingParamEst:
    1337             :                     case PlantEquipmentType::CoilWAHPCoolingParamEst: {
    1338        3940 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
    1339        3940 :                         this_comp.compPtr = &state.dataPlantMgr->dummyPlantComponent;
    1340        3940 :                         break;
    1341             :                     }
    1342           1 :                     case PlantEquipmentType::RefrigSystemWaterCondenser: {
    1343           1 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
    1344           1 :                         this_comp.compPtr = RefrigeratedCase::RefrigCondenserData::factory(state, CompNames(CompNum));
    1345           1 :                         break;
    1346             :                     }
    1347           1 :                     case PlantEquipmentType::RefrigerationWaterCoolRack: {
    1348           1 :                         this_comp.CurOpSchemeType = OpScheme::Demand;
    1349           1 :                         this_comp.compPtr = RefrigeratedCase::RefrigRackData::factory(state, CompNames(CompNum));
    1350           1 :                         break;
    1351             :                     }
    1352           2 :                     case PlantEquipmentType::PlantComponentUserDefined: {
    1353           2 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1354           2 :                         this_comp.compPtr = UserDefinedComponents::UserPlantComponentStruct::factory(state, CompNames(CompNum));
    1355           2 :                         break;
    1356             :                     }
    1357          16 :                     case PlantEquipmentType::CoilUserDefined:
    1358             :                     case PlantEquipmentType::ZoneHVACAirUserDefined:
    1359             :                     case PlantEquipmentType::AirTerminalUserDefined: {
    1360          16 :                         this_comp.CurOpSchemeType = OpScheme::Invalid;
    1361          16 :                         this_comp.compPtr = &state.dataPlantMgr->dummyPlantComponent;
    1362          16 :                         break;
    1363             :                     }
    1364           1 :                     case PlantEquipmentType::WaterSource: {
    1365           1 :                         this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
    1366           1 :                         this_comp.compPtr = PlantComponentTemperatureSources::WaterSourceSpecs::factory(state, CompNames(CompNum));
    1367           1 :                         break;
    1368             :                     }
    1369           1 :                     case PlantEquipmentType::GrndHtExchgHorizTrench: {
    1370           1 :                         this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
    1371           1 :                         this_comp.compPtr =
    1372           1 :                             PlantPipingSystemsManager::Circuit::factory(state, PlantEquipmentType::GrndHtExchgHorizTrench, CompNames(CompNum));
    1373           1 :                         break;
    1374             :                     }
    1375           0 :                     default: {
    1376           0 :                         if (has_prefixi(this_comp_type, "Pump") || has_prefixi(this_comp_type, "HeaderedPumps")) {
    1377             :                             // discover unsupported equipment on branches.
    1378           0 :                             ShowSevereError(state, "GetPlantInput: trying to process a pump type that is not supported, dev note");
    1379           0 :                             ShowContinueError(state, "Component Type =" + this_comp_type);
    1380             :                         } else {
    1381             :                             // discover unsupported equipment on branches.
    1382           0 :                             ShowSevereError(state, "GetPlantInput: Branch=\"" + BranchNames(BranchNum) + "\", invalid component on branch.");
    1383           0 :                             ShowContinueError(state, "...invalid component type=\"" + this_comp_type + "\", name=\"" + CompNames(CompNum) + "\".");
    1384             :                             //            ErrorsFound=.TRUE.
    1385             :                         }
    1386             :                     }
    1387             :                     }
    1388             : 
    1389       13534 :                     if (!this_comp.compPtr) ShowFatalError(state, format(" Plant component \"{}\" was not assigned a pointer.", this_comp_type));
    1390             : 
    1391       13534 :                     this_comp.Name = CompNames(CompNum);
    1392       13534 :                     this_comp.NodeNameIn = InletNodeNames(CompNum);
    1393       13534 :                     this_comp.NodeNumIn = InletNodeNumbers(CompNum);
    1394       13534 :                     this_comp.NodeNameOut = OutletNodeNames(CompNum);
    1395       13534 :                     this_comp.NodeNumOut = OutletNodeNumbers(CompNum);
    1396             :                 }
    1397             : 
    1398             :                 // set branch inlet/outlet nodes
    1399       13450 :                 branch.NodeNumIn = branch.Comp(1).NodeNumIn;
    1400       13450 :                 branch.NodeNumOut = branch.Comp(branch.TotalComponents).NodeNumOut;
    1401             : 
    1402       13450 :                 CompTypes.deallocate();
    1403       13450 :                 CompNames.deallocate();
    1404       13450 :                 CompCtrls.deallocate();
    1405       13450 :                 InletNodeNames.deallocate();
    1406       13450 :                 InletNodeNumbers.deallocate();
    1407       13450 :                 OutletNodeNames.deallocate();
    1408       13450 :                 OutletNodeNumbers.deallocate();
    1409             :             }
    1410             : 
    1411        2296 :             BranchNames.deallocate();
    1412             : 
    1413        2296 :             if (ASeriesBranchHasPump && AParallelBranchHasPump) {
    1414           0 :                 ShowSevereError(state, "Current version does not support Loop pumps and branch pumps together");
    1415           0 :                 ShowContinueError(state, "Occurs in loop " + state.dataPlnt->PlantLoop(LoopNum).Name);
    1416           0 :                 ErrorsFound = true;
    1417             :             }
    1418             : 
    1419             :             // Obtain the Splitter and Mixer information
    1420        2296 :             if (loopSide.ConnectList.empty()) {
    1421          33 :                 state.dataLoopNodes->NumofSplitters = 0;
    1422          33 :                 state.dataLoopNodes->NumofMixers = 0;
    1423             :             } else {
    1424        2263 :                 errFlag = false;
    1425        2263 :                 GetNumSplitterMixerInConntrList(
    1426        2263 :                     state, plantLoop.Name, loopSide.ConnectList, state.dataLoopNodes->NumofSplitters, state.dataLoopNodes->NumofMixers, errFlag);
    1427        2263 :                 if (errFlag) {
    1428           0 :                     ErrorsFound = true;
    1429             :                 }
    1430        2263 :                 if (state.dataLoopNodes->NumofSplitters != state.dataLoopNodes->NumofMixers) {
    1431           0 :                     ShowSevereError(state,
    1432           0 :                                     "GetPlantInput: Loop Name=" + plantLoop.Name + ", ConnectorList=" + loopSide.ConnectList +
    1433             :                                         ", unequal number of splitters and mixers");
    1434           0 :                     ErrorsFound = true;
    1435             :                 }
    1436             :             }
    1437             : 
    1438        2296 :             loopSide.Splitter.Exists = state.dataLoopNodes->NumofSplitters > 0;
    1439        2296 :             loopSide.Mixer.Exists = state.dataLoopNodes->NumofMixers > 0;
    1440             : 
    1441        2296 :             if (ErrorsFound) {
    1442           0 :                 ShowFatalError(state, "GetPlantInput: Previous Severe errors cause termination.");
    1443             :             }
    1444             : 
    1445        2296 :             NumConnectorsInLoop = state.dataLoopNodes->NumofSplitters + state.dataLoopNodes->NumofMixers;
    1446        2296 :             SplitNum = 1;
    1447        4559 :             for (ConnNum = 1; ConnNum <= NumConnectorsInLoop; ++ConnNum) {
    1448             : 
    1449        4526 :                 if (SplitNum > state.dataLoopNodes->NumofSplitters) break;
    1450        2263 :                 OutletNodeNames.allocate(MaxNumAlphas);
    1451        2263 :                 OutletNodeNumbers.allocate(MaxNumAlphas);
    1452        4526 :                 GetLoopSplitter(state,
    1453        2263 :                                 plantLoop.Name,
    1454        2263 :                                 loopSide.ConnectList,
    1455        2263 :                                 loopSide.Splitter.Name,
    1456        2263 :                                 loopSide.Splitter.Exists,
    1457        2263 :                                 loopSide.Splitter.NodeNameIn,
    1458        2263 :                                 loopSide.Splitter.NodeNumIn,
    1459        2263 :                                 loopSide.Splitter.TotalOutletNodes,
    1460             :                                 OutletNodeNames,
    1461             :                                 OutletNodeNumbers,
    1462             :                                 ErrorsFound,
    1463             :                                 ConnNum,
    1464             :                                 SplitNum);
    1465             : 
    1466        2263 :                 if (SplitNum == 1) {
    1467           0 :                     OutletNodeNames.deallocate();
    1468           0 :                     OutletNodeNumbers.deallocate();
    1469           0 :                     continue;
    1470             :                 }
    1471             : 
    1472             :                 // Map the inlet node to the splitter to a branch number
    1473        2263 :                 if (loopSide.Splitter.Exists) {
    1474             :                     // Map the inlet node to the splitter to a branch number
    1475        2263 :                     SplitInBranch = false;
    1476        2263 :                     for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
    1477        2263 :                         auto &branch = loopSide.Branch(BranchNum);
    1478        2263 :                         CompNum = branch.TotalComponents;
    1479        2263 :                         if (loopSide.Splitter.NodeNumIn == branch.Comp(CompNum).NodeNumOut) {
    1480        2263 :                             loopSide.Splitter.BranchNumIn = BranchNum;
    1481        2263 :                             SplitInBranch = true;
    1482        2263 :                             break; // BranchNum DO loop
    1483             :                         }
    1484             :                     }
    1485        2263 :                     if (!SplitInBranch) {
    1486           0 :                         ShowSevereError(state, "Splitter Inlet Branch not found, Splitter=" + loopSide.Splitter.Name);
    1487           0 :                         ShowContinueError(state, "Splitter Branch Inlet name=" + loopSide.Splitter.NodeNameIn);
    1488           0 :                         ShowContinueError(state, "In Loop=" + plantLoop.Name);
    1489           0 :                         ErrorsFound = true;
    1490             :                     }
    1491             : 
    1492        2263 :                     loopSide.Splitter.NodeNameOut.allocate(loopSide.Splitter.TotalOutletNodes);
    1493        2263 :                     loopSide.Splitter.NodeNumOut.dimension(loopSide.Splitter.TotalOutletNodes, 0);
    1494        2263 :                     loopSide.Splitter.BranchNumOut.dimension(loopSide.Splitter.TotalOutletNodes, 0);
    1495             : 
    1496        2263 :                     SplitOutBranch.allocate(loopSide.Splitter.TotalOutletNodes);
    1497        2263 :                     SplitOutBranch = false;
    1498       11154 :                     for (NodeNum = 1; NodeNum <= loopSide.Splitter.TotalOutletNodes; ++NodeNum) {
    1499        8891 :                         loopSide.Splitter.NodeNameOut(NodeNum) = OutletNodeNames(NodeNum);
    1500        8891 :                         loopSide.Splitter.NodeNumOut(NodeNum) = OutletNodeNumbers(NodeNum);
    1501             :                         // The following DO loop series is intended to store the branch number for each outlet
    1502             :                         // branch of the splitter
    1503      112429 :                         for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
    1504      112429 :                             if (loopSide.Splitter.NodeNumOut(NodeNum) == loopSide.Branch(BranchNum).Comp(1).NodeNumIn) {
    1505        8891 :                                 loopSide.Splitter.BranchNumOut(NodeNum) = BranchNum;
    1506        8891 :                                 SplitOutBranch(NodeNum) = true;
    1507        8891 :                                 break; // BranchNum DO loop
    1508             :                             }
    1509             :                         }
    1510             :                     }
    1511             : 
    1512       11154 :                     for (Outlet = 1; Outlet <= loopSide.Splitter.TotalOutletNodes; ++Outlet) {
    1513        8891 :                         if (SplitOutBranch(Outlet)) continue;
    1514           0 :                         ShowSevereError(state, "Splitter Outlet Branch not found, Splitter=" + loopSide.Splitter.Name);
    1515           0 :                         ShowContinueError(state, "Splitter Branch Outlet node name=" + loopSide.Splitter.NodeNameOut(Outlet));
    1516           0 :                         ShowContinueError(state, "In Loop=" + plantLoop.Name);
    1517           0 :                         ShowContinueError(state, "Loop BranchList=" + loopSide.BranchList);
    1518           0 :                         ShowContinueError(state, "Loop ConnectorList=" + loopSide.ConnectList);
    1519           0 :                         ErrorsFound = true;
    1520             :                     }
    1521             : 
    1522        2263 :                     SplitOutBranch.deallocate();
    1523             : 
    1524             :                 } // Splitter exists
    1525        2263 :                 OutletNodeNames.deallocate();
    1526        2263 :                 OutletNodeNumbers.deallocate();
    1527             :             }
    1528             : 
    1529        2296 :             MixNum = 1;
    1530        6822 :             for (ConnNum = 1; ConnNum <= NumConnectorsInLoop; ++ConnNum) {
    1531             : 
    1532        4526 :                 if (MixNum > state.dataLoopNodes->NumofMixers) break;
    1533        4526 :                 InletNodeNames.allocate(MaxNumAlphas);
    1534        4526 :                 InletNodeNumbers.allocate(MaxNumAlphas);
    1535        9052 :                 GetLoopMixer(state,
    1536        4526 :                              plantLoop.Name,
    1537        4526 :                              loopSide.ConnectList,
    1538        4526 :                              loopSide.Mixer.Name,
    1539        4526 :                              loopSide.Mixer.Exists,
    1540        4526 :                              loopSide.Mixer.NodeNameOut,
    1541        4526 :                              loopSide.Mixer.NodeNumOut,
    1542        4526 :                              loopSide.Mixer.TotalInletNodes,
    1543             :                              InletNodeNames,
    1544             :                              InletNodeNumbers,
    1545             :                              ErrorsFound,
    1546             :                              ConnNum,
    1547             :                              MixNum);
    1548             : 
    1549        4526 :                 if (MixNum == 1) {
    1550        2263 :                     InletNodeNames.deallocate();
    1551        2263 :                     InletNodeNumbers.deallocate();
    1552        2263 :                     continue;
    1553             :                 }
    1554             :                 // Map the outlet node of the mixer to a branch number
    1555        2263 :                 if (loopSide.Mixer.Exists) {
    1556             :                     // Map the outlet node of the mixer to a branch number
    1557        2263 :                     MixerOutBranch = false;
    1558       13417 :                     for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
    1559       13417 :                         if (loopSide.Mixer.NodeNumOut == loopSide.Branch(BranchNum).Comp(1).NodeNumIn) {
    1560        2263 :                             loopSide.Mixer.BranchNumOut = BranchNum;
    1561        2263 :                             MixerOutBranch = true;
    1562        2263 :                             break; // BranchNum DO loop
    1563             :                         }
    1564             :                     }
    1565        2263 :                     if (!MixerOutBranch) {
    1566           0 :                         ShowSevereError(state, "Mixer Outlet Branch not found, Mixer=" + loopSide.Mixer.Name);
    1567           0 :                         ErrorsFound = true;
    1568             :                     }
    1569             : 
    1570        2263 :                     loopSide.Mixer.NodeNameIn.allocate(loopSide.Mixer.TotalInletNodes);
    1571        2263 :                     loopSide.Mixer.NodeNumIn.dimension(loopSide.Mixer.TotalInletNodes, 0);
    1572        2263 :                     loopSide.Mixer.BranchNumIn.dimension(loopSide.Mixer.TotalInletNodes, 0);
    1573             : 
    1574        2263 :                     MixerInBranch.allocate(loopSide.Mixer.TotalInletNodes);
    1575        2263 :                     MixerInBranch = false;
    1576       11154 :                     for (NodeNum = 1; NodeNum <= loopSide.Mixer.TotalInletNodes; ++NodeNum) {
    1577        8891 :                         loopSide.Mixer.NodeNameIn(NodeNum) = InletNodeNames(NodeNum);
    1578        8891 :                         loopSide.Mixer.NodeNumIn(NodeNum) = InletNodeNumbers(NodeNum);
    1579             :                         // The following DO loop series is intended to store the branch number for each inlet branch of the mixer
    1580      112429 :                         for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
    1581      112429 :                             auto &branch = loopSide.Branch(BranchNum);
    1582      112429 :                             CompNum = branch.TotalComponents;
    1583      112429 :                             if (loopSide.Mixer.NodeNumIn(NodeNum) == branch.Comp(CompNum).NodeNumOut) {
    1584        8891 :                                 loopSide.Mixer.BranchNumIn(NodeNum) = BranchNum;
    1585        8891 :                                 MixerInBranch(NodeNum) = true;
    1586        8891 :                                 break; // BranchNum DO loop
    1587             :                             }
    1588             :                         }
    1589             :                     }
    1590             : 
    1591       11154 :                     for (Inlet = 1; Inlet <= loopSide.Mixer.TotalInletNodes; ++Inlet) {
    1592        8891 :                         if (MixerInBranch(Inlet)) continue;
    1593           0 :                         ShowSevereError(state, "Mixer Inlet Branch not found, Mixer=" + loopSide.Mixer.Name);
    1594           0 :                         ShowContinueError(state, "Mixer Branch Inlet name=" + loopSide.Mixer.NodeNameIn(Inlet));
    1595           0 :                         ShowContinueError(state, "In Loop=" + plantLoop.Name);
    1596           0 :                         ShowContinueError(state, "Loop BranchList=" + loopSide.BranchList);
    1597           0 :                         ShowContinueError(state, "Loop ConnectorList=" + loopSide.ConnectList);
    1598           0 :                         ErrorsFound = true;
    1599             :                     }
    1600             : 
    1601        2263 :                     MixerInBranch.deallocate();
    1602             :                 } // Mixer exists
    1603        2263 :                 InletNodeNames.deallocate();
    1604        2263 :                 InletNodeNumbers.deallocate();
    1605             :             }
    1606             : 
    1607        2296 :             loopSide.noLoadConstantSpeedBranchFlowRateSteps.allocate(loopSide.TotalBranches - 2);
    1608             : 
    1609             :             // TODO: this is just intended to be temporary
    1610        2296 :             loopSide.plantLoc.loopNum = LoopNum;
    1611        2296 :             loopSide.plantLoc.loopSideNum = LoopSideNum;
    1612             : 
    1613             :         } // ... end LoopSideNum=LoopSideLocation::Demand,LoopSideLocation::Supply
    1614             : 
    1615        1148 :         plantLoop.LoopSide(DataPlant::LoopSideLocation::Demand).loopSideDescription = plantLoop.Name + " - Demand Side";
    1616        1148 :         plantLoop.LoopSide(DataPlant::LoopSideLocation::Supply).loopSideDescription = plantLoop.Name + " - Supply Side";
    1617             : 
    1618             :         // a nice little spot to report out bad pump/common-pipe configurations
    1619        1148 :         bool const ThisSideHasPumps = (plantLoop.LoopSide(DataPlant::LoopSideLocation::Demand).TotalPumps > 0);
    1620        1148 :         bool const OtherSideHasPumps = (plantLoop.LoopSide(DataPlant::LoopSideLocation::Supply).TotalPumps > 0);
    1621        1148 :         if ((plantLoop.CommonPipeType != DataPlant::CommonPipeType::No) && (!ThisSideHasPumps || !OtherSideHasPumps)) {
    1622           0 :             ShowSevereError(state, "Input Error: Common Pipe configurations must have pumps on both sides of loop");
    1623           0 :             ShowContinueError(state, "Occurs on plant loop name =\"" + plantLoop.Name + "\"");
    1624           0 :             ShowContinueError(state, "Make sure both demand and supply sides have a pump");
    1625           0 :             ErrorsFound = true;
    1626        1148 :         } else if ((plantLoop.CommonPipeType == DataPlant::CommonPipeType::No) && ThisSideHasPumps && OtherSideHasPumps) {
    1627           0 :             ShowSevereError(state, "Input Error: Pumps on both loop sides must utilize a common pipe");
    1628           0 :             ShowContinueError(state, "Occurs on plant loop name =\"" + plantLoop.Name + "\"");
    1629           0 :             ShowContinueError(state, "Add common pipe or remove one loop side pump");
    1630           0 :             ErrorsFound = true;
    1631        1148 :         } else if (!ThisSideHasPumps && !OtherSideHasPumps) {
    1632           0 :             ShowSevereError(state, "SetupLoopFlowRequest: Problem in plant topology, no pumps specified on the loop");
    1633           0 :             ShowContinueError(state, "Occurs on plant loop name =\"" + plantLoop.Name + "\"");
    1634           0 :             ShowContinueError(state, "All plant loops require at least one pump");
    1635           0 :             ErrorsFound = true;
    1636             :         }
    1637             : 
    1638             :         // set up some pump indexing for convenience later
    1639        3444 :         for (DataPlant::LoopSideLocation LoopSideCounter : DataPlant::LoopSideKeys) {
    1640        3466 :             for (int PumpCounter = 1; PumpCounter <= plantLoop.LoopSide(LoopSideCounter).TotalPumps; ++PumpCounter) {
    1641        1170 :                 int const PumpBranchNum = plantLoop.LoopSide(LoopSideCounter).Pumps(PumpCounter).BranchNum;
    1642        1170 :                 int const PumpCompNum = plantLoop.LoopSide(LoopSideCounter).Pumps(PumpCounter).CompNum;
    1643        1170 :                 plantLoop.LoopSide(LoopSideCounter).Branch(PumpBranchNum).Comp(PumpCompNum).IndexInLoopSidePumps = PumpCounter;
    1644             :             }
    1645             :         }
    1646             :     }
    1647             : 
    1648         796 :     if (ErrorsFound) {
    1649           0 :         ShowFatalError(state, "GetPlantInput: Errors in getting PlantLoop Input");
    1650             :     }
    1651             : 
    1652         796 :     if (state.dataHVACGlobal->NumPlantLoops > 0)
    1653         442 :         state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)].allocate(state.dataHVACGlobal->NumPlantLoops);
    1654         796 :     if (state.dataHVACGlobal->NumPlantLoops > 0)
    1655         442 :         state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)].allocate(state.dataHVACGlobal->NumPlantLoops);
    1656             : 
    1657        1686 :     for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumPlantLoops; ++LoopNum) {
    1658             : 
    1659             :         // set up references for this loop
    1660         890 :         auto &this_plant_loop(state.dataPlnt->PlantLoop(LoopNum));
    1661         890 :         auto &this_plant_supply(this_plant_loop.LoopSide(LoopSideLocation::Supply));
    1662         890 :         auto &this_vent_plant_supply(state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum));
    1663         890 :         auto &this_plant_demand(this_plant_loop.LoopSide(LoopSideLocation::Demand));
    1664         890 :         auto &this_vent_plant_demand(state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](LoopNum));
    1665             : 
    1666         890 :         this_vent_plant_supply.Name = this_plant_loop.Name;
    1667         890 :         this_vent_plant_supply.NodeNumIn = this_plant_supply.NodeNumIn;
    1668         890 :         this_vent_plant_supply.NodeNameIn = this_plant_supply.NodeNameIn;
    1669         890 :         this_vent_plant_supply.NodeNumOut = this_plant_supply.NodeNumOut;
    1670         890 :         this_vent_plant_supply.NodeNameOut = this_plant_supply.NodeNameOut;
    1671         890 :         this_vent_plant_supply.TotalBranches = this_plant_supply.TotalBranches;
    1672             : 
    1673         890 :         if (this_vent_plant_supply.TotalBranches > 0) this_vent_plant_supply.Branch.allocate(this_vent_plant_supply.TotalBranches);
    1674             : 
    1675        4592 :         for (BranchNum = 1; BranchNum <= this_vent_plant_supply.TotalBranches; ++BranchNum) {
    1676             : 
    1677        3702 :             auto &this_plant_supply_branch(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum));
    1678        3702 :             auto &this_vent_plant_supply_branch(state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum));
    1679             : 
    1680        3702 :             this_vent_plant_supply_branch.Name = this_plant_supply_branch.Name;
    1681        3702 :             this_vent_plant_supply_branch.NodeNumIn = this_plant_supply_branch.NodeNumIn;
    1682        3702 :             this_vent_plant_supply_branch.NodeNumOut = this_plant_supply_branch.NodeNumOut;
    1683        3702 :             this_vent_plant_supply_branch.TotalComponents = this_plant_supply_branch.TotalComponents;
    1684        3702 :             if (this_vent_plant_supply_branch.TotalComponents > 0) {
    1685        3702 :                 TotCompsOnBranch = this_vent_plant_supply_branch.TotalComponents;
    1686        3702 :                 this_vent_plant_supply_branch.Comp.allocate(TotCompsOnBranch);
    1687             :             }
    1688             : 
    1689        3702 :             for (CompNum = 1;
    1690        7462 :                  CompNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).TotalComponents;
    1691             :                  ++CompNum) {
    1692             : 
    1693        3760 :                 auto &this_plant_supply_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum));
    1694             :                 auto &this_vent_plant_supply_comp(
    1695        3760 :                     state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).Comp(CompNum));
    1696             : 
    1697        3760 :                 this_vent_plant_supply_comp.Name = this_plant_supply_comp.Name;
    1698        3760 :                 this_vent_plant_supply_comp.TypeOf = this_plant_supply_comp.TypeOf;
    1699        3760 :                 this_vent_plant_supply_comp.NodeNameIn = this_plant_supply_comp.NodeNameIn;
    1700        3760 :                 this_vent_plant_supply_comp.NodeNameOut = this_plant_supply_comp.NodeNameOut;
    1701        3760 :                 this_vent_plant_supply_comp.NodeNumIn = this_plant_supply_comp.NodeNumIn;
    1702        3760 :                 this_vent_plant_supply_comp.NodeNumOut = this_plant_supply_comp.NodeNumOut;
    1703             : 
    1704             :             } // loop over components in branches on the loop (ventilation report data)
    1705             : 
    1706             :         } // loop over branches on the loop (ventilation report data)
    1707             : 
    1708         890 :         this_vent_plant_demand.Name = this_plant_loop.Name;
    1709         890 :         this_vent_plant_demand.NodeNumIn = this_plant_demand.NodeNumIn;
    1710         890 :         this_vent_plant_demand.NodeNameIn = this_plant_demand.NodeNameIn;
    1711         890 :         this_vent_plant_demand.NodeNumOut = this_plant_demand.NodeNumOut;
    1712         890 :         this_vent_plant_demand.NodeNameOut = this_plant_demand.NodeNameOut;
    1713         890 :         this_vent_plant_demand.TotalBranches = this_plant_demand.TotalBranches;
    1714             : 
    1715         890 :         if (this_vent_plant_demand.TotalBranches > 0) this_vent_plant_demand.Branch.allocate(this_vent_plant_demand.TotalBranches);
    1716             : 
    1717        8331 :         for (BranchNum = 1; BranchNum <= this_vent_plant_demand.TotalBranches; ++BranchNum) {
    1718             : 
    1719        7441 :             auto &this_plant_demand_branch(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum));
    1720        7441 :             auto &this_vent_plant_demand_branch(state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum));
    1721             : 
    1722        7441 :             this_vent_plant_demand_branch.Name = this_plant_demand_branch.Name;
    1723        7441 :             this_vent_plant_demand_branch.NodeNumIn = this_plant_demand_branch.NodeNumIn;
    1724        7441 :             this_vent_plant_demand_branch.NodeNumOut = this_plant_demand_branch.NodeNumOut;
    1725        7441 :             this_vent_plant_demand_branch.TotalComponents = this_plant_demand_branch.TotalComponents;
    1726        7441 :             if (this_vent_plant_demand_branch.TotalComponents > 0) {
    1727        7441 :                 TotCompsOnBranch = this_vent_plant_demand_branch.TotalComponents;
    1728        7441 :                 this_vent_plant_demand_branch.Comp.allocate(TotCompsOnBranch);
    1729             :             }
    1730             : 
    1731       14892 :             for (CompNum = 1; CompNum <= this_vent_plant_demand_branch.TotalComponents; ++CompNum) {
    1732             : 
    1733        7451 :                 auto &this_plant_demand_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum));
    1734             :                 auto &this_vent_plant_demand_comp(
    1735        7451 :                     state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum).Comp(CompNum));
    1736             : 
    1737        7451 :                 this_vent_plant_demand_comp.Name = this_plant_demand_comp.Name;
    1738        7451 :                 this_vent_plant_demand_comp.TypeOf = this_plant_demand_comp.TypeOf;
    1739        7451 :                 this_vent_plant_demand_comp.NodeNameIn = this_plant_demand_comp.NodeNameIn;
    1740        7451 :                 this_vent_plant_demand_comp.NodeNameOut = this_plant_demand_comp.NodeNameOut;
    1741        7451 :                 this_vent_plant_demand_comp.NodeNumIn = this_plant_demand_comp.NodeNumIn;
    1742        7451 :                 this_vent_plant_demand_comp.NodeNumOut = this_plant_demand_comp.NodeNumOut;
    1743             : 
    1744             :             } // loop over components in branches on the loop (ventilation report data)
    1745             : 
    1746             :         } // loop over branches on the loop (ventilation report data)
    1747             : 
    1748             :     } // loop over plant supply loops (ventilation report data)
    1749             : 
    1750         796 :     if (state.dataHVACGlobal->NumCondLoops > 0)
    1751         257 :         state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)].allocate(state.dataHVACGlobal->NumCondLoops);
    1752         796 :     if (state.dataHVACGlobal->NumCondLoops > 0)
    1753         257 :         state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)].allocate(state.dataHVACGlobal->NumCondLoops);
    1754             : 
    1755        1054 :     for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumCondLoops; ++LoopNum) {
    1756             : 
    1757         258 :         LoopNumInArray = LoopNum + state.dataHVACGlobal->NumPlantLoops;
    1758             : 
    1759             :         // set up references for this loop
    1760         258 :         auto &this_cond_loop(state.dataPlnt->PlantLoop(LoopNumInArray));
    1761         258 :         auto &this_cond_supply(this_cond_loop.LoopSide(LoopSideLocation::Supply));
    1762         258 :         auto &this_vent_cond_supply(state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](LoopNum));
    1763         258 :         auto &this_cond_demand(this_cond_loop.LoopSide(LoopSideLocation::Demand));
    1764         258 :         auto &this_vent_cond_demand(state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](LoopNum));
    1765             : 
    1766         258 :         this_vent_cond_supply.Name = this_cond_loop.Name;
    1767         258 :         this_vent_cond_supply.NodeNumIn = this_cond_supply.NodeNumIn;
    1768         258 :         this_vent_cond_supply.NodeNameIn = this_cond_supply.NodeNameIn;
    1769         258 :         this_vent_cond_supply.NodeNumOut = this_cond_supply.NodeNumOut;
    1770         258 :         this_vent_cond_supply.NodeNameOut = this_cond_supply.NodeNameOut;
    1771         258 :         this_vent_cond_supply.TotalBranches = this_cond_supply.TotalBranches;
    1772         258 :         if (this_vent_cond_supply.TotalBranches > 0) this_vent_cond_supply.Branch.allocate(this_vent_cond_supply.TotalBranches);
    1773             : 
    1774        1305 :         for (BranchNum = 1; BranchNum <= this_vent_cond_supply.TotalBranches; ++BranchNum) {
    1775             : 
    1776        1047 :             auto &this_cond_supply_branch(this_cond_supply.Branch(BranchNum));
    1777        1047 :             auto &this_vent_cond_supply_branch(this_vent_cond_supply.Branch(BranchNum));
    1778             : 
    1779        1047 :             this_vent_cond_supply_branch.Name = this_cond_supply_branch.Name;
    1780        1047 :             this_vent_cond_supply_branch.NodeNumIn = this_cond_supply_branch.NodeNumIn;
    1781        1047 :             this_vent_cond_supply_branch.NodeNumOut = this_cond_supply_branch.NodeNumOut;
    1782        1047 :             this_vent_cond_supply_branch.TotalComponents = this_cond_supply_branch.TotalComponents;
    1783        1047 :             if (this_vent_cond_supply_branch.TotalComponents > 0) {
    1784        1047 :                 TotCompsOnBranch = this_vent_cond_supply_branch.TotalComponents;
    1785        1047 :                 this_vent_cond_supply_branch.Comp.allocate(TotCompsOnBranch);
    1786             :             }
    1787             : 
    1788        2110 :             for (CompNum = 1; CompNum <= this_vent_cond_supply_branch.TotalComponents; ++CompNum) {
    1789             : 
    1790        1063 :                 auto &this_cond_supply_comp(this_cond_loop.LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum));
    1791        1063 :                 auto &this_vent_cond_supply_comp(this_vent_cond_supply.Branch(BranchNum).Comp(CompNum));
    1792             : 
    1793        1063 :                 this_vent_cond_supply_comp.Name = this_cond_supply_comp.Name;
    1794        1063 :                 this_vent_cond_supply_comp.TypeOf = this_cond_supply_comp.TypeOf;
    1795        1063 :                 this_vent_cond_supply_comp.NodeNameIn = this_cond_supply_comp.NodeNameIn;
    1796        1063 :                 this_vent_cond_supply_comp.NodeNameOut = this_cond_supply_comp.NodeNameOut;
    1797        1063 :                 this_vent_cond_supply_comp.NodeNumIn = this_cond_supply_comp.NodeNumIn;
    1798        1063 :                 this_vent_cond_supply_comp.NodeNumOut = this_cond_supply_comp.NodeNumOut;
    1799             : 
    1800             :             } // loop over components in branches on the loop (ventilation report data)
    1801             : 
    1802             :         } // loop over branches on the loop (ventilation report data)
    1803             : 
    1804         258 :         this_vent_cond_demand.Name = this_cond_loop.Name;
    1805         258 :         this_vent_cond_demand.NodeNumIn = this_cond_demand.NodeNumIn;
    1806         258 :         this_vent_cond_demand.NodeNameIn = this_cond_demand.NodeNameIn;
    1807         258 :         this_vent_cond_demand.NodeNumOut = this_cond_demand.NodeNumOut;
    1808         258 :         this_vent_cond_demand.NodeNameOut = this_cond_demand.NodeNameOut;
    1809         258 :         this_vent_cond_demand.TotalBranches = this_cond_demand.TotalBranches;
    1810         258 :         if (this_vent_cond_demand.TotalBranches > 0) this_vent_cond_demand.Branch.allocate(this_vent_cond_demand.TotalBranches);
    1811             : 
    1812        1518 :         for (BranchNum = 1; BranchNum <= this_vent_cond_demand.TotalBranches; ++BranchNum) {
    1813             : 
    1814        1260 :             auto &this_cond_demand_branch(this_cond_demand.Branch(BranchNum));
    1815        1260 :             auto &this_vent_cond_demand_branch(this_vent_cond_demand.Branch(BranchNum));
    1816             : 
    1817        1260 :             this_vent_cond_demand_branch.Name = this_cond_demand_branch.Name;
    1818        1260 :             this_vent_cond_demand_branch.NodeNumIn = this_cond_demand_branch.NodeNumIn;
    1819        1260 :             this_vent_cond_demand_branch.NodeNumOut = this_cond_demand_branch.NodeNumOut;
    1820        1260 :             this_vent_cond_demand_branch.TotalComponents = this_cond_demand_branch.TotalComponents;
    1821        1260 :             if (this_vent_cond_demand_branch.TotalComponents > 0) {
    1822        1260 :                 TotCompsOnBranch = this_vent_cond_demand_branch.TotalComponents;
    1823        1260 :                 this_vent_cond_demand_branch.Comp.allocate(TotCompsOnBranch);
    1824             :             }
    1825             : 
    1826        2520 :             for (CompNum = 1; CompNum <= this_vent_cond_demand_branch.TotalComponents; ++CompNum) {
    1827             : 
    1828        1260 :                 auto &this_cond_demand_comp(this_cond_demand_branch.Comp(CompNum));
    1829        1260 :                 auto &this_vent_cond_demand_comp(this_vent_cond_demand_branch.Comp(CompNum));
    1830             : 
    1831        1260 :                 this_vent_cond_demand_comp.Name = this_cond_demand_comp.Name;
    1832        1260 :                 this_vent_cond_demand_comp.TypeOf = this_cond_demand_comp.TypeOf;
    1833        1260 :                 this_vent_cond_demand_comp.NodeNameIn = this_cond_demand_comp.NodeNameIn;
    1834        1260 :                 this_vent_cond_demand_comp.NodeNameOut = this_cond_demand_comp.NodeNameOut;
    1835        1260 :                 this_vent_cond_demand_comp.NodeNumIn = this_cond_demand_comp.NodeNumIn;
    1836        1260 :                 this_vent_cond_demand_comp.NodeNumOut = this_cond_demand_comp.NodeNumOut;
    1837             : 
    1838             :             } // loop over components in branches on the loop (ventilation report data)
    1839             : 
    1840             :         } // loop over branches on the loop (ventilation report data)
    1841             : 
    1842             :     } // loop over plant supply loops (ventilation report data)
    1843             : 
    1844             :     // OneTimeInit Here
    1845        1944 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    1846        1148 :         auto &plantLoop = state.dataPlnt->PlantLoop(LoopNum);
    1847        1148 :         plantLoop.LoopHasConnectionComp = false;
    1848             : 
    1849        3444 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    1850        2296 :             auto &loopSide = plantLoop.LoopSide(LoopSideNum);
    1851             : 
    1852       15746 :             for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
    1853             : 
    1854       26984 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    1855             :                     //                    auto &this_comp_type(CompTypes(CompNum));
    1856       13534 :                     auto &this_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum));
    1857             :                     // auto type = this_comp.TypeOf;
    1858       13534 :                     this_comp.oneTimeInit(state);
    1859             :                 }
    1860             :             }
    1861             :         }
    1862             :     }
    1863         796 : }
    1864             : 
    1865         796 : void SetupReports(EnergyPlusData &state)
    1866             : {
    1867             : 
    1868             :     // SUBROUTINE INFORMATION:
    1869             :     //       AUTHOR         Rick Strand
    1870             :     //       DATE WRITTEN   July 2001
    1871             : 
    1872             :     // PURPOSE OF THIS SUBROUTINE:
    1873             :     // This subroutine initializes the plant supply side reports.
    1874             :     // It was created during the splitting of supply and demand side functions.
    1875             : 
    1876         796 :     int MaxBranches = 0; // Maximum number of branches on any plant loop (used for allocating arrays)
    1877             : 
    1878        1944 :     for (auto &loop : state.dataPlnt->PlantLoop) {
    1879        1148 :         MaxBranches = max(MaxBranches, loop.LoopSide(LoopSideLocation::Demand).TotalBranches);
    1880        1148 :         MaxBranches = max(MaxBranches, loop.LoopSide(LoopSideLocation::Supply).TotalBranches);
    1881        1148 :         loop.MaxBranch = MaxBranches;
    1882        1148 :         loop.CoolingDemand = 0.0;
    1883        1148 :         loop.HeatingDemand = 0.0;
    1884        1148 :         loop.DemandNotDispatched = 0.0;
    1885        1148 :         loop.UnmetDemand = 0.0;
    1886        1148 :         loop.InletNodeTemperature = 0.0;
    1887        1148 :         loop.OutletNodeTemperature = 0.0;
    1888        1148 :         loop.InletNodeFlowrate = 0.0;
    1889        1148 :         loop.BypassFrac = 0.0;
    1890        1148 :         loop.OutletNodeFlowrate = 0.0;
    1891             :     }
    1892             : 
    1893        1944 :     for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    1894        1148 :         auto &loop = state.dataPlnt->PlantLoop(LoopNum);
    1895        2296 :         SetupOutputVariable(state,
    1896             :                             "Plant Supply Side Cooling Demand Rate",
    1897             :                             Constant::Units::W,
    1898        1148 :                             loop.CoolingDemand,
    1899             :                             OutputProcessor::TimeStepType::System,
    1900             :                             OutputProcessor::StoreType::Average,
    1901        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1902        2296 :         SetupOutputVariable(state,
    1903             :                             "Plant Supply Side Heating Demand Rate",
    1904             :                             Constant::Units::W,
    1905        1148 :                             loop.HeatingDemand,
    1906             :                             OutputProcessor::TimeStepType::System,
    1907             :                             OutputProcessor::StoreType::Average,
    1908        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1909        2296 :         SetupOutputVariable(state,
    1910             :                             "Plant Supply Side Inlet Mass Flow Rate",
    1911             :                             Constant::Units::kg_s,
    1912        1148 :                             loop.InletNodeFlowrate,
    1913             :                             OutputProcessor::TimeStepType::System,
    1914             :                             OutputProcessor::StoreType::Average,
    1915        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1916             : 
    1917        2296 :         SetupOutputVariable(state,
    1918             :                             "Plant Supply Side Inlet Temperature",
    1919             :                             Constant::Units::C,
    1920        1148 :                             loop.InletNodeTemperature,
    1921             :                             OutputProcessor::TimeStepType::System,
    1922             :                             OutputProcessor::StoreType::Average,
    1923        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1924        2296 :         SetupOutputVariable(state,
    1925             :                             "Plant Supply Side Outlet Temperature",
    1926             :                             Constant::Units::C,
    1927        1148 :                             loop.OutletNodeTemperature,
    1928             :                             OutputProcessor::TimeStepType::System,
    1929             :                             OutputProcessor::StoreType::Average,
    1930        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1931             : 
    1932        2296 :         SetupOutputVariable(state,
    1933             :                             "Plant Supply Side Not Distributed Demand Rate",
    1934             :                             Constant::Units::W,
    1935        1148 :                             loop.DemandNotDispatched,
    1936             :                             OutputProcessor::TimeStepType::System,
    1937             :                             OutputProcessor::StoreType::Average,
    1938        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1939        2296 :         SetupOutputVariable(state,
    1940             :                             "Plant Supply Side Unmet Demand Rate",
    1941             :                             Constant::Units::W,
    1942        1148 :                             loop.UnmetDemand,
    1943             :                             OutputProcessor::TimeStepType::System,
    1944             :                             OutputProcessor::StoreType::Average,
    1945        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1946        2296 :         SetupOutputVariable(state,
    1947             :                             "Debug Plant Loop Bypass Fraction",
    1948             :                             Constant::Units::None,
    1949        1148 :                             loop.BypassFrac,
    1950             :                             OutputProcessor::TimeStepType::System,
    1951             :                             OutputProcessor::StoreType::Average,
    1952        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1953        1148 :         SetupOutputVariable(state,
    1954             :                             "Debug Plant Last Simulated Loop Side",
    1955             :                             Constant::Units::None,
    1956        1148 :                             loop.LastLoopSideSimulated,
    1957             :                             OutputProcessor::TimeStepType::System,
    1958             :                             OutputProcessor::StoreType::Average,
    1959        1148 :                             state.dataPlnt->PlantLoop(LoopNum).Name);
    1960             :     }
    1961             : 
    1962             :     // setup more variables inside plant data structure
    1963         796 :     if (state.dataGlobal->DisplayAdvancedReportVariables) {
    1964          28 :         for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    1965          12 :             SetupOutputVariable(state,
    1966             :                                 "Plant Demand Side Lumped Capacitance Temperature",
    1967             :                                 Constant::Units::C,
    1968           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TankTemp,
    1969             :                                 OutputProcessor::TimeStepType::System,
    1970             :                                 OutputProcessor::StoreType::Average,
    1971           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    1972          12 :             SetupOutputVariable(state,
    1973             :                                 "Plant Supply Side Lumped Capacitance Temperature",
    1974             :                                 Constant::Units::C,
    1975           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_TankTemp,
    1976             :                                 OutputProcessor::TimeStepType::System,
    1977             :                                 OutputProcessor::StoreType::Average,
    1978           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    1979          12 :             SetupOutputVariable(state,
    1980             :                                 "Plant Demand Side Lumped Capacitance Heat Transport Rate",
    1981             :                                 Constant::Units::W,
    1982           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_MdotCpDeltaT,
    1983             :                                 OutputProcessor::TimeStepType::System,
    1984             :                                 OutputProcessor::StoreType::Average,
    1985           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    1986          12 :             SetupOutputVariable(state,
    1987             :                                 "Plant Supply Side Lumped Capacitance Heat Transport Rate",
    1988             :                                 Constant::Units::W,
    1989           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_MdotCpDeltaT,
    1990             :                                 OutputProcessor::TimeStepType::System,
    1991             :                                 OutputProcessor::StoreType::Average,
    1992           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    1993          12 :             SetupOutputVariable(state,
    1994             :                                 "Plant Demand Side Lumped Capacitance Heat Storage Rate",
    1995             :                                 Constant::Units::W,
    1996           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_McpDTdt,
    1997             :                                 OutputProcessor::TimeStepType::System,
    1998             :                                 OutputProcessor::StoreType::Average,
    1999           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    2000          12 :             SetupOutputVariable(state,
    2001             :                                 "Plant Supply Side Lumped Capacitance Heat Storage Rate",
    2002             :                                 Constant::Units::W,
    2003           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_McpDTdt,
    2004             :                                 OutputProcessor::TimeStepType::System,
    2005             :                                 OutputProcessor::StoreType::Average,
    2006           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    2007          12 :             SetupOutputVariable(state,
    2008             :                                 "Plant Demand Side Lumped Capacitance Excessive Storage Time",
    2009             :                                 Constant::Units::hr,
    2010           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_CapExcessStorageTimeReport,
    2011             :                                 OutputProcessor::TimeStepType::System,
    2012             :                                 OutputProcessor::StoreType::Sum,
    2013           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    2014          12 :             SetupOutputVariable(state,
    2015             :                                 "Plant Supply Side Lumped Capacitance Excessive Storage Time",
    2016             :                                 Constant::Units::hr,
    2017           6 :                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTimeReport,
    2018             :                                 OutputProcessor::TimeStepType::System,
    2019             :                                 OutputProcessor::StoreType::Sum,
    2020           6 :                                 state.dataPlnt->PlantLoop(LoopNum).Name);
    2021          18 :             for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2022          53 :                 for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2023          85 :                     for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
    2024             :                          ++CompNum) {
    2025          44 :                         if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType !=
    2026             :                             OpScheme::Demand) {
    2027          68 :                             SetupOutputVariable(state,
    2028             :                                                 "Plant Component Distributed Demand Rate",
    2029             :                                                 Constant::Units::W,
    2030          34 :                                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).MyLoad,
    2031             :                                                 OutputProcessor::TimeStepType::System,
    2032             :                                                 OutputProcessor::StoreType::Average,
    2033          34 :                                                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Name);
    2034             :                         }
    2035             :                     }
    2036             :                 }
    2037             :             }
    2038             :         }
    2039             :     }
    2040             : 
    2041             :     // now traverse plant loops and set fluid type index in all nodes on the loop
    2042        1944 :     for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2043        1148 :         int FluidIndex = state.dataPlnt->PlantLoop(LoopNum).FluidIndex;
    2044        3444 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2045        2296 :             state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).NodeNumIn).FluidIndex = FluidIndex;
    2046        2296 :             state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).NodeNumOut).FluidIndex = FluidIndex;
    2047       15746 :             for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2048       26984 :                 for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
    2049             :                      ++CompNum) {
    2050       13534 :                     state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn)
    2051       13534 :                         .FluidIndex = FluidIndex;
    2052       13534 :                     state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut)
    2053       27068 :                         .FluidIndex = FluidIndex;
    2054             :                 }
    2055             :             }
    2056             :         }
    2057             :     } // plant loops
    2058             : 
    2059             :     // Plant topology report
    2060             :     // auto &orp = state.dataOutRptPredefined;
    2061             :     // MJW ToDo: Tabular report inputs haven't been read yet - move that or just skip checking if the report is requested?
    2062             :     // if (orp->reportName(orp->pdrTopology).show) {
    2063             : 
    2064             :     // constexpr std::string_view plantLoop = "PlantLoop";
    2065         796 :     int rowCounter = 1;
    2066        1944 :     for (int loopNum = 1; loopNum <= state.dataPlnt->TotNumLoops; ++loopNum) {
    2067        1148 :         fillPlantCondenserTopology(state, state.dataPlnt->PlantLoop(loopNum), rowCounter);
    2068             :     }
    2069             : 
    2070             :     // constexpr std::string_view condenserLoop = "CondenserLoop";
    2071             :     // for (int loopNum = state.dataHVACGlobal->NumPlantLoops + 1; loopNum <= (state.dataHVACGlobal->NumPlantLoops +
    2072             :     // state.dataHVACGlobal->NumCondLoops);
    2073             :     //      ++loopNum) {
    2074             :     //     fillPlantCondenserTopology(state, condenserLoop, state.dataPlnt->PlantLoop(loopNum));
    2075             :     // }
    2076             :     // }
    2077         796 : }
    2078             : 
    2079        1148 : void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData &thisLoop, int &rowCounter)
    2080             : {
    2081        1148 :     auto &orp = state.dataOutRptPredefined;
    2082             :     // int repOffset = 0;
    2083             :     // if (thisLoop.TypeOfLoop == DataPlant::LoopType::Condenser) {
    2084             :     //     // Shift column pointers for condenser loop subtable
    2085             :     //     repOffset = orp->pdchTopCondCompType - orp->pdchTopPlantCompType;
    2086             :     // }
    2087        1148 :     std::string_view const loopType = DataPlant::loopTypeNames[static_cast<int>(thisLoop.TypeOfLoop)];
    2088        3444 :     for (DataPlant::LoopSideLocation LoopSideNum : {DataPlant::LoopSideLocation::Supply, DataPlant::LoopSideLocation::Demand}) {
    2089        2296 :         auto &thisLoopSide = thisLoop.LoopSide(LoopSideNum);
    2090        2296 :         std::string_view const loopSide = DataPlant::DemandSupplyNames[static_cast<int>(LoopSideNum)];
    2091             : 
    2092             :         // s->pdstTopPlantLoop2 = newPreDefSubTable(state, s->pdrTopology, "Plant Loop Component Arrangement");
    2093             :         // s->pdchTopPlantLoopType2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Loop Type");
    2094             :         // s->pdchTopPlantLoopName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Loop Name");
    2095             :         // s->pdchTopPlantSide2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Side");
    2096             :         // s->pdchTopPlantSplitName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Splitter Name");
    2097             :         // s->pdchTopPlantBranchName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Branch Name");
    2098             :         // s->pdchTopPlantCompType2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Type");
    2099             :         // s->pdchTopPlantCompName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Name");
    2100             :         // s->pdchTopPlantMixName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Mixer Name");
    2101             : 
    2102        2296 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
    2103        2296 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), thisLoop.Name);
    2104        2296 :         OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), loopSide);
    2105        2296 :         ++rowCounter;
    2106             : 
    2107             :         // Report for first branch
    2108        2296 :         auto &thisBranch = thisLoopSide.Branch(1);
    2109        2296 :         constexpr std::string_view branch = "Branch";
    2110             : 
    2111        4625 :         for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) {
    2112        2329 :             auto &thisComp = thisBranch.Comp(compNum);
    2113        2329 :             fillPlantToplogyComponentRow2(state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter);
    2114             :         }
    2115             : 
    2116        2296 :         if (thisLoopSide.TotalBranches >= 3) {
    2117             :             // parallel branches
    2118       11154 :             for (int branchNum = 2; branchNum <= thisLoopSide.TotalBranches - 1; ++branchNum) {
    2119        8891 :                 auto &thisBranch = thisLoopSide.Branch(branchNum);
    2120             :                 // splitter
    2121        8891 :                 if (thisLoopSide.Splitter.Exists) {
    2122        8891 :                     fillPlantToplogySplitterRow2(state, loopType, thisLoop.Name, loopSide, thisLoopSide.Splitter.Name, rowCounter);
    2123             :                 }
    2124             : 
    2125       17828 :                 for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) {
    2126        8937 :                     auto &thisComp = thisBranch.Comp(compNum);
    2127             :                     // fillPlantToplogyRow(state, thisComp.Name, thisComp.TypeOf, loopSide, branch, thisBranch.Name, thisLoop.FluidName, repOffset);
    2128        8937 :                     fillPlantToplogyComponentRow2(
    2129             :                         state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter);
    2130             :                 }
    2131             :                 // mixer
    2132        8891 :                 if (thisLoopSide.Mixer.Exists) {
    2133        8891 :                     rowCounter -= 1;
    2134        8891 :                     constexpr std::string_view mixer = "Mixer";
    2135        8891 :                     fillPlantToplogyMixerRow2(state, loopType, thisLoop.Name, loopSide, thisLoopSide.Mixer.Name, rowCounter);
    2136        8891 :                     rowCounter += 1;
    2137             :                 }
    2138             :             }
    2139             : 
    2140             :             // Outlet Branch
    2141        2263 :             auto &thisBranch = thisLoopSide.Branch(thisLoopSide.TotalBranches);
    2142        4531 :             for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) {
    2143        2268 :                 auto &thisComp = thisBranch.Comp(compNum);
    2144        2268 :                 fillPlantToplogyComponentRow2(state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter);
    2145             :             }
    2146             :         }
    2147             :     }
    2148        1148 : }
    2149             : 
    2150        8891 : void fillPlantToplogySplitterRow2(EnergyPlusData &state,
    2151             :                                   const std::string_view &loopType,
    2152             :                                   const std::string_view &loopName,
    2153             :                                   const std::string_view &side,
    2154             :                                   const std::string_view &splitterName,
    2155             :                                   int &rowCounter)
    2156             : {
    2157        8891 :     auto &orp = state.dataOutRptPredefined;
    2158             :     // s->pdchTopPlantSplitName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Splitter Name");
    2159        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
    2160        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), loopName);
    2161        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), side);
    2162        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSplitName2, format("{}", rowCounter), splitterName);
    2163        8891 : }
    2164        8891 : void fillPlantToplogyMixerRow2(EnergyPlusData &state,
    2165             :                                const std::string_view &loopType,
    2166             :                                const std::string_view &loopName,
    2167             :                                const std::string_view &side,
    2168             :                                const std::string_view &mixerName,
    2169             :                                int &rowCounter)
    2170             : {
    2171        8891 :     auto &orp = state.dataOutRptPredefined;
    2172             :     // s->pdchTopPlantMixName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Mixer Name");
    2173        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
    2174        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), loopName);
    2175        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), side);
    2176        8891 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantMixName2, format("{}", rowCounter), mixerName);
    2177        8891 : }
    2178       13534 : void fillPlantToplogyComponentRow2(EnergyPlusData &state,
    2179             :                                    const std::string_view &loopType,
    2180             :                                    const std::string_view &loopName,
    2181             :                                    const std::string_view &side,
    2182             :                                    const std::string_view &branchName,
    2183             :                                    const std::string_view &compType,
    2184             :                                    const std::string_view &compName,
    2185             :                                    int &rowCounter)
    2186             : {
    2187       13534 :     auto &orp = state.dataOutRptPredefined;
    2188             :     // s->pdchTopPlantBranchName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Branch Name");
    2189             :     // s->pdchTopPlantCompType2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Type");
    2190             :     // s->pdchTopPlantCompName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Name");
    2191       13534 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
    2192       13534 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), loopName);
    2193       13534 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), side);
    2194       13534 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantBranchName2, format("{}", rowCounter), branchName);
    2195       13534 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantCompType2, format("{}", rowCounter), compType);
    2196       13534 :     OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantCompName2, format("{}", rowCounter), compName);
    2197       13534 :     ++rowCounter;
    2198       13534 : }
    2199             : 
    2200     2944078 : void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // true if first iteration of the simulation
    2201             : {
    2202             : 
    2203             :     // SUBROUTINE INFORMATION:
    2204             :     //       AUTHOR         Sankaranarayanan K P
    2205             :     //       DATE WRITTEN   May 2005
    2206             :     //       MODIFIED       Dan Fisher Aug. 2008
    2207             :     //                      Brent Griffith May 2009 EMS setpoint check
    2208             :     //       RE-ENGINEERED  na
    2209             : 
    2210             :     // PURPOSE OF THIS SUBROUTINE:
    2211             :     // This subroutine initializes the
    2212             :     // Plant loop nodes one time at the beginning of the simulation.
    2213             :     // It also reinitializes loop temperatures if loop setpoint
    2214             :     // temperature changes. Branch levels for all branches are also set.
    2215             : 
    2216             :     // Using/Aliasing
    2217             :     using ScheduleManager::GetCurrentScheduleValue;
    2218             :     using namespace DataSizing;
    2219             :     using EMSManager::CheckIfNodeSetPointManagedByEMS;
    2220             : 
    2221             :     using PlantUtilities::SetAllFlowLocks;
    2222             : 
    2223             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2224             :     int LoopNum; // plant loop counter
    2225             :     DataPlant::LoopSideLocation LoopSideNum;
    2226             :     int BranchNum; // branch loop counter
    2227             :     int CompNum;   // plant side component counter
    2228             :     int SensedNode;
    2229             : 
    2230     2944078 :     bool ErrorsFound(false);
    2231             :     bool FinishSizingFlag;
    2232             : 
    2233             :     int HalfLoopNum;
    2234             :     int passNum;
    2235             : 
    2236     2944078 :     if (!allocated(state.dataPlantMgr->PlantLoopSetPointInitFlag)) {
    2237         458 :         state.dataPlantMgr->PlantLoopSetPointInitFlag.allocate(state.dataPlnt->TotNumLoops);
    2238             :     }
    2239             : 
    2240             :     // Initialize the setpoints  for Load range based schemes only as determined by the init flag
    2241             :     // The input already requires a loop setpoint.  The plantloop object requires
    2242             :     // specification of a loop node and corresponding setpoint manager.  Using a 'component setpoint'
    2243             :     // control scheme does NOT eliminate the requirement for a plant loop setpoint.  So there is
    2244             :     // already the possibility that a component setpoint controlled object on the loop outlet
    2245             :     // branch would have the same setpoint node as the loop.  I don't think setpoint manager traps
    2246             :     // for this user input error, but it might.  Since both loop and component setpoints already
    2247             :     // peacefully coexist on the loop, we can allow the user to intentionally specify and use both.
    2248             :     // The only change required is to NOT smear the loop setpoint over all the loop nodes.  Just
    2249             :     // read it from the setpoint node and use it.  In the short term it will remain up to the user
    2250             :     // to specify the location of the loop setpoint control node and avoid conflicts with component
    2251             :     // setpoint nodes.  Operationally, we will ignore the user specified placement of the loop setpoint
    2252             :     // node and assume that it is physically located at each half loop outlet for purposes of calculating loop
    2253             :     // demand.  Long term, I recommend that we:
    2254             :     //     1. specify the setpointmanager:plant object name (not the node name) in the plantloop/condloop objects
    2255             :     //     2. write a new setpoint manager (setpointmanager:plant) that is more suitable for plant use and
    2256             :     //        accomodates AIR and GROUND setpoints...with offsets.
    2257             : 
    2258             :     //*****************************************************************
    2259             :     // ONE TIME LOOP NODE SETPOINT CHECK
    2260             :     //*****************************************************************
    2261     2944078 :     if (state.dataPlantMgr->MySetPointCheckFlag && state.dataHVACGlobal->DoSetPointTest) {
    2262             : 
    2263             :         // check for missing setpoints
    2264        1605 :         for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2265             : 
    2266        1147 :             SensedNode = state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum;
    2267        1147 :             if (SensedNode > 0) {
    2268        1147 :                 if (state.dataLoopNodes->Node(SensedNode).TempSetPoint == SensedNodeFlagValue) {
    2269           8 :                     if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2270           0 :                         ShowSevereError(state,
    2271           0 :                                         "PlantManager: No Setpoint Manager Defined for Node=" + state.dataLoopNodes->NodeID(SensedNode) +
    2272           0 :                                             " in PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
    2273           0 :                         ShowContinueError(state, "Add Temperature Setpoint Manager with Control Variable = \"Temperature\" for this PlantLoop.");
    2274           0 :                         state.dataHVACGlobal->SetPointErrorFlag = true;
    2275             :                     } else {
    2276             :                         // need call to EMS to check node
    2277           8 :                         CheckIfNodeSetPointManagedByEMS(state, SensedNode, HVAC::CtrlVarType::Temp, state.dataHVACGlobal->SetPointErrorFlag);
    2278           8 :                         if (state.dataHVACGlobal->SetPointErrorFlag) {
    2279           0 :                             ShowSevereError(state,
    2280           0 :                                             "PlantManager: No Setpoint Manager Defined for Node=" + state.dataLoopNodes->NodeID(SensedNode) +
    2281           0 :                                                 " in PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
    2282           0 :                             ShowContinueError(state, "Add Temperature Setpoint Manager with Control Variable = \"Temperature\" for this PlantLoop.");
    2283           0 :                             ShowContinueError(state, "Or add EMS Actuator to provide temperature setpoint at this node");
    2284             :                         }
    2285             :                     }
    2286             :                 }
    2287             :             }
    2288             :         }
    2289         458 :         state.dataPlantMgr->MySetPointCheckFlag = false;
    2290             :     }
    2291             :     //*****************************************************************
    2292             :     // END ONE TIME LOOP NODE SETPOINT CHECK
    2293             : 
    2294             :     //*****************************************************************
    2295             :     // First Pass PUMP AND SIZING INIT
    2296             :     //*****************************************************************
    2297     2944078 :     if (!state.dataPlnt->PlantFirstSizeCompleted) {
    2298             : 
    2299         458 :         SetAllFlowLocks(state, DataPlant::FlowLock::Unlocked);
    2300         458 :         FinishSizingFlag = false;
    2301         458 :         state.dataPlnt->PlantFirstSizesOkayToFinalize = false; // set global flag for when it ready to store final sizes
    2302         458 :         state.dataPlnt->PlantFirstSizesOkayToReport = false;
    2303         458 :         state.dataPlnt->PlantFinalSizesOkayToReport = false;
    2304         458 :         state.dataPlantMgr->GetCompSizFac = true;
    2305        2290 :         for (passNum = 1; passNum <= 4; ++passNum) { // begin while loop to iterate over the next calls sequentially
    2306             : 
    2307             :             // Step 2, call component models it  using PlantCallingOrderInfo for sizing
    2308       11008 :             for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    2309        9176 :                 LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
    2310        9176 :                 LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
    2311        9176 :                 state.dataSize->CurLoopNum = LoopNum;
    2312             : 
    2313       62944 :                 for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2314      107872 :                     for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
    2315             :                          ++CompNum) {
    2316       54104 :                         state.dataPlnt->PlantLoop(LoopNum)
    2317       54104 :                             .LoopSide(LoopSideNum)
    2318       54104 :                             .Branch(BranchNum)
    2319       54104 :                             .Comp(CompNum)
    2320       54104 :                             .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
    2321       54104 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
    2322             :                     } //-CompNum
    2323             :                 }     //-BranchNum
    2324             :             }
    2325             : 
    2326             :             // step 3, revise calling order
    2327             :             // have now called each plant component model at least once with InitLoopEquip = .TRUE.
    2328             :             //  this means the calls to InterConnectTwoPlantLoopSides have now been made, so rework calling order
    2329        1832 :             RevisePlantCallingOrder(state);
    2330             : 
    2331             :             // Step 4: Simulate plant loop components so their design flows are included
    2332             : 
    2333       11008 :             for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    2334             : 
    2335        9176 :                 LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
    2336        9176 :                 LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
    2337        9176 :                 state.dataSize->CurLoopNum = LoopNum;
    2338        9176 :                 if (LoopSideNum == LoopSideLocation::Supply) {
    2339        4588 :                     SizePlantLoop(state, LoopNum, FinishSizingFlag);
    2340             :                 }
    2341             :             }
    2342        1832 :             state.dataPlantMgr->GetCompSizFac = false;
    2343             :         } // iterative passes thru sizing related routines.  end while?
    2344             : 
    2345             :         // Step 5 now one more time for the final
    2346        2752 :         for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    2347        2294 :             if (state.dataGlobal->DoHVACSizingSimulation) {
    2348          88 :                 state.dataPlnt->PlantFirstSizesOkayToFinalize = true;
    2349          88 :                 FinishSizingFlag = true;
    2350          88 :                 state.dataPlnt->PlantFirstSizesOkayToReport = true;
    2351          88 :                 state.dataPlnt->PlantFinalSizesOkayToReport = false;
    2352             :             } else {
    2353        2206 :                 state.dataPlnt->PlantFirstSizesOkayToFinalize = true;
    2354        2206 :                 FinishSizingFlag = true;
    2355        2206 :                 state.dataPlnt->PlantFirstSizesOkayToReport = false;
    2356        2206 :                 state.dataPlnt->PlantFinalSizesOkayToReport = true;
    2357             :             }
    2358        2294 :             LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
    2359        2294 :             LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
    2360        2294 :             state.dataSize->CurLoopNum = LoopNum;
    2361        2294 :             if (LoopSideNum == LoopSideLocation::Supply) {
    2362        1147 :                 SizePlantLoop(state, LoopNum, FinishSizingFlag);
    2363             :             }
    2364             :             // pumps are special so call them directly
    2365        2294 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).SimulateAllLoopSidePumps(state);
    2366       15736 :             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2367       26968 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2368       13526 :                     state.dataPlnt->PlantLoop(LoopNum)
    2369       13526 :                         .LoopSide(LoopSideNum)
    2370       13526 :                         .Branch(BranchNum)
    2371       13526 :                         .Comp(CompNum)
    2372       13526 :                         .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
    2373       13526 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
    2374             :                 } //-CompNum
    2375             :             }     //-BranchNum
    2376             :             //                if ( PlantLoop( LoopNum ).PlantSizNum > 0 ) PlantSizData( PlantLoop( LoopNum ).PlantSizNum
    2377             :             //).VolFlowSizingDone = true;
    2378             :         }
    2379             : 
    2380         458 :         state.dataPlnt->PlantFirstSizeCompleted = true;
    2381         458 :         state.dataPlnt->PlantFirstSizesOkayToReport = false;
    2382             :     }
    2383             :     //*****************************************************************
    2384             :     // END First Pass SIZING INIT
    2385             :     //*****************************************************************
    2386             :     //*****************************************************************
    2387             :     // BEGIN Resizing Pass for HVAC Sizing Simultion Adjustments
    2388             :     //*****************************************************************
    2389     2944078 :     if (state.dataGlobal->RedoSizesHVACSimulation && !state.dataPlnt->PlantReSizingCompleted) {
    2390             : 
    2391             :         // cycle through plant equipment calling with InitLoopEquip true
    2392          12 :         state.dataPlantMgr->GetCompSizFac = false;
    2393         100 :         for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    2394          88 :             LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
    2395          88 :             LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
    2396          88 :             state.dataSize->CurLoopNum = LoopNum;
    2397             : 
    2398         710 :             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2399        1247 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2400         625 :                     state.dataPlnt->PlantLoop(LoopNum)
    2401         625 :                         .LoopSide(LoopSideNum)
    2402         625 :                         .Branch(BranchNum)
    2403         625 :                         .Comp(CompNum)
    2404         625 :                         .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
    2405             : 
    2406         625 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
    2407             :                 } //-CompNum
    2408             :             }     //-BranchNum
    2409             :         }
    2410             : 
    2411             :         // reset loop level
    2412          12 :         state.dataPlnt->PlantFinalSizesOkayToReport = true;
    2413          56 :         for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2414          44 :             ResizePlantLoopLevelSizes(state, LoopNum);
    2415             :         }
    2416             : 
    2417             :         // now call everything again to reporting turned on
    2418         100 :         for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    2419          88 :             LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
    2420          88 :             LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
    2421          88 :             state.dataSize->CurLoopNum = LoopNum;
    2422             : 
    2423         710 :             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2424        1247 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2425         625 :                     state.dataPlnt->PlantLoop(LoopNum)
    2426         625 :                         .LoopSide(LoopSideNum)
    2427         625 :                         .Branch(BranchNum)
    2428         625 :                         .Comp(CompNum)
    2429         625 :                         .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
    2430         625 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
    2431             :                 } //-CompNum
    2432             :             }     //-BranchNum
    2433             :             // pumps are special so call them directly
    2434          88 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).SimulateAllLoopSidePumps(state);
    2435             :         }
    2436             : 
    2437          12 :         state.dataPlnt->PlantReSizingCompleted = true;
    2438          12 :         state.dataPlnt->PlantFinalSizesOkayToReport = false;
    2439             :     }
    2440             :     //*****************************************************************
    2441             :     // END Resizing Pass for HVAC Sizing Simulation Adjustments
    2442             :     //*****************************************************************
    2443             :     //*****************************************************************
    2444             :     // BEGIN ONE TIME ENVIRONMENT INITS
    2445             :     //*****************************************************************
    2446     2944078 :     if (state.dataPlantMgr->SupplyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) {
    2447             : 
    2448        9777 :         for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2449             :             // check if setpoints being placed on node properly
    2450        7049 :             if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) {
    2451          91 :                 if (state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi == SensedNodeFlagValue) {
    2452           0 :                     if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2453           0 :                         ShowSevereError(state, "Plant Loop: missing high temperature setpoint for dual setpoint deadband demand scheme");
    2454           0 :                         ShowContinueError(state,
    2455           0 :                                           "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
    2456           0 :                         ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
    2457           0 :                         state.dataHVACGlobal->SetPointErrorFlag = true;
    2458             :                     } else {
    2459           0 :                         CheckIfNodeSetPointManagedByEMS(state,
    2460           0 :                                                         state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum,
    2461             :                                                         HVAC::CtrlVarType::Temp,
    2462           0 :                                                         state.dataHVACGlobal->SetPointErrorFlag);
    2463           0 :                         if (state.dataHVACGlobal->SetPointErrorFlag) {
    2464           0 :                             ShowSevereError(state, "Plant Loop: missing high temperature setpoint for dual setpoint deadband demand scheme");
    2465           0 :                             ShowContinueError(
    2466           0 :                                 state, "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
    2467           0 :                             ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
    2468           0 :                             ShowContinueError(state, "Or add EMS Actuator for Temperature Maximum Setpoint");
    2469             : 
    2470             :                         } // SetPointErrorFlag
    2471             :                     }     // Not EMS
    2472             :                 }         // Node TSPhi = Sensed
    2473          91 :                 if (state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointLo == SensedNodeFlagValue) {
    2474           0 :                     if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
    2475           0 :                         ShowSevereError(state, "Plant Loop: missing low temperature setpoint for dual setpoint deadband demand scheme");
    2476           0 :                         ShowContinueError(state,
    2477           0 :                                           "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
    2478           0 :                         ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
    2479           0 :                         state.dataHVACGlobal->SetPointErrorFlag = true;
    2480             :                     } else {
    2481           0 :                         CheckIfNodeSetPointManagedByEMS(state,
    2482           0 :                                                         state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum,
    2483             :                                                         HVAC::CtrlVarType::Temp,
    2484           0 :                                                         state.dataHVACGlobal->SetPointErrorFlag);
    2485           0 :                         if (state.dataHVACGlobal->SetPointErrorFlag) {
    2486           0 :                             ShowSevereError(state, "Plant Loop: missing low temperature setpoint for dual setpoint deadband demand scheme");
    2487           0 :                             ShowContinueError(
    2488           0 :                                 state, "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
    2489           0 :                             ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
    2490           0 :                             ShowContinueError(state, "Or add EMS Actuator for Temperature Minimum Setpoint");
    2491             : 
    2492             :                         } // SetPointErrorFlag
    2493             :                     }     // NOT EMS
    2494             :                 }         // Node TSPtLo = Sensed...
    2495             :             }             // LoopDemandScheme = DualSPDB
    2496             :         }                 // PLANT LOOP
    2497             : 
    2498             :         // Any per-environment load distribution init should be OK here
    2499             :         // Just clear away any trailing MyLoad for now...
    2500             :         // This could likely be moved into InitLoadDistribution also...
    2501        9777 :         for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2502       21147 :             for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2503       99062 :                 for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2504      170455 :                     for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
    2505             :                          ++CompNum) {
    2506       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).MyLoad = 0.0;
    2507       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).FreeCoolCntrlShutDown = false;
    2508       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Available = false;
    2509             :                     }
    2510             :                 }
    2511             :             }
    2512             :         }
    2513             : 
    2514        2728 :         state.dataPlantMgr->SupplyEnvrnFlag = false;
    2515             :         //!*****************************************************************
    2516             :         // !END OF ONE TIME ENVIRONMENT INITS
    2517             :         //!*****************************************************************
    2518             :     } //
    2519     2944078 :     if (!state.dataGlobal->BeginEnvrnFlag) state.dataPlantMgr->SupplyEnvrnFlag = true;
    2520             : 
    2521     2944078 :     if (ErrorsFound) ShowFatalError(state, "Preceding errors caused termination");
    2522     2944078 : }
    2523             : 
    2524     2838329 : void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state)
    2525             : {
    2526             : 
    2527             :     // SUBROUTINE INFORMATION:
    2528             :     //       AUTHOR         Brent Griffith
    2529             :     //       DATE WRITTEN   Sept 2010
    2530             :     //       MODIFIED       na
    2531             :     //       RE-ENGINEERED  na
    2532             : 
    2533             :     // PURPOSE OF THIS SUBROUTINE:
    2534             :     // initialize node mass flow requests
    2535             : 
    2536             :     // METHODOLOGY EMPLOYED:
    2537             :     // called from SimHVAC to reset mass flow rate requests
    2538             :     // this contains all the initializations
    2539             : 
    2540             :     // Using/Aliasing
    2541             :     using ScheduleManager::GetCurrentScheduleValue;
    2542             : 
    2543             :     // SUBROUTINE PARAMETER DEFINITIONS:
    2544     2838329 :     Real64 constexpr StartQuality(1.0);
    2545     2838329 :     Real64 constexpr StartHumRat(0.0);
    2546             :     static constexpr std::string_view RoutineNameAlt("InitializeLoops");
    2547             :     static constexpr std::string_view RoutineName("PlantManager:InitializeLoop");
    2548             : 
    2549             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2550             :     int LoopNum;                      // plant loop counter
    2551             :     Real64 LoopMaxMassFlowRate;       // maximum allowable loop mass flow rate
    2552             :     Real64 LoopSetPointTemp;          // the loop control or setpoint temperature
    2553             :     Real64 LoopMaxTemp;               // maximum allowable loop temperature
    2554             :     Real64 LoopMinTemp;               // minimum allowable loop temperature
    2555             :     Real64 LoopSetPointTempLo;        // the loop control or setpoint temperature
    2556             :     Real64 LoopSetPointTempHi;        // the loop control or setpoint temperature
    2557             :     Real64 SecondaryLoopSetPointTemp; // loop setpoint temperature for common pipes with different secondary setpt
    2558             :     int BranchNum;                    // branch loop counter
    2559             :     int OpNum;                        // operation scheme counter
    2560             :     int CompNum;                      // plant side component counter
    2561             :     int BranchInlet;                  // branch inlet node number
    2562             :     int ComponentInlet;               // component inlet node number
    2563             :     int ComponentOutlet;              // component outlet node number
    2564             : 
    2565             :     Real64 LoopMinMassFlowRate; // minimum allowable loop mass flow rate
    2566             :     Real64 SteamDensity;
    2567             :     Real64 SteamTemp;
    2568             :     Real64 StartEnthalpy;
    2569             :     Real64 Cp;
    2570             :     Real64 rho;
    2571             :     Real64 LoopSetPointTemperatureHi;
    2572             :     Real64 LoopSetPointTemperatureLo;
    2573             : 
    2574             :     //*****************************************************************
    2575             :     // BEGIN ENVIRONMENT INITS
    2576             :     //*****************************************************************
    2577             : 
    2578     2838329 :     if (state.dataPlantMgr->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) {
    2579             : 
    2580       11692 :         for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2581       21147 :             for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2582       14098 :                 switch (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme) {
    2583       13916 :                 case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
    2584       13916 :                     LoopSetPointTemp = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPoint;
    2585       13916 :                 } break;
    2586         182 :                 case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
    2587             :                     // Get the range of setpoints
    2588         182 :                     LoopSetPointTemperatureHi = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi;
    2589         182 :                     LoopSetPointTemperatureLo = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointLo;
    2590         182 :                     LoopSetPointTemp = (LoopSetPointTemperatureLo + LoopSetPointTemperatureHi) / 2.0;
    2591         182 :                 } break;
    2592           0 :                 default:
    2593           0 :                     break;
    2594             :                 }
    2595             : 
    2596       14218 :                 if ((state.dataPlnt->PlantLoop(LoopNum).CommonPipeType == DataPlant::CommonPipeType::TwoWay) &&
    2597       14218 :                     (LoopSideNum == LoopSideLocation::Demand) &&
    2598          60 :                     (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).InletNodeSetPt)) { // get a second setpoint for
    2599             :                                                                                                               // secondaryLoop
    2600             :                     // if the plant loop is two common pipe configured for temperature control on secondary side inlet, then
    2601             :                     // we want to initialize the demand side of the loop using that setpoint
    2602          49 :                     LoopSetPointTemp =
    2603          49 :                         state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPoint;
    2604             :                 }
    2605             : 
    2606             :                 // Check the Loop Setpoint and make sure it is bounded by the Loop Max and Min
    2607       14098 :                 LoopMaxTemp = state.dataPlnt->PlantLoop(LoopNum).MaxTemp;
    2608       14098 :                 LoopMinTemp = state.dataPlnt->PlantLoop(LoopNum).MinTemp;
    2609             : 
    2610             :                 // trap for -999 and set to average of limits if so
    2611       14098 :                 if (LoopSetPointTemp == SensedNodeFlagValue) {
    2612          64 :                     LoopSetPointTemp = (LoopMinTemp + LoopMaxTemp) / 2.0;
    2613             :                 }
    2614             :                 // Check it against the loop temperature limits
    2615       14098 :                 LoopSetPointTemp = min(LoopMaxTemp, LoopSetPointTemp);
    2616       14098 :                 LoopSetPointTemp = max(LoopMinTemp, LoopSetPointTemp);
    2617             : 
    2618             :                 // Initialize the capacitance model at the tank interface, and other loop side values
    2619       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TempInterfaceTankOutlet = LoopSetPointTemp;
    2620       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).LastTempInterfaceTankOutlet = LoopSetPointTemp;
    2621       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).LoopSideInlet_TankTemp = LoopSetPointTemp;
    2622       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalPumpHeat = 0.0;
    2623       14098 :                 if (allocated(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Pumps))
    2624       14303 :                     for (auto &e : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Pumps)
    2625        7176 :                         e.PumpHeatToFluid = 0.0;
    2626       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).FlowRequest = 0.0;
    2627       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TimeElapsed = 0.0;
    2628       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).FlowLock = DataPlant::FlowLock::Unlocked;
    2629       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).InletNode.TemperatureHistory = 0.0;
    2630       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).InletNode.MassFlowRateHistory = 0.0;
    2631       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).OutletNode.TemperatureHistory = 0.0;
    2632       14098 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).OutletNode.MassFlowRateHistory = 0.0;
    2633             : 
    2634       14098 :                 if (state.dataPlnt->PlantLoop(LoopNum).FluidType != DataLoopNode::NodeFluidType::Steam) {
    2635       13992 :                     Cp = FluidProperties::GetSpecificHeatGlycol(state,
    2636       13992 :                                                                 state.dataPlnt->PlantLoop(LoopNum).FluidName,
    2637             :                                                                 LoopSetPointTemp,
    2638       13992 :                                                                 state.dataPlnt->PlantLoop(LoopNum).FluidIndex,
    2639             :                                                                 RoutineNameAlt);
    2640       13992 :                     StartEnthalpy = Cp * LoopSetPointTemp;
    2641             :                 }
    2642             :                 // Use Min/Max flow rates to initialize loop
    2643       14098 :                 if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) {
    2644       13992 :                     rho = FluidProperties::GetDensityGlycol(state,
    2645       13992 :                                                             state.dataPlnt->PlantLoop(LoopNum).FluidName,
    2646             :                                                             LoopSetPointTemp,
    2647       13992 :                                                             state.dataPlnt->PlantLoop(LoopNum).FluidIndex,
    2648             :                                                             RoutineNameAlt);
    2649             : 
    2650       13992 :                     LoopMaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * rho;
    2651       13992 :                     LoopMinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * rho;
    2652             :                 }
    2653             :                 // use saturated liquid of steam at the loop setpoint temp as the starting enthalpy for a water loop
    2654       14098 :                 if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) {
    2655         106 :                     SteamTemp = 100.0;
    2656         212 :                     SteamDensity = FluidProperties::GetSatDensityRefrig(
    2657         106 :                         state, fluidNameSteam, SteamTemp, 1.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);
    2658         106 :                     LoopMaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * SteamDensity;
    2659         212 :                     StartEnthalpy = FluidProperties::GetSatEnthalpyRefrig(
    2660         106 :                         state, fluidNameSteam, LoopSetPointTemp, 0.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);
    2661         106 :                     LoopMinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * SteamDensity;
    2662             :                 }
    2663             : 
    2664       14098 :                 LoopMaxMassFlowRate = max(0.0, LoopMaxMassFlowRate);
    2665       14098 :                 LoopMinMassFlowRate = max(0.0, LoopMinMassFlowRate);
    2666             : 
    2667             :                 // Initial all loop nodes by initializing all component inlet and outlet nodes
    2668       99062 :                 for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2669      170455 :                     for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
    2670             :                          ++CompNum) {
    2671       85491 :                         ComponentInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn;
    2672       85491 :                         ComponentOutlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut;
    2673       85491 :                         BranchInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumIn;
    2674             : 
    2675       85491 :                         state.dataLoopNodes->Node(ComponentInlet).Temp = LoopSetPointTemp;
    2676       85491 :                         state.dataLoopNodes->Node(ComponentInlet).TempMin = LoopMinTemp;
    2677       85491 :                         state.dataLoopNodes->Node(ComponentInlet).TempMax = LoopMaxTemp;
    2678       85491 :                         state.dataLoopNodes->Node(ComponentInlet).TempLastTimestep = LoopSetPointTemp;
    2679             : 
    2680       85491 :                         state.dataLoopNodes->Node(ComponentInlet).MassFlowRate = 0.0;
    2681       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).MyLoad = 0.0;
    2682       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Available = false;
    2683       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).FreeCoolCntrlShutDown = false;
    2684       85491 :                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).RequestedMassFlow = 0.0;
    2685             : 
    2686       85491 :                         if (state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin > 0.0) {
    2687           0 :                             state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMinAvail =
    2688           0 :                                 state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin;
    2689             :                         } else {
    2690       85491 :                             state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin = LoopMinMassFlowRate;
    2691       85491 :                             state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMinAvail = LoopMinMassFlowRate;
    2692             :                         }
    2693             : 
    2694       85491 :                         if (state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax > 0.0) {
    2695       39214 :                             state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMaxAvail =
    2696       39214 :                                 state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax;
    2697             :                         } else {
    2698       46277 :                             state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax = LoopMaxMassFlowRate;
    2699       46277 :                             state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMaxAvail = LoopMaxMassFlowRate;
    2700             :                         }
    2701             : 
    2702       85491 :                         state.dataLoopNodes->Node(ComponentInlet).MassFlowRateRequest = 0.0;
    2703       85491 :                         state.dataLoopNodes->Node(ComponentInlet).Quality = StartQuality;
    2704       85491 :                         state.dataLoopNodes->Node(ComponentInlet).Press = state.dataEnvrn->StdBaroPress;
    2705       85491 :                         state.dataLoopNodes->Node(ComponentInlet).Enthalpy = StartEnthalpy;
    2706       85491 :                         state.dataLoopNodes->Node(ComponentInlet).HumRat = StartHumRat;
    2707             : 
    2708       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).FluidType = state.dataLoopNodes->Node(BranchInlet).FluidType;
    2709       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).Temp = state.dataLoopNodes->Node(BranchInlet).Temp;
    2710       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).TempMin = state.dataLoopNodes->Node(BranchInlet).TempMin;
    2711       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).TempMax = state.dataLoopNodes->Node(BranchInlet).TempMax;
    2712       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).TempLastTimestep = state.dataLoopNodes->Node(BranchInlet).TempLastTimestep;
    2713       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).MassFlowRate = state.dataLoopNodes->Node(BranchInlet).MassFlowRate;
    2714       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMin = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMin;
    2715       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMax = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMax;
    2716       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMinAvail = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMinAvail;
    2717       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMaxAvail = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMaxAvail;
    2718       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateRequest = 0.0;
    2719       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).Quality = StartQuality;
    2720       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).Press = state.dataEnvrn->StdBaroPress;
    2721       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).Enthalpy = StartEnthalpy;
    2722       85491 :                         state.dataLoopNodes->Node(ComponentOutlet).HumRat = StartHumRat;
    2723             :                     } // COMPONENT LOOP
    2724             :                 }     // BRANCH LOOP
    2725             :             }         // LOOPSIDE
    2726             :         }             // PLANT LOOP
    2727       11692 :         for (auto &loop : state.dataPlnt->PlantLoop) {
    2728        7049 :             loop.CoolingDemand = 0.0;
    2729        7049 :             loop.HeatingDemand = 0.0;
    2730        7049 :             loop.DemandNotDispatched = 0.0;
    2731        7049 :             loop.UnmetDemand = 0.0;
    2732        7049 :             loop.LastLoopSideSimulated = static_cast<int>(DataPlant::LoopSideLocation::Invalid);
    2733        7049 :             loop.InletNodeFlowrate = 0.0;
    2734        7049 :             loop.InletNodeTemperature = 0.0;
    2735        7049 :             loop.OutletNodeFlowrate = 0.0;
    2736        7049 :             loop.OutletNodeTemperature = 0.0;
    2737             :         }
    2738             : 
    2739        4643 :         state.dataPlantMgr->MyEnvrnFlag = false;
    2740             :         //*****************************************************************
    2741             :         // END OF ENVIRONMENT INITS
    2742             :         //*****************************************************************
    2743             :     }
    2744             : 
    2745     2838329 :     if (!state.dataGlobal->BeginEnvrnFlag) state.dataPlantMgr->MyEnvrnFlag = true;
    2746             : 
    2747             :     // FirstHVACiteration inits
    2748     6566160 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2749     3727831 :         LoopSetPointTemp = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPoint;
    2750             : 
    2751             :         // Check the Loop Setpoint and make sure it is bounded by the Loop Max and Min
    2752     3727831 :         LoopMaxTemp = state.dataPlnt->PlantLoop(LoopNum).MaxTemp;
    2753     3727831 :         LoopMinTemp = state.dataPlnt->PlantLoop(LoopNum).MinTemp;
    2754             :         // Check it against the loop temperature limits
    2755     3727831 :         LoopSetPointTemp = min(LoopMaxTemp, LoopSetPointTemp);
    2756     3727831 :         LoopSetPointTemp = max(LoopMinTemp, LoopSetPointTemp);
    2757             : 
    2758             :         // Update supply side loop setpoint in plant data structure
    2759     3727831 :         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TempSetPoint = LoopSetPointTemp;
    2760     3727831 :         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPoint = LoopSetPointTemp;
    2761             : 
    2762             :         // Update supply side hi-lo setpoints for dual SP control
    2763     3727831 :         if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) {
    2764       22933 :             LoopSetPointTempHi = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi;
    2765       22933 :             LoopSetPointTempLo = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointLo;
    2766       22933 :             LoopSetPointTempHi = min(LoopMaxTemp, LoopSetPointTempHi);
    2767       22933 :             LoopSetPointTempHi = max(LoopMinTemp, LoopSetPointTempHi);
    2768       22933 :             LoopSetPointTempLo = min(LoopMaxTemp, LoopSetPointTempLo);
    2769       22933 :             LoopSetPointTempLo = max(LoopMinTemp, LoopSetPointTempLo);
    2770       22933 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TempSetPointHi = LoopSetPointTempHi;
    2771       22933 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TempSetPointLo = LoopSetPointTempLo;
    2772             :         }
    2773             : 
    2774             :         // update demand side loop setpoint in plant data structure
    2775     3727831 :         if (state.dataPlnt->PlantLoop(LoopNum).CommonPipeType == DataPlant::CommonPipeType::TwoWay) { // get a second setpoint for secondaryLoop
    2776             :             // if the plant loop is two common pipe configured for temperature control on secondary side inlet, then
    2777             :             // we want to initialize the demand side of the loop using that setpoint
    2778       14399 :             if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).InletNodeSetPt) {
    2779       12120 :                 SecondaryLoopSetPointTemp =
    2780       12120 :                     state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPoint;
    2781       12120 :                 SecondaryLoopSetPointTemp = min(LoopMaxTemp, SecondaryLoopSetPointTemp);
    2782       12120 :                 SecondaryLoopSetPointTemp = max(LoopMinTemp, SecondaryLoopSetPointTemp);
    2783       12120 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPoint = SecondaryLoopSetPointTemp;
    2784             :                 // Since Dual setpoint not explicitly available for demand side, we can't do the
    2785             :                 // bounding check on hi/lo setpoint.  IF we did we would over-write
    2786             :                 // the SensedNodeFlagValue of -999 for no dual setpoint case.
    2787       12120 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointHi =
    2788       12120 :                     state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPointHi;
    2789       12120 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointLo =
    2790       12120 :                     state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPointLo;
    2791             :             }
    2792             : 
    2793             :             // initialize common pipe flows to zero.
    2794       14399 :             if (allocated(state.dataHVACInterfaceMgr->PlantCommonPipe)) {
    2795       14389 :                 state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).PriToSecFlow = 0.0;
    2796       14389 :                 state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).SecToPriFlow = 0.0;
    2797       14389 :                 state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).PriCPLegFlow = 0.0;
    2798       14389 :                 state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).SecCPLegFlow = 0.0;
    2799             :             }
    2800             :         } else { // no secondary loop, so use supply side loop SP on demand side too.
    2801     3713432 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPoint = LoopSetPointTemp;
    2802     3713432 :             if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) {
    2803       22933 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointHi = LoopSetPointTempHi;
    2804       22933 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointLo = LoopSetPointTempLo;
    2805             :             }
    2806             :         }
    2807             : 
    2808    11183493 :         for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2809    53482401 :             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
    2810    92252704 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2811    46225965 :                     ComponentInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn;
    2812    46225965 :                     ComponentOutlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut;
    2813             : 
    2814             :                     // reinit to node hardware limits
    2815    46225965 :                     state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMinAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin;
    2816    46225965 :                     state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMinAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin;
    2817    46225965 :                     state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMaxAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax;
    2818    46225965 :                     state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMaxAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax;
    2819             : 
    2820    46225965 :                     state.dataLoopNodes->Node(ComponentInlet).MassFlowRateRequest = 0.0;
    2821    46225965 :                     state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateRequest = 0.0;
    2822             :                 }
    2823             :             }
    2824             :         }
    2825             : 
    2826     7814908 :         for (OpNum = 1; OpNum <= state.dataPlnt->PlantLoop(LoopNum).NumOpSchemes; ++OpNum) {
    2827             :             // If the operating scheme is scheduled "OFF", go to next scheme
    2828     4087077 :             state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).Available =
    2829     4087077 :                 GetCurrentScheduleValue(state, state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).SchedPtr) > 0.0;
    2830             :         }
    2831             :     }
    2832     2838329 : }
    2833             : 
    2834     3561101 : void UpdateNodeThermalHistory(EnergyPlusData &state)
    2835             : {
    2836             : 
    2837             :     // SUBROUTINE INFORMATION:
    2838             :     //       AUTHOR         Brent Griffith
    2839             :     //       DATE WRITTEN   Sept 2010
    2840             : 
    2841             :     // PURPOSE OF THIS SUBROUTINE:
    2842             :     // update temperature history for plant capacitance model and other
    2843             : 
    2844             :     // METHODOLOGY EMPLOYED:
    2845             :     // copy current values into "LastTimestep" values
    2846             : 
    2847             :     // REFERENCES:
    2848             :     // na
    2849             : 
    2850             :     // USE STATEMENTS:
    2851             :     // na
    2852             : 
    2853             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    2854             :     // na
    2855             : 
    2856             :     // SUBROUTINE PARAMETER DEFINITIONS:
    2857             :     // na
    2858             : 
    2859             :     // INTERFACE BLOCK SPECIFICATIONS:
    2860             :     // na
    2861             : 
    2862             :     // DERIVED TYPE DEFINITIONS:
    2863             :     // na
    2864             : 
    2865             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2866             :     // na
    2867             : 
    2868             :     // array assignment
    2869     3561101 :     if (state.dataLoopNodes->NumOfNodes > 0) {
    2870   299049778 :         for (auto &e : state.dataLoopNodes->Node) { // MA
    2871   295806321 :             e.TempLastTimestep = e.Temp;
    2872   295806321 :             e.EnthalpyLastTimestep = e.Enthalpy;
    2873             :         }
    2874             :     }
    2875     3561101 :     if (state.dataPlnt->TotNumLoops > 0 && !state.dataGlobal->WarmupFlag) {
    2876     1265202 :         for (auto &loop : state.dataPlnt->PlantLoop) {
    2877     2685702 :             for (auto &side : loop.LoopSide) {
    2878     1790468 :                 if (loop.OutletNodeFlowrate > HVAC::SmallMassFlow) {
    2879             :                     // Accumulate total time loop is active
    2880      596662 :                     side.LoopSideInlet_TotalTime += state.dataHVACGlobal->TimeStepSys;
    2881             :                     // Determine excessive storage - if both are moving in the same direction and McpDTdt is larger than MdotCpDeltaT
    2882      981590 :                     if ((std::abs(side.LoopSideInlet_MdotCpDeltaT) > HVAC::SmallLoad) &&
    2883      384928 :                         ((side.LoopSideInlet_McpDTdt / side.LoopSideInlet_MdotCpDeltaT) > 1.1)) {
    2884       21078 :                         side.LoopSideInlet_CapExcessStorageTimeReport = state.dataHVACGlobal->TimeStepSys;
    2885       21078 :                         side.LoopSideInlet_CapExcessStorageTime += state.dataHVACGlobal->TimeStepSys;
    2886             :                     } else {
    2887      575584 :                         side.LoopSideInlet_CapExcessStorageTimeReport = 0;
    2888             :                     }
    2889             :                 } else {
    2890     1193806 :                     side.LoopSideInlet_CapExcessStorageTimeReport = 0;
    2891             :                 }
    2892             :             }
    2893             :         }
    2894             :     }
    2895     3561101 : }
    2896             : 
    2897           2 : void CheckPlantOnAbort(EnergyPlusData &state)
    2898             : {
    2899             : 
    2900             :     // SUBROUTINE INFORMATION:
    2901             :     //       AUTHOR         Brent Griffith
    2902             :     //       DATE WRITTEN   Septemeber 2006
    2903             :     //       MODIFIED       na
    2904             :     //       RE-ENGINEERED  na
    2905             : 
    2906             :     // PURPOSE OF THIS SUBROUTINE:
    2907             :     // Called once E+ is in the process of aborting because of fatal error
    2908             :     //  check for plant input problems to help users find problems in input files
    2909             : 
    2910             :     // METHODOLOGY EMPLOYED:
    2911             :     //  search plant data structures for issues that may help solve problems in input files
    2912             :     //  1.   if loop side has a splitter/mixer and one branch in there is control type bypass,
    2913             :     //       then another branch in the s/m needs to be active
    2914             :     //  other checks could/should be added!
    2915             : 
    2916             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2917             :     int LoopNum;           // DO loop counter for loops
    2918             :     bool ActiveCntrlfound; // used to search for active control branches in parallel with bypass branches
    2919             :     int ParalBranchNum;    // used to search for active control branches in parallel with bypass branches
    2920             :     int ParalBranchNum2;   // used to search for active control branches in parallel with bypass branches
    2921             :     int BranchNum2;        // used to search for active control branches in parallel with bypass branches
    2922             :     int numLoopSides;
    2923             :     int BranchNum; // DO loop counter for branches
    2924             :     int CompNum;   // do loop for multiple components on a branch
    2925             :     bool ShouldBeACTIVE;
    2926             : 
    2927           2 :     if (!(state.dataErrTracking->AskForPlantCheckOnAbort)) {
    2928           1 :         return;
    2929             :     }
    2930             : 
    2931           1 :     if (state.dataPlnt->TotNumLoops <= 0) return;
    2932           1 :     if (!(allocated(state.dataPlnt->PlantLoop))) return;
    2933             : 
    2934           2 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    2935           1 :         numLoopSides = 2;
    2936           3 :         for (DataPlant::LoopSideLocation SideNum : DataPlant::LoopSideKeys) {
    2937           2 :             if (!(state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.Exists)) continue;
    2938             : 
    2939           6 :             for (ParalBranchNum = 1; ParalBranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.TotalOutletNodes;
    2940             :                  ++ParalBranchNum) {
    2941           4 :                 BranchNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.BranchNumOut(ParalBranchNum);
    2942           4 :                 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).IsBypass) { // we know there is a bypass
    2943             :                     // check that there is at least one 'Active' control type in parallel with bypass branch
    2944           2 :                     ActiveCntrlfound = false;
    2945           6 :                     for (ParalBranchNum2 = 1; ParalBranchNum2 <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.TotalOutletNodes;
    2946             :                          ++ParalBranchNum2) {
    2947           4 :                         BranchNum2 = state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.BranchNumOut(ParalBranchNum2);
    2948           4 :                         if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum2).controlType ==
    2949             :                             DataBranchAirLoopPlant::ControlType::Active) {
    2950           2 :                             ActiveCntrlfound = true;
    2951             :                         }
    2952             :                     }
    2953           2 :                     if (!(ActiveCntrlfound)) {
    2954           0 :                         ShowWarningError(state,
    2955           0 :                                          "Check control types on branches between splitter and mixer in PlantLoop=" +
    2956           0 :                                              state.dataPlnt->PlantLoop(LoopNum).Name);
    2957           0 :                         ShowContinueError(state, "Found a BYPASS branch with no ACTIVE branch in parallel with it");
    2958           0 :                         ShowContinueError(state, "In certain (but not all) situations, this can cause problems; please verify your inputs");
    2959           0 :                         ShowContinueError(state,
    2960           0 :                                           "Bypass branch named: " + state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
    2961             :                     }
    2962             :                 } // bypass present
    2963             : 
    2964             :                 // check for possible components on demand side that should be ACTIVE but are not
    2965           4 :                 if (SideNum == LoopSideLocation::Demand) {
    2966             :                     // check for presences of the following components whose branch control type should be active
    2967             :                     // WATER HEATER:MIXED
    2968             :                     // WATER HEATER:STRATIFIED
    2969             :                     // WATER USE CONNECTIONS
    2970             :                     // COIL:WATER:COOLING
    2971             :                     // COIL:WATER:SIMPLEHEATING
    2972             :                     // COIL:STEAM:AIRHEATING
    2973             :                     // SOLAR COLLECTOR:FLAT PLATE
    2974             :                     // PLANT LOAD PROFILE
    2975           4 :                     for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
    2976           2 :                         ShouldBeACTIVE = false;
    2977           2 :                         switch (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Comp(CompNum).Type) {
    2978           1 :                         case DataPlant::PlantEquipmentType::WtrHeaterMixed:
    2979             :                         case DataPlant::PlantEquipmentType::WtrHeaterStratified:
    2980             :                         case DataPlant::PlantEquipmentType::WaterUseConnection:
    2981             :                         case DataPlant::PlantEquipmentType::CoilWaterCooling:
    2982             :                         case DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling:
    2983             :                         case DataPlant::PlantEquipmentType::CoilWaterSimpleHeating:
    2984             :                         case DataPlant::PlantEquipmentType::CoilSteamAirHeating:
    2985             :                         case DataPlant::PlantEquipmentType::SolarCollectorFlatPlate:
    2986             :                         case DataPlant::PlantEquipmentType::PlantLoadProfile: {
    2987           1 :                             ShouldBeACTIVE = true;
    2988           1 :                         } break;
    2989           1 :                         default: {
    2990             :                             // not a demand side component that we know needs to be active, do nothing
    2991           1 :                         } break;
    2992             :                         }
    2993             : 
    2994           2 :                         if (ShouldBeACTIVE) {
    2995           1 :                             switch (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).controlType) {
    2996           0 :                             case DataBranchAirLoopPlant::ControlType::Invalid: {
    2997           0 :                                 ShowWarningError(state,
    2998           0 :                                                  "Found potential problem with Control Type for Branch named: " +
    2999           0 :                                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
    3000           0 :                                 ShowContinueError(state, "This branch should (probably) be ACTIVE but has control type unknown");
    3001           0 :                             } break;
    3002           1 :                             case DataBranchAirLoopPlant::ControlType::Active: {
    3003             :                                 // do nothing, this is correct control type.
    3004           1 :                             } break;
    3005           0 :                             case DataBranchAirLoopPlant::ControlType::Passive: {
    3006           0 :                                 ShowWarningError(state,
    3007           0 :                                                  "Found potential problem with Control Type for Branch named: " +
    3008           0 :                                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
    3009           0 :                                 ShowContinueError(state, "This branch should (probably) be ACTIVE but has control type PASSIVE");
    3010           0 :                             } break;
    3011           0 :                             case DataBranchAirLoopPlant::ControlType::SeriesActive: {
    3012             :                                 // do nothing, should be okay. (? don't really understand SeriesActive though)
    3013           0 :                             } break;
    3014           0 :                             case DataBranchAirLoopPlant::ControlType::Bypass: {
    3015           0 :                                 ShowWarningError(state,
    3016           0 :                                                  "Found potential problem with Control Type for Branch named: " +
    3017           0 :                                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
    3018           0 :                                 ShowContinueError(state, "This branch should (probably) be ACTIVE but has control type Bypass");
    3019           0 :                             } break;
    3020           0 :                             default:
    3021           0 :                                 break;
    3022             :                             }
    3023             :                         } // should be active
    3024             :                     }     // comp num loop
    3025             :                 }         // demand side
    3026             : 
    3027             :             } // splitter outlet nodes
    3028             : 
    3029             :             // check to see if bypass exists in demand side. If not warn error of possible flow problems
    3030           2 :             if (!state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).BypassExists) {
    3031           0 :                 if (SideNum == LoopSideLocation::Demand) {
    3032           0 :                     ShowWarningError(state,
    3033           0 :                                      "There is no BYPASS component in the demand-side of PlantLoop =" + state.dataPlnt->PlantLoop(LoopNum).Name);
    3034           0 :                     ShowContinueError(state, "You may be able to fix the fatal error above by adding a demand-side BYPASS PIPE.");
    3035             :                 }
    3036             :             }
    3037             :         } // loop sides
    3038             :     }     // plant loops
    3039             : }
    3040             : 
    3041        1148 : void InitOneTimePlantSizingInfo(EnergyPlusData &state, int const LoopNum) // loop being initialized for sizing
    3042             : {
    3043             : 
    3044             :     // SUBROUTINE INFORMATION:
    3045             :     //       AUTHOR         Brent Griffith
    3046             :     //       DATE WRITTEN   April 2011
    3047             :     //       MODIFIED       na
    3048             :     //       RE-ENGINEERED  na
    3049             : 
    3050             :     // PURPOSE OF THIS SUBROUTINE:
    3051             :     // one time init what can be set up related to plant sizing data structure.
    3052             : 
    3053             :     // Using/Aliasing
    3054             :     using DataSizing::PlantSizingData;
    3055             : 
    3056             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3057        1148 :     int PlantSizNum(0); // index of Plant Sizing data for this loop
    3058             : 
    3059        1148 :     if (state.dataPlnt->PlantLoop(LoopNum).PlantSizNum == 0) {
    3060        1148 :         if (state.dataSize->NumPltSizInput > 0) {
    3061             :             PlantSizNum =
    3062         816 :                 Util::FindItemInList(state.dataPlnt->PlantLoop(LoopNum).Name, state.dataSize->PlantSizData, &PlantSizingData::PlantLoopName);
    3063         816 :             if (PlantSizNum > 0) {
    3064         789 :                 state.dataPlnt->PlantLoop(LoopNum).PlantSizNum = PlantSizNum;
    3065             :             }
    3066             :         }
    3067             :     }
    3068        1148 : }
    3069             : 
    3070        5735 : void SizePlantLoop(EnergyPlusData &state,
    3071             :                    int const LoopNum, // Supply side loop being simulated
    3072             :                    bool const OkayToFinish)
    3073             : {
    3074             : 
    3075             :     // SUBROUTINE INFORMATION:
    3076             :     //       AUTHOR         Fred Buhl
    3077             :     //       DATE WRITTEN   December 2001
    3078             :     //       MODIFIED       na
    3079             :     //       RE-ENGINEERED  na
    3080             : 
    3081             :     // PURPOSE OF THIS SUBROUTINE:
    3082             :     // This subroutine is for sizing the supply side of Plant Loops for which loop flow rates
    3083             :     // have not been specified in the input.
    3084             : 
    3085             :     // METHODOLOGY EMPLOYED:
    3086             :     // Obtains volumetric flow rate data from the PlantSizData array..
    3087             : 
    3088             :     // Using/Aliasing
    3089             :     using namespace DataSizing;
    3090             : 
    3091             :     // SUBROUTINE PARAMETER DEFINITIONS:
    3092             :     static constexpr std::string_view RoutineName("SizePlantLoop");
    3093             : 
    3094             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3095        5735 :     int PlantSizNum(0);      // index of Plant Sizing data for this loop
    3096             :     int BranchNum;           // DO loop counter for cycling through branches on a demand side loop
    3097             :     int CompNum;             // DO loop counter for cycling through components on a demand side loop
    3098             :     int SupNodeNum;          // component inlet water node number
    3099             :     int WaterCompNum;        // DO loop counter for cycling through all the components that demand water
    3100        5735 :     bool ErrorsFound(false); // If errors detected in input
    3101        5735 :     Real64 LoopSizFac(0.0);
    3102             :     Real64 AvLoopSizFac;
    3103        5735 :     Real64 PlantSizFac(1.0);
    3104        5735 :     Real64 MaxSizFac(0.0);
    3105             :     Real64 BranchSizFac;
    3106        5735 :     Real64 NumBrSizFac(0.0);
    3107        5735 :     Real64 FluidDensity(0.0); // local value from glycol routine
    3108        5735 :     bool Finalize(OkayToFinish);
    3109             : 
    3110        5735 :     if (state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0) {
    3111        3940 :         PlantSizNum = state.dataPlnt->PlantLoop(LoopNum).PlantSizNum;
    3112             :         // PlantSizData(PlantSizNum)%DesVolFlowRate = 0.0D0 ! DSU2
    3113             :     } else {
    3114        1795 :         if (state.dataSize->NumPltSizInput > 0) {
    3115             :             PlantSizNum =
    3116         135 :                 Util::FindItemInList(state.dataPlnt->PlantLoop(LoopNum).Name, state.dataSize->PlantSizData, &PlantSizingData::PlantLoopName);
    3117             :         }
    3118             :     }
    3119        5735 :     state.dataPlnt->PlantLoop(LoopNum).PlantSizNum = PlantSizNum;
    3120             :     // calculate a loop sizing factor and a branch sizing factor. Note that components without a sizing factor
    3121             :     // are assigned sizing factors of zero in this calculation
    3122        5735 :     if (PlantSizNum > 0) {
    3123        3940 :         if (state.dataPlantMgr->GetCompSizFac) {
    3124        3993 :             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) {
    3125        3205 :                 BranchSizFac = 0.0;
    3126        3205 :                 state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = 1.0;
    3127        3205 :                 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn ==
    3128        3205 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn)
    3129         788 :                     continue;
    3130        2417 :                 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumOut ==
    3131        2417 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumOut)
    3132         786 :                     continue;
    3133        3282 :                 for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents;
    3134             :                      ++CompNum) {
    3135        1651 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).simulate(state, true);
    3136        1651 :                     BranchSizFac = max(BranchSizFac,
    3137        1651 :                                        state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).SizFac);
    3138             :                 }
    3139        1631 :                 LoopSizFac += BranchSizFac;
    3140        1631 :                 MaxSizFac = max(MaxSizFac, BranchSizFac);
    3141        1631 :                 if (BranchSizFac > 0.0) {
    3142         621 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = BranchSizFac;
    3143         621 :                     ++NumBrSizFac;
    3144             :                 }
    3145             :             }
    3146         788 :             AvLoopSizFac = LoopSizFac / max(1.0, NumBrSizFac);
    3147             : 
    3148         788 :             if (AvLoopSizFac > 0.0 && AvLoopSizFac < 1.0) {
    3149          22 :                 PlantSizFac = LoopSizFac;
    3150         766 :             } else if (AvLoopSizFac > 1.0) {
    3151           9 :                 PlantSizFac = MaxSizFac;
    3152             :             } else {
    3153         757 :                 PlantSizFac = 1.0;
    3154             :             }
    3155             :             // store the sizing factor now, for later reuse,
    3156         788 :             state.dataSize->PlantSizData(PlantSizNum).PlantSizFac = PlantSizFac;
    3157             :             // might deprecate this next bit in favor of simpler storage in PlantSizData structure
    3158        3993 :             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) {
    3159        3205 :                 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn ==
    3160        3205 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn) {
    3161         788 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = PlantSizFac;
    3162             :                 }
    3163        3205 :                 if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumOut ==
    3164        3205 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumOut) {
    3165         788 :                     state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = PlantSizFac;
    3166             :                 }
    3167             :             }
    3168             :         }
    3169             : 
    3170             :         // sum up contributions from CompDesWaterFlow, demand side size request (non-coincident)
    3171        3940 :         state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate = 0.0; // init for summation
    3172       38440 :         for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) {
    3173       69030 :             for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents;
    3174             :                  ++CompNum) {
    3175       34530 :                 SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn;
    3176     2074365 :                 for (WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) {
    3177     2039835 :                     if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) {
    3178       22660 :                         state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate;
    3179             :                     }
    3180             :                 }
    3181             :             }
    3182             :         }
    3183             : 
    3184        3940 :         if (!state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRateWasAutoSized && (state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate > 0.0)) {
    3185             :             // if the user puts in a large throwaway value for hard max plant loop size, they may not want this affecting anything else.
    3186             :             //  but if they put in a smaller value, then it should cap the design size, so use hard value if it is smaller than non-coincident
    3187             :             //  result
    3188         355 :             state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate =
    3189         355 :                 std::min(state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate, state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3190             :         }
    3191             :     }
    3192             : 
    3193        5735 :     if (state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRateWasAutoSized) {
    3194             : 
    3195        3585 :         if ((PlantSizNum > 0)) {
    3196             : 
    3197        3585 :             if (state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
    3198        3448 :                 state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate =
    3199        3448 :                     state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * state.dataSize->PlantSizData(PlantSizNum).PlantSizFac;
    3200             :             } else {
    3201         137 :                 state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate = 0.0;
    3202         137 :                 if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3203           0 :                     ShowWarningError(state,
    3204           0 :                                      format("SizePlantLoop: Calculated Plant Sizing Design Volume Flow Rate=[{:.2R}] is too small. Set to 0.0",
    3205           0 :                                             state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate));
    3206           0 :                     ShowContinueError(state, "..occurs for PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
    3207             :                 }
    3208             :             }
    3209        3585 :             if (Finalize) {
    3210         717 :                 if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3211         673 :                     if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3212        1108 :                         BaseSizer::reportSizerOutput(state,
    3213             :                                                      "PlantLoop",
    3214         554 :                                                      state.dataPlnt->PlantLoop(LoopNum).Name,
    3215             :                                                      "Maximum Loop Flow Rate [m3/s]",
    3216         554 :                                                      state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3217             :                         // begin std 229 plantloop equipment summary new table
    3218        1108 :                         OutputReportPredefined::PreDefTableEntry(
    3219         554 :                             state, state.dataOutRptPredefined->pdchPLCLType, state.dataPlnt->PlantLoop(LoopNum).Name, "PlantLoop");
    3220             :                         // end std 229 plantloop equipment summary new table
    3221         119 :                     } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3222         238 :                         BaseSizer::reportSizerOutput(state,
    3223             :                                                      "CondenserLoop",
    3224         119 :                                                      state.dataPlnt->PlantLoop(LoopNum).Name,
    3225             :                                                      "Maximum Loop Flow Rate [m3/s]",
    3226         119 :                                                      state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3227             :                         // begin std 229 plantloop equipment summary new table
    3228         238 :                         OutputReportPredefined::PreDefTableEntry(
    3229         119 :                             state, state.dataOutRptPredefined->pdchPLCLType, state.dataPlnt->PlantLoop(LoopNum).Name, "CondenserLoop");
    3230             :                         // end std 229 plantloop equipment summary new table
    3231             :                     }
    3232             :                     // begin std 229 plantloop equipment summary new table
    3233        1346 :                     OutputReportPredefined::PreDefTableEntry(state,
    3234         673 :                                                              state.dataOutRptPredefined->pdchPLCLProvHeat,
    3235         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3236         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).HeatingDemand >= 0 ? "Yes" : "No");
    3237        1346 :                     OutputReportPredefined::PreDefTableEntry(state,
    3238         673 :                                                              state.dataOutRptPredefined->pdchPLCLProvCool,
    3239         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3240         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).CoolingDemand >= 0 ? "Yes" : "No");
    3241        1346 :                     OutputReportPredefined::PreDefTableEntry(state,
    3242         673 :                                                              state.dataOutRptPredefined->pdchPLCLMaxLoopFlowRate,
    3243         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3244         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3245        1346 :                     OutputReportPredefined::PreDefTableEntry(state,
    3246         673 :                                                              state.dataOutRptPredefined->pdchPLCLMinLoopFlowRate,
    3247         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3248         673 :                                                              state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate);
    3249             :                     // end std 229 plantloop equipment summary new table
    3250             :                 }
    3251         717 :                 if (state.dataPlnt->PlantFirstSizesOkayToReport) {
    3252          44 :                     if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3253          68 :                         BaseSizer::reportSizerOutput(state,
    3254             :                                                      "PlantLoop",
    3255          34 :                                                      state.dataPlnt->PlantLoop(LoopNum).Name,
    3256             :                                                      "Initial Maximum Loop Flow Rate [m3/s]",
    3257          34 :                                                      state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3258          10 :                     } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3259          20 :                         BaseSizer::reportSizerOutput(state,
    3260             :                                                      "CondenserLoop",
    3261          10 :                                                      state.dataPlnt->PlantLoop(LoopNum).Name,
    3262             :                                                      "Initial Maximum Loop Flow Rate [m3/s]",
    3263          10 :                                                      state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3264             :                     }
    3265             :                 }
    3266             :             }
    3267             : 
    3268             :         } else {
    3269           0 :             if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
    3270           0 :                 ShowFatalError(state, "Autosizing of plant loop requires a loop Sizing:Plant object");
    3271           0 :                 ShowContinueError(state, "Occurs in PlantLoop object=" + state.dataPlnt->PlantLoop(LoopNum).Name);
    3272           0 :                 ErrorsFound = true;
    3273             :             }
    3274             :         }
    3275             :     }
    3276             : 
    3277             :     // Small loop mass no longer introduces instability. Checks and warnings removed by SJR 20 July 2007.
    3278        5735 :     if (state.dataPlnt->PlantLoop(LoopNum).VolumeWasAutoSized) {
    3279             :         // There is no stability requirement (mass can be zero), autosizing is based on loop circulation time.
    3280             :         // Note this calculation also appears in PlantManager::ResizePlantLoopLevelSizes and SizingAnalysisObjects::ResolveDesignFlowRate
    3281        5545 :         state.dataPlnt->PlantLoop(LoopNum).Volume =
    3282        5545 :             state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * state.dataPlnt->PlantLoop(LoopNum).CirculationTime * 60.0;
    3283        5545 :         if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3284        1065 :             if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3285             :                 // condenser loop vs plant loop breakout needed.
    3286        1646 :                 BaseSizer::reportSizerOutput(
    3287         823 :                     state, "PlantLoop", state.dataPlnt->PlantLoop(LoopNum).Name, "Plant Loop Volume [m3]", state.dataPlnt->PlantLoop(LoopNum).Volume);
    3288             :                 // begin std 229 added lines
    3289        2469 :                 BaseSizer::reportSizerOutput(state,
    3290             :                                              "PlantLoop",
    3291         823 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3292             :                                              "Design Supply Temperature [C]",
    3293         823 :                                              state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
    3294         601 :                                                  ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp
    3295             :                                                  : -999.0);
    3296        2469 :                 BaseSizer::reportSizerOutput(state,
    3297             :                                              "PlantLoop",
    3298         823 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3299             :                                              "Design Return Temperature [C]",
    3300         823 :                                              state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
    3301         601 :                                                  ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp -
    3302         601 :                                                        state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).DeltaT
    3303             :                                                  : -999.0);
    3304        2469 :                 BaseSizer::reportSizerOutput(state,
    3305             :                                              "PlantLoop",
    3306         823 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3307             :                                              "Sizing option (Coincident/NonCoincident)",
    3308         823 :                                              state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
    3309         601 :                                                  ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ConcurrenceOption
    3310             :                                                  : -1);
    3311             :                 // end std 229 added lines
    3312         242 :             } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3313         484 :                 BaseSizer::reportSizerOutput(state,
    3314             :                                              "CondenserLoop",
    3315         242 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3316             :                                              "Condenser Loop Volume [m3]",
    3317         242 :                                              state.dataPlnt->PlantLoop(LoopNum).Volume);
    3318             :                 // begin std 229 added lines
    3319         726 :                 BaseSizer::reportSizerOutput(state,
    3320             :                                              "CondenserLoop",
    3321         242 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3322             :                                              "Design Supply Temperature [C]",
    3323         242 :                                              state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
    3324         135 :                                                  ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp
    3325             :                                                  : -999.0);
    3326         726 :                 BaseSizer::reportSizerOutput(state,
    3327             :                                              "CondenserLoop",
    3328         242 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3329             :                                              "Design Return Temperature [C]",
    3330         242 :                                              state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
    3331         135 :                                                  ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp -
    3332         135 :                                                        state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).DeltaT
    3333             :                                                  : -999.0);
    3334         726 :                 BaseSizer::reportSizerOutput(state,
    3335             :                                              "CondenserLoop",
    3336         242 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3337             :                                              "Sizing option (Coincident/NonCoincident)",
    3338         242 :                                              state.dataPlnt->PlantLoop(LoopNum).PlantSizNum
    3339         135 :                                                  ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ConcurrenceOption
    3340             :                                                  : -1);
    3341             :                 // end std 229 added lines
    3342             :             }
    3343             :         }
    3344        5545 :         if (state.dataPlnt->PlantFirstSizesOkayToReport) {
    3345          44 :             if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3346             :                 // condenser loop vs plant loop breakout needed.
    3347          68 :                 BaseSizer::reportSizerOutput(state,
    3348             :                                              "PlantLoop",
    3349          34 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3350             :                                              "Initial Plant Loop Volume [m3]",
    3351          34 :                                              state.dataPlnt->PlantLoop(LoopNum).Volume);
    3352          10 :             } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3353          20 :                 BaseSizer::reportSizerOutput(state,
    3354             :                                              "CondenserLoop",
    3355          10 :                                              state.dataPlnt->PlantLoop(LoopNum).Name,
    3356             :                                              "Initial Condenser Loop Volume [m3]",
    3357          10 :                                              state.dataPlnt->PlantLoop(LoopNum).Volume);
    3358             :             }
    3359             :         }
    3360             :     }
    3361             : 
    3362        5735 :     if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3363        1103 :         if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3364        1710 :             BaseSizer::reportSizerOutput(state,
    3365             :                                          "PlantLoop",
    3366         855 :                                          state.dataPlnt->PlantLoop(LoopNum).Name,
    3367             :                                          "Minimum Loop Flow Rate [m3/s]",
    3368         855 :                                          state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate);
    3369         248 :         } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3370         496 :             BaseSizer::reportSizerOutput(state,
    3371             :                                          "CondenserLoop",
    3372         248 :                                          state.dataPlnt->PlantLoop(LoopNum).Name,
    3373             :                                          "Minimum Loop Flow Rate [m3/s]",
    3374         248 :                                          state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate);
    3375             :         }
    3376             :     }
    3377             : 
    3378             :     // should now have plant volume, calculate plant volume's mass for fluid type
    3379        5735 :     if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) {
    3380        5690 :         FluidDensity = FluidProperties::GetDensityGlycol(
    3381        5690 :             state, state.dataPlnt->PlantLoop(LoopNum).FluidName, Constant::InitConvTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);
    3382        5690 :         if (PlantSizNum > 0 && allocated(state.dataSize->PlantSizData)) { // method only works if sizing delta T is avaiable
    3383        3895 :             Real64 cp = FluidProperties::GetSpecificHeatGlycol(state,
    3384        3895 :                                                                state.dataPlnt->PlantLoop(LoopNum).FluidName,
    3385             :                                                                Constant::InitConvTemp,
    3386        3895 :                                                                state.dataPlnt->PlantLoop(LoopNum).FluidIndex,
    3387             :                                                                RoutineName);
    3388             :             Real64 DesignPlantCapacity =
    3389        3895 :                 cp * FluidDensity * state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * state.dataSize->PlantSizData(PlantSizNum).DeltaT;
    3390        3895 :             state.dataSize->PlantSizData(PlantSizNum).DesCapacity = DesignPlantCapacity; // store it for later use in scaling
    3391        3895 :             if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3392         735 :                 BaseSizer::reportSizerOutput(state, "PlantLoop", state.dataPlnt->PlantLoop(LoopNum).Name, "Design Capacity [W]", DesignPlantCapacity);
    3393             :             }
    3394             :         }
    3395          45 :     } else if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) {
    3396             :         FluidDensity =
    3397          45 :             FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, 100.0, 1.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);
    3398             :     } else {
    3399           0 :         assert(false);
    3400             :     }
    3401             : 
    3402        5735 :     state.dataPlnt->PlantLoop(LoopNum).Mass = state.dataPlnt->PlantLoop(LoopNum).Volume * FluidDensity;
    3403             : 
    3404        5735 :     state.dataPlnt->PlantLoop(LoopNum).MaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * FluidDensity;
    3405        5735 :     state.dataPlnt->PlantLoop(LoopNum).MinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * FluidDensity;
    3406             : 
    3407        5735 :     if (ErrorsFound) {
    3408           0 :         ShowFatalError(state, "Preceding sizing errors cause program termination");
    3409             :     }
    3410        5735 : }
    3411             : 
    3412          44 : void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Supply side loop being simulated
    3413             : )
    3414             : {
    3415             : 
    3416             :     // SUBROUTINE INFORMATION:
    3417             :     //       AUTHOR         Brent Griffith
    3418             :     //       DATE WRITTEN   Jan 2015
    3419             :     //       MODIFIED       na
    3420             :     //       RE-ENGINEERED  na
    3421             : 
    3422             :     // PURPOSE OF THIS SUBROUTINE:
    3423             :     // This subroutine is for redon the sizing of plant loops to support HVAC Sizing Simulation
    3424             : 
    3425             :     // METHODOLOGY EMPLOYED:
    3426             :     // Obtains volumetric flow rate data from the PlantSizData array..
    3427             : 
    3428             :     // Using/Aliasing
    3429             :     using namespace DataSizing;
    3430             : 
    3431             :     // SUBROUTINE PARAMETER DEFINITIONS:
    3432             :     static constexpr std::string_view RoutineName("ResizePlantLoop");
    3433             : 
    3434             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3435          44 :     int PlantSizNum(0);      // index of Plant Sizing data for this loop
    3436             :     int BranchNum;           // DO loop counter for cycling through branches on a demand side loop
    3437             :     int CompNum;             // DO loop counter for cycling through components on a demand side loop
    3438             :     int SupNodeNum;          // component inlet water node number
    3439             :     int WaterCompNum;        // DO loop counter for cycling through all the components that demand water
    3440          44 :     bool ErrorsFound(false); // If errors detected in input
    3441             : 
    3442          44 :     Real64 FluidDensity(0.0); // local value from glycol routine
    3443             : 
    3444          44 :     Real64 PlantSizeFac = 0.0;
    3445             : 
    3446          44 :     PlantSizNum = state.dataPlnt->PlantLoop(LoopNum).PlantSizNum;
    3447             : 
    3448             :     // fill PlantSizFac from data structure
    3449          44 :     for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) {
    3450          44 :         if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn ==
    3451          44 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn) {
    3452          44 :             PlantSizeFac = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac;
    3453          44 :             break;
    3454             :         }
    3455             :     }
    3456          44 :     if (state.dataSize->PlantSizData(PlantSizNum).ConcurrenceOption == NonCoincident) {
    3457             :         // we can have plant loops that are non-coincident along with some that are coincident
    3458             :         // so refresh sum of registered flows (they may have changed)
    3459             : 
    3460          18 :         state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate = 0.0; // init for summation
    3461         115 :         for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) {
    3462         194 :             for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents;
    3463             :                  ++CompNum) {
    3464          97 :                 SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn;
    3465        3329 :                 for (WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) {
    3466        3232 :                     if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) {
    3467          43 :                         state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate;
    3468             :                     }
    3469             :                 }
    3470             :             }
    3471             :         }
    3472             :     }
    3473             : 
    3474          44 :     if (state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRateWasAutoSized) {
    3475             : 
    3476          44 :         if ((PlantSizNum > 0)) {
    3477             : 
    3478          44 :             if (state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
    3479          44 :                 state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate = state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * PlantSizeFac;
    3480             :             } else {
    3481           0 :                 state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate = 0.0;
    3482           0 :                 if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3483           0 :                     ShowWarningError(state,
    3484           0 :                                      format("SizePlantLoop: Calculated Plant Sizing Design Volume Flow Rate=[{:.2R}] is too small. Set to 0.0",
    3485           0 :                                             state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate));
    3486           0 :                     ShowContinueError(state, "..occurs for PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
    3487             :                 }
    3488             :             }
    3489          44 :             if (state.dataPlnt->PlantFinalSizesOkayToReport) {
    3490          44 :                 if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3491          68 :                     BaseSizer::reportSizerOutput(state,
    3492             :                                                  "PlantLoop",
    3493          34 :                                                  state.dataPlnt->PlantLoop(LoopNum).Name,
    3494             :                                                  "Maximum Loop Flow Rate [m3/s]",
    3495          34 :                                                  state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3496          10 :                 } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3497          20 :                     BaseSizer::reportSizerOutput(state,
    3498             :                                                  "CondenserLoop",
    3499          10 :                                                  state.dataPlnt->PlantLoop(LoopNum).Name,
    3500             :                                                  "Maximum Loop Flow Rate [m3/s]",
    3501          10 :                                                  state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
    3502             :                 }
    3503             :             }
    3504             :         }
    3505             :     }
    3506             : 
    3507             :     // Small loop mass no longer introduces instability. Checks and warnings removed by SJR 20 July 2007.
    3508          44 :     if (state.dataPlnt->PlantLoop(LoopNum).VolumeWasAutoSized) {
    3509             :         // There is no stability requirement (mass can be zero), autosizing is based on loop circulation time.
    3510             :         // Note this calculation also appears in PlantManager::SizePlantLoop and SizingAnalysisObjects::ResolveDesignFlowRate
    3511          44 :         state.dataPlnt->PlantLoop(LoopNum).Volume =
    3512          44 :             state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * state.dataPlnt->PlantLoop(LoopNum).CirculationTime * 60.0;
    3513          44 :         if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
    3514             :             // condenser loop vs plant loop breakout needed.
    3515          68 :             BaseSizer::reportSizerOutput(
    3516          34 :                 state, "PlantLoop", state.dataPlnt->PlantLoop(LoopNum).Name, "Plant Loop Volume [m3]", state.dataPlnt->PlantLoop(LoopNum).Volume);
    3517          10 :         } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
    3518          20 :             BaseSizer::reportSizerOutput(state,
    3519             :                                          "CondenserLoop",
    3520          10 :                                          state.dataPlnt->PlantLoop(LoopNum).Name,
    3521             :                                          "Condenser Loop Volume [m3]",
    3522          10 :                                          state.dataPlnt->PlantLoop(LoopNum).Volume);
    3523             :         }
    3524             :     }
    3525             : 
    3526             :     // should now have plant volume, calculate plant volume's mass for fluid type
    3527          44 :     if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) {
    3528          44 :         FluidDensity = FluidProperties::GetDensityGlycol(
    3529          44 :             state, state.dataPlnt->PlantLoop(LoopNum).FluidName, Constant::InitConvTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);
    3530           0 :     } else if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) {
    3531             :         FluidDensity =
    3532           0 :             FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, 100.0, 1.0, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);
    3533             :     } else {
    3534           0 :         assert(false);
    3535             :     }
    3536             : 
    3537          44 :     state.dataPlnt->PlantLoop(LoopNum).Mass = state.dataPlnt->PlantLoop(LoopNum).Volume * FluidDensity;
    3538             : 
    3539          44 :     state.dataPlnt->PlantLoop(LoopNum).MaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * FluidDensity;
    3540          44 :     state.dataPlnt->PlantLoop(LoopNum).MinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * FluidDensity;
    3541             : 
    3542          44 :     if (ErrorsFound) {
    3543           0 :         ShowFatalError(state, "Preceding sizing errors cause program termination");
    3544             :     }
    3545          44 : }
    3546             : 
    3547         796 : void SetupInitialPlantCallingOrder(EnergyPlusData &state)
    3548             : {
    3549             : 
    3550             :     // SUBROUTINE INFORMATION:
    3551             :     //       AUTHOR         Brent Griffith
    3552             :     //       DATE WRITTEN   Feb 2010
    3553             :     //       MODIFIED       na
    3554             :     //       RE-ENGINEERED  na
    3555             : 
    3556             :     // PURPOSE OF THIS SUBROUTINE:
    3557             :     // setup the order that plant loops are to be called
    3558             : 
    3559             :     // METHODOLOGY EMPLOYED:
    3560             :     // simple rule-based allocation of which order to call the half loops
    3561             :     //  initially just mimicing historical practice until a better set of rules is
    3562             :     // developed
    3563             :     // 1.  first call all plant demand sides
    3564             :     // 2.  second call all plant supply sides
    3565             :     // 3.  third call all condenser demand sides
    3566             :     // 4.  fourth call all condenser supply sides
    3567             : 
    3568             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3569             :     int OrderIndex; // local
    3570             :     int I;          // local loop
    3571             : 
    3572         796 :     state.dataPlnt->TotNumHalfLoops = 2 * state.dataPlnt->TotNumLoops;
    3573             : 
    3574         796 :     if (state.dataPlnt->TotNumHalfLoops <= 0) return;
    3575             : 
    3576             :     // first allocate to total number of plant half loops
    3577             : 
    3578         459 :     if (!allocated(state.dataPlnt->PlantCallingOrderInfo)) state.dataPlnt->PlantCallingOrderInfo.allocate(state.dataPlnt->TotNumHalfLoops);
    3579             : 
    3580             :     // set plant loop demand sides
    3581        1349 :     for (I = 1; I <= state.dataHVACGlobal->NumPlantLoops; ++I) {
    3582         890 :         state.dataPlnt->PlantCallingOrderInfo(I).LoopIndex = I;
    3583         890 :         state.dataPlnt->PlantCallingOrderInfo(I).LoopSide = LoopSideLocation::Demand;
    3584             :     }
    3585             : 
    3586             :     // set plant loop supply sides
    3587        1349 :     for (I = 1; I <= state.dataHVACGlobal->NumPlantLoops; ++I) {
    3588         890 :         OrderIndex = I + state.dataHVACGlobal->NumPlantLoops;
    3589         890 :         state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopIndex = I;
    3590         890 :         state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopSide = LoopSideLocation::Supply;
    3591             :     }
    3592             : 
    3593             :     // set condenser Loop demand sides
    3594         717 :     for (I = 1; I <= state.dataHVACGlobal->NumCondLoops; ++I) {
    3595         258 :         OrderIndex = 2 * state.dataHVACGlobal->NumPlantLoops + I;
    3596         258 :         state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopIndex = state.dataHVACGlobal->NumPlantLoops + I;
    3597         258 :         state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopSide = LoopSideLocation::Demand;
    3598             :     }
    3599             : 
    3600             :     // set condenser Loop supply sides
    3601         717 :     for (I = 1; I <= state.dataHVACGlobal->NumCondLoops; ++I) {
    3602         258 :         OrderIndex = 2 * state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops + I;
    3603         258 :         state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopIndex = state.dataHVACGlobal->NumPlantLoops + I;
    3604         258 :         state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopSide = LoopSideLocation::Supply;
    3605             :     }
    3606             : }
    3607             : 
    3608        1832 : void RevisePlantCallingOrder(EnergyPlusData &state)
    3609             : {
    3610             : 
    3611             :     // SUBROUTINE INFORMATION:
    3612             :     //       AUTHOR         Brent Griffith
    3613             :     //       DATE WRITTEN   april 2011
    3614             :     //       MODIFIED       na
    3615             :     //       RE-ENGINEERED  na
    3616             : 
    3617             :     // PURPOSE OF THIS SUBROUTINE:
    3618             :     // setup the order that plant loops are to be called
    3619             : 
    3620             :     // METHODOLOGY EMPLOYED:
    3621             :     // simple rule-based allocation of which order to call the half loops
    3622             :     // Examine for interconnected components and rearrange to impose the following rules
    3623             : 
    3624             :     // Using/Aliasing
    3625             :     using PlantUtilities::ShiftPlantLoopSideCallingOrder;
    3626             : 
    3627             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3628             :     int HalfLoopNum;
    3629             :     int LoopNum;
    3630             :     DataPlant::LoopSideLocation LoopSideNum;
    3631             :     int OtherLoopNum;
    3632             :     DataPlant::LoopSideLocation OtherLoopSideNum;
    3633             : 
    3634             :     bool thisLoopPutsDemandOnAnother;
    3635             :     int ConnctNum;
    3636             : 
    3637       11008 :     for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    3638             : 
    3639        9176 :         LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
    3640        9176 :         LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
    3641             : 
    3642        9176 :         if (allocated(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected)) {
    3643        6122 :             for (ConnctNum = 1; ConnctNum <= isize(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected); ++ConnctNum) {
    3644        3665 :                 OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopNum;
    3645        3665 :                 OtherLoopSideNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopSideNum;
    3646        3665 :                 state.dataPlantMgr->OtherLoopCallingIndex = FindLoopSideInCallingOrder(state, OtherLoopNum, OtherLoopSideNum);
    3647             : 
    3648        3665 :                 thisLoopPutsDemandOnAnother = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopDemandsOnRemote;
    3649        3665 :                 if (thisLoopPutsDemandOnAnother) {                                 // make sure this loop side is called before the other loop side
    3650        1790 :                     if (state.dataPlantMgr->OtherLoopCallingIndex < HalfLoopNum) { // rearrange
    3651           1 :                         state.dataPlantMgr->newCallingIndex = min(HalfLoopNum + 1, state.dataPlnt->TotNumHalfLoops);
    3652           1 :                         ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
    3653             :                     }
    3654             : 
    3655             :                 } else {                                                           // make sure the other is called before this one
    3656        1875 :                     if (state.dataPlantMgr->OtherLoopCallingIndex > HalfLoopNum) { // rearrange
    3657          53 :                         state.dataPlantMgr->newCallingIndex = max(HalfLoopNum, 1);
    3658             : 
    3659          53 :                         if (OtherLoopSideNum == LoopSideLocation::Supply) { // if this is a supply side, don't push it before its own demand side
    3660         106 :                             state.dataPlantMgr->OtherLoopDemandSideCallingIndex =
    3661          53 :                                 FindLoopSideInCallingOrder(state, OtherLoopNum, LoopSideLocation::Demand);
    3662          53 :                             if (state.dataPlantMgr->OtherLoopDemandSideCallingIndex < HalfLoopNum) { // good to go
    3663          29 :                                 state.dataPlantMgr->newCallingIndex = min(state.dataPlantMgr->OtherLoopDemandSideCallingIndex + 1,
    3664          29 :                                                                           state.dataPlnt->TotNumHalfLoops); // put it right after its demand side
    3665          29 :                                 ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
    3666             :                             } else { // move both sides of other loop before this, keeping demand side in front
    3667          24 :                                 state.dataPlantMgr->NewOtherDemandSideCallingIndex = max(HalfLoopNum, 1);
    3668          24 :                                 ShiftPlantLoopSideCallingOrder(
    3669          24 :                                     state, state.dataPlantMgr->OtherLoopDemandSideCallingIndex, state.dataPlantMgr->NewOtherDemandSideCallingIndex);
    3670             :                                 // get fresh pointer after it has changed in previous call
    3671          24 :                                 state.dataPlantMgr->OtherLoopCallingIndex = FindLoopSideInCallingOrder(state, OtherLoopNum, OtherLoopSideNum);
    3672          24 :                                 state.dataPlantMgr->newCallingIndex = state.dataPlantMgr->NewOtherDemandSideCallingIndex + 1;
    3673          24 :                                 ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
    3674             :                             }
    3675             :                         } else {
    3676           0 :                             ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
    3677             :                         }
    3678             :                     }
    3679             :                 }
    3680             :             }
    3681             :         }
    3682             :     }
    3683        1832 : }
    3684             : 
    3685        3742 : int FindLoopSideInCallingOrder(EnergyPlusData &state, int const LoopNum, const LoopSideLocation LoopSide)
    3686             : {
    3687             : 
    3688             :     // FUNCTION INFORMATION:
    3689             :     //       AUTHOR         B. Griffith
    3690             :     //       DATE WRITTEN   April 2011
    3691             :     //       MODIFIED       na
    3692             :     //       RE-ENGINEERED  na
    3693             : 
    3694             :     // PURPOSE OF THIS FUNCTION:
    3695             :     // locate loop and loop side in calling order structure
    3696             : 
    3697             :     // METHODOLOGY EMPLOYED:
    3698             :     // returns integer "pointer" index to calling order structure
    3699             : 
    3700             :     // REFERENCES:
    3701             :     // na
    3702             : 
    3703             :     // USE STATEMENTS:
    3704             :     // na
    3705             : 
    3706             :     // Return value
    3707             :     int CallingIndex;
    3708             : 
    3709             :     // Locals
    3710             :     // FUNCTION ARGUMENT DEFINITIONS:
    3711             : 
    3712             :     // FUNCTION PARAMETER DEFINITIONS:
    3713             :     // na
    3714             : 
    3715             :     // INTERFACE BLOCK SPECIFICATIONS:
    3716             :     // na
    3717             : 
    3718             :     // DERIVED TYPE DEFINITIONS:
    3719             :     // na
    3720             : 
    3721             :     // FUNCTION LOCAL VARIABLE DECLARATIONS:
    3722             :     int HalfLoopNum;
    3723             : 
    3724        3742 :     CallingIndex = 0;
    3725             : 
    3726       29592 :     for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
    3727       33334 :         if ((LoopNum == state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex) &&
    3728        7484 :             (LoopSide == state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide)) {
    3729             : 
    3730        3742 :             CallingIndex = HalfLoopNum;
    3731             :         }
    3732             :     }
    3733        3742 :     return CallingIndex;
    3734             : }
    3735             : 
    3736         796 : void SetupBranchControlTypes(EnergyPlusData &state)
    3737             : {
    3738             : 
    3739             :     // SUBROUTINE INFORMATION:
    3740             :     //       AUTHOR         Brent Griffith
    3741             :     //       DATE WRITTEN   March 2010
    3742             :     //       MODIFIED       na
    3743             :     //       RE-ENGINEERED  na
    3744             : 
    3745             :     // PURPOSE OF THIS SUBROUTINE:
    3746             :     // set the control types on plant branches using heuristics.
    3747             :     //  Trying to obsolete branch control type  input
    3748             : 
    3749             :     // METHODOLOGY EMPLOYED:
    3750             :     // set component control types based on component type
    3751             :     //  process branches and set branch level control types based on the type of components on them
    3752             :     //  Rules applied
    3753             :     //   - Most component models are active
    3754             :     //   - Pipes are passive unless located between splitter/mixers when assumed to be bypass
    3755             :     //   - A branch with multiple active components becomes SeriesActive and so do its components
    3756             : 
    3757             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3758             :     int LoopCtr;
    3759             :     int BranchCtr;
    3760             :     int CompCtr;
    3761             :     bool BranchIsInSplitterMixer;
    3762             :     DataBranchAirLoopPlant::ControlType ComponentFlowCtrl;
    3763             :     int ActiveCount;
    3764             :     int BypassCount;
    3765             :     int NumComponentsOnBranch;
    3766             :     int NumCount;
    3767             : 
    3768             :     // first set component level control type (obsoletes one input in field set for Branch )
    3769         796 :     if (allocated(state.dataPlnt->PlantLoop)) {
    3770         796 :         NumCount = size(state.dataPlnt->PlantLoop);
    3771             :     } else {
    3772           0 :         NumCount = 0;
    3773             :     }
    3774        1944 :     for (LoopCtr = 1; LoopCtr <= NumCount; ++LoopCtr) {
    3775        3444 :         for (DataPlant::LoopSideLocation LoopSideCtr : DataPlant::LoopSideKeys) {
    3776       15746 :             for (BranchCtr = 1; BranchCtr <= state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).TotalBranches; ++BranchCtr) {
    3777       13450 :                 BranchIsInSplitterMixer = false;
    3778             :                 // test if this branch is inside a splitter/mixer
    3779       13450 :                 if (state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Splitter.Exists) {
    3780       13417 :                     if ((BranchCtr > 1) && (BranchCtr < state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).TotalBranches)) {
    3781        8891 :                         BranchIsInSplitterMixer = true;
    3782             :                     }
    3783             :                 }
    3784             : 
    3785       13450 :                 NumComponentsOnBranch = state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).TotalComponents;
    3786             : 
    3787       26984 :                 for (CompCtr = 1; CompCtr <= isize(state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp); ++CompCtr) {
    3788             : 
    3789       13534 :                     auto &this_component(state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp(CompCtr));
    3790             : 
    3791       13534 :                     switch (this_component.Type) {
    3792           0 :                     case DataPlant::PlantEquipmentType::Invalid: { //                             = -1
    3793           0 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
    3794           0 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
    3795           0 :                         this_component.HowLoadServed = DataPlant::HowMet::Invalid;
    3796           0 :                     } break;
    3797         208 :                     case DataPlant::PlantEquipmentType::Boiler_Simple: { //         =  1
    3798         208 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3799         208 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3800         208 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapHiOutLimit;
    3801         208 :                     } break;
    3802           8 :                     case DataPlant::PlantEquipmentType::Boiler_Steam: { //                      =  2
    3803           8 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3804           8 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3805           8 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3806           8 :                     } break;
    3807           4 :                     case DataPlant::PlantEquipmentType::Chiller_Absorption: { // = 3 ! older BLAST absorption chiller
    3808           4 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3809           4 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3810           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3811           2 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3812             :                         } else {
    3813           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3814           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3815             :                         }
    3816           4 :                     } break;
    3817           5 :                     case DataPlant::PlantEquipmentType::Chiller_Indirect_Absorption: { // = 4 ! revised absorption chiller
    3818           5 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3819           5 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3820           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3821           3 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3822             :                         } else {
    3823           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3824           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3825             :                         }
    3826           5 :                     } break;
    3827           5 :                     case DataPlant::PlantEquipmentType::Chiller_CombTurbine: { //           =  5
    3828           5 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3829           5 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3830           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3831           3 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3832             :                         } else {
    3833           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3834           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3835             :                         }
    3836           5 :                     } break;
    3837         185 :                     case DataPlant::PlantEquipmentType::Chiller_ConstCOP: { //                 =  6
    3838         185 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3839             : 
    3840         185 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3841          91 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3842          91 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3843             :                         } else {
    3844          94 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3845          94 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3846             :                         }
    3847         185 :                     } break;
    3848           3 :                     case DataPlant::PlantEquipmentType::Chiller_DFAbsorption: { //             =  7
    3849           3 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3850           3 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3851           1 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3852           1 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3853             :                         } else {
    3854           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    3855           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3856             :                         }
    3857           3 :                     } break;
    3858           3 :                     case DataPlant::PlantEquipmentType::Chiller_ExhFiredAbsorption: { //             =  76
    3859           3 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3860           3 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3861           1 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3862           1 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3863             :                         } else {
    3864           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    3865           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3866             :                         }
    3867           3 :                     } break;
    3868         378 :                     case DataPlant::PlantEquipmentType::Chiller_Electric: { //                 =  8
    3869         378 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3870         378 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3871         163 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3872         163 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3873             :                         } else {
    3874         215 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3875         215 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3876             :                         }
    3877         378 :                     } break;
    3878          97 :                     case DataPlant::PlantEquipmentType::Chiller_ElectricEIR: { //              =  9
    3879          97 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3880          97 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3881          45 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3882          45 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3883             :                         } else {
    3884          52 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3885          52 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3886             :                         }
    3887          97 :                     } break;
    3888          82 :                     case DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR: { //        = 10
    3889          82 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3890          82 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3891          41 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3892          41 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3893             :                         } else {
    3894          41 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3895          41 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3896             :                         }
    3897          82 :                     } break;
    3898          27 :                     case DataPlant::PlantEquipmentType::Chiller_EngineDriven: { //             = 11
    3899          27 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3900          27 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3901          27 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3902          15 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3903          15 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3904             :                         } else {
    3905          12 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3906          12 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    3907             :                         }
    3908          27 :                     } break;
    3909         231 :                     case DataPlant::PlantEquipmentType::CoolingTower_SingleSpd: { //           = 12
    3910         231 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3911         231 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3912         231 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3913         231 :                     } break;
    3914          13 :                     case DataPlant::PlantEquipmentType::CoolingTower_TwoSpd: { //              = 13
    3915          13 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3916          13 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3917          13 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3918          13 :                     } break;
    3919          24 :                     case DataPlant::PlantEquipmentType::CoolingTower_VarSpd: { //              = 14
    3920          24 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3921          24 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3922          24 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3923          24 :                     } break;
    3924           2 :                     case DataPlant::PlantEquipmentType::CoolingTower_VarSpdMerkel: { //              = 89
    3925           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3926           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3927           2 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3928           2 :                     } break;
    3929           2 :                     case DataPlant::PlantEquipmentType::Generator_FCExhaust: { //              = 15
    3930           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3931           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3932           2 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    3933           2 :                     } break;
    3934          10 :                     case PlantEquipmentType::HeatPumpWtrHeaterPumped:
    3935             :                     case DataPlant::PlantEquipmentType::HeatPumpWtrHeaterWrapped: { //                = 16, 92
    3936          10 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3937          10 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3938          10 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    3939          10 :                     } break;
    3940           4 :                     case DataPlant::PlantEquipmentType::HPWaterEFCooling: { //                 = 17
    3941           4 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3942           4 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3943           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3944           2 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3945             :                         } else {
    3946           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3947           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3948             :                         }
    3949           4 :                     } break;
    3950           4 :                     case DataPlant::PlantEquipmentType::HPWaterEFHeating: { //                 = 18
    3951           4 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3952           4 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3953           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3954           2 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3955             :                         } else {
    3956           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3957           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3958             :                         }
    3959           4 :                     } break;
    3960           6 :                     case DataPlant::PlantEquipmentType::HPWaterPECooling: { //                 = 19
    3961           6 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3962           6 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3963           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3964           3 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3965             :                         } else {
    3966           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    3967           3 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3968             :                         }
    3969           6 :                     } break;
    3970           6 :                     case DataPlant::PlantEquipmentType::HPWaterPEHeating: { //                 = 20
    3971           6 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    3972           6 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    3973           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    3974           3 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3975             :                         } else {
    3976           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    3977           3 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    3978             :                         }
    3979           6 :                     } break;
    3980        5497 :                     case DataPlant::PlantEquipmentType::Pipe: { //                             = 21
    3981        5497 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3982        5497 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3983        5497 :                         if (BranchIsInSplitterMixer) {
    3984        2140 :                             if (NumComponentsOnBranch == 1) {
    3985        2139 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    3986           1 :                             } else if (NumComponentsOnBranch > 1) {
    3987           1 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    3988             :                             } else {
    3989           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    3990             :                             }
    3991             :                         } else {
    3992        3357 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    3993             :                         }
    3994        5497 :                     } break;
    3995          39 :                     case DataPlant::PlantEquipmentType::PipeSteam: { //                        = 22
    3996          39 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    3997          39 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    3998          39 :                         if (BranchIsInSplitterMixer) {
    3999          12 :                             if (NumComponentsOnBranch == 1) {
    4000          12 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4001           0 :                             } else if (NumComponentsOnBranch > 1) {
    4002           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4003             :                             } else {
    4004           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4005             :                             }
    4006             :                         } else {
    4007          27 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4008             :                         }
    4009          39 :                     } break;
    4010           1 :                     case DataPlant::PlantEquipmentType::PipeExterior: { //                     = 23
    4011           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4012           1 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4013           1 :                         if (BranchIsInSplitterMixer) {
    4014           1 :                             if (NumComponentsOnBranch == 1) {
    4015           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4016           1 :                             } else if (NumComponentsOnBranch > 1) {
    4017           1 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4018             :                             } else {
    4019           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4020             :                             }
    4021             :                         } else {
    4022           0 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4023             :                         }
    4024           1 :                     } break;
    4025           2 :                     case DataPlant::PlantEquipmentType::PipeInterior: { //                     = 24
    4026           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4027           2 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4028           2 :                         if (BranchIsInSplitterMixer) {
    4029           2 :                             if (NumComponentsOnBranch == 1) {
    4030           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4031           2 :                             } else if (NumComponentsOnBranch > 1) {
    4032           2 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4033             :                             } else {
    4034           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4035             :                             }
    4036             :                         } else {
    4037           0 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4038             :                         }
    4039           2 :                     } break;
    4040           1 :                     case DataPlant::PlantEquipmentType::PipeUnderground: { //                  = 25
    4041           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4042           1 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4043           1 :                         if (BranchIsInSplitterMixer) {
    4044           1 :                             if (NumComponentsOnBranch == 1) {
    4045           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4046           1 :                             } else if (NumComponentsOnBranch > 1) {
    4047           1 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4048             :                             } else {
    4049           0 :                                 this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
    4050             :                             }
    4051             :                         } else {
    4052           0 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
    4053             :                         }
    4054           1 :                     } break;
    4055         133 :                     case DataPlant::PlantEquipmentType::PurchChilledWater: { //                = 26
    4056         133 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4057         133 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4058         133 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    4059         133 :                     } break;
    4060         144 :                     case DataPlant::PlantEquipmentType::PurchHotWater: { //                    = 27
    4061         144 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4062         144 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4063         144 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapHiOutLimit;
    4064         144 :                     } break;
    4065           1 :                     case DataPlant::PlantEquipmentType::PurchSteam: { //
    4066           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4067           1 :                     } break;
    4068           7 :                     case DataPlant::PlantEquipmentType::TS_IceDetailed: { //                   = 28
    4069           7 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4070           7 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4071           7 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4072           7 :                     } break;
    4073           2 :                     case DataPlant::PlantEquipmentType::TS_IceSimple: { //                    = 29
    4074           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4075           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4076           2 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4077           2 :                     } break;
    4078           2 :                     case DataPlant::PlantEquipmentType::ValveTempering: { //                  = 30
    4079           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4080           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4081           2 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4082           2 :                     } break;
    4083         129 :                     case DataPlant::PlantEquipmentType::WtrHeaterMixed: { //                   = 31
    4084         129 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4085           2 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4086           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4087           2 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4088             :                         } else {
    4089         127 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4090         127 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4091         127 :                             this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4092             :                         }
    4093         129 :                     } break;
    4094           3 :                     case DataPlant::PlantEquipmentType::WtrHeaterStratified: { //              = 32
    4095           3 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4096           1 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4097           1 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4098           1 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4099             :                         } else {
    4100           2 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4101           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4102           2 :                             this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4103             :                         }
    4104           3 :                     } break;
    4105         945 :                     case DataPlant::PlantEquipmentType::PumpVariableSpeed: { //                 = 33
    4106         945 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4107         945 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4108         945 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4109         945 :                     } break;
    4110         209 :                     case DataPlant::PlantEquipmentType::PumpConstantSpeed: { //                 = 34
    4111         209 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4112         209 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4113         209 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4114         209 :                     } break;
    4115           9 :                     case DataPlant::PlantEquipmentType::PumpCondensate: { //                    = 35
    4116           9 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4117           9 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4118           9 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4119           9 :                     } break;
    4120           6 :                     case DataPlant::PlantEquipmentType::PumpBankVariableSpeed: { //             = 36
    4121           6 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4122           6 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4123           6 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4124           6 :                     } break;
    4125           1 :                     case DataPlant::PlantEquipmentType::PumpBankConstantSpeed: { //             = 37
    4126           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4127           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4128           1 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4129           1 :                     } break;
    4130         913 :                     case DataPlant::PlantEquipmentType::WaterUseConnection: { //              = 38
    4131         913 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4132         913 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4133         913 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4134         913 :                     } break;
    4135         434 :                     case DataPlant::PlantEquipmentType::CoilWaterCooling: { //               = 39  ! demand side component
    4136         434 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4137         434 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4138         434 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4139         434 :                     } break;
    4140         150 :                     case DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling: { //      = 40  ! demand side component
    4141         150 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4142         150 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4143         150 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4144         150 :                     } break;
    4145        2729 :                     case DataPlant::PlantEquipmentType::CoilWaterSimpleHeating: { //           = 41  ! demand side component
    4146        2729 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4147        2729 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4148        2729 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4149        2729 :                     } break;
    4150          20 :                     case DataPlant::PlantEquipmentType::CoilSteamAirHeating: { //         = 42  ! demand side component
    4151          20 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4152          20 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4153          20 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4154          20 :                     } break;
    4155           8 :                     case DataPlant::PlantEquipmentType::SolarCollectorFlatPlate: { //         = 43  ! demand side component
    4156           8 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4157           8 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4158           8 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4159           8 :                     } break;
    4160          28 :                     case DataPlant::PlantEquipmentType::PlantLoadProfile: { //            = 44  ! demand side component
    4161          28 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4162          28 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4163          28 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4164          28 :                     } break;
    4165          23 :                     case DataPlant::PlantEquipmentType::GrndHtExchgSystem: { //            = 45
    4166          23 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4167          23 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4168          23 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4169          23 :                     } break;
    4170           1 :                     case DataPlant::PlantEquipmentType::GrndHtExchgSurface: { //            = 46
    4171           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4172           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4173           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4174           1 :                     } break;
    4175           3 :                     case DataPlant::PlantEquipmentType::GrndHtExchgPond: { //            = 47
    4176           3 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4177           3 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4178           3 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4179           3 :                     } break;
    4180           2 :                     case DataPlant::PlantEquipmentType::Generator_MicroTurbine: { //          = 48  !newer FSEC turbine
    4181           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4182           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4183           2 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4184           2 :                     } break;
    4185           3 :                     case DataPlant::PlantEquipmentType::Generator_ICEngine: { //             = 49
    4186           3 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4187           3 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4188           3 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4189           3 :                     } break;
    4190           3 :                     case DataPlant::PlantEquipmentType::Generator_CTurbine: { //             = 50  !older BLAST turbine
    4191           3 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4192           3 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4193           3 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4194           3 :                     } break;
    4195           2 :                     case DataPlant::PlantEquipmentType::Generator_MicroCHP: { //              = 51
    4196           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4197           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4198           2 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4199           2 :                     } break;
    4200           0 :                     case DataPlant::PlantEquipmentType::Generator_FCStackCooler: { //         = 52
    4201           0 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4202           0 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4203           0 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4204           0 :                     } break;
    4205           1 :                     case DataPlant::PlantEquipmentType::FluidCooler_SingleSpd: { //           = 53
    4206           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4207           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4208           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4209           1 :                     } break;
    4210           5 :                     case DataPlant::PlantEquipmentType::FluidCooler_TwoSpd: { //            = 54
    4211           5 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4212           5 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4213           5 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4214           5 :                     } break;
    4215           1 :                     case DataPlant::PlantEquipmentType::EvapFluidCooler_SingleSpd: { //       = 55
    4216           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4217           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4218           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4219           1 :                     } break;
    4220           2 :                     case DataPlant::PlantEquipmentType::EvapFluidCooler_TwoSpd: { //         = 56
    4221           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4222           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4223           2 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4224           2 :                     } break;
    4225           7 :                     case DataPlant::PlantEquipmentType::ChilledWaterTankMixed: { //         = 57
    4226           7 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4227           3 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4228           3 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4229           3 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4230             :                         } else {
    4231           4 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4232           4 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4233           4 :                             this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4234             :                         }
    4235           7 :                     } break;
    4236           3 :                     case DataPlant::PlantEquipmentType::ChilledWaterTankStratified: { //      = 58
    4237           3 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4238           1 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4239           1 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4240           1 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4241             :                         } else {
    4242           2 :                             this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4243           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4244           2 :                             this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4245             :                         }
    4246           3 :                     } break;
    4247          10 :                     case DataPlant::PlantEquipmentType::PVTSolarCollectorFlatPlate: { //      = 59
    4248          10 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4249          10 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4250          10 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4251             :                         // next batch for ZoneHVAC
    4252          10 :                     } break;
    4253          30 :                     case DataPlant::PlantEquipmentType::Baseboard_Conv_Water: { //        = 60
    4254          30 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4255          30 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4256          30 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4257          30 :                     } break;
    4258           2 :                     case DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Steam: { //      = 61
    4259           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4260           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4261           2 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4262           2 :                     } break;
    4263          17 :                     case DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Water: { //      = 62
    4264          17 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4265          17 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4266          17 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4267          17 :                     } break;
    4268           4 :                     case DataPlant::PlantEquipmentType::CoolingPanel_Simple: {
    4269           4 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4270           4 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4271           4 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4272           4 :                     } break;
    4273          89 :                     case DataPlant::PlantEquipmentType::LowTempRadiant_VarFlow: {
    4274          89 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4275          89 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4276          89 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4277          89 :                     } break;
    4278          51 :                     case DataPlant::PlantEquipmentType::LowTempRadiant_ConstFlow: {
    4279          51 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4280          51 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4281          51 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4282          51 :                     } break;
    4283           5 :                     case DataPlant::PlantEquipmentType::CooledBeamAirTerminal: {
    4284           5 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4285           5 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4286           5 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4287           5 :                     } break;
    4288          60 :                     case DataPlant::PlantEquipmentType::FourPipeBeamAirTerminal: {
    4289          60 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4290          60 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4291          60 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4292          60 :                     } break;
    4293         137 :                     case DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit: {
    4294         137 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4295         137 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4296         137 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4297         137 :                     } break;
    4298         137 :                     case DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit: {
    4299         137 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4300         137 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4301         137 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4302         137 :                     } break;
    4303          18 :                     case DataPlant::PlantEquipmentType::CoilVSWAHPHeatingEquationFit: {
    4304          18 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4305          18 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4306          18 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4307          18 :                     } break;
    4308          18 :                     case DataPlant::PlantEquipmentType::CoilVSWAHPCoolingEquationFit: {
    4309          18 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4310          18 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4311          18 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4312          18 :                     } break;
    4313          19 :                     case DataPlant::PlantEquipmentType::CoilWAHPHeatingParamEst: {
    4314          19 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4315          19 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4316          19 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4317          19 :                     } break;
    4318          19 :                     case DataPlant::PlantEquipmentType::CoilWAHPCoolingParamEst: {
    4319          19 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4320          19 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4321          19 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4322          19 :                     } break;
    4323           1 :                     case DataPlant::PlantEquipmentType::RefrigSystemWaterCondenser: {
    4324           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4325           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4326           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4327           1 :                     } break;
    4328           1 :                     case DataPlant::PlantEquipmentType::RefrigerationWaterCoolRack: {
    4329           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4330           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4331           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4332           1 :                     } break;
    4333           0 :                     case DataPlant::PlantEquipmentType::MultiSpeedHeatPumpRecovery: {
    4334           0 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4335           0 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4336           0 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4337           0 :                     } break;
    4338           0 :                     case DataPlant::PlantEquipmentType::UnitarySysRecovery: {
    4339           0 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4340           0 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4341           0 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4342           0 :                     } break;
    4343           4 :                     case DataPlant::PlantEquipmentType::PipingSystemPipeCircuit: {
    4344           4 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4345           4 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4346           4 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4347           4 :                     } break;
    4348           2 :                     case DataPlant::PlantEquipmentType::SolarCollectorICS: { //         = 75
    4349           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4350           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4351           2 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4352           2 :                     } break;
    4353           2 :                     case DataPlant::PlantEquipmentType::PlantComponentUserDefined: {
    4354           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4355           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
    4356           2 :                         this_component.HowLoadServed = DataPlant::HowMet::Invalid;
    4357           2 :                     } break;
    4358           6 :                     case DataPlant::PlantEquipmentType::CoilUserDefined: {
    4359           6 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4360           6 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
    4361           6 :                         this_component.HowLoadServed = DataPlant::HowMet::Invalid;
    4362           6 :                     } break;
    4363           0 :                     case DataPlant::PlantEquipmentType::ZoneHVACAirUserDefined: {
    4364           0 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4365           0 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
    4366           0 :                         this_component.HowLoadServed = DataPlant::HowMet::Invalid;
    4367           0 :                     } break;
    4368          10 :                     case DataPlant::PlantEquipmentType::AirTerminalUserDefined: {
    4369          10 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4370          10 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
    4371          10 :                         this_component.HowLoadServed = DataPlant::HowMet::Invalid;
    4372          10 :                     } break;
    4373           1 :                     case DataPlant::PlantEquipmentType::HeatPumpVRF: { //       =  82  ! AirConditioner:VariableRefrigerantFlow
    4374           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4375             : 
    4376           1 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4377           1 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4378           1 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4379             :                         } else { // should never happen
    4380           0 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4381           0 :                             this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4382             :                         }
    4383           1 :                     } break;
    4384           1 :                     case DataPlant::PlantEquipmentType::WaterSource: {
    4385           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4386           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4387           1 :                         this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    4388           1 :                     } break;
    4389           1 :                     case DataPlant::PlantEquipmentType::GrndHtExchgHorizTrench: { // = 83  GroundHeatExchanger:HorizontalTrench
    4390           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4391           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4392           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4393           1 :                     } break;
    4394          64 :                     case DataPlant::PlantEquipmentType::FluidToFluidPlantHtExchg: { //          = 84
    4395          64 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4396          64 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4397          32 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4398          32 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4399             :                         } else {
    4400          32 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4401          32 :                             this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4402             :                         }
    4403          64 :                     } break;
    4404           6 :                     case DataPlant::PlantEquipmentType::CentralGroundSourceHeatPump: { // 86
    4405           6 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4406           6 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4407           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4408           2 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4409             :                         } else {
    4410           4 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4411           4 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4412             :                         }
    4413           6 :                     } break;
    4414           1 :                     case DataPlant::PlantEquipmentType::PackagedTESCoolingCoil: { // 88
    4415           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4416           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4417           1 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4418           1 :                     } break;
    4419           2 :                     case DataPlant::PlantEquipmentType::SwimmingPool_Indoor: { // 90
    4420           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4421           2 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4422           2 :                         this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4423           2 :                     } break;
    4424           1 :                     case DataPlant::PlantEquipmentType::GrndHtExchgSlinky: { //            = 91
    4425           1 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4426           1 :                         this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4427           1 :                         this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
    4428           1 :                     } break;
    4429          23 :                     case DataPlant::PlantEquipmentType::HeatPumpEIRCooling:
    4430             :                     case PlantEquipmentType::HeatPumpEIRHeating: { // 95, 96
    4431          23 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4432          23 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4433           5 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4434           5 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4435             :                         } else {
    4436          18 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4437          18 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4438             :                         }
    4439          23 :                     } break;
    4440           2 :                     case DataPlant::PlantEquipmentType::HeatPumpFuelFiredCooling:
    4441             :                     case PlantEquipmentType::HeatPumpFuelFiredHeating: {
    4442           2 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4443           2 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4444           0 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4445           0 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4446             :                         } else {
    4447           2 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
    4448           2 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
    4449             :                         }
    4450           2 :                     } break;
    4451          14 :                     case DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205: {
    4452          14 :                         this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
    4453          14 :                         if (LoopSideCtr == LoopSideLocation::Demand) {
    4454           9 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
    4455           9 :                             this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
    4456             :                         } else {
    4457           5 :                             this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
    4458           5 :                             this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
    4459             :                         }
    4460          14 :                     } break;
    4461           0 :                     default: {
    4462           0 :                         ShowSevereError(state, "SetBranchControlTypes: Caught unexpected equipment type of number");
    4463           0 :                     } break;
    4464             :                     }
    4465             :                 }
    4466             :             }
    4467             :         }
    4468             :     }
    4469             : 
    4470             :     // now set up branch control types based on components.
    4471             : 
    4472         796 :     if (allocated(state.dataPlnt->PlantLoop)) {
    4473         796 :         NumCount = size(state.dataPlnt->PlantLoop);
    4474             :     } else {
    4475           0 :         NumCount = 0;
    4476             :     }
    4477        1944 :     for (LoopCtr = 1; LoopCtr <= NumCount; ++LoopCtr) { // SIZE(PlantLoop)
    4478        3444 :         for (DataPlant::LoopSideLocation LoopSideCtr : DataPlant::LoopSideKeys) {
    4479       15746 :             for (BranchCtr = 1; BranchCtr <= state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).TotalBranches; ++BranchCtr) {
    4480       13450 :                 ActiveCount = 0;
    4481       13450 :                 BypassCount = 0;
    4482       26984 :                 for (CompCtr = 1; CompCtr <= isize(state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp); ++CompCtr) {
    4483       13534 :                     ComponentFlowCtrl = state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp(CompCtr).FlowCtrl;
    4484             : 
    4485       13534 :                     switch (ComponentFlowCtrl) {
    4486           0 :                     case DataBranchAirLoopPlant::ControlType::Invalid: {
    4487           0 :                         state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
    4488             :                             DataBranchAirLoopPlant::ControlType::Passive;
    4489           0 :                     } break;
    4490        7989 :                     case DataBranchAirLoopPlant::ControlType::Active: {
    4491        7989 :                         ++ActiveCount;
    4492        7989 :                         if (ActiveCount > 1) {
    4493             :                             //  assume multiple active components in series means branch is SeriesActive
    4494          64 :                             state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
    4495             :                                 DataBranchAirLoopPlant::ControlType::SeriesActive;
    4496             :                             // assume all components on branch are to be SeriesActive as well
    4497         200 :                             for (auto &e : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp)
    4498         136 :                                 e.FlowCtrl = DataBranchAirLoopPlant::ControlType::SeriesActive;
    4499             :                         } else {
    4500        7925 :                             state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
    4501             :                                 DataBranchAirLoopPlant::ControlType::Active;
    4502             :                         }
    4503             : 
    4504        7989 :                         if (BypassCount > 0) {
    4505           0 :                             ShowSevereError(state, "An active component is on the same branch as a pipe situated between splitter/mixer");
    4506           0 :                             ShowContinueError(state,
    4507           0 :                                               "Occurs in Branch=" + state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Name);
    4508           0 :                             ShowContinueError(state, "Occurs in Plant Loop=" + state.dataPlnt->PlantLoop(LoopCtr).Name);
    4509           0 :                             ShowContinueError(state, "SetupBranchControlTypes: and the simulation continues");
    4510             :                             //  note not sure why this is so bad.  heat transfer pipe might be a good reason to allow this?
    4511             :                             //   this used to fatal in older PlantFlowResolver.
    4512             :                         }
    4513             : 
    4514             :                         // test for active component in series with bypass
    4515        7989 :                     } break;
    4516        2151 :                     case DataBranchAirLoopPlant::ControlType::Bypass: {
    4517        2151 :                         ++BypassCount;
    4518        2151 :                         state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
    4519             :                             DataBranchAirLoopPlant::ControlType::Bypass;
    4520        2151 :                         state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).IsBypass = true;
    4521        2151 :                         state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).BypassExists = true;
    4522             : 
    4523        2151 :                         if (CompCtr > 1) {
    4524           0 :                             ShowSevereError(state, "A pipe used as a bypass should not be in series with another component");
    4525           0 :                             ShowContinueError(
    4526           0 :                                 state, "Occurs in Branch = " + state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Name);
    4527           0 :                             ShowContinueError(state, "Occurs in PlantLoop = " + state.dataPlnt->PlantLoop(LoopCtr).Name);
    4528           0 :                             ShowFatalError(state, "SetupBranchControlTypes: preceding condition causes termination.");
    4529             :                         }
    4530        2151 :                     } break;
    4531        3387 :                     case DataBranchAirLoopPlant::ControlType::Passive: {
    4532        3387 :                         if (ActiveCount > 0) {
    4533             :                             // do nothing, branch set before)
    4534             :                         } else {
    4535        3377 :                             if (BypassCount > 0) {
    4536             : 
    4537             :                             } else {
    4538        3377 :                                 state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
    4539             :                                     DataBranchAirLoopPlant::ControlType::Passive;
    4540             :                             }
    4541             :                         }
    4542        3387 :                     } break;
    4543           7 :                     case DataBranchAirLoopPlant::ControlType::SeriesActive: {
    4544             :                         // do nothing, already set when more than one active component found on a branch
    4545           7 :                     } break;
    4546           0 :                     default:
    4547           0 :                         break;
    4548             :                     }
    4549             :                 }
    4550             :             }
    4551             :         }
    4552             :     }
    4553         796 : }
    4554             : 
    4555         796 : void CheckIfAnyPlant(EnergyPlusData &state)
    4556             : {
    4557             : 
    4558             :     // SUBROUTINE INFORMATION:
    4559             :     //       AUTHOR         Brent Griffith
    4560             :     //       DATE WRITTEN   Sept 2010
    4561             :     //       MODIFIED       na
    4562             :     //       RE-ENGINEERED  na
    4563             : 
    4564             :     // PURPOSE OF THIS SUBROUTINE:
    4565             :     // determine if any plant loops will be ever be set up
    4566             : 
    4567             :     // METHODOLOGY EMPLOYED:
    4568             :     // use input processor ot find number of plant loops
    4569             : 
    4570             :     // Using/Aliasing
    4571             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    4572             :     int numPlantLoopsCheck;
    4573             :     int numCondenserLoopsCheck;
    4574         796 :     auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
    4575         796 :     cCurrentModuleObject = "PlantLoop";
    4576         796 :     numPlantLoopsCheck = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
    4577             : 
    4578         796 :     cCurrentModuleObject = "CondenserLoop";
    4579         796 :     numCondenserLoopsCheck = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
    4580             : 
    4581         796 :     if ((numPlantLoopsCheck + numCondenserLoopsCheck) > 0) {
    4582         459 :         state.dataGlobal->AnyPlantInModel = true;
    4583             :     } else {
    4584         337 :         state.dataGlobal->AnyPlantInModel = false;
    4585         337 :         state.dataPlnt->PlantLoop.allocate(0);
    4586             :     }
    4587         796 : }
    4588             : 
    4589         794 : void CheckOngoingPlantWarnings(EnergyPlusData &state)
    4590             : {
    4591             :     int LoopNum;
    4592        1940 :     for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
    4593             :         // Warning if the excess storage time is more than half of the total time
    4594        1146 :         if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_CapExcessStorageTime >
    4595        1146 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime / 2) {
    4596           0 :             ShowWarningError(
    4597           0 :                 state, "Plant Loop: " + state.dataPlnt->PlantLoop(LoopNum).Name + " Demand Side is storing excess heat the majority of the time.");
    4598           0 :             ShowContinueError(state,
    4599           0 :                               format("Excesss Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]",
    4600           0 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime,
    4601           0 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime));
    4602             :         }
    4603        1146 :         if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime >
    4604        1146 :             state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_TotalTime / 2) {
    4605          12 :             ShowWarningError(
    4606          12 :                 state, "Plant Loop: " + state.dataPlnt->PlantLoop(LoopNum).Name + " Supply Side is storing excess heat the majority of the time.");
    4607          12 :             ShowContinueError(state,
    4608          12 :                               format("Excesss Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]",
    4609           6 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime,
    4610           6 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime));
    4611             :         }
    4612             :     }
    4613         794 : }
    4614             : 
    4615           0 : void EmptyPlantComponent::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
    4616             : {
    4617           0 : }
    4618         459 : void EmptyPlantComponent::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
    4619             : {
    4620         459 : }
    4621             : } // namespace EnergyPlus::PlantManager

Generated by: LCOV version 1.14