LCOV - code coverage report
Current view: top level - EnergyPlus - SimulationManager.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 75.1 % 1483 1113
Test Date: 2025-06-02 12:03:30 Functions: 82.4 % 17 14

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // FMI-Related Headers
      49              : extern "C" {
      50              : #include <FMI/main.h>
      51              : }
      52              : 
      53              : // C++ Headers
      54              : #include <memory>
      55              : #include <string>
      56              : 
      57              : // ObjexxFCL Headers
      58              : #include <ObjexxFCL/Array.functions.hh>
      59              : #include <ObjexxFCL/Array1D.hh>
      60              : #include <ObjexxFCL/environment.hh>
      61              : #include <ObjexxFCL/string.functions.hh>
      62              : 
      63              : // EnergyPlus Headers
      64              : #include <EnergyPlus/BranchInputManager.hh>
      65              : #include <EnergyPlus/BranchNodeConnections.hh>
      66              : #include <EnergyPlus/CostEstimateManager.hh>
      67              : #include <EnergyPlus/CurveManager.hh>
      68              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      69              : #include <EnergyPlus/DataAirLoop.hh>
      70              : #include <EnergyPlus/DataBranchNodeConnections.hh>
      71              : #include <EnergyPlus/DataConvergParams.hh>
      72              : #include <EnergyPlus/DataErrorTracking.hh>
      73              : #include <EnergyPlus/DataGlobalConstants.hh>
      74              : #include <EnergyPlus/DataHVACGlobals.hh>
      75              : #include <EnergyPlus/DataHeatBalFanSys.hh>
      76              : #include <EnergyPlus/DataHeatBalance.hh>
      77              : #include <EnergyPlus/DataIPShortCuts.hh>
      78              : #include <EnergyPlus/DataLoopNode.hh>
      79              : #include <EnergyPlus/DataOutputs.hh>
      80              : #include <EnergyPlus/DataReportingFlags.hh>
      81              : #include <EnergyPlus/DataRuntimeLanguage.hh>
      82              : #include <EnergyPlus/DataStringGlobals.hh>
      83              : #include <EnergyPlus/DataSurfaces.hh>
      84              : #include <EnergyPlus/DataSystemVariables.hh>
      85              : #include <EnergyPlus/DataZoneEquipment.hh>
      86              : #include <EnergyPlus/DemandManager.hh>
      87              : #include <EnergyPlus/DisplayRoutines.hh>
      88              : #include <EnergyPlus/DualDuct.hh>
      89              : #include <EnergyPlus/EMSManager.hh>
      90              : #include <EnergyPlus/EconomicLifeCycleCost.hh>
      91              : #include <EnergyPlus/EconomicTariff.hh>
      92              : #include <EnergyPlus/ElectricPowerServiceManager.hh>
      93              : #include <EnergyPlus/ExteriorEnergyUse.hh>
      94              : #include <EnergyPlus/ExternalInterface.hh>
      95              : #include <EnergyPlus/FaultsManager.hh>
      96              : #include <EnergyPlus/FileSystem.hh>
      97              : #include <EnergyPlus/FluidProperties.hh>
      98              : #include <EnergyPlus/GeneralRoutines.hh>
      99              : #include <EnergyPlus/HVACControllers.hh>
     100              : #include <EnergyPlus/HVACManager.hh>
     101              : #include <EnergyPlus/HVACSizingSimulationManager.hh>
     102              : #include <EnergyPlus/HeatBalanceAirManager.hh>
     103              : #include <EnergyPlus/HeatBalanceIntRadExchange.hh>
     104              : #include <EnergyPlus/HeatBalanceManager.hh>
     105              : #include <EnergyPlus/HeatBalanceSurfaceManager.hh>
     106              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
     107              : #include <EnergyPlus/MixedAir.hh>
     108              : #include <EnergyPlus/NodeInputManager.hh>
     109              : #include <EnergyPlus/OutAirNodeManager.hh>
     110              : #include <EnergyPlus/OutputProcessor.hh>
     111              : #include <EnergyPlus/OutputReportPredefined.hh>
     112              : #include <EnergyPlus/OutputReportTabular.hh>
     113              : #include <EnergyPlus/OutputReports.hh>
     114              : #include <EnergyPlus/Plant/PlantManager.hh>
     115              : #include <EnergyPlus/PlantPipingSystemsManager.hh>
     116              : #include <EnergyPlus/PluginManager.hh>
     117              : #include <EnergyPlus/PollutionModule.hh>
     118              : #include <EnergyPlus/Psychrometrics.hh>
     119              : #include <EnergyPlus/RefrigeratedCase.hh>
     120              : #include <EnergyPlus/ReportCoilSelection.hh>
     121              : #include <EnergyPlus/ResultsFramework.hh>
     122              : #include <EnergyPlus/SetPointManager.hh>
     123              : #include <EnergyPlus/SimulationManager.hh>
     124              : #include <EnergyPlus/SizingManager.hh>
     125              : #include <EnergyPlus/SolarShading.hh>
     126              : #include <EnergyPlus/SurfaceGeometry.hh>
     127              : #include <EnergyPlus/SystemReports.hh>
     128              : #include <EnergyPlus/UtilityRoutines.hh>
     129              : #include <EnergyPlus/WeatherManager.hh>
     130              : #include <EnergyPlus/ZoneContaminantPredictorCorrector.hh>
     131              : #include <EnergyPlus/ZoneEquipmentManager.hh>
     132              : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
     133              : #include <EnergyPlus/api/datatransfer.h>
     134              : 
     135              : namespace EnergyPlus {
     136              : namespace SimulationManager {
     137              : 
     138              :     // MODULE INFORMATION:
     139              :     //       AUTHOR         Rick Strand
     140              :     //       DATE WRITTEN   January 1997
     141              : 
     142              :     // PURPOSE OF THIS MODULE:
     143              :     // This module contains the main driver routine which manages the major
     144              :     // control loops of the EnergyPlus simulation.  This module is also
     145              :     // responsible for setting the global environment flags for these
     146              :     // loops.
     147              : 
     148              :     // METHODOLOGY EMPLOYED:
     149              :     // This module was constructed from the remnants of (I)BLAST routines
     150              :     // SIMBLD (Simulate Building), SIMZG (Simulate Zone Group), and SIMZGD
     151              :     // (Simulate Zone Group for a Day).
     152              : 
     153              :     // REFERENCES:
     154              :     // (I)BLAST legacy code, internal Reverse Engineering documentation,
     155              :     // and internal Evolutionary Engineering documentation.
     156              : 
     157              :     // Using/Aliasing
     158              :     using namespace DataSizing;
     159              :     using namespace DataSystemVariables;
     160              :     using namespace HeatBalanceManager;
     161              :     using namespace ExternalInterface;
     162              : 
     163              :     // MODULE PARAMETER DEFINITIONS:
     164              : 
     165           75 :     void ManageSimulation(EnergyPlusData &state)
     166              :     {
     167              : 
     168              :         // SUBROUTINE INFORMATION:
     169              :         //       AUTHOR         Rick Strand
     170              :         //       DATE WRITTEN   January 1997
     171              : 
     172              :         // PURPOSE OF THIS SUBROUTINE:
     173              :         // This subroutine is the main driver of the simulation manager module.
     174              :         // It contains the main environment-time loops for the building
     175              :         // simulation.  This includes the environment loop, a day loop, an
     176              :         // hour loop, and a time step loop.
     177              : 
     178              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     179           75 :         bool ErrorsFound(false);
     180           75 :         bool oneTimeUnderwaterBoundaryCheck = true;
     181           75 :         bool AnyUnderwaterBoundaries = false;
     182              : 
     183           75 :         state.files.outputControl.getInput(state);
     184           75 :         state.dataResultsFramework->resultsFramework->setupOutputOptions(state);
     185              : 
     186          150 :         state.files.debug.ensure_open(state, "OpenOutputFiles", state.files.outputControl.dbg);
     187              : 
     188           75 :         if (!state.dataSQLiteProcedures->sqlite) {
     189           73 :             state.dataSQLiteProcedures->sqlite = EnergyPlus::CreateSQLiteDatabase(state);
     190              :         }
     191              : 
     192           75 :         if (state.dataSQLiteProcedures->sqlite) {
     193            5 :             state.dataSQLiteProcedures->sqlite->sqliteBegin();
     194           15 :             state.dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(
     195           10 :                 1, state.dataStrGlobals->VerStringVar, state.dataStrGlobals->CurrentDateTime);
     196            5 :             state.dataSQLiteProcedures->sqlite->sqliteCommit();
     197              :         }
     198              : 
     199           75 :         PostIPProcessing(state);
     200              : 
     201           75 :         state.dataGlobal->BeginSimFlag = true;
     202           75 :         state.dataGlobal->DoOutputReporting = false;
     203           75 :         state.dataReportFlag->DisplayPerfSimulationFlag = false;
     204           75 :         state.dataReportFlag->DoWeatherInitReporting = false;
     205           75 :         state.dataSimulationManager->RunPeriodsInInput =
     206           75 :             (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod") > 0 ||
     207           75 :              state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod:CustomRange") > 0 || state.dataSysVars->FullAnnualRun);
     208           75 :         state.dataErrTracking->AskForConnectionsReport = false; // set to false until sizing is finished
     209              : 
     210           75 :         state.init_constant_state(state);
     211           75 :         state.init_state(state);
     212              : 
     213           75 :         CheckForMisMatchedEnvironmentSpecifications(state);
     214           75 :         CheckForRequestedReporting(state);
     215           75 :         OutputReportPredefined::SetPredefinedTables(state);
     216           75 :         SetPreConstructionInputParameters(state); // establish array bounds for constructions early
     217              : 
     218           75 :         OutputProcessor::SetupTimePointers(
     219           75 :             state, OutputProcessor::TimeStepType::Zone, state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation
     220           75 :         OutputProcessor::SetupTimePointers(state, OutputProcessor::TimeStepType::System, state.dataHVACGlobal->TimeStepSys);
     221              : 
     222           75 :         createFacilityElectricPowerServiceObject(state);
     223           75 :         createCoilSelectionReportObj(state);
     224              :         // read object information early in simulation
     225           75 :         isInputObjectUsed(state);
     226              : 
     227           75 :         BranchInputManager::ManageBranchInput(state); // just gets input and returns.
     228              : 
     229              :         // Create a new plugin manager which starts up the Python interpreter
     230           75 :         state.dataPluginManager->pluginManager = std::make_unique<EnergyPlus::PluginManagement::PluginManager>(state);
     231              : 
     232           74 :         state.dataGlobal->DoingSizing = true;
     233           74 :         SizingManager::ManageSizing(state);
     234              : 
     235           74 :         bool SimsDone = false;
     236           74 :         if (state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim || state.dataGlobal->DoHVACSizingSimulation) {
     237           66 :             state.dataGlobal->DoOutputReporting = true;
     238              :         }
     239           74 :         state.dataGlobal->DoingSizing = false;
     240           74 :         state.dataHeatBal->doSpaceHeatBalance = state.dataHeatBal->doSpaceHeatBalanceSimulation;
     241              : 
     242          108 :         if ((state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing) &&
     243           34 :             !(state.dataGlobal->DoDesDaySim || (state.dataGlobal->DoWeathSim && state.dataSimulationManager->RunPeriodsInInput))) {
     244           24 :             ShowWarningError(state,
     245              :                              "ManageSimulation: Input file has requested Sizing Calculations but no Simulations are requested (in SimulationControl "
     246              :                              "object). Succeeding warnings/errors may be confusing.");
     247              :         }
     248           74 :         bool Available = true; // an environment is available to process
     249              : 
     250           74 :         if (state.dataGlobal->DoPureLoadCalc) {
     251            8 :             state.dataGlobal->DoOutputReporting = true;
     252            8 :             Available = false;
     253            8 :             state.dataOutRptTab->WriteTabularFiles = true;
     254              :         }
     255              : 
     256           74 :         if (state.dataBranchInputManager->InvalidBranchDefinitions) {
     257            0 :             ShowFatalError(state, "Preceding error(s) in Branch Input cause termination.");
     258              :         }
     259              : 
     260           74 :         DisplayString(state, "Adjusting Air System Sizing");
     261           74 :         SizingManager::ManageSystemSizingAdjustments(state);
     262              : 
     263           74 :         DisplayString(state, "Adjusting Standard 62.1 Ventilation Sizing");
     264           74 :         SizingManager::ManageSystemVentilationAdjustments(state);
     265              : 
     266           74 :         DisplayString(state, "Initializing Simulation");
     267           74 :         state.dataGlobal->KickOffSimulation = true;
     268              : 
     269           74 :         Weather::ResetEnvironmentCounter(state);
     270           74 :         SetupSimulation(state, ErrorsFound);
     271              : 
     272           73 :         FaultsManager::CheckAndReadFaults(state);
     273              : 
     274           73 :         Curve::InitCurveReporting(state);
     275              : 
     276           73 :         state.dataErrTracking->AskForConnectionsReport = true; // set to true now that input processing and sizing is done.
     277           73 :         state.dataGlobal->KickOffSimulation = false;
     278           73 :         state.dataGlobal->WarmupFlag = false;
     279           73 :         state.dataReportFlag->DoWeatherInitReporting = true;
     280              : 
     281              :         //  Note:  All the inputs have been 'gotten' by the time we get here.
     282           73 :         if (state.dataGlobal->DoOutputReporting) {
     283           73 :             DisplayString(state, "Reporting Surfaces");
     284           73 :             bool ErrFound = false;
     285           73 :             bool TerminalError = false;
     286              : 
     287           73 :             ReportSurfaces(state);
     288              : 
     289           73 :             NodeInputManager::SetupNodeVarsForReporting(state);
     290           73 :             state.dataGlobal->MetersHaveBeenInitialized = true;
     291           73 :             Pollution::SetupPollutionMeterReporting(state);
     292           73 :             SystemReports::AllocateAndSetUpVentReports(state);
     293           73 :             if (state.dataPluginManager->pluginManager) {
     294           73 :                 EnergyPlus::PluginManagement::PluginManager::setupOutputVariables(state);
     295              :             }
     296           73 :             UpdateMeterReporting(state);
     297           73 :             Pollution::CheckPollutionMeterReporting(state);
     298           73 :             state.dataElectPwrSvcMgr->facilityElectricServiceObj->verifyCustomMetersElecPowerMgr(state);
     299           73 :             Pollution::SetupPollutionCalculations(state);
     300           73 :             DemandManager::InitDemandManagers(state);
     301           73 :             BranchInputManager::TestBranchIntegrity(state, ErrFound);
     302           73 :             if (ErrFound) {
     303            0 :                 TerminalError = true;
     304              :             }
     305           73 :             TestAirPathIntegrity(state, ErrFound);
     306           73 :             if (ErrFound) {
     307            0 :                 TerminalError = true;
     308              :             }
     309           73 :             NodeInputManager::CheckMarkedNodes(state, ErrFound);
     310           73 :             if (ErrFound) {
     311            0 :                 TerminalError = true;
     312              :             }
     313           73 :             BranchNodeConnections::CheckNodeConnections(state, ErrFound);
     314           73 :             if (ErrFound) {
     315            0 :                 TerminalError = true;
     316              :             }
     317           73 :             BranchNodeConnections::TestCompSetInletOutletNodes(state, ErrFound);
     318           73 :             if (ErrFound) {
     319            0 :                 TerminalError = true;
     320              :             }
     321           73 :             MixedAir::CheckControllerLists(state, ErrFound);
     322           73 :             if (ErrFound) {
     323            0 :                 TerminalError = true;
     324              :             }
     325              : 
     326           73 :             if (state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim || state.dataGlobal->DoPureLoadCalc) {
     327           73 :                 ReportLoopConnections(state);
     328           73 :                 SystemReports::ReportAirLoopConnections(state);
     329           73 :                 ReportNodeConnections(state);
     330              :             }
     331           73 :             SystemReports::CreateEnergyReportStructure(state);
     332              :             bool anyEMSRan;
     333              :             // point to finish setup processing EMS, sensor ready now
     334           73 :             EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyEMSRan, ObjexxFCL::Optional_int_const());
     335           73 :             ProduceRDDMDD(state);
     336              : 
     337           73 :             if (TerminalError) {
     338            0 :                 ShowFatalError(state, "Previous Conditions cause program termination.");
     339              :             }
     340              :         }
     341              : 
     342              :         // up until this point, output vars, meters, actuators, etc., may not have been registered; they are now
     343           73 :         state.dataPluginManager->fullyReady = true;
     344              : 
     345           73 :         if (state.dataSQLiteProcedures->sqlite) {
     346            5 :             state.dataSQLiteProcedures->sqlite->sqliteBegin();
     347            5 :             state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(1, state.dataGlobal->TimeStepsInHour);
     348            5 :             state.dataSQLiteProcedures->sqlite->sqliteCommit();
     349              :         }
     350              : 
     351           73 :         EconomicLifeCycleCost::GetInputForLifeCycleCost(state); // must be prior to WriteTabularReports -- do here before big simulation stuff.
     352              : 
     353              :         // check for variable latitude/location/etc
     354           73 :         Weather::ReadVariableLocationOrientation(state);
     355              : 
     356              :         // if user requested HVAC Sizing Simulation, call HVAC sizing simulation manager
     357           73 :         if (state.dataGlobal->DoHVACSizingSimulation) {
     358            0 :             ManageHVACSizingSimulation(state, ErrorsFound);
     359              :         }
     360              : 
     361           73 :         if (!state.dataGlobal->DoPureLoadCalc) {
     362          130 :             ShowMessage(state, "Beginning Simulation");
     363           65 :             DisplayString(state, "Beginning Primary Simulation");
     364              :         }
     365           73 :         Weather::ResetEnvironmentCounter(state);
     366              : 
     367           73 :         int EnvCount = 0;
     368           73 :         state.dataGlobal->WarmupFlag = true;
     369              : 
     370          202 :         while (Available) {
     371          194 :             if (state.dataGlobal->stopSimulation) {
     372           65 :                 break;
     373              :             }
     374              : 
     375          193 :             Weather::GetNextEnvironment(state, Available, ErrorsFound);
     376              : 
     377          193 :             if (!Available) {
     378           64 :                 break;
     379              :             }
     380          129 :             if (ErrorsFound) {
     381            0 :                 break;
     382              :             }
     383          129 :             if ((!state.dataGlobal->DoDesDaySim) && (state.dataGlobal->KindOfSim != Constant::KindOfSim::RunPeriodWeather)) {
     384           17 :                 continue;
     385              :             }
     386          129 :             if ((!state.dataGlobal->DoWeathSim) && (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather)) {
     387           17 :                 continue;
     388              :             }
     389          112 :             if (state.dataGlobal->KindOfSim == Constant::KindOfSim::HVACSizeDesignDay) {
     390            0 :                 continue; // don't run these here, only for sizing simulations
     391              :             }
     392              : 
     393          112 :             if (state.dataGlobal->KindOfSim == Constant::KindOfSim::HVACSizeRunPeriodDesign) {
     394            0 :                 continue; // don't run these here, only for sizing simulations
     395              :             }
     396              : 
     397          112 :             ++EnvCount;
     398              : 
     399          112 :             if (state.dataSQLiteProcedures->sqlite) {
     400            8 :                 state.dataSQLiteProcedures->sqlite->sqliteBegin();
     401           24 :                 state.dataSQLiteProcedures->sqlite->createSQLiteEnvironmentPeriodRecord(
     402           16 :                     state.dataEnvrn->CurEnvirNum, state.dataEnvrn->EnvironmentName, state.dataGlobal->KindOfSim);
     403            8 :                 state.dataSQLiteProcedures->sqlite->sqliteCommit();
     404              :             }
     405              : 
     406          112 :             state.dataErrTracking->ExitDuringSimulations = true;
     407          112 :             SimsDone = true;
     408          112 :             DisplayString(state, "Initializing New Environment Parameters");
     409              : 
     410          112 :             state.dataGlobal->BeginEnvrnFlag = true;
     411          112 :             state.dataGlobal->EndEnvrnFlag = false;
     412          112 :             state.dataEnvrn->EndMonthFlag = false;
     413          112 :             state.dataGlobal->WarmupFlag = true;
     414          112 :             state.dataGlobal->DayOfSim = 0;
     415          112 :             state.dataGlobal->DayOfSimChr = "0";
     416          112 :             state.dataReportFlag->NumOfWarmupDays = 0;
     417          112 :             if (state.dataEnvrn->CurrentYearIsLeapYear) {
     418            0 :                 if (state.dataGlobal->NumOfDayInEnvrn <= 366) {
     419            0 :                     state.dataOutputProcessor->isFinalYear = true;
     420              :                 }
     421              :             } else {
     422          112 :                 if (state.dataGlobal->NumOfDayInEnvrn <= 365) {
     423          112 :                     state.dataOutputProcessor->isFinalYear = true;
     424              :                 }
     425              :             }
     426              : 
     427          112 :             HVACManager::ResetNodeData(state); // Reset here, because some zone calcs rely on node data (e.g. ZoneITEquip)
     428              : 
     429              :             bool anyEMSRan;
     430          112 :             ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyEMSRan, ObjexxFCL::Optional_int_const()); // calling point
     431              : 
     432         1406 :             while ((state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ...
     433         1295 :                 if (state.dataGlobal->stopSimulation) {
     434            1 :                     break;
     435              :                 }
     436              : 
     437         1294 :                 if (state.dataSQLiteProcedures->sqlite) {
     438           54 :                     state.dataSQLiteProcedures->sqlite->sqliteBegin(); // setup for one transaction per day
     439              :                 }
     440              : 
     441         1294 :                 ++state.dataGlobal->DayOfSim;
     442         1294 :                 state.dataGlobal->DayOfSimChr = fmt::to_string(state.dataGlobal->DayOfSim);
     443         1294 :                 if (!state.dataGlobal->WarmupFlag) {
     444          111 :                     ++state.dataEnvrn->CurrentOverallSimDay;
     445          111 :                     DisplaySimDaysProgress(state, state.dataEnvrn->CurrentOverallSimDay, state.dataEnvrn->TotalOverallSimDays);
     446              :                 } else {
     447         1183 :                     state.dataGlobal->DayOfSimChr = "0";
     448              :                 }
     449         1294 :                 state.dataGlobal->BeginDayFlag = true;
     450         1294 :                 state.dataGlobal->EndDayFlag = false;
     451              : 
     452         1294 :                 if (state.dataGlobal->WarmupFlag) {
     453         1183 :                     ++state.dataReportFlag->NumOfWarmupDays;
     454         1183 :                     state.dataReportFlag->cWarmupDay = fmt::to_string(state.dataReportFlag->NumOfWarmupDays);
     455         1183 :                     DisplayString(state, "Warming up {" + state.dataReportFlag->cWarmupDay + '}');
     456          111 :                 } else if (state.dataGlobal->DayOfSim == 1) {
     457          111 :                     if (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) {
     458            0 :                         DisplayString(state, "Starting Simulation at " + state.dataEnvrn->CurMnDyYr + " for " + state.dataEnvrn->EnvironmentName);
     459              :                     } else {
     460          111 :                         DisplayString(state, "Starting Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName);
     461              :                     }
     462              :                     static constexpr std::string_view Format_700("Environment:WarmupDays,{:3}\n");
     463          111 :                     print(state.files.eio, Format_700, state.dataReportFlag->NumOfWarmupDays);
     464            0 :                 } else if (state.dataReportFlag->DisplayPerfSimulationFlag) {
     465            0 :                     if (state.dataGlobal->KindOfSim == Constant::KindOfSim::RunPeriodWeather) {
     466            0 :                         DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDyYr + " for " + state.dataEnvrn->EnvironmentName);
     467              :                     } else {
     468            0 :                         DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName);
     469              :                     }
     470            0 :                     state.dataReportFlag->DisplayPerfSimulationFlag = false;
     471              :                 }
     472              :                 // for simulations that last longer than a week, identify when the last year of the simulation is started
     473         1294 :                 if ((state.dataGlobal->DayOfSim > 365) && ((state.dataGlobal->NumOfDayInEnvrn - state.dataGlobal->DayOfSim) == 364) &&
     474            0 :                     !state.dataGlobal->WarmupFlag) {
     475            0 :                     DisplayString(state, "Starting last  year of environment at:  " + state.dataGlobal->DayOfSimChr);
     476            0 :                     OutputReportTabular::ResetTabularReports(state);
     477              :                 }
     478              : 
     479        32327 :                 for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ...
     480        31034 :                     if (state.dataGlobal->stopSimulation) {
     481            1 :                         break;
     482              :                     }
     483              : 
     484        31033 :                     state.dataGlobal->BeginHourFlag = true;
     485        31033 :                     state.dataGlobal->EndHourFlag = false;
     486              : 
     487       196802 :                     for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->TimeStepsInHour;
     488       165769 :                          ++state.dataGlobal->TimeStep) {
     489       165770 :                         if (state.dataGlobal->stopSimulation) {
     490            1 :                             break;
     491              :                         }
     492              : 
     493       165769 :                         if (state.dataGlobal->AnySlabsInModel || state.dataGlobal->AnyBasementsInModel) {
     494            0 :                             PlantPipingSystemsManager::SimulateGroundDomains(state, false);
     495              :                         }
     496              : 
     497       165769 :                         if (AnyUnderwaterBoundaries) {
     498            0 :                             Weather::UpdateUnderwaterBoundaries(state);
     499              :                         }
     500              : 
     501       331538 :                         if (state.dataEnvrn->varyingLocationLatSched != nullptr || state.dataEnvrn->varyingLocationLongSched != nullptr ||
     502       165769 :                             state.dataEnvrn->varyingOrientationSched != nullptr) {
     503            0 :                             Weather::UpdateLocationAndOrientation(state);
     504              :                         }
     505              : 
     506       165769 :                         state.dataGlobal->BeginTimeStepFlag = true;
     507       165769 :                         ExternalInterfaceExchangeVariables(state);
     508              : 
     509              :                         // Set the End__Flag variables to true if necessary.  Note that
     510              :                         // each flag builds on the previous level.  EndDayFlag cannot be
     511              :                         // .TRUE. unless EndHourFlag is also .TRUE., etc.  Note that the
     512              :                         // EndEnvrnFlag and the EndSimFlag cannot be set during warmup.
     513              :                         // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the
     514              :                         // SubTimeStepFlags can/will be set/reset in the HVAC Manager.
     515              : 
     516       165769 :                         if (state.dataGlobal->TimeStep == state.dataGlobal->TimeStepsInHour) {
     517        31032 :                             state.dataGlobal->EndHourFlag = true;
     518        31032 :                             if (state.dataGlobal->HourOfDay == 24) {
     519         1293 :                                 state.dataGlobal->EndDayFlag = true;
     520         1293 :                                 if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) {
     521          111 :                                     state.dataGlobal->EndEnvrnFlag = true;
     522              :                                 }
     523              :                             }
     524              :                         }
     525              : 
     526       165769 :                         Weather::ManageWeather(state);
     527              : 
     528       165769 :                         ExteriorEnergyUse::ManageExteriorEnergyUse(state);
     529              : 
     530       165769 :                         ManageHeatBalance(state);
     531              : 
     532       165769 :                         if (oneTimeUnderwaterBoundaryCheck) {
     533           65 :                             AnyUnderwaterBoundaries = Weather::CheckIfAnyUnderwaterBoundaries(state);
     534           65 :                             oneTimeUnderwaterBoundaryCheck = false;
     535              :                         }
     536              : 
     537       165769 :                         state.dataGlobal->BeginHourFlag = false;
     538       165769 :                         state.dataGlobal->BeginDayFlag = false;
     539       165769 :                         state.dataGlobal->BeginEnvrnFlag = false;
     540       165769 :                         state.dataGlobal->BeginSimFlag = false;
     541              :                     } // TimeStep loop
     542              : 
     543        31033 :                     state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay;
     544              : 
     545              :                 } // ... End hour loop.
     546              : 
     547         1294 :                 if (state.dataSQLiteProcedures->sqlite) {
     548           54 :                     state.dataSQLiteProcedures->sqlite->sqliteCommit(); // one transaction per day
     549              :                 }
     550              : 
     551              :             } // ... End day loop.
     552              : 
     553              :             // Need one last call to send latest states to middleware
     554          112 :             ExternalInterfaceExchangeVariables(state);
     555              : 
     556              :         } // ... End environment loop.
     557              : 
     558           73 :         state.dataGlobal->WarmupFlag = false;
     559              : 
     560           73 :         if (!SimsDone && state.dataGlobal->DoDesDaySim) {
     561            0 :             if ((state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays) == 0) { // if sum is 0, then there was no sizing done.
     562            0 :                 ShowWarningError(state,
     563              :                                  "ManageSimulation: SizingPeriod:* were requested in SimulationControl but no SizingPeriod:* objects in input.");
     564              :             }
     565              :         }
     566              : 
     567           73 :         if (!SimsDone && state.dataGlobal->DoWeathSim) {
     568            0 :             if (!state.dataSimulationManager->RunPeriodsInInput) { // if no run period requested, and sims not done
     569            0 :                 ShowWarningError(state, "ManageSimulation: Weather Simulation was requested in SimulationControl but no RunPeriods in input.");
     570              :             }
     571              :         }
     572              : 
     573           73 :         PlantManager::CheckOngoingPlantWarnings(state);
     574              : 
     575           73 :         if (state.dataSQLiteProcedures->sqlite) {
     576            5 :             state.dataSQLiteProcedures->sqlite->sqliteBegin(); // for final data to write
     577              :         }
     578              : 
     579           73 :         CostEstimateManager::SimCostEstimate(state);
     580              : 
     581           73 :         EconomicTariff::ComputeTariff(state); //     Compute the utility bills
     582              : 
     583           73 :         EMSManager::checkForUnusedActuatorsAtEnd(state);
     584           73 :         EMSManager::checkSetpointNodesAtEnd(state);
     585              : 
     586           73 :         OutputProcessor::ReportForTabularReports(state); // For Energy Meters (could have other things that need to be pushed to after simulation)
     587              : 
     588           73 :         OutputReportTabular::OpenOutputTabularFile(state);
     589              : 
     590           73 :         OutputReportTabular::WriteTabularReports(state); // Create the tabular reports at completion of each
     591              : 
     592           73 :         EconomicTariff::WriteTabularTariffReports(state);
     593              : 
     594           73 :         EconomicLifeCycleCost::ComputeLifeCycleCostAndReport(state); // must be after WriteTabularReports and WriteTabularTariffReports
     595              : 
     596           73 :         OutputReportTabular::CloseOutputTabularFile(state);
     597              : 
     598           73 :         HVACControllers::DumpAirLoopStatistics(state); // Dump runtime statistics for air loop controller simulation to csv file
     599              : 
     600           73 :         CloseOutputFiles(state);
     601              : 
     602              :         // state.dataSQLiteProcedures->sqlite->createZoneExtendedOutput();
     603           73 :         CreateSQLiteZoneExtendedOutput(state);
     604              : 
     605           73 :         if (state.dataSQLiteProcedures->sqlite) {
     606            5 :             DisplayString(state, "Writing final SQL reports");
     607            5 :             state.dataSQLiteProcedures->sqlite->sqliteCommit();      // final transactions
     608            5 :             state.dataSQLiteProcedures->sqlite->initializeIndexes(); // do not create indexes (SQL) until all is done.
     609              :         }
     610              : 
     611           73 :         if (ErrorsFound) {
     612            0 :             ShowFatalError(state, "Error condition occurred.  Previous Severe Errors cause termination.");
     613              :         }
     614           73 :     }
     615              : 
     616         1173 :     void GetProjectData(EnergyPlusData &state)
     617              :     {
     618              : 
     619              :         // SUBROUTINE INFORMATION:
     620              :         //       AUTHOR         Linda K. Lawrie
     621              :         //       DATE WRITTEN   November 1997
     622              :         //       MODIFIED       na
     623              :         //       RE-ENGINEERED  na
     624              : 
     625              :         // PURPOSE OF THIS SUBROUTINE:
     626              :         // This subroutine gets global project data from the input file.
     627              : 
     628              :         // METHODOLOGY EMPLOYED:
     629              :         // Use GetObjectItem from the Input Processor
     630              : 
     631              :         // Using/Aliasing
     632              :         using DataStringGlobals::MatchVersion;
     633              :         using namespace DataSystemVariables;
     634         1173 :         auto &deviationFromSetPtThresholdClg = state.dataHVACGlobal->deviationFromSetPtThresholdClg;
     635         1173 :         auto &deviationFromSetPtThresholdHtg = state.dataHVACGlobal->deviationFromSetPtThresholdHtg;
     636              : 
     637              :         // SUBROUTINE PARAMETER DEFINITIONS:
     638              :         static constexpr std::array<int, 12> Div60 = {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60};
     639              : 
     640              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     641         1173 :         Array1D_string Alphas(10);
     642         1173 :         Array1D<Real64> Number(4);
     643              :         int NumAlpha;
     644              :         int NumNumber;
     645              :         int IOStat;
     646              :         int NumDebugOut;
     647              :         int MinInt;
     648              :         int Num;
     649              :         int Which;
     650              :         bool ErrorsFound;
     651              :         int NumRunControl;
     652         1173 :         std::string VersionID;
     653         1173 :         std::string CurrentModuleObject;
     654              :         bool CondFDAlgo;
     655              :         int Item;
     656              : 
     657         1173 :         ErrorsFound = false;
     658              : 
     659         1173 :         CurrentModuleObject = "Version";
     660         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     661         1173 :         if (Num == 1) {
     662         2002 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     663              :                                                                      CurrentModuleObject,
     664              :                                                                      1,
     665              :                                                                      Alphas,
     666              :                                                                      NumAlpha,
     667              :                                                                      Number,
     668              :                                                                      NumNumber,
     669              :                                                                      IOStat,
     670         1001 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     671         1001 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     672         1001 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     673         1001 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     674         1001 :             std::string::size_type const lenVer(len(MatchVersion));
     675         1001 :             if ((lenVer > 0) && (MatchVersion[lenVer - 1] == '0')) {
     676            0 :                 Which = static_cast<int>(index(Alphas(1).substr(0, lenVer - 2), MatchVersion.substr(0, lenVer - 2)));
     677              :             } else {
     678         1001 :                 Which = static_cast<int>(index(Alphas(1), MatchVersion));
     679              :             }
     680         1001 :             if (Which != 0) {
     681           12 :                 ShowWarningError(state, format("{}: in IDF=\"{}\" not the same as expected=\"{}\"", CurrentModuleObject, Alphas(1), MatchVersion));
     682              :             }
     683         1001 :             VersionID = Alphas(1);
     684          172 :         } else if (Num == 0) {
     685          172 :             ShowWarningError(state, format("{}: missing in IDF, processing for EnergyPlus version=\"{}\"", CurrentModuleObject, MatchVersion));
     686              :         } else {
     687            0 :             ShowSevereError(state, format("Too many {} Objects found.", CurrentModuleObject));
     688            0 :             ErrorsFound = true;
     689              :         }
     690              : 
     691              :         // Do Mini Gets on HB Algorithm and by-surface overrides
     692         1173 :         CurrentModuleObject = "HeatBalanceAlgorithm";
     693         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     694         1173 :         CondFDAlgo = false;
     695         1173 :         if (Num > 0) {
     696          188 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     697              :                                                                      CurrentModuleObject,
     698              :                                                                      1,
     699              :                                                                      Alphas,
     700              :                                                                      NumAlpha,
     701              :                                                                      Number,
     702              :                                                                      NumNumber,
     703              :                                                                      IOStat,
     704           94 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     705           94 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     706           94 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     707           94 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     708              :             static constexpr std::array<std::string_view, 4> condFDTypes = {
     709              :                 "CONDUCTIONFINITEDIFFERENCE", "CONDFD", "CONDUCTIONFINITEDIFFERENCEDETAILED", "CONDUCTIONFINITEDIFFERENCESIMPLIFIED"};
     710           94 :             CondFDAlgo = std::find(condFDTypes.begin(), condFDTypes.end(), Alphas(1)) != condFDTypes.end();
     711              :         }
     712         1173 :         CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm";
     713         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     714         1173 :         if (Num > 0) {
     715            3 :             for (Item = 1; Item <= Num; ++Item) {
     716            4 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
     717              :                                                                          CurrentModuleObject,
     718              :                                                                          Item,
     719              :                                                                          Alphas,
     720              :                                                                          NumAlpha,
     721              :                                                                          Number,
     722              :                                                                          NumNumber,
     723              :                                                                          IOStat,
     724            2 :                                                                          state.dataIPShortCut->lNumericFieldBlanks,
     725            2 :                                                                          state.dataIPShortCut->lAlphaFieldBlanks,
     726            2 :                                                                          state.dataIPShortCut->cAlphaFieldNames,
     727            2 :                                                                          state.dataIPShortCut->cNumericFieldNames);
     728            2 :                 if (Alphas(2) == "CONDUCTIONFINITEDIFFERENCE") {
     729            0 :                     CondFDAlgo = true;
     730              :                 }
     731              :             }
     732              :         }
     733         1173 :         CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:MultipleSurface";
     734         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     735         1173 :         if (Num > 0) {
     736            0 :             for (Item = 1; Item <= Num; ++Item) {
     737            0 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
     738              :                                                                          CurrentModuleObject,
     739              :                                                                          1,
     740              :                                                                          Alphas,
     741              :                                                                          NumAlpha,
     742              :                                                                          Number,
     743              :                                                                          NumNumber,
     744              :                                                                          IOStat,
     745            0 :                                                                          state.dataIPShortCut->lNumericFieldBlanks,
     746            0 :                                                                          state.dataIPShortCut->lAlphaFieldBlanks,
     747            0 :                                                                          state.dataIPShortCut->cAlphaFieldNames,
     748            0 :                                                                          state.dataIPShortCut->cNumericFieldNames);
     749            0 :                 if (Alphas(3) == "CONDUCTIONFINITEDIFFERENCE") {
     750            0 :                     CondFDAlgo = true;
     751              :                 }
     752              :             }
     753              :         }
     754         1173 :         CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:SurfaceList";
     755         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     756         1173 :         if (Num > 0) {
     757            0 :             for (Item = 1; Item <= Num; ++Item) {
     758            0 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
     759              :                                                                          CurrentModuleObject,
     760              :                                                                          1,
     761            0 :                                                                          state.dataIPShortCut->cAlphaArgs,
     762              :                                                                          NumAlpha,
     763              :                                                                          Number,
     764              :                                                                          NumNumber,
     765              :                                                                          IOStat,
     766            0 :                                                                          state.dataIPShortCut->lNumericFieldBlanks,
     767            0 :                                                                          state.dataIPShortCut->lAlphaFieldBlanks,
     768            0 :                                                                          state.dataIPShortCut->cAlphaFieldNames,
     769            0 :                                                                          state.dataIPShortCut->cNumericFieldNames);
     770            0 :                 if (state.dataIPShortCut->cAlphaArgs(2) == "CONDUCTIONFINITEDIFFERENCE") {
     771            0 :                     CondFDAlgo = true;
     772              :                 }
     773              :             }
     774              :         }
     775         1173 :         CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:Construction";
     776         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     777         1173 :         if (Num > 0) {
     778            2 :             for (Item = 1; Item <= Num; ++Item) {
     779            2 :                 state.dataInputProcessing->inputProcessor->getObjectItem(state,
     780              :                                                                          CurrentModuleObject,
     781              :                                                                          1,
     782            1 :                                                                          state.dataIPShortCut->cAlphaArgs,
     783              :                                                                          NumAlpha,
     784              :                                                                          Number,
     785              :                                                                          NumNumber,
     786              :                                                                          IOStat,
     787            1 :                                                                          state.dataIPShortCut->lNumericFieldBlanks,
     788            1 :                                                                          state.dataIPShortCut->lAlphaFieldBlanks,
     789            1 :                                                                          state.dataIPShortCut->cAlphaFieldNames,
     790            1 :                                                                          state.dataIPShortCut->cNumericFieldNames);
     791            1 :                 if (state.dataIPShortCut->cAlphaArgs(2) == "CONDUCTIONFINITEDIFFERENCE") {
     792            1 :                     CondFDAlgo = true;
     793              :                 }
     794              :             }
     795              :         }
     796              : 
     797         1173 :         CurrentModuleObject = "Timestep";
     798         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     799         1173 :         if (Num == 1) {
     800         2004 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     801              :                                                                      CurrentModuleObject,
     802              :                                                                      1,
     803              :                                                                      Alphas,
     804              :                                                                      NumAlpha,
     805              :                                                                      Number,
     806              :                                                                      NumNumber,
     807              :                                                                      IOStat,
     808         1002 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     809         1002 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     810         1002 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     811         1002 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     812         1002 :             state.dataGlobal->TimeStepsInHour = Number(1);
     813         1002 :             if (state.dataSysVars->ciForceTimeStep) {
     814            0 :                 state.dataGlobal->TimeStepsInHour = 2; // Force 30 minute time steps on CI
     815              :             }
     816         1002 :             if (state.dataGlobal->TimeStepsInHour <= 0 || state.dataGlobal->TimeStepsInHour > 60) {
     817            0 :                 Alphas(1) = fmt::to_string(state.dataGlobal->TimeStepsInHour);
     818            0 :                 ShowWarningError(state, format("{}: Requested number ({}) invalid, Defaulted to 4", CurrentModuleObject, Alphas(1)));
     819            0 :                 state.dataGlobal->TimeStepsInHour = 4;
     820         1002 :             } else if (mod(60, state.dataGlobal->TimeStepsInHour) != 0) {
     821            0 :                 MinInt = 9999;
     822            0 :                 for (Num = 1; Num <= 12; ++Num) {
     823            0 :                     if (std::abs(state.dataGlobal->TimeStepsInHour - Div60[Num - 1]) > MinInt) {
     824            0 :                         continue;
     825              :                     }
     826            0 :                     MinInt = state.dataGlobal->TimeStepsInHour - Div60[Num - 1];
     827            0 :                     Which = Num;
     828              :                 }
     829            0 :                 ShowWarningError(state,
     830            0 :                                  format("{}: Requested number ({}) not evenly divisible into 60, defaulted to nearest ({}).",
     831              :                                         CurrentModuleObject,
     832            0 :                                         state.dataGlobal->TimeStepsInHour,
     833            0 :                                         Div60[Which - 1]));
     834            0 :                 state.dataGlobal->TimeStepsInHour = Div60[Which - 1];
     835              :             }
     836         1002 :             if (CondFDAlgo && state.dataGlobal->TimeStepsInHour < 20) {
     837            0 :                 ShowWarningError(state,
     838            0 :                                  format("{}: Requested number ({}) cannot be used when Conduction Finite Difference algorithm is selected.",
     839              :                                         CurrentModuleObject,
     840            0 :                                         state.dataGlobal->TimeStepsInHour));
     841            0 :                 ShowContinueError(state, format("...{} is set to 20.", CurrentModuleObject));
     842            0 :                 state.dataGlobal->TimeStepsInHour = 20;
     843              :             }
     844         1002 :             if (state.dataGlobal->TimeStepsInHour < 4 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0) {
     845           14 :                 ShowWarningError(state,
     846           14 :                                  format("{}: Requested number ({}) is less than the suggested minimum of 4.",
     847              :                                         CurrentModuleObject,
     848            7 :                                         state.dataGlobal->TimeStepsInHour));
     849           14 :                 ShowContinueError(state,
     850           14 :                                   format("Please see entry for {} in Input/Output Reference for discussion of considerations.", CurrentModuleObject));
     851              :             }
     852          171 :         } else if (Num == 0 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0 && !CondFDAlgo) {
     853            4 :             ShowWarningError(state, format("No {} object found.  Number of TimeSteps in Hour defaulted to 4.", CurrentModuleObject));
     854            4 :             state.dataGlobal->TimeStepsInHour = 4;
     855          167 :         } else if (Num == 0 && !CondFDAlgo) {
     856          167 :             state.dataGlobal->TimeStepsInHour = 4;
     857            0 :         } else if (Num == 0 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0 && CondFDAlgo) {
     858            0 :             ShowWarningError(state, format("No {} object found.  Number of TimeSteps in Hour defaulted to 20.", CurrentModuleObject));
     859            0 :             ShowContinueError(state, "...Due to presence of Conduction Finite Difference Algorithm selection.");
     860            0 :             state.dataGlobal->TimeStepsInHour = 20;
     861            0 :         } else if (Num == 0 && CondFDAlgo) {
     862            0 :             state.dataGlobal->TimeStepsInHour = 20;
     863              :         } else {
     864            0 :             ShowSevereError(state, format("Too many {} Objects found.", CurrentModuleObject));
     865            0 :             ErrorsFound = true;
     866              :         }
     867              : 
     868         1173 :         state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->TimeStepsInHour);
     869         1173 :         state.dataGlobal->MinutesInTimeStep = state.dataGlobal->TimeStepZone * 60;
     870         1173 :         state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * Constant::rSecsInHour;
     871              : 
     872         1173 :         CurrentModuleObject = "ConvergenceLimits";
     873         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     874         1173 :         if (Num == 1) {
     875           22 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     876              :                                                                      CurrentModuleObject,
     877              :                                                                      1,
     878              :                                                                      Alphas,
     879              :                                                                      NumAlpha,
     880              :                                                                      Number,
     881              :                                                                      NumNumber,
     882              :                                                                      IOStat,
     883           11 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
     884           11 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
     885           11 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
     886           11 :                                                                      state.dataIPShortCut->cNumericFieldNames);
     887           11 :             MinInt = int(Number(1));
     888           11 :             if (MinInt > state.dataGlobal->MinutesInTimeStep) {
     889            0 :                 MinInt = state.dataGlobal->MinutesInTimeStep;
     890              :             }
     891           11 :             if (MinInt < 0 || MinInt > 60) {
     892            0 :                 ShowWarningError(
     893              :                     state,
     894            0 :                     format(
     895            0 :                         "{}: Requested {} ({}) invalid. Set to 1 minute.", CurrentModuleObject, state.dataIPShortCut->cNumericFieldNames(1), MinInt));
     896            0 :                 state.dataConvergeParams->MinTimeStepSys = 1.0 / 60.0;
     897           11 :             } else if (MinInt == 0) { // Set to TimeStepZone
     898            0 :                 state.dataConvergeParams->MinTimeStepSys = state.dataGlobal->TimeStepZone;
     899              :             } else {
     900           11 :                 state.dataConvergeParams->MinTimeStepSys = double(MinInt) / 60.0;
     901              :             }
     902           11 :             state.dataConvergeParams->MaxIter = int(Number(2));
     903           11 :             if (state.dataConvergeParams->MaxIter <= 0) {
     904            0 :                 state.dataConvergeParams->MaxIter = 20;
     905              :             }
     906           11 :             if (!state.dataIPShortCut->lNumericFieldBlanks(3)) {
     907            0 :                 state.dataConvergeParams->MinPlantSubIterations = int(Number(3));
     908              :             }
     909           11 :             if (!state.dataIPShortCut->lNumericFieldBlanks(4)) {
     910            0 :                 state.dataConvergeParams->MaxPlantSubIterations = int(Number(4));
     911              :             }
     912              :             // trap bad values
     913           11 :             if (state.dataConvergeParams->MinPlantSubIterations < 1) {
     914            0 :                 state.dataConvergeParams->MinPlantSubIterations = 1;
     915              :             }
     916           11 :             if (state.dataConvergeParams->MaxPlantSubIterations < 3) {
     917            0 :                 state.dataConvergeParams->MaxPlantSubIterations = 3;
     918              :             }
     919           11 :             if (state.dataConvergeParams->MinPlantSubIterations > state.dataConvergeParams->MaxPlantSubIterations) {
     920            0 :                 state.dataConvergeParams->MaxPlantSubIterations = state.dataConvergeParams->MinPlantSubIterations + 1;
     921              :             }
     922              : 
     923         1162 :         } else if (Num == 0) {
     924         1162 :             state.dataConvergeParams->MinTimeStepSys = 1.0 / 60.0;
     925         1162 :             state.dataConvergeParams->MaxIter = 20;
     926         1162 :             state.dataConvergeParams->MinPlantSubIterations = 2;
     927         1162 :             state.dataConvergeParams->MaxPlantSubIterations = 8;
     928              :         } else {
     929            0 :             ShowSevereError(state, format("Too many {} Objects found.", CurrentModuleObject));
     930            0 :             ErrorsFound = true;
     931              :         }
     932              : 
     933         1173 :         state.dataHVACGlobal->LimitNumSysSteps = int(state.dataGlobal->TimeStepZone / state.dataConvergeParams->MinTimeStepSys);
     934              : 
     935         1173 :         state.dataReportFlag->DebugOutput = false;
     936         1173 :         state.dataReportFlag->EvenDuringWarmup = false;
     937         1173 :         CurrentModuleObject = "Output:DebuggingData";
     938         1173 :         NumDebugOut = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     939         1173 :         if (NumDebugOut > 1) {
     940            1 :             ShowWarningError(state, format("{}: More than 1 occurrence of this object found, only first will be used.", CurrentModuleObject));
     941              :         }
     942         1173 :         if (NumDebugOut > 0) {
     943            3 :             state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, 1, Alphas, NumAlpha, Number, NumNumber, IOStat);
     944            3 :             if (NumAlpha >= 1) {
     945            3 :                 state.dataReportFlag->DebugOutput = Util::SameString(Alphas(1), "Yes");
     946              :             }
     947            3 :             if (NumAlpha >= 2) {
     948            3 :                 state.dataReportFlag->EvenDuringWarmup = Util::SameString(Alphas(2), "Yes");
     949              :             }
     950              :         }
     951              : 
     952              :         {
     953         1173 :             CurrentModuleObject = "Output:Diagnostics";
     954         1173 :             Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
     955         1173 :             if (Num > 1) {
     956              :                 // Let it slide, but warn
     957              :                 // ErrorsFound = true;
     958            1 :                 ShowWarningError(state, format("{}: More than 1 occurrence of this object found, only first will be used.", CurrentModuleObject));
     959              :             }
     960         1173 :             auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(CurrentModuleObject);
     961              : 
     962         1173 :             if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) {
     963           21 :                 auto &instancesValue = instances.value();
     964           21 :                 for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
     965           21 :                     auto const &fields = instance.value();
     966           21 :                     std::string const &thisObjectName = instance.key();
     967           21 :                     state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, thisObjectName);
     968              : 
     969           21 :                     auto diagnosticsExtensibles = fields.find("diagnostics");
     970           21 :                     if (diagnosticsExtensibles != fields.end()) {
     971           58 :                         for (auto &diagnosticsExtensible : diagnosticsExtensibles.value()) {
     972              : 
     973              :                             // We want to avoid cryptic failures such as this one: "[json.exception.out_of_range.403] key 'key' not found"
     974              :                             // Which happens if you put an "empty" entry in the extensible portion
     975           38 :                             auto it = diagnosticsExtensible.find("key");
     976           38 :                             if (it == diagnosticsExtensible.end()) {
     977            2 :                                 ShowWarningError(state,
     978            2 :                                                  format("{}: empty key found, consider removing it to avoid this warning.", CurrentModuleObject));
     979            1 :                                 continue;
     980              :                             }
     981           37 :                             std::string diagnosticName = it->get<std::string>();
     982              : 
     983           37 :                             if (Util::SameString(diagnosticName, "DisplayExtraWarnings")) {
     984           16 :                                 state.dataGlobal->DisplayExtraWarnings = true;
     985           21 :                             } else if (Util::SameString(diagnosticName, "DisplayAdvancedReportVariables")) {
     986            4 :                                 state.dataGlobal->DisplayAdvancedReportVariables = true;
     987           17 :                             } else if (Util::SameString(diagnosticName, "DisplayAllWarnings")) {
     988            2 :                                 state.dataGlobal->DisplayAllWarnings = true;
     989            2 :                                 state.dataGlobal->DisplayExtraWarnings = true;
     990            2 :                                 state.dataGlobal->DisplayUnusedObjects = true;
     991            2 :                                 state.dataGlobal->DisplayUnusedSchedules = true;
     992           15 :                             } else if (Util::SameString(diagnosticName, "DisplayUnusedObjects")) {
     993            1 :                                 state.dataGlobal->DisplayUnusedObjects = true;
     994           14 :                             } else if (Util::SameString(diagnosticName, "DisplayUnusedSchedules")) {
     995            2 :                                 state.dataGlobal->DisplayUnusedSchedules = true;
     996           12 :                             } else if (Util::SameString(diagnosticName, "DisplayZoneAirHeatBalanceOffBalance")) {
     997            1 :                                 state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance = true;
     998           11 :                             } else if (Util::SameString(diagnosticName, "DoNotMirrorDetachedShading")) {
     999            1 :                                 state.dataReportFlag->MakeMirroredDetachedShading = false;
    1000           10 :                             } else if (Util::SameString(diagnosticName, "DoNotMirrorAttachedShading")) {
    1001            1 :                                 state.dataReportFlag->MakeMirroredAttachedShading = false;
    1002            9 :                             } else if (Util::SameString(diagnosticName, "ReportDuringWarmup")) {
    1003            1 :                                 state.dataSysVars->ReportDuringWarmup = true;
    1004            8 :                             } else if (Util::SameString(diagnosticName, "DisplayWeatherMissingDataWarnings")) {
    1005            1 :                                 state.dataEnvrn->DisplayWeatherMissingDataWarnings = true;
    1006            7 :                             } else if (Util::SameString(diagnosticName, "IgnoreSolarRadiation")) { // TODO: Not a valid key choice
    1007            1 :                                 state.dataEnvrn->IgnoreSolarRadiation = true;
    1008            6 :                             } else if (Util::SameString(diagnosticName, "IgnoreBeamRadiation")) { // TODO: Not a valid key choice
    1009            1 :                                 state.dataEnvrn->IgnoreBeamRadiation = true;
    1010            5 :                             } else if (Util::SameString(diagnosticName, "IgnoreDiffuseRadiation")) { // TODO: Not a valid key choice
    1011            1 :                                 state.dataEnvrn->IgnoreDiffuseRadiation = true;
    1012            4 :                             } else if (Util::SameString(diagnosticName, "DeveloperFlag")) { // TODO: Not a valid key choice
    1013            1 :                                 state.dataSysVars->DeveloperFlag = true;
    1014            3 :                             } else if (Util::SameString(diagnosticName, "TimingFlag")) { // TODO: Not a valid key choice
    1015            1 :                                 state.dataSysVars->TimingFlag = true;
    1016            2 :                             } else if (Util::SameString(diagnosticName, "ReportDetailedWarmupConvergence")) {
    1017            1 :                                 state.dataSysVars->ReportDetailedWarmupConvergence = true;
    1018            1 :                             } else if (Util::SameString(diagnosticName, "ReportDuringHVACSizingSimulation")) {
    1019            1 :                                 state.dataSysVars->ReportDuringHVACSizingSimulation = true;
    1020            0 :                             } else if (Util::SameString(diagnosticName, "CreateMinimalSurfaceVariables")) { // TODO: Not a valid key choice
    1021            0 :                                 continue;
    1022              :                                 //        CreateMinimalSurfaceVariables=.TRUE.
    1023            0 :                             } else if (Util::SameString(diagnosticName, "CreateNormalSurfaceVariables")) { // TODO: Not a valid key choice
    1024            0 :                                 continue;
    1025              :                                 //        IF (CreateMinimalSurfaceVariables) THEN
    1026              :                                 //          CALL ShowWarningError(state, 'GetProjectData: '//TRIM(CurrentModuleObject)//'=''//  &
    1027              :                                 //             TRIM(diagnosticName)//'', prior set=true for this condition reverts to false.')
    1028              :                                 //        ENDIF
    1029              :                                 //        CreateMinimalSurfaceVariables=.FALSE.
    1030            0 :                             } else if (!diagnosticName.empty()) {
    1031            0 :                                 ShowWarningError(state,
    1032            0 :                                                  format("GetProjectData: {}=\"{}\", Invalid value for field, entered value ignored.",
    1033              :                                                         CurrentModuleObject,
    1034              :                                                         diagnosticName));
    1035              :                             }
    1036           58 :                         }
    1037              :                     }
    1038              : 
    1039              :                     // Don't process the duplicate ones
    1040           21 :                     break;
    1041           42 :                 }
    1042              :             }
    1043         1173 :         }
    1044              : 
    1045         1173 :         CurrentModuleObject = "OutputControl:ReportingTolerances";
    1046         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
    1047         1173 :         if (Num > 0) {
    1048            0 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1049              :                                                                      CurrentModuleObject,
    1050              :                                                                      1,
    1051              :                                                                      Alphas,
    1052              :                                                                      NumAlpha,
    1053              :                                                                      Number,
    1054              :                                                                      NumNumber,
    1055              :                                                                      IOStat,
    1056            0 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
    1057            0 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
    1058            0 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
    1059            0 :                                                                      state.dataIPShortCut->cNumericFieldNames);
    1060            0 :             if (!state.dataIPShortCut->lNumericFieldBlanks(1)) {
    1061            0 :                 deviationFromSetPtThresholdHtg = -Number(1);
    1062              :             } else {
    1063            0 :                 deviationFromSetPtThresholdHtg = -0.2;
    1064              :             }
    1065            0 :             if (!state.dataIPShortCut->lNumericFieldBlanks(2)) {
    1066            0 :                 deviationFromSetPtThresholdClg = Number(2);
    1067              :             } else {
    1068            0 :                 deviationFromSetPtThresholdClg = 0.2;
    1069              :             }
    1070              :         }
    1071              : 
    1072         1173 :         state.dataHeatBalMgr->CurrentModuleObject = "OutputControl:ResilienceSummaries";
    1073         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, state.dataHeatBalMgr->CurrentModuleObject);
    1074         1173 :         if (Num > 0) {
    1075            0 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1076            0 :                                                                      state.dataHeatBalMgr->CurrentModuleObject,
    1077              :                                                                      1,
    1078              :                                                                      Alphas,
    1079              :                                                                      NumAlpha,
    1080              :                                                                      Number,
    1081              :                                                                      NumNumber,
    1082              :                                                                      IOStat,
    1083            0 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
    1084            0 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
    1085            0 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
    1086            0 :                                                                      state.dataIPShortCut->cNumericFieldNames);
    1087            0 :             if (NumAlpha > 0) {
    1088            0 :                 state.dataHeatBal->heatIndexMethod =
    1089            0 :                     static_cast<DataHeatBalance::HeatIndexMethod>(getEnumValue(DataHeatBalance::HeatIndexMethodUC, Util::makeUPPER(Alphas(1))));
    1090              :             }
    1091              :         }
    1092              : 
    1093         1173 :         state.dataGlobal->DoZoneSizing = false;
    1094         1173 :         state.dataGlobal->DoSystemSizing = false;
    1095         1173 :         state.dataGlobal->DoPlantSizing = false;
    1096         1173 :         state.dataGlobal->DoDesDaySim = true;
    1097         1173 :         state.dataGlobal->DoWeathSim = true;
    1098         1173 :         state.dataGlobal->DoHVACSizingSimulation = false;
    1099         1173 :         state.dataGlobal->HVACSizingSimMaxIterations = 0;
    1100         1173 :         CurrentModuleObject = "SimulationControl";
    1101         1173 :         NumRunControl = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
    1102         1173 :         if (NumRunControl > 0) {
    1103          162 :             state.dataSimulationManager->RunControlInInput = true;
    1104          324 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1105              :                                                                      CurrentModuleObject,
    1106              :                                                                      1,
    1107              :                                                                      Alphas,
    1108              :                                                                      NumAlpha,
    1109              :                                                                      Number,
    1110              :                                                                      NumNumber,
    1111              :                                                                      IOStat,
    1112          162 :                                                                      state.dataIPShortCut->lNumericFieldBlanks,
    1113          162 :                                                                      state.dataIPShortCut->lAlphaFieldBlanks,
    1114          162 :                                                                      state.dataIPShortCut->cAlphaFieldNames,
    1115          162 :                                                                      state.dataIPShortCut->cNumericFieldNames);
    1116          162 :             if (Alphas(1) == "YES") {
    1117           72 :                 state.dataGlobal->DoZoneSizing = true;
    1118              :             }
    1119          162 :             if (Alphas(2) == "YES") {
    1120           50 :                 state.dataGlobal->DoSystemSizing = true;
    1121              :             }
    1122          162 :             if (Alphas(3) == "YES") {
    1123           16 :                 state.dataGlobal->DoPlantSizing = true;
    1124              :             }
    1125          162 :             if (Alphas(4) == "NO") {
    1126           31 :                 state.dataGlobal->DoDesDaySim = false;
    1127              :             }
    1128          162 :             if (Alphas(5) == "NO") {
    1129          112 :                 state.dataGlobal->DoWeathSim = false;
    1130              :             }
    1131          162 :             if (NumAlpha > 5) {
    1132          162 :                 if (Alphas(6) == "YES") {
    1133            1 :                     state.dataGlobal->DoHVACSizingSimulation = true;
    1134              :                 }
    1135              :             }
    1136              :         }
    1137         1173 :         if (state.dataSysVars->DDOnly) {
    1138           26 :             state.dataGlobal->DoDesDaySim = true;
    1139           26 :             state.dataGlobal->DoWeathSim = false;
    1140              :         }
    1141         1173 :         if (state.dataSysVars->FullAnnualRun) {
    1142            0 :             state.dataGlobal->DoDesDaySim = false;
    1143            0 :             state.dataGlobal->DoWeathSim = true;
    1144              :         }
    1145              : 
    1146         1185 :         if ((!state.dataGlobal->DoDesDaySim && !state.dataGlobal->DoWeathSim && !state.dataGlobal->DoHVACSizingSimulation) &&
    1147           12 :             (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing)) {
    1148           11 :             state.dataGlobal->DoPureLoadCalc = true;
    1149              :         }
    1150              : 
    1151         1173 :         CurrentModuleObject = "PerformancePrecisionTradeoffs";
    1152         1173 :         auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(CurrentModuleObject);
    1153         1173 :         Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
    1154         1173 :         if (Num > 1) {
    1155            0 :             ErrorsFound = true;
    1156            0 :             ShowFatalError(state, format("GetProjectData: Only one (\"1\") {} object per simulation is allowed.", CurrentModuleObject));
    1157              :         }
    1158         1173 :         state.dataGlobal->createPerfLog = Num > 0;
    1159         1173 :         std::string overrideModeValue = "Normal";
    1160         1173 :         if (instances != state.dataInputProcessing->inputProcessor->epJSON.end()) {
    1161            4 :             auto &instancesValue = instances.value();
    1162            8 :             for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) {
    1163            4 :                 auto const &fields = instance.value();
    1164            4 :                 std::string const &thisObjectName = instance.key();
    1165            4 :                 state.dataInputProcessing->inputProcessor->markObjectAsUsed(CurrentModuleObject, thisObjectName);
    1166           12 :                 if (fields.find("use_coil_direct_solutions") != fields.end()) {
    1167            4 :                     state.dataGlobal->DoCoilDirectSolutions = Util::makeUPPER(fields.at("use_coil_direct_solutions").get<std::string>()) == "YES";
    1168              :                 }
    1169           12 :                 if (fields.find("zone_radiant_exchange_algorithm") != fields.end()) {
    1170            0 :                     state.dataHeatBalIntRadExchg->CarrollMethod =
    1171            0 :                         Util::makeUPPER(fields.at("zone_radiant_exchange_algorithm").get<std::string>()) == "CARROLLMRT";
    1172              :                 }
    1173           12 :                 if (fields.find("use_representative_surfaces_for_calculations") != fields.end()) {
    1174            0 :                     state.dataSurface->UseRepresentativeSurfaceCalculations =
    1175            0 :                         Util::makeUPPER(fields.at("use_representative_surfaces_for_calculations").get<std::string>()) == "YES";
    1176              :                 }
    1177            4 :                 bool overrideTimestep(false);
    1178            4 :                 bool overrideZoneAirHeatBalAlg(false);
    1179            4 :                 bool overrideMinNumWarmupDays(false);
    1180            4 :                 bool overrideBeginEnvResetSuppress(false);
    1181            4 :                 bool overrideMaxZoneTempDiff(false);
    1182            4 :                 bool overrideSystemTimestep(false);
    1183            4 :                 bool overrideMaxAllowedDelTemp(false);
    1184            4 :                 bool overridePsychTsatFnPb(false);
    1185            4 :                 state.dataZoneTempPredictorCorrector->OscillationVariablesNeeded = true;
    1186           12 :                 if (fields.find("override_mode") != fields.end()) {
    1187            2 :                     overrideModeValue = Util::makeUPPER(fields.at("override_mode").get<std::string>());
    1188            2 :                     if (overrideModeValue == "NORMAL") {
    1189              :                         // no overrides
    1190            2 :                     } else if (overrideModeValue == "MODE01") {
    1191              :                         // Zone Time step (TimeStep object) will be set to one timestep per hour
    1192            2 :                         overrideTimestep = true;
    1193            0 :                     } else if (overrideModeValue == "MODE02") {
    1194              :                         // Mode01 plus ZoneAirHeatBalanceAlgorithm will be set to Euler
    1195            0 :                         overrideTimestep = true;
    1196            0 :                         overrideZoneAirHeatBalAlg = true;
    1197            0 :                     } else if (overrideModeValue == "MODE03") {
    1198              :                         // Mode02 plus Minimum Number of Warmup Days will be set to 1
    1199            0 :                         overrideTimestep = true;
    1200            0 :                         overrideZoneAirHeatBalAlg = true;
    1201            0 :                         overrideMinNumWarmupDays = true;
    1202            0 :                     } else if (overrideModeValue == "MODE04") {
    1203              :                         // Mode03 plus Begin Environment Reset Mode will be set to SuppressAllBeginEnvironmentResets
    1204            0 :                         overrideTimestep = true;
    1205            0 :                         overrideZoneAirHeatBalAlg = true;
    1206            0 :                         overrideMinNumWarmupDays = true;
    1207            0 :                         overrideBeginEnvResetSuppress = true;
    1208            0 :                     } else if (overrideModeValue == "MODE05") {
    1209              :                         // Mode04 plus Minimun System Timestep will be set to 1hr
    1210            0 :                         overrideTimestep = true;
    1211            0 :                         overrideZoneAirHeatBalAlg = true;
    1212            0 :                         overrideMinNumWarmupDays = true;
    1213            0 :                         overrideBeginEnvResetSuppress = true;
    1214            0 :                         overrideSystemTimestep = true;
    1215            0 :                     } else if (overrideModeValue == "MODE06") {
    1216              :                         // Mode05 plus cubic spline interpolations in replacement of the original psychrometric function PsychTsatFnPb
    1217            0 :                         overrideTimestep = true;
    1218            0 :                         overrideZoneAirHeatBalAlg = true;
    1219            0 :                         overrideMinNumWarmupDays = true;
    1220            0 :                         overrideBeginEnvResetSuppress = true;
    1221            0 :                         overrideSystemTimestep = true;
    1222            0 :                         overridePsychTsatFnPb = true;
    1223            0 :                     } else if (overrideModeValue == "MODE07") {
    1224              :                         // Mode06 plus internal variable MaxZoneTempDiff will be set to 1.00
    1225            0 :                         overrideTimestep = true;
    1226            0 :                         overrideZoneAirHeatBalAlg = true;
    1227            0 :                         overrideMinNumWarmupDays = true;
    1228            0 :                         overrideBeginEnvResetSuppress = true;
    1229            0 :                         overrideSystemTimestep = true;
    1230            0 :                         overrideMaxZoneTempDiff = true;
    1231            0 :                         overridePsychTsatFnPb = true;
    1232            0 :                     } else if (overrideModeValue == "MODE08") {
    1233              :                         // Mode07 plus internal variable MaxAllowedDelTemp will be set to 0.1
    1234            0 :                         overrideTimestep = true;
    1235            0 :                         overrideZoneAirHeatBalAlg = true;
    1236            0 :                         overrideMinNumWarmupDays = true;
    1237            0 :                         overrideBeginEnvResetSuppress = true;
    1238            0 :                         overrideSystemTimestep = true;
    1239            0 :                         overrideMaxZoneTempDiff = true;
    1240            0 :                         overrideMaxAllowedDelTemp = true;
    1241            0 :                         overridePsychTsatFnPb = true;
    1242            0 :                     } else if (overrideModeValue == "ADVANCED") {
    1243            0 :                         bool advancedModeUsed = false;
    1244            0 :                         if (fields.find("maxzonetempdiff") != fields.end()) { // not required field, has default value
    1245            0 :                             state.dataConvergeParams->MaxZoneTempDiff = fields.at("maxzonetempdiff").get<Real64>();
    1246            0 :                             ShowWarningError(state,
    1247            0 :                                              format("PerformancePrecisionTradeoffs using the Advanced Override Mode, MaxZoneTempDiff set to: {:.4R}",
    1248            0 :                                                     state.dataConvergeParams->MaxZoneTempDiff));
    1249            0 :                             advancedModeUsed = true;
    1250              :                         }
    1251            0 :                         if (fields.find("maxalloweddeltemp") != fields.end()) { // not required field, has default value
    1252            0 :                             state.dataHeatBal->MaxAllowedDelTemp = fields.at("maxalloweddeltemp").get<Real64>();
    1253            0 :                             ShowWarningError(
    1254              :                                 state,
    1255            0 :                                 format("PerformancePrecisionTradeoffs using the Advanced Override Mode, MaxAllowedDelTemp set to: {:.4R}",
    1256            0 :                                        state.dataHeatBal->MaxAllowedDelTemp));
    1257            0 :                             advancedModeUsed = true;
    1258              :                         }
    1259            0 :                         if (advancedModeUsed) {
    1260            0 :                             ShowContinueError(state,
    1261              :                                               "...Care should be used when using the Advanced Override Mode. Results may be significantly different "
    1262              :                                               "than a simulation not using this mode.");
    1263              :                         } else {
    1264            0 :                             ShowWarningError(
    1265              :                                 state, "PerformancePrecisionTradeoffs using the Advanced Override Mode but no specific parameters have been set.");
    1266              :                         }
    1267              :                     } else {
    1268            0 :                         ShowSevereError(state,
    1269            0 :                                         format("Invalid over ride mode specified in PerformancePrecisionTradeoffs object: {}", overrideModeValue));
    1270              :                     }
    1271              : 
    1272            2 :                     if (overrideTimestep) {
    1273            4 :                         ShowWarningError(state, "Due to PerformancePrecisionTradeoffs Override Mode, the Number of TimeSteps has been changed to 1.");
    1274            2 :                         state.dataGlobal->TimeStepsInHour = 1;
    1275            2 :                         state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->TimeStepsInHour);
    1276            2 :                         state.dataGlobal->MinutesInTimeStep = state.dataGlobal->TimeStepZone * Constant::rMinutesInHour;
    1277            2 :                         state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * Constant::rSecsInHour;
    1278            2 :                         state.dataGlobal->OverrideTimestep = true;
    1279              :                     }
    1280            2 :                     if (overrideZoneAirHeatBalAlg) {
    1281            0 :                         ShowWarningError(
    1282              :                             state,
    1283              :                             "Due to PerformancePrecisionTradeoffs Override Mode, the ZoneAirHeatBalanceAlgorithm has been changed to EulerMethod.");
    1284            0 :                         state.dataHeatBal->OverrideZoneAirSolutionAlgo = true;
    1285              :                     }
    1286            2 :                     if (overrideMinNumWarmupDays) {
    1287            0 :                         ShowWarningError(
    1288              :                             state, "Due to PerformancePrecisionTradeoffs Override Mode, the Minimum Number of Warmup Days has been changed to 1.");
    1289            0 :                         state.dataHeatBal->MinNumberOfWarmupDays = 1;
    1290              :                     }
    1291            2 :                     if (overrideBeginEnvResetSuppress) {
    1292            0 :                         ShowWarningError(state,
    1293              :                                          "Due to PerformancePrecisionTradeoffs Override Mode, the Begin Environment Reset Mode has been changed to "
    1294              :                                          "SuppressAllBeginEnvironmentResets.");
    1295            0 :                         state.dataEnvrn->forceBeginEnvResetSuppress = true;
    1296              :                     }
    1297            2 :                     if (overrideSystemTimestep) {
    1298            0 :                         ShowWarningError(
    1299              :                             state, "Due to PerformancePrecisionTradeoffs Override Mode, the minimum System TimeSteps has been changed to 1 hr.");
    1300            0 :                         int MinTimeStepSysOverrideValue = 60.0;
    1301            0 :                         if (MinTimeStepSysOverrideValue > state.dataGlobal->MinutesInTimeStep) {
    1302            0 :                             MinTimeStepSysOverrideValue = state.dataGlobal->MinutesInTimeStep;
    1303              :                         }
    1304            0 :                         state.dataConvergeParams->MinTimeStepSys = MinTimeStepSysOverrideValue / 60.0;
    1305            0 :                         state.dataHVACGlobal->LimitNumSysSteps = int(state.dataGlobal->TimeStepZone / state.dataConvergeParams->MinTimeStepSys);
    1306              :                     }
    1307            2 :                     if (overridePsychTsatFnPb) {
    1308            0 :                         ShowWarningError(state,
    1309              :                                          "Due to PerformancePrecisionTradeoffs Override Mode, the saturated temperature will be calculated using "
    1310              :                                          "cubic spline interpolations in replacement of PsychTsatFnPb .");
    1311              :                         // Mode06 CSpline interpolation (64 Pa bin size + 20/16 bit)
    1312            0 :                         state.dataPsychrometrics->useInterpolationPsychTsatFnPb = true;
    1313              : #ifdef EP_cache_PsyTsatFnPb
    1314            0 :                         state.dataPsychCache->tsatprecision_bits = 20;
    1315              : #endif
    1316              :                     }
    1317            2 :                     if (overrideMaxZoneTempDiff) {
    1318            0 :                         ShowWarningError(
    1319              :                             state, "Due to PerformancePrecisionTradeoffs Override Mode, internal variable MaxZoneTempDiff will be set to 1.0 .");
    1320            0 :                         state.dataConvergeParams->MaxZoneTempDiff = 1.0;
    1321              :                     }
    1322            2 :                     if (overrideMaxAllowedDelTemp) {
    1323            0 :                         ShowWarningError(
    1324              :                             state, "Due to PerformancePrecisionTradeoffs Override Mode, internal variable MaxAllowedDelTemp will be set to 0.1 .");
    1325            0 :                         state.dataHeatBal->MaxAllowedDelTemp = 0.1;
    1326              :                     }
    1327              :                 }
    1328            4 :             }
    1329              :         }
    1330         1173 :         if (ErrorsFound) {
    1331            0 :             ShowFatalError(state, "Errors found getting Project Input");
    1332              :         }
    1333              : 
    1334         1173 :         print(state.files.eio, "{}\n", "! <Version>, Version ID");
    1335              :         static constexpr std::string_view Format_721(" Version, {}\n");
    1336         1173 :         print(state.files.eio, Format_721, VersionID);
    1337              : 
    1338         1173 :         print(state.files.eio, "{}\n", "! <Timesteps per Hour>, #TimeSteps, Minutes per TimeStep {minutes}");
    1339              :         static constexpr std::string_view Format_731(" Timesteps per Hour, {:2}, {:2}\n");
    1340         1173 :         print(state.files.eio, Format_731, state.dataGlobal->TimeStepsInHour, state.dataGlobal->MinutesInTimeStep);
    1341              : 
    1342         1173 :         print(state.files.eio,
    1343              :               "{}\n",
    1344              :               "! <System Convergence Limits>, Minimum System TimeStep {minutes}, Max HVAC Iterations, Minimum Plant "
    1345              :               "Iterations, Maximum Plant Iterations");
    1346         1173 :         MinInt = state.dataConvergeParams->MinTimeStepSys * 60.0;
    1347              :         static constexpr std::string_view Format_733(" System Convergence Limits, {}, {}, {}, {}\n");
    1348         1173 :         print(state.files.eio,
    1349              :               Format_733,
    1350              :               MinInt,
    1351         1173 :               state.dataConvergeParams->MaxIter,
    1352         1173 :               state.dataConvergeParams->MinPlantSubIterations,
    1353         1173 :               state.dataConvergeParams->MaxPlantSubIterations);
    1354              : 
    1355         1173 :         if (state.dataGlobal->DoZoneSizing) {
    1356           72 :             Alphas(1) = "Yes";
    1357              :         } else {
    1358         1101 :             Alphas(1) = "No";
    1359              :         }
    1360         1173 :         if (state.dataGlobal->DoSystemSizing) {
    1361           50 :             Alphas(2) = "Yes";
    1362              :         } else {
    1363         1123 :             Alphas(2) = "No";
    1364              :         }
    1365         1173 :         if (state.dataGlobal->DoPlantSizing) {
    1366           16 :             Alphas(3) = "Yes";
    1367              :         } else {
    1368         1157 :             Alphas(3) = "No";
    1369              :         }
    1370         1173 :         if (state.dataGlobal->DoDesDaySim) {
    1371         1143 :             Alphas(4) = "Yes";
    1372              :         } else {
    1373           30 :             Alphas(4) = "No";
    1374              :         }
    1375         1173 :         if (state.dataGlobal->DoWeathSim) {
    1376         1036 :             Alphas(5) = "Yes";
    1377              :         } else {
    1378          137 :             Alphas(5) = "No";
    1379              :         }
    1380         1173 :         if (state.dataGlobal->DoHVACSizingSimulation) {
    1381            1 :             Alphas(6) = "Yes";
    1382            1 :             if (NumNumber >= 1) {
    1383            1 :                 state.dataGlobal->HVACSizingSimMaxIterations = Number(1);
    1384              :             }
    1385              :         } else {
    1386         1172 :             Alphas(6) = "No";
    1387              :         }
    1388              : 
    1389         1173 :         print(state.files.eio,
    1390              :               "{}\n",
    1391              :               "! <Simulation Control>, Do Zone Sizing, Do System Sizing, Do Plant Sizing, Do Design Days, Do Weather "
    1392              :               "Simulation, Do HVAC Sizing Simulation");
    1393         1173 :         print(state.files.eio, " Simulation Control");
    1394         8211 :         for (Num = 1; Num <= 6; ++Num) {
    1395         7038 :             print(state.files.eio, ", {}", Alphas(Num));
    1396              :         }
    1397         1173 :         print(state.files.eio, "\n");
    1398              : 
    1399              :         // Performance Precision Tradeoffs
    1400         1173 :         if (state.dataGlobal->DoCoilDirectSolutions) {
    1401            1 :             Alphas(1) = "Yes";
    1402            3 :             ShowWarningError(state, "PerformancePrecisionTradeoffs: Coil Direct Solution simulation is selected.");
    1403              :         } else {
    1404         1172 :             Alphas(1) = "No";
    1405              :         }
    1406         1173 :         if (state.dataHeatBalIntRadExchg->CarrollMethod) {
    1407            0 :             Alphas(2) = "CarrollMRT";
    1408            0 :             ShowWarningError(state, "PerformancePrecisionTradeoffs: Carroll MRT radiant exchange method is selected.");
    1409              :         } else {
    1410         1173 :             Alphas(2) = "ScriptF";
    1411              :         }
    1412         1173 :         Alphas(3) = overrideModeValue;
    1413         1173 :         Alphas(4) = fmt::to_string(state.dataGlobal->TimeStepsInHour);
    1414         1173 :         if (state.dataHeatBal->OverrideZoneAirSolutionAlgo) {
    1415            0 :             Alphas(5) = "Yes";
    1416              :         } else {
    1417         1173 :             Alphas(5) = "No";
    1418              :         }
    1419         1173 :         Alphas(6) = fmt::to_string(state.dataHeatBal->MinNumberOfWarmupDays);
    1420         1173 :         if (state.dataEnvrn->forceBeginEnvResetSuppress) {
    1421            0 :             Alphas(7) = "Yes";
    1422              :         } else {
    1423         1173 :             Alphas(7) = "No";
    1424              :         }
    1425         1173 :         Alphas(8) = format("{:.1R}", state.dataConvergeParams->MinTimeStepSys * 60.0);
    1426         1173 :         Alphas(9) = format("{:.3R}", state.dataConvergeParams->MaxZoneTempDiff);
    1427         1173 :         Alphas(10) = format("{:.4R}", state.dataHeatBal->MaxAllowedDelTemp);
    1428              :         std::string pptHeader = "! <Performance Precision Tradeoffs>, Use Coil Direct Simulation, "
    1429              :                                 "Zone Radiant Exchange Algorithm, Override Mode, Number of Timestep In Hour, "
    1430              :                                 "Force Euler Method, Minimum Number of Warmup Days, Force Suppress All Begin Environment Resets, "
    1431         1173 :                                 "Minimum System Timestep, MaxZoneTempDiff, MaxAllowedDelTemp";
    1432         1173 :         print(state.files.eio, "{}\n", pptHeader);
    1433         1173 :         print(state.files.eio, " Performance Precision Tradeoffs");
    1434        12903 :         for (Num = 1; Num <= 10; ++Num) {
    1435        11730 :             print(state.files.eio, ", {}", Alphas(Num));
    1436              :         }
    1437         1173 :         print(state.files.eio, "\n");
    1438              : 
    1439         1173 :         print(state.files.eio,
    1440              :               "{}\n",
    1441              :               "! <Output Reporting Tolerances>, Tolerance for Time Heating Setpoint Not Met, Tolerance for Zone Cooling Setpoint Not Met Time");
    1442              :         // Formats
    1443              :         static constexpr std::string_view Format_751(" Output Reporting Tolerances, {:.3R}, {:.3R}, \n");
    1444              : 
    1445         1173 :         print(state.files.eio, Format_751, std::abs(deviationFromSetPtThresholdHtg), deviationFromSetPtThresholdClg);
    1446              : 
    1447              :         //  IF (DisplayExtraWarnings) THEN
    1448              :         //    Write(OutputFileInits,740)
    1449              :         //    Write(OutputFileInits,741) (TRIM(Alphas(Num)),Num=1,5)
    1450              :         // 742 Format('! <Display Extra Warnings>, Display Advanced Report Variables, Do Not Mirror Detached Shading')
    1451              :         //    IF (DisplayAdvancedReportVariables) THEN
    1452              :         //      NumOut1='Yes'
    1453              :         //    ELSE
    1454              :         //      NumOut2='No'
    1455              :         //    ENDIF
    1456              :         //    IF (.not. MakeMirroredDetachedShading) THEN
    1457              :         //      NumOut1='Yes'
    1458              :         //    ELSE
    1459              :         //      NumOut2='No'
    1460              :         //    ENDIF
    1461              :         // unused0909743 Format(' Display Extra Warnings',2(', ',A))
    1462              :         //  ENDIF
    1463         1173 :         if (state.dataGlobal->createPerfLog) {
    1464            4 :             writeInitialPerfLogValues(state, overrideModeValue);
    1465              :         }
    1466         1173 :     }
    1467              : 
    1468            5 :     void writeInitialPerfLogValues(EnergyPlusData &state, std::string const &currentOverrideModeValue)
    1469              :     // write the input related portions of the .perflog
    1470              :     // J.Glazer February 2020
    1471              :     {
    1472            5 :         Util::appendPerfLog(state,
    1473              :                             "Program, Version, TimeStamp",
    1474            5 :                             state.dataStrGlobals->VerStringVar); // this string already includes three portions and has commas
    1475           15 :         Util::appendPerfLog(state, "Use Coil Direct Solution", bool_to_string(state.dataGlobal->DoCoilDirectSolutions));
    1476            5 :         if (state.dataHeatBalIntRadExchg->CarrollMethod) {
    1477            0 :             Util::appendPerfLog(state, "Zone Radiant Exchange Algorithm", "CarrollMRT");
    1478              :         } else {
    1479           20 :             Util::appendPerfLog(state, "Zone Radiant Exchange Algorithm", "ScriptF");
    1480              :         }
    1481            5 :         Util::appendPerfLog(state, "Override Mode", currentOverrideModeValue);
    1482           15 :         Util::appendPerfLog(state, "Number of Timesteps per Hour", fmt::to_string(state.dataGlobal->TimeStepsInHour));
    1483           15 :         Util::appendPerfLog(state, "Minimum Number of Warmup Days", fmt::to_string(state.dataHeatBal->MinNumberOfWarmupDays));
    1484           15 :         Util::appendPerfLog(state, "SuppressAllBeginEnvironmentResets", bool_to_string(state.dataEnvrn->forceBeginEnvResetSuppress));
    1485           15 :         Util::appendPerfLog(state, "Minimum System Timestep", format("{:.1R}", state.dataConvergeParams->MinTimeStepSys * 60.0));
    1486           15 :         Util::appendPerfLog(state, "MaxZoneTempDiff", format("{:.2R}", state.dataConvergeParams->MaxZoneTempDiff));
    1487           15 :         Util::appendPerfLog(state, "MaxAllowedDelTemp", format("{:.4R}", state.dataHeatBal->MaxAllowedDelTemp));
    1488            5 :     }
    1489              : 
    1490           12 :     std::string bool_to_string(bool logical)
    1491              :     {
    1492           12 :         if (logical) {
    1493            4 :             return ("True");
    1494              :         } else {
    1495           20 :             return ("False");
    1496              :         }
    1497              :     }
    1498              : 
    1499           77 :     void CheckForMisMatchedEnvironmentSpecifications(EnergyPlusData &state)
    1500              :     {
    1501              : 
    1502              :         // SUBROUTINE INFORMATION:
    1503              :         //       AUTHOR         Linda Lawrie
    1504              :         //       DATE WRITTEN   August 2008
    1505              :         //       MODIFIED       na
    1506              :         //       RE-ENGINEERED  na
    1507              : 
    1508              :         // PURPOSE OF THIS SUBROUTINE:
    1509              :         // In response to CR 7518, this routine will check to see if a proper combination of SimulationControl, RunPeriod,
    1510              :         // SizingPeriod:*, etc are entered to proceed with a simulation.
    1511              : 
    1512              :         // METHODOLOGY EMPLOYED:
    1513              :         // For now (8/2008), the routine will query several objects in the input.  And try to produce warnings or
    1514              :         // fatals as a result.
    1515              : 
    1516              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1517              :         int NumZoneSizing;
    1518              :         int NumSystemSizing;
    1519              :         int NumPlantSizing;
    1520              :         int NumDesignDays;
    1521              :         int NumRunPeriodDesign;
    1522              :         int NumSizingDays;
    1523              :         bool WeatherFileAttached;
    1524              :         bool ErrorsFound;
    1525              : 
    1526           77 :         ErrorsFound = false;
    1527           77 :         NumZoneSizing = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Sizing:Zone");
    1528           77 :         NumSystemSizing = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Sizing:System");
    1529           77 :         NumPlantSizing = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Sizing:Plant");
    1530           77 :         NumDesignDays = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay");
    1531           77 :         NumRunPeriodDesign = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") +
    1532           77 :                              state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType");
    1533           77 :         NumSizingDays = NumDesignDays + NumRunPeriodDesign;
    1534              : 
    1535           77 :         WeatherFileAttached = FileSystem::fileExists(state.files.inputWeatherFilePath.filePath);
    1536              : 
    1537           77 :         if (state.dataSimulationManager->RunControlInInput) {
    1538           76 :             if (state.dataGlobal->DoZoneSizing) {
    1539           34 :                 if (NumZoneSizing > 0 && NumSizingDays == 0) {
    1540            0 :                     ErrorsFound = true;
    1541            0 :                     ShowSevereError(
    1542              :                         state, "CheckEnvironmentSpecifications: Sizing for Zones has been requested but there are no design environments specified.");
    1543            0 :                     ShowContinueError(state, "...Add appropriate SizingPeriod:* objects for your simulation.");
    1544              :                 }
    1545           34 :                 if (NumZoneSizing > 0 && NumRunPeriodDesign > 0 && !WeatherFileAttached) {
    1546            0 :                     ErrorsFound = true;
    1547            0 :                     ShowSevereError(state,
    1548              :                                     "CheckEnvironmentSpecifications: Sizing for Zones has been requested; Design period from the weather file "
    1549              :                                     "requested; but no weather file specified.");
    1550              :                 }
    1551              :             }
    1552           76 :             if (state.dataGlobal->DoSystemSizing) {
    1553           23 :                 if (NumSystemSizing > 0 && NumSizingDays == 0) {
    1554            0 :                     ErrorsFound = true;
    1555            0 :                     ShowSevereError(
    1556              :                         state,
    1557              :                         "CheckEnvironmentSpecifications: Sizing for Systems has been requested but there are no design environments specified.");
    1558            0 :                     ShowContinueError(state, "...Add appropriate SizingPeriod:* objects for your simulation.");
    1559              :                 }
    1560           23 :                 if (NumSystemSizing > 0 && NumRunPeriodDesign > 0 && !WeatherFileAttached) {
    1561            0 :                     ErrorsFound = true;
    1562            0 :                     ShowSevereError(state,
    1563              :                                     "CheckEnvironmentSpecifications: Sizing for Systems has been requested; Design period from the weather file "
    1564              :                                     "requested; but no weather file specified.");
    1565              :                 }
    1566              :             }
    1567           76 :             if (state.dataGlobal->DoPlantSizing) {
    1568            5 :                 if (NumPlantSizing > 0 && NumSizingDays == 0) {
    1569            0 :                     ErrorsFound = true;
    1570            0 :                     ShowSevereError(state,
    1571              :                                     "CheckEnvironmentSpecifications: Sizing for Equipment/Plants has been requested but there are no design "
    1572              :                                     "environments specified.");
    1573            0 :                     ShowContinueError(state, "...Add appropriate SizingPeriod:* objects for your simulation.");
    1574              :                 }
    1575            5 :                 if (NumPlantSizing > 0 && NumRunPeriodDesign > 0 && !WeatherFileAttached) {
    1576            0 :                     ErrorsFound = true;
    1577            0 :                     ShowSevereError(state,
    1578              :                                     "CheckEnvironmentSpecifications: Sizing for Equipment/Plants has been requested; Design period from the weather "
    1579              :                                     "file requested; but no weather file specified.");
    1580              :                 }
    1581              :             }
    1582           76 :             if (state.dataGlobal->DoDesDaySim && NumSizingDays == 0) {
    1583            0 :                 ShowWarningError(state,
    1584              :                                  "CheckEnvironmentSpecifications: SimulationControl specified doing design day simulations, but no design "
    1585              :                                  "environments specified.");
    1586            0 :                 ShowContinueError(
    1587              :                     state,
    1588              :                     "...No design environment results produced. For these results, add appropriate SizingPeriod:* objects for your simulation.");
    1589              :             }
    1590           76 :             if (state.dataGlobal->DoDesDaySim && NumRunPeriodDesign > 0 && !WeatherFileAttached) {
    1591            0 :                 ErrorsFound = true;
    1592            0 :                 ShowSevereError(state,
    1593              :                                 "CheckEnvironmentSpecifications: SimulationControl specified doing design day simulations; weather file design "
    1594              :                                 "environments specified; but no weather file specified.");
    1595              :             }
    1596           76 :             if (state.dataGlobal->DoWeathSim && !state.dataSimulationManager->RunPeriodsInInput) {
    1597            0 :                 ShowWarningError(state,
    1598              :                                  "CheckEnvironmentSpecifications: SimulationControl specified doing weather simulations, but no run periods for "
    1599              :                                  "weather file specified.  No annual results produced.");
    1600              :             }
    1601           76 :             if (state.dataGlobal->DoWeathSim && state.dataSimulationManager->RunPeriodsInInput && !WeatherFileAttached) {
    1602            0 :                 ShowWarningError(state,
    1603              :                                  "CheckEnvironmentSpecifications: SimulationControl specified doing weather simulations; run periods for weather "
    1604              :                                  "file specified; but no weather file specified.");
    1605              :             }
    1606              :         }
    1607              : 
    1608           77 :         if (!state.dataGlobal->DoDesDaySim && !state.dataGlobal->DoWeathSim) {
    1609              :             // This amounts to checking: (!DoHVACSizingSimulation && !DoZoneSizing && !DoSystemSizing)
    1610           10 :             if (!state.dataGlobal->DoHVACSizingSimulation && !state.dataGlobal->DoPureLoadCalc) {
    1611            2 :                 ShowSevereError(state, "All elements of SimulationControl are set to \"No\". No simulations can be done. Program terminates.");
    1612            1 :                 ErrorsFound = true;
    1613              :             } else {
    1614           27 :                 ShowWarningError(state,
    1615              :                                  "\"Run Simulation for Sizing Periods\" and \"Run Simulation for Weather File Run Periods\" are both set to \"No\". "
    1616              :                                  "No simulations will be performed, and most input will not be read.");
    1617              :             }
    1618              :         }
    1619              : 
    1620           77 :         if (ErrorsFound) {
    1621            3 :             ShowFatalError(state, "Program terminates due to preceding conditions.");
    1622              :         }
    1623           76 :     }
    1624              : 
    1625           75 :     void CheckForRequestedReporting(EnergyPlusData &state)
    1626              :     {
    1627              : 
    1628              :         // SUBROUTINE INFORMATION:
    1629              :         //       AUTHOR         Linda Lawrie
    1630              :         //       DATE WRITTEN   January 2009
    1631              : 
    1632              :         // PURPOSE OF THIS SUBROUTINE:
    1633              :         // EnergyPlus does not automatically produce any results files.  Because of this, users may not request
    1634              :         // reports and may get confused when nothing is produced.  This routine will provide a warning when
    1635              :         // results should be produced (either sizing periods or weather files are run) but no reports are
    1636              :         // requested.
    1637              : 
    1638           75 :         bool SimPeriods = (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:DesignDay") > 0 ||
    1639            1 :                            state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileDays") > 0 ||
    1640           77 :                            state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "SizingPeriod:WeatherFileConditionType") > 0 ||
    1641            1 :                            state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod") > 0);
    1642              : 
    1643           75 :         if ((state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim || state.dataGlobal->DoPureLoadCalc) && SimPeriods) {
    1644              :             bool ReportingRequested =
    1645           74 :                 (state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:SummaryReports") > 0 ||
    1646           35 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:TimeBins") > 0 ||
    1647           35 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:Monthly") > 0 ||
    1648           35 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Table:Annual") > 0 ||
    1649           35 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Variable") > 0 ||
    1650           34 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter") > 0 ||
    1651           33 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:MeterFileOnly") > 0 ||
    1652          142 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:Cumulative") > 0 ||
    1653           33 :                  state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Output:Meter:Cumulative:MeterFileOnly") > 0);
    1654              :             // Not testing for : Output:SQLite or Output:EnvironmentalImpactFactors
    1655           74 :             if (!ReportingRequested) {
    1656           66 :                 ShowWarningError(state, "No reporting elements have been requested. No simulation results produced.");
    1657           99 :                 ShowContinueError(state,
    1658              :                                   "...Review requirements such as \"Output:Table:SummaryReports\", \"Output:Table:Monthly\", \"Output:Variable\", "
    1659              :                                   "\"Output:Meter\" and others.");
    1660              :             }
    1661              :         }
    1662           75 :     }
    1663              : 
    1664            0 :     std::unique_ptr<std::ostream> OpenStreamFile(EnergyPlusData &state, const fs::path &filePath, std::ios_base::openmode mode)
    1665              :     {
    1666            0 :         auto result = std::make_unique<std::ofstream>(filePath, mode); // (AUTO_OK_UPTR)
    1667            0 :         if (!result->good()) {
    1668            0 :             ShowFatalError(state, format("OpenOutputFiles: Could not open file {} for output (write).", filePath));
    1669              :         }
    1670            0 :         return result;
    1671            0 :     }
    1672              : 
    1673            0 :     std::unique_ptr<fmt::ostream> OpenFmtStreamFile(EnergyPlusData &state, const fs::path &filePath)
    1674              :     {
    1675            0 :         std::unique_ptr<fmt::ostream> result = nullptr;
    1676              : #ifdef _WIN32
    1677              :         std::string filePathStr = FileSystem::toString(filePath);
    1678              :         const char *path = filePathStr.c_str();
    1679              : #else
    1680            0 :         const char *path = filePath.c_str();
    1681              : #endif
    1682              :         try {
    1683            0 :             auto f = fmt::output_file(path, fmt::buffer_size = (2 << 17)); // (AUTO_OK_OBJ)
    1684            0 :             result = std::make_unique<fmt::ostream>(std::move(f));
    1685            0 :         } catch (const std::system_error &error) {
    1686            0 :             ShowSevereError(state, error.what());
    1687            0 :             ShowFatalError(state, format("OpenOutputFiles: Could not open file {} for output (write).", filePath));
    1688            0 :         }
    1689            0 :         return result;
    1690            0 :     }
    1691              : 
    1692         1155 :     void OpenOutputFiles(EnergyPlusData &state)
    1693              :     {
    1694              : 
    1695              :         // SUBROUTINE INFORMATION:
    1696              :         //       AUTHOR         Rick Strand
    1697              :         //       DATE WRITTEN   June 1997
    1698              :         //       MODIFIED       na
    1699              :         //       RE-ENGINEERED  na
    1700              : 
    1701              :         // PURPOSE OF THIS SUBROUTINE:
    1702              :         // This subroutine opens all of the input and output files needed for
    1703              :         // an EnergyPlus run.
    1704              : 
    1705         1155 :         state.dataGlobal->StdOutputRecordCount = 0;
    1706         2310 :         state.files.eso.ensure_open(state, "OpenOutputFiles", state.files.outputControl.eso);
    1707         1155 :         print(state.files.eso, "Program Version,{}\n", state.dataStrGlobals->VerStringVar);
    1708              : 
    1709              :         // Open the Initialization Output File
    1710         2310 :         state.files.eio.ensure_open(state, "OpenOutputFiles", state.files.outputControl.eio);
    1711         1155 :         print(state.files.eio, "Program Version,{}\n", state.dataStrGlobals->VerStringVar);
    1712              : 
    1713              :         // Open the Meters Output File
    1714         2310 :         state.files.mtr.ensure_open(state, "OpenOutputFiles", state.files.outputControl.mtr);
    1715         1155 :         print(state.files.mtr, "Program Version,{}\n", state.dataStrGlobals->VerStringVar);
    1716              : 
    1717              :         // Open the Branch-Node Details Output File
    1718         2310 :         state.files.bnd.ensure_open(state, "OpenOutputFiles", state.files.outputControl.bnd);
    1719         1155 :         print(state.files.bnd, "Program Version,{}\n", state.dataStrGlobals->VerStringVar);
    1720         1155 :     }
    1721              : 
    1722           74 :     void CloseOutputFiles(EnergyPlusData &state)
    1723              :     {
    1724              : 
    1725              :         // SUBROUTINE INFORMATION:
    1726              :         //       AUTHOR         Rick Strand
    1727              :         //       DATE WRITTEN   June 1997
    1728              :         //       MODIFIED       na
    1729              :         //       RE-ENGINEERED  na
    1730              : 
    1731              :         // PURPOSE OF THIS SUBROUTINE:
    1732              :         // This subroutine closes all of the input and output files needed for
    1733              :         // an EnergyPlus run.  It also prints the end of data marker for each
    1734              :         // output file.
    1735              : 
    1736              :         // METHODOLOGY EMPLOYED:
    1737              :         // na
    1738              : 
    1739              :         // REFERENCES:
    1740              :         // na
    1741              : 
    1742              :         // Using/Aliasing
    1743              :         using namespace DataOutputs;
    1744              :         using namespace DataRuntimeLanguage;
    1745              :         using namespace DataSystemVariables;
    1746              : 
    1747              :         // SUBROUTINE PARAMETER DEFINITIONS:
    1748              :         static constexpr std::string_view EndOfDataString("End of Data"); // Signifies the end of the data block in the output file
    1749              : 
    1750              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1751           74 :         std::string cEnvSetThreads;
    1752           74 :         std::string cepEnvSetThreads;
    1753           74 :         std::string cIDFSetThreads;
    1754              : 
    1755          148 :         state.files.audit.ensure_open(state, "CloseOutputFiles", state.files.outputControl.audit);
    1756              :         constexpr static std::string_view variable_fmt = " {}={:12}\n";
    1757              :         // Record some items on the audit file
    1758           74 :         print(state.files.audit, variable_fmt, "NumOfRVariable", state.dataOutputProcessor->NumOfRVariable_Setup);
    1759           74 :         print(state.files.audit, variable_fmt, "NumOfRVariable(Total)", state.dataOutputProcessor->NumTotalRVariable);
    1760           74 :         print(state.files.audit, variable_fmt, "NumOfRVariable(Actual)", state.dataOutputProcessor->NumOfRVariable);
    1761           74 :         print(state.files.audit, variable_fmt, "NumOfRVariable(Summed)", state.dataOutputProcessor->NumOfRVariable_Sum);
    1762           74 :         print(state.files.audit, variable_fmt, "NumOfRVariable(Meter)", state.dataOutputProcessor->NumOfRVariable_Meter);
    1763           74 :         print(state.files.audit, variable_fmt, "NumOfIVariable", state.dataOutputProcessor->NumOfIVariable_Setup);
    1764           74 :         print(state.files.audit, variable_fmt, "NumOfIVariable(Total)", state.dataOutputProcessor->NumTotalIVariable);
    1765           74 :         print(state.files.audit, variable_fmt, "NumOfIVariable(Actual)", state.dataOutputProcessor->NumOfIVariable);
    1766           74 :         print(state.files.audit, variable_fmt, "NumOfIVariable(Summed)", state.dataOutputProcessor->NumOfIVariable_Sum);
    1767              :         // print(state.files.audit, variable_fmt, "MaxRVariable", state.dataOutputProcessor->MaxRVariable);
    1768              :         // print(state.files.audit, variable_fmt, "MaxIVariable", state.dataOutputProcessor->MaxIVariable);
    1769           74 :         print(state.files.audit, variable_fmt, "NumEnergyMeters", state.dataOutputProcessor->meters.size());
    1770              :         // print(state.files.audit, variable_fmt, "NumVarMeterArrays", state.dataOutputProcessor->NumVarMeterArrays);
    1771           74 :         print(state.files.audit, variable_fmt, "maxUniqueKeyCount", state.dataOutRptTab->maxUniqueKeyCount);
    1772           74 :         print(state.files.audit, variable_fmt, "maxNumberOfFigures", state.dataSolarShading->maxNumberOfFigures);
    1773           74 :         print(state.files.audit, variable_fmt, "MAXHCArrayBounds", state.dataSolarShading->MAXHCArrayBounds);
    1774           74 :         print(state.files.audit, variable_fmt, "MaxVerticesPerSurface", state.dataSurface->MaxVerticesPerSurface);
    1775              :         // print(state.files.audit, variable_fmt, "NumReportList", state.dataOutputProcessor->NumReportList);
    1776              :         // print(state.files.audit, variable_fmt, "InstMeterCacheSize", state.dataOutputProcessor->InstMeterCacheSize);
    1777           74 :         if (state.dataSysVars->SutherlandHodgman) {
    1778           74 :             if (state.dataSysVars->SlaterBarsky) {
    1779            0 :                 print(state.files.audit, " {}\n", "ClippingAlgorithm=SlaterBarskyandSutherlandHodgman");
    1780              :             } else {
    1781           74 :                 print(state.files.audit, " {}\n", "ClippingAlgorithm=SutherlandHodgman");
    1782              :             }
    1783              :         } else {
    1784            0 :             print(state.files.audit, "{}\n", "ClippingAlgorithm=ConvexWeilerAtherton");
    1785              :         }
    1786           74 :         print(state.files.audit, variable_fmt, "MonthlyFieldSetInputCount", state.dataOutRptTab->MonthlyFieldSetInputCount);
    1787           74 :         print(state.files.audit, variable_fmt, "NumConsideredOutputVariables", state.dataOutput->NumConsideredOutputVariables);
    1788           74 :         print(state.files.audit, variable_fmt, "MaxConsideredOutputVariables", state.dataOutput->MaxConsideredOutputVariables);
    1789              : 
    1790           74 :         print(state.files.audit, variable_fmt, "numActuatorsUsed", state.dataRuntimeLang->numActuatorsUsed);
    1791           74 :         print(state.files.audit, variable_fmt, "numEMSActuatorsAvailable", state.dataRuntimeLang->numEMSActuatorsAvailable);
    1792           74 :         print(state.files.audit, variable_fmt, "maxEMSActuatorsAvailable", state.dataRuntimeLang->maxEMSActuatorsAvailable);
    1793           74 :         print(state.files.audit, variable_fmt, "numInternalVariablesUsed", state.dataRuntimeLang->NumInternalVariablesUsed);
    1794           74 :         print(state.files.audit, variable_fmt, "numEMSInternalVarsAvailable", state.dataRuntimeLang->numEMSInternalVarsAvailable);
    1795           74 :         print(state.files.audit, variable_fmt, "maxEMSInternalVarsAvailable", state.dataRuntimeLang->maxEMSInternalVarsAvailable);
    1796              : 
    1797           74 :         print(state.files.audit, variable_fmt, "NumOfNodeConnections", state.dataBranchNodeConnections->NumOfNodeConnections);
    1798           74 :         print(state.files.audit, variable_fmt, "MaxNumOfNodeConnections", state.dataBranchNodeConnections->MaxNumOfNodeConnections);
    1799              : #ifdef EP_Count_Calls
    1800              :         print(state.files.audit, variable_fmt, "NumShadow_Calls", state.dataTimingsData->NumShadow_Calls);
    1801              :         print(state.files.audit, variable_fmt, "NumShadowAtTS_Calls", state.dataTimingsData->NumShadowAtTS_Calls);
    1802              :         print(state.files.audit, variable_fmt, "NumClipPoly_Calls", state.dataTimingsData->NumClipPoly_Calls);
    1803              :         print(state.files.audit, variable_fmt, "NumInitSolar_Calls", state.dataTimingsData->NumInitSolar_Calls);
    1804              :         print(state.files.audit, variable_fmt, "NumAnisoSky_Calls", state.dataTimingsData->NumAnisoSky_Calls);
    1805              :         print(state.files.audit, variable_fmt, "NumDetPolyOverlap_Calls", state.dataTimingsData->NumDetPolyOverlap_Calls);
    1806              :         print(state.files.audit, variable_fmt, "NumCalcPerSolBeam_Calls", state.dataTimingsData->NumCalcPerSolBeam_Calls);
    1807              :         print(state.files.audit, variable_fmt, "NumDetShadowCombs_Calls", state.dataTimingsData->NumDetShadowCombs_Calls);
    1808              :         print(state.files.audit, variable_fmt, "NumIntSolarDist_Calls", state.dataTimingsData->NumIntSolarDist_Calls);
    1809              :         print(state.files.audit, variable_fmt, "NumIntRadExchange_Calls", state.dataTimingsData->NumIntRadExchange_Calls);
    1810              :         print(state.files.audit, variable_fmt, "NumIntRadExchangeZ_Calls", state.dataTimingsData->NumIntRadExchangeZ_Calls);
    1811              :         print(state.files.audit, variable_fmt, "NumIntRadExchangeMain_Calls", state.dataTimingsData->NumIntRadExchangeMain_Calls);
    1812              :         print(state.files.audit, variable_fmt, "NumIntRadExchangeOSurf_Calls", state.dataTimingsData->NumIntRadExchangeOSurf_Calls);
    1813              :         print(state.files.audit, variable_fmt, "NumIntRadExchangeISurf_Calls", state.dataTimingsData->NumIntRadExchangeISurf_Calls);
    1814              :         print(state.files.audit, variable_fmt, "NumMaxInsideSurfIterations", state.dataTimingsData->NumMaxInsideSurfIterations);
    1815              :         print(state.files.audit, variable_fmt, "NumCalcScriptF_Calls", state.dataTimingsData->NumCalcScriptF_Calls);
    1816              : #endif
    1817              : 
    1818           74 :         print(state.files.eso, "{}\n", EndOfDataString);
    1819           74 :         if (state.dataGlobal->StdOutputRecordCount > 0) {
    1820           25 :             print(state.files.eso, variable_fmt, "Number of Records Written", state.dataGlobal->StdOutputRecordCount);
    1821           25 :             state.files.eso.close();
    1822              :         } else {
    1823           49 :             state.files.eso.del();
    1824              :         }
    1825              : 
    1826           74 :         if (state.dataHeatBal->AnyCondFD) { // echo out relaxation factor, it may have been changed by the program
    1827            2 :             print(
    1828            2 :                 state.files.eio, "{}\n", "! <ConductionFiniteDifference Numerical Parameters>, Starting Relaxation Factor, Final Relaxation Factor");
    1829            2 :             print(state.files.eio,
    1830              :                   "ConductionFiniteDifference Numerical Parameters, {:.3R}, {:.3R}\n",
    1831            2 :                   state.dataHeatBal->CondFDRelaxFactorInput,
    1832            2 :                   state.dataHeatBal->CondFDRelaxFactor);
    1833              :         }
    1834              :         // Report number of threads to eio file
    1835              :         static constexpr std::string_view ThreadingHeader(
    1836              :             "! <Program Control Information:Threads/Parallel Sims>, Threading Supported,Maximum Number of "
    1837              :             "Threads, Env Set Threads (OMP_NUM_THREADS), EP Env Set Threads (EP_OMP_NUM_THREADS), IDF Set "
    1838              :             "Threads, Number of Threads Used (Interior Radiant Exchange), Number Nominal Surfaces, Number "
    1839              :             "Parallel Sims");
    1840           74 :         print(state.files.eio, "{}\n", ThreadingHeader);
    1841              :         static constexpr std::string_view ThreadReport("Program Control:Threads/Parallel Sims, {},{}, {}, {}, {}, {}, {}, {}\n");
    1842           74 :         if (state.dataSysVars->Threading) {
    1843            0 :             if (state.dataSysVars->iEnvSetThreads == 0) {
    1844            0 :                 cEnvSetThreads = "Not Set";
    1845              :             } else {
    1846            0 :                 cEnvSetThreads = fmt::to_string(state.dataSysVars->iEnvSetThreads);
    1847              :             }
    1848            0 :             if (state.dataSysVars->iepEnvSetThreads == 0) {
    1849            0 :                 cepEnvSetThreads = "Not Set";
    1850              :             } else {
    1851            0 :                 cepEnvSetThreads = fmt::to_string(state.dataSysVars->iepEnvSetThreads);
    1852              :             }
    1853            0 :             if (state.dataSysVars->iIDFSetThreads == 0) {
    1854            0 :                 cIDFSetThreads = "Not Set";
    1855              :             } else {
    1856            0 :                 cIDFSetThreads = fmt::to_string(state.dataSysVars->iIDFSetThreads);
    1857              :             }
    1858            0 :             if (state.dataSysVars->lnumActiveSims) {
    1859            0 :                 print(state.files.eio,
    1860              :                       ThreadReport,
    1861              :                       "Yes",
    1862            0 :                       state.dataSysVars->MaxNumberOfThreads,
    1863              :                       cEnvSetThreads,
    1864              :                       cepEnvSetThreads,
    1865              :                       cIDFSetThreads,
    1866            0 :                       state.dataSysVars->NumberIntRadThreads,
    1867            0 :                       state.dataSysVars->iNominalTotSurfaces,
    1868            0 :                       state.dataSysVars->inumActiveSims);
    1869              :             } else {
    1870            0 :                 print(state.files.eio,
    1871              :                       ThreadReport,
    1872              :                       "Yes",
    1873            0 :                       state.dataSysVars->MaxNumberOfThreads,
    1874              :                       cEnvSetThreads,
    1875              :                       cepEnvSetThreads,
    1876              :                       cIDFSetThreads,
    1877            0 :                       state.dataSysVars->NumberIntRadThreads,
    1878            0 :                       state.dataSysVars->iNominalTotSurfaces,
    1879              :                       "N/A");
    1880              :             }
    1881              :         } else { // no threading
    1882           74 :             if (state.dataSysVars->lnumActiveSims) {
    1883            0 :                 print(state.files.eio,
    1884              :                       ThreadReport,
    1885              :                       "No",
    1886            0 :                       state.dataSysVars->MaxNumberOfThreads,
    1887              :                       "N/A",
    1888              :                       "N/A",
    1889              :                       "N/A",
    1890              :                       "N/A",
    1891              :                       "N/A",
    1892            0 :                       state.dataSysVars->inumActiveSims);
    1893              :             } else {
    1894           74 :                 print(state.files.eio, ThreadReport, "No", state.dataSysVars->MaxNumberOfThreads, "N/A", "N/A", "N/A", "N/A", "N/A", "N/A");
    1895              :             }
    1896              :         }
    1897              : 
    1898              :         // Close the Initialization Output File
    1899           74 :         print(state.files.eio, "{}\n", EndOfDataString);
    1900           74 :         state.files.eio.close();
    1901              : 
    1902              :         // Close the Meters Output File
    1903           74 :         print(state.files.mtr, "{}\n", EndOfDataString);
    1904           74 :         print(state.files.mtr, " Number of Records Written={:12}\n", state.dataGlobal->StdMeterRecordCount);
    1905           74 :         if (state.dataGlobal->StdMeterRecordCount > 0) {
    1906           22 :             state.files.mtr.close();
    1907              :         } else {
    1908           52 :             state.files.mtr.del();
    1909              :         }
    1910              : 
    1911              :         // Close the External Shading Output File
    1912           74 :         state.files.shade.close();
    1913           74 :     }
    1914              : 
    1915           91 :     void SetupSimulation(EnergyPlusData &state, bool &ErrorsFound)
    1916              :     {
    1917              : 
    1918              :         // SUBROUTINE INFORMATION:
    1919              :         //       AUTHOR         B. Griffith/L. Lawrie
    1920              :         //       DATE WRITTEN   May 2008
    1921              :         //       MODIFIED       na
    1922              :         //       RE-ENGINEERED  na
    1923              : 
    1924              :         // PURPOSE OF THIS SUBROUTINE:
    1925              :         //  execute a few time steps of a simulation to facilitate setting up model
    1926              :         //  developed to resolve reverse DD problems caused be the differences
    1927              :         //  that stem from setup and information gathering that occurs during the first pass.
    1928              : 
    1929              :         // METHODOLOGY EMPLOYED:
    1930              :         // Using global flag (kickoff simulation), only a few time steps are executed.
    1931              :         // global flag is used in other parts of simulation to terminate quickly.
    1932              : 
    1933              :         // Using/Aliasing
    1934              :         using CostEstimateManager::SimCostEstimate;
    1935              :         using ExteriorEnergyUse::ManageExteriorEnergyUse;
    1936              : 
    1937           91 :         bool Available = true;
    1938              : 
    1939          264 :         while (Available) { // do for each environment
    1940              : 
    1941          264 :             Weather::GetNextEnvironment(state, Available, ErrorsFound);
    1942              : 
    1943          263 :             if (!Available) {
    1944           89 :                 break;
    1945              :             }
    1946          174 :             if (ErrorsFound) {
    1947            0 :                 break;
    1948              :             }
    1949              : 
    1950          174 :             state.dataGlobal->BeginEnvrnFlag = true;
    1951          174 :             state.dataGlobal->EndEnvrnFlag = false;
    1952          174 :             state.dataEnvrn->EndMonthFlag = false;
    1953          174 :             state.dataGlobal->WarmupFlag = true;
    1954          174 :             state.dataGlobal->DayOfSim = 0;
    1955              : 
    1956          174 :             ++state.dataGlobal->DayOfSim;
    1957          174 :             state.dataGlobal->BeginDayFlag = true;
    1958          174 :             state.dataGlobal->EndDayFlag = false;
    1959              : 
    1960          174 :             state.dataGlobal->HourOfDay = 1;
    1961              : 
    1962          174 :             state.dataGlobal->BeginHourFlag = true;
    1963          174 :             state.dataGlobal->EndHourFlag = false;
    1964              : 
    1965          174 :             state.dataGlobal->TimeStep = 1;
    1966              : 
    1967          174 :             if (state.dataSysVars->DeveloperFlag) {
    1968            0 :                 DisplayString(state, "Initializing Simulation - timestep 1:" + state.dataEnvrn->EnvironmentName);
    1969              :             }
    1970              : 
    1971          174 :             state.dataGlobal->BeginTimeStepFlag = true;
    1972              : 
    1973          174 :             Weather::ManageWeather(state);
    1974              : 
    1975          174 :             ManageExteriorEnergyUse(state);
    1976              : 
    1977          174 :             ManageHeatBalance(state);
    1978              : 
    1979          173 :             state.dataGlobal->BeginHourFlag = false;
    1980          173 :             state.dataGlobal->BeginDayFlag = false;
    1981          173 :             state.dataGlobal->BeginEnvrnFlag = false;
    1982          173 :             state.dataGlobal->BeginSimFlag = false;
    1983              : 
    1984              :             //          ! do another timestep=1
    1985          173 :             if (state.dataSysVars->DeveloperFlag) {
    1986            0 :                 DisplayString(state, "Initializing Simulation - 2nd timestep 1:" + state.dataEnvrn->EnvironmentName);
    1987              :             }
    1988              : 
    1989          173 :             Weather::ManageWeather(state);
    1990              : 
    1991          173 :             ManageExteriorEnergyUse(state);
    1992              : 
    1993          173 :             ManageHeatBalance(state);
    1994              : 
    1995              :             //         do an end of day, end of environment time step
    1996              : 
    1997          173 :             state.dataGlobal->HourOfDay = 24;
    1998          173 :             state.dataGlobal->TimeStep = state.dataGlobal->TimeStepsInHour;
    1999          173 :             state.dataGlobal->EndEnvrnFlag = true;
    2000              : 
    2001          173 :             if (state.dataSysVars->DeveloperFlag) {
    2002            0 :                 DisplayString(state, "Initializing Simulation - hour 24 timestep 1:" + state.dataEnvrn->EnvironmentName);
    2003              :             }
    2004          173 :             Weather::ManageWeather(state);
    2005              : 
    2006          173 :             ManageExteriorEnergyUse(state);
    2007              : 
    2008          173 :             ManageHeatBalance(state);
    2009              : 
    2010              :         } // ... End environment loop.
    2011              : 
    2012           89 :         if (state.dataGlobal->AnySlabsInModel || state.dataGlobal->AnyBasementsInModel) {
    2013            0 :             PlantPipingSystemsManager::SimulateGroundDomains(state, true);
    2014              :         }
    2015              : 
    2016           89 :         if (!ErrorsFound) {
    2017           89 :             SimCostEstimate(state); // basically will get and check input
    2018              :         }
    2019           89 :         if (ErrorsFound) {
    2020            0 :             ShowFatalError(state, "Previous conditions cause program termination.");
    2021              :         }
    2022           89 :     }
    2023              : 
    2024           73 :     void ReportNodeConnections(EnergyPlusData &state)
    2025              :     {
    2026              : 
    2027              :         // SUBROUTINE INFORMATION:
    2028              :         //       AUTHOR         Linda Lawrie
    2029              :         //       DATE WRITTEN   February 2004
    2030              :         //       MODIFIED       na
    2031              :         //       RE-ENGINEERED  na
    2032              : 
    2033              :         // PURPOSE OF THIS SUBROUTINE:
    2034              :         // This subroutine 'reports' the NodeConnection data structure.  It groups the
    2035              :         // report/dump by parent, non-parent objects.
    2036              : 
    2037              :         // Using/Aliasing
    2038              :         using namespace DataBranchNodeConnections;
    2039              : 
    2040              :         // Formats
    2041              :         static constexpr std::string_view Format_702("! <#{0} Node Connections>,<Number of {0} Node Connections>\n");
    2042              :         static constexpr std::string_view Format_703(
    2043              :             "! <{} Node Connection>,<Node Name>,<Node ObjectType>,<Node ObjectName>,<Node ConnectionType>,<Node FluidStream>\n");
    2044              : 
    2045           73 :         state.dataBranchNodeConnections->NonConnectedNodes.dimension(state.dataLoopNodes->NumOfNodes, true);
    2046              : 
    2047           73 :         int NumNonParents = 0;
    2048         2310 :         for (int Loop = 1; Loop <= state.dataBranchNodeConnections->NumOfNodeConnections; ++Loop) {
    2049         2237 :             if (state.dataBranchNodeConnections->NodeConnections(Loop).ObjectIsParent) {
    2050          678 :                 continue;
    2051              :             }
    2052         1559 :             ++NumNonParents;
    2053              :         }
    2054           73 :         const int NumParents = state.dataBranchNodeConnections->NumOfNodeConnections - NumNonParents;
    2055           73 :         state.dataBranchNodeConnections->ParentNodeList.allocate(NumParents);
    2056              : 
    2057              :         //  Do Parent Objects
    2058           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2059           73 :         print(state.files.bnd, Format_702, "Parent");
    2060           73 :         print(state.files.bnd, " #Parent Node Connections,{}\n", NumParents);
    2061           73 :         print(state.files.bnd, Format_703, "Parent");
    2062              : 
    2063         2310 :         for (int Loop = 1; Loop <= state.dataBranchNodeConnections->NumOfNodeConnections; ++Loop) {
    2064         2237 :             if (!state.dataBranchNodeConnections->NodeConnections(Loop).ObjectIsParent) {
    2065         1559 :                 continue;
    2066              :             }
    2067          678 :             state.dataBranchNodeConnections->NonConnectedNodes(state.dataBranchNodeConnections->NodeConnections(Loop).NodeNumber) = false;
    2068          678 :             print(state.files.bnd,
    2069              :                   " Parent Node Connection,{},{},{},{},{}\n",
    2070          678 :                   state.dataBranchNodeConnections->NodeConnections(Loop).NodeName,
    2071              :                   BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2072          678 :                       state.dataBranchNodeConnections->NodeConnections(Loop).ObjectType)],
    2073          678 :                   state.dataBranchNodeConnections->NodeConnections(Loop).ObjectName,
    2074          678 :                   DataLoopNode::ConnectionTypeNames[static_cast<int>(state.dataBranchNodeConnections->NodeConnections(Loop).ConnectionType)],
    2075          678 :                   state.dataBranchNodeConnections->NodeConnections(Loop).FluidStream);
    2076              :             // Build ParentNodeLists
    2077         1075 :             if ((state.dataBranchNodeConnections->NodeConnections(Loop).ConnectionType == DataLoopNode::ConnectionType::Inlet) ||
    2078          397 :                 (state.dataBranchNodeConnections->NodeConnections(Loop).ConnectionType == DataLoopNode::ConnectionType::Outlet)) {
    2079          592 :                 bool ParentComponentFound = false;
    2080         6867 :                 for (int Loop1 = 1; Loop1 <= state.dataBranchNodeConnections->NumOfActualParents; ++Loop1) {
    2081         6275 :                     if (state.dataBranchNodeConnections->ParentNodeList(Loop1).ComponentType !=
    2082         8942 :                             state.dataBranchNodeConnections->NodeConnections(Loop).ObjectType ||
    2083         2667 :                         state.dataBranchNodeConnections->ParentNodeList(Loop1).ComponentName !=
    2084         2667 :                             state.dataBranchNodeConnections->NodeConnections(Loop).ObjectName) {
    2085         5983 :                         continue;
    2086              :                     }
    2087          292 :                     ParentComponentFound = true;
    2088              : 
    2089          292 :                     switch (state.dataBranchNodeConnections->NodeConnections(Loop).ConnectionType) {
    2090           46 :                     case DataLoopNode::ConnectionType::Inlet:
    2091           46 :                         state.dataBranchNodeConnections->ParentNodeList(Loop1).InletNodeName =
    2092           92 :                             state.dataBranchNodeConnections->NodeConnections(Loop).NodeName;
    2093           46 :                         break;
    2094          246 :                     case DataLoopNode::ConnectionType::Outlet:
    2095          246 :                         state.dataBranchNodeConnections->ParentNodeList(Loop1).OutletNodeName =
    2096          492 :                             state.dataBranchNodeConnections->NodeConnections(Loop).NodeName;
    2097          246 :                     default:
    2098          246 :                         break;
    2099              :                     }
    2100              :                 }
    2101          592 :                 if (!ParentComponentFound) {
    2102          300 :                     ++state.dataBranchNodeConnections->NumOfActualParents;
    2103          300 :                     state.dataBranchNodeConnections->ParentNodeList(state.dataBranchNodeConnections->NumOfActualParents).ComponentType =
    2104          300 :                         state.dataBranchNodeConnections->NodeConnections(Loop).ObjectType;
    2105          300 :                     state.dataBranchNodeConnections->ParentNodeList(state.dataBranchNodeConnections->NumOfActualParents).ComponentName =
    2106          600 :                         state.dataBranchNodeConnections->NodeConnections(Loop).ObjectName;
    2107              : 
    2108          300 :                     switch (state.dataBranchNodeConnections->NodeConnections(Loop).ConnectionType) {
    2109          235 :                     case DataLoopNode::ConnectionType::Inlet:
    2110          235 :                         state.dataBranchNodeConnections->ParentNodeList(state.dataBranchNodeConnections->NumOfActualParents).InletNodeName =
    2111          470 :                             state.dataBranchNodeConnections->NodeConnections(Loop).NodeName;
    2112          235 :                         break;
    2113           65 :                     case DataLoopNode::ConnectionType::Outlet:
    2114           65 :                         state.dataBranchNodeConnections->ParentNodeList(state.dataBranchNodeConnections->NumOfActualParents).OutletNodeName =
    2115          130 :                             state.dataBranchNodeConnections->NodeConnections(Loop).NodeName;
    2116           65 :                         break;
    2117            0 :                     default:
    2118            0 :                         break;
    2119              :                     }
    2120              :                 }
    2121              :             }
    2122              :         }
    2123              : 
    2124              :         //  Do non-Parent Objects
    2125           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2126           73 :         print(state.files.bnd, Format_702, "Non-Parent");
    2127           73 :         print(state.files.bnd, " #Non-Parent Node Connections,{}\n", NumNonParents);
    2128           73 :         print(state.files.bnd, Format_703, "Non-Parent");
    2129              : 
    2130         2310 :         for (int Loop = 1; Loop <= state.dataBranchNodeConnections->NumOfNodeConnections; ++Loop) {
    2131         2237 :             if (state.dataBranchNodeConnections->NodeConnections(Loop).ObjectIsParent) {
    2132          678 :                 continue;
    2133              :             }
    2134         1559 :             state.dataBranchNodeConnections->NonConnectedNodes(state.dataBranchNodeConnections->NodeConnections(Loop).NodeNumber) = false;
    2135         1559 :             print(state.files.bnd,
    2136              :                   " Non-Parent Node Connection,{},{},{},{},{}\n",
    2137         1559 :                   state.dataBranchNodeConnections->NodeConnections(Loop).NodeName,
    2138              :                   BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2139         1559 :                       state.dataBranchNodeConnections->NodeConnections(Loop).ObjectType)],
    2140         1559 :                   state.dataBranchNodeConnections->NodeConnections(Loop).ObjectName,
    2141         1559 :                   DataLoopNode::ConnectionTypeNames[static_cast<int>(state.dataBranchNodeConnections->NodeConnections(Loop).ConnectionType)],
    2142         1559 :                   state.dataBranchNodeConnections->NodeConnections(Loop).FluidStream);
    2143              :         }
    2144              : 
    2145           73 :         int NumNonConnected = 0;
    2146          862 :         for (int Loop = 1; Loop <= state.dataLoopNodes->NumOfNodes; ++Loop) {
    2147          789 :             if (state.dataBranchNodeConnections->NonConnectedNodes(Loop)) {
    2148            0 :                 ++NumNonConnected;
    2149              :             }
    2150              :         }
    2151              : 
    2152           73 :         if (NumNonConnected > 0) {
    2153            0 :             print(state.files.bnd, "{}\n", "! ===============================================================");
    2154              :             static constexpr std::string_view Format_705("! <#NonConnected Nodes>,<Number of NonConnected Nodes>\n #NonConnected Nodes,{}\n");
    2155            0 :             print(state.files.bnd, Format_705, NumNonConnected);
    2156              :             static constexpr std::string_view Format_706("! <NonConnected Node>,<NonConnected Node Number>,<NonConnected Node Name>");
    2157            0 :             print(state.files.bnd, "{}\n", Format_706);
    2158            0 :             for (int Loop = 1; Loop <= state.dataLoopNodes->NumOfNodes; ++Loop) {
    2159            0 :                 if (!state.dataBranchNodeConnections->NonConnectedNodes(Loop)) {
    2160            0 :                     continue;
    2161              :                 }
    2162            0 :                 print(state.files.bnd, " NonConnected Node,{},{}\n", Loop, state.dataLoopNodes->NodeID(Loop));
    2163              :             }
    2164              :         }
    2165              : 
    2166           73 :         state.dataBranchNodeConnections->NonConnectedNodes.deallocate();
    2167           73 :     }
    2168              : 
    2169           73 :     void ReportLoopConnections(EnergyPlusData &state)
    2170              :     {
    2171              : 
    2172              :         // SUBROUTINE INFORMATION:
    2173              :         //       AUTHOR         Linda Lawrie
    2174              :         //       DATE WRITTEN   December 2001
    2175              :         //       MODIFIED       March 2003; added other reporting
    2176              : 
    2177              :         // PURPOSE OF THIS SUBROUTINE:
    2178              :         // This subroutine reports on the node connections in various parts of the
    2179              :         // HVAC system: Component Sets, Air Loop, Plant and Condenser Loop, Supply and
    2180              :         // return air paths, controlled zones.
    2181              :         // This information should be useful in diagnosing node connection input errors.
    2182              : 
    2183              :         static constexpr std::string_view errstring = "**error**";
    2184              : 
    2185              :         // Formats
    2186              :         static constexpr std::string_view Format_700 = "! <#Component Sets>,<Number of Component Sets>";
    2187              :         static constexpr std::string_view Format_702 = "! <Component Set>,<Component Set Count>,<Parent Object Type>,<Parent Object Name>,<Component "
    2188              :                                                        "Type>,<Component Name>,<Inlet Node ID>,<Outlet Node ID>,<Description>";
    2189              :         static constexpr std::string_view Format_720 = "! <#Zone Equipment Lists>,<Number of Zone Equipment Lists>";
    2190              :         static constexpr std::string_view Format_722 =
    2191              :             "! <Zone Equipment List>,<Zone Equipment List Count>,<Zone Equipment List Name>,<Zone Name>,<Number of Components>";
    2192              :         static constexpr std::string_view Format_723 =
    2193              :             "! <Zone Equipment Component>,<Component Count>,<Component Type>,<Component Name>,<Zone Name>,<Heating "
    2194              :             "Priority>,<Cooling Priority>";
    2195              : 
    2196              :         // Report outside air node names on the Branch-Node Details file
    2197           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2198           73 :         print(state.files.bnd, "{}\n", "! #Outdoor Air Nodes,<Number of Outdoor Air Nodes>");
    2199           73 :         print(state.files.bnd, " #Outdoor Air Nodes,{}\n", state.dataOutAirNodeMgr->NumOutsideAirNodes);
    2200           73 :         if (state.dataOutAirNodeMgr->NumOutsideAirNodes > 0) {
    2201           26 :             print(state.files.bnd, "{}\n", "! <Outdoor Air Node>,<NodeNumber>,<Node Name>");
    2202              :         }
    2203          132 :         for (int Count = 1; Count <= state.dataOutAirNodeMgr->NumOutsideAirNodes; ++Count) {
    2204           59 :             print(state.files.bnd,
    2205              :                   " Outdoor Air Node,{},{}\n",
    2206           59 :                   state.dataOutAirNodeMgr->OutsideAirNodeList(Count),
    2207           59 :                   state.dataLoopNodes->NodeID(state.dataOutAirNodeMgr->OutsideAirNodeList(Count)));
    2208              :         }
    2209              :         // Component Sets
    2210           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2211           73 :         print(state.files.bnd, "{}\n", Format_700);
    2212           73 :         print(state.files.bnd, " #Component Sets,{}\n", state.dataBranchNodeConnections->NumCompSets);
    2213           73 :         print(state.files.bnd, "{}\n", Format_702);
    2214              : 
    2215          420 :         for (int Count = 1; Count <= state.dataBranchNodeConnections->NumCompSets; ++Count) {
    2216          347 :             print(state.files.bnd,
    2217              :                   " Component Set,{},{},{},{},{},{},{},{}\n",
    2218              :                   Count,
    2219              :                   BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2220          347 :                       state.dataBranchNodeConnections->CompSets(Count).ParentObjectType)],
    2221          347 :                   state.dataBranchNodeConnections->CompSets(Count).ParentCName,
    2222              :                   BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2223          347 :                       state.dataBranchNodeConnections->CompSets(Count).ComponentObjectType)],
    2224          347 :                   state.dataBranchNodeConnections->CompSets(Count).CName,
    2225          347 :                   state.dataBranchNodeConnections->CompSets(Count).InletNodeName,
    2226          347 :                   state.dataBranchNodeConnections->CompSets(Count).OutletNodeName,
    2227          347 :                   state.dataBranchNodeConnections->CompSets(Count).Description);
    2228              : 
    2229              :             std::string_view const CType = BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2230          347 :                 state.dataBranchNodeConnections->CompSets(Count).ComponentObjectType)];
    2231          347 :             if (state.dataBranchNodeConnections->CompSets(Count).ParentObjectType == DataLoopNode::ConnectionObjectType::Undefined ||
    2232          694 :                 state.dataBranchNodeConnections->CompSets(Count).InletNodeName == "UNDEFINED" ||
    2233          347 :                 state.dataBranchNodeConnections->CompSets(Count).OutletNodeName == "UNDEFINED") {
    2234            0 :                 if (state.dataErrTracking->AbortProcessing && state.dataSimulationManager->WarningOut) {
    2235            0 :                     ShowWarningError(state,
    2236              :                                      "Node Connection errors shown during \"fatal error\" processing may be false because not all inputs may have "
    2237              :                                      "been retrieved.");
    2238            0 :                     state.dataSimulationManager->WarningOut = false;
    2239              :                 }
    2240            0 :                 ShowWarningError(state,
    2241            0 :                                  format("Node Connection Error for object {}={}", CType, state.dataBranchNodeConnections->CompSets(Count).CName));
    2242            0 :                 ShowContinueError(state,
    2243            0 :                                   format("  {} not on any Branch or Parent Object", state.dataBranchNodeConnections->CompSets(Count).Description));
    2244            0 :                 ShowContinueError(state, format("  Inlet Node : {}", state.dataBranchNodeConnections->CompSets(Count).InletNodeName));
    2245            0 :                 ShowContinueError(state, format("  Outlet Node: {}", state.dataBranchNodeConnections->CompSets(Count).OutletNodeName));
    2246            0 :                 ++state.dataBranchNodeConnections->NumNodeConnectionErrors;
    2247            0 :                 if (state.dataBranchNodeConnections->CompSets(Count).ComponentObjectType ==
    2248              :                     DataLoopNode::ConnectionObjectType::SolarCollectorUnglazedTranspired) {
    2249            0 :                     ShowContinueError(state, "This report does not necessarily indicate a problem for a MultiSystem Transpired Collector");
    2250              :                 }
    2251              :             }
    2252          347 :             if (state.dataBranchNodeConnections->CompSets(Count).Description == "UNDEFINED") {
    2253            0 :                 if (state.dataErrTracking->AbortProcessing && state.dataSimulationManager->WarningOut) {
    2254            0 :                     ShowWarningError(state,
    2255              :                                      "Node Connection errors shown during \"fatal error\" processing may be false because not all inputs may have "
    2256              :                                      "been retrieved.");
    2257            0 :                     state.dataSimulationManager->WarningOut = false;
    2258              :                 }
    2259            0 :                 ShowWarningError(
    2260              :                     state,
    2261            0 :                     format("Potential Node Connection Error for object {}, name={}", CType, state.dataBranchNodeConnections->CompSets(Count).CName));
    2262            0 :                 ShowContinueError(state, "  Node Types are still UNDEFINED -- See Branch/Node Details file for further information");
    2263            0 :                 ShowContinueError(state, format("  Inlet Node : {}", state.dataBranchNodeConnections->CompSets(Count).InletNodeName));
    2264            0 :                 ShowContinueError(state, format("  Outlet Node: {}", state.dataBranchNodeConnections->CompSets(Count).OutletNodeName));
    2265            0 :                 ++state.dataBranchNodeConnections->NumNodeConnectionErrors;
    2266              :             }
    2267              :         }
    2268              : 
    2269          420 :         for (int Count = 1; Count <= state.dataBranchNodeConnections->NumCompSets; ++Count) {
    2270         3962 :             for (int Count1 = Count + 1; Count1 <= state.dataBranchNodeConnections->NumCompSets; ++Count1) {
    2271         3615 :                 if (state.dataBranchNodeConnections->CompSets(Count).ComponentObjectType !=
    2272         3615 :                     state.dataBranchNodeConnections->CompSets(Count1).ComponentObjectType) {
    2273         3615 :                     continue;
    2274              :                 }
    2275          522 :                 if (state.dataBranchNodeConnections->CompSets(Count).CName != state.dataBranchNodeConnections->CompSets(Count1).CName) {
    2276          497 :                     continue;
    2277              :                 }
    2278           25 :                 if (state.dataBranchNodeConnections->CompSets(Count).InletNodeName !=
    2279           25 :                     state.dataBranchNodeConnections->CompSets(Count1).InletNodeName) {
    2280           25 :                     continue;
    2281              :                 }
    2282            0 :                 if (state.dataBranchNodeConnections->CompSets(Count).OutletNodeName !=
    2283            0 :                     state.dataBranchNodeConnections->CompSets(Count1).OutletNodeName) {
    2284            0 :                     continue;
    2285              :                 }
    2286            0 :                 if (state.dataErrTracking->AbortProcessing && state.dataSimulationManager->WarningOut) {
    2287            0 :                     ShowWarningError(state,
    2288              :                                      "Node Connection errors shown during \"fatal error\" processing may be false because not all inputs may have "
    2289              :                                      "been retrieved.");
    2290            0 :                     state.dataSimulationManager->WarningOut = false;
    2291              :                 }
    2292              :                 std::string_view const CType = BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2293            0 :                     state.dataBranchNodeConnections->CompSets(Count).ComponentObjectType)];
    2294              :                 std::string_view const ParentCType = BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2295            0 :                     state.dataBranchNodeConnections->CompSets(Count1).ParentObjectType)];
    2296              :                 std::string_view const ParentCType1 = BranchNodeConnections::ConnectionObjectTypeNamesUC[static_cast<int>(
    2297            0 :                     state.dataBranchNodeConnections->CompSets(Count).ParentObjectType)];
    2298            0 :                 ShowWarningError(state, "Component plus inlet/outlet node pair used more than once:");
    2299            0 :                 ShowContinueError(state, format("  Component  : {}={}", CType, state.dataBranchNodeConnections->CompSets(Count).CName));
    2300            0 :                 ShowContinueError(state, format("  Inlet Node : {}", state.dataBranchNodeConnections->CompSets(Count).InletNodeName));
    2301            0 :                 ShowContinueError(state, format("  Outlet Node: {}", state.dataBranchNodeConnections->CompSets(Count).OutletNodeName));
    2302            0 :                 ShowContinueError(state, format("  Used by    : {}={}", ParentCType, state.dataBranchNodeConnections->CompSets(Count).ParentCName));
    2303            0 :                 ShowContinueError(state, format("  and  by    : {}={}", ParentCType1, state.dataBranchNodeConnections->CompSets(Count1).ParentCName));
    2304            0 :                 ++state.dataBranchNodeConnections->NumNodeConnectionErrors;
    2305              :             }
    2306              :         }
    2307              :         //  Plant Loops
    2308           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2309           73 :         print(state.files.bnd, "{}\n", "! <# Plant Loops>,<Number of Plant Loops>");
    2310           73 :         print(state.files.bnd, " #Plant Loops,{}\n", state.dataHVACGlobal->NumPlantLoops);
    2311           73 :         print(state.files.bnd,
    2312              :               "{}\n",
    2313              :               "! <Plant Loop>,<Plant Loop Name>,<Loop Type>,<Inlet Node Name>,<Outlet Node Name>,<Branch List>,<Connector List>");
    2314           73 :         print(
    2315           73 :             state.files.bnd, "{}\n", "! <Plant Loop Connector>,<Connector Type>,<Connector Name>,<Loop Name>,<Loop Type>,<Number of Inlets/Outlets>");
    2316           73 :         print(state.files.bnd,
    2317              :               "{}\n",
    2318              :               "! <Plant Loop Connector Branches>,<Connector Node Count>,<Connector Type>,<Connector Name>,<Inlet Branch>,<Outlet Branch>,<Loop "
    2319              :               "Name>,<Loop Type>");
    2320           73 :         print(state.files.bnd,
    2321              :               "{}\n",
    2322              :               "! <Plant Loop Connector Nodes>,<Connector Node Count>,<Connector Type>,<Connector Name>,<Inlet Node>,<Outlet Node>,<Loop Name>,<Loop "
    2323              :               "Type>");
    2324           73 :         print(state.files.bnd,
    2325              :               "{}\n",
    2326              :               "! <Plant Loop Supply Connection>,<Plant Loop Name>,<Supply Side Outlet Node Name>,<Demand Side Inlet Node Name>");
    2327           73 :         print(state.files.bnd,
    2328              :               "{}\n",
    2329              :               "! <Plant Loop Return Connection>,<Plant Loop Name>,<Demand Side Outlet Node Name>,<Supply Side Inlet Node Name>");
    2330           84 :         for (int Count = 1; Count <= state.dataHVACGlobal->NumPlantLoops; ++Count) {
    2331           33 :             for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2332              :                 //  Plant Supply Side Loop
    2333              :                 // LoopSideLocation::Demand and LoopSideLocation::Supply is parametrized in DataPlant
    2334           22 :                 std::string_view const LoopString = DataPlant::DemandSupplyNames[static_cast<int>(LoopSideNum)];
    2335              : 
    2336           22 :                 print(state.files.bnd,
    2337              :                       " Plant Loop,{},{},{},{},{},{}\n",
    2338           22 :                       state.dataPlnt->PlantLoop(Count).Name,
    2339              :                       LoopString,
    2340           22 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).NodeNameIn,
    2341           22 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).NodeNameOut,
    2342           22 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).BranchList,
    2343           22 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).ConnectList);
    2344              :                 //  Plant Supply Side Splitter
    2345           22 :                 if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Exists) {
    2346           22 :                     print(state.files.bnd,
    2347              :                           "   Plant Loop Connector,Splitter,{},{},{},{}\n",
    2348           22 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Name,
    2349           22 :                           state.dataPlnt->PlantLoop(Count).Name,
    2350              :                           LoopString,
    2351           22 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.TotalOutletNodes);
    2352           76 :                     for (int Count1 = 1; Count1 <= state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.TotalOutletNodes; ++Count1) {
    2353           54 :                         print(state.files.bnd,
    2354              :                               "     Plant Loop Connector Branches,{},Splitter,{},",
    2355              :                               Count1,
    2356           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Name);
    2357              : 
    2358           54 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumIn <= 0) {
    2359            0 :                             print(state.files.bnd, "{},\n", errstring);
    2360              :                         } else {
    2361           54 :                             print(state.files.bnd,
    2362              :                                   "{},",
    2363           54 :                                   state.dataPlnt->PlantLoop(Count)
    2364           54 :                                       .LoopSide(LoopSideNum)
    2365           54 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumIn)
    2366           54 :                                       .Name);
    2367              :                         }
    2368              : 
    2369           54 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumOut(Count1) <= 0) {
    2370            0 :                             print(state.files.bnd, "{},{},{}\n", errstring, state.dataPlnt->PlantLoop(Count).Name, LoopString);
    2371              :                         } else {
    2372           54 :                             print(state.files.bnd,
    2373              :                                   "{},{},{}\n",
    2374           54 :                                   state.dataPlnt->PlantLoop(Count)
    2375           54 :                                       .LoopSide(LoopSideNum)
    2376           54 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumOut(Count1))
    2377           54 :                                       .Name,
    2378           54 :                                   state.dataPlnt->PlantLoop(Count).Name,
    2379              :                                   LoopString);
    2380              :                         }
    2381              : 
    2382           54 :                         print(state.files.bnd,
    2383              :                               "     Plant Loop Connector Nodes,   {},Splitter,{},{},{},{},{}\n",
    2384              :                               Count1,
    2385           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Name,
    2386           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.NodeNameIn,
    2387           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.NodeNameOut(Count1),
    2388           54 :                               state.dataPlnt->PlantLoop(Count).Name,
    2389              :                               LoopString);
    2390              :                     }
    2391              :                 }
    2392              : 
    2393              :                 //  Plant Supply Side Mixer
    2394           22 :                 if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Exists) {
    2395           22 :                     print(state.files.bnd,
    2396              :                           "   Plant Loop Connector,Mixer,{},{},{},{}\n",
    2397           22 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Name,
    2398           22 :                           state.dataPlnt->PlantLoop(Count).Name,
    2399              :                           LoopString,
    2400           22 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.TotalInletNodes); //',Supply,'//  &
    2401              : 
    2402           76 :                     for (int Count1 = 1; Count1 <= state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.TotalInletNodes; ++Count1) {
    2403           54 :                         print(state.files.bnd,
    2404              :                               "     Plant Loop Connector Branches,{},Mixer,{},",
    2405              :                               Count1,
    2406           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Name);
    2407           54 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumIn(Count1) <= 0) {
    2408            0 :                             print(state.files.bnd, "{},", errstring);
    2409              :                         } else {
    2410           54 :                             print(state.files.bnd,
    2411              :                                   "{},",
    2412           54 :                                   state.dataPlnt->PlantLoop(Count)
    2413           54 :                                       .LoopSide(LoopSideNum)
    2414           54 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumIn(Count1))
    2415           54 :                                       .Name);
    2416              :                         }
    2417           54 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumOut <= 0) {
    2418            0 :                             print(state.files.bnd, "{},{},Supply\n", errstring, state.dataPlnt->PlantLoop(Count).Name);
    2419              :                         } else {
    2420           54 :                             print(state.files.bnd,
    2421              :                                   "{},{},{}\n",
    2422           54 :                                   state.dataPlnt->PlantLoop(Count)
    2423           54 :                                       .LoopSide(LoopSideNum)
    2424           54 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumOut)
    2425           54 :                                       .Name,
    2426           54 :                                   state.dataPlnt->PlantLoop(Count).Name,
    2427              :                                   LoopString);
    2428              :                         }
    2429           54 :                         print(state.files.bnd,
    2430              :                               "     Plant Loop Connector Nodes,   {},Mixer,{},{},{},{},{}\n",
    2431              :                               Count1,
    2432           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Name,
    2433           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.NodeNameIn(Count1),
    2434           54 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.NodeNameOut,
    2435           54 :                               state.dataPlnt->PlantLoop(Count).Name,
    2436              :                               LoopString);
    2437              :                     }
    2438              :                 }
    2439              :             }
    2440           11 :             print(state.files.bnd,
    2441              :                   " Plant Loop Supply Connection,{},{},{}\n",
    2442           11 :                   state.dataPlnt->PlantLoop(Count).Name,
    2443           11 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNameOut,
    2444           11 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Demand).NodeNameIn);
    2445           11 :             print(state.files.bnd,
    2446              :                   " Plant Loop Return Connection,{},{},{}\n",
    2447           11 :                   state.dataPlnt->PlantLoop(Count).Name,
    2448           11 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Demand).NodeNameOut,
    2449           11 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNameIn);
    2450              : 
    2451              :         } //  Plant Demand Side Loop
    2452              : 
    2453              :         //  Condenser Loops
    2454           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2455           73 :         print(state.files.bnd, "{}\n", "! <# Condenser Loops>,<Number of Condenser Loops>");
    2456           73 :         print(state.files.bnd, " #Condenser Loops,{}\n", state.dataHVACGlobal->NumCondLoops);
    2457           73 :         print(state.files.bnd,
    2458              :               "{}\n",
    2459              :               "! <Condenser Loop>,<Condenser Loop Name>,<Loop Type>,<Inlet Node Name>,<Outlet Node Name>,<Branch List>,<Connector List>");
    2460           73 :         print(state.files.bnd,
    2461              :               "{}\n",
    2462              :               "! <Condenser Loop Connector>,<Connector Type>,<Connector Name>,<Loop Name>,<Loop Type>,<Number of Inlets/Outlets>");
    2463           73 :         print(state.files.bnd,
    2464              :               "{}\n",
    2465              :               "! <Condenser Loop Connector Branches>,<Connector Node Count>,<Connector Type>,<Connector Name>,<Inlet Branch>,<Outlet Branch>,<Loop "
    2466              :               "Name>,<Loop Type>");
    2467           73 :         print(state.files.bnd,
    2468              :               "{}\n",
    2469              :               "! <Condenser Loop Connector Nodes>,<Connector Node Count>,<Connector Type>,<Connector Name>,<Inlet Node>,<Outlet Node>,<Loop "
    2470              :               "Name>,<Loop Type>");
    2471           73 :         print(state.files.bnd,
    2472              :               "{}\n",
    2473              :               "! <Condenser Loop Supply Connection>,<Condenser Loop Name>,<Supply Side Outlet Node Name>,<Demand Side Inlet Node Name>");
    2474           73 :         print(state.files.bnd,
    2475              :               "{}\n",
    2476              :               "! <Condenser Loop Return Connection>,<Condenser Loop Name>,<Demand Side Outlet Node Name>,<Supply Side Inlet Node Name>");
    2477              : 
    2478           75 :         for (int Count = state.dataHVACGlobal->NumPlantLoops + 1; Count <= state.dataPlnt->TotNumLoops; ++Count) {
    2479            6 :             for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
    2480              :                 //  Plant Supply Side Loop
    2481              :                 // LoopSideLocation::Demand and LoopSideLocation::Supply is parametrized in DataPlant
    2482           12 :                 const auto LoopString = [&]() {
    2483            4 :                     if (LoopSideNum == DataPlant::LoopSideLocation::Demand) {
    2484            2 :                         return "Demand";
    2485            2 :                     } else if (LoopSideNum == DataPlant::LoopSideLocation::Supply) {
    2486            2 :                         return "Supply";
    2487              :                     } else {
    2488            0 :                         return "";
    2489              :                     }
    2490            4 :                 }();
    2491              : 
    2492            4 :                 print(state.files.bnd,
    2493              :                       " Plant Loop,{},{},{},{},{},{}\n",
    2494            4 :                       state.dataPlnt->PlantLoop(Count).Name,
    2495              :                       LoopString,
    2496            4 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).NodeNameIn,
    2497            4 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).NodeNameOut,
    2498            4 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).BranchList,
    2499            4 :                       state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).ConnectList);
    2500              :                 //  Plant Supply Side Splitter
    2501            4 :                 if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Exists) {
    2502            4 :                     print(state.files.bnd,
    2503              :                           "   Plant Loop Connector,Splitter,{},{},{},{}\n",
    2504            4 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Name,
    2505            4 :                           state.dataPlnt->PlantLoop(Count).Name,
    2506              :                           LoopString,
    2507            4 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.TotalOutletNodes);
    2508           15 :                     for (int Count1 = 1; Count1 <= state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.TotalOutletNodes; ++Count1) {
    2509           11 :                         print(state.files.bnd,
    2510              :                               "     Plant Loop Connector Branches,{},Splitter,{},",
    2511              :                               Count1,
    2512           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Name);
    2513              : 
    2514           11 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumIn <= 0) {
    2515            0 :                             print(state.files.bnd, "{},", errstring);
    2516              :                         } else {
    2517           11 :                             print(state.files.bnd,
    2518              :                                   "{},",
    2519           11 :                                   state.dataPlnt->PlantLoop(Count)
    2520           11 :                                       .LoopSide(LoopSideNum)
    2521           11 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumIn)
    2522           11 :                                       .Name);
    2523              :                         }
    2524           11 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumOut(Count1) <= 0) {
    2525            0 :                             print(state.files.bnd, "{},{},{}\n", errstring, state.dataPlnt->PlantLoop(Count).Name, LoopString);
    2526              :                         } else {
    2527              : 
    2528           11 :                             print(state.files.bnd,
    2529              :                                   "{},{},{}\n",
    2530           11 :                                   state.dataPlnt->PlantLoop(Count)
    2531           11 :                                       .LoopSide(LoopSideNum)
    2532           11 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.BranchNumOut(Count1))
    2533           11 :                                       .Name,
    2534           11 :                                   state.dataPlnt->PlantLoop(Count).Name,
    2535              :                                   LoopString);
    2536              :                         }
    2537              : 
    2538           11 :                         print(state.files.bnd,
    2539              :                               "     Plant Loop Connector Nodes,   {},Splitter,{},{},{},{},{}\n",
    2540              :                               Count1,
    2541           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.Name,
    2542           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.NodeNameIn,
    2543           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Splitter.NodeNameOut(Count1),
    2544           11 :                               state.dataPlnt->PlantLoop(Count).Name,
    2545              :                               LoopString);
    2546              :                     }
    2547              :                 }
    2548              : 
    2549              :                 //  Plant Supply Side Mixer
    2550            4 :                 if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Exists) {
    2551            4 :                     const int totalInletNodes = state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.TotalInletNodes;
    2552            4 :                     print(state.files.bnd,
    2553              :                           "   Plant Loop Connector,Mixer,{},{},{},{}\n",
    2554            4 :                           state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Name,
    2555            4 :                           state.dataPlnt->PlantLoop(Count).Name,
    2556              :                           LoopString,
    2557              :                           totalInletNodes); //',Supply,'//  &
    2558              : 
    2559           15 :                     for (int Count1 = 1; Count1 <= totalInletNodes; ++Count1) {
    2560           11 :                         print(state.files.bnd,
    2561              :                               "     Plant Loop Connector Branches,{},Mixer,{},",
    2562              :                               Count1,
    2563           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Name);
    2564              : 
    2565           11 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumIn(Count1) <= 0) {
    2566            0 :                             print(state.files.bnd, "{},", errstring);
    2567              :                         } else {
    2568           11 :                             print(state.files.bnd,
    2569              :                                   "{},",
    2570           11 :                                   state.dataPlnt->PlantLoop(Count)
    2571           11 :                                       .LoopSide(LoopSideNum)
    2572           11 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumIn(Count1))
    2573           11 :                                       .Name);
    2574              :                         }
    2575           11 :                         if (state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumOut <= 0) {
    2576            0 :                             print(state.files.bnd, "{},{},{}\n", errstring, state.dataPlnt->PlantLoop(Count).Name, LoopString);
    2577              :                         } else {
    2578           11 :                             print(state.files.bnd,
    2579              :                                   "{},{},{}\n",
    2580           11 :                                   state.dataPlnt->PlantLoop(Count)
    2581           11 :                                       .LoopSide(LoopSideNum)
    2582           11 :                                       .Branch(state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.BranchNumOut)
    2583           11 :                                       .Name,
    2584           11 :                                   state.dataPlnt->PlantLoop(Count).Name,
    2585              :                                   LoopString);
    2586              :                         }
    2587           11 :                         print(state.files.bnd,
    2588              :                               "     Plant Loop Connector Nodes,   {},Mixer,{},{},{},{},{}\n",
    2589              :                               Count1,
    2590           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.Name,
    2591           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.NodeNameIn(Count1),
    2592           11 :                               state.dataPlnt->PlantLoop(Count).LoopSide(LoopSideNum).Mixer.NodeNameOut,
    2593           11 :                               state.dataPlnt->PlantLoop(Count).Name,
    2594              :                               LoopString);
    2595              :                     }
    2596              :                 }
    2597              :             }
    2598            2 :             print(state.files.bnd,
    2599              :                   " Plant Loop Supply Connection,{},{},{}\n",
    2600            2 :                   state.dataPlnt->PlantLoop(Count).Name,
    2601            2 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNameOut,
    2602            2 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Demand).NodeNameIn);
    2603            2 :             print(state.files.bnd,
    2604              :                   " Plant Loop Return Connection,{},{},{}\n",
    2605            2 :                   state.dataPlnt->PlantLoop(Count).Name,
    2606            2 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Demand).NodeNameOut,
    2607            2 :                   state.dataPlnt->PlantLoop(Count).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNameIn);
    2608              : 
    2609              :         } //  Plant Demand Side Loop
    2610              : 
    2611           73 :         print(state.files.bnd, "{}\n", "! ===============================================================");
    2612           73 :         int NumOfControlledZones = 0;
    2613          167 :         for (int Count = 1; Count <= state.dataGlobal->NumOfZones; ++Count) {
    2614           94 :             if (!allocated(state.dataZoneEquip->ZoneEquipConfig)) {
    2615            0 :                 continue;
    2616              :             }
    2617           94 :             if (state.dataZoneEquip->ZoneEquipConfig(Count).IsControlled) {
    2618           52 :                 ++NumOfControlledZones;
    2619              :             }
    2620              :         }
    2621              : 
    2622           73 :         if (NumOfControlledZones > 0) {
    2623           36 :             print(state.files.bnd, "{}\n", "! <# Controlled Zones>,<Number of Controlled Zones>");
    2624           36 :             print(state.files.bnd, " #Controlled Zones,{}\n", NumOfControlledZones);
    2625           36 :             print(state.files.bnd,
    2626              :                   "{}\n",
    2627              :                   "! <Controlled Zone>,<Controlled Zone Name>,<Equip List Name>,<Control List Name>,<Zone Node Name>,<# Inlet Nodes>,<# Exhaust "
    2628              :                   "Nodes>,<# Return Nodes>");
    2629           36 :             print(state.files.bnd,
    2630              :                   "{}\n",
    2631              :                   "! <Controlled Zone Inlet>,<Inlet Node Count>,<Controlled Zone Name>,<Supply Air Inlet Node Name>,<SD Sys:Cooling/Heating "
    2632              :                   "[DD:Cooling] Inlet Node Name>,<DD Sys:Heating Inlet Node Name>");
    2633           36 :             print(state.files.bnd, "{}\n", "! <Controlled Zone Exhaust>,<Exhaust Node Count>,<Controlled Zone Name>,<Exhaust Air Node Name>");
    2634              : 
    2635           91 :             for (int Count = 1; Count <= state.dataGlobal->NumOfZones; ++Count) {
    2636           55 :                 if (!state.dataZoneEquip->ZoneEquipConfig(Count).IsControlled) {
    2637            3 :                     continue;
    2638              :                 }
    2639              : 
    2640           52 :                 print(state.files.bnd,
    2641              :                       " Controlled Zone,{},{},{},{},{},{},{}\n",
    2642           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName,
    2643           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).EquipListName,
    2644           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).ControlListName,
    2645           52 :                       state.dataLoopNodes->NodeID(state.dataZoneEquip->ZoneEquipConfig(Count).ZoneNode),
    2646           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).NumInletNodes,
    2647           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).NumExhaustNodes,
    2648           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).NumReturnNodes);
    2649          107 :                 for (int Count1 = 1; Count1 <= state.dataZoneEquip->ZoneEquipConfig(Count).NumInletNodes; ++Count1) {
    2650           55 :                     std::string ChrName = state.dataLoopNodes->NodeID(state.dataZoneEquip->ZoneEquipConfig(Count).AirDistUnitHeat(Count1).InNode);
    2651           55 :                     if (ChrName == "Undefined") {
    2652           53 :                         ChrName = "N/A";
    2653              :                     }
    2654           55 :                     print(state.files.bnd,
    2655              :                           "   Controlled Zone Inlet,{},{},{},{},{}\n",
    2656              :                           Count1,
    2657           55 :                           state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName,
    2658           55 :                           state.dataLoopNodes->NodeID(state.dataZoneEquip->ZoneEquipConfig(Count).InletNode(Count1)),
    2659           55 :                           state.dataLoopNodes->NodeID(state.dataZoneEquip->ZoneEquipConfig(Count).AirDistUnitCool(Count1).InNode),
    2660              :                           ChrName);
    2661           55 :                 }
    2662           85 :                 for (int Count1 = 1; Count1 <= state.dataZoneEquip->ZoneEquipConfig(Count).NumExhaustNodes; ++Count1) {
    2663           33 :                     print(state.files.bnd,
    2664              :                           "   Controlled Zone Exhaust,{},{},{}\n",
    2665              :                           Count1,
    2666           33 :                           state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName,
    2667           33 :                           state.dataLoopNodes->NodeID(state.dataZoneEquip->ZoneEquipConfig(Count).ExhaustNode(Count1)));
    2668              :                 }
    2669          100 :                 for (int Count1 = 1; Count1 <= state.dataZoneEquip->ZoneEquipConfig(Count).NumReturnNodes; ++Count1) {
    2670           48 :                     print(state.files.bnd,
    2671              :                           "   Controlled Zone Return,{},{},{}\n",
    2672              :                           Count1,
    2673           48 :                           state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName,
    2674           48 :                           state.dataLoopNodes->NodeID(state.dataZoneEquip->ZoneEquipConfig(Count).ReturnNode(Count1)));
    2675              :                 }
    2676              :             }
    2677              : 
    2678              :             // Report Zone Equipment Lists to BND File
    2679           36 :             print(state.files.bnd, "{}\n", "! ===============================================================");
    2680           36 :             print(state.files.bnd, "{}\n", Format_720);
    2681           36 :             print(state.files.bnd, " #Zone Equipment Lists,{}\n", NumOfControlledZones);
    2682           36 :             print(state.files.bnd, "{}\n", Format_722);
    2683           36 :             print(state.files.bnd, "{}\n", Format_723);
    2684              : 
    2685           91 :             for (int Count = 1; Count <= state.dataGlobal->NumOfZones; ++Count) {
    2686              :                 // Zone equipment list array parallels controlled zone equipment array, so
    2687              :                 // same index finds corresponding data from both arrays
    2688           55 :                 if (!state.dataZoneEquip->ZoneEquipConfig(Count).IsControlled) {
    2689            3 :                     continue;
    2690              :                 }
    2691              : 
    2692           52 :                 print(state.files.bnd,
    2693              :                       " Zone Equipment List,{},{},{},{}\n",
    2694              :                       Count,
    2695           52 :                       state.dataZoneEquip->ZoneEquipList(Count).Name,
    2696           52 :                       state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName,
    2697           52 :                       state.dataZoneEquip->ZoneEquipList(Count).NumOfEquipTypes);
    2698              : 
    2699          117 :                 for (int Count1 = 1; Count1 <= state.dataZoneEquip->ZoneEquipList(Count).NumOfEquipTypes; ++Count1) {
    2700           65 :                     print(state.files.bnd,
    2701              :                           "   Zone Equipment Component,{},{},{},{},{},{}\n",
    2702              :                           Count1,
    2703           65 :                           state.dataZoneEquip->ZoneEquipList(Count).EquipTypeName(Count1),
    2704           65 :                           state.dataZoneEquip->ZoneEquipList(Count).EquipName(Count1),
    2705           65 :                           state.dataZoneEquip->ZoneEquipConfig(Count).ZoneName,
    2706           65 :                           state.dataZoneEquip->ZoneEquipList(Count).CoolingPriority(Count1),
    2707           65 :                           state.dataZoneEquip->ZoneEquipList(Count).HeatingPriority(Count1));
    2708              :                 }
    2709              :             }
    2710              :         }
    2711              : 
    2712              :         // Report Dual Duct Dampers to BND File
    2713           73 :         DualDuct::ReportDualDuctConnections(state);
    2714              : 
    2715           73 :         if (state.dataBranchNodeConnections->NumNodeConnectionErrors == 0) {
    2716          198 :             ShowMessage(state, "No node connection errors were found.");
    2717              :         } else {
    2718            7 :             if (state.dataBranchNodeConnections->NumNodeConnectionErrors > 1) {
    2719            2 :                 ShowMessage(state, format("There were {} node connection errors noted.", state.dataBranchNodeConnections->NumNodeConnectionErrors));
    2720              :             } else {
    2721            5 :                 ShowMessage(state, format("There was {} node connection error noted.", state.dataBranchNodeConnections->NumNodeConnectionErrors));
    2722              :             }
    2723              :         }
    2724              : 
    2725           73 :         state.dataErrTracking->AskForConnectionsReport = false;
    2726           73 :     }
    2727              : 
    2728         1419 :     void PostIPProcessing(EnergyPlusData &state)
    2729              :     {
    2730              :         // SUBROUTINE INFORMATION:
    2731              :         //       AUTHOR         Linda Lawrie
    2732              :         //       DATE WRITTEN   August 2010
    2733              : 
    2734              :         // PURPOSE OF THIS SUBROUTINE:
    2735              :         // This provides post processing (for errors, etc) directly after the InputProcessor
    2736              :         // finishes.  Code originally in the Input Processor.
    2737              : 
    2738              :         // Using/Aliasing
    2739              :         // using SQLiteProcedures::CreateSQLiteDatabase;
    2740         1419 :         state.dataGlobal->DoingInputProcessing = false;
    2741              : 
    2742         1419 :         state.dataInputProcessing->inputProcessor->preProcessorCheck(
    2743         1419 :             state, state.dataSimulationManager->PreP_Fatal); // Check Preprocessor objects for warning, severe, etc errors.
    2744              : 
    2745         1419 :         if (state.dataSimulationManager->PreP_Fatal) {
    2746            0 :             ShowFatalError(state, "Preprocessor condition(s) cause termination.");
    2747              :         }
    2748              : 
    2749         1419 :         state.dataInputProcessing->inputProcessor->preScanReportingVariables(state);
    2750         1419 :     }
    2751              : 
    2752           75 :     void isInputObjectUsed(EnergyPlusData &state)
    2753              :     {
    2754              :         // there is a need to know if certain object are used in the simulation
    2755              :         // this may not be the best place to do this but it's a start at early reading of input data
    2756              :         // this concept could grow to include reading all inputs prior to the start of the simulation so all data is available
    2757              :         // once inputs are processed, read in all getInputs. They will be read early and will not be read again so there is no duplication
    2758              : 
    2759              :         // for example, AirLoopHVAC:DOAS systems autosize on weather data, and WeatherManager processes that data
    2760              :         // there is no need to process that data if there are no DOAS used in the simulation
    2761          150 :         state.dataGlobal->AirLoopHVACDOASUsedInSim =
    2762           75 :             state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirLoopHVAC:DedicatedOutdoorAirSystem") > 0;
    2763           75 :         EMSManager::CheckIfAnyEMS(state);
    2764           75 :         PlantManager::CheckIfAnyPlant(state);
    2765           75 :         PlantPipingSystemsManager::CheckIfAnySlabs(state);
    2766           75 :         PlantPipingSystemsManager::CheckIfAnyBasements(state);
    2767           75 :         SetPointManager::CheckIfAnyIdealCondEntSetPoint(state);
    2768           75 :     }
    2769              : 
    2770              : } // namespace SimulationManager
    2771              : 
    2772              : // EXTERNAL SUBROUTINES:
    2773              : 
    2774            0 : void Resimulate(EnergyPlusData &state,
    2775              :                 bool const ResimExt, // Flag to resimulate the exterior energy use simulation
    2776              :                 bool const ResimHB,  // Flag to resimulate the heat balance simulation (including HVAC)
    2777              :                 bool &ResimHVAC      // Flag to resimulate the HVAC simulation
    2778              : )
    2779              : {
    2780              : 
    2781              :     // SUBROUTINE INFORMATION:
    2782              :     //       AUTHOR         Peter Graham Ellis
    2783              :     //       DATE WRITTEN   August 2005
    2784              :     //       MODIFIED       Sep 2011 LKL/BG - resimulate only zones needing it for Radiant systems
    2785              :     //       RE-ENGINEERED  na
    2786              : 
    2787              :     // PURPOSE OF THIS SUBROUTINE:
    2788              :     // This subroutine is called as necessary by the Demand Manager to resimulate some of the modules that have
    2789              :     // already been simulated for the current timestep.  For example, if LIGHTS are demand limited, the lighting
    2790              :     // power is reduced which also impacts the zone internal heat gains and therefore requires that the entire
    2791              :     // zone heat balance must be resimulated.
    2792              : 
    2793              :     // METHODOLOGY EMPLOYED:
    2794              :     // If the zone heat balance must be resimulated, all the major subroutines are called sequentially in order
    2795              :     // to recalculate the impacts of demand limiting.  This routine is called from ManageHVAC _before_ any variables
    2796              :     // are reported or histories are updated.  This routine can be called multiple times without the overall
    2797              :     // simulation moving forward in time.
    2798              :     // If only HVAC components are demand limited, then the HVAC system is resimulated, not the entire heat balance.
    2799              :     // Similarly, if ony exterior lights and equipment are demand limited, it is only necessary to resimulate the
    2800              :     // exterior energy use, not the entire heat balance, nor the HVAC system.
    2801              :     // Below is the hierarchy of subroutine calls.  The calls marked with an asterisk are resimulated here.
    2802              :     // ManageSimulation
    2803              :     //     ManageWeather
    2804              :     //     ManageDemand
    2805              :     //   * ManageExteriorEnergyUse
    2806              :     //     ManageHeatBalance
    2807              :     //       * InitHeatBalance
    2808              :     //             PerformSolarCalculations
    2809              :     //         ManageSurfaceHeatBalance
    2810              :     //           * InitSurfaceHeatBalance
    2811              :     //                 ManageInternalHeatGains
    2812              :     //           * CalcHeatBalanceOutsideSurf
    2813              :     //           * CalcHeatBalanceInsideSurf
    2814              :     //             ManageAirHeatBalance
    2815              :     //                *InitAirHeatBalance
    2816              :     //                 CalcHeatBalanceAir
    2817              :     //                   * CalcAirFlow
    2818              :     //                   * ManageRefrigeratedCaseRacks
    2819              :     //                     ManageHVAC
    2820              :     //                       * ManageZoneAirUpdates 'GET ZONE SETPOINTS'
    2821              :     //                       * ManageZoneAirUpdates 'PREDICT'
    2822              :     //                       * SimHVAC
    2823              :     //                         UpdateDataandReport
    2824              :     //                 ReportAirHeatBalance
    2825              :     //             UpdateFinalSurfaceHeatBalance
    2826              :     //             UpdateThermalHistories
    2827              :     //             UpdateMoistureHistories
    2828              :     //             ManageThermalComfort
    2829              :     //             ReportSurfaceHeatBalance
    2830              :     //         RecKeepHeatBalance
    2831              :     //         ReportHeatBalance
    2832              : 
    2833              :     // Using/Aliasing
    2834              :     using ExteriorEnergyUse::ManageExteriorEnergyUse;
    2835              :     using HeatBalanceAirManager::InitAirHeatBalance;
    2836              :     using HeatBalanceSurfaceManager::InitSurfaceHeatBalance;
    2837              :     using HVACManager::SimHVAC;
    2838              :     using RefrigeratedCase::ManageRefrigeratedCaseRacks;
    2839              :     using ZoneContaminantPredictorCorrector::ManageZoneContaminanUpdates;
    2840              :     using ZoneTempPredictorCorrector::ManageZoneAirUpdates;
    2841              :     using namespace ZoneEquipmentManager;
    2842              : 
    2843              :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    2844            0 :     Real64 ZoneTempChange(0.0); // Dummy variable needed for calling ManageZoneAirUpdates
    2845              : 
    2846            0 :     if (ResimExt) {
    2847            0 :         ManageExteriorEnergyUse(state);
    2848              : 
    2849            0 :         ++state.dataDemandManager->DemandManagerExtIterations;
    2850              :     }
    2851              : 
    2852            0 :     if (ResimHB) {
    2853              :         // Surface simulation
    2854            0 :         InitSurfaceHeatBalance(state);
    2855            0 :         HeatBalanceSurfaceManager::CalcHeatBalanceOutsideSurf(state);
    2856            0 :         HeatBalanceSurfaceManager::CalcHeatBalanceInsideSurf(state);
    2857              : 
    2858              :         // Air simulation
    2859            0 :         InitAirHeatBalance(state);
    2860            0 :         ManageRefrigeratedCaseRacks(state);
    2861              : 
    2862            0 :         ++state.dataDemandManager->DemandManagerHBIterations;
    2863            0 :         ResimHVAC = true; // Make sure HVAC is resimulated too
    2864              :     }
    2865              : 
    2866            0 :     if (ResimHVAC) {
    2867              :         // HVAC simulation
    2868            0 :         ManageZoneAirUpdates(state,
    2869              :                              DataHeatBalFanSys::PredictorCorrectorCtrl::GetZoneSetPoints,
    2870              :                              ZoneTempChange,
    2871              :                              false,
    2872            0 :                              state.dataHVACGlobal->UseZoneTimeStepHistory,
    2873              :                              0.0);
    2874            0 :         if (state.dataContaminantBalance->Contaminant.SimulateContaminants) {
    2875            0 :             ManageZoneContaminanUpdates(
    2876            0 :                 state, DataHeatBalFanSys::PredictorCorrectorCtrl::GetZoneSetPoints, false, state.dataHVACGlobal->UseZoneTimeStepHistory, 0.0);
    2877              :         }
    2878            0 :         CalcAirFlowSimple(
    2879            0 :             state, 0, state.dataHeatBal->ZoneAirMassFlow.AdjustZoneMixingFlow, state.dataHeatBal->ZoneAirMassFlow.AdjustZoneInfiltrationFlow);
    2880            0 :         ManageZoneAirUpdates(
    2881            0 :             state, DataHeatBalFanSys::PredictorCorrectorCtrl::PredictStep, ZoneTempChange, false, state.dataHVACGlobal->UseZoneTimeStepHistory, 0.0);
    2882            0 :         if (state.dataContaminantBalance->Contaminant.SimulateContaminants) {
    2883            0 :             ManageZoneContaminanUpdates(
    2884            0 :                 state, DataHeatBalFanSys::PredictorCorrectorCtrl::PredictStep, false, state.dataHVACGlobal->UseZoneTimeStepHistory, 0.0);
    2885              :         }
    2886            0 :         SimHVAC(state);
    2887              : 
    2888            0 :         ++state.dataDemandManager->DemandManagerHVACIterations;
    2889              :     }
    2890            0 : }
    2891              : 
    2892              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1