-
Notifications
You must be signed in to change notification settings - Fork 195
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 #3314 - GBXML translate spaces etc even if Facility and/or Building aren't instantiated #4000
Conversation
// Facility and Building could not be explicitly instantiated in the model, but the functions still need to be called so that Spaces and surfaces | ||
// are translated. Facility and Building both are UniqueModelObjects, so passing model here as an argument is harmless | ||
boost::optional<pugi::xml_node> translateFacility(const openstudio::model::Model& model, pugi::xml_node& parent); | ||
boost::optional<pugi::xml_node> translateBuilding(const openstudio::model::Model& model, pugi::xml_node& parent); |
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.
Private methods now take model
instead of facility
/ building
. And in there it will conditionally check if there is a facility / building to use or default things.
// `model` is `const`, so we shouldn't call getUniqueModelObject<model::Facility> which will **create** a new object in there. | ||
boost::optional<model::Facility> _facility = model.getOptionalUniqueModelObject<model::Facility>(); | ||
|
||
auto result = parent.append_child("Campus"); | ||
m_translatedObjects[facility.handle()] = result; | ||
std::string name = "Facility"; | ||
|
||
boost::optional<std::string> name = facility.name(); | ||
if (_facility) { | ||
m_translatedObjects[_facility->handle()] = result; | ||
if (auto _s = _facility->name()) { | ||
name = _s.get(); | ||
} | ||
} |
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.
Check if there is an actual explicitly instantiated Facility object to use, otherwise default things.
|
||
// translate surfaces | ||
// TODO: JM 2020-06-18 Why is translateSpace not responsible to call this one? |
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 find it strange that the Surfaces are translated in translateFacility
Pull request overview
Also fix a ReverseTranslator issue that I found where the Material
Roughness
ends up empty.Pull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)src/openstudio_lib/library/OpenStudioPolicy.xml
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.