Module: URBANopt::GeoJSON::Model
- Defined in:
- lib/urbanopt/geojson/model.rb
Class Method Summary collapse
-
.change_adjacent_surfaces_to_adiabatic(model, runner) ⇒ Object
This method loops through each surface of the model for adjacent surfaces.
-
.create_construction_set(model, runner) ⇒ Object
Used to add construction to the model.
-
.create_space_type(bldg_use, space_use, model) ⇒ Object
Returns instance of
OpenStudio::Model::SpaceType. -
.transfer_prev_model_data(model, space_types) ⇒ Object
Loops through all the building stories in the model and for each space sets space type from the building story if no space type is assigned.
Class Method Details
.change_adjacent_surfaces_to_adiabatic(model, runner) ⇒ Object
This method loops through each surface of the model for adjacent surfaces. It sets the outside boundary condition to these surfaces as Adiabatic and hard assigns the construction.
Returns an instance of OpenStudio::Model::Model with surfaces changed to adiabatic.
- Parameters
-
model- Type:String - An instance ofOpenStudio::Model::Model. -
runner- Type:String - Measure run’s instance ofOpenStudio::Measure::OSRunner.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/urbanopt/geojson/model.rb', line 41 def self.change_adjacent_surfaces_to_adiabatic(model, runner) runner.registerInfo('Changing adjacent surfaces to adiabatic') model.getSurfaces.sort.each do |surface| adjacent_surface = surface.adjacentSurface if !adjacent_surface.empty? surface_construction = surface.construction if !surface_construction.empty? surface.setConstruction(surface_construction.get) end adjacent_surface_construction = adjacent_surface.get.construction if !adjacent_surface_construction.empty? surface.setOutsideBoundaryCondition('Adiabatic') adjacent_surface.get.setConstruction(adjacent_surface_construction.get) end adjacent_surface.get.setOutsideBoundaryCondition('Adiabatic') end end return model end |
.create_construction_set(model, runner) ⇒ Object
Used to add construction to the model. This method uses the default construction to the building, or creates a new+OpenStudio::Model::DefaultConstructionSet+ if no construction set is assigned.
Returns an instance of OpenStudio::Model::DefaultConstructionSet .
- Parameters
-
model- Type:String - An instance ofOpenStudio::Model::Model. -
runner- Type:String - Measure run’s instance ofOpenStudio::Measure::OSRunner.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/urbanopt/geojson/model.rb', line 20 def self.create_construction_set(model, runner) default_construction_set = model.getBuilding.defaultConstructionSet if !default_construction_set.is_initialized runner.registerInfo('Starting model does not have a default construction set, creating new one') default_construction_set = OpenStudio::Model::DefaultConstructionSet.new(model) else default_construction_set = default_construction_set.get end return default_construction_set end |
.create_space_type(bldg_use, space_use, model) ⇒ Object
Returns instance of OpenStudio::Model::SpaceType.
- Parameters
-
bldg_use- Type:String - Indicates the building use. -
space_use- Type:String - Indicates the space use. -
model- Type:String - An instance ofOpenStudio::Model::Model.
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/urbanopt/geojson/model.rb', line 92 def self.create_space_type(bldg_use, space_use, model) name = "#{bldg_use}:#{space_use}" model.getSpaceTypes.each do |s| if s.name.get == name return s end end space_type = OpenStudio::Model::SpaceType.new(model) space_type.setName(name) space_type.setStandardsBuildingType(bldg_use) space_type.setStandardsSpaceType(space_use) return space_type end |
.transfer_prev_model_data(model, space_types) ⇒ Object
Loops through all the building stories in the model and for each space sets space type from the building story if no space type is assigned.
Returns an Array of instances of OpenStudio::Model::Story .
- Parameters
-
model- Type:String - An instance ofOpenStudio::Model::Model. -
space_types- Type:Array - Instances ofOpenStudio::Model::SpaceType.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/urbanopt/geojson/model.rb', line 70 def self.transfer_prev_model_data(model, space_types) stories = [] model.getBuildingStorys.each { |story| stories << story } stories.sort! { |x, y| x.nominalZCoordinate.to_s.to_f <=> y.nominalZCoordinate.to_s.to_f } stories.each_index do |i| space_type = space_types[i] next if space_type.nil? stories[i].spaces.each do |space| space.setSpaceType(space_type) end end return stories end |