Module: BTAP::Geometry
- Defined in:
- lib/openstudio-standards/btap/geometry.rb
Defined Under Namespace
Modules: BuildingStoreys, Spaces, Surfaces, Zones
Class Method Summary
collapse
Class Method Details
.enumerate_spaces_model(model, prepend_name = false) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 23
def self.enumerate_spaces_model(model, prepend_name = false)
BTAP::Geometry::BuildingStoreys::auto_assign_spaces_to_stories(model)
model.getBuildingStorys.sort.each do |story|
spaces = Array.new
spaces.concat(story.spaces)
spaces.sort! do |a, b|
(a.xOrigin <=> b.xOrigin).nonzero? ||
(a.yOrigin <=> b.yOrigin)
end
counter = 1
spaces.sort.each do |space|
if prepend_name == true
space.setName("#{story.name}-#{counter.to_s}:#{space.name}")
else
space.setName("#{story.name}-#{counter.to_s}")
end
counter = counter + 1
p end
end
end
|
.get_fwdr(model) ⇒ Object
.get_surface_to_subsurface_ratio(surfaces) ⇒ Object
187
188
189
190
191
192
193
194
195
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 187
def self.get_surface_to_subsurface_ratio(surfaces)
total_gross_surface_area = 0.0
total_net_surface_area = 0.0
surfaces.each do |surface|
total_gross_surface_area = total_gross_surface_area + surface.grossArea
total_net_surface_area = total_net_surface_area + surface.netArea
end
return 1.0 - (total_net_surface_area / total_gross_surface_area)
end
|
.intersect_surfaces(model) ⇒ Object
145
146
147
148
149
150
151
152
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 145
def self.intersect_surfaces(model)
model.getSpaces.sort.each do |space1|
model.getSpaces.sort.each do |space2|
space1.intersectSurfaces(space2)
end
end
return model
end
|
.match_surfaces(model) ⇒ Object
136
137
138
139
140
141
142
143
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 136
def self.match_surfaces(model)
model.getSpaces.sort.each do |space1|
model.getSpaces.sort.each do |space2|
space1.matchSurfaces(space2)
end
end
return model
end
|
.prefix_equipment_with_zone_name(model) ⇒ Object
This method will rename the zone equipment to have the zone name as a prefix for a model. It will also rename the hot water coils for:
AirTerminalSingleDuctVAVReheat
ZoneHVACBaseboardConvectiveWater
ZoneHVACUnitHeater
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 98
def self.prefix_equipment_with_zone_name(model)
thermal_zones = model.getThermalZones
thermal_zones.each do |thermal_zone|
thermal_zone.equipment.each do |equip|
if not equip.to_AirTerminalSingleDuctVAVReheat.empty?
equip.setName("#{thermal_zone.name}:AirTerminalSingleDuctVAVReheat")
reheat_coil = equip.to_AirTerminalSingleDuctVAVReheat.get.reheatCoil
reheat_coil.setName("#{thermal_zone.name}:ReheatCoil")
elsif not equip.to_ZoneHVACBaseboardConvectiveWater.empty?
equip.setName("#{thermal_zone.name}:ZoneHVACBaseboardConvectiveWater")
heatingCoil = equip.to_ZoneHVACBaseboardConvectiveWater.get.heatingCoil
heatingCoil.setName("#{thermal_zone.name}:Baseboard HW Htg Coil")
elsif not equip.to_ZoneHVACUnitHeater.empty?
equip.setName("#{thermal_zone.name}:ZoneHVACUnitHeater")
heatingCoil = equip.to_ZoneHVACUnitHeater.get.heatingCoil
heatingCoil.setName("#{thermal_zone.name}:Unit Heater Htg Coil")
else equip.setName("#{thermal_zone.name}:#{equip.name}")
end
end
end
end
|
.rename_zones_based_on_spaces(model) ⇒ Object
this was a copy of the sketchup plugin method.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 49
def self.rename_zones_based_on_spaces(model)
model.getThermalZones.sort.each do |thermal_zone| spaces_in_thermal_zone = []
number_of_spaces = 0
spaces = thermal_zone.spaces
spaces.sort.each do |space|
spaces_in_thermal_zone.push space.name.to_s
end
number_of_spaces = spaces_in_thermal_zone.size
spaces_in_thermal_zone = spaces_in_thermal_zone.sort
if number_of_spaces > 1
multi = " - Plus"
else
multi = ""
end
if number_of_spaces > 0
new_name = "ZN:" + spaces_in_thermal_zone[0] + multi
thermal_zone.setName(new_name)
else
puts "#{thermal_zone.name.to_s} did not have any spaces, and will not be renamed."
end
end
end
|
.rotate_building(model:, degrees: nil) ⇒ Object
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 208
def self.rotate_building(model: , degrees: nil)
if degrees == 0 || degrees.nil?
puts ('The requested rotation was 0 or nil degrees. The model was not rotated.')
return
end
degrees -= 360.0 * (degrees / 360.0).truncate if (degrees > 360) || (degrees < -360)
building = model.getBuilding
final_building_angle = building.setNorthAxis(building.northAxis + degrees)
end
|
.rotate_model(model, degrees) ⇒ OpenStudio::Model::Model
This method will rotate the model
201
202
203
204
205
206
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 201
def self.rotate_model(model, degrees)
t = OpenStudio::Transformation::rotation(OpenStudio::Vector3d.new(0, 0, 1), degrees * Math::PI / 180)
model.getPlanarSurfaceGroups().each {|planar_surface| planar_surface.changeTransformation(t)}
return model
end
|
.scale_model(model, x, y, z) ⇒ OpenStudio::Model::Model
This method will scale the model
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
# File 'lib/openstudio-standards/btap/geometry.rb', line 160
def self.scale_model(model, x, y, z)
m = OpenStudio::Matrix.new(4, 4, 0)
m[0, 0] = 1.0 / x
m[1, 1] = 1.0 / y
m[2, 2] = 1.0 / z
m[3, 3] = 1.0
t = OpenStudio::Transformation.new(m)
model.getPlanarSurfaceGroups().each do |planar_surface|
planar_surface.changeTransformation(t)
end
return model
end
|