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 #1675 - ForwardTranslate WaterHeater:Mixed when not on loop but has Peak Use Flow Rate (standalone operation) #4011

Merged
merged 9 commits into from
Aug 14, 2020

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Jul 1, 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

@jmarrec jmarrec added component - HVAC component - IDF Translation Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Jul 1, 2020
@jmarrec jmarrec self-assigned this Jul 1, 2020
…dule is actually required for standalone operation
@jmarrec jmarrec requested a review from kbenne July 1, 2020 15:06
Comment on lines 3604 to 3607
// If using a plantLoop, this will be translated by the PlantLoop. But WaterHeaters can also be used stand-alone, so always translate them
// We'll check in their FT if the "Peak Use Flow Rate" is actually initialized as it's an indication that the WH was
result.push_back(OS_WaterHeater_Mixed);
result.push_back(OS_WaterHeater_Stratified);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Always translate them...

Comment on lines 61 to 65
if (!modelObject.plantLoop() && !(modelObject.peakUseFlowRate() && modelObject.useFlowRateFractionSchedule()) ) {
LOG(Warn, modelObject.briefDescription() << " will not be translated as it not on a PlantLoop, and it does not have both a Peak Use Flow Rate "
"and a Use Flow Rate Fraction Schedule which is a required condition for stand-alone operation");
return boost::none;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BUT do not actually translate them to IDF if either:

  • On a PlantLoop
  • has both the peakUseFlowRate set (optional double) and the useFlowRateFractionSchedule (optional schedule).

Technically I think we could do without the useFlowRateFractionSchedule but whatever, it is desired here I think, as it'll avoid people setting the flow rate by mistake (in OS App for eg...) and ending up with "hidden" standalone heaters if they get orphaned from a plantloop.

E+ source shows that no severe will be issued if schedule not specified while standalone operation, and it basically amounts to using an Unity schedule:

https://github.com/NREL/EnergyPlus/blob/68c51b98f26f703a0f7b92ac7c30a18f8a526313/src/EnergyPlus/WaterThermalTanks.cc#L2577-L2586

https://github.com/NREL/EnergyPlus/blob/68c51b98f26f703a0f7b92ac7c30a18f8a526313/src/EnergyPlus/WaterThermalTanks.cc#L5969-L5987

@kbenne

typo
@jmarrec jmarrec force-pushed the 1675_WaterHeater_Standalone branch from 394bdf8 to 0b78791 Compare July 1, 2020 15:14
@kbenne
Copy link
Contributor

kbenne commented Aug 10, 2020

@jmarrec I'm seeing this from the CI

/Users/jenkins/git/OpenStudioIncremental/develop/src/energyplus/Test/WaterHeaterMixed_GTest.cpp:64:19: note: in instantiation of template class 'boost::optional<openstudio::model::Schedule>' requested here
  EXPECT_FALSE(wh.useFlowRateFractionSchedule());

Which I think normally indicates a missing #include <Foo_Impl> Schedule_Impl in this case probably. Can you take a look?

@jmarrec
Copy link
Collaborator Author

jmarrec commented Aug 10, 2020

@jmarrec I'm seeing this from the CI

/Users/jenkins/git/OpenStudioIncremental/develop/src/energyplus/Test/WaterHeaterMixed_GTest.cpp:64:19: note: in instantiation of template class 'boost::optional<openstudio::model::Schedule>' requested here
  EXPECT_FALSE(wh.useFlowRateFractionSchedule());

Which I think normally indicates a missing #include <Foo_Impl> Schedule_Impl in this case probably. Can you take a look?

Thanks @kbenne I think I just forgot to include Schedule.hpp. I pushed a fix, we'll see what CI reports.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Aug 11, 2020

@kbenne I have a failing test and I cannot understand why.

From the Gtest itself, waterHeater.plantLoop() is perfectly true as it should.

EXPECT_TRUE(waterHeater.plantLoop());

Yet when I reach the FT, it is false?!?

if (!(modelObject.plantLoop() || (modelObject.peakUseFlowRate() && modelObject.useFlowRateFractionSchedule()))) {

[ RUN      ] EnergyPlusFixture.ForwardTranslatorGeneratorMicroTurbine_ELCD_Orphan
[BOOST_ASSERT] <2> Assertion idf_component failed on line 106 of boost::optional<openstudio::IdfObject> openstudio::energyplus::ForwardTranslator::translatePlantEquipmentOperationHeatingLoad(openstudio::model::PlantEquipmentOperationHeatingLoad&) in file /home/julien/Software/Others/OpenStudio/src/energyplus/ForwardTranslator/ForwardTranslatePlantEquipmentOperationHeatingLoad.cpp.
openstudio_energyplus_tests: /home/julien/Software/Others/OpenStudio/src/energyplus/Test/../../model/../utilities/core/Assert.hpp:61: void boost::assertion_failed(const char*, const char*, const char*, long int): Assertion `false' failed.
[1/1] EnergyPlusFixture.ForwardTranslatorGeneratorMicroTurbine_ELCD_Orphan returned/aborted with exit code -6 (402 ms)
FAILED TESTS (1/1):
     402 ms: Products/openstudio_energyplus_tests EnergyPlusFixture.ForwardTranslatorGeneratorMicroTurbine_ELCD_Orphan
Built branch '1675_WaterHeater_Standalone' in 1min7s, tests ran in 0min6s

@jmarrec
Copy link
Collaborator Author

jmarrec commented Aug 12, 2020

Linux and Mac are happy, the ECLD_Orphan test now passes with the fix. Thanks @kbenne for helping me find the needle in the haystack.

This is ready to drop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - HVAC component - IDF Translation Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WaterHeater:Mixed not forward translated when not on loop
3 participants