Ejemplo n.º 1
0
  bool ShadingSurfaceGroup_Impl::setShadedSubSurface(const SubSurface& subSurface)
  {
    boost::optional<Space> space = this->space();
    if (!space){
      return false;
    }

    boost::optional<Space> otherSpace = subSurface.space();
    if (!otherSpace){
      return false;
    }

    if (space->handle() != otherSpace->handle()){
      return false;
    }

    bool test = setPointer(OS_ShadingSurfaceGroupFields::ShadedObjectName, subSurface.handle());
    OS_ASSERT(test);

    return test;
  }
boost::optional<IdfObject> ForwardTranslator::translateDaylightingDeviceShelf( model::DaylightingDeviceShelf & modelObject )
{
  SubSurface window = modelObject.subSurface();
  boost::optional<Space> space = window.space();
  boost::optional<InteriorPartitionSurface> insideShelf = modelObject.insideShelf();
  boost::optional<ShadingSurface> outsideShelf = modelObject.outsideShelf();

  if (!space){
    return boost::none;
  }

  if (!(insideShelf || outsideShelf)){
    return boost::none;
  }

  IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::DaylightingDevice_Shelf, 
                                                       modelObject);

  idfObject.setString(DaylightingDevice_ShelfFields::WindowName, window.name().get());


  // inside shelf is converted to a surface
  if (insideShelf){

    openstudio::Transformation transformation;
    boost::optional<InteriorPartitionSurfaceGroup> group = insideShelf->interiorPartitionSurfaceGroup();
    if (group){
      transformation = group->transformation();
    }

    Point3dVector vertices = transformation*insideShelf->vertices();
    Surface newSurface(vertices, modelObject.model());
    newSurface.setName(modelObject.name().get());
    newSurface.setSpace(*space);
    newSurface.setAdjacentSurface(newSurface);

    boost::optional<ConstructionBase> construction = insideShelf->construction();
    if (!construction){
      Model t_model = modelObject.model();
      construction = interiorPartitionSurfaceConstruction(t_model);
    }
    OS_ASSERT(construction);
    newSurface.setConstruction(*construction);
    
    boost::optional<IdfObject> newSurfaceObject = translateAndMapModelObject(newSurface);
    if (newSurfaceObject){
      idfObject.setString(DaylightingDevice_ShelfFields::InsideShelfName, newSurfaceObject->name().get());
    }
  }

  if (outsideShelf){

    idfObject.setString(DaylightingDevice_ShelfFields::OutsideShelfName, outsideShelf->name().get());
    
    boost::optional<ConstructionBase> construction = outsideShelf->construction();
    if (!construction){
      Model t_model = modelObject.model();
      construction = exteriorSurfaceConstruction(t_model);
    }
    OS_ASSERT(construction);
    idfObject.setString(DaylightingDevice_ShelfFields::OutsideShelfConstructionName, construction->name().get());

    OptionalDouble d = modelObject.viewFactortoOutsideShelf();
    if (d){
      idfObject.setDouble(DaylightingDevice_ShelfFields::ViewFactortoOutsideShelf, *d);
    }
  }

  return idfObject;
}