diff --git a/src/EnergyPlus/ReportSizingManager.cc b/src/EnergyPlus/ReportSizingManager.cc index 5c1b61c3132..a9ad972d25b 100644 --- a/src/EnergyPlus/ReportSizingManager.cc +++ b/src/EnergyPlus/ReportSizingManager.cc @@ -185,7 +185,9 @@ namespace ReportSizingManager { // add to SQL output if ( sqlite ) sqlite->addSQLiteComponentSizingRecord( CompType, CompName, VarDesc, VarValue ); - + if ( present( UsrDesc ) && present( UsrValue ) ) { + if ( sqlite ) sqlite->addSQLiteComponentSizingRecord( CompType, CompName, UsrDesc, UsrValue ); + } } void diff --git a/src/Transition/OutputRulesFiles/OutputChanges8-7-0-to-8-8-0.md b/src/Transition/OutputRulesFiles/OutputChanges8-7-0-to-8-8-0.md new file mode 100644 index 00000000000..aa3f6f59401 --- /dev/null +++ b/src/Transition/OutputRulesFiles/OutputChanges8-7-0-to-8-8-0.md @@ -0,0 +1,15 @@ +Output Changes +============== + +This file documents the structural changes on the output of EnergyPlus that could affect interfaces, etc. + +### Description + +This will eventually become a more structured file, but currently it isn't clear what format is best. As an intermediate solution, and to allow the form to be formed organically, this plain text file is being used. Entries should be clearly delimited. It isn't expected that there will be but maybe a couple each release at most. Entries should also include some reference back to the repo. At least a PR number or whatever. + +### Adds additional records of User-Specified component sizing output to SQLite output file. + +In the Component Sizing table report, autosized fields may report values for "Design Size", "User-Specified", or both. Previously, for fields with both values, only the "Design Size" value was included in the Component Sizing table in the SQLite output. Now both values are included in the SQLite output. + +See [6147](https://github.com/NREL/EnergyPlus/pull/6147) + diff --git a/tst/EnergyPlus/unit/ReportSizingManager.unit.cc b/tst/EnergyPlus/unit/ReportSizingManager.unit.cc index bae027e5fa1..06873cd6a23 100644 --- a/tst/EnergyPlus/unit/ReportSizingManager.unit.cc +++ b/tst/EnergyPlus/unit/ReportSizingManager.unit.cc @@ -53,6 +53,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include "Fixtures/SQLiteFixture.hh" // EnergyPlus Headers #include @@ -353,3 +354,37 @@ TEST_F( EnergyPlusFixture, ReportSizingManager_RequestSizingZone ) { ZoneSizingInput.deallocate(); } + +TEST_F( SQLiteFixture, ReportSizingManager_SQLiteRecordReportSizingOutputTest ) { + // issue #6112 + std::string CompName; + std::string CompType; + std::string VarDesc; + std::string UsrDesc; + Real64 VarValue; + Real64 UsrValue; + + EnergyPlus::sqlite = std::move( sqlite_test ); + + // input values + CompType = "BOILER:HOTWATER"; + CompName = "RESIDENTIAL BOILER ELECTRIC"; + VarDesc = "Design Size Nominal Capacity [W]"; + VarValue = 105977.98934; + UsrDesc = "User-Specified Nominal Capacity [W]"; + UsrValue = 26352.97405; + // boiler hot water autosizing and userspecified nominal capacity reporting to SQLite output + ReportSizingManager::ReportSizingOutput( CompType, CompName, VarDesc, VarValue, UsrDesc, UsrValue ); + // get the sqlite output + sqlite_test = std::move( EnergyPlus::sqlite ); + // query the sqLite + auto result = queryResult( "SELECT * FROM ComponentSizes;", "ComponentSizes" ); + sqlite_test->sqliteCommit(); + // check that there are two sizing result records + ASSERT_EQ( 2ul, result.size() ); + std::vector testResult0{ "1", "BOILER:HOTWATER", "RESIDENTIAL BOILER ELECTRIC", "Design Size Nominal Capacity", "105977.98934", "W" }; + std::vector testResult1{ "2", "BOILER:HOTWATER", "RESIDENTIAL BOILER ELECTRIC", "User-Specified Nominal Capacity", "26352.97405", "W" }; + EXPECT_EQ( testResult0, result[0] ); + EXPECT_EQ( testResult1, result[1] ); + +}