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