Skip to content

Conversation

@mjwitte
Copy link
Contributor

@mjwitte mjwitte commented Sep 12, 2025

Pull request overview

   A3; \field Format Numeric Values
       \memo If No, all digits are shown after the decimal point without any rounding (23.238769213).
       \memo If Yes, values are rounded for readability (23.24).
       \type choice
       \key Yes
       \key No
       \default Yes
  • Add a new field to Output:SQLite:
   A3; \field Format Numeric Values for Tabular Data
       \memo If No, all digits are shown after the decimal point without any rounding (23.238769213).
       \memo If Yes, values are rounded for readability (23.24).
       \type choice
       \key Yes
       \key No
       \default Yes
  • Add two new fields to Output:JSON:
  A5 , \field Unit Conversion for Tabular Data
       \type choice
       \note Unit conversion option used when writing JSON Tabular Data
       \note This option applies to TabularData and TabularDatawithString in the JSON file(s)
       \key UseOutputControlTableStyle
       \key None
       \key JtoKWH
       \key JtoMJ
       \key JtoGJ
       \key InchPound
       \key InchPoundExceptElectricity
       \default UseOutputControlTableStyle
  A6 ; \field Format Numeric Values for Tabular Data
       \memo If No, all digits are shown after the decimal point without any rounding (23.238769213).
       \memo If Yes, values are rounded for readability (23.24).
       \type choice
       \key Yes
       \key No
       \default Yes
  • Fixes Output:Table:Annual not writing to JSON output.

Pull Request Author

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@mjwitte mjwitte added NewFeature Includes code to add a new feature to EnergyPlus IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) RPD labels Sep 12, 2025
@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit ad696cc

Regression Summary
  • EIO: 143
  • Table Big Diffs: 80

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit ad696cc

Regression Summary
  • EIO: 143
  • Table Big Diffs: 80

@mjwitte mjwitte added the OutputChange Code changes output in such a way that it cannot be merged after IO freeze label Sep 15, 2025
@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 7c4dc21

Regression Summary
  • EIO: 786
  • Table Big Diffs: 80

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit 7c4dc21

Regression Summary
  • EIO: 789
  • Table Big Diffs: 80

@mjwitte mjwitte added the Defect Includes code to repair a defect in EnergyPlus label Sep 15, 2025
@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 15, 2025

@JasonGlazer Here are some sample outputs with rounding turned off.
10896-TableRounding.zip
image
image
image

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit d5036a9

Regression Summary
  • EIO: 789
  • Table Big Diffs: 80

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit d5036a9

Regression Summary
  • EIO: 785
  • Table Big Diffs: 80

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 15, 2025

And some json outputs with and without rounding.
5ZoneAirCooledConvCoef-SI-NoRounding.json
5ZoneAirCooledConvCoef-SI-2Rounding.json

@JasonGlazer
Copy link
Contributor

5ZoneAirCooledConvCoef-SI-2Rounding.json

I noticed some values that are not being rounded in this file.

@JasonGlazer
Copy link
Contributor

JasonGlazer commented Sep 16, 2025

Here are some sample outputs with rounding turned off.

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.

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 16, 2025

5ZoneAirCooledConvCoef-SI-2Rounding.json

I noticed some values that are not being rounded in this file.

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.:
PreDefTableEntry(state, state.dataOutRptPredefined->pdchOaOccBzNatVent, thisZone.Name, natVent, 4);

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.

@JasonGlazer
Copy link
Contributor

was concerned that certain values that are expected to be small numbers would end up showing 0.00

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.

@mjwitte
Copy link
Contributor Author

mjwitte commented Sep 16, 2025

was concerned that certain values that are expected to be small numbers would end up showing 0.00

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 tablebody to the results framework for the various formats, so it's already been rounded or units converted, and it's all strings at that point. For predefined reports, we have the .origRealEntry value so we could access that. But for the other reports that are using realToString the original value is not being saved (which can impact unit conversions, too, if I'm following correctly.

@JasonGlazer
Copy link
Contributor

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.

@mjwitte mjwitte changed the title New significant digits option for table outputs New formatting and units options for table outputs (Tabular, SQLite, and JSON) Sep 17, 2025
@JasonGlazer
Copy link
Contributor

The SQL file in "TabularData" seems to be not getting rounded even when is set to Yes

@mjwitte
Copy link
Contributor Author

mjwitte commented Oct 3, 2025

No diffs here as expected, but there are some api unit test failures. I think they are unrelated? @mitchute ?
https://myoldmopar.github.io/EnergyPlusBuildResults/EnergyPlus-5979ad801c6ede9b14538a97ead96b5aaf94f26e-x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo.html

Next step will be a revised example file which should generate some JSON diffs.

@mjwitte
Copy link
Contributor Author

mjwitte commented Oct 3, 2025

Here's an example of Table (html) output with and without numeric formatting.
image
image

@mjwitte
Copy link
Contributor Author

mjwitte commented Oct 3, 2025

Here's an example of JSON output, format numbers vs not:
image

And JSON output IP units vs SI (no format for both):
image

@mjwitte
Copy link
Contributor Author

mjwitte commented Oct 3, 2025

And here's SQLite output formatted vs not:
image
image

And SQLite IP vs SI (just to confirm it still works):
image
image

image image

\min-fields 4
\memo This object defines the connection between two nodes and a component.
A1 , \field Name
\reference AirflowNetworkDistributionLinkageNames
Copy link
Contributor Author

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 ).

@mitchute
Copy link
Collaborator

mitchute commented Oct 3, 2025

No diffs here as expected, but there are some api unit test failures. I think they are unrelated? @mitchute ? https://myoldmopar.github.io/EnergyPlusBuildResults/EnergyPlus-5979ad801c6ede9b14538a97ead96b5aaf94f26e-x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo.html

Next step will be a revised example file which should generate some JSON diffs.

@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

Copy link
Contributor Author

@mjwitte mjwitte left a 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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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).

Comment on lines +573 to +579
struct tabularReportStyle
{
UnitsStyle unitsStyle = UnitsStyle::None;
bool formatReals = true;
bool produceTabular = true;
bool produceSQLite = true;
bool produceJSON = true;
Copy link
Contributor Author

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;
Copy link
Contributor Author

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.)

Comment on lines -724 to +731
void writeVeriSumSpaceTables(EnergyPlusData &state, bool produceTabular, bool produceSQLite);
void writeVeriSumSpaceTables(EnergyPlusData &state, const tabularReportStyle &style);
Copy link
Contributor Author

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).

Comment on lines 3632 to +3636
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
Copy link
Contributor Author

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.

Copy link
Collaborator

@mitchute mitchute Oct 6, 2025

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
Copy link
Contributor Author

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)
Copy link
Contributor Author

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);
Copy link
Contributor Author

@mjwitte mjwitte Oct 3, 2025

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.

@mjwitte
Copy link
Contributor Author

mjwitte commented Oct 3, 2025

@mitchute This should be ready for review.

Copy link
Collaborator

@mitchute mitchute left a 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.

Comment on lines 3632 to +3636
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
Copy link
Collaborator

@mitchute mitchute Oct 6, 2025

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?

@mjwitte
Copy link
Contributor Author

mjwitte commented Oct 6, 2025

None,                    !- Unit Conversion for Tabular Data
No;                      !- Format Numeric Values for Tabular Data

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.

@mitchute
Copy link
Collaborator

mitchute commented Oct 6, 2025

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 No. In that case, I guess I would expect some diffs. Checking on whether we're comparing the JSON during regressions...

@mitchute
Copy link
Collaborator

mitchute commented Oct 6, 2025

OK, so eplusout_hourly.json is compared with a math diff (these values don't change here), and eplusout.json is not compared at all; however, I am seeing the rounding diffs there. Let's merge this and then I'll update the regression tool to catch the eplusout.json diffs.

@mitchute mitchute merged commit 86cc706 into develop Oct 6, 2025
11 checks passed
@mitchute mitchute deleted the 10896TableRounding branch October 6, 2025 21:12
@mjwitte mjwitte mentioned this pull request Oct 8, 2025
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Defect Includes code to repair a defect in EnergyPlus IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) NewFeature Includes code to add a new feature to EnergyPlus OutputChange Code changes output in such a way that it cannot be merged after IO freeze RPD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add switch to disable rounding or truncating digits for tabular reports Allow different unit conversions for JSON tabular output file

6 participants