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

Addresses #3784, add methods to edit SummaryReports in OpenStudio SDK #3882

Closed
wants to merge 32 commits into from

Conversation

joseph-robertson
Copy link
Collaborator

@joseph-robertson joseph-robertson commented Feb 18, 2020

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.

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Checked behavior in OpenStudioApplication, adjusted policies as needed (src/openstudio_lib/library/OpenStudioPolicy.xml)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • 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

@joseph-robertson joseph-robertson added the Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. label Feb 19, 2020
@joseph-robertson joseph-robertson marked this pull request as ready for review February 19, 2020 23:20
@kbenne
Copy link
Contributor

kbenne commented Feb 24, 2020

@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?

@joseph-robertson
Copy link
Collaborator Author

@kbenne That's a good question. What's the name of the reporting measure, and where can it be found?

@jmarrec
Copy link
Collaborator

jmarrec commented Feb 25, 2020

@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 nrel_published in fact.

Copy link
Collaborator

@jmarrec jmarrec left a 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

Comment on lines -4525 to -4528
IdfObject outputTableSummaryReport(IddObjectType::Output_Table_SummaryReports);
IdfExtensibleGroup eg = outputTableSummaryReport.pushExtensibleGroup();
eg.setString(Output_Table_SummaryReportsExtensibleFields::ReportName,"AllSummary");
m_idfObjects.push_back(outputTableSummaryReport);
Copy link
Collaborator

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

// ensure that output table summary reports exists
boost::optional<model::OutputTableSummaryReports> summaryReports = model.getOptionalUniqueModelObject<model::OutputTableSummaryReports>();
if (!summaryReports){
summaryReports = model.getUniqueModelObject<model::OutputTableSummaryReports>();
Copy link
Collaborator

@jmarrec jmarrec Feb 25, 2020

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");

Copy link
Collaborator

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");
Copy link
Collaborator

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;
}

Copy link
Collaborator

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

src/model/test/OutputTableSummaryReports_GTest.cpp Outdated Show resolved Hide resolved
// change some of the fields
outputTableSummaryReports.addSummaryReport("ClimaticDataSummary");

// clone it into the same model
Copy link
Collaborator

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());
Copy link
Collaborator

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"

@jmarrec
Copy link
Collaborator

jmarrec commented Feb 25, 2020

@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 validReportNameValues and reportNameValues to return the \choices. (perhaps you'll want to change the name to summaryReportValues to match the API naming you chose, I just used the E+ IDD field name like in most cases)

@joseph-robertson
Copy link
Collaborator Author

This PR needs to wait on a fix to cloning unique model objects.

@jmarrec @kbenne

@tijcolem tijcolem mentioned this pull request Mar 12, 2020
@joseph-robertson joseph-robertson deleted the issue-3784 branch March 16, 2020 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Model Enhancement Request Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. severity - Normal Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add methods to edit SummaryReports in OpenStudio SDK
3 participants