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 #4786 - Space load-based actuator for spaces are named based on thermal zone name #4828

Merged
merged 10 commits into from Mar 16, 2023

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Mar 15, 2023

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

  • 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 15, 2023
@jmarrec jmarrec requested a review from brianlball March 15, 2023 18:34
@jmarrec jmarrec self-assigned this Mar 15, 2023
Comment on lines +36398 to +36405
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
Copy link
Collaborator Author

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.

src/model/EnergyManagementSystemActuator.hpp Show resolved Hide resolved
@@ -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
Copy link
Collaborator Author

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?

Copy link
Contributor

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?

Copy link
Collaborator Author

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

src/model/EnergyManagementSystemActuator.hpp Show resolved Hide resolved
src/model/EnergyManagementSystemActuator.hpp Show resolved Hide resolved
Comment on lines +230 to +256
// 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 << "'.");
}
Copy link
Collaborator Author

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

src/energyplus/Test/EMS_GTest.cpp Show resolved Hide resolved
src/energyplus/Test/EMS_GTest.cpp Show resolved Hide resolved
src/energyplus/Test/EMS_GTest.cpp Show resolved Hide resolved
src/energyplus/Test/EMS_GTest.cpp Show resolved Hide resolved
Copy link
Contributor

@brianlball brianlball left a 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!

@mdahlhausen
Copy link
Collaborator

Thanks @jmarrec this is helpful! I'll test it out with standards unless Jeremy Lerond beats me to it.

@lymereJ
Copy link

lymereJ commented Mar 15, 2023

Thanks @jmarrec this is helpful! I'll test it out with standards unless Jeremy Lerond beats me to it.

I probably won't, thanks @jmarrec for addressing this quickly!

@jmarrec jmarrec merged commit df82458 into develop Mar 16, 2023
2 checks passed
@jmarrec jmarrec deleted the 4786_EMS_Actuators_Spaces branch March 16, 2023 07:25
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.

Space load-based actuator for spaces are named based on thermal zone name
5 participants