| 316 | } |
| 317 | |
| 318 | boost::optional<model::ModelObject> ReverseTranslator::translateSpace(const pugi::xml_node& element, |
| 319 | openstudio::model::BuildingStory& buildingStory) { |
| 320 | pugi::xml_node nameElement = element.child("Name"); |
| 321 | pugi::xml_node hotWtrHtgRtElement = element.child("HotWtrHtgRtSim"); |
| 322 | pugi::xml_node hotWtrHtgSchRefElement = element.child("HotWtrHtgSchRef"); |
| 323 | pugi::xml_node shwFluidSegRefElement = element.child("SHWFluidSegRef"); |
| 324 | pugi::xml_node hotWtrSupTempElement = element.child("HotWtrSupTemp"); |
| 325 | std::vector<pugi::xml_node> exteriorWallElements = makeVectorOfChildren(element, "ExtWall"); |
| 326 | std::vector<pugi::xml_node> exteriorFloorElements = makeVectorOfChildren(element, "ExtFlr"); |
| 327 | std::vector<pugi::xml_node> roofElements = makeVectorOfChildren(element, "Roof"); |
| 328 | std::vector<pugi::xml_node> undergroundFloorElements = makeVectorOfChildren(element, "UndgrFlr"); |
| 329 | std::vector<pugi::xml_node> undergroundWallElements = makeVectorOfChildren(element, "UndgrWall"); |
| 330 | std::vector<pugi::xml_node> ceilingElements = makeVectorOfChildren(element, "Ceiling"); |
| 331 | std::vector<pugi::xml_node> interiorWallElements = makeVectorOfChildren(element, "IntWall"); |
| 332 | std::vector<pugi::xml_node> interiorFloorElements = makeVectorOfChildren(element, "IntFlr"); |
| 333 | |
| 334 | std::string spaceName; |
| 335 | |
| 336 | if (!nameElement) { |
| 337 | LOG(Error, "Spc element 'Name' is missing."); |
| 338 | } else { |
| 339 | std::string name = nameElement.text().as_string(); |
| 340 | if (name.empty()) { |
| 341 | LOG(Error, "Spc element 'Name' is empty."); |
| 342 | } else { |
| 343 | spaceName = escapeName(name); |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | boost::optional<model::Space> space = buildingStory.model().getConcreteModelObjectByName<model::Space>(spaceName); |
| 348 | if (!space) { |
| 349 | LOG(Error, "Could not retrieve Space named '" << spaceName << "'."); |
| 350 | return boost::none; |
| 351 | } |
| 352 | |
| 353 | space->setBuildingStory(buildingStory); |
| 354 | |
| 355 | pugi::xml_node thermalZoneElement = element.child("ThrmlZnRef"); |
| 356 | std::string thermalZoneName; |
| 357 | if (!thermalZoneElement) { |
| 358 | LOG(Error, "Spc element 'ThrmlZnRef' is empty for Space named '" << spaceName << "'."); |
| 359 | } else { |
| 360 | thermalZoneName = escapeName(thermalZoneElement.text().as_string()); |
| 361 | } |
| 362 | |
| 363 | boost::optional<model::ThermalZone> thermalZone = space->model().getConcreteModelObjectByName<model::ThermalZone>(thermalZoneName); |
| 364 | if (thermalZone) { |
| 365 | space->setThermalZone(*thermalZone); |
| 366 | } else { |
| 367 | LOG(Error, "Could not retrieve ThermalZone named '" << thermalZoneName << "'."); |
| 368 | LOG(Error, "ThermalZone not set for Space named '" << spaceName << "'."); |
| 369 | } |
| 370 | |
| 371 | translateLoads(element, *space); |
| 372 | |
| 373 | for (std::vector<pugi::xml_node>::size_type i = 0; i < exteriorWallElements.size(); i++) { |
| 374 | boost::optional<model::ModelObject> surface = translateSurface(exteriorWallElements[i], *space); |
| 375 | if (!surface) { |
nothing calls this directly
no test coverage detected