urbanopt-cli 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 402a4f72ad3e67514221ec16a53524fdab902b1d
4
- data.tar.gz: 826a536d3cf4f5a6d0080b163398e2f1f14478fc
2
+ SHA256:
3
+ metadata.gz: 656a49250fd1a04c5efe9db71d577832ec8f46cfcdd0c02c1f7ee877677fd796
4
+ data.tar.gz: 95e26852dccf178bf58fe61b5ba7e771acd89f2bd4bc919131f8bff6157dea32
5
5
  SHA512:
6
- metadata.gz: ec31c346dc3e9525f1b69c9e2c20d321db3f0a749f31b4bf5c87cd508c1ca5f790d02ad240c6ee8f6315ded6c6328c864ae1f60f2334058291703627af6d8995
7
- data.tar.gz: 8ac753b397fccf84bfa0ee4249533123479d02c859a072bce0e710556851637fc67e7c3d600ad9644d221646b539def34380d542798f479e0ac7762e5a65bbfd
6
+ metadata.gz: 03a36eea762adcd0f455a48879aca93d1a11fe62a450b2350e8c56fe07328bac19ead110730e02f09fc6fba6ee1231d62e740a43b248ddda4433fc57e03b0156
7
+ data.tar.gz: 2bf26b6d71d9dca6e8aae3b12670a7cf94e8c4ef632009a091f8b30ac8196cd9bfd13f3eba7ff9ad45260145b19a03e324980eeb7f504aa9fa4d4eda9a873802
data/.gitignore CHANGED
@@ -6,6 +6,11 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .DS_Store
10
+
11
+ # local dev IDE settings
12
+ .vscode/
13
+ .idea/
9
14
 
10
15
  # rbenv virtualenv management file
11
16
  .ruby-version
@@ -13,4 +18,8 @@
13
18
  # rspec failure tracking
14
19
  .rspec_status
15
20
 
16
- Gemfile.lock
21
+ # rspec test folder
22
+ spec/test_directory
23
+
24
+ Gemfile.lock
25
+ .rubocop*
@@ -6,4 +6,4 @@ AllCops:
6
6
  - lib/openstudio/extension/core/**/*
7
7
 
8
8
  inherit_from:
9
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
9
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.3.1
4
+
5
+ Date Range: 06/05/20 - 06/10/20:
6
+
7
+ - Fixed [#113]( https://github.com/urbanopt/urbanopt-cli/issues/113 ), CLI crashes if reopt folder missing from project directory
8
+
9
+ ## Version 0.3.0
10
+
11
+ Date Range: 04/23/20 - 06/05/20
12
+
13
+ - Fixed [#96]( https://github.com/urbanopt/urbanopt-cli/issues/96 ), Better error checking
14
+ - Fixed [#99]( https://github.com/urbanopt/urbanopt-cli/issues/99 ), CLI complexity is hindering usage
15
+ - Fixed [#100]( https://github.com/urbanopt/urbanopt-cli/issues/100 ), REopt gem is used even for non-reopt simulations and post-processing
16
+ - Fixed [#102]( https://github.com/urbanopt/urbanopt-cli/issues/102 ), Update change_log functionality
17
+ - Fixed [#103]( https://github.com/urbanopt/urbanopt-cli/issues/103 ), Update CLI to work with OS 3.0
18
+
19
+ Update to OpenStudio 3.x and Ruby 2.5.x
20
+
21
+ ## Version 0.2.3
22
+
23
+ Date Range: 04/01/20 - 04/23/20:
24
+
25
+ - Fixed [#65]( https://github.com/urbanopt/urbanopt-cli/issues/65 ), Add more tests
26
+ - Fixed [#81]( https://github.com/urbanopt/urbanopt-cli/issues/81 ), Mappers weren't updated for version 0.2
27
+ - Fixed [#83]( https://github.com/urbanopt/urbanopt-cli/issues/83 ), Recommend using absolute paths
28
+ - Fixed [#85]( https://github.com/urbanopt/urbanopt-cli/issues/85 ), reopt dependency not installed
29
+ - Fixed [#88]( https://github.com/urbanopt/urbanopt-cli/issues/88 ), Reopt tests are failing
30
+ - Fixed [#90]( https://github.com/urbanopt/urbanopt-cli/issues/90 ), Update baseline mapper
31
+ - Fixed [#92]( https://github.com/urbanopt/urbanopt-cli/issues/92 ), baseline mapper bug reading json file
32
+
33
+ ## Version 0.2.2
34
+
35
+ Date Range: 3/31/20 - 3/31/20
36
+
37
+ - Fixing simplecov / json native extension dependency
38
+
3
39
  ## Version 0.2.1
4
40
 
5
41
  Date Range: 03/31/20 - 03/31/20
data/Gemfile CHANGED
@@ -1,13 +1,9 @@
1
+
1
2
  source 'http://rubygems.org'
2
3
 
3
- # Specify your gem's dependencies in uo_cli.gemspec
4
+ # Specify dependencies in uo_cli.gemspec
4
5
  gemspec
5
6
 
6
- # simplecov has a dependency on native json gem, use fork that does not require this
7
- gem 'certified'
8
- gem 'simplecov', github: 'NREL/simplecov'
9
- gem 'urbanopt-reopt', '0.2.0'
10
-
11
7
  # Local gems are useful when developing and integrating the various dependencies.
12
8
  # To favor the use of local gems, set the following environment variable:
13
9
  # Mac: export FAVOR_LOCAL_GEMS=1
@@ -38,23 +34,31 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
38
34
  # gem 'openstudio-model-articulation', github: 'NREL/openstudio-model-articulation-gem', branch: 'develop'
39
35
  # end
40
36
 
41
- if allow_local && File.exist?('../urbanopt-scenario-gem')
42
- gem 'urbanopt-scenario', path: '../urbanopt-scenario-gem'
43
- elsif allow_local
44
- gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
45
- else
46
- gem 'urbanopt-scenario', '0.2.0'
47
- # temporary
48
- # gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
49
- end
50
-
51
- if allow_local && File.exist?('../urbanopt-geojson-gem')
52
- # gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
53
- gem 'urbanopt-geojson', path: '../urbanopt-geojson-gem'
54
- elsif allow_local
55
- gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
56
- else
57
- gem 'urbanopt-geojson', '0.2.0'
58
- # temporary
59
- # gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
60
- end
37
+ # if allow_local && File.exist?('../urbanopt-scenario-gem')
38
+ # gem 'urbanopt-scenario', path: '../urbanopt-scenario-gem'
39
+ # elsif allow_local
40
+ # gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
41
+ # else
42
+ # gem 'urbanopt-scenario', '0.3.0'
43
+ # # temporary
44
+ # # gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
45
+ # end
46
+
47
+ # if allow_local && File.exist?('../urbanopt-geojson-gem')
48
+ # # gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
49
+ # gem 'urbanopt-geojson', path: '../urbanopt-geojson-gem'
50
+ # elsif allow_local
51
+ # gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
52
+ # else
53
+ # gem 'urbanopt-geojson', '0.3.0'
54
+ # # temporary
55
+ # # gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
56
+ # end
57
+
58
+ # if allow_local && File.exist?('../urbanopt-reopt-gem')
59
+ # gem 'urbanopt-reopt', path: '../urbanopt-reopt-gem'
60
+ # elsif allow_local
61
+ # gem 'urbanopt-reopt', github: 'URBANopt/urbanopt-reopt-gem', branch: 'develop'
62
+ # else
63
+ # gem 'urbanopt-reopt', '0.3.0'
64
+ # end
data/README.md CHANGED
@@ -27,48 +27,61 @@ gem install urbanopt-cli
27
27
  For help text in your terminal, type:
28
28
 
29
29
  ```terminal
30
- uo -h
30
+ uo --help
31
31
  ```
32
32
 
33
33
  Create a project folder:
34
34
 
35
35
  ```terminal
36
- uo -p <FOLDERNAME>
36
+ uo create --project-folder <FOLDERNAME>
37
37
  ```
38
38
 
39
39
  Overwrite an existing project folder:
40
40
 
41
41
  ```terminal
42
- uo -o -p <FOLDERNAME>
42
+ uo create --overwrite --project-folder <FOLDERNAME>
43
43
  ```
44
44
 
45
45
  Create an empty project folder without the example files:
46
46
 
47
47
  ```terminal
48
- uo -e -p <FOLDERNAME>
48
+ uo create --empty --project-folder <FOLDERNAME>
49
+ ```
50
+
51
+ Create ScenarioFiles from a FeatureFile using MapperFiles:
52
+
53
+ ```terminal
54
+ uo create --scenario-file <FEATUREFILE>
55
+ ```
49
56
 
50
- Make ScenarioFiles from a FeatureFile using MapperFiles:
57
+ Create a ScenarioFile using only a specific FEATURE_ID from a FEATUREFILE:
51
58
 
52
59
  ```terminal
53
- uo -m -f <FEATUREFILE>
60
+ uo create --scenario-file <FEATUREFILE> --single-feature <FEATURE_ID>
54
61
  ```
55
62
 
56
- Make a ScenarioFile using only a specific FEATURE_ID from a FEATUREFILE:
63
+ Create a REopt ScenarioFile from an existing ScenarioFile:
57
64
 
58
65
  ```terminal
59
- uo -m -f <FEATUREFILE> -i <FEATURE_ID>
66
+ uo create --reopt-scenario-file baseline_scenario.csv
60
67
  ```
61
68
 
62
69
  Run URBANopt energy simulations for each feature in your scenario:
63
70
 
64
71
  ```terminal
65
- uo -r -s <SCENARIOFILE> -f <FEATUREFILE>
72
+ uo run --scenario <SCENARIOFILE> --feature <FEATUREFILE>
73
+ ```
74
+
75
+ Run URBANopt energy simulations for each feature in your scenario, with REopt functionality included:
76
+
77
+ ```terminal
78
+ uo run --reopt --scenario <SCENARIOFILE> --feature <FEATUREFILE>
66
79
  ```
67
80
 
68
- Gather simulations for a full scenario:
81
+ Post-process simulations for a full scenario:
69
82
 
70
83
  ```terminal
71
- uo -g -t <TYPE> -s <SCENARIOFILE> -f <FEATUREFILE>
84
+ uo process --<TYPE> --scenario <SCENARIOFILE> --feature <FEATUREFILE>
72
85
  ```
73
86
 
74
87
  - Valid `TYPE`s are: `default`, `opendss`, `reopt-scenario`, `reopt-feature`
@@ -76,15 +89,15 @@ uo -g -t -s -f
76
89
  Delete a scenario you have already run:
77
90
 
78
91
  ```terminal
79
- uo -d -s <SCENARIOFILE>
92
+ uo delete --scenario <SCENARIOFILE>
80
93
  ```
81
94
 
82
95
  Installed CLI version:
83
96
 
84
97
  ```terminal
85
- uo -v
98
+ uo --version
86
99
  ```
87
100
 
88
101
  ## Development
89
102
 
90
- To install this gem onto your local machine, clone this repo and run `rake install`. If you make changes to this repo, update the version number in `lib/version.rb` in your first commit. When ready to release, run the changelog script at `lib/change_log.rb` and copy the appropriate portion of the output into `CHANGELOG.md`. Run `bundle exec rake release` which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
103
+ To install this gem onto your local machine, clone this repo and run `bundle exec rake install`. If you make changes to this repo, update the version number in `lib/version.rb` in your first commit. When ready to release, [follow the documentation](https://docs.urbanopt.net/developer_resources/release_instructions.html).
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  require 'bundler/gem_tasks'
2
3
  require 'rspec/core/rake_task'
3
4
  require 'rubocop/rake_task'
@@ -5,4 +6,9 @@ require 'rubocop/rake_task'
5
6
  RSpec::Core::RakeTask.new(:spec)
6
7
  RuboCop::RakeTask.new
7
8
 
9
+ # Load in the rake tasks from the base openstudio-extension gem
10
+ require 'openstudio/extension/rake_task'
11
+ os_extension = OpenStudio::Extension::RakeTask.new
12
+ os_extension.set_extension_class(OpenStudio::Extension::Extension, 'urbanopt/urbanopt-cli')
13
+
8
14
  task default: :spec
@@ -1,3 +1,4 @@
1
+
1
2
  # *********************************************************************************
2
3
  # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
4
  # contributors. All rights reserved.
@@ -1,6 +1,7 @@
1
+
1
2
  source 'http://rubygems.org'
2
3
 
3
- ruby '2.2.4'
4
+ ruby '~> 2.5.0'
4
5
 
5
6
  # Local gems are useful when developing and integrating the various dependencies.
6
7
  # To favor the use of local gems, set the following environment variable:
@@ -10,62 +11,50 @@ ruby '2.2.4'
10
11
  # checkout the latest version (develop) from github.
11
12
  allow_local = ENV['FAVOR_LOCAL_GEMS']
12
13
 
13
- # Uncomment the extension, common measures, core gems if you need to test local development versions. Otherwise
14
+ # Uncomment the extension, core gems if you need to test local development versions. Otherwise
14
15
  # these are included in the model articulation and urbanopt gems
15
16
  #
16
17
  # if allow_local && File.exist?('../OpenStudio-extension-gem')
17
18
  # gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
18
19
  # elsif allow_local
19
- # gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
20
+ # gem 'openstudio-extension', github: 'NREL/openstudio-extension-gem', branch: 'develop'
20
21
  # end
21
- #
22
- # if allow_local && File.exist?('../openstudio-common-measures-gem')
23
- # gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
24
- # elsif allow_local
25
- # gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
26
- # end
27
- #
22
+
28
23
  # if allow_local && File.exist?('../urbanopt-core-gem')
29
24
  # gem 'urbanopt-core', path: '../urbanopt-core-gem'
30
25
  # elsif allow_local
31
- # gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'develop'
26
+ # gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'develop'
32
27
  # end
33
28
  #
34
29
 
35
- # if allow_local && File.exist?('../openstudio-common-measures-gem')
36
- # gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
37
- # elsif allow_local
38
- # gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
39
- # end
40
-
41
- # if allow_local && File.exist?('../openstudio-model-articulation-gem')
42
- # gem 'openstudio-model-articulation', path: '../openstudio-model-articulation-gem'
43
- # elsif allow_local
44
- # gem 'openstudio-model-articulation', github: 'NREL/openstudio-model-articulation-gem', branch: 'develop'
45
- # else
46
- # gem 'openstudio-model-articulation', '0.1.0'
47
- # end
30
+ if allow_local && File.exist?('../openstudio-common-measures-gem')
31
+ gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
32
+ elsif allow_local
33
+ gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
34
+ else
35
+ gem 'openstudio-common-measures', '~> 0.2.0'
36
+ end
48
37
 
49
- gem 'urbanopt-reopt', '0.2.0'
38
+ if allow_local && File.exist?('../openstudio-model-articulation-gem')
39
+ gem 'openstudio-model-articulation', path: '../openstudio-model-articulation-gem'
40
+ elsif allow_local
41
+ gem 'openstudio-model-articulation', github: 'NREL/openstudio-model-articulation-gem', branch: 'develop'
42
+ else
43
+ gem 'openstudio-model-articulation', '~> 0.2.0'
44
+ end
50
45
 
51
46
  if allow_local && File.exist?('../urbanopt-scenario-gem')
52
47
  gem 'urbanopt-scenario', path: '../urbanopt-scenario-gem'
53
48
  elsif allow_local
54
49
  gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
55
50
  else
56
- gem 'urbanopt-scenario', '0.2.0'
57
- # gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
51
+ gem 'urbanopt-scenario', '~> 0.3.0'
58
52
  end
59
53
 
60
54
  if allow_local && File.exist?('../urbanopt-geojson-gem')
61
- # gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
62
55
  gem 'urbanopt-geojson', path: '../urbanopt-geojson-gem'
63
56
  elsif allow_local
64
57
  gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
65
58
  else
66
- gem 'urbanopt-geojson', '0.2.0'
67
- # gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
59
+ gem 'urbanopt-geojson', '~> 0.3.0'
68
60
  end
69
-
70
- # Fix rack version temporarily to work with Ruby 2.2.4
71
- gem 'rack', '2.1.2'
@@ -13,7 +13,7 @@
13
13
  "cec_climate_zone": null,
14
14
  "climate_zone": "6A",
15
15
  "default_template": "90.1-2013",
16
- "end_date": "2017-13-31T07:00:00.000Z",
16
+ "end_date": "2017-12-31T07:00:00.000Z",
17
17
  "id": "53340c2c-ab20-40db-aba1-11ac607c52a7",
18
18
  "import_surrounding_buildings_as_shading": null,
19
19
  "name": "Site Origin",
@@ -1,3 +1,4 @@
1
+
1
2
  # *********************************************************************************
2
3
  # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
4
  # contributors. All rights reserved.
@@ -67,61 +68,61 @@ module URBANopt
67
68
  if template.include? 'DEER'
68
69
  case building_type
69
70
  when 'Education'
70
- 'EPr'
71
+ return 'EPr'
71
72
  when 'Enclosed mall'
72
- 'RtL'
73
+ return 'RtL'
73
74
  when 'Food sales'
74
- 'RSD'
75
+ return 'RSD'
75
76
  when 'Food service'
76
- 'RSD'
77
+ return 'RSD'
77
78
  when 'Inpatient health care'
78
- 'Nrs'
79
+ return 'Nrs'
79
80
  when 'Laboratory'
80
- 'Hsp'
81
+ return 'Hsp'
81
82
  when 'Lodging'
82
- 'Htl'
83
+ return 'Htl'
83
84
  when 'Mixed use'
84
- 'ECC'
85
+ return 'ECC'
85
86
  when 'Mobile Home'
86
- 'DMo'
87
+ return 'DMo'
87
88
  when 'Multifamily (2 to 4 units)'
88
- 'MFm'
89
+ return 'MFm'
89
90
  when 'Multifamily (5 or more units)'
90
- 'MFm'
91
+ return 'MFm'
91
92
  when 'Nonrefrigerated warehouse'
92
- 'SUn'
93
+ return 'SUn'
93
94
  when 'Nursing'
94
- 'Nrs'
95
+ return 'Nrs'
95
96
  when 'Office'
96
97
  if footprint_area
97
- if footprint_area.to_f > 100_000
98
- 'OfL'
98
+ if footprint_area.to_f > 100000
99
+ return 'OfL'
99
100
  else
100
- 'OfS'
101
+ return 'OfS'
101
102
  end
102
103
  else
103
104
  raise 'footprint_area required to map office building type'
104
105
  end
105
106
  when 'Outpatient health care'
106
- 'Nrs'
107
+ return 'Nrs'
107
108
  when 'Public assembly'
108
- 'Asm'
109
+ return 'Asm'
109
110
  when 'Public order and safety'
110
- 'Asm'
111
+ return 'Asm'
111
112
  when 'Refrigerated warehouse'
112
- 'WRf'
113
+ return 'WRf'
113
114
  when 'Religious worship'
114
- 'Asm'
115
+ return 'Asm'
115
116
  when 'Retail other than mall'
116
- 'RtS'
117
+ return 'RtS'
117
118
  when 'Service'
118
- 'MLI'
119
+ return 'MLI'
119
120
  when 'Single-Family'
120
- 'MFm'
121
+ return 'MFm'
121
122
  when 'Strip shopping mall'
122
- 'RtL'
123
+ return 'RtL'
123
124
  when 'Vacant'
124
- 'SUn'
125
+ return 'SUn'
125
126
  else
126
127
  raise "building type #{building_type} cannot be mapped to a DEER building type"
127
128
  end
@@ -130,17 +131,17 @@ module URBANopt
130
131
  # default: ASHRAE
131
132
  case building_type
132
133
  when 'Education'
133
- 'SecondarySchool'
134
+ return 'SecondarySchool'
134
135
  when 'Enclosed mall'
135
- 'RetailStripmall'
136
+ return 'RetailStripmall'
136
137
  when 'Food sales'
137
- 'FullServiceRestaurant'
138
+ return 'FullServiceRestaurant'
138
139
  when 'Food service'
139
- 'FullServiceRestaurant'
140
+ return 'FullServiceRestaurant'
140
141
  when 'Inpatient health care'
141
- 'Hospital'
142
+ return 'Hospital'
142
143
  when 'Laboratory'
143
- 'Hospital'
144
+ return 'Hospital'
144
145
  when 'Lodging'
145
146
  if number_of_stories
146
147
  if number_of_stories.to_i > 3
@@ -149,51 +150,51 @@ module URBANopt
149
150
  return 'SmallHotel'
150
151
  end
151
152
  end
152
- 'LargeHotel'
153
+ return 'LargeHotel'
153
154
  when 'Mixed use'
154
- 'Mixed use'
155
+ return 'Mixed use'
155
156
  when 'Mobile Home'
156
- 'MidriseApartment'
157
+ return 'MidriseApartment'
157
158
  when 'Multifamily (2 to 4 units)'
158
- 'MidriseApartment'
159
+ return 'MidriseApartment'
159
160
  when 'Multifamily (5 or more units)'
160
- 'MidriseApartment'
161
+ return 'MidriseApartment'
161
162
  when 'Nonrefrigerated warehouse'
162
- 'Warehouse'
163
+ return 'Warehouse'
163
164
  when 'Nursing'
164
- 'Outpatient'
165
+ return 'Outpatient'
165
166
  when 'Office'
166
167
  if footprint_area
167
- value = if footprint_area.to_f < 20_000
168
- 'SmallOffice'
169
- elsif footprint_area.to_f > 100_000
170
- 'LargeOffice'
171
- else
172
- 'MediumOffice'
173
- end
168
+ if footprint_area.to_f < 20000
169
+ value = 'SmallOffice'
170
+ elsif footprint_area.to_f > 100000
171
+ value = 'LargeOffice'
172
+ else
173
+ value = 'MediumOffice'
174
+ end
174
175
  else
175
176
  raise 'Floor area required to map office building type'
176
177
  end
177
178
  when 'Outpatient health care'
178
- 'Outpatient'
179
+ return 'Outpatient'
179
180
  when 'Public assembly'
180
- 'MediumOffice'
181
+ return 'MediumOffice'
181
182
  when 'Public order and safety'
182
- 'MediumOffice'
183
+ return 'MediumOffice'
183
184
  when 'Refrigerated warehouse'
184
- 'Warehouse'
185
+ return 'Warehouse'
185
186
  when 'Religious worship'
186
- 'MediumOffice'
187
+ return 'MediumOffice'
187
188
  when 'Retail other than mall'
188
- 'RetailStandalone'
189
+ return 'RetailStandalone'
189
190
  when 'Service'
190
- 'MediumOffice'
191
+ return 'MediumOffice'
191
192
  when 'Single-Family'
192
- 'MidriseApartment'
193
+ return 'MidriseApartment'
193
194
  when 'Strip shopping mall'
194
- 'RetailStripmall'
195
+ return 'RetailStripmall'
195
196
  when 'Vacant'
196
- 'Warehouse'
197
+ return 'Warehouse'
197
198
  else
198
199
  raise "building type #{building_type} cannot be mapped to an ASHRAE building type"
199
200
  end
@@ -203,38 +204,38 @@ module URBANopt
203
204
  def lookup_template_by_year_built(template, year_built)
204
205
  if template.include? 'DEER'
205
206
  if year_built <= 1996
206
- 'DEER 1985'
207
+ return 'DEER 1985'
207
208
  elsif year_built <= 2003
208
- 'DEER 1996'
209
+ return 'DEER 1996'
209
210
  elsif year_built <= 2007
210
- 'DEER 2003'
211
+ return 'DEER 2003'
211
212
  elsif year_built <= 2011
212
- 'DEER 2007'
213
+ return 'DEER 2007'
213
214
  elsif year_built <= 2014
214
- 'DEER 2011'
215
+ return 'DEER 2011'
215
216
  elsif year_built <= 2015
216
- 'DEER 2014'
217
+ return 'DEER 2014'
217
218
  elsif year_built <= 2017
218
- 'DEER 2015'
219
+ return 'DEER 2015'
219
220
  elsif year_built <= 2020
220
- 'DEER 2017'
221
+ return 'DEER 2017'
221
222
  else
222
- 'DEER 2020'
223
+ return 'DEER 2020'
223
224
  end
224
225
  else
225
226
  # ASHRAE
226
227
  if year_built < 1980
227
- 'DOE Ref Pre-1980'
228
+ return 'DOE Ref Pre-1980'
228
229
  elsif year_built <= 2004
229
- 'DOE Ref 1980-2004'
230
+ return 'DOE Ref 1980-2004'
230
231
  elsif year_built <= 2007
231
- '90.1-2004'
232
+ return '90.1-2004'
232
233
  elsif year_built <= 2010
233
- '90.1-2007'
234
+ return '90.1-2007'
234
235
  elsif year_built <= 2013
235
- '90.1-2010'
236
+ return '90.1-2010'
236
237
  else
237
- '90.1-2013'
238
+ return '90.1-2013'
238
239
  end
239
240
  end
240
241
  end
@@ -247,7 +248,9 @@ module URBANopt
247
248
  feature_id = feature.id
248
249
  feature_type = feature.type
249
250
  feature_name = feature.name
250
- feature_name = feature_names[0] if feature_names.size == 1
251
+ if feature_names.size == 1
252
+ feature_name = feature_names[0]
253
+ end
251
254
 
252
255
  # deep clone of @@osw before we configure it
253
256
  osw = Marshal.load(Marshal.dump(@@osw))
@@ -261,17 +264,17 @@ module URBANopt
261
264
  # set_run_period
262
265
  begin
263
266
  timesteps_per_hour = feature.timesteps_per_hour
264
- unless timesteps_per_hour.empty?
267
+ if timesteps_per_hour
265
268
  OpenStudio::Extension.set_measure_argument(osw, 'set_run_period', 'timesteps_per_hour', timesteps_per_hour)
266
269
  end
267
270
  rescue StandardError
268
271
  end
269
272
  begin
270
273
  begin_date = feature.begin_date
271
- unless feature.begin_date.empty?
274
+ if begin_date
272
275
  # check date-only YYYY-MM-DD
273
- if feature.begin_date.length > 10
274
- feature.begin_date = feature.begin_date[0, 10]
276
+ if begin_date.length > 10
277
+ begin_date = begin_date[0, 10]
275
278
  end
276
279
  OpenStudio::Extension.set_measure_argument(osw, 'set_run_period', 'begin_date', begin_date)
277
280
  end
@@ -279,10 +282,10 @@ module URBANopt
279
282
  end
280
283
  begin
281
284
  end_date = feature.end_date
282
- unless feature.end_date.empty?
285
+ if end_date
283
286
  # check date-only YYYY-MM-DD
284
- if feature.end_date.length > 10
285
- feature.end_date = feature.end_date[0, 10]
287
+ if end_date.length > 10
288
+ end_date = end_date[0, 10]
286
289
  end
287
290
  OpenStudio::Extension.set_measure_argument(osw, 'set_run_period', 'end_date', end_date)
288
291
  end
@@ -366,11 +369,21 @@ module URBANopt
366
369
  end
367
370
 
368
371
  floor_height = 10
369
- system_type = if building_hash.key?(:system_type)
370
- building_hash[:system_type]
371
- else
372
- 'Inferred'
373
- end
372
+ # Map system type to openstudio system types
373
+ # TODO: Map all system types
374
+ if building_hash.key?(:system_type)
375
+ system_type = building_hash[:system_type]
376
+ case system_type
377
+ when 'Fan coil district hot and chilled water'
378
+ system_type = 'Fan coil district chilled water with district hot water'
379
+ when 'Fan coil air-cooled chiller and boiler'
380
+ system_type = 'Fan coil air-cooled chiller with boiler'
381
+ when 'VAV with gas reheat'
382
+ system_type = 'VAV air-cooled chiller with gas boiler reheat'
383
+ end
384
+ else
385
+ system_type = 'Inferred'
386
+ end
374
387
 
375
388
  def time_mapping(time)
376
389
  hour = time.split(':')[0]
@@ -379,7 +392,7 @@ module URBANopt
379
392
  fraction_roundup = fraction.round(2)
380
393
  minute_fraction = fraction_roundup.to_s.split('.')[1]
381
394
  new_time = [hour, minute_fraction].join('.')
382
- new_time
395
+ return new_time
383
396
  end
384
397
 
385
398
  # ChangeBuildingLocation
@@ -390,17 +403,23 @@ module URBANopt
390
403
  cec_found = false
391
404
  begin
392
405
  cec_climate_zone = feature.cec_climate_zone
393
- unless cec_climate_zone.empty?
406
+ if !cec_climate_zone.empty?
394
407
  cec_climate_zone = 'T24-CEC' + cec_climate_zone
395
408
  OpenStudio::Extension.set_measure_argument(osw, 'ChangeBuildingLocation', 'climate_zone', cec_climate_zone)
396
409
  cec_found = true
410
+ # Temporary fix for CEC climate zone:
411
+ cec_modified_zone = 'CEC ' + cec_climate_zone
412
+ OpenStudio::Extension.set_measure_argument(osw, 'create_bar_from_building_type_ratios', 'climate_zone', cec_modified_zone)
413
+ OpenStudio::Extension.set_measure_argument(osw, 'create_typical_building_from_model', 'climate_zone', cec_modified_zone, 'create_typical_building_from_model 1')
414
+ OpenStudio::Extension.set_measure_argument(osw, 'create_typical_building_from_model', 'climate_zone', cec_modified_zone, 'create_typical_building_from_model 2')
415
+
397
416
  end
398
417
  rescue StandardError
399
418
  end
400
- unless cec_found
419
+ if !cec_found
401
420
  begin
402
421
  climate_zone = feature.climate_zone
403
- unless climate_zone.empty?
422
+ if !climate_zone.empty?
404
423
  climate_zone = 'ASHRAE 169-2013-' + climate_zone
405
424
  OpenStudio::Extension.set_measure_argument(osw, 'ChangeBuildingLocation', 'climate_zone', climate_zone)
406
425
  end
@@ -430,7 +449,7 @@ module URBANopt
430
449
  # set weekday start time
431
450
  begin
432
451
  weekday_start_time = feature.weekday_start_time
433
- unless feature.weekday_start_time.empty?
452
+ if !feature.weekday_start_time.empty?
434
453
  new_weekday_start_time = time_mapping(weekday_start_time)
435
454
  OpenStudio::Extension.set_measure_argument(osw, 'create_typical_building_from_model', 'wkdy_op_hrs_start_time', new_weekday_start_time, 'create_typical_building_from_model 1')
436
455
  end
@@ -440,7 +459,7 @@ module URBANopt
440
459
  # set weekday duration
441
460
  begin
442
461
  weekday_duration = feature.weekday_duration
443
- unless feature.weekday_duration.empty?
462
+ if !feature.weekday_duration.empty?
444
463
  new_weekday_duration = time_mapping(weekday_duration)
445
464
  OpenStudio::Extension.set_measure_argument(osw, 'create_typical_building_from_model', 'wkdy_op_hrs_duration', new_weekday_duration, 'create_typical_building_from_model 1')
446
465
  end
@@ -450,7 +469,7 @@ module URBANopt
450
469
  # set weekend start time
451
470
  begin
452
471
  weekend_start_time = feature.weekend_start_time
453
- unless feature.weekend_start_time.empty?
472
+ if !feature.weekend_start_time.empty?
454
473
  new_weekend_start_time = time_mapping(weekend_start_time)
455
474
  OpenStudio::Extension.set_measure_argument(osw, 'create_typical_building_from_model', 'wknd_op_hrs_start_time', new_weekend_start_time, 'create_typical_building_from_model 1')
456
475
  end
@@ -460,7 +479,7 @@ module URBANopt
460
479
  # set weekend duration
461
480
  begin
462
481
  weekend_duration = feature.weekend_duration
463
- unless feature.weekend_duration.empty?
482
+ if !feature.weekend_duration.empty?
464
483
  new_weekend_duration = time_mapping(weekend_duration)
465
484
  OpenStudio::Extension.set_measure_argument(osw, 'create_typical_building_from_model', 'wknd_op_hrs_duration', new_weekend_duration, 'create_typical_building_from_model 1')
466
485
  end
@@ -546,7 +565,7 @@ module URBANopt
546
565
  OpenStudio::Extension.set_measure_argument(osw, 'default_feature_reports', 'feature_type', feature_type)
547
566
  end
548
567
 
549
- osw
568
+ return osw
550
569
  end
551
570
  end # BaselineMapper
552
571
  end # Scenario