-
Notifications
You must be signed in to change notification settings - Fork 390
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
Conversation
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
6dc2125
to
c39acff
Compare
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; |
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 a bool to keep track of which is actually a namedMonthly one
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.
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); |
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.
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); |
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 but makeUPPER returns a std::string
, not a reference
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.
Yeah we're not really saving anything by creating a reference there, good catch.
if (!ort->MonthlyInput(TabNum).isNamedMonthly) { | ||
++state.dataOutRptTab->ErrCount1; | ||
} |
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.
Don't warn twice. This is my fault, from #8317
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.
We increment the count here.
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.
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.
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.
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
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.
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.
// 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; | ||
} | ||
} |
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.
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.
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)); |
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.
Print the detail only if it's not a namedMonthlyOne and issueWArnings (= DisplayExtraWarnings + a Weather file run requested)
if (issueWarnings && !ort->MonthlyInput(TabNum).isNamedMonthly) { | ||
ShowWarningError( | ||
state, | ||
format("In Output:Table:Monthly '{}' invalid Variable or Meter Name '{}'", ort->MonthlyInput(TabNum).name, curVariMeter)); |
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.
same here.
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'", | ||
}); |
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.
Example of the err stream when you have DisplayExtraWarnings + a weather file run
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.
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) |
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.
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); |
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.
Yeah we're not really saving anything by creating a reference there, good catch.
if (!ort->MonthlyInput(TabNum).isNamedMonthly) { | ||
++state.dataOutRptTab->ErrCount1; | ||
} |
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.
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; |
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.
Thanks for cleaning up the initializations!
InitializeTabularMonthly(*state); | ||
|
||
compare_err_stream(""); | ||
} |
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.
All good here!
This now has a conflict in the unit test. I'll resolve it locally and push it up. |
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. |
I did a quick build/test and it's all happy, merging. Thanks @jmarrec |
Pull request overview
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.