Skip to content

Commit

Permalink
Merge pull request #10155 from NREL/output-json-tabular-data
Browse files Browse the repository at this point in the history
Fixes `Output:JSON` tabular data output incorrectly dependent on `OutputControl:Files input`
  • Loading branch information
Myoldmopar authored Jan 5, 2024
2 parents fb265cd + 51a6a08 commit bc827aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/EconomicTariff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2716,7 +2716,7 @@ void ComputeTariff(EnergyPlusData &state)

Real64 annualAggregate;

if (!(state.files.outputControl.tabular || state.files.outputControl.sqlite)) {
if (!state.files.outputControl.writeTabular(state)) {
state.dataOutRptTab->WriteTabularFiles = false;
return;
}
Expand Down
8 changes: 8 additions & 0 deletions src/EnergyPlus/IOFiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ std::vector<std::string> InputOutputFile::getLines()
return std::vector<std::string>();
}

bool IOFiles::OutputControl::writeTabular(EnergyPlusData &state)
{
bool const htmlTabular = state.files.outputControl.tabular;
bool const jsonTabular = state.files.outputControl.json && state.dataResultsFramework->resultsFramework->timeSeriesAndTabularEnabled();
bool const sqliteTabular = state.files.outputControl.sqlite; // && @JasonGlazer thinks something else maybe?
return (htmlTabular || jsonTabular || sqliteTabular);
}

void IOFiles::OutputControl::getInput(EnergyPlusData &state)
{
auto &ip = state.dataInputProcessing->inputProcessor;
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/IOFiles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ public:
OutputControl() = default;

void getInput(EnergyPlusData &state);
bool writeTabular(EnergyPlusData &state);

bool csv = false;
bool mtr = true;
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/OutputReportTabular.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void GetInputTabularMonthly(EnergyPlusData &state)
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
auto &ort = state.dataOutRptTab;

if (!(state.files.outputControl.tabular || state.files.outputControl.sqlite)) {
if (!state.files.outputControl.writeTabular(state)) {
ort->WriteTabularFiles = false;
return;
}
Expand Down Expand Up @@ -1053,7 +1053,7 @@ void GetInputTabularTimeBins(EnergyPlusData &state)

auto &ort = state.dataOutRptTab;

if (!(state.files.outputControl.tabular || state.files.outputControl.sqlite)) {
if (!state.files.outputControl.writeTabular(state)) {
ort->WriteTabularFiles = false;
return;
}
Expand Down Expand Up @@ -1461,7 +1461,7 @@ void GetInputOutputTableSummaryReports(EnergyPlusData &state)
auto &ort = state.dataOutRptTab;
bool ErrorsFound = false;

if (!(state.files.outputControl.tabular || state.files.outputControl.sqlite)) {
if (!state.files.outputControl.writeTabular(state)) {
ort->WriteTabularFiles = false;
return;
}
Expand Down

4 comments on commit bc827aa

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2778 of 2778 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2756 of 2756 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1969 of 1969 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.