urbanopt-geojson 0.2.0.pre3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +0 -3
- data/LICENSE.md +1 -1
- data/RDOC_MAIN.md +1 -1
- data/README.md +1 -1
- data/Rakefile +2 -2
- 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/README.md +1 -1
- data/docs/package-lock.json +5206 -6883
- data/docs/package.json +12 -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 +2 -2
- data/lib/measures/urban_geometry_creation/measure.rb +21 -2
- data/lib/measures/urban_geometry_creation/measure.xml +17 -20
- data/lib/measures/urban_geometry_creation_zoning/LICENSE.md +1 -1
- data/lib/measures/urban_geometry_creation_zoning/README.md +1 -1
- data/lib/measures/urban_geometry_creation_zoning/measure.rb +5 -4
- data/lib/measures/urban_geometry_creation_zoning/measure.xml +15 -18
- data/lib/urbanopt-geojson.rb +1 -1
- data/lib/urbanopt/geojson.rb +2 -1
- data/lib/urbanopt/geojson/building.rb +74 -26
- data/lib/urbanopt/geojson/derived_extension.rb +1 -1
- data/lib/urbanopt/geojson/district_system.rb +1 -1
- data/lib/urbanopt/geojson/feature.rb +116 -2
- data/lib/urbanopt/geojson/geo_file.rb +28 -29
- data/lib/urbanopt/geojson/helper.rb +42 -7
- data/lib/urbanopt/geojson/logging.rb +1 -1
- data/lib/urbanopt/geojson/mapper_classes.rb +47 -47
- data/lib/urbanopt/geojson/model.rb +3 -4
- data/lib/urbanopt/geojson/region.rb +1 -1
- data/lib/urbanopt/geojson/scale_area.rb +91 -0
- data/lib/urbanopt/geojson/schema/building_properties.json +252 -80
- 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 +2 -2
- data/lib/urbanopt/geojson/validate_geojson.rb +3 -1
- data/lib/urbanopt/geojson/version.rb +2 -2
- data/lib/urbanopt/geojson/workflows/building.osw.out +4 -4
- data/lib/urbanopt/geojson/zoning.rb +21 -16
- data/urbanopt-geojson-gem.gemspec +10 -17
- metadata +29 -48
- data/lib/change_log.rb +0 -147
- data/lib/measures/urban_geometry_creation/tests/nrel_stm_footprints.geojson +0 -3238
- data/lib/measures/urban_geometry_creation/tests/shadowed_tests.rb +0 -80
- data/lib/measures/urban_geometry_creation/tests/urban_geometry_creation_test.rb +0 -139
- data/lib/measures/urban_geometry_creation_zoning/tests/nrel_stm_footprints.geojson +0 -3238
- data/lib/measures/urban_geometry_creation_zoning/tests/urban_geometry_creation_zoning_test.rb +0 -139
data/docs/package.json
CHANGED
@@ -10,20 +10,23 @@
|
|
10
10
|
},
|
11
11
|
"author": "Brian Schiller",
|
12
12
|
"dependencies": {
|
13
|
-
"highlight.js": "^
|
14
|
-
"json-schema-ref-parser": "^
|
13
|
+
"highlight.js": "^10.2.0",
|
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": ">=18.1.1"
|
28
31
|
}
|
29
32
|
}
|
data/lib/measures/.rubocop.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
URBANopt
|
1
|
+
URBANopt™, 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,
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# UrbanGeometryCreation
|
6
6
|
|
7
7
|
## Description
|
8
|
-
This measure reads an URBANopt GeoJSON and creates geometry for a particular building. Surrounding buildings are included as shading structures.
|
8
|
+
This measure reads an URBANopt™ GeoJSON and creates geometry for a particular building. Surrounding buildings are included as shading structures.
|
9
9
|
|
10
10
|
## Modeler Description
|
11
|
-
|
11
|
+
This measure takes in the GeoJSON file, the feature_id of the building and the surrounding buildings as arguments and add has methods to create space types and add default construction sets.
|
12
12
|
|
13
13
|
## Measure Type
|
14
14
|
ModelMeasure
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
4
|
+
# URBANopt™, 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,6 +75,12 @@ 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
|
|
@@ -88,6 +96,7 @@ class UrbanGeometryCreation < OpenStudio::Measure::ModelMeasure
|
|
88
96
|
geojson_file = runner.getStringArgumentValue('geojson_file', user_arguments)
|
89
97
|
feature_id = runner.getStringArgumentValue('feature_id', user_arguments)
|
90
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)
|
91
100
|
|
92
101
|
default_construction_set = URBANopt::GeoJSON::Model.create_construction_set(model, runner)
|
93
102
|
|
@@ -131,7 +140,17 @@ class UrbanGeometryCreation < OpenStudio::Measure::ModelMeasure
|
|
131
140
|
|
132
141
|
if feature.type == 'Building'
|
133
142
|
# make requested building
|
134
|
-
|
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)
|
135
154
|
if spaces.nil?
|
136
155
|
@runner.registerError("Failed to create spaces for building '#{name}'")
|
137
156
|
return false
|
@@ -1,14 +1,15 @@
|
|
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>e32672b2-91b1-4b62-9770-7712cab86004</version_id>
|
7
|
+
<version_modified>20200807T210717Z</version_modified>
|
7
8
|
<xml_checksum>D254E772</xml_checksum>
|
8
9
|
<class_name>UrbanGeometryCreation</class_name>
|
9
10
|
<display_name>UrbanGeometryCreation</display_name>
|
10
11
|
<description>This measure reads an URBANopt GeoJSON and creates geometry for a particular building. Surrounding buildings are included as shading structures.</description>
|
11
|
-
<modeler_description
|
12
|
+
<modeler_description>This measure takes in the GeoJSON file, the feature_id of the building and the surrounding buildings as arguments and add has methods to create space types and add default construction sets.</modeler_description>
|
12
13
|
<arguments>
|
13
14
|
<argument>
|
14
15
|
<name>geojson_file</name>
|
@@ -43,15 +44,11 @@
|
|
43
44
|
<value>ShadingOnly</value>
|
44
45
|
<display_name>ShadingOnly</display_name>
|
45
46
|
</choice>
|
46
|
-
<choice>
|
47
|
-
<value>All</value>
|
48
|
-
<display_name>All</display_name>
|
49
|
-
</choice>
|
50
47
|
</choices>
|
51
48
|
</argument>
|
52
49
|
</arguments>
|
53
|
-
<outputs/>
|
54
|
-
<provenances/>
|
50
|
+
<outputs />
|
51
|
+
<provenances />
|
55
52
|
<tags>
|
56
53
|
<tag>Envelope.Form</tag>
|
57
54
|
</tags>
|
@@ -94,35 +91,35 @@
|
|
94
91
|
<usage_type>readmeerb</usage_type>
|
95
92
|
<checksum>703C9964</checksum>
|
96
93
|
</file>
|
97
|
-
<file>
|
98
|
-
<filename>README.md</filename>
|
99
|
-
<filetype>md</filetype>
|
100
|
-
<usage_type>readme</usage_type>
|
101
|
-
<checksum>D339FA87</checksum>
|
102
|
-
</file>
|
103
94
|
<file>
|
104
95
|
<filename>LICENSE.md</filename>
|
105
96
|
<filetype>md</filetype>
|
106
97
|
<usage_type>license</usage_type>
|
107
|
-
<checksum>
|
98
|
+
<checksum>EA283B74</checksum>
|
108
99
|
</file>
|
109
100
|
<file>
|
110
101
|
<filename>nrel_stm_footprints.geojson</filename>
|
111
102
|
<filetype>geojson</filetype>
|
112
103
|
<usage_type>test</usage_type>
|
113
|
-
<checksum>
|
104
|
+
<checksum>40290298</checksum>
|
105
|
+
</file>
|
106
|
+
<file>
|
107
|
+
<filename>README.md</filename>
|
108
|
+
<filetype>md</filetype>
|
109
|
+
<usage_type>readme</usage_type>
|
110
|
+
<checksum>A09F345D</checksum>
|
114
111
|
</file>
|
115
112
|
<file>
|
116
113
|
<filename>shadowed_tests.rb</filename>
|
117
114
|
<filetype>rb</filetype>
|
118
115
|
<usage_type>test</usage_type>
|
119
|
-
<checksum>
|
116
|
+
<checksum>4E51A05C</checksum>
|
120
117
|
</file>
|
121
118
|
<file>
|
122
119
|
<filename>urban_geometry_creation_test.rb</filename>
|
123
120
|
<filetype>rb</filetype>
|
124
121
|
<usage_type>test</usage_type>
|
125
|
-
<checksum>
|
122
|
+
<checksum>DDAD6BFA</checksum>
|
126
123
|
</file>
|
127
124
|
<file>
|
128
125
|
<version>
|
@@ -133,7 +130,7 @@
|
|
133
130
|
<filename>measure.rb</filename>
|
134
131
|
<filetype>rb</filetype>
|
135
132
|
<usage_type>script</usage_type>
|
136
|
-
<checksum>
|
133
|
+
<checksum>2F8C09F7</checksum>
|
137
134
|
</file>
|
138
135
|
</files>
|
139
136
|
</measure>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
URBANopt
|
1
|
+
URBANopt™, 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,
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# UrbanGeometryCreationZoning
|
6
6
|
|
7
7
|
## Description
|
8
|
-
This measure reads an URBANopt GeoJSON and creates geometry for a particular building. Surrounding buildings are included as shading structures.
|
8
|
+
This measure reads an URBANopt™ GeoJSON and creates geometry with zoning for a particular building. Surrounding buildings are included as shading structures.
|
9
9
|
|
10
10
|
## Modeler Description
|
11
11
|
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# *********************************************************************************
|
2
|
-
# URBANopt
|
4
|
+
# URBANopt™, 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,
|
@@ -111,8 +113,8 @@ class UrbanGeometryCreationZoning < OpenStudio::Measure::ModelMeasure
|
|
111
113
|
@runner = runner
|
112
114
|
@origin_lat_lon = nil
|
113
115
|
|
114
|
-
all_features = URBANopt::GeoJSON::GeoFile.from_file(geojson_file)
|
115
|
-
feature = URBANopt::GeoJSON::GeoFile.from_file(geojson_file).get_feature_by_id(feature_id)
|
116
|
+
all_features = URBANopt::GeoJSON::GeoFile.from_file(geojson_file)
|
117
|
+
feature = URBANopt::GeoJSON::GeoFile.from_file(geojson_file).get_feature_by_id(feature_id)
|
116
118
|
|
117
119
|
# EXPOSE NAME
|
118
120
|
name = feature.feature_json[:properties][:name]
|
@@ -153,7 +155,6 @@ class UrbanGeometryCreationZoning < OpenStudio::Measure::ModelMeasure
|
|
153
155
|
convert_to_shades = feature.create_other_buildings(surrounding_buildings, all_features.json, model, @origin_lat_lon, @runner)
|
154
156
|
end
|
155
157
|
|
156
|
-
|
157
158
|
# intersect surfaces in this building with others
|
158
159
|
@runner.registerInfo('Intersecting surfaces')
|
159
160
|
spaces.each do |space|
|
@@ -1,13 +1,14 @@
|
|
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>884d6eb0-6517-40dc-96ca-ac4db7c2ad7d</version_id>
|
7
|
+
<version_modified>20200807T210718Z</version_modified>
|
7
8
|
<xml_checksum>D254E772</xml_checksum>
|
8
9
|
<class_name>UrbanGeometryCreationZoning</class_name>
|
9
10
|
<display_name>UrbanGeometryCreationZoning</display_name>
|
10
|
-
<description>This measure reads an URBANopt GeoJSON and creates geometry for a particular building. Surrounding buildings are included as shading structures.</description>
|
11
|
+
<description>This measure reads an URBANopt GeoJSON and creates geometry with zoning for a particular building. Surrounding buildings are included as shading structures.</description>
|
11
12
|
<modeler_description></modeler_description>
|
12
13
|
<arguments>
|
13
14
|
<argument>
|
@@ -43,15 +44,11 @@
|
|
43
44
|
<value>ShadingOnly</value>
|
44
45
|
<display_name>ShadingOnly</display_name>
|
45
46
|
</choice>
|
46
|
-
<choice>
|
47
|
-
<value>All</value>
|
48
|
-
<display_name>All</display_name>
|
49
|
-
</choice>
|
50
47
|
</choices>
|
51
48
|
</argument>
|
52
49
|
</arguments>
|
53
|
-
<outputs/>
|
54
|
-
<provenances/>
|
50
|
+
<outputs />
|
51
|
+
<provenances />
|
55
52
|
<tags>
|
56
53
|
<tag>Envelope.Form</tag>
|
57
54
|
</tags>
|
@@ -104,19 +101,13 @@
|
|
104
101
|
<filename>LICENSE.md</filename>
|
105
102
|
<filetype>md</filetype>
|
106
103
|
<usage_type>license</usage_type>
|
107
|
-
<checksum>
|
104
|
+
<checksum>EA283B74</checksum>
|
108
105
|
</file>
|
109
106
|
<file>
|
110
107
|
<filename>README.md</filename>
|
111
108
|
<filetype>md</filetype>
|
112
109
|
<usage_type>readme</usage_type>
|
113
|
-
<checksum>
|
114
|
-
</file>
|
115
|
-
<file>
|
116
|
-
<filename>urban_geometry_creation_test.rb</filename>
|
117
|
-
<filetype>rb</filetype>
|
118
|
-
<usage_type>test</usage_type>
|
119
|
-
<checksum>111178B3</checksum>
|
110
|
+
<checksum>0458EE16</checksum>
|
120
111
|
</file>
|
121
112
|
<file>
|
122
113
|
<version>
|
@@ -127,7 +118,13 @@
|
|
127
118
|
<filename>measure.rb</filename>
|
128
119
|
<filetype>rb</filetype>
|
129
120
|
<usage_type>script</usage_type>
|
130
|
-
<checksum>
|
121
|
+
<checksum>2505C43D</checksum>
|
122
|
+
</file>
|
123
|
+
<file>
|
124
|
+
<filename>urban_geometry_creation_zoning_test.rb</filename>
|
125
|
+
<filetype>rb</filetype>
|
126
|
+
<usage_type>test</usage_type>
|
127
|
+
<checksum>986CB63E</checksum>
|
131
128
|
</file>
|
132
129
|
</files>
|
133
130
|
</measure>
|
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,
|
@@ -33,7 +33,6 @@ require 'urbanopt/geojson/feature'
|
|
33
33
|
module URBANopt
|
34
34
|
module GeoJSON
|
35
35
|
class Building < URBANopt::GeoJSON::Feature
|
36
|
-
|
37
36
|
##
|
38
37
|
# Used to initialize the feature. This method is inherited from the Feature class.
|
39
38
|
def initialize(feature = {})
|
@@ -88,9 +87,11 @@ module URBANopt
|
|
88
87
|
# * +origin_lat_lon+ - _Type:Float_ - An instance of +OpenStudio::PointLatLon+ indicating the latitude and longitude of the origin.
|
89
88
|
# * +runner+ - _Type:String_ - An instance of +OpenStudio::Measure::OSRunner+ for the measure run.
|
90
89
|
# * +zoning+ - _Type:Boolean_ - Value is +true+ if utilizing detailed zoning, else
|
91
|
-
# +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).
|
92
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.
|
93
|
-
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)
|
94
95
|
number_of_stories = other_building[:properties][:number_of_stories]
|
95
96
|
number_of_stories_above_ground = other_building[:properties][:number_of_stories_above_ground]
|
96
97
|
number_of_stories_below_ground = other_building[:properties][:number_of_stories_below_ground]
|
@@ -129,7 +130,7 @@ module URBANopt
|
|
129
130
|
spaces = []
|
130
131
|
if create_method == :space_per_floor || create_method == :spaces_per_floor
|
131
132
|
(-number_of_stories_below_ground + 1..number_of_stories_above_ground).each do |story_number|
|
132
|
-
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)
|
133
134
|
spaces.concat(new_spaces)
|
134
135
|
end
|
135
136
|
elsif create_method == :space_per_building
|
@@ -248,6 +249,41 @@ module URBANopt
|
|
248
249
|
end
|
249
250
|
end
|
250
251
|
|
252
|
+
def calculate_perimeter(feature)
|
253
|
+
model = OpenStudio::Model::Model.new
|
254
|
+
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
255
|
+
origin_lat_lon = nil
|
256
|
+
origin_lat_lon = feature.create_origin_lat_lon(runner)
|
257
|
+
spaces = feature.create_building(:space_per_building, model, origin_lat_lon, runner)
|
258
|
+
surfaces = spaces[0].surfaces
|
259
|
+
ground_surface = nil
|
260
|
+
surfaces.each do |surface|
|
261
|
+
boundary_condition = surface.outsideBoundaryCondition
|
262
|
+
if boundary_condition == 'Ground'
|
263
|
+
ground_surface = surface
|
264
|
+
end
|
265
|
+
end
|
266
|
+
vertices = ground_surface.vertices
|
267
|
+
n = vertices.size
|
268
|
+
perimeter = 0
|
269
|
+
for i in (0..n - 1) do i
|
270
|
+
vertex_1 = nil
|
271
|
+
vertex_2 = nil
|
272
|
+
if i == n - 1
|
273
|
+
vertex_1 = vertices[n - 1]
|
274
|
+
vertex_2 = vertices[0]
|
275
|
+
else
|
276
|
+
vertex_1 = vertices[i]
|
277
|
+
vertex_2 = vertices[i + 1]
|
278
|
+
end
|
279
|
+
length = OpenStudio::Vector3d.new(vertex_2 - vertex_1).length
|
280
|
+
perimeter += length
|
281
|
+
end
|
282
|
+
perimeter = OpenStudio.convert(perimeter, 'm', 'ft').get
|
283
|
+
perimeter = perimeter.round(4)
|
284
|
+
return perimeter
|
285
|
+
end
|
286
|
+
|
251
287
|
##
|
252
288
|
# Convert to a Hash equivalent for JSON serialization
|
253
289
|
##
|
@@ -277,14 +313,13 @@ module URBANopt
|
|
277
313
|
result[:mixed_type_3_percentage] = @mixed_type_3_percentage if @mixed_type_3_percentage
|
278
314
|
result[:mixed_type_4] = @mixed_type_4 if @mixed_type_4
|
279
315
|
result[:mixed_type_4_percentage] = @mixed_type_4_percentage if @mixed_type_4_percentage
|
280
|
-
return result
|
316
|
+
return result
|
281
317
|
end
|
282
318
|
|
283
|
-
|
284
319
|
private
|
285
320
|
|
286
321
|
##
|
287
|
-
# Returns an array of instances of +OpenStudio::Model::Space+ per building
|
322
|
+
# Returns an array of instances of +OpenStudio::Model::Space+ per building.
|
288
323
|
#
|
289
324
|
# [Parameters]
|
290
325
|
# * +min_elevation+ - _Type:Integer_ - Indicates minimum elevation across all buildings.
|
@@ -294,7 +329,9 @@ module URBANopt
|
|
294
329
|
# * +runner+ - _Type:String_ - An instance of +Openstudio::Measure::OSRunner+ for the measure run.
|
295
330
|
# * +zoning+ - _Type:Boolean_ - Value is +true+ if utilizing detailed zoning, else
|
296
331
|
# +false+. Zoning is set to False by default.
|
332
|
+
# rubocop:disable Style/OptionalArguments, Style/CommentedKeyword
|
297
333
|
def create_space_per_building(min_elevation, max_elevation, model, origin_lat_lon, runner, zoning = false, other_building) #:doc:
|
334
|
+
# rubocop: enable Style/OptionalArguments, Style/CommentedKeyword
|
298
335
|
if other_building
|
299
336
|
geometry = other_building[:geometry]
|
300
337
|
properties = other_building[:properties]
|
@@ -338,7 +375,7 @@ module URBANopt
|
|
338
375
|
result << space
|
339
376
|
end
|
340
377
|
return result
|
341
|
-
|
378
|
+
end
|
342
379
|
|
343
380
|
##
|
344
381
|
# Returns an array of instances of +OpenStudio::Model::Space+ per floor.
|
@@ -352,10 +389,20 @@ module URBANopt
|
|
352
389
|
# origin's latitude and longitude.
|
353
390
|
# * +runner+ - _Type:String_ - An instance of +Openstudio::Measure::OSRunner+ for the measure run.
|
354
391
|
# * +zoning+ - _Type:Boolean_ - Value is +true+ if utilizing detailed zoning, else
|
355
|
-
# +false+. Zoning is set to False by default.
|
356
|
-
|
357
|
-
|
358
|
-
|
392
|
+
# +false+. Zoning is set to False by default.
|
393
|
+
# rubocop:disable Style/CommentedKeyword
|
394
|
+
def create_space_per_floor(story_number, floor_to_floor_height, model, origin_lat_lon, runner, zoning = false, scaled_footprint_area) #:doc:
|
395
|
+
# rubocop:enable Style/CommentedKeyword
|
396
|
+
begin
|
397
|
+
if other_building
|
398
|
+
geometry = other_building[:geometry]
|
399
|
+
properties = other_building[:properties]
|
400
|
+
else
|
401
|
+
geometry = @feature_json[:geometry]
|
402
|
+
properties = @feature_json[:properties]
|
403
|
+
end
|
404
|
+
rescue StandardError
|
405
|
+
end
|
359
406
|
floor_prints = []
|
360
407
|
multi_polygons = get_multi_polygons
|
361
408
|
multi_polygons.each do |multi_polygon|
|
@@ -364,10 +411,10 @@ module URBANopt
|
|
364
411
|
end
|
365
412
|
multi_polygon.each do |polygon|
|
366
413
|
elevation = (story_number - 1) * floor_to_floor_height
|
367
|
-
floor_print = URBANopt::GeoJSON::Helper.floor_print_from_polygon(polygon, elevation, origin_lat_lon, runner, zoning)
|
414
|
+
floor_print = URBANopt::GeoJSON::Helper.floor_print_from_polygon(polygon, elevation, origin_lat_lon, runner, zoning, scaled_footprint_area)
|
368
415
|
if floor_print
|
369
416
|
if zoning
|
370
|
-
this_floor_prints = URBANopt::GeoJSON::Zoning.divide_floor_print(floor_print, 4.0, runner)
|
417
|
+
this_floor_prints = URBANopt::GeoJSON::Zoning.divide_floor_print(floor_print, 4.0, runner)
|
371
418
|
floor_prints.concat(this_floor_prints)
|
372
419
|
else
|
373
420
|
floor_prints << floor_print
|
@@ -377,8 +424,8 @@ module URBANopt
|
|
377
424
|
end
|
378
425
|
# Subsequent polygons are holes, and are not supported.
|
379
426
|
break
|
380
|
-
end
|
381
|
-
end
|
427
|
+
end
|
428
|
+
end
|
382
429
|
spaces = []
|
383
430
|
floor_prints.each do |floor_print|
|
384
431
|
space = OpenStudio::Model::Space.fromFloorPrint(floor_print, floor_to_floor_height, model)
|
@@ -394,22 +441,23 @@ module URBANopt
|
|
394
441
|
surface.setOutsideBoundaryCondition('Ground')
|
395
442
|
end
|
396
443
|
end
|
397
|
-
end
|
444
|
+
end
|
398
445
|
spaces << space
|
399
|
-
end
|
400
|
-
|
446
|
+
end
|
447
|
+
|
401
448
|
building_story = OpenStudio::Model::BuildingStory.new(model)
|
402
449
|
building_story.setName("Building Story #{story_number}")
|
450
|
+
building_story.setNominalZCoordinate(story_number * floor_to_floor_height)
|
451
|
+
building_story.setNominalFloortoFloorHeight(floor_to_floor_height)
|
403
452
|
spaces.each do |space|
|
404
453
|
space.setBuildingStory(building_story)
|
405
454
|
thermal_zone = OpenStudio::Model::ThermalZone.new(model)
|
406
455
|
thermal_zone.setName("Building Story #{story_number} ThermalZone")
|
407
456
|
space.setThermalZone(thermal_zone)
|
408
|
-
end
|
409
|
-
|
457
|
+
end
|
458
|
+
|
410
459
|
return spaces
|
411
460
|
end
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
end
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|