-
Notifications
You must be signed in to change notification settings - Fork 193
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
Conversation
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; |
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.
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
CI Results for 6374961:
|
@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.
|
Run zone, sytem, and plant sizing due to avoid error due to changes from NREL/OpenStudio#5118
Explicitly run zone, system, and plant sizing due to changes in NREL/OpenStudio#5118
Pull request overview
Fixes SimulationControl choices not translating to E+ #1472
We always respect a value that the user has picked
When defaulted, the smart default is in the model object itself
@kbenne does that make sense to you?
Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.