-
Notifications
You must be signed in to change notification settings - Fork 208
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
Addresses #3784, add methods to edit SummaryReports in OpenStudio SDK #3882
Conversation
@DavidGoldwasser and @joseph-robertson is there any possibility that this feature could accidentally break the reporting measure? Could a user turn off certain summary reports that the reporting measure might need? |
@kbenne That's a good question. What's the name of the reporting measure, and where can it be found? |
@joseph-robertson https://github.com/NREL/OpenStudio-measures/tree/develop/nrel_published/openstudio_results Probably a good idea to run the entire test-suite on |
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.
Thorough PR @joseph-robertson!
Most of my review comments are really minor things.
The real comment is to adjust the default behavior of adding "AllSummary" (I think user should be able to disable all reports), in addition to testing with the reporting measure.
This should receive an OpenStudio-resources tests, along with the OutputDiagnostics etc: added it in issue NREL/OpenStudio-resources#94
IdfObject outputTableSummaryReport(IddObjectType::Output_Table_SummaryReports); | ||
IdfExtensibleGroup eg = outputTableSummaryReport.pushExtensibleGroup(); | ||
eg.setString(Output_Table_SummaryReportsExtensibleFields::ReportName,"AllSummary"); | ||
m_idfObjects.push_back(outputTableSummaryReport); |
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 will break backward compatibility in its current form. cf comment on line 558
src/energyplus/ForwardTranslator.cpp
Outdated
// ensure that output table summary reports exists | ||
boost::optional<model::OutputTableSummaryReports> summaryReports = model.getOptionalUniqueModelObject<model::OutputTableSummaryReports>(); | ||
if (!summaryReports){ | ||
summaryReports = model.getUniqueModelObject<model::OutputTableSummaryReports>(); |
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.
To maintain backward compat, either OutputTableSummaryReports
needs to have it's Ctor directly call addSummaryReport("AllSummary")
or you need to do it here by adding a line after 561 summaryReports.addSummaryReport("AllSummary");
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.
I now see you actually do that in the FT translateOutputTableSumaryReports
method, but I like that less, see comments over there too.
} | ||
} else { | ||
auto eg = idfObject.pushExtensibleGroup(); | ||
eg.setString(Output_Table_SummaryReportsExtensibleFields::ReportName, "AllSummary"); |
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.
I see you actually handle the case where we create a default one in FT here. I'd prefer doing it in ForwardTranslator.cpp#L558 (or model API), so the user can choose to manually instantiate an OutputTableSummaryReports
and actually disable all outputs instead of ending with "AllSummary" anyways.
LOG(Error, "WorkspaceObject is not IddObjectType: OutputTableSummaryReports"); | ||
return boost::none; | ||
} | ||
|
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.
Perhaps worth checking if it actually has reports, if not return and don't create one? (minor comment...)
// change some of the fields | ||
outputTableSummaryReports.addSummaryReport("ClimaticDataSummary"); | ||
|
||
// clone it into the same model |
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.
Cloning a Unique model object?
// clone it into a different model | ||
Model model2; | ||
OutputTableSummaryReports outputTableSummaryReportsClone2 = outputTableSummaryReports.clone(model2).cast<OutputTableSummaryReports>(); | ||
ASSERT_EQ(1, outputTableSummaryReportsClone2.numberofSummaryReports()); |
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 a unique model object. What happens if model2
already has one instantiated? (I never thought of that...)
Also, probably test if the report is "ClimaticDataSummary"
@joseph-robertson I made a few trivial changes and "resolved" my review comments above accordingly to clean up the review and focus on the important stuff. I also added two synonym methods |
(Adding tests for all these objects in NREL/OpenStudio-resources#94 at the same time)
Pull request overview
Please read OpenStudio Pull Requests to better understand the OpenStudio Pull Request protocol.
Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)src/openstudio_lib/library/OpenStudioPolicy.xml
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.