boost::optional<IdfObject> ForwardTranslator::translatePlantEquipmentOperationHeatingLoad( PlantEquipmentOperationHeatingLoad & modelObject ) { IdfObject idfObject(IddObjectType::PlantEquipmentOperation_HeatingLoad); m_idfObjects.push_back(idfObject); // Name auto name = modelObject.name().get(); idfObject.setName(name); double lowerLimit = modelObject.minimumLowerLimit(); int i = 1; for( auto upperLimit : modelObject.loadRangeUpperLimits() ) { auto equipment = modelObject.equipment(upperLimit); if( ! equipment.empty() ) { auto eg = idfObject.pushExtensibleGroup(); eg.setDouble(PlantEquipmentOperation_HeatingLoadExtensibleFields::LoadRangeLowerLimit,lowerLimit); eg.setDouble(PlantEquipmentOperation_HeatingLoadExtensibleFields::LoadRangeUpperLimit,upperLimit); IdfObject equipmentList(IddObjectType::PlantEquipmentList); m_idfObjects.push_back(equipmentList); auto equipmentListName = name + " equipment list " + std::to_string(i); equipmentList.setName(equipmentListName); eg.setString(PlantEquipmentOperation_HeatingLoadExtensibleFields::RangeEquipmentListName,equipmentListName); for( auto component : equipment ) { // TODO: Find the right way to deal with this // For now, "dirty" (?) fix for Generator:MicroTurbine // @kbenne, FYI boost::optional<IdfObject> idf_component; if (boost::optional<GeneratorMicroTurbineHeatRecovery> mchpHR = component.optionalCast<GeneratorMicroTurbineHeatRecovery>()) { GeneratorMicroTurbine mchp = mchpHR->generatorMicroTurbine(); idf_component = translateAndMapModelObject(mchp); } else { idf_component = translateAndMapModelObject(component); } auto eg2 = equipmentList.pushExtensibleGroup(); OS_ASSERT(idf_component); eg2.setString(PlantEquipmentListExtensibleFields::EquipmentObjectType,idf_component->iddObject().name()); eg2.setString(PlantEquipmentListExtensibleFields::EquipmentName,idf_component->name().get()); } } lowerLimit = upperLimit; ++i; } return idfObject; }
boost::optional<IdfObject> ForwardTranslator::translatePlantEquipmentOperationHeatingLoad( PlantEquipmentOperationHeatingLoad & modelObject ) { IdfObject idfObject(IddObjectType::PlantEquipmentOperation_HeatingLoad); m_idfObjects.push_back(idfObject); // Name auto name = modelObject.name().get(); idfObject.setName(name); double lowerLimit = modelObject.minimumLowerLimit(); int i = 1; for( auto upperLimit : modelObject.loadRangeUpperLimits() ) { auto equipment = modelObject.equipment(upperLimit); if( ! equipment.empty() ) { auto eg = idfObject.pushExtensibleGroup(); eg.setDouble(PlantEquipmentOperation_HeatingLoadExtensibleFields::LoadRangeLowerLimit,lowerLimit); eg.setDouble(PlantEquipmentOperation_HeatingLoadExtensibleFields::LoadRangeUpperLimit,upperLimit); IdfObject equipmentList(IddObjectType::PlantEquipmentList); m_idfObjects.push_back(equipmentList); auto equipmentListName = name + " equipment list " + std::to_string(i); equipmentList.setName(equipmentListName); eg.setString(PlantEquipmentOperation_HeatingLoadExtensibleFields::RangeEquipmentListName,equipmentListName); for( auto component : equipment ) { auto eg2 = equipmentList.pushExtensibleGroup(); auto idf_component = translateAndMapModelObject(component); OS_ASSERT(idf_component); eg2.setString(PlantEquipmentListExtensibleFields::EquipmentObjectType,idf_component->iddObject().name()); eg2.setString(PlantEquipmentListExtensibleFields::EquipmentName,idf_component->name().get()); } } lowerLimit = upperLimit; ++i; } return idfObject; }