From b24187c6da93a50bc5af09e45bad216bf28bfa06 Mon Sep 17 00:00:00 2001 From: Rawad El Kontar Date: Mon, 13 Sep 2021 23:24:52 -0600 Subject: [PATCH] added missing feature location arguments to CreateBar & Floorspace workflow.osw and mapper --- example_project/mappers/Baseline.rb | 3 --- example_project/mappers/CreateBar.rb | 6 ++++++ example_project/mappers/Floorspace.rb | 6 ++++++ example_project/mappers/createbar_workflow.osw | 3 ++- example_project/mappers/floorspace_workflow.osw | 3 ++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/example_project/mappers/Baseline.rb b/example_project/mappers/Baseline.rb index 7f58ac4ee..55f239dd8 100644 --- a/example_project/mappers/Baseline.rb +++ b/example_project/mappers/Baseline.rb @@ -402,9 +402,6 @@ def create_osw(scenario, features, feature_names) feature_id = feature.id feature_type = feature.type - # take the first vertex as the location of the building - #feature_location = feature.feature_json[:geometry][:coordinates][0][0].to_s - # take the centroid of the vertices as the location of the building feature_vertices_coordinates = feature.feature_json[:geometry][:coordinates][0] feature_location = feature.find_feature_center(feature_vertices_coordinates).to_s diff --git a/example_project/mappers/CreateBar.rb b/example_project/mappers/CreateBar.rb index 2288624ad..fefbc95f7 100644 --- a/example_project/mappers/CreateBar.rb +++ b/example_project/mappers/CreateBar.rb @@ -258,7 +258,12 @@ def create_osw(scenario, features, feature_names) feature = features[0] feature_id = feature.id feature_type = feature.type + # take the centroid of the vertices as the location of the building + feature_vertices_coordinates = feature.feature_json[:geometry][:coordinates][0] + feature_location = feature.find_feature_center(feature_vertices_coordinates).to_s + feature_name = feature.name + if feature_names.size == 1 feature_name = feature_names[0] end @@ -552,6 +557,7 @@ def time_mapping(time) 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 diff --git a/example_project/mappers/Floorspace.rb b/example_project/mappers/Floorspace.rb index 88bbd7854..40ecd70ad 100644 --- a/example_project/mappers/Floorspace.rb +++ b/example_project/mappers/Floorspace.rb @@ -258,6 +258,11 @@ def create_osw(scenario, features, feature_names) feature = features[0] feature_id = feature.id feature_type = feature.type + + # take the centroid of the vertices as the location of the building + feature_vertices_coordinates = feature.feature_json[:geometry][:coordinates][0] + feature_location = feature.find_feature_center(feature_vertices_coordinates).to_s + feature_name = feature.name if feature_names.size == 1 feature_name = feature_names[0] @@ -656,6 +661,7 @@ def time_mapping(time) 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 diff --git a/example_project/mappers/createbar_workflow.osw b/example_project/mappers/createbar_workflow.osw index 82160afa2..6bdacd0f7 100644 --- a/example_project/mappers/createbar_workflow.osw +++ b/example_project/mappers/createbar_workflow.osw @@ -90,7 +90,8 @@ "arguments": { "feature_id": null, "feature_name": null, - "feature_type": null + "feature_type": null, + "feature_location": null } } ], diff --git a/example_project/mappers/floorspace_workflow.osw b/example_project/mappers/floorspace_workflow.osw index c80cf6fdd..a083dfa24 100644 --- a/example_project/mappers/floorspace_workflow.osw +++ b/example_project/mappers/floorspace_workflow.osw @@ -125,7 +125,8 @@ "arguments": { "feature_id": null, "feature_name": null, - "feature_type": null + "feature_type": null, + "feature_location": null } } ],