-
Notifications
You must be signed in to change notification settings - Fork 389
/
SimulationManager.cc
3077 lines (2758 loc) · 169 KB
/
SimulationManager.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// EnergyPlus, Copyright (c) 1996-2021, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
// contributors. All rights reserved.
//
// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
// U.S. Government consequently retains certain rights. As such, the U.S. Government has been
// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
// worldwide license in the Software to reproduce, distribute copies to the public, prepare
// derivative works, and perform publicly and display publicly, and to permit others to do so.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
// provided that the following conditions are met:
//
// (1) Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// (2) Redistributions in binary form must reproduce the above copyright notice, this list of
// conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific prior
// written permission.
//
// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
// without changes from the version obtained under this License, or (ii) Licensee makes a
// reference solely to the software portion of its product, Licensee must refer to the
// software as "EnergyPlus version X" software, where "X" is the version number Licensee
// obtained under this License and may not use a different name for the software. Except as
// specifically required in this Section (4), Licensee shall not use in a company name, a
// product name, in advertising, publicity, or other promotional activities any name, trade
// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
// similar designation, without the U.S. Department of Energy's prior written consent.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// FMI-Related Headers
extern "C" {
#include <FMI/main.h>
}
// C++ Headers
#include <memory>
#include <string>
// ObjexxFCL Headers
#include <ObjexxFCL/Array.functions.hh>
#include <ObjexxFCL/Array1D.hh>
#include <ObjexxFCL/Fmath.hh>
#include <ObjexxFCL/environment.hh>
#include <ObjexxFCL/string.functions.hh>
// EnergyPlus Headers
#include <EnergyPlus/BranchInputManager.hh>
#include <EnergyPlus/BranchNodeConnections.hh>
#include <EnergyPlus/CostEstimateManager.hh>
#include <EnergyPlus/CurveManager.hh>
#include <EnergyPlus/Data/EnergyPlusData.hh>
#include <EnergyPlus/DataAirLoop.hh>
#include <EnergyPlus/DataBranchNodeConnections.hh>
#include <EnergyPlus/DataConvergParams.hh>
#include <EnergyPlus/DataErrorTracking.hh>
#include <EnergyPlus/DataGlobalConstants.hh>
#include <EnergyPlus/DataHVACGlobals.hh>
#include <EnergyPlus/DataHeatBalFanSys.hh>
#include <EnergyPlus/DataHeatBalance.hh>
#include <EnergyPlus/DataIPShortCuts.hh>
#include <EnergyPlus/DataLoopNode.hh>
#include <EnergyPlus/DataOutputs.hh>
#include <EnergyPlus/DataReportingFlags.hh>
#include <EnergyPlus/DataRuntimeLanguage.hh>
#include <EnergyPlus/DataStringGlobals.hh>
#include <EnergyPlus/DataSurfaces.hh>
#include <EnergyPlus/DataSystemVariables.hh>
#include <EnergyPlus/DataZoneEquipment.hh>
#include <EnergyPlus/DemandManager.hh>
#include <EnergyPlus/DisplayRoutines.hh>
#include <EnergyPlus/DualDuct.hh>
#include <EnergyPlus/EMSManager.hh>
#include <EnergyPlus/EconomicLifeCycleCost.hh>
#include <EnergyPlus/EconomicTariff.hh>
#include <EnergyPlus/ElectricPowerServiceManager.hh>
#include <EnergyPlus/ExteriorEnergyUse.hh>
#include <EnergyPlus/ExternalInterface.hh>
#include <EnergyPlus/FaultsManager.hh>
#include <EnergyPlus/FileSystem.hh>
#include <EnergyPlus/FluidProperties.hh>
#include <EnergyPlus/GeneralRoutines.hh>
#include <EnergyPlus/HVACControllers.hh>
#include <EnergyPlus/HVACManager.hh>
#include <EnergyPlus/HVACSizingSimulationManager.hh>
#include <EnergyPlus/HeatBalanceAirManager.hh>
#include <EnergyPlus/HeatBalanceIntRadExchange.hh>
#include <EnergyPlus/HeatBalanceManager.hh>
#include <EnergyPlus/HeatBalanceSurfaceManager.hh>
#include <EnergyPlus/InputProcessing/InputProcessor.hh>
#include <EnergyPlus/MixedAir.hh>
#include <EnergyPlus/NodeInputManager.hh>
#include <EnergyPlus/OutAirNodeManager.hh>
#include <EnergyPlus/OutputProcessor.hh>
#include <EnergyPlus/OutputReportPredefined.hh>
#include <EnergyPlus/OutputReportTabular.hh>
#include <EnergyPlus/OutputReports.hh>
#include <EnergyPlus/Plant/DataPlant.hh>
#include <EnergyPlus/Plant/PlantManager.hh>
#include <EnergyPlus/PlantPipingSystemsManager.hh>
#include <EnergyPlus/PluginManager.hh>
#include <EnergyPlus/PollutionModule.hh>
#include <EnergyPlus/Psychrometrics.hh>
#include <EnergyPlus/RefrigeratedCase.hh>
#include <EnergyPlus/ReportCoilSelection.hh>
#include <EnergyPlus/ResultsFramework.hh>
#include <EnergyPlus/SetPointManager.hh>
#include <EnergyPlus/SimulationManager.hh>
#include <EnergyPlus/SizingManager.hh>
#include <EnergyPlus/SolarShading.hh>
#include <EnergyPlus/SurfaceGeometry.hh>
#include <EnergyPlus/SystemReports.hh>
#include <EnergyPlus/UtilityRoutines.hh>
#include <EnergyPlus/WeatherManager.hh>
#include <EnergyPlus/ZoneContaminantPredictorCorrector.hh>
#include <EnergyPlus/ZoneEquipmentManager.hh>
#include <EnergyPlus/ZoneTempPredictorCorrector.hh>
#include <EnergyPlus/api/datatransfer.h>
namespace EnergyPlus {
namespace SimulationManager {
// MODULE INFORMATION:
// AUTHOR Rick Strand
// DATE WRITTEN January 1997
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS MODULE:
// This module contains the main driver routine which manages the major
// control loops of the EnergyPlus simulation. This module is also
// responsible for setting the global environment flags for these
// loops.
// METHODOLOGY EMPLOYED:
// This module was constructed from the remnants of (I)BLAST routines
// SIMBLD (Simulate Building), SIMZG (Simulate Zone Group), and SIMZGD
// (Simulate Zone Group for a Day).
// REFERENCES:
// (I)BLAST legacy code, internal Reverse Engineering documentation,
// and internal Evolutionary Engineering documentation.
// Using/Aliasing
using namespace DataSizing;
using namespace DataSystemVariables;
using namespace HeatBalanceManager;
using namespace WeatherManager;
using namespace ExternalInterface;
// MODULE PARAMETER DEFINITIONS:
void ManageSimulation(EnergyPlusData &state)
{
// SUBROUTINE INFORMATION:
// AUTHOR Rick Strand
// DATE WRITTEN January 1997
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine is the main driver of the simulation manager module.
// It contains the main environment-time loops for the building
// simulation. This includes the environment loop, a day loop, an
// hour loop, and a time step loop.
// Using/Aliasing
auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
using BranchInputManager::ManageBranchInput;
using BranchInputManager::TestBranchIntegrity;
using BranchNodeConnections::CheckNodeConnections;
using BranchNodeConnections::TestCompSetInletOutletNodes;
using CostEstimateManager::SimCostEstimate;
using CurveManager::InitCurveReporting;
using DemandManager::InitDemandManagers;
using EconomicLifeCycleCost::ComputeLifeCycleCostAndReport;
using EconomicLifeCycleCost::GetInputForLifeCycleCost;
using EconomicTariff::ComputeTariff; // added for computing annual utility costs
using EconomicTariff::WriteTabularTariffReports;
using EMSManager::CheckIfAnyEMS;
using EMSManager::ManageEMS;
using ExteriorEnergyUse::ManageExteriorEnergyUse;
using FaultsManager::CheckAndReadFaults;
using HVACControllers::DumpAirLoopStatistics;
using MixedAir::CheckControllerLists;
using NodeInputManager::CheckMarkedNodes;
using NodeInputManager::SetupNodeVarsForReporting;
using OutputProcessor::ReportForTabularReports;
using OutputProcessor::ResetAccumulationWhenWarmupComplete;
using OutputProcessor::SetupTimePointers;
using OutputReportPredefined::SetPredefinedTables;
using OutputReportTabular::CloseOutputTabularFile;
using OutputReportTabular::OpenOutputTabularFile;
using OutputReportTabular::ResetTabularReports;
using OutputReportTabular::WriteTabularReports;
using PlantManager::CheckIfAnyPlant;
using PlantPipingSystemsManager::CheckIfAnyBasements;
using PlantPipingSystemsManager::CheckIfAnySlabs;
using PlantPipingSystemsManager::SimulateGroundDomains;
using PollutionModule::CheckPollutionMeterReporting;
using PollutionModule::SetupPollutionCalculations;
using PollutionModule::SetupPollutionMeterReporting;
using Psychrometrics::InitializePsychRoutines;
using SetPointManager::CheckIfAnyIdealCondEntSetPoint;
using SizingManager::ManageSizing;
using SystemReports::CreateEnergyReportStructure;
using SystemReports::ReportAirLoopConnections;
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
bool Available; // an environment is available to process
bool ErrorsFound(false);
bool TerminalError(false);
bool SimsDone;
bool ErrFound;
bool oneTimeUnderwaterBoundaryCheck = true;
bool AnyUnderwaterBoundaries = false;
int EnvCount;
state.files.outputControl.getInput(state);
state.dataResultsFramework->resultsFramework->setupOutputOptions(state);
state.files.debug.ensure_open(state, "OpenOutputFiles", state.files.outputControl.dbg);
// CreateSQLiteDatabase();
state.dataSQLiteProcedures->sqlite = EnergyPlus::CreateSQLiteDatabase(state);
if (state.dataSQLiteProcedures->sqlite) {
state.dataSQLiteProcedures->sqlite->sqliteBegin();
state.dataSQLiteProcedures->sqlite->createSQLiteSimulationsRecord(
1, state.dataStrGlobals->VerStringVar, state.dataStrGlobals->CurrentDateTime);
state.dataSQLiteProcedures->sqlite->sqliteCommit();
}
PostIPProcessing(state);
state.dataGlobal->BeginSimFlag = true;
state.dataGlobal->BeginFullSimFlag = false;
state.dataGlobal->DoOutputReporting = false;
state.dataReportFlag->DisplayPerfSimulationFlag = false;
state.dataReportFlag->DoWeatherInitReporting = false;
state.dataSimulationManager->RunPeriodsInInput =
(state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod") > 0 ||
state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod:CustomRange") > 0 || state.dataSysVars->FullAnnualRun);
state.dataErrTracking->AskForConnectionsReport = false; // set to false until sizing is finished
OpenOutputFiles(state);
GetProjectData(state);
InitializePsychRoutines(state);
CheckForMisMatchedEnvironmentSpecifications(state);
CheckForRequestedReporting(state);
SetPredefinedTables(state);
SetPreConstructionInputParameters(state); // establish array bounds for constructions early
SetupTimePointers(
state, OutputProcessor::SOVTimeStepType::Zone, state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation
SetupTimePointers(state, OutputProcessor::SOVTimeStepType::HVAC, TimeStepSys);
CheckIfAnyEMS(state);
CheckIfAnyPlant(state);
CheckIfAnySlabs(state);
CheckIfAnyBasements(state);
CheckIfAnyIdealCondEntSetPoint(state);
createFacilityElectricPowerServiceObject(state);
createCoilSelectionReportObj(state);
ManageBranchInput(state); // just gets input and returns.
// Create a new plugin manager which starts up the Python interpreter
state.dataPluginManager->pluginManager = std::make_unique<EnergyPlus::PluginManagement::PluginManager>(state);
state.dataGlobal->DoingSizing = true;
ManageSizing(state);
state.dataGlobal->BeginFullSimFlag = true;
SimsDone = false;
if (state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim || state.dataGlobal->DoHVACSizingSimulation) {
state.dataGlobal->DoOutputReporting = true;
}
state.dataGlobal->DoingSizing = false;
if ((state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing) &&
!(state.dataGlobal->DoDesDaySim || (state.dataGlobal->DoWeathSim && state.dataSimulationManager->RunPeriodsInInput))) {
ShowWarningError(state,
"ManageSimulation: Input file has requested Sizing Calculations but no Simulations are requested (in SimulationControl "
"object). Succeeding warnings/errors may be confusing.");
}
Available = true;
if (state.dataBranchInputManager->InvalidBranchDefinitions) {
ShowFatalError(state, "Preceding error(s) in Branch Input cause termination.");
}
DisplayString(state, "Adjusting Air System Sizing");
SizingManager::ManageSystemSizingAdjustments(state);
DisplayString(state, "Adjusting Standard 62.1 Ventilation Sizing");
SizingManager::ManageSystemVentilationAdjustments(state);
DisplayString(state, "Initializing Simulation");
state.dataGlobal->KickOffSimulation = true;
ResetEnvironmentCounter(state);
SetupSimulation(state, ErrorsFound);
CheckAndReadFaults(state);
InitCurveReporting(state);
state.dataErrTracking->AskForConnectionsReport = true; // set to true now that input processing and sizing is done.
state.dataGlobal->KickOffSimulation = false;
state.dataGlobal->WarmupFlag = false;
state.dataReportFlag->DoWeatherInitReporting = true;
// Note: All the inputs have been 'gotten' by the time we get here.
ErrFound = false;
if (state.dataGlobal->DoOutputReporting) {
DisplayString(state, "Reporting Surfaces");
ReportSurfaces(state);
SetupNodeVarsForReporting(state);
state.dataGlobal->MetersHaveBeenInitialized = true;
SetupPollutionMeterReporting(state);
SystemReports::AllocateAndSetUpVentReports(state);
if (state.dataPluginManager->pluginManager) {
EnergyPlus::PluginManagement::PluginManager::setupOutputVariables(state);
}
UpdateMeterReporting(state);
CheckPollutionMeterReporting(state);
state.dataElectPwrSvcMgr->facilityElectricServiceObj->verifyCustomMetersElecPowerMgr(state);
SetupPollutionCalculations(state);
InitDemandManagers(state);
TestBranchIntegrity(state, ErrFound);
if (ErrFound) TerminalError = true;
TestAirPathIntegrity(state, ErrFound);
if (ErrFound) TerminalError = true;
CheckMarkedNodes(state, ErrFound);
if (ErrFound) TerminalError = true;
CheckNodeConnections(state, ErrFound);
if (ErrFound) TerminalError = true;
TestCompSetInletOutletNodes(state, ErrFound);
if (ErrFound) TerminalError = true;
CheckControllerLists(state, ErrFound);
if (ErrFound) TerminalError = true;
if (state.dataGlobal->DoDesDaySim || state.dataGlobal->DoWeathSim) {
ReportLoopConnections(state);
ReportAirLoopConnections(state);
ReportNodeConnections(state);
// Debug reports
// CALL ReportCompSetMeterVariables
// CALL ReportParentChildren
}
CreateEnergyReportStructure(state);
bool anyEMSRan;
ManageEMS(state,
EMSManager::EMSCallFrom::SetupSimulation,
anyEMSRan,
ObjexxFCL::Optional_int_const()); // point to finish setup processing EMS, sensor ready now
ProduceRDDMDD(state);
if (TerminalError) {
ShowFatalError(state, "Previous Conditions cause program termination.");
}
}
// up until this point, output vars, meters, actuators, etc., may not have been registered; they are now
state.dataPluginManager->fullyReady = true;
if (state.dataSQLiteProcedures->sqlite) {
state.dataSQLiteProcedures->sqlite->sqliteBegin();
state.dataSQLiteProcedures->sqlite->updateSQLiteSimulationRecord(1, state.dataGlobal->NumOfTimeStepInHour);
state.dataSQLiteProcedures->sqlite->sqliteCommit();
}
GetInputForLifeCycleCost(state); // must be prior to WriteTabularReports -- do here before big simulation stuff.
// check for variable latitude/location/etc
WeatherManager::ReadVariableLocationOrientation(state);
// if user requested HVAC Sizing Simulation, call HVAC sizing simulation manager
if (state.dataGlobal->DoHVACSizingSimulation) {
ManageHVACSizingSimulation(state, ErrorsFound);
}
ShowMessage(state, "Beginning Simulation");
DisplayString(state, "Beginning Primary Simulation");
ResetEnvironmentCounter(state);
EnvCount = 0;
state.dataGlobal->WarmupFlag = true;
while (Available) {
if (state.dataGlobal->stopSimulation) break;
GetNextEnvironment(state, Available, ErrorsFound);
if (!Available) break;
if (ErrorsFound) break;
if ((!state.dataGlobal->DoDesDaySim) && (state.dataGlobal->KindOfSim != DataGlobalConstants::KindOfSim::RunPeriodWeather)) continue;
if ((!state.dataGlobal->DoWeathSim) && (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather)) continue;
if (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::HVACSizeDesignDay)
continue; // don't run these here, only for sizing simulations
if (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::HVACSizeRunPeriodDesign)
continue; // don't run these here, only for sizing simulations
++EnvCount;
if (state.dataSQLiteProcedures->sqlite) {
state.dataSQLiteProcedures->sqlite->sqliteBegin();
state.dataSQLiteProcedures->sqlite->createSQLiteEnvironmentPeriodRecord(
state.dataEnvrn->CurEnvirNum, state.dataEnvrn->EnvironmentName, state.dataGlobal->KindOfSim);
state.dataSQLiteProcedures->sqlite->sqliteCommit();
}
state.dataErrTracking->ExitDuringSimulations = true;
SimsDone = true;
DisplayString(state, "Initializing New Environment Parameters");
state.dataGlobal->BeginEnvrnFlag = true;
if ((state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::DesignDay) &&
(state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum)
.suppressBegEnvReset)) {
// user has input in SizingPeriod:DesignDay directing to skip begin environment rests, for accuracy-with-speed as zones can more
// easily converge fewer warmup days are allowed
DisplayString(state, "Design Day Fast Warmup Mode: Suppressing Initialization of New Environment Parameters");
state.dataGlobal->beginEnvrnWarmStartFlag = true;
} else {
state.dataGlobal->beginEnvrnWarmStartFlag = false;
}
state.dataGlobal->EndEnvrnFlag = false;
state.dataEnvrn->EndMonthFlag = false;
state.dataGlobal->WarmupFlag = true;
state.dataGlobal->DayOfSim = 0;
state.dataGlobal->DayOfSimChr = "0";
state.dataReportFlag->NumOfWarmupDays = 0;
if (state.dataEnvrn->CurrentYearIsLeapYear) {
if (state.dataGlobal->NumOfDayInEnvrn <= 366) {
state.dataOutputProcessor->isFinalYear = true;
}
} else {
if (state.dataGlobal->NumOfDayInEnvrn <= 365) {
state.dataOutputProcessor->isFinalYear = true;
}
}
HVACManager::ResetNodeData(state); // Reset here, because some zone calcs rely on node data (e.g. ZoneITEquip)
bool anyEMSRan;
ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyEMSRan, ObjexxFCL::Optional_int_const()); // calling point
while ((state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ...
if (state.dataGlobal->stopSimulation) break;
if (state.dataSQLiteProcedures->sqlite) state.dataSQLiteProcedures->sqlite->sqliteBegin(); // setup for one transaction per day
++state.dataGlobal->DayOfSim;
state.dataGlobal->DayOfSimChr = fmt::to_string(state.dataGlobal->DayOfSim);
if (!state.dataGlobal->WarmupFlag) {
++state.dataEnvrn->CurrentOverallSimDay;
DisplaySimDaysProgress(state, state.dataEnvrn->CurrentOverallSimDay, state.dataEnvrn->TotalOverallSimDays);
} else {
state.dataGlobal->DayOfSimChr = "0";
}
state.dataGlobal->BeginDayFlag = true;
state.dataGlobal->EndDayFlag = false;
if (state.dataGlobal->WarmupFlag) {
++state.dataReportFlag->NumOfWarmupDays;
state.dataReportFlag->cWarmupDay = fmt::to_string(state.dataReportFlag->NumOfWarmupDays);
DisplayString(state, "Warming up {" + state.dataReportFlag->cWarmupDay + '}');
} else if (state.dataGlobal->DayOfSim == 1) {
if (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather) {
DisplayString(state, "Starting Simulation at " + state.dataEnvrn->CurMnDyYr + " for " + state.dataEnvrn->EnvironmentName);
} else {
DisplayString(state, "Starting Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName);
}
static constexpr std::string_view Format_700("Environment:WarmupDays,{:3}\n");
print(state.files.eio, Format_700, state.dataReportFlag->NumOfWarmupDays);
ResetAccumulationWhenWarmupComplete(state);
} else if (state.dataReportFlag->DisplayPerfSimulationFlag) {
if (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather) {
DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDyYr + " for " + state.dataEnvrn->EnvironmentName);
} else {
DisplayString(state, "Continuing Simulation at " + state.dataEnvrn->CurMnDy + " for " + state.dataEnvrn->EnvironmentName);
}
state.dataReportFlag->DisplayPerfSimulationFlag = false;
}
// for simulations that last longer than a week, identify when the last year of the simulation is started
if ((state.dataGlobal->DayOfSim > 365) && ((state.dataGlobal->NumOfDayInEnvrn - state.dataGlobal->DayOfSim) == 364) &&
!state.dataGlobal->WarmupFlag) {
DisplayString(state, "Starting last year of environment at: " + state.dataGlobal->DayOfSimChr);
ResetTabularReports(state);
}
for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ...
if (state.dataGlobal->stopSimulation) break;
state.dataGlobal->BeginHourFlag = true;
state.dataGlobal->EndHourFlag = false;
for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour;
++state.dataGlobal->TimeStep) {
if (state.dataGlobal->stopSimulation) break;
if (state.dataGlobal->AnySlabsInModel || state.dataGlobal->AnyBasementsInModel) {
SimulateGroundDomains(state, false);
}
if (AnyUnderwaterBoundaries) {
WeatherManager::UpdateUnderwaterBoundaries(state);
}
if (state.dataEnvrn->varyingLocationSchedIndexLat > 0 || state.dataEnvrn->varyingLocationSchedIndexLong > 0 ||
state.dataEnvrn->varyingOrientationSchedIndex > 0) {
WeatherManager::UpdateLocationAndOrientation(state);
}
state.dataGlobal->BeginTimeStepFlag = true;
ExternalInterfaceExchangeVariables(state);
// Set the End__Flag variables to true if necessary. Note that
// each flag builds on the previous level. EndDayFlag cannot be
// .TRUE. unless EndHourFlag is also .TRUE., etc. Note that the
// EndEnvrnFlag and the EndSimFlag cannot be set during warmup.
// Note also that BeginTimeStepFlag, EndTimeStepFlag, and the
// SubTimeStepFlags can/will be set/reset in the HVAC Manager.
if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) {
state.dataGlobal->EndHourFlag = true;
if (state.dataGlobal->HourOfDay == 24) {
state.dataGlobal->EndDayFlag = true;
if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) {
state.dataGlobal->EndEnvrnFlag = true;
}
}
}
ManageWeather(state);
ManageExteriorEnergyUse(state);
ManageHeatBalance(state);
if (oneTimeUnderwaterBoundaryCheck) {
AnyUnderwaterBoundaries = WeatherManager::CheckIfAnyUnderwaterBoundaries(state);
oneTimeUnderwaterBoundaryCheck = false;
}
state.dataGlobal->BeginHourFlag = false;
state.dataGlobal->BeginDayFlag = false;
state.dataGlobal->BeginEnvrnFlag = false;
state.dataGlobal->BeginSimFlag = false;
state.dataGlobal->BeginFullSimFlag = false;
} // TimeStep loop
state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay;
} // ... End hour loop.
if (state.dataSQLiteProcedures->sqlite) state.dataSQLiteProcedures->sqlite->sqliteCommit(); // one transaction per day
} // ... End day loop.
// Need one last call to send latest states to middleware
ExternalInterfaceExchangeVariables(state);
} // ... End environment loop.
state.dataGlobal->WarmupFlag = false;
if (!SimsDone && state.dataGlobal->DoDesDaySim) {
if ((state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays) == 0) { // if sum is 0, then there was no sizing done.
ShowWarningError(state,
"ManageSimulation: SizingPeriod:* were requested in SimulationControl but no SizingPeriod:* objects in input.");
}
}
if (!SimsDone && state.dataGlobal->DoWeathSim) {
if (!state.dataSimulationManager->RunPeriodsInInput) { // if no run period requested, and sims not done
ShowWarningError(state, "ManageSimulation: Weather Simulation was requested in SimulationControl but no RunPeriods in input.");
}
}
PlantManager::CheckOngoingPlantWarnings(state);
if (state.dataSQLiteProcedures->sqlite) state.dataSQLiteProcedures->sqlite->sqliteBegin(); // for final data to write
#ifdef EP_Detailed_Timings
epStartTime("Closeout Reporting=");
#endif
SimCostEstimate(state);
ComputeTariff(state); // Compute the utility bills
EMSManager::checkForUnusedActuatorsAtEnd(state);
EMSManager::checkSetpointNodesAtEnd(state);
ReportForTabularReports(state); // For Energy Meters (could have other things that need to be pushed to after simulation)
OpenOutputTabularFile(state);
WriteTabularReports(state); // Create the tabular reports at completion of each
WriteTabularTariffReports(state);
ComputeLifeCycleCostAndReport(state); // must be after WriteTabularReports and WriteTabularTariffReports
CloseOutputTabularFile(state);
DumpAirLoopStatistics(state); // Dump runtime statistics for air loop controller simulation to csv file
#ifdef EP_Detailed_Timings
epStopTime("Closeout Reporting=");
#endif
CloseOutputFiles(state);
// state.dataSQLiteProcedures->sqlite->createZoneExtendedOutput();
CreateSQLiteZoneExtendedOutput(state);
if (state.dataSQLiteProcedures->sqlite) {
DisplayString(state, "Writing final SQL reports");
state.dataSQLiteProcedures->sqlite->sqliteCommit(); // final transactions
state.dataSQLiteProcedures->sqlite->initializeIndexes(); // do not create indexes (SQL) until all is done.
}
if (ErrorsFound) {
ShowFatalError(state, "Error condition occurred. Previous Severe Errors cause termination.");
}
}
void GetProjectData(EnergyPlusData &state)
{
// SUBROUTINE INFORMATION:
// AUTHOR Linda K. Lawrie
// DATE WRITTEN November 1997
// MODIFIED na
// RE-ENGINEERED na
// PURPOSE OF THIS SUBROUTINE:
// This subroutine gets global project data from the input file.
// METHODOLOGY EMPLOYED:
// Use GetObjectItem from the Input Processor
// Using/Aliasing
using DataStringGlobals::MatchVersion;
using namespace DataSystemVariables;
auto &deviationFromSetPtThresholdClg = state.dataHVACGlobal->deviationFromSetPtThresholdClg;
auto &deviationFromSetPtThresholdHtg = state.dataHVACGlobal->deviationFromSetPtThresholdHtg;
// SUBROUTINE PARAMETER DEFINITIONS:
static constexpr std::array<int, 12> Div60 = {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60};
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
Array1D_string Alphas(10);
Array1D<Real64> Number(4);
int NumAlpha;
int NumNumber;
int IOStat;
int NumDebugOut;
int MinInt;
int Num;
int Which;
bool ErrorsFound;
int NumRunControl;
std::string VersionID;
std::string CurrentModuleObject;
bool CondFDAlgo;
int Item;
ErrorsFound = false;
CurrentModuleObject = "Version";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num == 1) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
Alphas,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
std::string::size_type const lenVer(len(MatchVersion));
if ((lenVer > 0) && (MatchVersion[lenVer - 1] == '0')) {
Which = static_cast<int>(index(Alphas(1).substr(0, lenVer - 2), MatchVersion.substr(0, lenVer - 2)));
} else {
Which = static_cast<int>(index(Alphas(1), MatchVersion));
}
if (Which != 0) {
ShowWarningError(state, CurrentModuleObject + ": in IDF=\"" + Alphas(1) + "\" not the same as expected=\"" + MatchVersion + "\"");
}
VersionID = Alphas(1);
} else if (Num == 0) {
ShowWarningError(state, CurrentModuleObject + ": missing in IDF, processing for EnergyPlus version=\"" + MatchVersion + "\"");
} else {
ShowSevereError(state, "Too many " + CurrentModuleObject + " Objects found.");
ErrorsFound = true;
}
// Do Mini Gets on HB Algorithm and by-surface overrides
CurrentModuleObject = "HeatBalanceAlgorithm";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
CondFDAlgo = false;
if (Num > 0) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
Alphas,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
{
auto const SELECT_CASE_var(Alphas(1));
if ((SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCE") || (SELECT_CASE_var == "CONDFD") ||
(SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCEDETAILED") || (SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCESIMPLIFIED")) {
CondFDAlgo = true;
} else {
}
}
}
CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num > 0) {
for (Item = 1; Item <= Num; ++Item) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
Item,
Alphas,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
{
auto const SELECT_CASE_var(Alphas(2));
if (SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCE") {
CondFDAlgo = true;
} else {
}
}
}
}
CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:MultipleSurface";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num > 0) {
for (Item = 1; Item <= Num; ++Item) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
Alphas,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
{
auto const SELECT_CASE_var(Alphas(3));
if (SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCE") {
CondFDAlgo = true;
} else {
}
}
}
}
CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:SurfaceList";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num > 0) {
for (Item = 1; Item <= Num; ++Item) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
state.dataIPShortCut->cAlphaArgs,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
{
auto const SELECT_CASE_var(state.dataIPShortCut->cAlphaArgs(2));
if (SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCE") {
CondFDAlgo = true;
} else {
}
}
}
}
CurrentModuleObject = "SurfaceProperty:HeatTransferAlgorithm:Construction";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num > 0) {
for (Item = 1; Item <= Num; ++Item) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
state.dataIPShortCut->cAlphaArgs,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
{
auto const SELECT_CASE_var(state.dataIPShortCut->cAlphaArgs(2));
if (SELECT_CASE_var == "CONDUCTIONFINITEDIFFERENCE") {
CondFDAlgo = true;
} else {
}
}
}
}
CurrentModuleObject = "Timestep";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num == 1) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
Alphas,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
state.dataGlobal->NumOfTimeStepInHour = Number(1);
if (state.dataGlobal->NumOfTimeStepInHour <= 0 || state.dataGlobal->NumOfTimeStepInHour > 60) {
Alphas(1) = fmt::to_string(state.dataGlobal->NumOfTimeStepInHour);
ShowWarningError(state, CurrentModuleObject + ": Requested number (" + Alphas(1) + ") invalid, Defaulted to 4");
state.dataGlobal->NumOfTimeStepInHour = 4;
} else if (mod(60, state.dataGlobal->NumOfTimeStepInHour) != 0) {
MinInt = 9999;
for (Num = 1; Num <= 12; ++Num) {
if (std::abs(state.dataGlobal->NumOfTimeStepInHour - Div60[Num - 1]) > MinInt) continue;
MinInt = state.dataGlobal->NumOfTimeStepInHour - Div60[Num - 1];
Which = Num;
}
ShowWarningError(state,
format("{}: Requested number ({}) not evenly divisible into 60, defaulted to nearest ({}).",
CurrentModuleObject,
state.dataGlobal->NumOfTimeStepInHour,
Div60[Which - 1]));
state.dataGlobal->NumOfTimeStepInHour = Div60[Which - 1];
}
if (CondFDAlgo && state.dataGlobal->NumOfTimeStepInHour < 20) {
ShowWarningError(state,
format("{}: Requested number ({}) cannot be used when Conduction Finite Difference algorithm is selected.",
CurrentModuleObject,
state.dataGlobal->NumOfTimeStepInHour));
ShowContinueError(state, "..." + CurrentModuleObject + " is set to 20.");
state.dataGlobal->NumOfTimeStepInHour = 20;
}
if (state.dataGlobal->NumOfTimeStepInHour < 4 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0) {
ShowWarningError(state,
format("{}: Requested number ({}) is less than the suggested minimum of 4.",
CurrentModuleObject,
state.dataGlobal->NumOfTimeStepInHour));
ShowContinueError(state,
"Please see entry for " + CurrentModuleObject + " in Input/Output Reference for discussion of considerations.");
}
} else if (Num == 0 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0 && !CondFDAlgo) {
ShowWarningError(state, "No " + CurrentModuleObject + " object found. Number of TimeSteps in Hour defaulted to 4.");
state.dataGlobal->NumOfTimeStepInHour = 4;
} else if (Num == 0 && !CondFDAlgo) {
state.dataGlobal->NumOfTimeStepInHour = 4;
} else if (Num == 0 && state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Zone") > 0 && CondFDAlgo) {
ShowWarningError(state, "No " + CurrentModuleObject + " object found. Number of TimeSteps in Hour defaulted to 20.");
ShowContinueError(state, "...Due to presence of Conduction Finite Difference Algorithm selection.");
state.dataGlobal->NumOfTimeStepInHour = 20;
} else if (Num == 0 && CondFDAlgo) {
state.dataGlobal->NumOfTimeStepInHour = 20;
} else {
ShowSevereError(state, "Too many " + CurrentModuleObject + " Objects found.");
ErrorsFound = true;
}
state.dataGlobal->TimeStepZone = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour);
state.dataGlobal->MinutesPerTimeStep = state.dataGlobal->TimeStepZone * 60;
state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour;
CurrentModuleObject = "ConvergenceLimits";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num == 1) {
state.dataInputProcessing->inputProcessor->getObjectItem(state,
CurrentModuleObject,
1,
Alphas,
NumAlpha,
Number,
NumNumber,
IOStat,
state.dataIPShortCut->lNumericFieldBlanks,
state.dataIPShortCut->lAlphaFieldBlanks,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);
MinInt = int(Number(1));
if (MinInt > state.dataGlobal->MinutesPerTimeStep) {
MinInt = state.dataGlobal->MinutesPerTimeStep;
}
if (MinInt < 0 || MinInt > 60) {
ShowWarningError(
state,
format(
"{}: Requested {} ({}) invalid. Set to 1 minute.", CurrentModuleObject, state.dataIPShortCut->cNumericFieldNames(1), MinInt));
state.dataConvergeParams->MinTimeStepSys = 1.0 / 60.0;
} else if (MinInt == 0) { // Set to TimeStepZone
state.dataConvergeParams->MinTimeStepSys = state.dataGlobal->TimeStepZone;
} else {
state.dataConvergeParams->MinTimeStepSys = double(MinInt) / 60.0;
}
state.dataConvergeParams->MaxIter = int(Number(2));
if (state.dataConvergeParams->MaxIter <= 0) {
state.dataConvergeParams->MaxIter = 20;
}
if (!state.dataIPShortCut->lNumericFieldBlanks(3)) state.dataConvergeParams->MinPlantSubIterations = int(Number(3));
if (!state.dataIPShortCut->lNumericFieldBlanks(4)) state.dataConvergeParams->MaxPlantSubIterations = int(Number(4));
// trap bad values
if (state.dataConvergeParams->MinPlantSubIterations < 1) state.dataConvergeParams->MinPlantSubIterations = 1;
if (state.dataConvergeParams->MaxPlantSubIterations < 3) state.dataConvergeParams->MaxPlantSubIterations = 3;
if (state.dataConvergeParams->MinPlantSubIterations > state.dataConvergeParams->MaxPlantSubIterations)
state.dataConvergeParams->MaxPlantSubIterations = state.dataConvergeParams->MinPlantSubIterations + 1;
} else if (Num == 0) {
state.dataConvergeParams->MinTimeStepSys = 1.0 / 60.0;
state.dataConvergeParams->MaxIter = 20;
state.dataConvergeParams->MinPlantSubIterations = 2;
state.dataConvergeParams->MaxPlantSubIterations = 8;
} else {
ShowSevereError(state, "Too many " + CurrentModuleObject + " Objects found.");
ErrorsFound = true;
}
state.dataHVACGlobal->LimitNumSysSteps = int(state.dataGlobal->TimeStepZone / state.dataConvergeParams->MinTimeStepSys);
state.dataReportFlag->DebugOutput = false;
state.dataReportFlag->EvenDuringWarmup = false;
CurrentModuleObject = "Output:DebuggingData";
NumDebugOut = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (NumDebugOut > 1) {
ShowWarningError(state, CurrentModuleObject + ": More than 1 occurrence of this object found, only first will be used.");
}
if (NumDebugOut > 0) {
state.dataInputProcessing->inputProcessor->getObjectItem(state, CurrentModuleObject, 1, Alphas, NumAlpha, Number, NumNumber, IOStat);
if (NumAlpha >= 1) {
state.dataReportFlag->DebugOutput = UtilityRoutines::SameString(Alphas(1), "Yes");
}
if (NumAlpha >= 2) {
state.dataReportFlag->EvenDuringWarmup = UtilityRoutines::SameString(Alphas(2), "Yes");
}
}
{
CurrentModuleObject = "Output:Diagnostics";
Num = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject);
if (Num > 1) {
// Let it slide, but warn