Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/EnergyPlus/OutputReportTabularAnnual.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,9 @@ void AnnualTable::gatherForTimestep(EnergyPlusData &state, OutputProcessor::Time
case AnnualFieldSet::AggregationKind::hoursInTenBinsPlusMinusTwoStdDev:
case AnnualFieldSet::AggregationKind::hoursInTenBinsPlusMinusThreeStdDev:
// for all of the binning options add the value to the deferred
if (fldStIt->m_varAvgSum == OutputProcessor::StoreType::Sum) { // if it is a summed variable
fldStIt->m_cell[row].deferredResults.push_back(curValue /= secondsInTimeStep); // divide by time just like max and min
if (fldStIt->m_varAvgSum == OutputProcessor::StoreType::Sum) { // if it is a summed variable
const Real64 curValueRate = curValue / secondsInTimeStep; // divide by time just like max and min
fldStIt->m_cell[row].deferredResults.push_back(curValueRate);
} else {
fldStIt->m_cell[row].deferredResults.push_back(curValue);
}
Expand Down Expand Up @@ -613,9 +614,9 @@ Real64 AnnualTable::getElapsedTime(EnergyPlusData &state, OutputProcessor::TimeS
{
Real64 elapsedTime;
if (kindOfTimeStep == OutputProcessor::TimeStepType::Zone) {
elapsedTime = state.dataHVACGlobal->TimeStepSys;
} else {
elapsedTime = state.dataGlobal->TimeStepZone;
} else {
elapsedTime = state.dataHVACGlobal->TimeStepSys;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This certainly does look backwards.

}
return elapsedTime;
}
Expand All @@ -624,9 +625,9 @@ Real64 AnnualTable::getSecondsInTimeStep(EnergyPlusData &state, OutputProcessor:
{
Real64 secondsInTimeStep;
if (kindOfTimeStep == OutputProcessor::TimeStepType::Zone) {
secondsInTimeStep = state.dataHVACGlobal->TimeStepSysSec;
} else {
secondsInTimeStep = state.dataGlobal->TimeStepZoneSec;
} else {
secondsInTimeStep = state.dataHVACGlobal->TimeStepSysSec;
}
return secondsInTimeStep;
}
Expand Down
32 changes: 32 additions & 0 deletions tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults_MinMaxHrsShown
{
using namespace OutputProcessor;
state->dataGlobal->TimeStepZone = 1.0;
state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour;
state->dataHVACGlobal->TimeStepSys = 1.0;
state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour;

Expand Down Expand Up @@ -348,6 +349,37 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults_MinMaxHrsShown
EXPECT_EQ(fieldSetParams[13].std::string::substr(0, 6), "0.0152"); // m_cell[0].result
}

TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_Maximum_SummedVariable_UsesZoneSeconds)
{
using namespace OutputProcessor;

// Make zone and system timesteps different so a swapped mapping is detectable
state->dataGlobal->TimeStepZone = 0.25; // hours
state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * Constant::rSecsInHour; // 900 s

state->dataHVACGlobal->TimeStepSys = 1.0; // hours
state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::rSecsInHour; // 3600 s

Meter *meter = new Meter("ELECTRICITY:MYTH");
meter->units = Constant::Units::None;
state->dataOutputProcessor->meters.push_back(meter);
state->dataOutputProcessor->meterMap.insert_or_assign("ELECTRICITY:MYTH", state->dataOutputProcessor->meters.size() - 1);

std::vector<AnnualTable> annualTables;
annualTables.emplace_back(*state, "TEST MAX RATE FROM SUM", "", "");
annualTables.back().addFieldSet("ELECTRICITY:MYTH", AnnualFieldSet::AggregationKind::maximum, 6);
annualTables.back().setupGathering(*state);

// CurTSValue behaves like a summed timestep quantity here; maximum aggregation converts to a rate by dividing by secondsInTimeStep
meter->CurTSValue = 55.0;
annualTables.back().gatherForTimestep(*state, OutputProcessor::TimeStepType::Zone);

// Expect 55 / 900 = 0.061111...
std::vector<std::string> fieldSetParams = annualTables.back().inspectTableFieldSets(0);
EXPECT_EQ(fieldSetParams[0], "ELECTRICITY:MYTH"); // m_colHead
EXPECT_EQ(fieldSetParams[13].std::string::substr(0, 6), "0.0611"); // m_cell[0].result
}

TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_columnHeadersToTitleCase)
{
using namespace OutputProcessor;
Expand Down
Loading