Creates a Space from an FSSpace
| 394 | |
| 395 | // Creates a Space from an FSSpace |
| 396 | void FloorspaceReverseTranslator_Impl::createSpace(const FSSpace& fsEntity, double minZ, double maxZ, SpaceTypeEnum typeOfSpace, |
| 397 | bool openToBelow) { |
| 398 | Space osSpace(m_model); |
| 399 | osSpace.setBuildingStory(*m_currentStory); |
| 400 | osSpace.setName(fsEntity.name() + getPlenumPostfix(typeOfSpace)); |
| 401 | m_currentSpace = osSpace; |
| 402 | |
| 403 | // Make the surfaces/sub-surfaces |
| 404 | createSurfaces(osSpace, fsEntity, minZ, maxZ, typeOfSpace, openToBelow); |
| 405 | |
| 406 | // Do the assignments |
| 407 | // Thermal zones for above floor spaces are already created, here plenum thermal zones will be created |
| 408 | // to associated them with the plenum spaces |
| 409 | if (fsEntity.thermalZone().has_value()) { |
| 410 | std::string zoneName = fsEntity.thermalZone()->name() + getPlenumPostfix(typeOfSpace); |
| 411 | // Space is assigned to a thermal zone |
| 412 | auto zone = m_model.getConcreteModelObjectByName<ThermalZone>(zoneName); |
| 413 | if (!zone) { |
| 414 | // Zone does not yet exist so create it |
| 415 | zone = ThermalZone(m_model); |
| 416 | zone->setName(zoneName); |
| 417 | } |
| 418 | if (zone) { |
| 419 | int multiplier = fsEntity.multiplier(); |
| 420 | // Assign the space to the zone and set the multiplier |
| 421 | if (multiplier == 0) { |
| 422 | LOG(Warn, "Muliplier for Space '" << fsEntity.name() << "' is 0, setting to 1"); |
| 423 | multiplier = 1; |
| 424 | } else if (multiplier > 1) { |
| 425 | LOG(Warn, "Multiplier translation not yet implemented for Space '" << fsEntity.name() << "', setting to 1"); |
| 426 | multiplier = 1; |
| 427 | } |
| 428 | |
| 429 | osSpace.setThermalZone(*zone); |
| 430 | if (zone->spaces().size() == 1) { |
| 431 | zone->setMultiplier(multiplier); |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | // For space type plenum spaces are always added to a space type called 'Plenum Space Type' |
| 437 | // regardless of whether the space is associated with a space type. |
| 438 | if (typeOfSpace == SpaceTypeEnum::ABOVEFLOOR) { |
| 439 | if (fsEntity.spaceType().has_value()) { |
| 440 | // The Space type for the main space will already have been created |
| 441 | auto spaceType = m_model.getConcreteModelObjectByName<SpaceType>(fsEntity.spaceType()->name()); |
| 442 | if (spaceType.has_value()) { |
| 443 | osSpace.setSpaceType(*spaceType); |
| 444 | } |
| 445 | } |
| 446 | } else { |
| 447 | auto spaceType = m_model.getConcreteModelObjectByName<SpaceType>(PLENUMSPACETYPENAME); |
| 448 | // The plenum space type might not exist yet as it is created on demand |
| 449 | if (!spaceType.has_value()) { |
| 450 | spaceType = SpaceType(m_model); |
| 451 | spaceType->setName(PLENUMSPACETYPENAME); |
| 452 | } |
| 453 | if (spaceType) { |
nothing calls this directly
no test coverage detected