Skip to content

Optimize TableEntry Handling#11469

Draft
amirroth wants to merge 3 commits intodevelopfrom
TableEntry
Draft

Optimize TableEntry Handling#11469
amirroth wants to merge 3 commits intodevelopfrom
TableEntry

Conversation

@amirroth
Copy link
Copy Markdown
Collaborator

This PR optimizes TableEntry handling by storing entries in table-specific lists instead of a single global list. When printing out tables, each entry has to be traversed only once rather than once per table. Unique rows are also tracked on a per-table basis.

To enable this, SetPredefinedTables was moved to init_constant_state(). This broke a unit test which checked that the Standard 62.1 was not being printed out if sizing was not done. This logic was implemented by not initializing the table constants if Sizing was off, but that's not the way to do something like this. The unit test is partially disabled for now.

@amirroth amirroth added Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Mar 15, 2026
@amirroth amirroth added this to the EnergyPlus 26.1 milestone Mar 15, 2026
Copy link
Copy Markdown
Collaborator Author

@amirroth amirroth left a comment

Choose a reason for hiding this comment

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

Simple walk through.

s->pdchSHGSHtOtherRem = newPreDefColumn(state, s->pdstSHGSpkHt, "Opaque Surface Conduction and Other Heat Removal [W]");

// Standard62Report
if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Don't condition constant initialization based on flags. Initialize always and use the flags to condition display later.

// SUBROUTINE PARAMETER DEFINITIONS:
assert(columnIndex > 0 && columnIndex <= state.dataOutRptPredefined->numColumnTag);
auto &column = state.dataOutRptPredefined->columnTag(columnIndex);
auto &table = state.dataOutRptPredefined->subTable(column.indexSubTable);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Store entries in table-specific lists.

auto &table = state.dataOutRptPredefined->subTable(column.indexSubTable);

for (int i = 1; i <= table.numEntries; ++i) {
if (table.entries(i).indexColumn == columnIndex && table.entries(i).objectName == objName) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Search entries only from the appropriate table.

int numEntries;
int sizeEntries;

Array1D<TableEntryType> entries;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Table-specific entry lists.


for (auto &currentStyle : ort->tabularReportPasses) {

// loop through the entries and associate them with the subtable and create
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We will do this on a per-table basis below.

}
}

int curNumRows = numUniqueObjectNames;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Number of rows equals number of unique objects.

}

// determine what row the current entry is in
int const rowCurrent = entry.uniqueObjName;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Indentation has changed, that is all.


TEST_F(EnergyPlusFixture, OutputReportTabularTest_PredefinedTableRowMatchingTest)
{

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is being called by init_constant_state().


void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
{
OutputReportPredefined::SetPredefinedTables(state);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Call SetPredefinedTables() here.

// Do this some other way, whether or not a report is used should not depend on whether or not it is defined

GetInputOutputTableSummaryReports(*state);
// auto &reportNameArray = state->dataOutRptPredefined->reportName;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Disable this part of the unit test (for now?). Maybe do this via an #ifdef DISABLED.

@github-actions
Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit d667b96

Regression Summary
  • Audit: 814
  • Table String Diffs: 11

@github-actions
Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit d667b96

Regression Summary
  • Audit: 810
  • Table String Diffs: 11

@github-actions
Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 5a476ca

Regression Summary
  • Audit: 810

@github-actions
Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 5a476ca

Regression Summary
  • Audit: 814

@github-actions
Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 2caf4af

Regression Summary
  • Audit: 810

@github-actions
Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 2caf4af

Regression Summary
  • Audit: 814

@mitchute
Copy link
Copy Markdown
Collaborator

I've tested this locally and am seeing that for files with no system sizing (ASIHPMixedTank.idf, for example), the 62.1 table entries appear in the .htm file, but they are blank. Whereas in the baseline branch, they do not appear at all, which I think is consistent with what you described regarding the unit test. Hence some of the very large .audit file diffs.

  sizeReportName=         100
- numReportName=          18
+ numReportName=          19
  sizeSubTable=         200
- numSubTable=         105
+ numSubTable=         113
  sizeColumnTag=        1600
- numColumnTag=         968
- sizeTableEntry=        6400
+ numColumnTag=        1053
+ sizeTableEntry=        7900
  numTableEntry=        3248

For files with system sizing (5ZoneAirCooledConvCoeff.idf), I am still seeing very large .audit file diffs, but the .htm files show no numerical diffs (though the entries are reordered in some cases).

-  sizeTableEntry=        6400
+  sizeTableEntry=        11200

@amirroth
Copy link
Copy Markdown
Collaborator Author

amirroth commented Mar 18, 2026

I've tested this locally and am seeing that for files with no system sizing (ASIHPMixedTank.idf, for example), the 62.1 table entries appear in the .htm file, but they are blank. Whereas in the baseline branch, they do not appear at all, which I think is consistent with what you described regarding the unit test. Hence some of the very large .audit file diffs.

  sizeReportName=         100
- numReportName=          18
+ numReportName=          19
  sizeSubTable=         200
- numSubTable=         105
+ numSubTable=         113
  sizeColumnTag=        1600
- numColumnTag=         968
- sizeTableEntry=        6400
+ numColumnTag=        1053
+ sizeTableEntry=        7900
  numTableEntry=        3248

For files with system sizing (5ZoneAirCooledConvCoeff.idf), I am still seeing very large .audit file diffs, but the .htm files show no numerical diffs (though the entries are reordered in some cases).

-  sizeTableEntry=        6400
+  sizeTableEntry=        11200

The audit files diffs don't really matter. Especially the ones having to do with sizes of lists as opposed to number of entries. The blank table is a problem, but it needs a different solution than what was previously used. I can try to come up with something, or maybe @JasonGlazer has an idea.

@rraustad
Copy link
Copy Markdown
Collaborator

rraustad commented Mar 18, 2026

I've tested this locally and am seeing that for files with no system sizing (ASIHPMixedTank.idf, for example), the 62.1 table
entries appear in the .htm file, but they are blank. Whereas in the baseline branch, they do not appear at all, which I think
is consistent with what you described regarding the unit test. Hence some of the very large .audit file diffs.

See old and new line 1450 of OutputReportPredefined.cc, these tables are now created regardless if sizing is selected.

    if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing) {  

@amirroth amirroth marked this pull request as draft March 30, 2026 13:45
@amirroth amirroth self-assigned this Mar 30, 2026
s->pdchS62shdEvz = newPreDefColumn(state, s->pdstS62sysHeatDes, "Zone Ventilation Efficiency - Evz-min");
}

// if (state.dataGlobal->DoZoneSizing || state.dataGlobal->DoSystemSizing) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This line is the reason the tables are now present and blank.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NotIDDChange Code does not impact IDD (can be merged after IO freeze) Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants