-
Notifications
You must be signed in to change notification settings - Fork 208
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 #4786 - Space load-based actuator for spaces are named based on thermal zone name #4828
Conversation
…ore a Space or a ThermalZone in it.
…ce (and vice versa)
…cts, sort them by name, so we're deterministic
A6; \field Zone or Space Name | ||
\note This field is useful for a SpaceLoadInstance that is assigned to a SpaceType | ||
\note because internally E+ will duplicate the instances and you need to access the final name | ||
\note If you are using the Space Translation of the ForwardTranslator (which is defaulted on) this should be set to a Space | ||
\note If not then use a ThermalZone | ||
\type object-list | ||
\object-list AllObjects | ||
\object-list SpaceNames | ||
\object-list ThermalZoneNames |
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.
Constrain this field in the IDD. It will now only accept a Thermal Zone or a Space.
@@ -85,13 +94,17 @@ namespace model { | |||
/** @name Getters */ | |||
//@{ | |||
|
|||
boost::optional<ModelObject> actuatedComponent() const; | |||
boost::optional<ModelObject> actuatedComponent() const; // TODO: this should NOT be an optional |
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.
I didn't want to break API, but this should never have been an optional. Though I suppose the idea is that there's a chance the object it referenced would be deleted, right?
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.
Thats right. what happens if that object gets removed?
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.
You just don't translate it during FT. That can mean having the FT calling an Impl function or in a try catch
In an ideal world, removing à modelobject would mean removing any ems actuator attached, but that's probably a major slow down and we don't want to penalize anyone not using ems
// Not translating Spaces | ||
std::set<std::string> zoneNames; | ||
for (const auto& space : spaceType_->spaces()) { | ||
if (auto tz_ = space.thermalZone()) { | ||
zoneNames.insert(tz_->nameString()); | ||
} | ||
} | ||
if (zoneNames.empty()) { | ||
LOG(Error, "Actuator '" << modelObject.nameString() << "' references a SpaceLoad '" << load_->nameString() | ||
<< "' attached to the SpaceType '" << spaceType_->nameString() | ||
<< "' but the Space Type has zero spaces attached to any Thermal Zones, so it will not be translated."); | ||
return boost::none; | ||
} | ||
zoneOrSpaceName = *(zoneNames.begin()); | ||
if (zoneNames.size() == 1) { | ||
LOG(Warn, "Actuator '" << modelObject.nameString() << "' references a SpaceLoad '" << load_->nameString() << "' attached to the SpaceType '" | ||
<< spaceType_->nameString() | ||
<< "' but you have turned off ForwardTranslation's Space Feature. Falling back to using the attached ThermalZone '" | ||
<< zoneOrSpaceName << "' since there is only 1."); | ||
} else { // if (zoneNames.size() > 1) { | ||
// TODO: do we grab the first space or just don't translate it? | ||
LOG(Error, "Actuator '" << modelObject.nameString() << "' references a SpaceLoad '" << load_->nameString() | ||
<< "' attached to the SpaceType '" << spaceType_->nameString() | ||
<< "' but you have turned off ForwardTranslation's Space Feature. " | ||
"Your SpaceType ends up linked to multiples Thermal Zones. Falling back to using the first Thermal Zone '" | ||
<< zoneOrSpaceName << "'."); | ||
} |
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.
If we are NOT translating spaces.... We construct a std::set of all the found Thermal Zone Names (so it's sorted and unique)
If we can't find any, throw. Otherwise, grab the first one, issue a warning if one only, an error if two or more
c5a08ce
to
045292d
Compare
CI Results for 045292d:
|
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.
this is great work! Thank you!
Thanks @jmarrec this is helpful! I'll test it out with standards unless Jeremy Lerond beats me to it. |
Pull request overview
@mdahlhausen @lymereJ would appreciate a review / testing from you please.
@brianlball I'm tagging you as a reviewer as you're the most familiar with this piece of code, but if you can't review I can ask someone else (@tijcolem for eg)
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.