-
Notifications
You must be signed in to change notification settings - Fork 198
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 #4166 - Merging FloorSpaceJS can delete unique model Objects such as Facility, Building, Site (and children) #4245
Conversation
…pacejson( north axis) is overriding the original model
if ((iddObjectType == IddObjectType::OS_Site) || (iddObjectType == IddObjectType::OS_Facility) | ||
|| (iddObjectType == IddObjectType::OS_Building)) { | ||
// These are unique objects, so no need to delete them | ||
continue; | ||
} else { | ||
currenObject.remove(); | ||
} |
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.
Actual fix in ModelMerge::mergeModels
. This works because getCurrentModelObject
will grab them just fine, and the mergeSite / mergeFacility will deal with it gracefully, only overriding stuff coming from new_Model if it isn't defaulted.
I think this is functionally equivalent to < 3.1.0, and still works when the floorspace comes up with a northAxis for eg
std::map<UUID, UUID> handleMapping; | ||
mm.mergeModels(model1, model2, handleMapping); | ||
|
||
ASSERT_TRUE(model1.getOptionalUniqueModelObject<ClimateZones>()); |
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 line fails before fix. This is the MCVE that exhibits the issue present in #4166
|
||
// Start with a base model, put some climate zone in there | ||
// Add a Climate Zone to model1 only |
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 test is a bit more involved than the ModelMerger test: it loads a floorspace.json and will also check that the mapping of things like north_axis actually ends up in the model.
Building building = model.getUniqueModelObject<Building>(); | ||
EXPECT_TRUE(building.setNominalFloortoFloorHeight(2.5)); |
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.
My building has a building, and it has a NominalFloorToFloorHeight.
EXPECT_FALSE(newModel_->getOptionalUniqueModelObject<ClimateZones>()); | ||
|
||
EXPECT_EQ(0.0, building.northAxis()); | ||
EXPECT_EQ(2.5, building.nominalFloortoFloorHeight()); | ||
|
||
ASSERT_TRUE(newModel_->getOptionalUniqueModelObject<Building>()); | ||
EXPECT_EQ(-30.0, newModel_->getOptionalUniqueModelObject<Building>()->northAxis()); | ||
EXPECT_FALSE(newModel_->getOptionalUniqueModelObject<Building>()->nominalFloortoFloorHeight()); |
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.
Prior merge
ASSERT_TRUE(model.getOptionalUniqueModelObject<Building>()); | ||
EXPECT_EQ(-30.0, model.getOptionalUniqueModelObject<Building>()->northAxis()); | ||
ASSERT_TRUE(model.getOptionalUniqueModelObject<Building>()->nominalFloortoFloorHeight()); | ||
EXPECT_EQ(2.5, model.getOptionalUniqueModelObject<Building>()->nominalFloortoFloorHeight()); | ||
|
||
// New Model isn't touched anyways... | ||
ASSERT_TRUE(newModel_->getOptionalUniqueModelObject<Building>()); | ||
EXPECT_EQ(-30.0, newModel_->getOptionalUniqueModelObject<Building>()->northAxis()); | ||
EXPECT_FALSE(newModel_->getOptionalUniqueModelObject<Building>()->nominalFloortoFloorHeight()); |
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.
post merge:
model | new_model (floorspace) | Merged: expected | |
---|---|---|---|
Building Axis | 0 | -30 | -30 |
nominalFloortoFloorHeight | 2.5 | NaN | 2.5 |
CI Results for 1244c95:
|
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.
Looks good, although did see Incremental Windows Build is failing.
@DavidGoldwasser Windows has a unit test failure |
Pull request overview
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.