bool EnergyManagementSystemProgramCallingManager_Impl::addProgram(const EnergyManagementSystemProgram& program) { //add program to end of vector of programs bool result = false; WorkspaceExtensibleGroup group = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); result = group.setPointer(OS_EnergyManagementSystem_ProgramCallingManagerExtensibleFields::ProgramName, program.handle()); return result; }
void ZoneHVACEquipmentList_Impl::setCoolingPriority(const ModelObject & equipment, unsigned priority) { std::vector<ModelObject> equipmentVector = equipmentInCoolingOrder(); OS_ASSERT( std::find(equipmentVector.begin(),equipmentVector.end(),equipment) != equipmentVector.end() ); if( priority > equipmentVector.size() ) priority = equipmentVector.size(); if( priority < 1 ) priority = 1; equipmentVector.erase(std::find(equipmentVector.begin(),equipmentVector.end(),equipment)); equipmentVector.insert(equipmentVector.begin() + (priority - 1),equipment); unsigned newPriority = 1; for( std::vector<ModelObject>::iterator it = equipmentVector.begin(); it != equipmentVector.end(); ++it ) { WorkspaceExtensibleGroup eg = getGroupForModelObject(*it); eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence,newPriority); newPriority++; } }
bool AvailabilityManagerAssignmentList_Impl::addAvailabilityManager(const AvailabilityManager & avm) { WorkspaceExtensibleGroup eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); bool ok = eg.setPointer(OS_AvailabilityManagerAssignmentListExtensibleFields::AvailabilityManagerName, avm.handle()); return ok; }
bool ModelObjectList_Impl::addModelObject(const ModelObject& modelObject ) { WorkspaceExtensibleGroup eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); bool ok = eg.setPointer(OS_ModelObjectListExtensibleFields::ModelObject,modelObject.handle()); if( !ok ) { getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex()); } return ok; }
void ZoneHVACEquipmentList_Impl::removeEquipment(const ModelObject & equipment) { std::vector<ModelObject> coolingVector = equipmentInCoolingOrder(); std::vector<ModelObject> heatingVector = equipmentInHeatingOrder(); std::vector<IdfExtensibleGroup> groups = extensibleGroups(); for( std::vector<IdfExtensibleGroup>::iterator it = groups.begin(); it != groups.end(); ++it ) { boost::optional<WorkspaceObject> wo = it->cast<WorkspaceExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment); OS_ASSERT(wo); if( wo->handle() == equipment.handle() ) { getObject<ModelObject>().eraseExtensibleGroup(it->groupIndex()); break; } } coolingVector.erase(std::find(coolingVector.begin(),coolingVector.end(),equipment)); heatingVector.erase(std::find(heatingVector.begin(),heatingVector.end(),equipment)); unsigned priority = 1; for( std::vector<ModelObject>::iterator it = coolingVector.begin(); it != coolingVector.end(); ++it ) { WorkspaceExtensibleGroup eg = getGroupForModelObject(*it); eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence,priority); priority++; } priority = 1; for( std::vector<ModelObject>::iterator it = heatingVector.begin(); it != heatingVector.end(); ++it ) { WorkspaceExtensibleGroup eg = getGroupForModelObject(*it); eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence,priority); priority++; } }
bool WaterUseConnections_Impl::addWaterUseEquipment(const WaterUseEquipment & waterUseEquipment) { bool result = false; if( waterUseEquipment.model() == model() ) { WorkspaceExtensibleGroup group = getObject<WaterUseConnections>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); group.setPointer(OS_WaterUse_ConnectionsExtensibleFields::WaterUseEquipmentName,waterUseEquipment.handle()); result = true; } return result; }
std::vector<EnergyManagementSystemProgram> EnergyManagementSystemProgramCallingManager_Impl::programs() const { // loop through extensible groups and return vector of programs std::vector<EnergyManagementSystemProgram> result; auto groups = extensibleGroups(); for (const auto & elem : groups) { WorkspaceExtensibleGroup group = elem.cast<WorkspaceExtensibleGroup>(); boost::optional<WorkspaceObject> wo = group.getTarget(OS_EnergyManagementSystem_ProgramCallingManagerExtensibleFields::ProgramName); if (wo){ EnergyManagementSystemProgram program = wo->cast<EnergyManagementSystemProgram>(); result.push_back(program); } } return result; }
boost::optional<EnergyManagementSystemProgram> EnergyManagementSystemProgramCallingManager_Impl::getProgram(unsigned index) const { //return program at index boost::optional<EnergyManagementSystemProgram> result; auto groups = extensibleGroups(); unsigned sizeOfGroup = numExtensibleGroups(); if ((index < sizeOfGroup) && (!groups[index].empty())) { WorkspaceExtensibleGroup group = groups[index].cast<WorkspaceExtensibleGroup>(); boost::optional<WorkspaceObject> wo = group.getTarget(OS_EnergyManagementSystem_ProgramCallingManagerExtensibleFields::ProgramName); if (wo) { EnergyManagementSystemProgram program = wo->cast<EnergyManagementSystemProgram>(); result = program; } } return result; }
bool EnergyManagementSystemProgramCallingManager_Impl::setPrograms(const std::vector<EnergyManagementSystemProgram>& programs) { //add programs to end of vector of programs std::vector<bool> ok(programs.size(), false); bool result = false; for (auto &program : programs) { WorkspaceExtensibleGroup group = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); result = group.setPointer(OS_EnergyManagementSystem_ProgramCallingManagerExtensibleFields::ProgramName, program.handle()); ok.at(OS_EnergyManagementSystem_ProgramCallingManagerExtensibleFields::ProgramName) = result; } //check if all the programs set true result = true; for (size_t i = 0; i<ok.size(); i++) { if (!ok.at(i)) {//ok value is false result = false; //not all values in array are true } } return result; }
void ZoneHVACEquipmentList_Impl::addEquipment(const ModelObject & equipment) { unsigned count = this->equipment().size(); WorkspaceExtensibleGroup eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>(); bool ok = eg.setPointer(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment,equipment.handle()); if( ok ) { eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence,count + 1); eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence,count + 1); } else { getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex()); } }
std::vector<WaterUseEquipment> WaterUseConnections_Impl::waterUseEquipment() const { std::vector<WaterUseEquipment> result; std::vector<IdfExtensibleGroup> groups = extensibleGroups(); for( const auto & elem : groups ) { WorkspaceExtensibleGroup group = elem.cast<WorkspaceExtensibleGroup>(); boost::optional<WorkspaceObject> wo = group.getTarget(OS_WaterUse_ConnectionsExtensibleFields::WaterUseEquipmentName); if( wo ) { WaterUseEquipment equipment = wo->cast<WaterUseEquipment>(); result.push_back(equipment); } } return result; }
OptionalModelObject ReverseTranslator::translateZoneList( const WorkspaceObject & workspaceObject ) { if( workspaceObject.iddObject().type() != IddObjectType::Zone ){ LOG(Error, "WorkspaceObject is not IddObjectType: Zone"); return boost::none; } openstudio::model::SpaceType spaceType( m_model ); OptionalString s = workspaceObject.name(); if(s){ spaceType.setName(*s); } for (const IdfExtensibleGroup& idfGroup : workspaceObject.extensibleGroups()){ WorkspaceExtensibleGroup workspaceGroup = idfGroup.cast<WorkspaceExtensibleGroup>(); OptionalWorkspaceObject target = workspaceGroup.getTarget(0); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<Space>()){ Space space = modelObject->cast<Space>(); if (space.spaceType()){ LOG(Warn, "Overriding previously assigned SpaceType for Space '" << space.name().get() << "'"); } space.setSpaceType(spaceType); } } } } return spaceType; }
void ModelObjectList_Impl::removeModelObject(const ModelObject& modelObject ) { WorkspaceExtensibleGroup eg = getGroupForModelObject(modelObject); getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex()); }
OptionalModelObject ReverseTranslator::translateSizingZone( const WorkspaceObject & workspaceObject ) { boost::optional<WorkspaceObject> target = workspaceObject.getTarget(Sizing_ZoneFields::ZoneorZoneListName); std::vector<ThermalZone> thermalZones; if( target ) { // just one thermal zone boost::optional<ModelObject> mo; if (target->iddObject().type() == IddObjectType::Zone) { mo = translateAndMapWorkspaceObject(target.get()); if( mo ) { if( boost::optional<Space> space = mo->optionalCast<Space>() ) { boost::optional<ThermalZone> thermalZone = space->thermalZone(); if (thermalZone) { thermalZones.push_back(*thermalZone); } } } } else if (target->iddObject().type() == IddObjectType::ZoneList) { // get all thermal zones in zone list for (const IdfExtensibleGroup& idfGroup : target->extensibleGroups()) { WorkspaceExtensibleGroup workspaceGroup = idfGroup.cast<WorkspaceExtensibleGroup>(); OptionalWorkspaceObject owo = workspaceGroup.getTarget(0); if (owo) { mo = translateAndMapWorkspaceObject(owo.get()); if( mo ) { if( boost::optional<Space> space = mo->optionalCast<Space>() ) { boost::optional<ThermalZone> thermalZone = space->thermalZone(); if (thermalZone) { thermalZones.push_back(*thermalZone); } } } } } } } if(thermalZones.empty()) { LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find associated ThermalZone(s)."); return boost::none; } boost::optional<ModelObject> result; for (ThermalZone thermalZone : thermalZones) { // sizing zone is constructed in thermal zone ctor openstudio::model::SizingZone sizingZone = thermalZone.sizingZone(); // return first sizing zone if (!result) { result = sizingZone; } boost::optional<std::string> s; boost::optional<double> value; // ZoneCoolingDesignSupplyAirTemperature value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneCoolingDesignSupplyAirTemperature); if( value ) { sizingZone.setZoneCoolingDesignSupplyAirTemperature(value.get()); } // ZoneHeatingDesignSupplyAirTemperature value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingDesignSupplyAirTemperature); if( value ) { sizingZone.setZoneHeatingDesignSupplyAirTemperature(value.get()); } // ZoneCoolingDesignSupplyAirHumidityRatio value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingDesignSupplyAirHumidityRatio); if( value ) { sizingZone.setZoneHeatingDesignSupplyAirHumidityRatio(value.get()); } // ZoneHeatingDesignSupplyAirHumidityRatio value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingDesignSupplyAirHumidityRatio); if( value ) { sizingZone.setZoneHeatingDesignSupplyAirHumidityRatio(value.get()); } // DesignSpecificationOutdoorAirObjectName target = workspaceObject.getTarget(Sizing_ZoneFields::DesignSpecificationOutdoorAirObjectName); if (target) { OptionalModelObject mo = translateDesignSpecificationOutdoorAir(*target); if (mo) { if (mo->optionalCast<DesignSpecificationOutdoorAir>()) { std::vector<Space> spaces = thermalZone.spaces(); OS_ASSERT(spaces.size() == 1); spaces[0].setDesignSpecificationOutdoorAir(mo->cast<DesignSpecificationOutdoorAir>()); } } } // ZoneHeatingSizingFactor value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneHeatingSizingFactor); if( value ) { sizingZone.setZoneHeatingSizingFactor(value.get()); } // ZoneCoolingSizingFactor value = workspaceObject.getDouble(Sizing_ZoneFields::ZoneCoolingSizingFactor); if( value ) { sizingZone.setZoneCoolingSizingFactor(value.get()); } // CoolingDesignAirFlowMethod s = workspaceObject.getString(Sizing_ZoneFields::CoolingDesignAirFlowMethod); if( s ) { sizingZone.setCoolingDesignAirFlowMethod(s.get()); } // CoolingDesignAirFlowRate value = workspaceObject.getDouble(Sizing_ZoneFields::CoolingDesignAirFlowRate); if( value ) { sizingZone.setCoolingDesignAirFlowRate(value.get()); } // CoolingMinimumAirFlowperZoneFloorArea value = workspaceObject.getDouble(Sizing_ZoneFields::CoolingMinimumAirFlowperZoneFloorArea); if( value ) { sizingZone.setCoolingMinimumAirFlowperZoneFloorArea(value.get()); } // CoolingMinimumAirFlow value = workspaceObject.getDouble(Sizing_ZoneFields::CoolingMinimumAirFlow); if( value ) { sizingZone.setCoolingMinimumAirFlow(value.get()); } // CoolingMinimumAirFlowFraction value = workspaceObject.getDouble(Sizing_ZoneFields::CoolingMinimumAirFlowFraction); if( value ) { sizingZone.setCoolingMinimumAirFlowFraction(value.get()); } // HeatingDesignAirFlowMethod s = workspaceObject.getString(Sizing_ZoneFields::HeatingDesignAirFlowMethod); if( s ) { sizingZone.setHeatingDesignAirFlowMethod(s.get()); } // HeatingDesignAirFlowRate value = workspaceObject.getDouble(Sizing_ZoneFields::HeatingDesignAirFlowRate); if( value ) { sizingZone.setHeatingDesignAirFlowRate(value.get()); } // HeatingMaximumAirFlowperZoneFloorArea value = workspaceObject.getDouble(Sizing_ZoneFields::HeatingMaximumAirFlowperZoneFloorArea); if( value ) { sizingZone.setHeatingMaximumAirFlowperZoneFloorArea(value.get()); } // HeatingMaximumAirFlow value = workspaceObject.getDouble(Sizing_ZoneFields::HeatingMaximumAirFlow); if( value ) { sizingZone.setHeatingMaximumAirFlow(value.get()); } // HeatingMaximumAirFlowFraction value = workspaceObject.getDouble(Sizing_ZoneFields::HeatingMaximumAirFlowFraction); if( value ) { sizingZone.setHeatingMaximumAirFlowFraction(value.get()); } //DesignSpecification_ZoneAirDistribution boost::optional<WorkspaceObject> _designSpecification = workspaceObject.getTarget(Sizing_ZoneFields::DesignSpecificationZoneAirDistributionObjectName); if( _designSpecification ) { // ZoneAirDistributionEffectivenessinCoolingMode value = _designSpecification->getDouble( DesignSpecification_ZoneAirDistributionFields::ZoneAirDistributionEffectivenessinCoolingMode); if( value ) { sizingZone.setDesignZoneAirDistributionEffectivenessinCoolingMode(value.get()); } // ZoneAirDistributionEffectivenessinHeatingMode value = _designSpecification->getDouble( DesignSpecification_ZoneAirDistributionFields::ZoneAirDistributionEffectivenessinHeatingMode); if( value ) { sizingZone.setDesignZoneAirDistributionEffectivenessinHeatingMode(value.get()); } } } return result; }
OptionalModelObject ReverseTranslator::translateAirLoopHVAC( const WorkspaceObject & workspaceObject ) { if( workspaceObject.iddObject().type() != IddObjectType::AirLoopHVAC ) { LOG(Error, "WorkspaceObject is not IddObjectType: AirLoopHVAC"); return boost::none; } OptionalModelObject result; boost::optional<double> val; boost::optional<std::string> optionalString; Workspace _workspace = workspaceObject.workspace(); openstudio::model::AirLoopHVAC airLoopHVAC( m_model ); boost::optional<std::string> supplyInletNodeName = workspaceObject.getString(AirLoopHVACFields::SupplySideInletNodeName); boost::optional<std::string> supplyOutletNodeName = workspaceObject.getString(AirLoopHVACFields::SupplySideOutletNodeNames); boost::optional<std::string> demandInletNodeName = workspaceObject.getString(AirLoopHVACFields::DemandSideInletNodeNames); boost::optional<std::string> demandOutletNodeName = workspaceObject.getString(AirLoopHVACFields::DemandSideOutletNodeName); Node supplyInletNode = airLoopHVAC.supplyInletNode(); Node supplyOutletNode = airLoopHVAC.supplyOutletNode(); Node demandInletNode = airLoopHVAC.demandInletNode(); Node demandOutletNode = airLoopHVAC.demandOutletNode(); if( supplyInletNodeName ) { supplyInletNode.setName(supplyInletNodeName.get()); } if( supplyOutletNodeName ) { supplyOutletNode.setName(supplyOutletNodeName.get()); } if( demandInletNodeName ) { demandInletNode.setName(demandInletNodeName.get()); } if( demandOutletNodeName ) { demandOutletNode.setName(demandOutletNodeName.get()); } optionalString = workspaceObject.getString(AirLoopHVACFields::Name); if( optionalString ) { airLoopHVAC.setName(optionalString.get()); } optionalString = workspaceObject.getString(AirLoopHVACFields::DesignSupplyAirFlowRate); if( optionalString && istringEqual(optionalString.get(),"AutoSize") ) { airLoopHVAC.autosizeDesignSupplyAirFlowRate(); } else if( (val = workspaceObject.getDouble(AirLoopHVACFields::DesignSupplyAirFlowRate)) ) { airLoopHVAC.setDesignSupplyAirFlowRate(val.get()); } // Go find the supply branch. // Currently only supporting one supply branch. // Dual ducts are not supported. OptionalWorkspaceObject _supplyBranchList; OptionalWorkspaceObject _supplyBranch; _supplyBranchList = workspaceObject.getTarget(AirLoopHVACFields::BranchListName); if( _supplyBranchList ) { _supplyBranch = _supplyBranchList->getExtensibleGroup(0).cast<WorkspaceExtensibleGroup>().getTarget(BranchListExtensibleFields::BranchName); if( ! _supplyBranch ) { LOG(Error, _supplyBranchList->briefDescription() << ": Missing supply branch"); } else { // March through the equipment on the supply branch and convert them. for( unsigned i = 0; ! _supplyBranch->getExtensibleGroup(i).empty(); i++ ) { WorkspaceExtensibleGroup eg = _supplyBranch->getExtensibleGroup(i).cast<WorkspaceExtensibleGroup>(); boost::optional<std::string> componentName = eg.getString(BranchExtensibleFields::ComponentName); boost::optional<std::string> componentType = eg.getString(BranchExtensibleFields::ComponentObjectType); boost::optional<std::string> componentInletNodeName = eg.getString(BranchExtensibleFields::ComponentInletNodeName); boost::optional<std::string> componentOutletNodeName = eg.getString(BranchExtensibleFields::ComponentOutletNodeName); boost::optional<WorkspaceObject> wo; OptionalNode node; OptionalModelObject targetModelObject; if( componentName && (componentName.get() != "") && componentType && (componentType.get() != "") ) { IddObjectType iddType(componentType.get()); wo = _workspace.getObjectByTypeAndName(iddType,componentName.get()); } if( wo ) { targetModelObject = translateAndMapWorkspaceObject( wo.get() ); if( !targetModelObject) { LOG(Error, "Error importing object: " << wo->briefDescription() ); continue; } if( OptionalHVACComponent hvacComponent = targetModelObject->optionalCast<HVACComponent>() ) { Node node = airLoopHVAC.supplyOutletNode(); if( hvacComponent->addToNode(node) ) { if( boost::optional<StraightComponent> straightComponent = hvacComponent->optionalCast<StraightComponent>() ) { Node outletNode = straightComponent->outletModelObject()->cast<Node>(); Node inletNode = straightComponent->inletModelObject()->cast<Node>(); if( componentOutletNodeName ) { outletNode.setName(componentOutletNodeName.get()); } if( componentInletNodeName ) { inletNode.setName(componentInletNodeName.get()); } } else if( boost::optional<AirLoopHVACOutdoorAirSystem> oaSystem = hvacComponent->optionalCast<AirLoopHVACOutdoorAirSystem>() ) { Node outletNode = oaSystem->mixedAirModelObject()->cast<Node>(); Node inletNode = oaSystem->returnAirModelObject()->cast<Node>(); if( componentOutletNodeName ) { outletNode.setName(componentOutletNodeName.get()); } if( componentInletNodeName ) { inletNode.setName(componentInletNodeName.get()); } } } } } else { LOG(Error, _supplyBranch->briefDescription() << ": Missing object listed at ComponentName " << i); } } } } else { LOG( Error, workspaceObject.briefDescription() << ": Missing supply branch list, " << "Supply equipment will be incomplete"); } // March through the zone on the demand side and add branches for them. if( demandOutletNodeName ) { // Find the zone mixer for this air loop std::vector<WorkspaceObject> _airLoopHVACZoneMixers; _airLoopHVACZoneMixers = workspaceObject.workspace().getObjectsByType(IddObjectType::AirLoopHVAC_ZoneMixer); boost::optional<WorkspaceObject> _airLoopHVACZoneMixer; for( const auto & elem : _airLoopHVACZoneMixers ) { boost::optional<std::string> mixerOutletNodeName; mixerOutletNodeName = elem.getString(AirLoopHVAC_ZoneMixerFields::OutletNodeName); if( mixerOutletNodeName && mixerOutletNodeName.get() == demandOutletNodeName.get() ) { _airLoopHVACZoneMixer = elem; break; } } if( _airLoopHVACZoneMixer ) { for( int i = 2; _airLoopHVACZoneMixer->getString(i); i++ ) { std::vector<WorkspaceObject> _zoneHVACEquipmentConnections; std::string mixerInletNodeName = _airLoopHVACZoneMixer->getString(i).get(); _zoneHVACEquipmentConnections = _workspace.getObjectsByType(IddObjectType::ZoneHVAC_EquipmentConnections); for( const auto & _zoneHVACEquipmentConnection : _zoneHVACEquipmentConnections ) { OptionalString returnAirNodeName = _zoneHVACEquipmentConnection.getString(ZoneHVAC_EquipmentConnectionsFields::ZoneReturnAirNodeName); OptionalString inletAirNodeName = _zoneHVACEquipmentConnection.getString(ZoneHVAC_EquipmentConnectionsFields::ZoneAirInletNodeorNodeListName); OptionalString zoneName = _zoneHVACEquipmentConnection.getString(ZoneHVAC_EquipmentConnectionsFields::ZoneName); OptionalString zoneEquipListName = _zoneHVACEquipmentConnection.getString(ZoneHVAC_EquipmentConnectionsFields::ZoneConditioningEquipmentListName); OptionalWorkspaceObject _zone; OptionalWorkspaceObject _zoneEquipmentList; OptionalWorkspaceObject _zoneEquipment; OptionalWorkspaceObject _airTerminal; if( returnAirNodeName && returnAirNodeName.get() == mixerInletNodeName && zoneName && zoneEquipListName ) { _zone = _workspace.getObjectByTypeAndName(IddObjectType::Zone,*zoneName); _zoneEquipmentList = _workspace.getObjectByTypeAndName(IddObjectType::ZoneHVAC_EquipmentList,zoneEquipListName.get()); if( ! _zone ) { LOG( Error, airLoopHVAC.briefDescription() << " is connected to a zone that does not exist." ); break; } if( ! _zoneEquipmentList ) { LOG( Error, _zone->briefDescription() << " does not have a zone equipment list, but it is attached to a loop." ); break; } for( int j = 1; (optionalString = _zoneEquipmentList->getString(j)); j = j + 4 ) { boost::optional<std::string> zoneEquipmentName = _zoneEquipmentList->getString(j+1) ; // Possible Zone Equipment // // ZoneHVAC:AirDistributionUnit // AirTerminal:SingleDuct:Uncontrolled // ZoneHVAC:EnergyRecoveryVentilator // ZoneHVAC:FourPipeFanCoil // ZoneHVAC:OutdoorAirUnit // ZoneHVAC:PackagedTerminalAirConditioner // ZoneHVAC:PackagedTerminalHeatPump // ZoneHVAC:UnitHeater // ZoneHVAC:UnitVentilator // ZoneHVAC:VentilatedSlab // ZoneHVAC:WaterToAirHeatPump // ZoneHVAC:WindowAirConditioner // ZoneHVAC:Baseboard:RadiantConvective:Electric // ZoneHVAC:Baseboard:RadiantConvective:Water // ZoneHVAC:Baseboard:RadiantConvective:Steam // ZoneHVAC:Baseboard:Convective:Electric // ZoneHVAC:Baseboard:Convective:Water // ZoneHVAC:HighTemperatureRadiant // ZoneHVAC:LowTemperatureRadiant:VariableFlow // ZoneHVAC:LowTemperatureRadiant:ConstantFlow // ZoneHVAC:LowTemperatureRadiant:Electric // ZoneHVAC:Dehumidifier:DX // ZoneHVAC:IdealLoadsAirSystem // Fan:ZoneExhaust // WaterHeater:HeatPump // if( zoneEquipmentName ) { if( istringEqual(optionalString.get(),"AirTerminal:SingleDuct:Uncontrolled") ) { _airTerminal = _workspace.getObjectByTypeAndName(IddObjectType::AirTerminal_SingleDuct_Uncontrolled,zoneEquipmentName.get()); break; } else if( istringEqual(optionalString.get(),"ZoneHVAC:AirDistributionUnit") ) { boost::optional<WorkspaceObject> _airDistributionUnit = _workspace.getObjectByTypeAndName(IddObjectType::ZoneHVAC_AirDistributionUnit,zoneEquipmentName.get()); if( _airDistributionUnit ) { boost::optional<std::string> airUnitName; boost::optional<std::string> airUnitType; airUnitType = _airDistributionUnit->getString(ZoneHVAC_AirDistributionUnitFields::AirTerminalObjectType); airUnitName = _airDistributionUnit->getString(ZoneHVAC_AirDistributionUnitFields::AirTerminalName); if( airUnitName && airUnitType ) { _airTerminal = _workspace.getObjectByTypeAndName(IddObjectType(airUnitType.get()),airUnitName.get()); } } break; } } } OptionalModelObject airTerminalModelObject; OptionalSpace space; OptionalStraightComponent straightComponent; OptionalThermalZone thermalZone; if( _airTerminal ) { airTerminalModelObject = translateAndMapWorkspaceObject( _airTerminal.get() ); } if( _zone ) { if( OptionalModelObject mo = translateAndMapWorkspaceObject( _zone.get() ) ) { space = mo->optionalCast<Space>(); } } if( space ) { thermalZone = space->thermalZone(); } if( airTerminalModelObject ) { straightComponent = airTerminalModelObject->optionalCast<StraightComponent>(); } bool success = false; if( straightComponent && thermalZone ) { success = airLoopHVAC.addBranchForZone(thermalZone.get(),straightComponent.get()); } else if( thermalZone ) { Model m; success = airLoopHVAC.addBranchForZone(thermalZone.get(),boost::none); } if( success ) { if( inletAirNodeName ) { thermalZone->inletPortList().airLoopHVACModelObject()->cast<Node>().setName(inletAirNodeName.get()); } if( returnAirNodeName ) { thermalZone->returnAirModelObject()->cast<Node>().setName(returnAirNodeName.get()); } } } } } } } return airLoopHVAC; }