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++; } }
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++; } }
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()); } }