From f6e0e8a909ea7b7c1ce9169f303fa82a0f4094ac Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 11 Jul 2024 21:10:29 -0400 Subject: [PATCH 1/9] Move SetPreConstructionInputParameters setup function to init_state --- src/EnergyPlus/SimulationManager.cc | 4 ++-- src/EnergyPlus/SimulationManager.hh | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/EnergyPlus/SimulationManager.cc b/src/EnergyPlus/SimulationManager.cc index 70ba13d6ddd..45ccad83e7f 100644 --- a/src/EnergyPlus/SimulationManager.cc +++ b/src/EnergyPlus/SimulationManager.cc @@ -102,7 +102,6 @@ extern "C" { #include #include #include -#include #include #include #include @@ -211,10 +210,11 @@ namespace SimulationManager { state.init_state(state); + // these checks report warnings for SimulationControl setup, no actual inputs are read in CheckForMisMatchedEnvironmentSpecifications(state); CheckForRequestedReporting(state); + // set up pre-defined reports, no actual inputs are read in OutputReportPredefined::SetPredefinedTables(state); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early OutputProcessor::SetupTimePointers( state, OutputProcessor::TimeStepType::Zone, state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation diff --git a/src/EnergyPlus/SimulationManager.hh b/src/EnergyPlus/SimulationManager.hh index 86f23c4a5d7..578d27dc2dc 100644 --- a/src/EnergyPlus/SimulationManager.hh +++ b/src/EnergyPlus/SimulationManager.hh @@ -52,6 +52,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -103,6 +104,7 @@ struct SimulationManagerData : BaseGlobalStruct { SimulationManager::OpenOutputFiles(state); SimulationManager::GetProjectData(state); + HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early } void clear_state() override From 758b5e1c96c2152bdf4bf0b12b71503d73bbb0c9 Mon Sep 17 00:00:00 2001 From: rraustad Date: Thu, 15 Aug 2024 14:37:17 -0400 Subject: [PATCH 2/9] Add schedules and curve getInputs to init_state --- src/EnergyPlus/CurveManager.cc | 2 +- src/EnergyPlus/CurveManager.hh | 6 ++- src/EnergyPlus/Data/EnergyPlusData.cc | 6 +-- src/EnergyPlus/ScheduleManager.hh | 4 +- src/EnergyPlus/SimulationManager.cc | 2 - src/EnergyPlus/SimulationManager.hh | 2 + tst/EnergyPlus/unit/DXCoils.unit.cc | 2 +- .../unit/Fixtures/EnergyPlusFixture.cc | 12 +---- .../unit/Fixtures/EnergyPlusFixture.hh | 7 --- tst/EnergyPlus/unit/Furnaces.unit.cc | 2 +- tst/EnergyPlus/unit/MixedAir.unit.cc | 4 +- tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc | 2 +- tst/EnergyPlus/unit/OutputFiles.unit.cc | 2 + tst/EnergyPlus/unit/OutputProcessor.unit.cc | 24 ++-------- tst/EnergyPlus/unit/SimulationManager.unit.cc | 44 ++++++++++++++++--- tst/EnergyPlus/unit/WaterUse.unit.cc | 6 +-- tst/EnergyPlus/unit/WeatherManager.unit.cc | 4 +- 17 files changed, 68 insertions(+), 63 deletions(-) diff --git a/src/EnergyPlus/CurveManager.cc b/src/EnergyPlus/CurveManager.cc index ea358edc77a..b6b71e03008 100644 --- a/src/EnergyPlus/CurveManager.cc +++ b/src/EnergyPlus/CurveManager.cc @@ -61,7 +61,6 @@ // EnergyPlus Headers #include -#include #include #include #include @@ -653,6 +652,7 @@ namespace Curve { // initialize the array int CurveNum = 0; // keep track of the current curve index in the main curve array + state.dataCurveManager->UniqueCurveNames.clear(); // Loop over biquadratic curves and load data CurrentModuleObject = "Curve:Biquadratic"; diff --git a/src/EnergyPlus/CurveManager.hh b/src/EnergyPlus/CurveManager.hh index 79e20bdbfde..e851e6bd201 100644 --- a/src/EnergyPlus/CurveManager.hh +++ b/src/EnergyPlus/CurveManager.hh @@ -65,6 +65,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -469,8 +470,11 @@ struct CurveManagerData : BaseGlobalStruct this->PerfCurve.push_back(new EnergyPlus::Curve::Curve); } - void init_state([[maybe_unused]] EnergyPlusData &state) override + void init_state(EnergyPlusData &state) override { + Curve::GetCurveInput(state); + Curve::GetPressureSystemInput(state); + state.dataCurveManager->GetCurvesInputFlag = false; } void clear_state() override diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index db7eed811b0..770bcc2e25a 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -577,9 +577,11 @@ void EnergyPlusData::init_state(EnergyPlusData &state) // do this in "topological" order meaning the first to go are the // objects that do not reference any other objects, like fluids, // schedules, curves, etc. - this->dataSimulationManager->init_state(state); // GetProjectData + this->dataSimulationManager->init_state(state); // OpenOutputFiles, GetProjectData, SetPreConstructionInputParameters this->dataFluidProps->init_state(state); // GetFluidPropertiesData this->dataPsychrometrics->init_state(state); // InitializePsychRoutines + this->dataScheduleMgr->init_state(state); // ProcessScheduleInput - requires NumOfTimeStepInHour and AnyEnergyManagementSystemInModel + this->dataCurveManager->init_state(state); // GetCurveInput, GetPressureSystemInput this->dataAirLoop->init_state(state); this->dataAirLoopHVACDOAS->init_state(state); @@ -614,7 +616,6 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataCoolTower->init_state(state); this->dataCostEstimateManager->init_state(state); this->dataCrossVentMgr->init_state(state); - this->dataCurveManager->init_state(state); this->dataDXCoils->init_state(state); this->dataDXFEarClipping->init_state(state); this->dataDaylightingDevices->init_state(state); @@ -758,7 +759,6 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataRuntimeLang->init_state(state); this->dataRuntimeLangProcessor->init_state(state); this->dataSQLiteProcedures->init_state(state); - this->dataScheduleMgr->init_state(state); this->dataSetPointManager->init_state(state); this->dataShadowComb->init_state(state); this->dataSimAirServingZones->init_state(state); diff --git a/src/EnergyPlus/ScheduleManager.hh b/src/EnergyPlus/ScheduleManager.hh index 72343930f4a..ee2f70864b8 100644 --- a/src/EnergyPlus/ScheduleManager.hh +++ b/src/EnergyPlus/ScheduleManager.hh @@ -409,8 +409,10 @@ struct ScheduleManagerData : BaseGlobalStruct Array1D WeekSchedule; // Week Schedule Storage Array1D Schedule; // Schedule Storage - void init_state([[maybe_unused]] EnergyPlusData &state) override + void init_state(EnergyPlusData &state) override { + ScheduleManager::ProcessScheduleInput(state); + ScheduleInputProcessed = true; } void clear_state() override diff --git a/src/EnergyPlus/SimulationManager.cc b/src/EnergyPlus/SimulationManager.cc index 45ccad83e7f..0cb81130b6e 100644 --- a/src/EnergyPlus/SimulationManager.cc +++ b/src/EnergyPlus/SimulationManager.cc @@ -87,7 +87,6 @@ extern "C" { #include #include #include -#include #include #include #include @@ -2637,7 +2636,6 @@ namespace SimulationManager { // there is no need to process that data if there are no DOAS used in the simulation state.dataGlobal->AirLoopHVACDOASUsedInSim = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "AirLoopHVAC:DedicatedOutdoorAirSystem") > 0; - EMSManager::CheckIfAnyEMS(state); PlantManager::CheckIfAnyPlant(state); PlantPipingSystemsManager::CheckIfAnySlabs(state); PlantPipingSystemsManager::CheckIfAnyBasements(state); diff --git a/src/EnergyPlus/SimulationManager.hh b/src/EnergyPlus/SimulationManager.hh index 578d27dc2dc..27e085228ee 100644 --- a/src/EnergyPlus/SimulationManager.hh +++ b/src/EnergyPlus/SimulationManager.hh @@ -50,6 +50,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -104,6 +105,7 @@ struct SimulationManagerData : BaseGlobalStruct { SimulationManager::OpenOutputFiles(state); SimulationManager::GetProjectData(state); + EMSManager::CheckIfAnyEMS(state); // required prior to ProcessScheduleInput HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early } diff --git a/tst/EnergyPlus/unit/DXCoils.unit.cc b/tst/EnergyPlus/unit/DXCoils.unit.cc index e2ed52955d4..6cb6912e8e0 100644 --- a/tst/EnergyPlus/unit/DXCoils.unit.cc +++ b/tst/EnergyPlus/unit/DXCoils.unit.cc @@ -4633,7 +4633,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) DX Cooling Coil AHRI 2023 Standard Rating Information, Coil:Cooling:DX:MultiSpeed, ASHP CLG COIL, 31156.1, 3.73, 12.72, 15.17, 15.98, 15.0 )EIO"; replace_pipes_with_spaces(clg_coil_eio_output); - EXPECT_TRUE(compare_eio_stream_substring(clg_coil_eio_output, true)); + EXPECT_TRUE(compare_eio_stream(clg_coil_eio_output, true)); // check multi-speed DX heating coil EXPECT_EQ("ASHP HTG COIL", state->dataDXCoils->DXCoil(2).Name); diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc index 3402f5892fd..b495552a765 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc @@ -183,15 +183,6 @@ bool EnergyPlusFixture::compare_eio_stream(std::string const &expected_string, b return are_equal; } -bool EnergyPlusFixture::compare_eio_stream_substring(std::string const &search_string, bool reset_stream) -{ - auto const stream_str = state->files.eio.get_output(); - bool const found = stream_str.find(search_string) != std::string::npos; - EXPECT_TRUE(found); - if (reset_stream) state->files.eio.open_as_stringstream(); - return found; -} - bool EnergyPlusFixture::compare_mtr_stream(std::string const &expected_string, bool reset_stream) { auto const stream_str = state->files.mtr.get_output(); @@ -359,7 +350,8 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use inputProcessor->initializeMaps(); SimulationManager::PostIPProcessing(*state); - state->init_state(*state); + + FluidProperties::GetFluidPropertiesData(*state); if (state->dataSQLiteProcedures->sqlite) { bool writeOutputToSQLite = false; diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh index 350878d18c7..b3b8497b049 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh @@ -171,13 +171,6 @@ protected: // Will return true if string matches the stream and false if it does not bool compare_eio_stream(std::string const &expected_string, bool reset_stream = true); - // Check if EIO string contains a substring. The default is to reset the EIO stream after every call. - // It is easier to test successive functions if the EIO stream is 'empty' before the next call. - // This calls EXPECT_* within the function as well as returns a boolean so you can call [ASSERT/EXPECT]_[TRUE/FALSE] depending - // if it makes sense for the unit test to continue after returning from function. - // Will return true if string matches the stream and false if it does not - bool compare_eio_stream_substring(std::string const &expected_string, bool reset_stream = true); - // Compare an expected string against the MTR stream. The default is to reset the MTR stream after every call. // It is easier to test successive functions if the MTR stream is 'empty' before the next call. // This calls EXPECT_* within the function as well as returns a boolean so you can call [ASSERT/EXPECT]_[TRUE/FALSE] depending diff --git a/tst/EnergyPlus/unit/Furnaces.unit.cc b/tst/EnergyPlus/unit/Furnaces.unit.cc index c98b7c9e906..5dd6ef90f05 100644 --- a/tst/EnergyPlus/unit/Furnaces.unit.cc +++ b/tst/EnergyPlus/unit/Furnaces.unit.cc @@ -87,7 +87,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) { - state->init_state(*state); + state->init_state(*state); // get FluidProperties int FurnaceNum(1); Real64 OnOffAirFlowRatio; // This is a return value Real64 PartLoadRatio(1.0); diff --git a/tst/EnergyPlus/unit/MixedAir.unit.cc b/tst/EnergyPlus/unit/MixedAir.unit.cc index 34ecef54b8d..369d6cffc33 100644 --- a/tst/EnergyPlus/unit/MixedAir.unit.cc +++ b/tst/EnergyPlus/unit/MixedAir.unit.cc @@ -6563,10 +6563,10 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) " ** ~~~ ** This may be overriding desired ventilation controls. Check inputs for Minimum Outdoor Air Flow Rate, Minimum Outdoor Air " "Schedule Name and Controller:MechanicalVentilation", " ** ~~~ ** Minimum OA fraction = 2.9412E-003, Mech Vent OA fraction = 1.5603E-003", - " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", + " ** ~~~ ** Environment=, at Simulation time= 00:15 - 00:15", }); - EXPECT_TRUE(compare_err_stream_substring(error_string, true)); + EXPECT_TRUE(compare_err_stream(error_string, true)); state->dataAirLoop->AirLoopControlInfo.deallocate(); state->dataSize->OARequirements.deallocate(); diff --git a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc index d49a85525c4..1ebb69685cc 100644 --- a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc +++ b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc @@ -379,7 +379,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) " ** ~~~ ** Air mass balance is required by other outdoor air units: Fan:ZoneExhaust, ZoneMixing, ZoneCrossMixing, or other air flow " "control inputs.", " ** ~~~ ** The outdoor mass flow rate = 0.602 and the exhaust mass flow rate = 0.000.", - " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", + " ** ~~~ ** Environment=, at Simulation time= 00:15 - 00:15", }); EXPECT_TRUE(compare_err_stream(error_string, true)); diff --git a/tst/EnergyPlus/unit/OutputFiles.unit.cc b/tst/EnergyPlus/unit/OutputFiles.unit.cc index e0417086a8d..33f8c23cadc 100644 --- a/tst/EnergyPlus/unit/OutputFiles.unit.cc +++ b/tst/EnergyPlus/unit/OutputFiles.unit.cc @@ -276,6 +276,8 @@ TEST_F(EnergyPlusFixture, OutputControlFiles) " ** ~~~ ** See InputOutputReference document for more details.", " ************* Object=Building=Bldg", " ** ~~~ ** Object=GlobalGeometryRules", + " ** ~~~ ** Object=Timestep", + " ** ~~~ ** Object=Version", }); compare_err_stream(expected_error); diff --git a/tst/EnergyPlus/unit/OutputProcessor.unit.cc b/tst/EnergyPlus/unit/OutputProcessor.unit.cc index 44ae8837d37..1411183733c 100644 --- a/tst/EnergyPlus/unit/OutputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/OutputProcessor.unit.cc @@ -2990,8 +2990,7 @@ namespace OutputProcessor { auto reportExtendedDataResults = queryResult("SELECT * FROM ReportExtendedData;", "ReportExtendedData"); compare_eso_stream( - delimited_string({"Program Version,", - "1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", + delimited_string({"1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "2,11,Boiler2,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "3,11,Boiler3,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n")); @@ -3022,8 +3021,7 @@ namespace OutputProcessor { auto reportExtendedDataResults = queryResult("SELECT * FROM ReportExtendedData;", "ReportExtendedData"); compare_eso_stream( - delimited_string({"Program Version,", - "1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", + delimited_string({"1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "2,11,Boiler3,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n")); } @@ -3054,8 +3052,7 @@ namespace OutputProcessor { auto reportExtendedDataResults = queryResult("SELECT * FROM ReportExtendedData;", "ReportExtendedData"); compare_eso_stream( - delimited_string({"Program Version,", - "1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", + delimited_string({"1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "2,11,Boiler2,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "3,11,Boiler3,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n")); @@ -3123,7 +3120,6 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { - "Program Version,", "1,1,Zn003:Wall001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "2,1,Zn003:Wall002,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "3,1,Zn003:Wall002:Win001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", @@ -3196,7 +3192,6 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { - "Program Version,", "1,1,ZN003:WALL001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "2,1,ZN003:WALL002,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "3,1,ZN003:WALL002:WIN001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", @@ -3294,8 +3289,7 @@ namespace OutputProcessor { UpdateMeterReporting(*state); compare_mtr_stream( - delimited_string({"Program Version,", - "53,9,InteriorLights:Electricity:Zone:SPACE1 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", + delimited_string({"53,9,InteriorLights:Electricity:Zone:SPACE1 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", "102,9,InteriorLights:Electricity:Zone:SPACE2 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", "139,9,InteriorLights:Electricity:Zone:SPACE3 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", "176,9,InteriorLights:Electricity:Zone:SPACE4 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", @@ -3746,7 +3740,6 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; state->dataEnvrn->Month = 12; @@ -3965,7 +3958,6 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { - "Program Version,", "1,1,Environment,Site Outdoor Air Drybulb Temperature [C] !TimeStep", "2,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Hourly", "3,7,Environment,Site Outdoor Air Drybulb Temperature [C] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -3996,7 +3988,6 @@ namespace OutputProcessor { compare_mtr_stream(delimited_string( { - "Program Version,", "7,1,Electricity:Facility [J] !TimeStep", "8,1,Electricity:Facility [J] !Hourly", "9,7,Electricity:Facility [J] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -4038,7 +4029,6 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; state->dataEnvrn->Month = 12; @@ -4265,7 +4255,6 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { - "Program Version,", "1,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Each Call", "2,1,Environment,Site Outdoor Air Drybulb Temperature [C] !TimeStep", "3,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Hourly", @@ -4300,7 +4289,6 @@ namespace OutputProcessor { compare_mtr_stream(delimited_string( { - "Program Version,", "8,1,Electricity:Facility [J] !Each Call", "9,1,Electricity:Facility [J] !Hourly", "10,7,Electricity:Facility [J] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -4544,7 +4532,6 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { - "Program Version,", "1,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Each Call", "2,1,Environment,Site Outdoor Air Drybulb Temperature [C] !TimeStep", "3,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Hourly", @@ -4566,7 +4553,6 @@ namespace OutputProcessor { compare_mtr_stream(delimited_string( { - "Program Version,", "8,1,Electricity:Facility [J] !Each Call", "9,1,Electricity:Facility [J] !Hourly", "10,7,Electricity:Facility [J] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -4585,7 +4571,6 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; state->dataEnvrn->Month = 12; @@ -4643,7 +4628,6 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { - "Program Version,", "2,1,Electricity:Facility [J] !TimeStep", ",365,12,31, 0,24,50.00,60.00,Tuesday", "2,0.0", diff --git a/tst/EnergyPlus/unit/SimulationManager.unit.cc b/tst/EnergyPlus/unit/SimulationManager.unit.cc index 954b4afae02..67d2357667c 100644 --- a/tst/EnergyPlus/unit/SimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/SimulationManager.unit.cc @@ -112,6 +112,8 @@ TEST_F(EnergyPlusFixture, Test_PerformancePrecisionTradeoffs_DirectSolution_Mess EXPECT_TRUE(process_idf(idf_objects, false)); + SimulationManager::GetProjectData(*state); + std::string const error_string = delimited_string({ " ** Warning ** PerformancePrecisionTradeoffs: Coil Direct Solution simulation is selected.", }); @@ -170,6 +172,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); @@ -184,9 +187,9 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) " ; !- Report During Warmup", }); - state->init_state_called = false; EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); EXPECT_TRUE(state->dataReportFlag->DebugOutput); EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); @@ -201,9 +204,9 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) " Yes; !- Report During Warmup", }); - state->init_state_called = false; EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); @@ -223,21 +226,26 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) " No; !- Report During Warmup", }); - state->init_state_called = false; - compare_err_stream_substring("", true); // Input processor with throw a severe, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); // Instead do it here, making sure to reset the stream { std::string const expectedError = delimited_string({ " ** Severe ** [Output:DebuggingData] - Object should have no more than 1 properties.", - " ** Warning ** Output:DebuggingData: More than 1 occurrence of this object found, only first will be used.", }); EXPECT_TRUE(compare_err_stream(expectedError, true)); } + SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); + + { + std::string const expectedError = delimited_string({ + " ** Warning ** Output:DebuggingData: More than 1 occurrence of this object found, only first will be used.", + }); + EXPECT_TRUE(compare_err_stream(expectedError, true)); + } } } @@ -249,6 +257,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_DefaultState) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); @@ -283,6 +293,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_SimpleCase) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); + EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); EXPECT_TRUE(state->dataGlobal->DisplayUnusedObjects); @@ -321,6 +333,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_AllKeys) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); + EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); EXPECT_TRUE(state->dataGlobal->DisplayUnusedObjects); @@ -348,17 +362,16 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) " DisplayAllWarnings; !- Key 1", }); - compare_err_stream_substring("", true); // Input processor will throw a severe, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); // Instead do it here, making sure to reset the stream { std::string const expectedError = delimited_string({ " ** Severe ** [Output:Diagnostics] - Object should have no more than 1 properties.", - " ** Warning ** Output:Diagnostics: More than 1 occurrence of this object found, only first will be used.", }); EXPECT_TRUE(compare_err_stream(expectedError, true)); } + SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); @@ -372,6 +385,13 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); EXPECT_FALSE(state->dataSysVars->ReportDuringHVACSizingSimulation); + + { + std::string const expectedError = delimited_string({ + " ** Warning ** Output:Diagnostics: More than 1 occurrence of this object found, only first will be used.", + }); + EXPECT_TRUE(compare_err_stream(expectedError, true)); + } } TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) @@ -401,6 +421,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) }); EXPECT_TRUE(compare_err_stream(expected_warning, true)); + SimulationManager::GetProjectData(*state); + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); @@ -436,6 +458,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_HasEmpty) EXPECT_TRUE(process_idf(idf_objects)); + ASSERT_NO_THROW(SimulationManager::GetProjectData(*state)); + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); @@ -472,6 +496,8 @@ TEST_F(EnergyPlusFixture, SimulationManager_HVACSizingSimulationChoiceTest) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); + EXPECT_TRUE(state->dataGlobal->DoHVACSizingSimulation); // get a default value EXPECT_EQ(state->dataGlobal->HVACSizingSimMaxIterations, 1); @@ -493,6 +519,8 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_ZeroSimulation) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); + ASSERT_THROW(SimulationManager::CheckForMisMatchedEnvironmentSpecifications(*state), std::runtime_error); // no error message from PerformancePrecisionTradeoffs objects // @@ -523,6 +551,8 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_PureLoadCalc) EXPECT_TRUE(process_idf(idf_objects)); + SimulationManager::GetProjectData(*state); + EXPECT_NO_THROW(SimulationManager::CheckForMisMatchedEnvironmentSpecifications(*state)); // no error message from PerformancePrecisionTradeoffs objects // diff --git a/tst/EnergyPlus/unit/WaterUse.unit.cc b/tst/EnergyPlus/unit/WaterUse.unit.cc index 61cc656bb85..21eddfb8abe 100644 --- a/tst/EnergyPlus/unit/WaterUse.unit.cc +++ b/tst/EnergyPlus/unit/WaterUse.unit.cc @@ -451,7 +451,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) std::string const error_string1 = delimited_string({ " ** Warning ** CalcEquipmentFlowRates: \"CORE_ZN WATER EQUIPMENT\" - Hot water temperature is less than the cold water temperature by " "(5.00 C)", - " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", + " ** ~~~ ** Environment=, at Simulation time= 00:15 - 00:15", " ** ~~~ ** ...hot water temperature = 10.00 C", " ** ~~~ ** ...cold water temperature = 15.00 C", " ** ~~~ ** ...Hot water temperature should be greater than or equal to the cold water temperature. Verify temperature setpoints and " @@ -478,7 +478,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) std::string const error_string2 = delimited_string({ " ** Warning ** CalcEquipmentFlowRates: \"CORE_ZN WATER EQUIPMENT\" - Target water temperature is greater than the hot water temperature " "by (6.70 C)", - " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", + " ** ~~~ ** Environment=, at Simulation time= 00:15 - 00:15", " ** ~~~ ** ...target water temperature = 50.00 C", " ** ~~~ ** ...hot water temperature = 43.30 C", " ** ~~~ ** ...Target water temperature should be less than or equal to the hot water temperature. Verify temperature setpoints and " @@ -496,7 +496,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) std::string const error_string3 = delimited_string({ " ** Warning ** CalcEquipmentFlowRates: \"CORE_ZN WATER EQUIPMENT\" - Target water temperature is less than the cold water temperature " "by (15.00 C)", - " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", + " ** ~~~ ** Environment=, at Simulation time= 00:15 - 00:15", " ** ~~~ ** ...target water temperature = 0.00 C", " ** ~~~ ** ...cold water temperature = 15.00 C", " ** ~~~ ** ...Target water temperature should be greater than or equal to the cold water temperature. Verify temperature setpoints " diff --git a/tst/EnergyPlus/unit/WeatherManager.unit.cc b/tst/EnergyPlus/unit/WeatherManager.unit.cc index bbdcd682397..d37191aadbd 100644 --- a/tst/EnergyPlus/unit/WeatherManager.unit.cc +++ b/tst/EnergyPlus/unit/WeatherManager.unit.cc @@ -597,7 +597,7 @@ TEST_F(EnergyPlusFixture, WaterMainsOutputReports_CorrelationFromWeatherFileTest }); ASSERT_TRUE(process_idf(idf_objects)); - compare_eio_stream_substring("", true); + bool foundErrors(false); Weather::GetWaterMainsTemperatures(*state, foundErrors); EXPECT_FALSE(foundErrors); // expect no errors @@ -688,7 +688,6 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) bool ErrorsFound(false); state->dataEnvrn->TotDesDays = 2; - state->dataGlobal->NumOfTimeStepInHour = 0; // setup environment state state->dataWeather->Environment.allocate(state->dataEnvrn->TotDesDays); state->dataWeather->DesignDay.allocate(state->dataEnvrn->TotDesDays); @@ -1145,7 +1144,6 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherCalculateMissingIRHoriz) bool ErrorsFound(false); state->dataEnvrn->TotDesDays = 2; - state->dataGlobal->NumOfTimeStepInHour = 0; // setup environment state state->dataWeather->Environment.allocate(state->dataEnvrn->TotDesDays); From 5aefd65c08d2ce2542a8563577b42fdd4d7267f4 Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Thu, 15 Aug 2024 23:08:16 -0400 Subject: [PATCH 3/9] Repair error summary report and protect GetCurveInputData --- src/EnergyPlus/CurveManager.cc | 3 ++- src/EnergyPlus/Data/EnergyPlusData.cc | 4 ++++ src/EnergyPlus/DataErrorTracking.hh | 2 ++ src/EnergyPlus/DataGlobals.hh | 1 + src/EnergyPlus/UtilityRoutines.cc | 8 ++++++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/EnergyPlus/CurveManager.cc b/src/EnergyPlus/CurveManager.cc index 04545d4d9b3..2833ff6a9fd 100644 --- a/src/EnergyPlus/CurveManager.cc +++ b/src/EnergyPlus/CurveManager.cc @@ -571,7 +571,6 @@ namespace Curve { bool GetInputErrorsFound = false; GetCurveInputData(state, GetInputErrorsFound); - state.dataCurveManager->GetCurvesInputFlag = false; if (GetInputErrorsFound) { ShowFatalError(state, "GetCurveInput: Errors found in getting Curve Objects. Preceding condition(s) cause termination."); @@ -610,6 +609,8 @@ namespace Curve { int IOStatus; // Used in GetObjectItem std::string CurrentModuleObject; // for ease in renaming. + if (!state.dataCurveManager->GetCurvesInputFlag) return; + state.dataCurveManager->GetCurvesInputFlag = false; // Find the number of each type of curve (note: Current Module object not used here, must rename manually) int const NumBiQuad = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Curve:Biquadratic"); diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index 0ff1ec8f56c..33ed460ac92 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -572,6 +572,8 @@ void EnergyPlusData::clear_state() void EnergyPlusData::init_state(EnergyPlusData &state) { if (this->init_state_called) return; + + state.dataGlobal->InputsFlag = true; this->init_state_called = true; // The order in which we do this matters. We're going to try to // do this in "topological" order meaning the first to go are the @@ -826,6 +828,8 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataZoneEquipmentManager->init_state(state); this->dataZonePlenum->init_state(state); this->dataZoneTempPredictorCorrector->init_state(state); + + state.dataGlobal->InputsFlag = false; } } // namespace EnergyPlus diff --git a/src/EnergyPlus/DataErrorTracking.hh b/src/EnergyPlus/DataErrorTracking.hh index d88f17840da..04faed0aea4 100644 --- a/src/EnergyPlus/DataErrorTracking.hh +++ b/src/EnergyPlus/DataErrorTracking.hh @@ -210,6 +210,8 @@ struct ErrorTrackingData : BaseGlobalStruct int NumRecurringErrors = 0; // Number of stored recurring error messages int TotalSevereErrors = 0; // Counter int TotalWarningErrors = 0; // Counter + int TotalSevereErrorsDuringInputs = 0; // Counter + int TotalWarningErrorsDuringInputs = 0; // Counter int TotalSevereErrorsDuringWarmup = 0; // Counter int TotalWarningErrorsDuringWarmup = 0; // Counter int TotalSevereErrorsDuringSizing = 0; // Counter diff --git a/src/EnergyPlus/DataGlobals.hh b/src/EnergyPlus/DataGlobals.hh index fb4d70283fd..fb59a7686bd 100644 --- a/src/EnergyPlus/DataGlobals.hh +++ b/src/EnergyPlus/DataGlobals.hh @@ -111,6 +111,7 @@ struct DataGlobal : BaseGlobalStruct int numSpaceTypes = 0; // Number of unique space types int TimeStep = 0; // Counter for time steps (fractional hours) Real64 TimeStepZone = 0.0; // Zone time step in fractional hours + bool InputsFlag = false; // True during the init_state portion of a simulation bool WarmupFlag = false; // True during the warmup portion of a simulation Int64 StdOutputRecordCount = 0; // Count of Standard output records Int64 StdMeterRecordCount = 0; // Count of Meter output records diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index 3f0ecaef058..3ac69e35b60 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -548,8 +548,10 @@ int AbortEnergyPlus(EnergyPlusData &state) CloseMiscOpenFiles(state); NumWarnings = fmt::to_string(state.dataErrTracking->TotalWarningErrors); NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors); - NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup); - NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); + NumWarningsDuringWarmup = + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputs); + NumSevereDuringWarmup = + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputs); NumWarningsDuringSizing = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing); NumSevereDuringSizing = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing); @@ -928,6 +930,7 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt } ++state.dataErrTracking->TotalSevereErrors; + if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalSevereErrorsDuringInputs; if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataErrTracking->AbortProcessing) ++state.dataErrTracking->TotalSevereErrorsDuringWarmup; @@ -1129,6 +1132,7 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op } ++state.dataErrTracking->TotalWarningErrors; + if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalWarningErrorsDuringInputs; if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataErrTracking->AbortProcessing) ++state.dataErrTracking->TotalWarningErrorsDuringWarmup; From 339fe3b40535621f53a5c1d5bacdfda6b752970b Mon Sep 17 00:00:00 2001 From: Richard Raustad Date: Fri, 16 Aug 2024 00:56:33 -0400 Subject: [PATCH 4/9] Revise and update another function --- src/EnergyPlus/UtilityRoutines.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index 3ac69e35b60..35c3fc21128 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -548,12 +548,12 @@ int AbortEnergyPlus(EnergyPlusData &state) CloseMiscOpenFiles(state); NumWarnings = fmt::to_string(state.dataErrTracking->TotalWarningErrors); NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors); - NumWarningsDuringWarmup = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputs); - NumSevereDuringWarmup = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputs); - NumWarningsDuringSizing = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing); - NumSevereDuringSizing = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing); + NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup); + NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); + NumWarningsDuringSizing = + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputs); + NumSevereDuringSizing = + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputs); // catch up with timings if in middle state.dataSysVars->runtimeTimer.tock(); @@ -682,9 +682,11 @@ int EndEnergyPlus(EnergyPlusData &state) strip(NumWarningsDuringWarmup); NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); strip(NumSevereDuringWarmup); - NumWarningsDuringSizing = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing); + NumWarningsDuringSizing = + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputs); strip(NumWarningsDuringSizing); - NumSevereDuringSizing = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing); + NumSevereDuringSizing = + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputs); strip(NumSevereDuringSizing); state.dataSysVars->runtimeTimer.tock(); From f7ba56c7677634de9507e28bbb72ba0daa4546e8 Mon Sep 17 00:00:00 2001 From: rraustad Date: Fri, 16 Aug 2024 11:56:21 -0400 Subject: [PATCH 5/9] Revise to get warning summary to line up and correct unit tests FPE --- src/EnergyPlus/DataErrorTracking.hh | 44 ++++++++++--------- src/EnergyPlus/UtilityRoutines.cc | 39 +++++++++++----- .../unit/AirflowNetworkComponents.unit.cc | 1 + tst/EnergyPlus/unit/Furnaces.unit.cc | 2 +- tst/EnergyPlus/unit/RefrigeratedCase.unit.cc | 2 + 5 files changed, 56 insertions(+), 32 deletions(-) diff --git a/src/EnergyPlus/DataErrorTracking.hh b/src/EnergyPlus/DataErrorTracking.hh index 04faed0aea4..cf93295483d 100644 --- a/src/EnergyPlus/DataErrorTracking.hh +++ b/src/EnergyPlus/DataErrorTracking.hh @@ -206,27 +206,29 @@ struct ErrorTrackingData : BaseGlobalStruct { Array1D RecurringErrors; Array1D_int MatchCounts; - bool AbortProcessing = false; // Flag used to if currently in "abort processing" - int NumRecurringErrors = 0; // Number of stored recurring error messages - int TotalSevereErrors = 0; // Counter - int TotalWarningErrors = 0; // Counter - int TotalSevereErrorsDuringInputs = 0; // Counter - int TotalWarningErrorsDuringInputs = 0; // Counter - int TotalSevereErrorsDuringWarmup = 0; // Counter - int TotalWarningErrorsDuringWarmup = 0; // Counter - int TotalSevereErrorsDuringSizing = 0; // Counter - int TotalWarningErrorsDuringSizing = 0; // Counter - int TotalMultipliedWindows = 0; // Counter - int TotalCoincidentVertices = 0; // Counter - int TotalDegenerateSurfaces = 0; // Counter - int TotalReceivingNonConvexSurfaces = 0; // Counter - int TotalCastingNonConvexSurfaces = 0; // Counter - int TotalRoomAirPatternTooLow = 0; // Counter - int TotalRoomAirPatternTooHigh = 0; // Counter - bool AskForConnectionsReport = false; // Flag used to tell when connections should be reported - bool AskForSurfacesReport = false; // Flag used to tell when surfaces should be reported - bool AskForPlantCheckOnAbort = false; // flag used to tell if plant structure can be checked - bool ExitDuringSimulations = false; // flag used to tell if program is in simulation mode when fatal occurs + bool AbortProcessing = false; // Flag used to if currently in "abort processing" + int NumRecurringErrors = 0; // Number of stored recurring error messages + int TotalSevereErrors = 0; // Counter + int TotalWarningErrors = 0; // Counter + int TotalSevereErrorsDuringInputsSizing = 0; // Counter + int TotalWarningErrorsDuringInputsSizing = 0; // Counter + int TotalSevereErrorsDuringInputsWarmup = 0; // Counter + int TotalWarningErrorsDuringInputsWarmup = 0; // Counter + int TotalSevereErrorsDuringWarmup = 0; // Counter + int TotalWarningErrorsDuringWarmup = 0; // Counter + int TotalSevereErrorsDuringSizing = 0; // Counter + int TotalWarningErrorsDuringSizing = 0; // Counter + int TotalMultipliedWindows = 0; // Counter + int TotalCoincidentVertices = 0; // Counter + int TotalDegenerateSurfaces = 0; // Counter + int TotalReceivingNonConvexSurfaces = 0; // Counter + int TotalCastingNonConvexSurfaces = 0; // Counter + int TotalRoomAirPatternTooLow = 0; // Counter + int TotalRoomAirPatternTooHigh = 0; // Counter + bool AskForConnectionsReport = false; // Flag used to tell when connections should be reported + bool AskForSurfacesReport = false; // Flag used to tell when surfaces should be reported + bool AskForPlantCheckOnAbort = false; // flag used to tell if plant structure can be checked + bool ExitDuringSimulations = false; // flag used to tell if program is in simulation mode when fatal occurs std::string LastSevereError; ErrorTrackingData() diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index 35c3fc21128..c96a8e0b306 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -548,12 +548,14 @@ int AbortEnergyPlus(EnergyPlusData &state) CloseMiscOpenFiles(state); NumWarnings = fmt::to_string(state.dataErrTracking->TotalWarningErrors); NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors); - NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup); - NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); + NumWarningsDuringWarmup = + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup); + NumSevereDuringWarmup = + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputsWarmup); NumWarningsDuringSizing = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputs); + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputsSizing); NumSevereDuringSizing = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputs); + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputsSizing); // catch up with timings if in middle state.dataSysVars->runtimeTimer.tock(); @@ -678,15 +680,17 @@ int EndEnergyPlus(EnergyPlusData &state) strip(NumWarnings); NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors); strip(NumSevere); - NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup); + NumWarningsDuringWarmup = + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup); strip(NumWarningsDuringWarmup); - NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); + NumSevereDuringWarmup = + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputsWarmup); strip(NumSevereDuringWarmup); NumWarningsDuringSizing = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputs); + fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputsSizing); strip(NumWarningsDuringSizing); NumSevereDuringSizing = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputs); + fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputsSizing); strip(NumSevereDuringSizing); state.dataSysVars->runtimeTimer.tock(); @@ -932,7 +936,13 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt } ++state.dataErrTracking->TotalSevereErrors; - if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalSevereErrorsDuringInputs; + if (state.dataGlobal->InputsFlag) { + if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing) { + ++state.dataErrTracking->TotalWarningErrorsDuringInputsSizing; + } else { + ++state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup; + } + } if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataErrTracking->AbortProcessing) ++state.dataErrTracking->TotalSevereErrorsDuringWarmup; @@ -1134,7 +1144,16 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op } ++state.dataErrTracking->TotalWarningErrors; - if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalWarningErrorsDuringInputs; + bool reportWarning = true; + std::size_t found = ErrorMessage.find("Timestep: Requested number"); + if (found != ErrorMessage.npos) reportWarning = false; + if (state.dataGlobal->InputsFlag && reportWarning) { + if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing) { + ++state.dataErrTracking->TotalWarningErrorsDuringInputsSizing; + } else { + ++state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup; + } + } if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataErrTracking->AbortProcessing) ++state.dataErrTracking->TotalWarningErrorsDuringWarmup; diff --git a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc index 0e79bbcdf83..fd3ce134759 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc @@ -1864,6 +1864,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_UserDefinedDuctViewFactors) HeatBalanceManager::GetHeatBalanceInput(*state); HeatBalanceManager::AllocateHeatBalArrays(*state); state->dataEnvrn->OutBaroPress = 101000; + state->dataGlobal->TimeStepZone = 0.25; state->dataHVACGlobal->TimeStepSys = state->dataGlobal->TimeStepZone; state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour; diff --git a/tst/EnergyPlus/unit/Furnaces.unit.cc b/tst/EnergyPlus/unit/Furnaces.unit.cc index 5dd6ef90f05..a957e3dc35d 100644 --- a/tst/EnergyPlus/unit/Furnaces.unit.cc +++ b/tst/EnergyPlus/unit/Furnaces.unit.cc @@ -87,7 +87,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) { - state->init_state(*state); // get FluidProperties +// state->init_state(*state); // get FluidProperties int FurnaceNum(1); Real64 OnOffAirFlowRatio; // This is a return value Real64 PartLoadRatio(1.0); diff --git a/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc b/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc index ae91acad1de..18c47e9ed19 100644 --- a/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc +++ b/tst/EnergyPlus/unit/RefrigeratedCase.unit.cc @@ -387,6 +387,7 @@ Schedule:Compact, state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataEnvrn->OutBaroPress = 101325.0; + state->dataGlobal->TimeStepZone = 0.25; bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -738,6 +739,7 @@ Schedule:Compact, state->dataZoneEquip->ZoneEquipInputsFilled = true; state->dataEnvrn->OutBaroPress = 101325.0; + state->dataGlobal->TimeStepZone = 0.25; bool ErrorsFound = false; HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); From 85a2ef230c29f96ef827210e6ddc89b3585f123f Mon Sep 17 00:00:00 2001 From: rraustad Date: Mon, 19 Aug 2024 08:32:03 -0400 Subject: [PATCH 6/9] Curves used, input warnings, ResultsFramework --- src/EnergyPlus/CurveManager.cc | 28 ++++++++- src/EnergyPlus/CurveManager.hh | 15 ++++- src/EnergyPlus/DataErrorTracking.hh | 44 +++++++------ .../InputProcessing/InputProcessor.cc | 3 +- .../InputProcessing/InputProcessor.hh | 4 +- src/EnergyPlus/ResultsFramework.cc | 7 +++ src/EnergyPlus/ResultsFramework.hh | 4 +- src/EnergyPlus/UtilityRoutines.cc | 62 +++++++++---------- 8 files changed, 105 insertions(+), 62 deletions(-) diff --git a/src/EnergyPlus/CurveManager.cc b/src/EnergyPlus/CurveManager.cc index 0728a608875..3975acab8d8 100644 --- a/src/EnergyPlus/CurveManager.cc +++ b/src/EnergyPlus/CurveManager.cc @@ -68,7 +68,6 @@ #include #include #include -#include #include #include @@ -676,6 +675,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -759,6 +759,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -825,6 +826,7 @@ namespace Curve { _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; GlobalNames::VerifyUniqueInterObjectName(state, state.dataCurveManager->UniqueCurveNames, @@ -895,6 +897,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -959,6 +962,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1023,6 +1027,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1104,6 +1109,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1185,6 +1191,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1249,6 +1256,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1330,6 +1338,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1452,6 +1461,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1531,6 +1541,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1611,6 +1622,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1664,6 +1676,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1732,6 +1745,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1798,6 +1812,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1864,6 +1879,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1930,6 +1946,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -1996,6 +2013,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -2062,6 +2080,7 @@ namespace Curve { CurrentModuleObject, state.dataIPShortCut->cAlphaFieldNames(1), ErrorsFound); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; Curve *thisCurve = state.dataCurveManager->PerfCurve(CurveNum); @@ -2122,6 +2141,7 @@ namespace Curve { state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); std::string wpcName = Alphas(1); // Name of CP array int numWindDir = NumNumbers; std::vector windDirs(numWindDir); @@ -2172,6 +2192,7 @@ namespace Curve { _, state.dataIPShortCut->cAlphaFieldNames, state.dataIPShortCut->cNumericFieldNames); + state.dataInputProcessing->inputProcessor->unusedInputs.emplace(CurrentModuleObject, Alphas(1)); ++CurveNum; GlobalNames::VerifyUniqueInterObjectName(state, state.dataCurveManager->UniqueCurveNames, @@ -3072,7 +3093,10 @@ namespace Curve { if (state.dataCurveManager->NumCurves > 0) { for (int Count = 1; Count <= (int)state.dataCurveManager->PerfCurve.size(); ++Count) { - if (CurveName == state.dataCurveManager->PerfCurve(Count)->Name) return Count; + if (CurveName == state.dataCurveManager->PerfCurve(Count)->Name) { + state.dataCurveManager->PerfCurve(Count)->markUsed(state); + return Count; + } } return 0; // Not found } else { diff --git a/src/EnergyPlus/CurveManager.hh b/src/EnergyPlus/CurveManager.hh index e851e6bd201..41accbeb72d 100644 --- a/src/EnergyPlus/CurveManager.hh +++ b/src/EnergyPlus/CurveManager.hh @@ -72,6 +72,7 @@ #include #include #include +#include #include namespace EnergyPlus { @@ -151,7 +152,8 @@ namespace Curve { struct Curve { // Basic data - std::string Name; // Curve Name + std::string Name; // Curve Name + bool used = true; CurveType curveType = CurveType::Invalid; // Curve type (see parameter definitions above) // Table data stuff InterpType interpolationType = InterpType::Invalid; // Table interpolation method @@ -208,6 +210,17 @@ namespace Curve { const Real64 Var4, // 4th independent variable const Real64 Var5, // 5th independent variable const Real64 Var6); + + void markUsed(EnergyPlusData &state) + { + if (!this->used) return; + auto const find_unused = + state.dataInputProcessing->inputProcessor->unusedInputs.find({std::string(objectNames[int(this->curveType)]), this->Name}); + if (find_unused != state.dataInputProcessing->inputProcessor->unusedInputs.end()) { + state.dataInputProcessing->inputProcessor->unusedInputs.erase(find_unused); + } + this->used = false; + }; }; // Table file objects diff --git a/src/EnergyPlus/DataErrorTracking.hh b/src/EnergyPlus/DataErrorTracking.hh index cf93295483d..04faed0aea4 100644 --- a/src/EnergyPlus/DataErrorTracking.hh +++ b/src/EnergyPlus/DataErrorTracking.hh @@ -206,29 +206,27 @@ struct ErrorTrackingData : BaseGlobalStruct { Array1D RecurringErrors; Array1D_int MatchCounts; - bool AbortProcessing = false; // Flag used to if currently in "abort processing" - int NumRecurringErrors = 0; // Number of stored recurring error messages - int TotalSevereErrors = 0; // Counter - int TotalWarningErrors = 0; // Counter - int TotalSevereErrorsDuringInputsSizing = 0; // Counter - int TotalWarningErrorsDuringInputsSizing = 0; // Counter - int TotalSevereErrorsDuringInputsWarmup = 0; // Counter - int TotalWarningErrorsDuringInputsWarmup = 0; // Counter - int TotalSevereErrorsDuringWarmup = 0; // Counter - int TotalWarningErrorsDuringWarmup = 0; // Counter - int TotalSevereErrorsDuringSizing = 0; // Counter - int TotalWarningErrorsDuringSizing = 0; // Counter - int TotalMultipliedWindows = 0; // Counter - int TotalCoincidentVertices = 0; // Counter - int TotalDegenerateSurfaces = 0; // Counter - int TotalReceivingNonConvexSurfaces = 0; // Counter - int TotalCastingNonConvexSurfaces = 0; // Counter - int TotalRoomAirPatternTooLow = 0; // Counter - int TotalRoomAirPatternTooHigh = 0; // Counter - bool AskForConnectionsReport = false; // Flag used to tell when connections should be reported - bool AskForSurfacesReport = false; // Flag used to tell when surfaces should be reported - bool AskForPlantCheckOnAbort = false; // flag used to tell if plant structure can be checked - bool ExitDuringSimulations = false; // flag used to tell if program is in simulation mode when fatal occurs + bool AbortProcessing = false; // Flag used to if currently in "abort processing" + int NumRecurringErrors = 0; // Number of stored recurring error messages + int TotalSevereErrors = 0; // Counter + int TotalWarningErrors = 0; // Counter + int TotalSevereErrorsDuringInputs = 0; // Counter + int TotalWarningErrorsDuringInputs = 0; // Counter + int TotalSevereErrorsDuringWarmup = 0; // Counter + int TotalWarningErrorsDuringWarmup = 0; // Counter + int TotalSevereErrorsDuringSizing = 0; // Counter + int TotalWarningErrorsDuringSizing = 0; // Counter + int TotalMultipliedWindows = 0; // Counter + int TotalCoincidentVertices = 0; // Counter + int TotalDegenerateSurfaces = 0; // Counter + int TotalReceivingNonConvexSurfaces = 0; // Counter + int TotalCastingNonConvexSurfaces = 0; // Counter + int TotalRoomAirPatternTooLow = 0; // Counter + int TotalRoomAirPatternTooHigh = 0; // Counter + bool AskForConnectionsReport = false; // Flag used to tell when connections should be reported + bool AskForSurfacesReport = false; // Flag used to tell when surfaces should be reported + bool AskForPlantCheckOnAbort = false; // flag used to tell if plant structure can be checked + bool ExitDuringSimulations = false; // flag used to tell if program is in simulation mode when fatal occurs std::string LastSevereError; ErrorTrackingData() diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.cc b/src/EnergyPlus/InputProcessing/InputProcessor.cc index cbbc4776a7c..ab33b5af6a4 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.cc +++ b/src/EnergyPlus/InputProcessing/InputProcessor.cc @@ -340,7 +340,8 @@ bool InputProcessor::checkVersionMatch(EnergyPlusData &state) Which = static_cast(index(v, MatchVersion)); } if (Which != 0) { - ShowWarningError(state, "Version: in IDF=\"" + v + "\" not the same as expected=\"" + MatchVersion + "\""); + // this is reported in GetProjectData + // ShowWarningError(state, "Version: in IDF=\"" + v + "\" not the same as expected=\"" + MatchVersion + "\""); return false; } } diff --git a/src/EnergyPlus/InputProcessing/InputProcessor.hh b/src/EnergyPlus/InputProcessing/InputProcessor.hh index 3e63b53e4b3..081812f4038 100644 --- a/src/EnergyPlus/InputProcessing/InputProcessor.hh +++ b/src/EnergyPlus/InputProcessing/InputProcessor.hh @@ -313,9 +313,11 @@ private: UnorderedObjectCacheMap objectCacheMap; // ObjectType to vector of ObjectName - UnusedObjectSet unusedInputs; char s[129] = {0}; +public: + UnusedObjectSet unusedInputs; + }; // InputProcessor struct DataInputProcessing : BaseGlobalStruct diff --git a/src/EnergyPlus/ResultsFramework.cc b/src/EnergyPlus/ResultsFramework.cc index 0649abad7e9..8bd9a18f802 100644 --- a/src/EnergyPlus/ResultsFramework.cc +++ b/src/EnergyPlus/ResultsFramework.cc @@ -123,6 +123,12 @@ namespace ResultsFramework { RunTime = elapsedTime; } + void SimInfo::setNumErrorsInputs(const std::string &numWarningsDuringInputs, const std::string &numSevereDuringInputs) + { + NumWarningsDuringInputs = numWarningsDuringInputs; + NumSevereDuringInputs = numSevereDuringInputs; + } + void SimInfo::setNumErrorsWarmup(const std::string &numWarningsDuringWarmup, const std::string &numSevereDuringWarmup) { NumWarningsDuringWarmup = numWarningsDuringWarmup; @@ -149,6 +155,7 @@ namespace ResultsFramework { {"StartDateTimeStamp", StartDateTimeStamp}, {"RunTime", RunTime}, {"ErrorSummary", {{"NumWarnings", NumWarnings}, {"NumSevere", NumSevere}}}, + {"ErrorSummaryInputs", {{"NumWarnings", NumWarningsDuringInputs}, {"NumSevere", NumSevereDuringInputs}}}, {"ErrorSummaryWarmup", {{"NumWarnings", NumWarningsDuringWarmup}, {"NumSevere", NumSevereDuringWarmup}}}, {"ErrorSummarySizing", {{"NumWarnings", NumWarningsDuringSizing}, {"NumSevere", NumSevereDuringSizing}}}}; return root; diff --git a/src/EnergyPlus/ResultsFramework.hh b/src/EnergyPlus/ResultsFramework.hh index d8af9cc1c8d..b5c495ea6f2 100644 --- a/src/EnergyPlus/ResultsFramework.hh +++ b/src/EnergyPlus/ResultsFramework.hh @@ -97,6 +97,7 @@ namespace ResultsFramework { void setInputModelURI(const std::string &inputModelURI); void setStartDateTimeStamp(const std::string &startDateTimeStamp); void setRunTime(const std::string &elapsedTime); + void setNumErrorsInputs(const std::string &numWarningsDuringInputs, const std::string &numSevereDuringInputs); void setNumErrorsWarmup(const std::string &numWarningsDuringWarmup, const std::string &numSevereDuringWarmup); void setNumErrorsSizing(const std::string &numWarningsDuringSizing, const std::string &numSevereDuringSizing); void setNumErrorsSummary(const std::string &numWarnings, const std::string &numSevere); @@ -108,7 +109,8 @@ namespace ResultsFramework { std::string InputModelURI; std::string StartDateTimeStamp; std::string RunTime; - std::string NumWarningsDuringWarmup, NumSevereDuringWarmup, NumWarningsDuringSizing, NumSevereDuringSizing, NumWarnings, NumSevere; + std::string NumWarningsDuringInputs, NumSevereDuringInputs, NumWarningsDuringWarmup, NumSevereDuringWarmup, NumWarningsDuringSizing, + NumSevereDuringSizing, NumWarnings, NumSevere; }; class Variable : public BaseResultObject diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index c96a8e0b306..a64f5857d10 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -493,6 +493,8 @@ int AbortEnergyPlus(EnergyPlusData &state) std::string NumWarnings; std::string NumSevere; + std::string NumWarningsDuringInputs; + std::string NumSevereDuringInputs; std::string NumWarningsDuringWarmup; std::string NumSevereDuringWarmup; std::string NumWarningsDuringSizing; @@ -548,24 +550,26 @@ int AbortEnergyPlus(EnergyPlusData &state) CloseMiscOpenFiles(state); NumWarnings = fmt::to_string(state.dataErrTracking->TotalWarningErrors); NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors); - NumWarningsDuringWarmup = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup); - NumSevereDuringWarmup = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputsWarmup); - NumWarningsDuringSizing = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputsSizing); - NumSevereDuringSizing = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputsSizing); + NumWarningsDuringInputs = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringInputs); + NumSevereDuringInputs = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringInputs); + NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup); + NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); + NumWarningsDuringSizing = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing); + NumSevereDuringSizing = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing); // catch up with timings if in middle state.dataSysVars->runtimeTimer.tock(); const std::string Elapsed = state.dataSysVars->runtimeTimer.formatAsHourMinSecs(); state.dataResultsFramework->resultsFramework->SimulationInformation.setRunTime(Elapsed); + state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsInputs(NumWarningsDuringInputs, NumSevereDuringInputs); state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsWarmup(NumWarningsDuringWarmup, NumSevereDuringWarmup); state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSizing(NumWarningsDuringSizing, NumSevereDuringSizing); state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSummary(NumWarnings, NumSevere); + ShowMessage( + state, + format("EnergyPlus Inputs Error Summary. During Inputs: {} Warning; {} Severe Errors.", NumWarningsDuringInputs, NumSevereDuringInputs)); ShowMessage( state, format("EnergyPlus Warmup Error Summary. During Warmup: {} Warning; {} Severe Errors.", NumWarningsDuringWarmup, NumSevereDuringWarmup)); @@ -660,6 +664,8 @@ int EndEnergyPlus(EnergyPlusData &state) std::string NumWarnings; std::string NumSevere; + std::string NumWarningsDuringInputs; + std::string NumSevereDuringInputs; std::string NumWarningsDuringWarmup; std::string NumSevereDuringWarmup; std::string NumWarningsDuringSizing; @@ -680,17 +686,17 @@ int EndEnergyPlus(EnergyPlusData &state) strip(NumWarnings); NumSevere = fmt::to_string(state.dataErrTracking->TotalSevereErrors); strip(NumSevere); - NumWarningsDuringWarmup = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup + state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup); + NumWarningsDuringInputs = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringInputs); + strip(NumWarningsDuringInputs); + NumSevereDuringInputs = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringInputs); + strip(NumSevereDuringInputs); + NumWarningsDuringWarmup = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringWarmup); strip(NumWarningsDuringWarmup); - NumSevereDuringWarmup = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup + state.dataErrTracking->TotalSevereErrorsDuringInputsWarmup); + NumSevereDuringWarmup = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringWarmup); strip(NumSevereDuringWarmup); - NumWarningsDuringSizing = - fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing + state.dataErrTracking->TotalWarningErrorsDuringInputsSizing); + NumWarningsDuringSizing = fmt::to_string(state.dataErrTracking->TotalWarningErrorsDuringSizing); strip(NumWarningsDuringSizing); - NumSevereDuringSizing = - fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing + state.dataErrTracking->TotalSevereErrorsDuringInputsSizing); + NumSevereDuringSizing = fmt::to_string(state.dataErrTracking->TotalSevereErrorsDuringSizing); strip(NumSevereDuringSizing); state.dataSysVars->runtimeTimer.tock(); @@ -699,6 +705,7 @@ int EndEnergyPlus(EnergyPlusData &state) } const std::string Elapsed = state.dataSysVars->runtimeTimer.formatAsHourMinSecs(); state.dataResultsFramework->resultsFramework->SimulationInformation.setRunTime(Elapsed); + state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsInputs(NumWarningsDuringInputs, NumSevereDuringInputs); state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsWarmup(NumWarningsDuringWarmup, NumSevereDuringWarmup); state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSizing(NumWarningsDuringSizing, NumSevereDuringSizing); state.dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSummary(NumWarnings, NumSevere); @@ -708,6 +715,9 @@ int EndEnergyPlus(EnergyPlusData &state) Util::appendPerfLog(state, "Number of Warnings", NumWarnings); Util::appendPerfLog(state, "Number of Severe", NumSevere, true); // last item so write the perfLog file } + ShowMessage( + state, + format("EnergyPlus Inputs Error Summary. During Inputs: {} Warning; {} Severe Errors.", NumWarningsDuringInputs, NumSevereDuringInputs)); ShowMessage( state, format("EnergyPlus Warmup Error Summary. During Warmup: {} Warning; {} Severe Errors.", NumWarningsDuringWarmup, NumSevereDuringWarmup)); @@ -936,13 +946,7 @@ void ShowSevereError(EnergyPlusData &state, std::string const &ErrorMessage, Opt } ++state.dataErrTracking->TotalSevereErrors; - if (state.dataGlobal->InputsFlag) { - if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing) { - ++state.dataErrTracking->TotalWarningErrorsDuringInputsSizing; - } else { - ++state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup; - } - } + if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalSevereErrorsDuringInputs; if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataErrTracking->AbortProcessing) ++state.dataErrTracking->TotalSevereErrorsDuringWarmup; @@ -1144,16 +1148,8 @@ void ShowWarningError(EnergyPlusData &state, std::string const &ErrorMessage, Op } ++state.dataErrTracking->TotalWarningErrors; - bool reportWarning = true; - std::size_t found = ErrorMessage.find("Timestep: Requested number"); - if (found != ErrorMessage.npos) reportWarning = false; - if (state.dataGlobal->InputsFlag && reportWarning) { - if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing || state.dataGlobal->DoPlantSizing) { - ++state.dataErrTracking->TotalWarningErrorsDuringInputsSizing; - } else { - ++state.dataErrTracking->TotalWarningErrorsDuringInputsWarmup; - } - } + + if (state.dataGlobal->InputsFlag) ++state.dataErrTracking->TotalWarningErrorsDuringInputs; if (state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataErrTracking->AbortProcessing) ++state.dataErrTracking->TotalWarningErrorsDuringWarmup; From de455d711ee892e9248b5e81636063513cea27f0 Mon Sep 17 00:00:00 2001 From: rraustad Date: Mon, 19 Aug 2024 09:53:42 -0400 Subject: [PATCH 7/9] Fix unit tests --- tst/EnergyPlus/unit/Furnaces.unit.cc | 2 +- tst/EnergyPlus/unit/ResultsFramework.unit.cc | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tst/EnergyPlus/unit/Furnaces.unit.cc b/tst/EnergyPlus/unit/Furnaces.unit.cc index a957e3dc35d..5dd6ef90f05 100644 --- a/tst/EnergyPlus/unit/Furnaces.unit.cc +++ b/tst/EnergyPlus/unit/Furnaces.unit.cc @@ -87,7 +87,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) { -// state->init_state(*state); // get FluidProperties + state->init_state(*state); // get FluidProperties int FurnaceNum(1); Real64 OnOffAirFlowRatio; // This is a return value Real64 PartLoadRatio(1.0); diff --git a/tst/EnergyPlus/unit/ResultsFramework.unit.cc b/tst/EnergyPlus/unit/ResultsFramework.unit.cc index 24f871ab160..c7dbf4fd665 100644 --- a/tst/EnergyPlus/unit/ResultsFramework.unit.cc +++ b/tst/EnergyPlus/unit/ResultsFramework.unit.cc @@ -108,6 +108,7 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_SimInfo) state->dataResultsFramework->resultsFramework->SimulationInformation.setInputModelURI(""); state->dataResultsFramework->resultsFramework->SimulationInformation.setRunTime("00hr 08min 6.67sec"); state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSummary("1", "2"); + state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsInputs("0", "0"); state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSizing("0", "0"); state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsWarmup("0", "2"); state->dataResultsFramework->resultsFramework->SimulationInformation.setSimulationEnvironment(""); @@ -118,6 +119,10 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_SimInfo) "NumSevere": "2", "NumWarnings": "1" }, + "ErrorSummaryInputs": { + "NumSevere": "0", + "NumWarnings": "0" + }, "ErrorSummarySizing": { "NumSevere": "0", "NumWarnings": "0" @@ -142,6 +147,7 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_SimInfo_String) state->dataResultsFramework->resultsFramework->SimulationInformation.setInputModelURI(""); state->dataResultsFramework->resultsFramework->SimulationInformation.setRunTime("00hr 08min 6.67sec"); state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSummary("1", "2"); + state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsInputs("0", "0"); state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsSizing("0", "0"); state->dataResultsFramework->resultsFramework->SimulationInformation.setNumErrorsWarmup("0", "2"); state->dataResultsFramework->resultsFramework->SimulationInformation.setSimulationEnvironment(""); @@ -149,7 +155,8 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_SimInfo_String) json result = state->dataResultsFramework->resultsFramework->SimulationInformation.getJSON(); std::string expectedResult = - "{\n \"ErrorSummary\": {\n \"NumSevere\": \"2\",\n \"NumWarnings\": \"1\"\n },\n \"ErrorSummarySizing\": {\n " + "{\n \"ErrorSummary\": {\n \"NumSevere\": \"2\",\n \"NumWarnings\": \"1\"\n },\n \"ErrorSummaryInputs\": {\n " + "\"NumSevere\": \"0\",\n \"NumWarnings\": \"0\"\n },\n \"ErrorSummarySizing\": {\n " "\"NumSevere\": \"0\",\n \"NumWarnings\": \"0\"\n },\n \"ErrorSummaryWarmup\": {\n \"NumSevere\": \"2\",\n " "\"NumWarnings\": \"0\"\n },\n \"InputModelURI\": \"\",\n \"ProgramVersion\": \"EnergyPlus, Version 8.6.0-0f5a10914b\",\n " "\"RunTime\": \"00hr 08min 6.67sec\",\n \"SimulationEnvironment\": \"\",\n \"StartDateTimeStamp\": \"2017.03.22 11:03\"\n}"; From 0dafbab294c09467ea1dce6e663138b55a34b207 Mon Sep 17 00:00:00 2001 From: rraustad Date: Mon, 19 Aug 2024 10:15:59 -0400 Subject: [PATCH 8/9] Another unit test repair --- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 741c2a7d0dd..0ab280936aa 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -19038,6 +19038,7 @@ Schedule:Compact, ASSERT_TRUE(process_idf(idf_objects)); // read idf objects + state->init_state(*state); state->dataZoneEquip->ZoneEquipInputsFilled = true; InternalHeatGains::ManageInternalHeatGains(*state, true); std::string compName = "UNITARY SYSTEM MODEL"; From 730845a2844bbf42ae6f6e3b18cecc7a31b3f599 Mon Sep 17 00:00:00 2001 From: rraustad Date: Mon, 19 Aug 2024 10:29:53 -0400 Subject: [PATCH 9/9] Table objects don't set curveType --- src/EnergyPlus/CurveManager.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EnergyPlus/CurveManager.hh b/src/EnergyPlus/CurveManager.hh index 41accbeb72d..5406ed113bf 100644 --- a/src/EnergyPlus/CurveManager.hh +++ b/src/EnergyPlus/CurveManager.hh @@ -213,7 +213,7 @@ namespace Curve { void markUsed(EnergyPlusData &state) { - if (!this->used) return; + if (!this->used || this->curveType == CurveType::Invalid) return; auto const find_unused = state.dataInputProcessing->inputProcessor->unusedInputs.find({std::string(objectNames[int(this->curveType)]), this->Name}); if (find_unused != state.dataInputProcessing->inputProcessor->unusedInputs.end()) {