urbanopt-geojson 0.3.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +2 -2
- data/CHANGELOG.md +54 -4
- data/CONTRIBUTING.md +1 -1
- data/LICENSE.md +1 -1
- data/RDOC_MAIN.md +26 -22
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/doc_templates/LICENSE.md +1 -1
- data/doc_templates/copyright_erb.txt +1 -1
- data/doc_templates/copyright_js.txt +1 -1
- data/doc_templates/copyright_ruby.txt +1 -1
- data/docs/.vuepress/components/InnerJsonSchema.vue +7 -11
- data/docs/.vuepress/config.js +11 -1
- data/docs/.vuepress/highlight.js +1 -1
- data/docs/.vuepress/json-schema-deref-loader.js +22 -0
- data/docs/README.md +3 -4
- data/docs/package-lock.json +5205 -6885
- data/docs/package.json +13 -9
- data/lib/measures/.rubocop.yml +1 -1
- data/lib/measures/urban_geometry_creation/LICENSE.md +1 -1
- data/lib/measures/urban_geometry_creation/README.md +8 -0
- data/lib/measures/urban_geometry_creation/measure.rb +21 -4
- data/lib/measures/urban_geometry_creation/measure.xml +34 -20
- data/lib/measures/urban_geometry_creation_zoning/LICENSE.md +1 -1
- data/lib/measures/urban_geometry_creation_zoning/measure.rb +3 -3
- data/lib/measures/urban_geometry_creation_zoning/measure.xml +8 -13
- data/lib/urbanopt-geojson.rb +1 -1
- data/lib/urbanopt/geojson.rb +2 -1
- data/lib/urbanopt/geojson/building.rb +61 -10
- data/lib/urbanopt/geojson/derived_extension.rb +1 -1
- data/lib/urbanopt/geojson/district_system.rb +1 -1
- data/lib/urbanopt/geojson/feature.rb +117 -3
- data/lib/urbanopt/geojson/geo_file.rb +3 -4
- data/lib/urbanopt/geojson/helper.rb +46 -3
- data/lib/urbanopt/geojson/logging.rb +1 -1
- data/lib/urbanopt/geojson/mapper_classes.rb +1 -1
- data/lib/urbanopt/geojson/model.rb +1 -1
- data/lib/urbanopt/geojson/region.rb +1 -1
- data/lib/urbanopt/geojson/scale_area.rb +95 -0
- data/lib/urbanopt/geojson/schema/building_properties.json +57 -7
- data/lib/urbanopt/geojson/schema/electrical_connector_properties.json +9 -9
- data/lib/urbanopt/geojson/schema/electrical_junction_properties.json +4 -5
- data/lib/urbanopt/geojson/schema/thermal_connector_properties.json +1 -1
- data/lib/urbanopt/geojson/schema/thermal_junction_properties.json +1 -1
- data/lib/urbanopt/geojson/update_areas.rb +1 -1
- data/lib/urbanopt/geojson/validate_geojson.rb +1 -1
- data/lib/urbanopt/geojson/version.rb +2 -2
- data/lib/urbanopt/geojson/zoning.rb +21 -16
- data/urbanopt-geojson-gem.gemspec +4 -8
- metadata +12 -23
data/docs/package.json
CHANGED
@@ -10,20 +10,24 @@
|
|
10
10
|
},
|
11
11
|
"author": "Brian Schiller",
|
12
12
|
"dependencies": {
|
13
|
-
"highlight.js": "^
|
14
|
-
"json-schema-ref-parser": "^
|
13
|
+
"highlight.js": "^10.4.1",
|
14
|
+
"json-schema-ref-parser": "^9.0.6",
|
15
15
|
"json-schema-view-js": "git+https://git@github.com/bgschiller/json-schema-view-js.git",
|
16
|
-
"vuepress": "^
|
16
|
+
"vuepress": "^1.5.4",
|
17
17
|
"webpack-dev-middleware": "^3.6.0"
|
18
18
|
},
|
19
19
|
"devDependencies": {
|
20
|
-
"braces": "
|
21
|
-
"
|
20
|
+
"braces": "^3.0.2",
|
21
|
+
"dot-prop": ">=5.1.1",
|
22
|
+
"gh-pages": "^3.1.0",
|
22
23
|
"js-yaml": ">=3.13.1",
|
23
|
-
"lodash": ">=4.17.
|
24
|
+
"lodash": ">=4.17.19",
|
24
25
|
"lodash.template": ">=4.5.0",
|
25
|
-
"
|
26
|
-
"
|
27
|
-
"
|
26
|
+
"minimist": ">=1.2.3",
|
27
|
+
"mixin-deep": "^2.0.1",
|
28
|
+
"serialize-javascript": "^5.0.1",
|
29
|
+
"set-value": "^3.0.2",
|
30
|
+
"yargs-parser": "^20.2.3",
|
31
|
+
"ini": "^2.0.0"
|
28
32
|
}
|
29
33
|
}
|
data/lib/measures/.rubocop.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
1
|
+
URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
2
|
contributors. All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -43,6 +43,14 @@ Select which surrounding buildings to include.
|
|
43
43
|
**Required:** true,
|
44
44
|
**Model Dependent:** false
|
45
45
|
|
46
|
+
### Scale Footprint Area by the Floor Area?
|
47
|
+
If true, the footprint area from GeoJSON will be scaled by the floor_area provided by the user in URBANopt.
|
48
|
+
**Name:** scale_footprint_area_by_floor_area,
|
49
|
+
**Type:** Boolean,
|
50
|
+
**Units:** ,
|
51
|
+
**Required:** false,
|
52
|
+
**Model Dependent:** false
|
53
|
+
|
46
54
|
|
47
55
|
|
48
56
|
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
4
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
5
|
# contributors. All rights reserved.
|
4
6
|
#
|
5
7
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -73,13 +75,17 @@ class UrbanGeometryCreation < OpenStudio::Measure::ModelMeasure
|
|
73
75
|
surrounding_buildings.setDescription('Select which surrounding buildings to include.')
|
74
76
|
surrounding_buildings.setDefaultValue('ShadingOnly')
|
75
77
|
args << surrounding_buildings
|
78
|
+
# not a required argument
|
79
|
+
scale_footprint_area_by_floor_area = OpenStudio::Ruleset::OSArgument.makeBoolArgument('scale_footprint_area_by_floor_area', false)
|
80
|
+
scale_footprint_area_by_floor_area.setDisplayName('Scale Footprint Area by the Floor Area?')
|
81
|
+
scale_footprint_area_by_floor_area.setDescription('If true, the footprint area from GeoJSON will be scaled by the floor_area provided by the user in URBANopt.')
|
82
|
+
scale_footprint_area_by_floor_area.setDefaultValue(false)
|
83
|
+
args << scale_footprint_area_by_floor_area
|
76
84
|
return args
|
77
85
|
end
|
78
86
|
|
79
87
|
# define what happens when the measure is run
|
80
|
-
# rubocop:disable Metrics/AbcSize
|
81
88
|
def run(model, runner, user_arguments)
|
82
|
-
# rubocop:enable Metrics/AbcSize
|
83
89
|
super(model, runner, user_arguments)
|
84
90
|
# use the built-in error checking
|
85
91
|
if !runner.validateUserArguments(arguments(model), user_arguments)
|
@@ -90,6 +96,7 @@ class UrbanGeometryCreation < OpenStudio::Measure::ModelMeasure
|
|
90
96
|
geojson_file = runner.getStringArgumentValue('geojson_file', user_arguments)
|
91
97
|
feature_id = runner.getStringArgumentValue('feature_id', user_arguments)
|
92
98
|
surrounding_buildings = runner.getStringArgumentValue('surrounding_buildings', user_arguments)
|
99
|
+
scale_footprint_area_by_floor_area = runner.getBoolArgumentValue('scale_footprint_area_by_floor_area', user_arguments)
|
93
100
|
|
94
101
|
default_construction_set = URBANopt::GeoJSON::Model.create_construction_set(model, runner)
|
95
102
|
|
@@ -133,7 +140,17 @@ class UrbanGeometryCreation < OpenStudio::Measure::ModelMeasure
|
|
133
140
|
|
134
141
|
if feature.type == 'Building'
|
135
142
|
# make requested building
|
136
|
-
|
143
|
+
# pass in scaled_footprint_area (calculated from floor_area / number_of_stories)
|
144
|
+
scaled_footprint_area = 0
|
145
|
+
if scale_footprint_area_by_floor_area
|
146
|
+
building_hash = feature.to_hash
|
147
|
+
if building_hash[:number_of_stories] && building_hash[:floor_area]
|
148
|
+
scaled_footprint_area = building_hash[:floor_area].to_f / building_hash[:number_of_stories].to_f
|
149
|
+
@runner.registerInfo("Desired footprint area in ft2: #{scaled_footprint_area}")
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
spaces = feature.create_building(:space_per_floor, model, @origin_lat_lon, @runner, false, scaled_footprint_area)
|
137
154
|
if spaces.nil?
|
138
155
|
@runner.registerError("Failed to create spaces for building '#{name}'")
|
139
156
|
return false
|
@@ -1,9 +1,10 @@
|
|
1
|
+
<?xml version="1.0"?>
|
1
2
|
<measure>
|
2
3
|
<schema_version>3.0</schema_version>
|
3
4
|
<name>urban_geometry_creation</name>
|
4
5
|
<uid>5ab85d6b-c9af-4361-8ab9-613ee99a5666</uid>
|
5
|
-
<version_id>
|
6
|
-
<version_modified>
|
6
|
+
<version_id>2e224aaa-0d77-486f-b8ef-c25121fabd91</version_id>
|
7
|
+
<version_modified>20201208T232103Z</version_modified>
|
7
8
|
<xml_checksum>D254E772</xml_checksum>
|
8
9
|
<class_name>UrbanGeometryCreation</class_name>
|
9
10
|
<display_name>UrbanGeometryCreation</display_name>
|
@@ -45,9 +46,28 @@
|
|
45
46
|
</choice>
|
46
47
|
</choices>
|
47
48
|
</argument>
|
49
|
+
<argument>
|
50
|
+
<name>scale_footprint_area_by_floor_area</name>
|
51
|
+
<display_name>Scale Footprint Area by the Floor Area?</display_name>
|
52
|
+
<description>If true, the footprint area from GeoJSON will be scaled by the floor_area provided by the user in URBANopt.</description>
|
53
|
+
<type>Boolean</type>
|
54
|
+
<required>false</required>
|
55
|
+
<model_dependent>false</model_dependent>
|
56
|
+
<default_value>false</default_value>
|
57
|
+
<choices>
|
58
|
+
<choice>
|
59
|
+
<value>true</value>
|
60
|
+
<display_name>true</display_name>
|
61
|
+
</choice>
|
62
|
+
<choice>
|
63
|
+
<value>false</value>
|
64
|
+
<display_name>false</display_name>
|
65
|
+
</choice>
|
66
|
+
</choices>
|
67
|
+
</argument>
|
48
68
|
</arguments>
|
49
|
-
<outputs/>
|
50
|
-
<provenances/>
|
69
|
+
<outputs />
|
70
|
+
<provenances />
|
51
71
|
<tags>
|
52
72
|
<tag>Envelope.Form</tag>
|
53
73
|
</tags>
|
@@ -90,29 +110,29 @@
|
|
90
110
|
<usage_type>readmeerb</usage_type>
|
91
111
|
<checksum>703C9964</checksum>
|
92
112
|
</file>
|
93
|
-
<file>
|
94
|
-
<filename>LICENSE.md</filename>
|
95
|
-
<filetype>md</filetype>
|
96
|
-
<usage_type>license</usage_type>
|
97
|
-
<checksum>EA283B74</checksum>
|
98
|
-
</file>
|
99
113
|
<file>
|
100
114
|
<filename>nrel_stm_footprints.geojson</filename>
|
101
115
|
<filetype>geojson</filetype>
|
102
116
|
<usage_type>test</usage_type>
|
103
117
|
<checksum>40290298</checksum>
|
104
118
|
</file>
|
119
|
+
<file>
|
120
|
+
<filename>LICENSE.md</filename>
|
121
|
+
<filetype>md</filetype>
|
122
|
+
<usage_type>license</usage_type>
|
123
|
+
<checksum>D8541540</checksum>
|
124
|
+
</file>
|
105
125
|
<file>
|
106
126
|
<filename>shadowed_tests.rb</filename>
|
107
127
|
<filetype>rb</filetype>
|
108
128
|
<usage_type>test</usage_type>
|
109
|
-
<checksum>
|
129
|
+
<checksum>F656F8DE</checksum>
|
110
130
|
</file>
|
111
131
|
<file>
|
112
132
|
<filename>urban_geometry_creation_test.rb</filename>
|
113
133
|
<filetype>rb</filetype>
|
114
134
|
<usage_type>test</usage_type>
|
115
|
-
<checksum>
|
135
|
+
<checksum>B4A7376B</checksum>
|
116
136
|
</file>
|
117
137
|
<file>
|
118
138
|
<version>
|
@@ -123,19 +143,13 @@
|
|
123
143
|
<filename>measure.rb</filename>
|
124
144
|
<filetype>rb</filetype>
|
125
145
|
<usage_type>script</usage_type>
|
126
|
-
<checksum>
|
127
|
-
</file>
|
128
|
-
<file>
|
129
|
-
<filename>out.txt</filename>
|
130
|
-
<filetype>txt</filetype>
|
131
|
-
<usage_type>test</usage_type>
|
132
|
-
<checksum>C5B18B73</checksum>
|
146
|
+
<checksum>791A977E</checksum>
|
133
147
|
</file>
|
134
148
|
<file>
|
135
149
|
<filename>README.md</filename>
|
136
150
|
<filetype>md</filetype>
|
137
151
|
<usage_type>readme</usage_type>
|
138
|
-
<checksum>
|
152
|
+
<checksum>74F54DC5</checksum>
|
139
153
|
</file>
|
140
154
|
</files>
|
141
155
|
</measure>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
1
|
+
URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
2
|
contributors. All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
4
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
5
|
# contributors. All rights reserved.
|
4
6
|
#
|
5
7
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -81,9 +83,7 @@ class UrbanGeometryCreationZoning < OpenStudio::Measure::ModelMeasure
|
|
81
83
|
end
|
82
84
|
|
83
85
|
# define what happens when the measure is run
|
84
|
-
# rubocop:disable Metrics/AbcSize
|
85
86
|
def run(model, runner, user_arguments)
|
86
|
-
# rubocop:enable Metrics/AbcSize
|
87
87
|
super(model, runner, user_arguments)
|
88
88
|
# use the built-in error checking
|
89
89
|
if !runner.validateUserArguments(arguments(model), user_arguments)
|
@@ -1,9 +1,10 @@
|
|
1
|
+
<?xml version="1.0"?>
|
1
2
|
<measure>
|
2
3
|
<schema_version>3.0</schema_version>
|
3
4
|
<name>urban_geometry_creation_zoning</name>
|
4
5
|
<uid>96ea1317-76ac-4670-b51d-71ee3f4fdd65</uid>
|
5
|
-
<version_id>
|
6
|
-
<version_modified>
|
6
|
+
<version_id>0c0d1135-a50f-40c6-82fb-fc357e46dd02</version_id>
|
7
|
+
<version_modified>20201208T232103Z</version_modified>
|
7
8
|
<xml_checksum>D254E772</xml_checksum>
|
8
9
|
<class_name>UrbanGeometryCreationZoning</class_name>
|
9
10
|
<display_name>UrbanGeometryCreationZoning</display_name>
|
@@ -46,8 +47,8 @@
|
|
46
47
|
</choices>
|
47
48
|
</argument>
|
48
49
|
</arguments>
|
49
|
-
<outputs/>
|
50
|
-
<provenances/>
|
50
|
+
<outputs />
|
51
|
+
<provenances />
|
51
52
|
<tags>
|
52
53
|
<tag>Envelope.Form</tag>
|
53
54
|
</tags>
|
@@ -100,7 +101,7 @@
|
|
100
101
|
<filename>LICENSE.md</filename>
|
101
102
|
<filetype>md</filetype>
|
102
103
|
<usage_type>license</usage_type>
|
103
|
-
<checksum>
|
104
|
+
<checksum>D8541540</checksum>
|
104
105
|
</file>
|
105
106
|
<file>
|
106
107
|
<version>
|
@@ -111,19 +112,13 @@
|
|
111
112
|
<filename>measure.rb</filename>
|
112
113
|
<filetype>rb</filetype>
|
113
114
|
<usage_type>script</usage_type>
|
114
|
-
<checksum>
|
115
|
-
</file>
|
116
|
-
<file>
|
117
|
-
<filename>out.txt</filename>
|
118
|
-
<filetype>txt</filetype>
|
119
|
-
<usage_type>test</usage_type>
|
120
|
-
<checksum>7FAF05F3</checksum>
|
115
|
+
<checksum>3E6D4653</checksum>
|
121
116
|
</file>
|
122
117
|
<file>
|
123
118
|
<filename>urban_geometry_creation_zoning_test.rb</filename>
|
124
119
|
<filetype>rb</filetype>
|
125
120
|
<usage_type>test</usage_type>
|
126
|
-
<checksum>
|
121
|
+
<checksum>D609CD4C</checksum>
|
127
122
|
</file>
|
128
123
|
<file>
|
129
124
|
<filename>README.md</filename>
|
data/lib/urbanopt-geojson.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
data/lib/urbanopt/geojson.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -39,3 +39,4 @@ require 'urbanopt/geojson/zoning'
|
|
39
39
|
require 'urbanopt/geojson/model'
|
40
40
|
require 'urbanopt/geojson/derived_extension'
|
41
41
|
require 'urbanopt/geojson/logging'
|
42
|
+
require 'urbanopt/geojson/scale_area'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -87,9 +87,11 @@ module URBANopt
|
|
87
87
|
# * +origin_lat_lon+ - _Type:Float_ - An instance of +OpenStudio::PointLatLon+ indicating the latitude and longitude of the origin.
|
88
88
|
# * +runner+ - _Type:String_ - An instance of +OpenStudio::Measure::OSRunner+ for the measure run.
|
89
89
|
# * +zoning+ - _Type:Boolean_ - Value is +true+ if utilizing detailed zoning, else
|
90
|
-
# +false
|
90
|
+
# +false+ Zoning is set to False by default.
|
91
|
+
# * +scaled_footprint_area+ - Used to scale the footprint area using the floor area. 0 by
|
92
|
+
# default (no scaling).
|
91
93
|
# * +other_building+ - _Type:URBANopt::GeoJSON::Feature - Optional, allow the user to pass in a different building to process. This is used for creating the other buildings for shading.
|
92
|
-
def create_building(create_method, model, origin_lat_lon, runner, zoning = false, other_building = @feature_json)
|
94
|
+
def create_building(create_method, model, origin_lat_lon, runner, zoning = false, scaled_footprint_area = 0, other_building = @feature_json)
|
93
95
|
number_of_stories = other_building[:properties][:number_of_stories]
|
94
96
|
number_of_stories_above_ground = other_building[:properties][:number_of_stories_above_ground]
|
95
97
|
number_of_stories_below_ground = other_building[:properties][:number_of_stories_below_ground]
|
@@ -128,7 +130,7 @@ module URBANopt
|
|
128
130
|
spaces = []
|
129
131
|
if create_method == :space_per_floor || create_method == :spaces_per_floor
|
130
132
|
(-number_of_stories_below_ground + 1..number_of_stories_above_ground).each do |story_number|
|
131
|
-
new_spaces = create_space_per_floor(story_number, floor_to_floor_height, model, origin_lat_lon, runner, zoning)
|
133
|
+
new_spaces = create_space_per_floor(story_number, floor_to_floor_height, model, origin_lat_lon, runner, zoning, scaled_footprint_area)
|
132
134
|
spaces.concat(new_spaces)
|
133
135
|
end
|
134
136
|
elsif create_method == :space_per_building
|
@@ -248,9 +250,50 @@ module URBANopt
|
|
248
250
|
end
|
249
251
|
|
250
252
|
##
|
251
|
-
#
|
253
|
+
# Used to calculate the perimeter from the floor polygon of a Feature. Returns the perimeter
|
254
|
+
# value.
|
255
|
+
#
|
256
|
+
# [Parameters]
|
257
|
+
# * +feature+ - An instance of URBANopt::GeoJSON::Feature
|
258
|
+
#
|
259
|
+
def calculate_perimeter(feature)
|
260
|
+
model = OpenStudio::Model::Model.new
|
261
|
+
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
262
|
+
origin_lat_lon = nil
|
263
|
+
origin_lat_lon = feature.create_origin_lat_lon(runner)
|
264
|
+
spaces = feature.create_building(:space_per_building, model, origin_lat_lon, runner)
|
265
|
+
surfaces = spaces[0].surfaces
|
266
|
+
ground_surface = nil
|
267
|
+
surfaces.each do |surface|
|
268
|
+
boundary_condition = surface.outsideBoundaryCondition
|
269
|
+
if boundary_condition == 'Ground'
|
270
|
+
ground_surface = surface
|
271
|
+
end
|
272
|
+
end
|
273
|
+
vertices = ground_surface.vertices
|
274
|
+
n = vertices.size
|
275
|
+
perimeter = 0
|
276
|
+
for i in (0..n - 1) do i
|
277
|
+
vertex_1 = nil
|
278
|
+
vertex_2 = nil
|
279
|
+
if i == n - 1
|
280
|
+
vertex_1 = vertices[n - 1]
|
281
|
+
vertex_2 = vertices[0]
|
282
|
+
else
|
283
|
+
vertex_1 = vertices[i]
|
284
|
+
vertex_2 = vertices[i + 1]
|
285
|
+
end
|
286
|
+
length = OpenStudio::Vector3d.new(vertex_2 - vertex_1).length
|
287
|
+
perimeter += length
|
288
|
+
end
|
289
|
+
perimeter = OpenStudio.convert(perimeter, 'm', 'ft').get
|
290
|
+
perimeter = perimeter.round(4)
|
291
|
+
return perimeter
|
292
|
+
end
|
293
|
+
|
252
294
|
##
|
253
|
-
#
|
295
|
+
# Convert to a Hash equivalent for JSON serialization.
|
296
|
+
# Excludes attributes with nil value.
|
254
297
|
##
|
255
298
|
def to_hash
|
256
299
|
result = {}
|
@@ -354,10 +397,18 @@ module URBANopt
|
|
354
397
|
# * +zoning+ - _Type:Boolean_ - Value is +true+ if utilizing detailed zoning, else
|
355
398
|
# +false+. Zoning is set to False by default.
|
356
399
|
# rubocop:disable Style/CommentedKeyword
|
357
|
-
def create_space_per_floor(story_number, floor_to_floor_height, model, origin_lat_lon, runner, zoning = false) #:doc:
|
400
|
+
def create_space_per_floor(story_number, floor_to_floor_height, model, origin_lat_lon, runner, zoning = false, scaled_footprint_area) #:doc:
|
358
401
|
# rubocop:enable Style/CommentedKeyword
|
359
|
-
|
360
|
-
|
402
|
+
begin
|
403
|
+
if other_building
|
404
|
+
geometry = other_building[:geometry]
|
405
|
+
properties = other_building[:properties]
|
406
|
+
else
|
407
|
+
geometry = @feature_json[:geometry]
|
408
|
+
properties = @feature_json[:properties]
|
409
|
+
end
|
410
|
+
rescue StandardError
|
411
|
+
end
|
361
412
|
floor_prints = []
|
362
413
|
multi_polygons = get_multi_polygons
|
363
414
|
multi_polygons.each do |multi_polygon|
|
@@ -366,7 +417,7 @@ module URBANopt
|
|
366
417
|
end
|
367
418
|
multi_polygon.each do |polygon|
|
368
419
|
elevation = (story_number - 1) * floor_to_floor_height
|
369
|
-
floor_print = URBANopt::GeoJSON::Helper.floor_print_from_polygon(polygon, elevation, origin_lat_lon, runner, zoning)
|
420
|
+
floor_print = URBANopt::GeoJSON::Helper.floor_print_from_polygon(polygon, elevation, origin_lat_lon, runner, zoning, scaled_footprint_area)
|
370
421
|
if floor_print
|
371
422
|
if zoning
|
372
423
|
this_floor_prints = URBANopt::GeoJSON::Zoning.divide_floor_print(floor_print, 4.0, runner)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|