Skip to content
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

Fix #9621 - AllSummaryAndMonthly option in Output:Table:SummaryReports prompts many warnings and incomplete reports #10211

Merged
merged 9 commits into from
Sep 14, 2023

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Sep 8, 2023

Pull request overview

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • 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

This will not be exhaustively relevant to every PR.

  • 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

fails with diff
```
With diff:
@@ -1,1 +1,434 @@
-   ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE'\n
+   ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE AIR SYSTEM SENSIBLE COOLING ENERGY'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE AIR SYSTEM SENSIBLE COOLING RATE'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR DRYBULB TEMPERATURE'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR WETBULB TEMPERATURE'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE TOTAL INTERNAL LATENT GAIN ENERGY'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'ZONE TOTAL INTERNAL LATENT GAIN RATE'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR DRYBULB TEMPERATURE'
+   ** Warning ** In Output:Table:Monthly 'ZoneCoolingSummaryMonthly' invalid Variable or Meter Name 'SITE OUTDOOR AIR WETBULB TEMPERATURE'
+   ** Warning ** In Output:Table:Monthly 'ZoneHeatingSummaryMonthly' invalid Variable or Meter Name 'ZONE AIR SYSTEM SENSIBLE HEATING ENERGY'
[...]
```
… in Monthly table if it's one of the Named Monthly ones
* Avoid printing two warnings when display extra warning (My fault, in #8348)
* Do not print individual variables if non display extra warning
* Reorganize when single line warning is issued to be more logical
* Reduce number of printed lines
@jmarrec jmarrec added the Defect Includes code to repair a defect in EnergyPlus label Sep 8, 2023
@jmarrec jmarrec self-assigned this Sep 8, 2023
@jmarrec jmarrec force-pushed the 9621_WarnOnMissingMonthlyVariable branch from 6dc2125 to c39acff Compare September 8, 2023 12:59
int numTables = 0; // number of tables
int firstTable = 0; // pointer to the first table
int showDigits = 0; // the number of digits to be shown
bool isNamedMonthly = false;
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 a bool to keep track of which is actually a namedMonthly one

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for cleaning up the initializations!

@@ -523,7 +519,7 @@ namespace OutputReportTabular {

void GetInputTabularMonthly(EnergyPlusData &state);

int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown);
int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown, bool isNamedMonthly = false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pass a bool

@@ -613,13 +614,14 @@ void InitializeTabularMonthly(EnergyPlusData &state)
// #ifdef ITM_KEYCACHE
// Noel comment: First time in this TabNum/ColNum loop, let's save the results
// of GetVariableKeyCountandType & GetVariableKeys.
std::string const &curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter);
std::string const curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter);
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 but makeUPPER returns a std::string, not a reference

Copy link
Member

Choose a reason for hiding this comment

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

Yeah we're not really saving anything by creating a reference there, good catch.

Comment on lines +622 to +624
if (!ort->MonthlyInput(TabNum).isNamedMonthly) {
++state.dataOutRptTab->ErrCount1;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't warn twice. This is my fault, from #8317

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We increment the count here.

Copy link
Member

Choose a reason for hiding this comment

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

In a more ideal scenario, would you have a variable tracker on the table object instance itself, and not a generic error counter in state? Just curious, not saying you need to change anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What purpose do you have in mind?

Note that that you also have a tracker on the MonthlyFieldSetInput (each "cell"), since keyCount is zero if it's an error.


Site note: I actually considered for a moment reporting in a different manner and grouping by table

   ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name(s):
   **   ~~~   ** - Variable X
   **   ~~~   ** - Variable Y

But this felt like it didn't follow 1) The existing reporting and 2) the general reporting pattern of eplusout.err

Copy link
Member

Choose a reason for hiding this comment

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

This is all fine as-is. I just try to be skeptical of accessing "static" looking things in state that look like they should belong to individual instances of things. Leave it.

src/EnergyPlus/OutputReportTabular.cc Show resolved Hide resolved
Comment on lines 727 to 740
// If no weather file run requested, don't bother issuing a warning
bool issueWarnings = false;
if (state.dataGlobal->DoWeathSim && (state.dataOutRptTab->ErrCount1 > 0)) {
ShowWarningError(state, "Processing Monthly Tabular Reports: Variable names not valid for this simulation");

if (!state.dataGlobal->DisplayExtraWarnings) {
ShowContinueError(state, "...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual variables.");
} else {
ShowContinueError(state,
"..Variables not valid for this simulation will have \"[Invalid/Undefined]\" in the Units Column of "
"the Table Report.");
issueWarnings = 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.

We issue the warning if a weather file run period was requested, by checking DoWeathSim and not KindOfSim

Used to not get the message if you have simulation control set to "Run Simulation for Sizing Periods" + "Run Simulation for Weather File Run Period because when this is called, the KindOfSim is DesignDay. This was what caused #8317 actually.

If DisplayExtraWarnings, print the single "Variables not valid for this simulation will have [Invalid/Undefined]" here because it's more logical that printing it after the first guilty var.

Comment on lines 758 to 760
if (KeyCount == 0 && issueWarnings && !ort->MonthlyInput(TabNum).isNamedMonthly) {
ShowWarningError(
state, format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Print the detail only if it's not a namedMonthlyOne and issueWArnings (= DisplayExtraWarnings + a Weather file run requested)

Comment on lines 918 to 921
if (issueWarnings && !ort->MonthlyInput(TabNum).isNamedMonthly) {
ShowWarningError(
state,
format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same here.

Comment on lines +12763 to +12768
std::string const expected_error = delimited_string({
" ** Warning ** Processing Monthly Tabular Reports: Variable names not valid for this simulation",
" ** ~~~ ** ..Variables not valid for this simulation will have \"[Invalid/Undefined]\" in the Units Column of the Table Report.",
" ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE'",
" ** Warning ** In Output:Table:Monthly 'SPACE GAINS ANNUAL REPORT' invalid Variable or Meter Name 'NON EXISTANT VARIABLE BIS'",
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example of the err stream when you have DisplayExtraWarnings + a weather file run

@jmarrec
Copy link
Contributor Author

jmarrec commented Sep 8, 2023

Using the MCVE on DevSupport. Without DisplayExtraWArnings

image

WithDisplayExtraWarnings, when "Run for Sizing Simulation" + "Run For Weather File"

image

WithDisplayExtraWarnings, when only "Run for Weather File"

image

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@@ -407,7 +407,7 @@ void GetInputTabularMonthly(EnergyPlusData &state)
}
}

int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown)
int AddMonthlyReport(EnergyPlusData &state, std::string const &inReportName, int const inNumDigitsShown, bool isNamedMonthly)
Copy link
Member

Choose a reason for hiding this comment

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

Why not just a local variable?

bool const isNamedMonthly = str.size() >= 7 && 0 == str.compare(0, 7, "Monthly");

JK :)

@@ -613,13 +614,14 @@ void InitializeTabularMonthly(EnergyPlusData &state)
// #ifdef ITM_KEYCACHE
// Noel comment: First time in this TabNum/ColNum loop, let's save the results
// of GetVariableKeyCountandType & GetVariableKeys.
std::string const &curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter);
std::string const curVariMeter = UtilityRoutines::makeUPPER(ort->MonthlyFieldSetInput(FirstColumn + colNum - 1).variMeter);
Copy link
Member

Choose a reason for hiding this comment

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

Yeah we're not really saving anything by creating a reference there, good catch.

Comment on lines +622 to +624
if (!ort->MonthlyInput(TabNum).isNamedMonthly) {
++state.dataOutRptTab->ErrCount1;
}
Copy link
Member

Choose a reason for hiding this comment

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

In a more ideal scenario, would you have a variable tracker on the table object instance itself, and not a generic error counter in state? Just curious, not saying you need to change anything.

int numTables = 0; // number of tables
int firstTable = 0; // pointer to the first table
int showDigits = 0; // the number of digits to be shown
bool isNamedMonthly = false;
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for cleaning up the initializations!

InitializeTabularMonthly(*state);

compare_err_stream("");
}
Copy link
Member

Choose a reason for hiding this comment

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

All good here!

@Myoldmopar
Copy link
Member

This now has a conflict in the unit test. I'll resolve it locally and push it up.

@Myoldmopar
Copy link
Member

Conflict was just that multiple new unit tests were added to that file at the same place. I resolved them and pushed the changes up. Decent CI was all happy with this before resolving the conflict, and I don't have any reason to think that would change now. I'll give GH some time to run basic checks and then merge soon if that's happy.

@Myoldmopar Myoldmopar added this to the EnergyPlus 23.2 milestone Sep 13, 2023
@Myoldmopar Myoldmopar assigned Myoldmopar and unassigned jmarrec Sep 13, 2023
@Myoldmopar
Copy link
Member

I did a quick build/test and it's all happy, merging. Thanks @jmarrec

@Myoldmopar Myoldmopar merged commit eacf319 into develop Sep 14, 2023
10 checks passed
@Myoldmopar Myoldmopar deleted the 9621_WarnOnMissingMonthlyVariable branch September 14, 2023 15:12
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AllSummaryAndMonthly option in Output:Table:SummaryReports prompts many warnings and incomplete reports
7 participants