From 475830e2c5cc9fe164209bbe6158f39f4b0a356b Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Thu, 30 Mar 2017 13:17:38 -0600 Subject: [PATCH] Revert "New error for Output:Table:Monthly and Annual don't have proper order for aggregation types" --- src/EnergyPlus/OutputReportTabular.cc | 53 +--------------- src/EnergyPlus/OutputReportTabular.hh | 3 - src/EnergyPlus/OutputReportTabularAnnual.cc | 62 ------------------- src/EnergyPlus/OutputReportTabularAnnual.hh | 6 -- .../unit/OutputReportTabular.unit.cc | 37 ----------- .../unit/OutputReportTabularAnnual.unit.cc | 37 ----------- 6 files changed, 1 insertion(+), 197 deletions(-) diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 76db0f87ec6..ce511a93c96 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -695,16 +695,12 @@ namespace OutputReportTabular { if ( UpdateTabularReportsGetInput ) { GetInputTabularMonthly(); OutputReportTabularAnnual::GetInputTabularAnnual(); - OutputReportTabularAnnual::checkAggregationOrderForAnnual(); GetInputTabularTimeBins(); GetInputTabularStyle(); GetInputOutputTableSummaryReports(); // noel -- noticed this was called once and very slow -- sped up a little by caching keys InitializeTabularMonthly(); - if ( isInvalidAggregationOrder( ) ) { - ShowFatalError( "OutputReportTabular: Invalid aggregations detected, no simulation performed." ); - } - GetInputFuelAndPollutionFactors( ); + GetInputFuelAndPollutionFactors(); SetupUnitConversions(); AddTOCZoneLoadComponentTable(); UpdateTabularReportsGetInput = false; @@ -1411,53 +1407,6 @@ namespace OutputReportTabular { //#endif } - bool - isInvalidAggregationOrder( ) - { - bool foundError = false; - if ( !DoWeathSim ) {// if no weather simulation than no reading of MonthlyInput array - return foundError; - } - for ( int iInput = 1; iInput <= MonthlyInputCount; ++iInput ) { - bool foundMinOrMax = false; - bool foundHourAgg = false; - bool missingMaxOrMinError = false; - bool missingHourAggError = false; - for ( int jTable = 1; jTable <= MonthlyInput( iInput ).numTables; ++jTable ) { - int curTable = jTable + MonthlyInput( iInput ).firstTable - 1; - // test if the aggregation types are in the correct order - for ( int kColumn = 1; kColumn <= MonthlyTables( curTable ).numColumns; ++kColumn ) { - int curCol = kColumn + MonthlyTables( curTable ).firstColumn - 1; - int curAggType = MonthlyColumns( curCol ).aggType; - if ( ( curAggType == aggTypeMaximum ) || ( curAggType == aggTypeMinimum ) ) { - foundMinOrMax = true; - } else if ( ( curAggType == aggTypeHoursNonZero ) || ( curAggType == aggTypeHoursZero ) || - ( curAggType == aggTypeHoursPositive ) || ( curAggType == aggTypeHoursNonPositive ) || - ( curAggType == aggTypeHoursNegative ) || ( curAggType == aggTypeHoursNonNegative ) ) { - foundHourAgg = true; - } else if ( curAggType == aggTypeValueWhenMaxMin ) { - if ( !foundMinOrMax ) { - missingMaxOrMinError = true; - } - } else if ( ( curAggType == aggTypeSumOrAverageHoursShown ) || ( curAggType == aggTypeMaximumDuringHoursShown ) || ( curAggType == aggTypeMinimumDuringHoursShown ) ) { - if ( !foundHourAgg ) { - missingHourAggError = true; - } - } - } - } - if ( missingMaxOrMinError ) { - ShowSevereError( "The Output:Table:Monthly report named=\"" + MonthlyInput( iInput ).name + "\" has a valueWhenMaxMin aggregation type for a column without a previous column that uses either the minimum or maximum aggregation types. The report will not be generated." ); - foundError = true; - } - if ( missingHourAggError ) { - ShowSevereError( "The Output:Table:Monthly report named=\"" + MonthlyInput( iInput ).name + "\" has a --DuringHoursShown aggregation type for a column without a previous field that uses one of the Hour-- aggregation types. The report will not be generated." ); - foundError = true; - } - } - return foundError; - } - void GetInputTabularTimeBins() { diff --git a/src/EnergyPlus/OutputReportTabular.hh b/src/EnergyPlus/OutputReportTabular.hh index 2def4b84b5d..460982a41c1 100644 --- a/src/EnergyPlus/OutputReportTabular.hh +++ b/src/EnergyPlus/OutputReportTabular.hh @@ -629,9 +629,6 @@ namespace OutputReportTabular { void InitializeTabularMonthly(); - bool - isInvalidAggregationOrder(); - void GetInputTabularTimeBins(); diff --git a/src/EnergyPlus/OutputReportTabularAnnual.cc b/src/EnergyPlus/OutputReportTabularAnnual.cc index 5615fbacf72..be5809f3e49 100644 --- a/src/EnergyPlus/OutputReportTabularAnnual.cc +++ b/src/EnergyPlus/OutputReportTabularAnnual.cc @@ -71,7 +71,6 @@ #include #include #include -#include namespace EnergyPlus { @@ -119,7 +118,6 @@ namespace EnergyPlus { InputProcessor::GetObjectDefMaxArgs( currentModuleObject, numParams, numAlphas, numNums ); alphArray.allocate( numAlphas ); numArray.dimension( numNums, 0.0 ); - for ( int tabNum = 1 ; tabNum <= objCount; ++tabNum ) { InputProcessor::GetObjectItem( currentModuleObject, tabNum, alphArray, numAlphas, numArray, numNums, IOStat ); if ( numAlphas >= 5 ) { @@ -151,7 +149,6 @@ namespace EnergyPlus { } } - void AnnualTable::addFieldSet( std::string varName, AnnualFieldSet::AggregationKind aggKind, int dgts) // Jason Glazer, August 2015 @@ -249,65 +246,6 @@ namespace EnergyPlus { } } - void - checkAggregationOrderForAnnual( ) - { - std::vector::iterator annualTableIt; - bool invalidAggregationOrderFound = false; - if ( !DataGlobals::DoWeathSim ) {// if no weather simulation than no reading of MonthlyInput array - return; - } - for ( annualTableIt = annualTables.begin( ); annualTableIt != annualTables.end( ); ++annualTableIt ) { - if ( annualTableIt->invalidAggregationOrder( ) ) { - invalidAggregationOrderFound = true; - } - } - if ( invalidAggregationOrderFound ) { - ShowFatalError( "OutputReportTabularAnnual: Invalid aggregations detected, no simulation performed." ); - } - } - - // Generate an error message if an advanced aggregation kind columns don't follow the appropriate column - Glazer 2017 - bool - AnnualTable::invalidAggregationOrder( ) - { - std::vector::iterator fldStIt; - bool foundMinOrMax = false; - bool foundHourAgg = false; - bool missingMaxOrMinError = false; - bool missingHourAggError = false; - for ( fldStIt = m_annualFields.begin( ); fldStIt != m_annualFields.end( ); ++fldStIt ) { - if ( ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::maximum ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::minimum ) ) { - foundMinOrMax = true; - } else if ( ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::hoursNonZero ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::hoursZero ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::hoursPositive ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::hoursNonPositive ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::hoursNegative ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::hoursNonNegative ) ){ - foundHourAgg = true; - } else if ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::valueWhenMaxMin ){ - if ( !foundMinOrMax ) { - missingMaxOrMinError = true; - } - } else if ( ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::sumOrAverageHoursShown ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::maximumDuringHoursShown ) || - ( fldStIt->m_aggregate == AnnualFieldSet::AggregationKind::minimumDuringHoursShown ) ){ - if ( !foundHourAgg ) { - missingHourAggError = true; - } - } - } - if ( missingMaxOrMinError ) { - ShowSevereError( "The Output:Table:Annual report named=\"" + m_name + "\" has a valueWhenMaxMin aggregation type for a column without a previous column that uses either the minimum or maximum aggregation types. The report will not be generated." ); - } - if ( missingHourAggError ) { - ShowSevereError( "The Output:Table:Annual report named=\"" + m_name + "\" has a --DuringHoursShown aggregation type for a column without a previous field that uses one of the Hour-- aggregation types. The report will not be generated." ); - } - return ( missingHourAggError || missingMaxOrMinError ); - } - void GatherAnnualResultsForTimeStep( int kindOfTimeStep ) diff --git a/src/EnergyPlus/OutputReportTabularAnnual.hh b/src/EnergyPlus/OutputReportTabularAnnual.hh index 51d0d692b8b..95a080ac9a9 100644 --- a/src/EnergyPlus/OutputReportTabularAnnual.hh +++ b/src/EnergyPlus/OutputReportTabularAnnual.hh @@ -75,9 +75,6 @@ namespace OutputReportTabularAnnual { void GetInputTabularAnnual(); - void - checkAggregationOrderForAnnual(); - void GatherAnnualResultsForTimeStep( int kindOfTypeStep ); @@ -133,9 +130,6 @@ public: void setupGathering(); - bool - invalidAggregationOrder(); - void gatherForTimestep( int kindOfTypeStep ); diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 9fe502d6f90..5082644b9e1 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -5973,40 +5973,3 @@ TEST_F( SQLiteFixture, WriteVeriSumTableAreasTest ) { EXPECT_EQ( " 114.72", tabularData[103][10] ); // window opening area } - - -TEST_F( EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder ) -{ - std::string const idf_objects = delimited_string( { - "Version,8.3;", - "Output:Table:Monthly,", - "Space Gains Annual Report, !- Name", - "2, !- Digits After Decimal", - "Exterior Lights Electric Energy, !- Variable or Meter 1 Name", - "SumOrAverageDuringHoursShown, !- Aggregation Type for Variable or Meter 1", - "Exterior Lights Electric Power, !- Variable or Meter 2 Name", - "Maximum, !- Aggregation Type for Variable or Meter 2", - "Exterior Lights Electric Power, !- Variable or Meter 2 Name", - "Minimum; !- Aggregation Type for Variable or Meter 2", - - } ); - - ASSERT_FALSE( process_idf( idf_objects ) ); - - Real64 extLitUse; - - SetupOutputVariable( "Exterior Lights Electric Energy [J]", extLitUse, "Zone", "Sum", "Lite1", _, "Electricity", "Exterior Lights", "General" ); - SetupOutputVariable( "Exterior Lights Electric Energy [J]", extLitUse, "Zone", "Sum", "Lite2", _, "Electricity", "Exterior Lights", "General" ); - SetupOutputVariable( "Exterior Lights Electric Energy [J]", extLitUse, "Zone", "Sum", "Lite3", _, "Electricity", "Exterior Lights", "General" ); - - DataGlobals::DoWeathSim = true; - DataGlobals::TimeStepZone = 0.25; - - GetInputTabularMonthly( ); - EXPECT_EQ( MonthlyInputCount, 1 ); - InitializeTabularMonthly( ); - - EXPECT_TRUE(isInvalidAggregationOrder()); - -} - diff --git a/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc b/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc index 0c1f3b2ed98..c0672572785 100644 --- a/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc @@ -272,40 +272,3 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_columnHeadersToTitleCase) } -TEST_F( EnergyPlusFixture, OutputReportTabularAnnual_invalidAggregationOrder ) -{ - std::string const idf_objects = delimited_string( { - "Version,8.7;", - "Output:Table:Annual,", - "Test Report, !- Name", - ", !- Filter", - ", !- Schedule Name", - "Electricity:Facility, !- Variable or Meter 2 Name", - "SumOrAverageDuringHoursShown, !- Aggregation Type for Variable or Meter 2", - ", !- field Digits After Decimal 2", - "Misc Facility Electric Energy, !- Variable or Meter 3 Name", - "SumOrAverage, !- Aggregation Type for Variable or Meter 3", - "0; !- field Digits After Decimal 3", - } ); - - ASSERT_FALSE( process_idf( idf_objects ) ); - - Real64 facilUse; - SetupOutputVariable( "Misc Facility Electric Energy [J]", facilUse, "Zone", "Sum", "Lite1", _, "Electricity", "Facility", "General" ); //create an electric meter - - OutputProcessor::NumEnergyMeters = 2; - OutputProcessor::EnergyMeters.allocate( OutputProcessor::NumEnergyMeters ); - OutputProcessor::EnergyMeters( 1 ).Name = "Electricity:Facility"; //"ELECTRICITY:FACILITY"; - OutputProcessor::EnergyMeters( 2 ).Name = "ELECTRICITY:LIGHTING"; - - DataGlobals::DoWeathSim = true; - - OutputReportTabularAnnual::GetInputTabularAnnual( ); - - EXPECT_EQ( OutputReportTabularAnnual::annualTables.size( ), 1u ); - - std::vector::iterator firstTable = OutputReportTabularAnnual::annualTables.begin( ); - - EXPECT_TRUE( firstTable->invalidAggregationOrder( ) ); - -}