-
Notifications
You must be signed in to change notification settings - Fork 460
New formatting and units options for table outputs (Tabular, SQLite, and JSON) #11210
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
Conversation
|
|
|
|
|
@JasonGlazer Here are some sample outputs with rounding turned off. |
|
|
|
And some json outputs with and without rounding. |
I noticed some values that are not being rounded in this file. |
Originally, I wasn't envisioning the HTML file to be changed, just the JSON files, but it is ok that it is a general change. Some values aren't shown as rounded in the 2Rounding case. Maybe not every tabular output uses RealToStr? See "Outdoor Air Details", "Standard 62.1 Summary", "Initialization Summary" Maybe not that important since we are really just after the 0 case without any rounding. |
This is a first pass. At this point, for tables that use the predefined report method, rounding values >0 are only touching entries that don't include the last argument. Any table entries where the number of places are specified in the call are using the input value. e.g.: I was concerned that certain values that are expected to be small numbers would end up showing 0.00, but I didn't test that. It's an easy change. |
That is a very legitimate concern. 0.00 implies zero even if the value is supposed to be small. Maybe the current behaviour is better, but it would need to be documented. |
While we're in here, we could add logic to switch to an exponent format whenever the value is smaller than the specified number of sig digits. Also regarding rounding for HTML vs JSON (and SQL). My understanding of the code is that the current approach sends the |
|
When I was thinking of this, I was thinking of extending the current loop that does different unit systems to be more general and basically reproduce the tables multiple times. Not very efficient. Your approach seems fine. |
|
The SQL file in "TabularData" seems to be not getting rounded even when is set to Yes |
|
No diffs here as expected, but there are some api unit test failures. I think they are unrelated? @mitchute ? Next step will be a revised example file which should generate some JSON diffs. |
| \min-fields 4 | ||
| \memo This object defines the connection between two nodes and a component. | ||
| A1 , \field Name | ||
| \reference AirflowNetworkDistributionLinkageNames |
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.
Unrelated fix to add missing reference that caused a pop-up warning in IDFEditor (see #10887 ).
@mjwitte those are old results. The latest ones are passing. https://myoldmopar.github.io/EnergyPlusBuildResults/EnergyPlus-bcbe5cda8682a986b16b1076d51170e58e577ded-x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo.html |
mjwitte
left a comment
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.
Code walkthru
| \key InchPound | ||
| \key InchPoundExceptElectricity | ||
| \default None | ||
| A3; \field Format Numeric Values |
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.
New format option for tabular output (html, tab, or csv)
| \key No | ||
| \default No | ||
|
|
||
| A5 , \field Unit Conversion for Tabular Data |
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.
New units and format options for JSON output (JSON, CBOR, MessagePack).
| \key InchPound | ||
| \key InchPoundExceptElectricity | ||
| \default UseOutputControlTableStyle | ||
| A3; \field Format Numeric Values for Tabular Data |
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.
New format option for SQLite output (already had a units option).
| struct tabularReportStyle | ||
| { | ||
| UnitsStyle unitsStyle = UnitsStyle::None; | ||
| bool formatReals = true; | ||
| bool produceTabular = true; | ||
| bool produceSQLite = true; | ||
| bool produceJSON = true; |
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.
New tabularReportStyle struct/vector. Tracks units and formatting for table reports in one of three output formats:
Tabular, JSON, and SQLite. By default, all three output types (if active) will have the same units and numerics will be formatted and there will only be on instance of this.
If different options are specified for JSON and/or SQLite, then another instance will be created for that file type, up to three instances max.
| AlphArray(2) = "None"; | ||
| ort->formatReals_Tabular = getYesNoValue(AlphArray(3)) == BooleanSwitch::Yes; |
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.
Set new format option for tabular (html etc.)
| void writeVeriSumSpaceTables(EnergyPlusData &state, bool produceTabular, bool produceSQLite); | ||
| void writeVeriSumSpaceTables(EnergyPlusData &state, const tabularReportStyle &style); |
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.
Various sub functions for the report writing need the style information passed in (more than before).
| Yes, !- Output JSON | ||
| No, !- Output CBOR | ||
| No; !- Output MessagePack | ||
| No, !- Output MessagePack | ||
| None, !- Unit Conversion for Tabular Data | ||
| No; !- Format Numeric Values for Tabular Data |
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.
Add new options to existing example file.
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.
Should we flip this to Yes so we exercise this via the unit integration tests?
|
|
||
| state->dataOutRptTab->WriteTabularFiles = true; | ||
|
|
||
| // activate JSON output |
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.
Extend existing unit test.
| } | ||
| } | ||
|
|
||
| TEST_F(SQLiteFixture, ORT_EndUseBySubcategorySQL_DualUnits2) |
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.
Clone the unit test with different options.
|
|
||
| OutputReportTabularAnnual::GetInputTabularAnnual(*state); | ||
| EXPECT_EQ(state->dataOutputReportTabularAnnual->annualTables.size(), 1u); | ||
| OutputReportTabular::setTabularReportStyles(*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.
And several unit tests need this new call to set things up.
|
@mitchute This should be ready for review. |
mitchute
left a comment
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.
Minor question, but the rest looks good.
| Yes, !- Output JSON | ||
| No, !- Output CBOR | ||
| No; !- Output MessagePack | ||
| No, !- Output MessagePack | ||
| None, !- Unit Conversion for Tabular Data | ||
| No; !- Format Numeric Values for Tabular Data |
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.
Should we flip this to Yes so we exercise this via the unit integration tests?
Since the prior (now default) behavior was Yes, my thought was to set this to No to force something different. But since no diffs were reported, apparently, we don't compare JSON outputs for regressions? But this will at least cause more than one reporting pass so it will help make sure nothing breaks the regular table outputs. |
Hmm.... I thought it was defaulted to |
|
OK, so |













Pull request overview
OutputControl:Table:Style:Output:SQLite:Output:JSON:Pull Request Author
Reviewer