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

Improve weather file handling in OS Workflow #5011

Merged
merged 3 commits into from
Nov 2, 2023

Conversation

kbenne
Copy link
Contributor

@kbenne kbenne commented Oct 31, 2023

Now we make sure to look in the Model for the final weather file defined after all Measures have run.

We also still iniitialize the weather file from the OSW if one is defined.

close #5009

Pull request overview

  • Fixes #ISSUENUMBERHERE (IF THIS IS A DEFECT)

Pull Request Author

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

Now we make sure to look in the Model for the final weather file defined
after all Measures have run.

We also still iniitialize the weather file from the OSW if one is
defined.

close #5009
@kbenne kbenne requested a review from jmarrec October 31, 2023 15:59
@kbenne kbenne self-assigned this Oct 31, 2023
@kbenne
Copy link
Contributor Author

kbenne commented Oct 31, 2023

Here is a workflow that demonstrates the issue.

test_workflow_370rc1.zip

@@ -38,6 +38,8 @@ void OSWorkflow::runTranslator() {
auto runDir = workflowJSON.absoluteRunDir();
OS_ASSERT(openstudio::filesystem::is_directory(runDir));

applyWeatherFileFromModel();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

@jmarrec jmarrec Oct 31, 2023

Choose a reason for hiding this comment

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

I believe you actually need to complete this unfinished block instead:

if (measureType == MeasureType::ModelMeasure) {
if (auto weatherFile_ = model.weatherFile()) {
if (auto p_ = weatherFile_->path()) {
// Probably a workflowJSON.findFile() call...
// m_epwPath_ = p_;
} else {
LOG(Warn, "Weather file object found in model but no path is given");
}
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

IIUC this unfinished block is really where it needs to happen, so any downstream OpenStudio ModelMeasure that needs to use the workflow path via runner.lastEpwFile or whatever will get the right info.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I forgot about Runner::lastEpwFile. But I think it still needs to happen before translation too, because don't we need to account for the fact that the last ModelMeasure could have changed the weather location?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Updating last runner epwfile is done prior to measure run currently. The unfinished code block I link to is supposed to be executed after the measure run.
I'm not against changing what workflow-gem does, but it's 1) easier to Match and 2) clearer and probably 3) less error prone

@DavidGoldwasser DavidGoldwasser merged commit 50ad104 into develop Nov 2, 2023
2 checks passed
@DavidGoldwasser DavidGoldwasser deleted the 5009-osw-weather branch November 2, 2023 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The new (C++ based) OpenStudio workflow fails if weather_file is not defined in the osw
3 participants