75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
|
# File 'lib/files/Honeybee.rb', line 75
def create_osw(scenario, features, feature_names)
if features.size != 1
raise "Mapper currently cannot simulate more than one feature at a time."
end
feature = features[0]
feature_id = feature.id
feature_type = feature.type
feature_name = feature.name
feature_vertices_coordinates = feature.feature_json[:geometry][:coordinates][0]
feature_location = feature.find_feature_center(feature_vertices_coordinates).to_s
if feature_names.size == 1
feature_name = feature_names[0]
end
osw = Marshal.load(Marshal.dump(@@osw))
osw[:name] = feature_name
osw[:description] = feature_name
if feature_type == 'Building'
OpenStudio::Extension.set_measure_argument(
osw, 'from_honeybee_model', 'model_json', feature.detailed_model_filename)
if not @@mapper_measures.nil?
@@mapper_measures.each do |map_measure_param|
feature_param = feature.send(map_measure_param[2])
OpenStudio::Extension.set_measure_argument(
osw, map_measure_param[0], map_measure_param[1], feature_param)
end
end
OpenStudio::Extension.set_measure_argument(
osw, 'default_feature_reports', 'feature_id', feature_id)
OpenStudio::Extension.set_measure_argument(
osw, 'default_feature_reports', 'feature_name', feature_name)
OpenStudio::Extension.set_measure_argument(
osw, 'default_feature_reports', 'feature_type', feature_type)
OpenStudio::Extension.set_measure_argument(
osw, 'default_feature_reports', 'feature_location', feature_location)
end
return osw
end
|