当前位置: 首页>>代码示例>>C++>>正文


C++ WorkspaceObject::extensibleGroups方法代码示例

本文整理汇总了C++中WorkspaceObject::extensibleGroups方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkspaceObject::extensibleGroups方法的具体用法?C++ WorkspaceObject::extensibleGroups怎么用?C++ WorkspaceObject::extensibleGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorkspaceObject的用法示例。


在下文中一共展示了WorkspaceObject::extensibleGroups方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: translateScheduleCompact

OptionalModelObject 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,代码来源:ReverseTranslateScheduleCompact.cpp

示例2: translateZoneList

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;
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:37,代码来源:ReverseTranslateZoneList.cpp

示例3: translateGroundHeatExchangerVertical


//.........这里部分代码省略.........
  if (d) {
    ghex.setMaximumFlowRate(*d);
  }

  //Number of Bore Holes
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::NumberofBoreHoles);
  if (d) {
    ghex.setNumberofBoreHoles(*d);
  }

  //Bore Hole Length
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::BoreHoleLength);
  if (d) {
    ghex.setBoreHoleLength(*d);
  }

  //Bore Hole Radius
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::BoreHoleRadius);
  if (d) {
    ghex.setBoreHoleRadius(*d);
  }

  //Ground Thermal Conductivity
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::GroundThermalConductivity);
  if (d) {
    ghex.setGroundThermalConductivity(*d);
  }

  //Ground Thermal Heat Capacity
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::GroundThermalHeatCapacity);
  if (d) {
    ghex.setGroundThermalHeatCapacity(*d);
  }

  //Ground Temperature
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::GroundTemperature);
  if (d) {
    ghex.setGroundTemperature(*d);
  }

  //Design Flow Rate
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::DesignFlowRate);
  if (d) {
    ghex.setDesignFlowRate(*d);
  }

  //Grout Thermal Conductivity
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::GroutThermalConductivity);
  if (d) {
      ghex.setGroutThermalConductivity(*d);
  }

  //Pipe Thermal Conductivity
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::PipeThermalConductivity);
  if (d) {
    ghex.setPipeThermalConductivity(*d);
  }

  //Pipe Out Diameter
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::PipeOutDiameter);
  if (d) {
    ghex.setPipeOutDiameter(*d);
  }

  //U-Tube Distance
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::UTubeDistance);
  if (d) {
    ghex.setUTubeDistance(*d);
  }

  //Pipe Thickness
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::PipeThickness);
  if (d) {
    ghex.setPipeThickness(*d);
  }

  //Maximum Length of Simulation
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::MaximumLengthofSimulation);
  if (d) {
    ghex.setMaximumLengthofSimulation(*d);
  }

  //G-Function Reference Ratio
  d = workspaceObject.getDouble(GroundHeatExchanger_VerticalFields::GFunctionReferenceRatio);
  if (d) {
    ghex.setGFunctionReferenceRatio(*d);
  }

  std::vector<IdfExtensibleGroup> groups = workspaceObject.extensibleGroups();
  ghex.removeAllGFunctions();

  for( std::vector<IdfExtensibleGroup>::iterator it = groups.begin();
       it != groups.end();
       it++ )
  {
    ghex.pushExtensibleGroup(it->fields());
  }

  return ghex;
}
开发者ID:Zicao,项目名称:OpenStudio,代码行数:101,代码来源:ReverseTranslateGroundHeatExchangerVertical.cpp

示例4: translateZoneHVACEquipmentList

OptionalModelObject ReverseTranslator::translateZoneHVACEquipmentList( const WorkspaceObject & workspaceObject )
{
  if(workspaceObject.iddObject().type() != IddObjectType::ZoneHVAC_EquipmentList){
    LOG(Error, "WorkspaceObject is not IddObjectType: ZoneHVAC:EquipmentList");
     return boost::none;
  }

  boost::optional<openstudio::model::ThermalZone> thermalZone;

  std::vector<WorkspaceObject> zoneHVACEquipmentConnections = workspaceObject.getSources(IddObjectType::ZoneHVAC_EquipmentConnections);
  if (zoneHVACEquipmentConnections.size() == 0){
    LOG(Error,"No ZoneHVAC:EquipmentConnections object associated with a zone. Check that IDF file is correct.");
    return boost::none;
  }else if (zoneHVACEquipmentConnections.size() > 1){
    LOG(Error,"More than 1 ZoneHVAC:EquipmentConnections objects associated with a zone. Check that IDF file is correct.");
    return boost::none;
  }

  for( const auto & zoneHVACEquipmentConnection : zoneHVACEquipmentConnections )
  {
    if( boost::optional<std::string> name = zoneHVACEquipmentConnection.getString(ZoneHVAC_EquipmentConnectionsFields::ZoneName) )
    {
      boost::optional<model::Space> space = m_model.getModelObjectByName<model::Space>(name.get());

      if( space )
      {
        thermalZone = space->thermalZone();
      }
    }
  }

  // get extensible groups for zone HVAC equipment list
  std::vector<IdfExtensibleGroup> extensibleGroups = workspaceObject.extensibleGroups();

  // loop over extensible groups
  unsigned n = extensibleGroups.size();
  for (unsigned i = 0; i < n; ++i){
    // define variables
    boost::optional<openstudio::model::ZoneHVACComponent> zoneHVACComponent;
    // get zone equipment object type and zone equipment object name from extensible group
    boost::optional<std::string> zoneEquipmentObjectType = extensibleGroups[i].getString(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentObjectType);
    boost::optional<std::string> zoneEquipmentName = extensibleGroups[i].getString(ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentName);
    // get zone equipment workspace object by type and name
    if (zoneEquipmentObjectType && zoneEquipmentName){
      OptionalWorkspaceObject zoneEquipmentWorkspaceObject = workspaceObject.workspace().getObjectByTypeAndName(IddObjectType(*zoneEquipmentObjectType),*zoneEquipmentName);
      // translate zone equipment workspace object
      if (zoneEquipmentWorkspaceObject){
        OptionalModelObject zoneEquipmentModelObject = translateAndMapWorkspaceObject(*zoneEquipmentWorkspaceObject);
        // cast zone equipment model object to zone HVAC component
        if (zoneEquipmentModelObject){
          zoneHVACComponent = zoneEquipmentModelObject->optionalCast<ZoneHVACComponent>();
        }
      }
    }
    // add to thermal zone
    if (zoneHVACComponent && thermalZone){
      zoneHVACComponent->addToThermalZone(*thermalZone);
    }
  }

  return boost::none;
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:62,代码来源:ReverseTranslateZoneHVACEquipmentList.cpp

示例5: translateScheduleDayInterval

OptionalModelObject ReverseTranslator::translateScheduleDayInterval(const WorkspaceObject & workspaceObject){
  if (workspaceObject.iddObject().type() != IddObjectType::Schedule_Day_Interval){
    LOG(Error, "WorkspaceObject is not IddObjectType: Schedule:Day:Interval");
    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_IntervalFields::ScheduleTypeLimitsName);
  if (target){
    OptionalModelObject scheduleTypeLimits = translateAndMapWorkspaceObject(*target);
    if (scheduleTypeLimits){
      scheduleDay.setPointer(OS_Schedule_DayFields::ScheduleTypeLimitsName, scheduleTypeLimits->handle());
    }
  }

  s = workspaceObject.getString(2,true);
  if (s){
    if (openstudio::istringEqual(*s,"yes")){
      scheduleDay.setInterpolatetoTimestep(true);
    }
    else if (openstudio::istringEqual(*s,"yes")){
      scheduleDay.setInterpolatetoTimestep(false);
    }
  }

  //get extensible groups
  std::vector<IdfExtensibleGroup> extensibleGroups = workspaceObject.extensibleGroups();
  //loop over extensible groups
  boost::regex timeRegex("(\\d?\\d:\\d\\d)");
  boost::smatch m;
  unsigned n = extensibleGroups.size();
  for (unsigned i = 0; i < n; ++i){
    //read in extensible groups
    boost::optional<std::string> timeString = extensibleGroups[i].getString(Schedule_Day_IntervalExtensibleFields::Time);
    boost::optional<double> valueUntilTime = extensibleGroups[i].getDouble(Schedule_Day_IntervalExtensibleFields::ValueUntilTime);
    if (timeString && valueUntilTime) {
      // Time string may be prefixed with "Until: ". Extract time in HH:MM format.
      if (boost::regex_search(*timeString,m,timeRegex)) {
        timeString = std::string(m[1].first,m[1].second);
      }
      try {
        openstudio::Time time(*timeString);
        scheduleDay.addValue(time,*valueUntilTime);
      }
      catch (std::exception& e) {
        LOG(Warn,"Could not add value (" << *timeString << ", " << *valueUntilTime
            << ") to ScheduleDay being created from " << workspaceObject.briefDescription()
            << ", because " << e.what() << ".");
      }
    }
    else {
      LOG(Warn,"Encountered extensible group with incomplete or improperly formatted data in "
          << workspaceObject.briefDescription() << ". Therefore, a corresponding value is not "
          << "being added to the ScheduleDay object under construction.");
    }
  }

  return scheduleDay;
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:66,代码来源:ReverseTranslateScheduleDayInterval.cpp


注:本文中的WorkspaceObject::extensibleGroups方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。