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 #1472 - Respect user's SimulationControl choices and move smart defaults to the modelObject #5118

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Mar 22, 2024

Pull request overview

  • Fixes SimulationControl choices not translating to E+ #1472

  • We always respect a value that the user has picked

    • I don't care if this means that the E+ simulation will crash. It's going to be clear that's the problem
    • I do issue a Warning if the user has deliberately picked "No" but it looks like it should be enabled
  • When defaulted, the smart default is in the model object itself

@kbenne does that make sense to you?

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

@jmarrec jmarrec added component - Model component - IDF Translation Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Mar 22, 2024
@jmarrec jmarrec self-assigned this Mar 22, 2024
@jmarrec jmarrec requested a review from kbenne March 22, 2024 10:01
Comment on lines 181 to +211
bool SimulationControl_Impl::doZoneSizingCalculation() const {
boost::optional<std::string> value = getString(OS_SimulationControlFields::DoZoneSizingCalculation, true);
OS_ASSERT(value);
return openstudio::istringEqual(value.get(), "Yes");

auto shouldItBeOn = [this]() -> bool {
const auto m = model();
const auto hasSizingPeriods = !m.getModelObjects<SizingPeriod>().empty();
if (!hasSizingPeriods) {
return false;
}

const auto zones = m.getConcreteModelObjects<ThermalZone>();
const auto hasZoneEquipment = std::any_of(zones.cbegin(), zones.cend(), [](const auto& z) { return !z.equipment().empty(); });

return hasZoneEquipment;
};

if (!isDoZoneSizingCalculationDefaulted()) {
boost::optional<std::string> value = getString(OS_SimulationControlFields::DoZoneSizingCalculation, true);
OS_ASSERT(value);
const auto result = openstudio::istringEqual(value.get(), "Yes");
if (!result && shouldItBeOn()) {
LOG(Warn, "You have zonal equipment and design days, it's possible you should enable SimulationControl::DoZoneSizingCalculation");
}
return result;
}

const auto result = shouldItBeOn();
if (result) {
LOG(Debug, "You have zonal equipment and design days, and SimulationControl::DoZoneSizingCalculation is defaulted: turning on.");
}

return result;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Example with doZoneSizing: the model object has smart logic.

  • If not defaulted, but we think it should be on: warn
  • If defaulted, we check whether we think it should be on. If so, since this is the opposite of the IDD default, we issue a Debug message explaining why we picked it

@kbenne
Copy link
Contributor

kbenne commented Apr 1, 2024

@jmarrec I like the principles that you laid out and I expect that most other people will too. I think this is a good pattern to use as much as we can.

  • We always respect a value that the user has picked, even if the E+ simulation will crash.
  • Issue a Warning if the user has deliberately picked a value that will result in EnergyPlus crashing.
  • When defaulted, the smart default is in the model object itself

@joseph-robertson joseph-robertson added this to the OpenStudio SDK 3.8.0 milestone Apr 2, 2024
@kbenne kbenne merged commit 2d5ba97 into develop Apr 5, 2024
4 of 6 checks passed
@kbenne kbenne deleted the 1472_SimulationControl_Choices branch April 5, 2024 20:37
mdahlhausen added a commit to NREL/openstudio-standards that referenced this pull request Apr 18, 2024
Run zone, sytem, and plant sizing due to avoid error due to changes from NREL/OpenStudio#5118
mdahlhausen added a commit to NREL/openstudio-standards that referenced this pull request Apr 18, 2024
Explicitly run zone, system, and plant sizing due to changes in NREL/OpenStudio#5118
jmarrec added a commit to NREL/OpenStudio-resources that referenced this pull request May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - IDF Translation component - Model 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.

SimulationControl choices not translating to E+
4 participants