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