Skip to content

Commit

Permalink
Fix for bug which resulted in losing building level schedule sets in …
Browse files Browse the repository at this point in the history
…transition between 1.2.2 and 1.2.3
  • Loading branch information
macumber committed Feb 10, 2014
1 parent b458b80 commit a1f5365
Showing 1 changed file with 54 additions and 24 deletions.
78 changes: 54 additions & 24 deletions openstudiocore/src/osversion/VersionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2163,6 +2163,7 @@ std::string VersionTranslator::update_1_2_2_to_1_2_3(const IdfFile& idf_1_2_2, c

boost::optional<int> numberOfStories;
boost::optional<int> numberOfAboveGroundStories;
boost::optional<std::string> buildingTypeValue;
boost::optional<IdfObject> buildingObject;

BOOST_FOREACH(const IdfObject& object,idf_1_2_2.objects()) {
Expand All @@ -2189,6 +2190,15 @@ std::string VersionTranslator::update_1_2_2_to_1_2_3(const IdfFile& idf_1_2_2, c

} else if( object.iddObject().name() == "OS:StandardsInformation:Building" ) {

//Number of Stories
numberOfStories = object.getInt(1);

// Number of Above Ground Stories
numberOfAboveGroundStories = object.getInt(2);

// Building Type Value
buildingTypeValue = object.getString(6);

m_deprecated.push_back(object);

} else {
Expand All @@ -2203,55 +2213,75 @@ std::string VersionTranslator::update_1_2_2_to_1_2_3(const IdfFile& idf_1_2_2, c

// Handle
boost::optional<std::string> s = buildingObject->getString(0);
OS_ASSERT(s);
bool test = newBuildingObject.setString(0, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(0, *s);
OS_ASSERT(test);
}

// Name
s = buildingObject->getString(1);
OS_ASSERT(s);
test = newBuildingObject.setString(1, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(1, *s);
OS_ASSERT(test);
}

// Building Sector Type
s = buildingObject->getString(2);
OS_ASSERT(s);
test = newBuildingObject.setString(2, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(2, *s);
OS_ASSERT(test);
}

// North Axis
s = buildingObject->getString(3);
OS_ASSERT(s);
test = newBuildingObject.setString(3, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(3, *s);
OS_ASSERT(test);
}

// Nominal Floor to Floor Height
s = buildingObject->getString(4);
OS_ASSERT(s);
test = newBuildingObject.setString(4, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(4, *s);
OS_ASSERT(test);
}

// Space Type Name
s = buildingObject->getString(5);
OS_ASSERT(s);
test = newBuildingObject.setString(5, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(5, *s);
OS_ASSERT(test);
}

// Default Schedule Set Name
// Default Construction Set Name
s = buildingObject->getString(6);
OS_ASSERT(s);
test = newBuildingObject.setString(6, *s);
OS_ASSERT(test);
if (s){
bool test = newBuildingObject.setString(6, *s);
OS_ASSERT(test);
}

// Default Schedule Set Name
s = buildingObject->getString(7);
if (s){
bool test = newBuildingObject.setString(7, *s);
OS_ASSERT(test);
}

// Standards Number of Stories
if (numberOfStories){
test = newBuildingObject.setInt(7, *numberOfStories);
bool test = newBuildingObject.setInt(8, *numberOfStories);
OS_ASSERT(test);
}

/// Standards Number of Above Ground Stories
if (numberOfAboveGroundStories){
test = newBuildingObject.setInt(8, *numberOfAboveGroundStories);
bool test = newBuildingObject.setInt(9, *numberOfAboveGroundStories);
OS_ASSERT(test);
}

// Standards Building Type
if (buildingTypeValue){
bool test = newBuildingObject.setString(10, *buildingTypeValue);
OS_ASSERT(test);
}

Expand Down

0 comments on commit a1f5365

Please sign in to comment.