这篇教程C++ translateAndMapWorkspaceObject函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中translateAndMapWorkspaceObject函数的典型用法代码示例。如果您正苦于以下问题:C++ translateAndMapWorkspaceObject函数的具体用法?C++ translateAndMapWorkspaceObject怎么用?C++ translateAndMapWorkspaceObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了translateAndMapWorkspaceObject函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LOGOptionalModelObject ReverseTranslator::translateZoneInfiltrationEffectiveLeakageArea( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::ZoneInfiltration_EffectiveLeakageArea ){ LOG(Error, "WorkspaceObject " << workspaceObject.briefDescription() << " is not IddObjectType: SpaceInfiltration_EffectiveLeakageArea"); return boost::none; } // create the instance SpaceInfiltrationEffectiveLeakageArea spaceInfiltrationEffectiveLeakageArea(m_model); OptionalString s = workspaceObject.name(); if(s){ spaceInfiltrationEffectiveLeakageArea.setName(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(ZoneInfiltration_EffectiveLeakageAreaFields::ZoneName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<Space>()){ spaceInfiltrationEffectiveLeakageArea.setSpace(modelObject->cast<Space>()); }else if (modelObject->optionalCast<SpaceType>()){ spaceInfiltrationEffectiveLeakageArea.setSpaceType(modelObject->cast<SpaceType>()); } } } target = workspaceObject.getTarget(ZoneInfiltration_EffectiveLeakageAreaFields::ScheduleName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){ Schedule schedule(*intermediate); spaceInfiltrationEffectiveLeakageArea.setSchedule(schedule); } } } boost::optional<double> value = workspaceObject.getDouble(ZoneInfiltration_EffectiveLeakageAreaFields::EffectiveAirLeakageArea); if( value ) { spaceInfiltrationEffectiveLeakageArea.setEffectiveAirLeakageArea(value.get()); } value = workspaceObject.getDouble(ZoneInfiltration_EffectiveLeakageAreaFields::StackCoefficient); if( value ) { spaceInfiltrationEffectiveLeakageArea.setStackCoefficient(value.get()); } value = workspaceObject.getDouble(ZoneInfiltration_EffectiveLeakageAreaFields::WindCoefficient); if( value ) { spaceInfiltrationEffectiveLeakageArea.setWindCoefficient(value.get()); } return spaceInfiltrationEffectiveLeakageArea;}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:59,
示例2: LOGOptionalModelObject ReverseTranslator::translateInternalMass( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::InternalMass ){ LOG(Error, "WorkspaceObject is not IddObjectType: InternalMass"); return boost::none; } // create the definition openstudio::model::InternalMassDefinition definition(m_model); OptionalString s = workspaceObject.name(); if(s){ definition.setName(*s + " Definition"); } OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::InternalMassFields::ConstructionName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ConstructionBase>()){ definition.setConstruction(modelObject->cast<ConstructionBase>()); } } } OptionalDouble d = workspaceObject.getDouble(openstudio::InternalMassFields::SurfaceArea); if(d){ definition.setSurfaceArea(*d); } // create the instance InternalMass internalMass(definition); s = workspaceObject.name(); if(s){ internalMass.setName(*s); } target = workspaceObject.getTarget(openstudio::InternalMassFields::ZoneName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<Space>()){ internalMass.setSpace(modelObject->cast<Space>()); }else if (modelObject->optionalCast<SpaceType>()){ internalMass.setSpaceType(modelObject->cast<SpaceType>()); } } } return internalMass;}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:52,
示例3: LOGOptionalModelObject ReverseTranslator::translateScheduleDayHourly(const WorkspaceObject & workspaceObject){ if (workspaceObject.iddObject().type() != IddObjectType::Schedule_Day_Hourly){ LOG(Error, "WorkspaceObject is not IddObjectType: Schedule:Day:Hourly"); return boost::none; } // create the schedule ScheduleDay scheduleDay(m_model); OptionalString s = workspaceObject.name(); if (s){ scheduleDay.setName(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(Schedule_Day_HourlyFields::ScheduleTypeLimitsName); if (target){ OptionalModelObject scheduleTypeLimits = translateAndMapWorkspaceObject(*target); if (scheduleTypeLimits){ scheduleDay.setPointer(OS_Schedule_DayFields::ScheduleTypeLimitsName, scheduleTypeLimits->handle()); } } for(unsigned i = 0; i < 24; ++i){ OptionalDouble d = workspaceObject.getDouble(Schedule_Day_HourlyFields::Hour1 + i, true); if (d){ scheduleDay.addValue(openstudio::Time(0,i+1,0,0), *d); } } return scheduleDay;}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:31,
示例4: LOGOptionalModelObject ReverseTranslator::translateCoilSystemCoolingDX( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::CoilSystem_Cooling_DX ) { LOG(Error, "WorkspaceObject is not IddObjectType: CoilSystem:Cooling:DX"); return boost::none; } Workspace workspace = workspaceObject.workspace(); boost::optional<std::string> coolingCoilObjectType; boost::optional<std::string> coolingCoilName; coolingCoilObjectType = workspaceObject.getString(CoilSystem_Cooling_DXFields::CoolingCoilObjectType); coolingCoilName = workspaceObject.getString(CoilSystem_Cooling_DXFields::CoolingCoilName); boost::optional<WorkspaceObject> wo; if( coolingCoilObjectType && coolingCoilName ) { wo = workspace.getObjectByTypeAndName(IddObjectType(coolingCoilObjectType.get()),coolingCoilName.get()); } if( wo ) { return translateAndMapWorkspaceObject(wo.get()); } else { return boost::none; }}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:32,
示例5: LOGOptionalModelObject ReverseTranslator::translateScheduleCompact( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::Schedule_Compact ) { LOG(Error, "WorkspaceObject is not IddObjectType: Schedule:Compact"); return boost::none; } ScheduleCompact scheduleCompact(m_model); OptionalWorkspaceObject target = workspaceObject.getTarget(Schedule_CompactFields::ScheduleTypeLimitsName); if (target){ OptionalModelObject scheduleTypeLimits = translateAndMapWorkspaceObject(*target); if (scheduleTypeLimits){ scheduleCompact.setPointer(OS_Schedule_CompactFields::ScheduleTypeLimitsName, scheduleTypeLimits->handle()); } } if (OptionalString os = workspaceObject.name()) { scheduleCompact.setName(*os); } for (const IdfExtensibleGroup& eg : workspaceObject.extensibleGroups()) { scheduleCompact.pushExtensibleGroup(eg.fields()); } return scheduleCompact;}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:28,
示例6: LOGOptionalModelObject ReverseTranslator::translateAirTerminalSingleDuctUncontrolled( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::AirTerminal_SingleDuct_Uncontrolled ) { LOG(Error, "WorkspaceObject is not IddObjectType: AirTerminal_SingleDuct_Uncontrolled"); return boost::none; } boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(AirTerminal_SingleDuct_UncontrolledFields::AvailabilityScheduleName); boost::optional<Schedule> schedule; boost::optional<AirTerminalSingleDuctUncontrolled> airTerminal; boost::optional<double> value; if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { if( ! (schedule = mo->optionalCast<Schedule>()) ) { LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule"); return boost::none; } } } if( schedule ) { airTerminal = AirTerminalSingleDuctUncontrolled(m_model,schedule.get()); } if( airTerminal ) { boost::optional<std::string> s = workspaceObject.getString(AirTerminal_SingleDuct_UncontrolledFields::Name); if( s ) { airTerminal->setName(s.get()); } s = workspaceObject.getString(AirTerminal_SingleDuct_UncontrolledFields::MaximumAirFlowRate); if( s && istringEqual(s.get(),"AutoSize") ) { airTerminal->autosizeMaximumAirFlowRate(); } else if( (value = workspaceObject.getDouble(AirTerminal_SingleDuct_UncontrolledFields::MaximumAirFlowRate)) ) { airTerminal->setMaximumAirFlowRate(value.get()); } return airTerminal.get(); } else { LOG(Error, "Unknown error translating " << workspaceObject.briefDescription()); return boost::none; }}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:59,
示例7: tsdsOptionalModelObject ReverseTranslator::translateThermostatSetpointDualSetpoint( const WorkspaceObject & workspaceObject ){OptionalModelObject result,temp; OptionalSchedule schedule; ThermostatSetpointDualSetpoint tsds(m_model); OptionalWorkspaceObject owo = workspaceObject.getTarget(ThermostatSetpoint_DualSetpointFields::HeatingSetpointTemperatureScheduleName); if(!owo) { LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule: "); return result; } temp = translateAndMapWorkspaceObject( *owo); if(temp) { schedule=temp->optionalCast<Schedule>(); if(schedule){ tsds.setHeatingSchedule( *schedule ); } } owo = workspaceObject.getTarget(ThermostatSetpoint_DualSetpointFields::CoolingSetpointTemperatureScheduleName); if(!owo) { LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule: "); return result; } temp = translateAndMapWorkspaceObject( *owo); if(temp) { schedule=temp->optionalCast<Schedule>(); if(schedule){ tsds.setCoolingSchedule( *schedule ); } } result = tsds; return result;}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:44,
示例8: LOGOptionalModelObject ReverseTranslator::translateShadingBuildingDetailed( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::Shading_Building_Detailed ){ LOG(Error, "WorkspaceObject is not IddObjectType: Shading:Building:Detailed"); return boost::none; } openstudio::Point3dVector vertices = getVertices(Shading_Building_DetailedFields::NumberofVertices + 1, workspaceObject); boost::optional<ShadingSurface> shadingSurface; try{ shadingSurface = ShadingSurface(vertices, m_model); }catch(const std::exception&){ LOG(Error, "Cannot create ShadingSurface for object: " << workspaceObject); return boost::none; } OptionalString s = workspaceObject.name(); if(s) { shadingSurface->setName(*s); } // look for first site level shading surface group OptionalShadingSurfaceGroup shadingSurfaceGroup; for (const ShadingSurfaceGroup& group : m_model.getConcreteModelObjects<ShadingSurfaceGroup>()){ if (istringEqual("Building", group.shadingSurfaceType())){ shadingSurfaceGroup = group; break; } } // if not found make one if (!shadingSurfaceGroup){ shadingSurfaceGroup = ShadingSurfaceGroup(m_model); shadingSurfaceGroup->setShadingSurfaceType("Building"); } shadingSurface->setShadingSurfaceGroup(*shadingSurfaceGroup); OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::Shading_Building_DetailedFields::TransmittanceScheduleName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){ Schedule schedule(*intermediate); shadingSurface->setTransmittanceSchedule(schedule); } } } return shadingSurface.get();}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:52,
示例9: LOGOptionalModelObject ReverseTranslator::translateEnergyManagementSystemConstructionIndexVariable(const WorkspaceObject & workspaceObject){ if (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_ConstructionIndexVariable) { LOG(Error, "WorkspaceObject is not IddObjectType: EnergyManagementSystem_ConstructionIndexVariable"); return boost::none; } OptionalString s1 = workspaceObject.getString(EnergyManagementSystem_ConstructionIndexVariableFields::Name); if(!s1){ LOG(Error, "WorkspaceObject EnergyManagementSystem_ConstructionIndexVariable has no Name"); return boost::none; } OptionalString s = workspaceObject.getString(EnergyManagementSystem_ConstructionIndexVariableFields::ConstructionObjectName); if (!s) { LOG(Error, workspaceObject.nameString() + ": has no ConstructionObjectName"); return boost::none; } Workspace workspace = workspaceObject.workspace(); if (s) { //std::vector<WorkspaceObject> wsObjects = workspace.getObjectsByTypeAndName(IddObjectType::Construction, *s); std::vector<WorkspaceObject> wsObjects = workspace.getObjectsByName(*s); if (wsObjects.size() > 1) { LOG(Error, workspaceObject.nameString() + ": Construction is not unique. More than 1 object with that name."); return boost::none; } if (wsObjects.size() == 0) { LOG(Error, workspaceObject.nameString() + ": Construction not found."); return boost::none; } else { boost::optional<model::ModelObject> modelObject = translateAndMapWorkspaceObject(wsObjects[0]); if (modelObject) { openstudio::model::EnergyManagementSystemConstructionIndexVariable emsConstructionIndexVariable(m_model); emsConstructionIndexVariable.setName(*s1); emsConstructionIndexVariable.setConstructionObject(modelObject.get()); return emsConstructionIndexVariable; } } } return boost::none;}
开发者ID:chlimit,项目名称:OpenStudio,代码行数:43,
示例10: LOGOptionalModelObject ReverseTranslator::translateSiteWaterMainsTemperature( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::Site_WaterMainsTemperature ) { LOG(Error, "WorkspaceObject is not IddObjectType: Site_WaterMainsTemperature"); return boost::none; } SiteWaterMainsTemperature mo = m_model.getUniqueModelObject<SiteWaterMainsTemperature>(); boost::optional<WorkspaceObject> wo; boost::optional<Schedule> schedule; wo = workspaceObject.getTarget(Site_WaterMainsTemperatureFields::TemperatureScheduleName); if( wo ) { boost::optional<ModelObject> mo2 = translateAndMapWorkspaceObject(wo.get()); if( mo2 ) { if( (schedule = mo2->optionalCast<Schedule>()) ) { mo.setTemperatureSchedule(schedule.get()); } } } boost::optional<double> value = workspaceObject.getDouble(Site_WaterMainsTemperatureFields::AnnualAverageOutdoorAirTemperature); if( value ) { mo.setAnnualAverageOutdoorAirTemperature(value.get()); } value = workspaceObject.getDouble(Site_WaterMainsTemperatureFields::MaximumDifferenceInMonthlyAverageOutdoorAirTemperatures); if( value ) { mo.setMaximumDifferenceInMonthlyAverageOutdoorAirTemperatures(value.get()); } return mo;}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:40,
示例11: outputVariableOptionalModelObject ReverseTranslator::translateOutputVariable( const WorkspaceObject & workspaceObject ){ OptionalString s = workspaceObject.getString(Output_VariableFields::VariableName); if(!s){ return boost::none; } openstudio::model::OutputVariable outputVariable( *s, m_model ); s = workspaceObject.getString(Output_VariableFields::KeyValue); if(s){ outputVariable.setKeyValue(*s); } s = workspaceObject.getString(Output_VariableFields::VariableName); if(s){ outputVariable.setVariableName(*s); } s = workspaceObject.getString(Output_VariableFields::ReportingFrequency); if(s){ outputVariable.setReportingFrequency(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(Output_VariableFields::ScheduleName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject( *target ); if (modelObject){ OptionalSchedule schedule = modelObject->optionalCast<Schedule>(); if (schedule){ outputVariable.setSchedule(*schedule); } } } return outputVariable;}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:38,
示例12: LOGOptionalModelObject ReverseTranslator::translateScheduleConstant( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::Schedule_Constant ) { LOG(Error, "WorkspaceObject is not IddObjectType: Schedule:Constant"); return boost::none; } ScheduleConstant scheduleConstant(m_model); boost::optional<WorkspaceObject> target = workspaceObject.getTarget(Schedule_ConstantFields::ScheduleTypeLimitsName); if (target){ OptionalModelObject scheduleTypeLimits = translateAndMapWorkspaceObject(*target); if (scheduleTypeLimits) { scheduleConstant.setPointer(OS_Schedule_ConstantFields::ScheduleTypeLimitsName, scheduleTypeLimits->handle()); } } if (OptionalDouble val = workspaceObject.getDouble(Schedule_ConstantFields::HourlyValue)) { scheduleConstant.setValue(*val); } return scheduleConstant;}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:23,
示例13: LOGOptionalModelObject 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;}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:37,
示例14: LOGOptionalModelObject ReverseTranslator::translateEnergyManagementSystemOutputVariable(const WorkspaceObject & workspaceObject){ if (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_OutputVariable) { LOG(Error, "WorkspaceObject is not IddObjectType: EnergyManagementSystem_OutputVariable"); return boost::none; } //make sure all other objects are translated first except below for (const WorkspaceObject& workspaceObject : m_workspace.objects()) { if ((workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_Program) && (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_Subroutine) && (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_ProgramCallingManager) && (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_MeteredOutputVariable) && (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_OutputVariable)) { translateAndMapWorkspaceObject(workspaceObject); } } OptionalString s = workspaceObject.getString(EnergyManagementSystem_OutputVariableFields::Name); if (!s) { LOG(Error, "EnergyManagementSystem_OutputVariable has no Name"); return boost::none; } openstudio::model::EnergyManagementSystemOutputVariable emsOutputVariable(m_model); emsOutputVariable.setName(*s); s = workspaceObject.getString(EnergyManagementSystem_OutputVariableFields::EMSVariableName); if (!s) { LOG(Error, emsOutputVariable.nameString() + ": EMSVariableName not set"); return boost::none; } else { Workspace workspace = workspaceObject.workspace(); //look for GlobalVariables, translate and check if there is a name match since GV's dont have name field. boost::optional<WorkspaceObject> wsObject = workspace.getObjectByTypeAndName(IddObjectType::EnergyManagementSystem_GlobalVariable, *s); //for (WorkspaceObject& wsObject : workspace.getObjectsByType(IddObjectType::EnergyManagementSystem_GlobalVariable)) { if (wsObject) { boost::optional<model::ModelObject> modelObject = translateAndMapWorkspaceObject(wsObject.get()); if (modelObject) { if (modelObject.get().cast<EnergyManagementSystemGlobalVariable>().name() == s) { emsOutputVariable.setEMSVariableName(*s); } } } //look for name match on other (EMS) objects. for (WorkspaceObject& wsObject : workspace.getObjectsByName(*s)) { boost::optional<model::ModelObject> modelObject = translateAndMapWorkspaceObject(wsObject); if (modelObject) { emsOutputVariable.setEMSVariableName(*s); break; } } } s = workspaceObject.getString(EnergyManagementSystem_OutputVariableFields::UpdateFrequency); if (!s) { LOG(Error, emsOutputVariable.nameString() + ": UpdateFrequency not set"); return boost::none; } else { emsOutputVariable.setUpdateFrequency(*s); } s = workspaceObject.getString(EnergyManagementSystem_OutputVariableFields::TypeofDatainVariable); if (!s) { LOG(Error, emsOutputVariable.nameString() + ": TypeofDatainVariable not set"); return boost::none; } else { emsOutputVariable.setTypeOfDataInVariable(*s); } s = workspaceObject.getString(EnergyManagementSystem_OutputVariableFields::Units); if (s) { emsOutputVariable.setUnits(*s); } s = workspaceObject.getString(EnergyManagementSystem_OutputVariableFields::EMSProgramorSubroutineName); if (s) { Workspace workspace = workspaceObject.workspace(); for (WorkspaceObject& wsObject : workspace.getObjectsByName(*s)) { boost::optional<model::ModelObject> modelObject = translateAndMapWorkspaceObject(wsObject); if (modelObject) { if (modelObject.get().iddObjectType() == IddObjectType::OS_EnergyManagementSystem_Program) { emsOutputVariable.setEMSProgramOrSubroutineName(modelObject.get().cast<EnergyManagementSystemProgram>()); } else if (modelObject.get().iddObjectType() == IddObjectType::OS_EnergyManagementSystem_Subroutine) { emsOutputVariable.setEMSProgramOrSubroutineName(modelObject.get().cast<EnergyManagementSystemSubroutine>()); } return emsOutputVariable; } } } return emsOutputVariable;}
开发者ID:chlimit,项目名称:OpenStudio,代码行数:92,
示例15: LOGOptionalModelObject ReverseTranslator::translateDesignSpecificationOutdoorAir( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::DesignSpecification_OutdoorAir ){ LOG(Error, "WorkspaceObject is not IddObjectType: DesignSpecification:OutdoorAir"); return boost::none; } OptionalString outdoorAirMethod = workspaceObject.getString(DesignSpecification_OutdoorAirFields::OutdoorAirMethod, true); if (!outdoorAirMethod){ LOG(Error, "No OutdoorAirMethod specified for DesignSpecification:OutdoorAir named '" << workspaceObject.name().get() << "'"); return boost::none; } DesignSpecificationOutdoorAir result(m_model); OptionalString name = workspaceObject.name(); if(name){ result.setName(*name); } result.setOutdoorAirMethod(*outdoorAirMethod); boost::optional<double> flowPerPerson = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowperPerson); boost::optional<double> flowPerArea = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowperZoneFloorArea); boost::optional<double> flowPerZone = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowperZone); boost::optional<double> ach = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowAirChangesperHour); if (istringEqual(*outdoorAirMethod, "Flow/Person")){ if (flowPerPerson){ result.setOutdoorAirFlowperPerson(*flowPerPerson); } }else if (istringEqual(*outdoorAirMethod, "Flow/Area")){ if (flowPerArea){ result.setOutdoorAirFlowperFloorArea(*flowPerArea); } }else if (istringEqual(*outdoorAirMethod, "Flow/Zone")){ if (flowPerZone){ result.setOutdoorAirFlowRate(*flowPerZone); } }else if (istringEqual(*outdoorAirMethod, "AirChanges/Hour")){ if (ach){ result.setOutdoorAirFlowRate(*ach); } }else if (istringEqual(*outdoorAirMethod, "Sum") || istringEqual(*outdoorAirMethod, "Maximum")){ if (flowPerPerson){ result.setOutdoorAirFlowperPerson(*flowPerPerson); } if (flowPerArea){ result.setOutdoorAirFlowperFloorArea(*flowPerArea); } if (flowPerZone){ result.setOutdoorAirFlowRate(*flowPerZone); } if (ach){ result.setOutdoorAirFlowRate(*ach); } }else{ LOG(Error, "Unknown OutdoorAirMethod '" << *outdoorAirMethod << "' specified for DesignSpecification:OutdoorAir named '" << workspaceObject.name().get() << "'"); } OptionalWorkspaceObject target = workspaceObject.getTarget(DesignSpecification_OutdoorAirFields::OutdoorAirFlowRateFractionScheduleName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){ Schedule schedule = *intermediate; result.setOutdoorAirFlowRateFractionSchedule(schedule); } } } return result;}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:75,
示例16: LOG//.........这里部分代码省略......... if( value ) { evapCooler->setUserSpecifiedDesignCapacity(value.get()); } // DesignEnteringWaterTemperature value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignEnteringWaterTemperature); if( value ) { evapCooler->setDesignEnteringWaterTemperature(value.get()); } // DesignEnteringAirTemperature value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignEnteringAirTemperature); if( value ) { evapCooler->setDesignEnteringAirTemperature(value.get()); } // DesignEnteringAirWetbulbTemperature value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DesignEnteringAirWetbulbTemperature); if( value ) { evapCooler->setDesignEnteringAirWetbulbTemperature(value.get()); } // CapacityControl s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::CapacityControl); if( s ) { evapCooler->setCapacityControl(s.get()); } // SizingFactor value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::SizingFactor); if( value ) { evapCooler->setSizingFactor(value.get()); } // EvaporationLossMode s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::EvaporationLossMode); if( s ) { evapCooler->setEvaporationLossMode(s.get()); } // EvaporationLossFactor value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::EvaporationLossFactor); if( value ) { evapCooler->setEvaporationLossFactor(value.get()); } // DriftLossPercent value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::DriftLossPercent); if( value ) { evapCooler->setDriftLossPercent(value.get()); } // BlowdownCalculationMode s = workspaceObject.getString(EvaporativeFluidCooler_SingleSpeedFields::BlowdownCalculationMode); if( s ) { evapCooler->setBlowdownCalculationMode(s.get()); } // BlowdownConcentrationRatio value = workspaceObject.getDouble(EvaporativeFluidCooler_SingleSpeedFields::BlowdownConcentrationRatio); if( value ) { evapCooler->setBlowdownConcentrationRatio(value.get()); } boost::optional<WorkspaceObject> _schedule; // BlowdownMakeupWaterUsageScheduleName _schedule = workspaceObject.getTarget(EvaporativeFluidCooler_SingleSpeedFields::BlowdownMakeupWaterUsageScheduleName); if( _schedule ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(_schedule.get()); if( mo ) { if( boost::optional<Schedule> schedule = mo->optionalCast<Schedule>() ) { evapCooler->setBlowdownMakeupWaterUsageSchedule(schedule.get()); } } } return evapCooler.get(); } else { LOG(Error, "Unknown error translating " << workspaceObject.briefDescription()); return boost::none; }}
开发者ID:NREL,项目名称:OpenStudio,代码行数:101,
示例17: LOGOptionalModelObject ReverseTranslator::translateSetpointManagerSingleZoneReheat( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::SetpointManager_SingleZone_Reheat ) { LOG(Error, "WorkspaceObject is not IddObjectType: SetpointManager_SingleZone_Reheat"); return boost::none; } bool nodeFound = false; if( boost::optional<std::string> setpointNodeName = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::SetpointNodeorNodeListName) ) { boost::optional<Node> setpointNode = m_model.getModelObjectByName<Node>(setpointNodeName.get()); if( setpointNode ) { nodeFound = true; } } if( ! nodeFound ) { LOG(Error, workspaceObject.briefDescription() << " is not attached to a node in the model"); return boost::none; } SetpointManagerSingleZoneReheat mo(m_model); boost::optional<std::string> s = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::Name); if( s ) { mo.setName(s.get()); } boost::optional<double> value = workspaceObject.getDouble(SetpointManager_SingleZone_ReheatFields::MinimumSupplyAirTemperature); if( value ) { mo.setMinimumSupplyAirTemperature(value.get()); } value = workspaceObject.getDouble(SetpointManager_SingleZone_ReheatFields::MaximumSupplyAirTemperature); if( value ) { mo.setMaximumSupplyAirTemperature(value.get()); } s = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::ControlZoneName); if( s ) { boost::optional<ModelObject> modelObject; boost::optional<Space> space; if( boost::optional<WorkspaceObject> _zone = workspaceObject.workspace().getObjectByTypeAndName(IddObjectType::Zone,s.get()) ) { modelObject = translateAndMapWorkspaceObject(_zone.get()); } if( modelObject ) { if( (space = modelObject->optionalCast<Space>()) ) { if( boost::optional<ThermalZone> thermalZone = space->thermalZone() ) { mo.setControlZone(thermalZone.get()); } } } } s = workspaceObject.getString(SetpointManager_SingleZone_ReheatFields::SetpointNodeorNodeListName); if( s ) { if( boost::optional<Node> node = m_model.getModelObjectByName<Node>(s.get()) ) { mo.addToNode(node.get()); } } if( mo.setpointNode() ) { return mo; } else { return boost::none; }}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:86,
示例18: LOGOptionalModelObject ReverseTranslator::translateAirTerminalSingleDuctConstantVolumeReheat( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::AirTerminal_SingleDuct_ConstantVolume_Reheat ) { LOG(Error, "WorkspaceObject is not IddObjectType: AirTerminal_SingleDuct_ConstantVolume_Reheat"); return boost::none; } boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::AvailabilityScheduleName); boost::optional<Schedule> schedule; boost::optional<HVACComponent> coil; boost::optional<AirTerminalSingleDuctConstantVolumeReheat> airTerminal; if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { if( ! (schedule = mo->optionalCast<Schedule>()) ) { LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule"); return boost::none; } } } wo = workspaceObject.getTarget(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::ReheatCoilName); if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { if( ! coil ) { //TODO: Maybe try to cast this to different types depending on ReheatCoilType coil = mo->optionalCast<CoilHeatingElectric>(); } } } if( schedule && coil ) { airTerminal = AirTerminalSingleDuctConstantVolumeReheat( m_model,schedule.get(),coil.get() ); } if( airTerminal ) { boost::optional<double> value; boost::optional<std::string> s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::Name); if( s ) { airTerminal->setName(s.get()); } // MaximumAirFlowRate value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumAirFlowRate); if( value ) { airTerminal->setMaximumAirFlowRate(value.get()); } else { s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumAirFlowRate); if( s && istringEqual(s.get(),"Autosize") ) { airTerminal->autosizeMaximumAirFlowRate(); } else if( s && istringEqual(s.get(),"Autocalculate") ) { airTerminal->autosizeMaximumAirFlowRate(); } } // MaximumHotWaterorSteamFlowRate value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumHotWaterorSteamFlowRate); if( value ) { airTerminal->setMaximumHotWaterorSteamFlowRate(value.get()); } else { s = workspaceObject.getString(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MaximumHotWaterorSteamFlowRate); if( s && istringEqual(s.get(),"Autosize") ) { airTerminal->autosizeMaximumHotWaterorSteamFlowRate(); } else if( s && istringEqual(s.get(),"Autocalculate") ) { airTerminal->autosizeMaximumHotWaterorSteamFlowRate(); } } // MinimumHotWaterorSteamFlowRate value = workspaceObject.getDouble(AirTerminal_SingleDuct_ConstantVolume_ReheatFields::MinimumHotWaterorSteamFlowRate); if( value ) { airTerminal->setMinimumHotWaterorSteamFlowRate(value.get()); }//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,
示例19: LOGOptionalModelObject ReverseTranslator::translateCoilHeatingGas( const WorkspaceObject & workspaceObject ){ OptionalModelObject result,temp; OptionalSchedule schedule; //get the Schedule OptionalWorkspaceObject owo = workspaceObject.getTarget(Coil_Heating_GasFields::AvailabilityScheduleName); if(!owo) { LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule."); return result; } temp = translateAndMapWorkspaceObject(*owo); if(temp) { schedule=temp->optionalCast<Schedule>(); } if( !schedule ) { LOG(Error, "Error importing object: " << workspaceObject.briefDescription() <<"Failed to convert iddObject (schedule) into ModelObject. Maybe it does not exist in model yet"); return result; } try { openstudio::model::CoilHeatingGas coil( m_model, *schedule ); OptionalString optS = workspaceObject.name(); if(optS) { coil.setName(*optS); } OptionalDouble d; d = workspaceObject.getDouble(openstudio::Coil_Heating_GasFields::GasBurnerEfficiency); if(d) { coil.setGasBurnerEfficiency(*d); } d = workspaceObject.getDouble(openstudio::Coil_Heating_GasFields::NominalCapacity); if(d) { coil.setNominalCapacity(*d); } //skip inlet and outlet node names. That should be done FOR us by the AirLoop Translator. d = workspaceObject.getDouble(openstudio::Coil_Heating_GasFields::GasBurnerEfficiency); if(d) { coil.setGasBurnerEfficiency(*d); } d = workspaceObject.getDouble(openstudio::Coil_Heating_GasFields::NominalCapacity); if(d) { coil.setNominalCapacity(*d); } d = workspaceObject.getDouble(openstudio::Coil_Heating_GasFields::ParasiticElectricLoad); if(d) { coil.setParasiticElectricLoad(*d); } d = workspaceObject.getDouble(openstudio::Coil_Heating_GasFields::ParasiticGasLoad); if(d) { coil.setParasiticGasLoad(*d); } result = coil; } catch (std::exception& e) { LOG(Error,"Unable to reverse translate " << workspaceObject.briefDescription() << ", because " << e.what() << "."); return boost::none; } return result;}
开发者ID:CheyenneBerlin,项目名称:OpenStudio,代码行数:82,
示例20: LOGOptionalModelObject ReverseTranslator::translateEnergyManagementSystemSubroutine(const WorkspaceObject & workspaceObject){ if (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_Subroutine) { LOG(Error, "WorkspaceObject is not IddObjectType: EnergyManagementSystem_Subroutine"); return boost::none; } OptionalString s = workspaceObject.getString(EnergyManagementSystem_SubroutineFields::Name); if (!s) { LOG(Error, "WorkspaceObject EnergyManagementSystem_Subroutine has no Name"); return boost::none; } // Make sure we translate the objects that can be referenced here for (const WorkspaceObject& workspaceObject : m_workspace.objects()) { // Note: JM 2018-08-17 // I think an EMS:Subroutine can reference another EMS:Subroutine, we might get problems from that: // The one that is being referenced would need be translated before the one that references before the name/uuid substitution happen. // But it's harder to control that order*, and this is really an edge case though, so not handling it. // * Can't add this condition without getting into a loop: // (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_Subroutine) if ( // These I'm sure we do need. (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_Actuator) || (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_Sensor) || (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_ConstructionIndexVariable) || (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_CurveOrTableIndexVariable) || (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_GlobalVariable) || (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_InternalVariable) || (workspaceObject.iddObject().type() == IddObjectType::EnergyManagementSystem_TrendVariable) ) { translateAndMapWorkspaceObject(workspaceObject); } } openstudio::model::EnergyManagementSystemSubroutine emsProgram(m_model); emsProgram.setName(*s); // Get all model objects that can be referenced int he EMS Program so we can do name / uid substitution const std::vector<IddObjectType> validIddObjectTypes{ IddObjectType::OS_EnergyManagementSystem_Subroutine, IddObjectType::OS_EnergyManagementSystem_Actuator, IddObjectType::OS_EnergyManagementSystem_Sensor, IddObjectType::OS_EnergyManagementSystem_ConstructionIndexVariable, IddObjectType::OS_EnergyManagementSystem_CurveOrTableIndexVariable, IddObjectType::OS_EnergyManagementSystem_GlobalVariable, IddObjectType::OS_EnergyManagementSystem_InternalVariable, IddObjectType::OS_EnergyManagementSystem_TrendVariable }; std::vector<model::ModelObject> modelObjects; for (const model::ModelObject& mo: m_model.modelObjects()) { if( std::find(validIddObjectTypes.begin(), validIddObjectTypes.end(), mo.iddObjectType()) != validIddObjectTypes.end() ) { modelObjects.push_back(mo); } } // Now, we should do the actual name/uid substitution on all lines of the program size_t pos, len; std::string newline, uid; unsigned n = workspaceObject.numExtensibleGroups(); OptionalString line; // Loop on each line of the program for (unsigned i = 0; i < n; ++i) { line = workspaceObject.getExtensibleGroup(i).cast<WorkspaceExtensibleGroup>().getString(EnergyManagementSystem_SubroutineExtensibleFields::ProgramLine); if (line) { newline = line.get(); // Split line to get 'tokens' and look for ModelObject names // splitEMSLineToTokens returns already sanitized tokens (excludes reserved keywords, blank ones, functions, removes parenthesis, etc) std::vector<std::string> tokens = splitEMSLineToTokens(newline); for (std::string& token: tokens) { for (const model::ModelObject& mo: modelObjects) { // Check if program item is the name of a model object boost::optional<std::string> _name = mo.name(); if ( _name && (_name.get() == token) ) { // replace model object's name with its handle pos = newline.find(token); len = token.length(); uid = toString(mo.handle()); newline.replace(pos, len, uid); // Now that we have done the replacement, no need to keep looping. // Plus, we should break out of the nested loop and go to the next "j" // Otherwise pos could become giberish if there's another object named the same // since it won't be able to find the already-replaced string (this shouldn't happen though) break; } } // end loop on all modelObjects } // end loop on all results in line emsProgram.addLine(newline); } // end if(line) } // End loop on each line of the program return emsProgram;//.........这里部分代码省略.........
开发者ID:NREL,项目名称:OpenStudio,代码行数:101,
示例21: LOGOptionalModelObject ReverseTranslator::translateGasEquipment( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::GasEquipment ){ LOG(Error, "WorkspaceObject is not IddObjectType: GasEquipment"); return boost::none; } // create the definition openstudio::model::GasEquipmentDefinition definition(m_model); OptionalString s = workspaceObject.name(); if(s){ definition.setName(*s + " Definition"); } s = workspaceObject.getString(openstudio::GasEquipmentFields::DesignLevelCalculationMethod, true); OS_ASSERT(s); OptionalDouble d; if (istringEqual("EquipmentLevel", *s)){ d = workspaceObject.getDouble(openstudio::GasEquipmentFields::DesignLevel); if (d){ definition.setDesignLevel(*d); }else{ LOG(Error, "EquipmentLevel value not found for workspace object " << workspaceObject); } }else if(istringEqual("Watts/Area", *s)){ d = workspaceObject.getDouble(openstudio::GasEquipmentFields::PowerperZoneFloorArea); if (d){ definition.setWattsperSpaceFloorArea(*d); }else{ LOG(Error, "Watts/Area value not found for workspace object " << workspaceObject); } }else if(istringEqual("Watts/Person", *s)){ d = workspaceObject.getDouble(openstudio::GasEquipmentFields::PowerperPerson); if (d){ definition.setWattsperPerson(*d); }else{ LOG(Error, "Watts/Person value not found for workspace object " << workspaceObject); } }else{ LOG(Error, "Unknown DesignLevelCalculationMethod value for workspace object" << workspaceObject); } d = workspaceObject.getDouble(openstudio::GasEquipmentFields::FractionLatent); if (d){ definition.setFractionLatent(*d); } d = workspaceObject.getDouble(openstudio::GasEquipmentFields::FractionRadiant); if (d){ definition.setFractionRadiant(*d); } d = workspaceObject.getDouble(openstudio::GasEquipmentFields::FractionLost); if (d){ definition.setFractionLost(*d); } d = workspaceObject.getDouble(openstudio::GasEquipmentFields::CarbonDioxideGenerationRate); if (d){ definition.setCarbonDioxideGenerationRate(*d); } // create the instance GasEquipment gasEquipment(definition); s = workspaceObject.name(); if(s){ gasEquipment.setName(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::GasEquipmentFields::ZoneorZoneListName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<Space>()){ gasEquipment.setSpace(modelObject->cast<Space>()); }else if (modelObject->optionalCast<SpaceType>()){ gasEquipment.setSpaceType(modelObject->cast<SpaceType>()); } } } target = workspaceObject.getTarget(openstudio::GasEquipmentFields::ScheduleName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()){ Schedule schedule(*intermediate); gasEquipment.setSchedule(schedule); } } } s = workspaceObject.getString(openstudio::GasEquipmentFields::EndUseSubcategory); if(s){ gasEquipment.setEndUseSubcategory(*s); } //.........这里部分代码省略.........
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:101,
示例22: LOG//.........这里部分代码省略......... } } // Thermostat // If the zone in the idf file does not have a name, there is no use in even trying to find a thermostat if( idfZoneName ) { Workspace workspace = workspaceObject.workspace(); std::vector<WorkspaceObject> _zoneControlThermostats; _zoneControlThermostats = workspace.getObjectsByType(IddObjectType::ZoneControl_Thermostat); for( const auto & _zoneControlThermostat : _zoneControlThermostats ) { if( boost::optional<std::string> zoneName = _zoneControlThermostat.getString( ZoneControl_ThermostatFields::ZoneorZoneListName ) ) { bool zoneControlThermostatfound = false; if( zoneName.get() == idfZoneName ) { zoneControlThermostatfound = true; } else if( boost::optional<WorkspaceObject> _zoneList = workspace.getObjectByTypeAndName(IddObjectType::ZoneList,zoneName.get()) ) { std::vector<IdfExtensibleGroup> zoneListGroup = _zoneList->extensibleGroups(); for( const auto & zoneListElem : zoneListGroup ) { boost::optional<std::string> zoneListZoneName = zoneListElem.getString(ZoneListExtensibleFields::ZoneName); if( zoneListZoneName ) { if( zoneListZoneName.get() == idfZoneName ) { zoneControlThermostatfound = true; } break; } } } if( zoneControlThermostatfound ) { std::vector<IdfExtensibleGroup> extensibleGroups = _zoneControlThermostat.extensibleGroups(); for( const auto & extensibleGroup : extensibleGroups ) { boost::optional<std::string> thermostatType = extensibleGroup.getString(ZoneControl_ThermostatExtensibleFields::ControlObjectType); boost::optional<std::string> thermostatName = extensibleGroup.getString(ZoneControl_ThermostatExtensibleFields::ControlName); if( thermostatName && thermostatType ) { boost::optional<WorkspaceObject> _thermostat = workspace.getObjectByTypeAndName(IddObjectType(thermostatType.get()),thermostatName.get()); if( _thermostat ) { boost::optional<ModelObject> thermostat = translateAndMapWorkspaceObject(_thermostat.get()); if( thermostat ) { if( boost::optional<ThermostatSetpointDualSetpoint> thermostatSetpointDualSetpoint = thermostat->optionalCast<ThermostatSetpointDualSetpoint>() ) { thermalZone.setThermostatSetpointDualSetpoint(thermostatSetpointDualSetpoint.get()); } } } } } break; } } } } // Zone Equipment/* if( idfZoneName ) { std::vector<WorkspaceObject> zoneHVACEquipmentConnections; zoneHVACEquipmentConnections = workspaceObject.workspace().getObjectsByType(IddObjectType::ZoneHVAC_EquipmentConnections); for( std::vector<WorkspaceObject>::iterator it = zoneHVACEquipmentConnections.begin(); it != zoneHVACEquipmentConnections.end(); it++ ) { s = it->getString(ZoneHVAC_EquipmentConnectionsFields::ZoneName); if( s && istringEqual(s.get(),idfZoneName.get()) ) { boost::optional<WorkspaceObject> _zoneEquipmentList = it->getTarget(ZoneHVAC_EquipmentConnectionsFields::ZoneConditioningEquipmentListName); if( _zoneEquipmentList ) { translateAndMapWorkspaceObject(_zoneEquipmentList.get()); } break; } } }*/ return space;}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:101,
示例23: LOGOptionalModelObject ReverseTranslator::translateOutputIlluminanceMap( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::Output_IlluminanceMap ){ LOG(Error, "WorkspaceObject is not IddObjectType: Output:IlluminanceMap"); return boost::none; } IlluminanceMap illuminanceMap( m_model ); OptionalString s = workspaceObject.name(); if (s){ illuminanceMap.setName(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(Output_IlluminanceMapFields::ZoneName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<Space>()){ illuminanceMap.setSpace(modelObject->cast<Space>()); } } } OptionalDouble d = workspaceObject.getDouble(Output_IlluminanceMapFields::Zheight); if (d){ illuminanceMap.setOriginZCoordinate(*d); } d = workspaceObject.getDouble(Output_IlluminanceMapFields::XMinimumCoordinate); if (d){ illuminanceMap.setOriginXCoordinate(*d); OptionalDouble maxX = workspaceObject.getDouble(Output_IlluminanceMapFields::XMaximumCoordinate); if (maxX){ illuminanceMap.setXLength(*maxX - *d); } } OptionalInt i = workspaceObject.getInt(Output_IlluminanceMapFields::NumberofXGridPoints); if (i){ illuminanceMap.setNumberofXGridPoints(*i); } d = workspaceObject.getDouble(Output_IlluminanceMapFields::YMinimumCoordinate); if (d){ illuminanceMap.setOriginYCoordinate(*d); OptionalDouble maxY = workspaceObject.getDouble(Output_IlluminanceMapFields::YMaximumCoordinate); if (maxY){ illuminanceMap.setYLength(*maxY - *d); } } i = workspaceObject.getInt(Output_IlluminanceMapFields::NumberofYGridPoints); if (i){ illuminanceMap.setNumberofYGridPoints(*i); } return illuminanceMap;}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:61,
示例24: mchpOptionalModelObject ReverseTranslator::translateGeneratorMicroTurbine( const WorkspaceObject & workspaceObject ){ OptionalModelObject result,temp; OptionalDouble d; boost::optional<WorkspaceObject> owo; OptionalString optS; // TODO: The availability schedule is in the ElectricLoadCenter:Generators (list) in E+, here it's carried by the generator itself // Should also get the Rated Thermal To Electrical Power Ratio in the list //Generator:MicroTurbine, // Capstone C65, !- Name openstudio::model::GeneratorMicroTurbine mchp( m_model ); // Name optS = workspaceObject.name(); if(optS) { mchp.setName(*optS); } // 65000, !- Reference Electrical Power Output {W} d = workspaceObject.getDouble(Generator_MicroTurbineFields::ReferenceElectricalPowerOutput); if(d) { mchp.setReferenceElectricalPowerOutput(*d); } // 29900, !- Minimum Full Load Electrical Power Output {W} d = workspaceObject.getDouble(Generator_MicroTurbineFields::MinimumFullLoadElectricalPowerOutput); if(d) { mchp.setMinimumFullLoadElectricalPowerOutput(*d); } // 65000, !- Maximum Full Load Electrical Power Output {W} setMaximumFullLoadElectricalPowerOutput d = workspaceObject.getDouble(Generator_MicroTurbineFields::MaximumFullLoadElectricalPowerOutput); if(d) { mchp.setMaximumFullLoadElectricalPowerOutput(*d); } // 0.29, !- Reference Electrical Efficiency Using Lower Heating Value d = workspaceObject.getDouble(Generator_MicroTurbineFields::ReferenceElectricalEfficiencyUsingLowerHeatingValue); if(d) { mchp.setReferenceElectricalEfficiencyUsingLowerHeatingValue(*d); } // 15.0, !- Reference Combustion Air Inlet Temperature {C} d = workspaceObject.getDouble(Generator_MicroTurbineFields::ReferenceCombustionAirInletTemperature); if(d) { mchp.setReferenceCombustionAirInletTemperature(*d); } // 0.00638, !- Reference Combustion Air Inlet Humidity Ratio {kgWater/kgDryAir} d = workspaceObject.getDouble(Generator_MicroTurbineFields::ReferenceCombustionAirInletHumidityRatio); if(d) { mchp.setReferenceCombustionAirInletHumidityRatio(*d); } // 0.0, !- Reference Elevation {m} d = workspaceObject.getDouble(Generator_MicroTurbineFields::MinimumFullLoadElectricalPowerOutput); if(d) { mchp.setMinimumFullLoadElectricalPowerOutput(*d); } // Capstone C65 Power_vs_Temp_Elev, !- Electrical Power Function of Temperature and Elevation Curve Name // BiquadraticCurves if( (owo = workspaceObject.getTarget(Generator_MicroTurbineFields::ElectricalPowerFunctionofTemperatureandElevationCurveName)) ) { if( boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(owo.get()) ) { if( boost::optional<CurveBiquadratic> curve = mo->optionalCast<CurveBiquadratic>() ) { mchp.setElectricalPowerFunctionofTemperatureandElevationCurve(curve.get()); } else { LOG(Warn, workspaceObject.briefDescription() << " has a wrong type curve for field Electrical Power Function of Temperature and Elevation Curve Name"); } } } // Capstone C65 Efficiency_vs_Temp, !- Electrical Efficiency Function of Temperature Curve Name // QuadraticCubicCurves if( (owo = workspaceObject.getTarget(Generator_MicroTurbineFields::ElectricalEfficiencyFunctionofTemperatureCurveName)) ) { if( boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(owo.get()) ) { if( boost::optional<CurveQuadratic> curve = mo->optionalCast<CurveQuadratic>() ) { mchp.setElectricalEfficiencyFunctionofTemperatureCurve(curve.get()); }//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,
示例25: LOGOptionalModelObject ReverseTranslator::translateSizingPeriodDesignDay( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::SizingPeriod_DesignDay ) { LOG(Error, "WorkspaceObject is not IddObjectType: SizingPeriod_DesignDay"); return boost::none; } DesignDay designDay(m_model); // Name boost::optional<std::string> s = workspaceObject.getString(SizingPeriod_DesignDayFields::Name); if( s ){ designDay.setName(s.get()); }else{ LOG(Error, "SizingPeriod:DesignDay missing required field Name"); } // Month boost::optional<int> i = workspaceObject.getInt(SizingPeriod_DesignDayFields::Month); if( i ){ designDay.setMonth( i.get() ); }else{ LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Month"); } // Day of Month i = workspaceObject.getInt(SizingPeriod_DesignDayFields::DayofMonth); if( i ){ designDay.setDayOfMonth(i.get()); }else{ LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Day of Month"); } // Day Type s = workspaceObject.getString(SizingPeriod_DesignDayFields::DayType); if( s ){ designDay.setDayType(s.get()); }else{ LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Day Type"); } // Maximum Dry-Bulb Temperature boost::optional<double> value = workspaceObject.getDouble(SizingPeriod_DesignDayFields::MaximumDryBulbTemperature); if( value ){ designDay.setMaximumDryBulbTemperature(value.get()); }else{ LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Maximum Dry Bulb Temperature"); } // Dry-Bulb Temperature Range Modifier Type s = workspaceObject.getString(SizingPeriod_DesignDayFields::DryBulbTemperatureRangeModifierType); if( s ){ designDay.setDryBulbTemperatureRangeModifierType(s.get()); } std::string dryBulbTemperatureRangeModifierType = designDay.dryBulbTemperatureRangeModifierType(); // Daily Dry-Bulb Temperature Range if (!istringEqual(dryBulbTemperatureRangeModifierType, "DifferenceSchedule")){ value = workspaceObject.getDouble(SizingPeriod_DesignDayFields::DailyDryBulbTemperatureRange); if( value ){ designDay.setDailyDryBulbTemperatureRange(value.get()); } } // Dry-Bulb Temperature Range Modifier Schedule Name if (istringEqual(dryBulbTemperatureRangeModifierType, "MultiplierSchedule") || istringEqual(dryBulbTemperatureRangeModifierType, "DifferenceSchedule")){ boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(SizingPeriod_DesignDayFields::DryBulbTemperatureRangeModifierDayScheduleName); if( wo ){ boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ){ if(boost::optional<ScheduleDay> schedule = mo->optionalCast<ScheduleDay>()){ designDay.setDryBulbTemperatureRangeModifierSchedule(*schedule); } } } if (!designDay.dryBulbTemperatureRangeModifierSchedule()){ LOG(Error, "SizingPeriod:DesignDay " << designDay.name().get() << " missing required field Maximum Dry Bulb Temperature"); } } // Humidity Condition Type s = workspaceObject.getString(SizingPeriod_DesignDayFields::HumidityConditionType); if( s ){ if (istringEqual(*s, "RelativeHumiditySchedule")){ s = "Schedule"; } designDay.setHumidityIndicatingType(s.get()); } std::string humidityIndicatingType = designDay.humidityIndicatingType(); // Wetbulb or DewPoint at Maximum Dry-Bulb if (istringEqual(humidityIndicatingType, "Wetbulb") || istringEqual(humidityIndicatingType, "Dewpoint") || istringEqual(humidityIndicatingType, "WetBulbProfileMultiplierSchedule") || istringEqual(humidityIndicatingType, "WetBulbProfileDifferenceSchedule") || istringEqual(humidityIndicatingType, "WetBulbProfileDefaultMultipliers")){ value = workspaceObject.getDouble(SizingPeriod_DesignDayFields::WetbulborDewPointatMaximumDryBulb); if( value ){//.........这里部分代码省略.........
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:101,
示例26: LOGOptionalModelObject ReverseTranslator::translateScheduleWeekDaily(const WorkspaceObject & workspaceObject){ if (workspaceObject.iddObject().type() != IddObjectType::Schedule_Week_Daily){ LOG(Error, "WorkspaceObject is not IddObjectType: Schedule:Week"); return boost::none; } // create the schedule ScheduleWeek scheduleWeek(m_model); OptionalString s = workspaceObject.name(); if (s){ scheduleWeek.setName(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(Schedule_Week_DailyFields::SundaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setSundaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::MondaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setMondaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::TuesdaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setTuesdaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::WednesdaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setWednesdaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::ThursdaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setThursdaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::FridaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setFridaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::SaturdaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setSaturdaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::HolidaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setHolidaySchedule(modelObject->cast<ScheduleDay>()); } } } target = workspaceObject.getTarget(Schedule_Week_DailyFields::SummerDesignDaySchedule_DayName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ScheduleDay>()){ scheduleWeek.setSummerDesignDaySchedule(modelObject->cast<ScheduleDay>());//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,
示例27: LOGOptionalModelObject ReverseTranslator::translateFanConstantVolume( const WorkspaceObject & workspaceObject ){OptionalModelObject result,temp; OptionalSchedule schedule; OptionalWorkspaceObject owo = workspaceObject.getTarget(Fan_ConstantVolumeFields::AvailabilityScheduleName); if(!owo) { LOG(Error, "Error importing object: " << workspaceObject.briefDescription() << " Can't find Schedule: "); return result; } temp = translateAndMapWorkspaceObject( *owo); if(temp) { schedule = temp->optionalCast<Schedule>(); } if( !schedule ) { LOG(Error, "Error importing object: " << workspaceObject.name().get() <<"Failed to convert iddObjects into model Objects. Maybe they do not exist in model yet"); return result; } openstudio::model::FanConstantVolume fan( m_model, *schedule ); OptionalString optS = workspaceObject.name(); if(optS) { fan.setName(*optS); } //inlet and outlet nodes are set my the HVACAirLoop OptionalDouble d; d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::FanTotalEfficiency); if(d) { fan.setFanEfficiency(*d); } d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::PressureRise); if(d) { fan.setPressureRise(*d); } d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MaximumFlowRate); if(d) { fan.setMaximumFlowRate(*d); } d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MotorEfficiency); if(d) { fan.setMotorEfficiency(*d); } d = workspaceObject.getDouble(openstudio::Fan_ConstantVolumeFields::MotorInAirstreamFraction); if(d) { fan.setMotorInAirstreamFraction(*d); } optS=workspaceObject.getString(openstudio::Fan_ConstantVolumeFields::EndUseSubcategory); if(optS) { fan.setEndUseSubcategory(*optS); } result=fan; return result;}
开发者ID:NREL,项目名称:OpenStudio,代码行数:71,
示例28: LOGOptionalModelObject ReverseTranslator::translateAirTerminalSingleDuctVAVReheat( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::AirTerminal_SingleDuct_VAV_Reheat ) { LOG(Error, "WorkspaceObject is not IddObjectType: AirTerminal_SingleDuct_VAV_Reheat"); return boost::none; } boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::AvailabilityScheduleName); boost::optional<Schedule> schedule; boost::optional<HVACComponent> coil; boost::optional<AirTerminalSingleDuctVAVReheat> airTerminal; if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { if( ! (schedule = mo->optionalCast<Schedule>()) ) { LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule"); return boost::none; } } } wo = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::ReheatCoilName); if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { if( ! coil ) { coil = mo->optionalCast<CoilHeatingGas>(); } } } if( schedule && coil ) { airTerminal = AirTerminalSingleDuctVAVReheat( m_model,schedule.get(),coil.get() ); } if( airTerminal ) { boost::optional<double> value; boost::optional<std::string> s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::Name); if( s ) { airTerminal->setName(s.get()); } // MaximumAirFlowRate value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumAirFlowRate); s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumAirFlowRate); if( value ) { airTerminal->setMaximumAirFlowRate(value.get()); } else if( s && istringEqual(s.get(),"Autosize") ) { airTerminal->autosizeMaximumAirFlowRate(); } else if( s && istringEqual(s.get(),"Autocalculate") ) { airTerminal->autosizeMaximumAirFlowRate(); } // ZoneMinimumAirFlowInputMethod s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::ZoneMinimumAirFlowInputMethod); if( s ) { airTerminal->setZoneMinimumAirFlowMethod(s.get()); } // ConstantMinimumAirFlowFraction value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::ConstantMinimumAirFlowFraction); if( value ) { airTerminal->setConstantMinimumAirFlowFraction(value.get()); } // FixedMinimumAirFlowRate value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::FixedMinimumAirFlowRate); if( value ) { airTerminal->setFixedMinimumAirFlowRate(value.get()); } boost::optional<WorkspaceObject> _schedule; // MinimumAirFlowFractionScheduleName _schedule = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::MinimumAirFlowFractionScheduleName); if( _schedule ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(_schedule.get()); if( mo )//.........这里部分代码省略.........
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:101,
示例29: LOGOptionalModelObject ReverseTranslator::translateSetpointManagerScheduled( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::SetpointManager_Scheduled ) { LOG(Error, "WorkspaceObject is not IddObjectType: SetpointManager_Scheduled"); return boost::none; } boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(SetpointManager_ScheduledFields::ScheduleName); boost::optional<Schedule> schedule; if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { if( ! (schedule = mo->optionalCast<Schedule>()) ) { LOG(Error, workspaceObject.briefDescription() << " does not have an associated schedule"); return boost::none; } } } bool nodeFound = false; if( boost::optional<std::string> setpointNodeName = workspaceObject.getString(SetpointManager_ScheduledFields::SetpointNodeorNodeListName) ) { boost::optional<Node> setpointNode = m_model.getModelObjectByName<Node>(setpointNodeName.get()); if( setpointNode ) { nodeFound = true; } } if( ! nodeFound ) { LOG(Error, workspaceObject.briefDescription() << " is not attached to a node in the model"); return boost::none; } if( schedule ) { SetpointManagerScheduled mo(m_model,schedule.get()); // Name boost::optional<std::string> s = workspaceObject.getString(SetpointManager_ScheduledFields::Name); if( s ) { mo.setName(s.get()); } // Setpoint Node s = workspaceObject.getString(SetpointManager_ScheduledFields::SetpointNodeorNodeListName); if( s ) { boost::optional<Node> node = m_model.getModelObjectByName<Node>(s.get()); if( node ) { mo.addToNode(node.get()); } } // Control Variable s = workspaceObject.getString(SetpointManager_ScheduledFields::ControlVariable); if( s ) { mo.setControlVariable(s.get()); } if( mo.setpointNode() ) { return mo; } else { return boost::none; } } else { return boost::none; }}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:85,
示例30: LOGOptionalModelObject ReverseTranslator::translateAirLoopHVACOutdoorAirSystem( const WorkspaceObject & workspaceObject ){ if( workspaceObject.iddObject().type() != IddObjectType::AirLoopHVAC_OutdoorAirSystem ) { LOG(Error, "WorkspaceObject is not IddObjectType: AirLoopHVAC_OutdoorAirSystem"); return boost::none; } Workspace _workspace = workspaceObject.workspace(); boost::optional<WorkspaceObject> _controllerList; boost::optional<WorkspaceObject> _controllerOutdoorAir; boost::optional<std::string> controllerName; boost::optional<std::string> controllerType; boost::optional<ControllerOutdoorAir> oaController; _controllerList = workspaceObject.getTarget(AirLoopHVAC_OutdoorAirSystemFields::ControllerListName); if( _controllerList ) { for( int i = 1; _controllerList->getString(i); i = i + 2 ) { controllerType = _controllerList->getString(i); controllerName = _controllerList->getString(i + 1); if( controllerType ) { if( istringEqual(controllerType.get(),"Controller:OutdoorAir") ) { break; } } } } if( controllerName && controllerType ) { boost::optional<WorkspaceObject> wo = _workspace.getObjectByTypeAndName(IddObjectType(controllerType.get()),controllerName.get()); if( wo ) { boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); if( mo ) { oaController = mo->optionalCast<ControllerOutdoorAir>(); } } } if( oaController ) { AirLoopHVACOutdoorAirSystem mo(m_model,oaController.get()); boost::optional<std::string> name = workspaceObject.getString(AirLoopHVAC_OutdoorAirSystemFields::Name); if( name ) { mo.setName(name.get()); } Node outboardOANode = mo.outboardOANode().get(); boost::optional<WorkspaceObject> _oaEquipmentList; boost::optional<WorkspaceObject> _outdoorAirMixer; std::vector<WorkspaceObject> equipmentVector; _oaEquipmentList = workspaceObject.getTarget(AirLoopHVAC_OutdoorAirSystemFields::OutdoorAirEquipmentListName); if( _oaEquipmentList ) { for( int i = 1; _oaEquipmentList->getString(i); i = i + 2 ) { boost::optional<std::string> equipmentName; boost::optional<std::string> equipmentType; equipmentType = _oaEquipmentList->getString(i); equipmentName = _oaEquipmentList->getString(i + 1); if( equipmentName && equipmentType ) { boost::optional<WorkspaceObject> wo = _workspace.getObjectByTypeAndName(IddObjectType(equipmentType.get()),equipmentName.get()); if( wo ) { equipmentVector.push_back(wo.get()); if( wo->iddObject().type() == IddObjectType::OutdoorAir_Mixer ) { _outdoorAirMixer = wo; } } } } if( _outdoorAirMixer ) { boost::optional<std::string> mixerOAInletNodeName = _outdoorAirMixer->getString(OutdoorAir_MixerFields::OutdoorAirStreamNodeName); boost::optional<std::string> mixerOAReliefNodeName = _outdoorAirMixer->getString(OutdoorAir_MixerFields::ReliefAirStreamNodeName); if( mixerOAInletNodeName ) { mo.outdoorAirModelObject()->cast<Node>().setName(mixerOAInletNodeName.get()); } if( mixerOAReliefNodeName ) { mo.reliefAirModelObject()->cast<Node>().setName(mixerOAReliefNodeName.get()); } boost::optional<std::string> oaStreamInletNodeName; boost::optional<std::string> oaStreamOutletNodeName; oaStreamInletNodeName = _outdoorAirMixer->getString(OutdoorAir_MixerFields::OutdoorAirStreamNodeName);//.........这里部分代码省略.........
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:101,
注:本文中的translateAndMapWorkspaceObject函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ translateChar函数代码示例 C++ translateAndMapModelObject函数代码示例 |