New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes Output:JSON
tabular data output incorrectly dependent on OutputControl:Files input
#10155
Conversation
… tabular output file.
To test, add an
Note that you now get the same eplusout.json output whether you have:
or
|
@shorowit I think the lines:
should probably be something like
Honestly, the portion that says just says "state.files.outputControl.sqlite" doesn't seem quite correct to me for the same reason but I haven't tried testing that. |
And if we go that way, I would prefer a valid version of something like this: 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?
if (!(htmlTabular || jsonTabular || sqliteTabular)) |
…put-json-tabular-data
@Myoldmopar @JasonGlazer Is this what you had in mind? It seems weird to me that the code in four different places is setting |
@shorowit that seems like a nice approach keeping the logic in the function. I didn't mean to imply that I know that my suggestion will fix the problem that @Myoldmopar brought up but I think it will. I would recommend either running some test files to make sure it works as expected and then adding some unit tests. Some digging might be needed if the SQL is not working right. |
I don't have an immediate need for this improvement, and I'm not going to have a chance to further test this and bring it to completion in the near future. So I'm going to change the milestone to the next release. (If someone else wants to bring it to completion sooner, feel free to have at it.) |
@shorowit @Myoldmopar it has been 28 days since this pull request was last updated. |
@@ -2711,7 +2711,7 @@ void ComputeTariff(EnergyPlusData &state) | |||
|
|||
Real64 annualAggregate; | |||
|
|||
if (!(state.files.outputControl.tabular || state.files.outputControl.sqlite)) { | |||
if (!state.files.outputControl.writeTabular(state)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb question here...why is the state.dataOutRptTab->WriteTabularFiles
being set here in a function called ComputeTariff
inside EconomicTariff.cc
anyway?? That alone seems super weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good question. And I don't remember, I suppose this might be the first place that a call to something dependent on actually writing tabular reports occurs, although that does not seem likely.
@@ -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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd like to take a crack at this where state.dataOutRptTab->WriteTabularFiles
is set once very early in the simulation and we don't need to keep calling this function. As soon as we have read inputs, we should be able to assign that flag.
I like that the function collects all the flags in one place -- that's always welcomed. The flag checks themselves may need a little extra work as described above, but regardless it's a good step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tested it to make sure the files are produced as expected but the logic looks good to me. Thanks @shorowit and @Myoldmopar
@@ -2711,7 +2711,7 @@ void ComputeTariff(EnergyPlusData &state) | |||
|
|||
Real64 annualAggregate; | |||
|
|||
if (!(state.files.outputControl.tabular || state.files.outputControl.sqlite)) { | |||
if (!state.files.outputControl.writeTabular(state)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good question. And I don't remember, I suppose this might be the first place that a call to something dependent on actually writing tabular reports occurs, although that does not seem likely.
bool const sqliteTabular = state.files.outputControl.sqlite; // && @JasonGlazer thinks something else maybe? | ||
return (htmlTabular || jsonTabular || sqliteTabular); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason I was concerned is the Output:SQLite field "Option Type" has two options Simple, SimpleAndTabular and they don't seem to impact this.
@@ -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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
@Myoldmopar @shorowit @Myoldmopar it has been 28 days since this pull request was last updated. |
OK, this has lingered long enough. It seems good. I'm going to just pull and test and get this in. If some further improvements are needed, they can come later. |
Everything is running fine, merging this. Thanks @shorowit and @JasonGlazer. |
Pull request overview
Output:JSON
tabular data output incorrectly dependent onOutputControl:Files
input #9393NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.