openstudio-extension 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +30 -1
- data/Gemfile +3 -1
- data/README.md +29 -22
- data/Rakefile +3 -3
- data/lib/change_log.rb +1 -1
- data/lib/openstudio/extension/core/os_lib_geometry.rb +1 -2
- data/lib/openstudio/extension/core/os_lib_model_generation.rb +142 -25
- data/lib/openstudio/extension/rake_task.rb +1 -198
- data/lib/openstudio/extension/runner.rb +18 -22
- data/lib/openstudio/extension/version.rb +1 -1
- data/lib/openstudio/extension.rb +5 -9
- data/openstudio-extension.gemspec +7 -7
- metadata +16 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e410744afb54a4a4c19ee59dd2d7a9edd77da75d67df9968f0ed2e0a304f0f7
|
4
|
+
data.tar.gz: 3949d1e1bb9a929b251e473aac854d50abff6da4800be4b10318f786b0c5c082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b88a5b66d29367fca57cb38228ccf7f782a798b98e09a220c11eb6d7bfe6e959a947e4a44f97fd391a7eec123fb37c1894e7dfd04803108fca75fd02a0bccb
|
7
|
+
data.tar.gz: 451ea32b090a21701eda6df859714bb213e212c2fdcdab086de7c51dd71031e9eaab493b04df671eccc9c01483408f40595127246997c91e810e0b1d3f4b3847
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -5,6 +5,7 @@ AllCops:
|
|
5
5
|
- lib/measures/**/resources/*
|
6
6
|
- lib/openstudio/extension/core/**/*
|
7
7
|
|
8
|
+
require: rubocop-performance
|
8
9
|
inherit_from:
|
9
|
-
- http://s3.amazonaws.com/openstudio-resources/styles/
|
10
|
+
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v4.yml
|
10
11
|
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,40 @@
|
|
1
1
|
# OpenStudio Extension Gem
|
2
2
|
|
3
|
+
## Version 0.5.0
|
4
|
+
|
5
|
+
* Update OpenStudio Workflow Gem to 2.3.0 (support for epJSON)
|
6
|
+
|
7
|
+
- Fixed [#133]( https://github.com/NREL/openstudio-extension-gem/pull/133 ), cleanup readme and rework BCL tasks
|
8
|
+
- Fixed [#135]( https://github.com/NREL/openstudio-extension-gem/pull/135 ), Intersect tests 072021
|
9
|
+
- Fixed [#136]( https://github.com/NREL/openstudio-extension-gem/pull/136 ), Osm from haystack
|
10
|
+
- Fixed [#137]( https://github.com/NREL/openstudio-extension-gem/issues/137 ), Edge case error in hospital bar
|
11
|
+
- Fixed [#138]( https://github.com/NREL/openstudio-extension-gem/issues/138 ), os_lib_model_generation does not assign SWH type correctly
|
12
|
+
- Fixed [#139]( https://github.com/NREL/openstudio-extension-gem/pull/139 ), fix swh_src assignment operators
|
13
|
+
- Fixed [#142]( https://github.com/NREL/openstudio-extension-gem/pull/142 ), added arg for hoo_var_method and updated test to use it
|
14
|
+
|
15
|
+
## Version 0.4.4
|
16
|
+
|
17
|
+
* Update BCL gem to version 0.7.1 which upgrades REXML and Spreadsheet with security patches
|
18
|
+
* Minor updates to documentation
|
19
|
+
|
20
|
+
## Version 0.4.3
|
21
|
+
|
22
|
+
* Update measure tester gem which upgrades Rubocop to 1.15
|
23
|
+
* Update styles to v4 based on new version of Rubocop
|
24
|
+
|
25
|
+
## Version 0.4.2
|
26
|
+
|
27
|
+
* Fixes [#113](https://github.com/NREL/openstudio-extension-gem/issues/113) Fix bad args behavior on bar_from_building_type_ratios
|
28
|
+
* Fixes [#103](https://github.com/NREL/openstudio-extension-gem/issues/103) make check_upstream_measure_for_arg more robust for non string arguments
|
29
|
+
* Updatd version of openstudio-standards for development to openstudio-standards 0.2.13
|
30
|
+
* Added ASHRAE 90.1 2016 and 2019 to get_doe_templates method in os_lib_model_generation.rb file. This method is used by a number of measures to generate allowable argument values
|
31
|
+
|
3
32
|
## Version 0.4.1
|
4
33
|
|
5
34
|
* Fixed [#95]( https://github.com/NREL/openstudio-extension-gem/issues/95 ), Extend exceptions on standards error messages for curves used on multiple objects
|
6
35
|
* Fixed [#113]( https://github.com/NREL/openstudio-extension-gem/issues/113 ), Fix bad args behavior on bar_from_building_type_ratios
|
7
36
|
* Fixed [#111]( https://github.com/NREL/openstudio-extension-gem/pull/111 ), night cycling change - for 0.4.x
|
8
|
-
* Updated version of openstudio-standards for development to openstudio-standards 0.2.13
|
37
|
+
* Updated version of openstudio-standards for development to openstudio-standards 0.2.13.rc3
|
9
38
|
|
10
39
|
## Version 0.4.0
|
11
40
|
|
data/Gemfile
CHANGED
@@ -2,5 +2,7 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in openstudio-extension.gemspec
|
4
4
|
|
5
|
-
|
5
|
+
# line below used for testing when need to test against branch instead of release of standards. Should be commented out prior to merge to develop
|
6
|
+
# gem 'openstudio-standards', github: 'NREL/openstudio-standards', branch: 'fix/901_2016_2019_properties' # for os_lib unit tests
|
6
7
|
|
8
|
+
gemspec
|
data/README.md
CHANGED
@@ -10,10 +10,10 @@ Derivative extension gems should include this gem to access common functionality
|
|
10
10
|
* OpenStudio CLI functionality such as list_measures and update_measures
|
11
11
|
* adding documentation and license files to measures
|
12
12
|
* adding core resource files to measures
|
13
|
-
*
|
13
|
+
* correct structure for contributing content to the Building Component Library (BCL)
|
14
14
|
|
15
15
|
Extension gems will contain a small group of related measures. Each extension gem will be the unique location to find these measures, and will be responsible for
|
16
|
-
testing and maintaining the measures as well as
|
16
|
+
testing and maintaining the measures as well as indexing them on BCL.
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
@@ -31,14 +31,15 @@ Each OpenStudio extension gem should define its own module name to ensure that t
|
|
31
31
|
|
32
32
|
## Installation
|
33
33
|
|
34
|
-
To use this and other extension gems, you will need Ruby 2.
|
34
|
+
To use the latest version of this and other extension gems, you will need Ruby 2.7.x and OpenStudio 3.1.0 or greater. For earlier versions, view the [compatibility matrix](#compatibility-matrix) below.
|
35
35
|
|
36
36
|
### Windows Installation
|
37
|
-
Install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.
|
37
|
+
Install Ruby with Devkit using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.7.2 (x64)](
|
38
|
+
https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-devkit-2.7.2-1-x64.exe).
|
38
39
|
|
39
|
-
|
40
|
+
Make sure that you select **option 3: MSYS2 and MINGW development toolchain** during the installation process.
|
40
41
|
|
41
|
-
Check the ruby installation returns the correct Ruby version (2.
|
42
|
+
Check the ruby installation returns the correct Ruby version (2.7.x):
|
42
43
|
```
|
43
44
|
ruby -v
|
44
45
|
```
|
@@ -48,10 +49,10 @@ Install bundler from the command line
|
|
48
49
|
gem install bundler -v 2.1
|
49
50
|
```
|
50
51
|
|
51
|
-
Install OpenStudio. Create a file ```C:\ruby-2.
|
52
|
+
Install OpenStudio. Create a file ```C:\ruby-2.7.2-1-x64-mingw32\lib\ruby\site_ruby\openstudio.rb``` and point it to your OpenStudio installation by editing the contents. E.g.:
|
52
53
|
|
53
54
|
```ruby
|
54
|
-
require 'C:\openstudio-3.
|
55
|
+
require 'C:\openstudio-3.1.0\Ruby\openstudio.rb'
|
55
56
|
```
|
56
57
|
|
57
58
|
Verify your OpenStudio and Ruby configuration:
|
@@ -65,7 +66,7 @@ rbenv can be installed via [Homebrew](https://brew.sh/):
|
|
65
66
|
```
|
66
67
|
brew install rbenv
|
67
68
|
rbenv init
|
68
|
-
rbenv install 2.
|
69
|
+
rbenv install 2.7.2
|
69
70
|
```
|
70
71
|
|
71
72
|
Also install bundler
|
@@ -76,10 +77,18 @@ gem install bundler -v 2.1
|
|
76
77
|
Install [OpenStudio](https://www.openstudio.net/downloads).
|
77
78
|
|
78
79
|
Add the RUBYLIB environment variable to your `bash_profile` (or similar) file. It should point to the Ruby folder within
|
79
|
-
the OpenStudio Application you just downloaded (replace 3.
|
80
|
+
the OpenStudio Application you just downloaded (replace 3.1.0 with the version you are using):
|
80
81
|
```
|
81
|
-
export RUBYLIB=/Applications/OpenStudio-3.
|
82
|
+
export RUBYLIB=/Applications/OpenStudio-3.1.0/Ruby
|
82
83
|
```
|
84
|
+
## Compatibility Matrix
|
85
|
+
|
86
|
+
|OpenStudio Extension Gem|OpenStudio|Ruby|
|
87
|
+
|:--------------:|:----------:|:--------:|
|
88
|
+
| 0.4.0 - 0.4.4 | 3.2 | 2.7 |
|
89
|
+
| 0.3.0 - 0.3.2 | 3.1 | 2.5 |
|
90
|
+
| 0.2.0 - 0.2.6 | 3.0 | 2.5 |
|
91
|
+
| 0.1.6 and below | 2.9 and below | 2.2.4 |
|
83
92
|
|
84
93
|
|
85
94
|
## Contents
|
@@ -138,7 +147,7 @@ Note that this folder is for 'core' functionality; if a measure's requires a new
|
|
138
147
|
Having a single repository for all measures, such as the OpenStudio-measures repo, can be cumbersome to test and keep up to date.
|
139
148
|
In this new framework, each extension gem will contain one or more related measures. The gem will be the new 'home' of these measures, and the repo owner will be responsible for testing and keeping the measures up to date.
|
140
149
|
|
141
|
-
In the short term, in order to preserve the PAT/OS App functionality, resource files will still be copied directly into the measures, and these measures will be
|
150
|
+
In the short term, in order to preserve the PAT/OS App functionality, resource files will still be copied directly into the measures, and these measures will be indexed on the BCL.
|
142
151
|
|
143
152
|
### Rake Tasks
|
144
153
|
|
@@ -146,10 +155,7 @@ Common Rake Tasks that are available to derivative extension gems include:
|
|
146
155
|
|
147
156
|
| Rake Task | Description |
|
148
157
|
| --------- | ----------- |
|
149
|
-
| openstudio:bcl:test_login | Test BCL login |
|
150
158
|
| openstudio:bcl:search_measures | Search BCL |
|
151
|
-
| openstudio:bcl:stage[reset] | Copy the measures/components to a staging location |
|
152
|
-
| openstudio:bcl:push | Upload measures from the staging location |
|
153
159
|
| openstudio:change_log[start_date,end_date,apikey] | Print the change log from GitHub. Specify dates in yyyy-mm-dd format |
|
154
160
|
| openstudio:list_measures | List all measures in the calling gem |
|
155
161
|
| openstudio:measures:add_license | Add License File to measures in the calling gem |
|
@@ -182,9 +188,10 @@ The following table contains all current extension gems.
|
|
182
188
|
| OpenStudio Calibration Gem | openstudio-calibration | https://github.com/NREL/openstudio-calibration-gem |
|
183
189
|
| OpenStudio EE Gem | openstudio-ee | https://github.com/NREL/openstudio-ee-gem |
|
184
190
|
| OpenStudio District Systems Gem | openstudio-district-systems | https://github.com/NREL/openstudio-district-systems-gem |
|
191
|
+
| OpenStudio Load Flexibility Measures Gem | openstudio-load-flexibility-measures | https://github.com/NREL/openstudio-load-flexibility-measures-gem |
|
185
192
|
| URBANopt Core Gem | urbanopt-core | https://github.com/urbanopt/urbanopt-core-gem |
|
186
193
|
| URBANopt GeoJSON Gem | urbanopt-geojson | https://github.com/urbanopt/urbanopt-geojson-gem |
|
187
|
-
| URBANopt
|
194
|
+
| URBANopt Reporting Gem | urbanopt-reporting | https://github.com/urbanopt/urbanopt-reporting-gem |
|
188
195
|
| BuildingSync Gem | buildingsync | https://github.com/BuildingSync/BuildingSync-gem |
|
189
196
|
|
190
197
|
### Initializing a new Extension Gem
|
@@ -208,12 +215,8 @@ The OpenStudio-extension gem can be used to easily initialize a new derivative e
|
|
208
215
|
* All files and classes should have underscores (no dashes) and (lowercase snake_case)
|
209
216
|
* Dashes should be used in module names
|
210
217
|
|
211
|
-
###
|
212
|
-
|
213
|
-
**Note of warning**: Use caution when pushing to the BCL. Public and private measures could be pushed to BCL from within an extension gem, even though the extension gem repo may be private.
|
214
|
-
|
215
|
-
TODO: Add warning to rake task and lists what gems will be pushed
|
216
|
-
TODO: Check that license files, etc. are present in each measure before pushing to BCL
|
218
|
+
### Contributing measures to the BCL
|
219
|
+
Register your extension gem repo with the [BCL Manifest](https://github.com/BuildingComponentLibrary/bcl-manifest) and [follow the instructions](https://github.com/BuildingComponentLibrary/bcl-manifest#contribute-content) to contribute content to the BCL.
|
217
220
|
|
218
221
|
## Include in a project
|
219
222
|
|
@@ -232,6 +235,10 @@ Or install it yourself as:
|
|
232
235
|
|
233
236
|
$ gem install 'openstudio-extension'
|
234
237
|
|
238
|
+
# Contributing
|
239
|
+
|
240
|
+
Please review the [OpenStudio Contribution Policy](https://openstudio.net/openstudio-contribution-policy) if you would like to contribute code to this gem.
|
241
|
+
|
235
242
|
# Releasing the gem
|
236
243
|
|
237
244
|
* Update CHANGELOG.md
|
data/Rakefile
CHANGED
@@ -45,10 +45,10 @@ desc 'Initialize a new gem'
|
|
45
45
|
task :init_new_gem do
|
46
46
|
puts 'Initializing a new extension gem'
|
47
47
|
print "\n Enter the name of the new gem directory (ex: openstudio-something-gem. Should end with '-gem'): "
|
48
|
-
gem_name =
|
48
|
+
gem_name = $stdin.gets.chomp
|
49
49
|
|
50
50
|
print "\n Enter the path (full or relative to this repo) where you want the new gem directory to be created: "
|
51
|
-
dir_path =
|
51
|
+
dir_path = $stdin.gets.chomp
|
52
52
|
|
53
53
|
# check if directory already exists at path, if so error
|
54
54
|
full_dir_name = dir_path + gem_name
|
@@ -61,7 +61,7 @@ task :init_new_gem do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# copy file structure
|
64
|
-
FileUtils.cp('.gitignore', full_dir_name
|
64
|
+
FileUtils.cp('.gitignore', "#{full_dir_name}/.gitignore")
|
65
65
|
FileUtils.cp_r(File.join(File.dirname(__FILE__), 'init_templates/template_gemfile.txt'), File.join(full_dir_name, 'Gemfile'))
|
66
66
|
FileUtils.cp_r(File.join(File.dirname(__FILE__), 'doc_templates'), full_dir_name)
|
67
67
|
|
data/lib/change_log.rb
CHANGED
@@ -144,7 +144,7 @@ class ChangeLog
|
|
144
144
|
puts "Total Open Issues: #{@total_open_issues.length}"
|
145
145
|
puts "Total Open Pull Requests: #{@total_open_pull_requests.length}"
|
146
146
|
puts "\nDate Range: #{@start_date.strftime('%m/%d/%y')} - #{@end_date.strftime('%m/%d/%y')}:"
|
147
|
-
puts "\nNew Issues: #{@new_issues.length} (
|
147
|
+
puts "\nNew Issues: #{@new_issues.length} (#{@new_issues.map(&:number).join(', ')})"
|
148
148
|
|
149
149
|
puts "\nClosed Issues: #{@closed_issues.length}"
|
150
150
|
@closed_issues.each { |issue| puts print_issue(issue) }
|
@@ -327,8 +327,7 @@ module OsLib_Geometry
|
|
327
327
|
end
|
328
328
|
|
329
329
|
# sort array by floor area, this hash will be altered to reduce floor area for each space type to 0
|
330
|
-
|
331
|
-
space_types_running_count = space_types
|
330
|
+
space_types_running_count = space_types.sort_by { |k, v| v[:floor_area] }
|
332
331
|
|
333
332
|
# array entry for each story
|
334
333
|
footprints = []
|
@@ -36,6 +36,9 @@
|
|
36
36
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
37
37
|
# *******************************************************************************
|
38
38
|
|
39
|
+
# used to load haystack json in typical_building_from_model
|
40
|
+
require 'json'
|
41
|
+
|
39
42
|
module OsLib_ModelGeneration
|
40
43
|
# simple list of building types that are valid for get_space_types_from_building_type
|
41
44
|
# for general public use use extended = false
|
@@ -158,6 +161,8 @@ module OsLib_ModelGeneration
|
|
158
161
|
array << '90.1-2007'
|
159
162
|
array << '90.1-2010'
|
160
163
|
array << '90.1-2013'
|
164
|
+
array << '90.1-2016'
|
165
|
+
array << '90.1-2019'
|
161
166
|
array << 'ComStock DOE Ref Pre-1980'
|
162
167
|
array << 'ComStock DOE Ref 1980-2004'
|
163
168
|
array << 'ComStock 90.1-2004'
|
@@ -1141,9 +1146,10 @@ module OsLib_ModelGeneration
|
|
1141
1146
|
spaces_temp = OpenStudio::Model::SpaceVector.new
|
1142
1147
|
spaces_temp << space_a
|
1143
1148
|
spaces_temp << space_b
|
1149
|
+
# disable until enhanced intersectio nand matching, will make walls adiabatic and exterior within create_bar workflow
|
1144
1150
|
# intersect and sort
|
1145
|
-
OpenStudio::Model.intersectSurfaces(spaces_temp)
|
1146
|
-
OpenStudio::Model.matchSurfaces(spaces_temp)
|
1151
|
+
# OpenStudio::Model.intersectSurfaces(spaces_temp)
|
1152
|
+
# OpenStudio::Model.matchSurfaces(spaces_temp)
|
1147
1153
|
end
|
1148
1154
|
end
|
1149
1155
|
runner.registerInfo("Intersecting and matching surfaces in story #{story.name}, this will create additional geometry.")
|
@@ -1167,9 +1173,11 @@ module OsLib_ModelGeneration
|
|
1167
1173
|
story.spaces.sort.each do |space|
|
1168
1174
|
story_spaces << space
|
1169
1175
|
end
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1176
|
+
# disable until enhanced intersectio nand matching, will make walls adiabatic and exterior within create_bar workflow
|
1177
|
+
# intersect and sort
|
1178
|
+
# OpenStudio::Model.intersectSurfaces(story_spaces)
|
1179
|
+
# OpenStudio::Model.matchSurfaces(story_spaces)
|
1180
|
+
#runner.registerInfo("Intersecting and matching surfaces in story #{story.name}, this will create additional geometry.")
|
1173
1181
|
end
|
1174
1182
|
end
|
1175
1183
|
|
@@ -1191,6 +1199,66 @@ module OsLib_ModelGeneration
|
|
1191
1199
|
end
|
1192
1200
|
end
|
1193
1201
|
|
1202
|
+
# set wall boundary condtions to adiabatic if using make_mid_story_surfaces_adiabatic prior to windows being made
|
1203
|
+
if bar_hash[:make_mid_story_surfaces_adiabatic]
|
1204
|
+
|
1205
|
+
runner.registerInfo("Finding non-exterior walls and setting boundary condition to adiabatic")
|
1206
|
+
|
1207
|
+
# need to organize by story incase top story is partial story
|
1208
|
+
story_bounding = {}
|
1209
|
+
|
1210
|
+
# gather new spaces by story
|
1211
|
+
new_spaces.each do |space|
|
1212
|
+
story = space.buildingStory.get
|
1213
|
+
if story_bounding.has_key?(story)
|
1214
|
+
story_bounding[story][:spaces] << space
|
1215
|
+
else
|
1216
|
+
story_bounding[story] = {:spaces => [space]}
|
1217
|
+
end
|
1218
|
+
end
|
1219
|
+
|
1220
|
+
# get bounding box for each story
|
1221
|
+
story_bounding.each do |story,v|
|
1222
|
+
|
1223
|
+
# get bounding_box
|
1224
|
+
bounding_box = OpenStudio::BoundingBox.new
|
1225
|
+
v[:spaces].each do |space|
|
1226
|
+
space.surfaces.each do |space_surface|
|
1227
|
+
bounding_box.addPoints(space.transformation * space_surface.vertices)
|
1228
|
+
end
|
1229
|
+
end
|
1230
|
+
min_x = bounding_box.minX.get
|
1231
|
+
min_y = bounding_box.minY.get
|
1232
|
+
max_x = bounding_box.maxX.get
|
1233
|
+
max_y = bounding_box.maxY.get
|
1234
|
+
ext_wall_toll = 0.01
|
1235
|
+
|
1236
|
+
# check surfaces again against min/max and change to adiabatic if not fully on one min or max x or y
|
1237
|
+
# todo - may need to look at aidiabiatc constructions in downstream measure. Some may be exterior party wall others may be interior walls
|
1238
|
+
v[:spaces].each do |space|
|
1239
|
+
space.surfaces.each do |space_surface|
|
1240
|
+
next if not space_surface.surfaceType == "Wall"
|
1241
|
+
surface_bounding_box = OpenStudio::BoundingBox.new
|
1242
|
+
surface_bounding_box.addPoints(space.transformation * space_surface.vertices)
|
1243
|
+
surface_on_outside = false
|
1244
|
+
# check xmin
|
1245
|
+
if (surface_bounding_box.minX.get - min_x).abs < ext_wall_toll && (surface_bounding_box.maxX.get - min_x).abs < ext_wall_toll then surface_on_outside = true end
|
1246
|
+
# check xmax
|
1247
|
+
if (surface_bounding_box.minX.get - max_x).abs < ext_wall_toll && (surface_bounding_box.maxX.get - max_x).abs < ext_wall_toll then surface_on_outside = true end
|
1248
|
+
# check ymin
|
1249
|
+
if (surface_bounding_box.minY.get - min_y).abs < ext_wall_toll && (surface_bounding_box.maxY.get - min_y).abs < ext_wall_toll then surface_on_outside = true end
|
1250
|
+
# check ymax
|
1251
|
+
if (surface_bounding_box.minY.get - max_y).abs < ext_wall_toll && (surface_bounding_box.maxY.get - max_y).abs < ext_wall_toll then surface_on_outside = true end
|
1252
|
+
|
1253
|
+
# change if not exterior
|
1254
|
+
if !surface_on_outside
|
1255
|
+
space_surface.setOutsideBoundaryCondition("Adiabatic")
|
1256
|
+
end
|
1257
|
+
end
|
1258
|
+
end
|
1259
|
+
end
|
1260
|
+
end
|
1261
|
+
|
1194
1262
|
# sort stories (by name for now but need better way)
|
1195
1263
|
sorted_stories = {}
|
1196
1264
|
new_spaces.each do |space|
|
@@ -1695,9 +1763,6 @@ module OsLib_ModelGeneration
|
|
1695
1763
|
end
|
1696
1764
|
fraction = OsLib_HelperMethods.checkDoubleAndIntegerArguments(runner, user_arguments, 'min' => 0.0, 'max' => 1.0, 'min_eq_bool' => true, 'max_eq_bool' => true, 'arg_array' => fraction_args)
|
1697
1765
|
|
1698
|
-
positive_args = ['total_bldg_floor_area']
|
1699
|
-
positive = OsLib_HelperMethods.checkDoubleAndIntegerArguments(runner, user_arguments, 'min' => 0.0, 'max' => nil, 'min_eq_bool' => false, 'max_eq_bool' => false, 'arg_array' => positive_args)
|
1700
|
-
|
1701
1766
|
one_or_greater_args = ['num_stories_above_grade']
|
1702
1767
|
one_or_greater = OsLib_HelperMethods.checkDoubleAndIntegerArguments(runner, user_arguments, 'min' => 1.0, 'max' => nil, 'min_eq_bool' => true, 'max_eq_bool' => false, 'arg_array' => one_or_greater_args)
|
1703
1768
|
|
@@ -1708,13 +1773,13 @@ module OsLib_ModelGeneration
|
|
1708
1773
|
'party_wall_stories_south',
|
1709
1774
|
'party_wall_stories_east',
|
1710
1775
|
'party_wall_stories_west',
|
1776
|
+
'total_bldg_floor_area',
|
1711
1777
|
'single_floor_area',
|
1712
1778
|
'bar_width']
|
1713
1779
|
non_neg = OsLib_HelperMethods.checkDoubleAndIntegerArguments(runner, user_arguments, 'min' => 0.0, 'max' => nil, 'min_eq_bool' => true, 'max_eq_bool' => false, 'arg_array' => non_neg_args)
|
1714
1780
|
|
1715
1781
|
# return false if any errors fail
|
1716
1782
|
if !fraction then return false end
|
1717
|
-
if !positive then return false end
|
1718
1783
|
return false if !one_or_greater
|
1719
1784
|
return false if !non_neg
|
1720
1785
|
|
@@ -1813,10 +1878,6 @@ module OsLib_ModelGeneration
|
|
1813
1878
|
args = bar_arg_check_setup(model,runner,user_arguments,false) # false stops it from checking args on used in bar_from_building_type_ratios
|
1814
1879
|
if !args then return false end
|
1815
1880
|
|
1816
|
-
# identify primary building type for building form defaults
|
1817
|
-
primary_building_type = "PrimarySchool" # see what building type represents the most floro area
|
1818
|
-
building_form_defaults = building_form_defaults(primary_building_type)
|
1819
|
-
|
1820
1881
|
# process arg into hash
|
1821
1882
|
space_type_hash_name = {}
|
1822
1883
|
args['space_type_hash_string'][0..-1].split(/, /).each { |entry| entryMap = entry.split(/=>/); value_str = entryMap[1]; space_type_hash_name[entryMap[0].strip[0..-1].to_s] = value_str.nil? ? '' : value_str.strip[0..-1].to_f }
|
@@ -1864,6 +1925,11 @@ module OsLib_ModelGeneration
|
|
1864
1925
|
building_type_fraction_of_building += ratio
|
1865
1926
|
end
|
1866
1927
|
|
1928
|
+
# identify primary building type for building form defaults
|
1929
|
+
primary_building_type = building_type_hash.keys.first # update to choose building with highest ratio
|
1930
|
+
runner.registerInfo("Creating bar with space type ratio proided as argument.")
|
1931
|
+
runner.registerInfo("Using building type from first ratio #{primary_building_type} as the primary building type. This is used for building form defaults.")
|
1932
|
+
|
1867
1933
|
# todo - confirm if this will get normalized up/down later of if I should fix or stop here instead of just a warning
|
1868
1934
|
if building_type_fraction_of_building > 1.0
|
1869
1935
|
runner.registerWarning("Sum of Space Type Ratio of #{building_type_fraction_of_building} is greater than the expected value of 1.0")
|
@@ -1875,6 +1941,8 @@ module OsLib_ModelGeneration
|
|
1875
1941
|
|
1876
1942
|
# if aspect ratio, story height or wwr have argument value of 0 then use smart building type defaults
|
1877
1943
|
primary_building_type = args['bldg_type_a']
|
1944
|
+
runner.registerInfo("Creating bar space type ratios by building type based on ratios from prototype models.")
|
1945
|
+
runner.registerInfo("#{primary_building_type} will be used for building form defaults.")
|
1878
1946
|
|
1879
1947
|
end
|
1880
1948
|
|
@@ -2510,7 +2578,7 @@ module OsLib_ModelGeneration
|
|
2510
2578
|
runner.registerValue('ew_wall_area_ip', wall_ew_ip, 'ft^2')
|
2511
2579
|
# for now using perimeter of ground floor and average story area (building area / num_stories)
|
2512
2580
|
runner.registerValue('floor_area_to_perim_ratio', model.getBuilding.floorArea / (OsLib_Geometry.calculate_perimeter(model) * num_stories))
|
2513
|
-
runner.registerValue('
|
2581
|
+
runner.registerValue('bar_width_output', OpenStudio.convert(bars['primary'][:width], 'm', 'ft').get, 'ft')
|
2514
2582
|
|
2515
2583
|
if args['party_wall_fraction'] > 0 || args['party_wall_stories_north'] > 0 || args['party_wall_stories_south'] > 0 || args['party_wall_stories_east'] > 0 || args['party_wall_stories_west'] > 0
|
2516
2584
|
runner.registerInfo('Target facade area by orientation not validated when party walls are applied')
|
@@ -2707,6 +2775,29 @@ module OsLib_ModelGeneration
|
|
2707
2775
|
return false
|
2708
2776
|
end
|
2709
2777
|
|
2778
|
+
# if haystack_file used find the file
|
2779
|
+
# todo - may want to allow NA, empty string or some other value to skip so a measure can ake this optional witht using optional measure arguments
|
2780
|
+
if args['haystack_file']
|
2781
|
+
haystack_file = runner.workflow.findFile(args['haystack_file'])
|
2782
|
+
if haystack_file.is_initialized
|
2783
|
+
haystack_file = haystack_file.get.to_s
|
2784
|
+
|
2785
|
+
# load JSON file
|
2786
|
+
json = nil
|
2787
|
+
File.open(haystack_file, 'r') do |file|
|
2788
|
+
json = file.read
|
2789
|
+
# uncomment to inspect haystack json
|
2790
|
+
# puts json
|
2791
|
+
end
|
2792
|
+
|
2793
|
+
else
|
2794
|
+
runner.registerError("Did not find #{args['haystack_file']} in paths described in OSW file.")
|
2795
|
+
return false
|
2796
|
+
end
|
2797
|
+
else
|
2798
|
+
haystack_file = nil
|
2799
|
+
end
|
2800
|
+
|
2710
2801
|
# make sure daylight savings is turned on up prior to any sizing runs being done.
|
2711
2802
|
if args['enable_dst']
|
2712
2803
|
start_date = '2nd Sunday in March'
|
@@ -2932,9 +3023,9 @@ module OsLib_ModelGeneration
|
|
2932
3023
|
if args['htg_src'] == 'NaturalGas' || args['htg_src'] == 'DistrictHeating'
|
2933
3024
|
args['swh_src'] = 'NaturalGas' # If building has gas service, probably uses natural gas for SWH
|
2934
3025
|
elsif args['htg_src'] == 'Electricity'
|
2935
|
-
args['swh_src']
|
3026
|
+
args['swh_src'] = 'Electricity' # If building is doing space heating with electricity, probably used for SWH
|
2936
3027
|
elsif args['htg_src'] == 'DistrictAmbient'
|
2937
|
-
args['swh_src']
|
3028
|
+
args['swh_src'] = 'HeatPump' # If building has district ambient loop, it is fancy and probably uses HPs for SWH
|
2938
3029
|
else
|
2939
3030
|
args['swh_src'] = nil # Use inferences built into OpenStudio Standards for each building and space type
|
2940
3031
|
end
|
@@ -3090,12 +3181,20 @@ module OsLib_ModelGeneration
|
|
3090
3181
|
sys_type # same as primary system type
|
3091
3182
|
end
|
3092
3183
|
|
3093
|
-
#
|
3094
|
-
|
3184
|
+
# group zones
|
3185
|
+
if haystack_file.nil?
|
3186
|
+
# Group zones by story
|
3187
|
+
bldg_zone_lists = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3188
|
+
else
|
3189
|
+
# todo - group zones using haystack file instead of building stories
|
3190
|
+
# todo - need to do something similar to use haystack to indentify secondary zones
|
3191
|
+
bldg_zone_lists = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3192
|
+
runner.registerInfo("***This code will define which zones are on air loops for inferred system***")
|
3193
|
+
end
|
3095
3194
|
|
3096
3195
|
# On each story, add the primary system to the primary zones
|
3097
3196
|
# and add the secondary system to any zones that are different.
|
3098
|
-
|
3197
|
+
bldg_zone_lists.each do |story_group|
|
3099
3198
|
# Differentiate primary and secondary zones, based on
|
3100
3199
|
# operating hours and internal loads (same as 90.1 PRM)
|
3101
3200
|
pri_sec_zone_lists = standard.model_differentiate_primary_secondary_thermal_zones(model, story_group)
|
@@ -3135,12 +3234,21 @@ module OsLib_ModelGeneration
|
|
3135
3234
|
# Group the zones by occupancy type. Only split out non-dominant groups if their total area exceeds the limit.
|
3136
3235
|
sys_groups = standard.model_group_zones_by_type(model, OpenStudio.convert(20_000, 'ft^2', 'm^2').get)
|
3137
3236
|
sys_groups.each do |sys_group|
|
3138
|
-
|
3139
|
-
|
3237
|
+
|
3238
|
+
# group zones
|
3239
|
+
if haystack_file.nil?
|
3240
|
+
# Group zones by story
|
3241
|
+
bldg_zone_groups = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3242
|
+
else
|
3243
|
+
# todo - group zones using haystack file instead of building stories
|
3244
|
+
# todo - need to do something similar to use haystack to indentify secondary zones
|
3245
|
+
bldg_zone_groups = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3246
|
+
runner.registerInfo("***This code will define which zones are on air loops for user specified system***")
|
3247
|
+
end
|
3140
3248
|
|
3141
3249
|
# Add the user specified HVAC system for each story.
|
3142
3250
|
# Single-zone systems will get one per zone.
|
3143
|
-
|
3251
|
+
bldg_zone_groups.each do |zones|
|
3144
3252
|
unless model.add_cbecs_hvac_system(standard, args['system_type'], zones)
|
3145
3253
|
runner.registerError("HVAC system type '#{args['system_type']}' not recognized. Check input system type argument against Model.hvac.rb for valid hvac system type names.")
|
3146
3254
|
return false
|
@@ -3155,8 +3263,17 @@ module OsLib_ModelGeneration
|
|
3155
3263
|
# Infer the current hours of operation schedule for the building
|
3156
3264
|
op_sch = standard.model_infer_hours_of_operation_building(model)
|
3157
3265
|
|
3266
|
+
# setup hoo_var_method (should be hours or fractional)
|
3267
|
+
if args.has_key?('hoo_var_method')
|
3268
|
+
hoo_var_method = args['hoo_var_method']
|
3269
|
+
else
|
3270
|
+
# support measures that don't supply this argument
|
3271
|
+
hoo_var_method = 'hours'
|
3272
|
+
end
|
3273
|
+
|
3158
3274
|
# Convert existing schedules in the model to parametric schedules based on current hours of operation
|
3159
|
-
|
3275
|
+
runner.registerInfo("Generating parametric schedules from ruleset schedules using #{hoo_var_method} variable method for hours of operation fromula.")
|
3276
|
+
standard.model_setup_parametric_schedules(model, hoo_var_method: hoo_var_method)
|
3160
3277
|
|
3161
3278
|
# Create start and end times from start time and duration supplied
|
3162
3279
|
wkdy_start_time = nil
|
@@ -3252,11 +3369,11 @@ module OsLib_ModelGeneration
|
|
3252
3369
|
|
3253
3370
|
# change night cycling control to "Thermostat" cycling and increase thermostat tolerance to 1.99999
|
3254
3371
|
manager_night_cycles = model.getAvailabilityManagerNightCycles
|
3255
|
-
|
3372
|
+
runner.registerInfo("Changing thermostat tollerance to 1.99999 for #{manager_night_cycles.size} night cycle manager objects.")
|
3373
|
+
|
3256
3374
|
manager_night_cycles.each do |night_cycle|
|
3257
3375
|
night_cycle.setThermostatTolerance(1.9999)
|
3258
3376
|
night_cycle.setCyclingRunTimeControlType("Thermostat")
|
3259
|
-
runner.registerInfo(" night_cycle == #{night_cycle}")
|
3260
3377
|
end
|
3261
3378
|
|
3262
3379
|
# report final condition of model
|
@@ -55,7 +55,7 @@ module OpenStudio
|
|
55
55
|
@root_dir = @extension.root_dir
|
56
56
|
# Catch if measures_dir is nil, then just make it an empty string
|
57
57
|
@measures_dir = @extension.measures_dir || ''
|
58
|
-
@staged_path = @measures_dir
|
58
|
+
@staged_path = "#{@measures_dir}/staged"
|
59
59
|
@core_dir = @extension.core_dir
|
60
60
|
@doc_templates_dir = @extension.doc_templates_dir
|
61
61
|
@files_dir = @extension.files_dir
|
@@ -147,19 +147,11 @@ module OpenStudio
|
|
147
147
|
end
|
148
148
|
|
149
149
|
namespace 'bcl' do
|
150
|
-
desc 'Test BCL login'
|
151
|
-
task :test_login do
|
152
|
-
puts 'test BCL login'
|
153
|
-
bcl = ::BCL::ComponentMethods.new
|
154
|
-
bcl.login
|
155
|
-
end
|
156
|
-
|
157
150
|
# for custom search, populate env var: bcl_search_keyword
|
158
151
|
desc 'Search BCL'
|
159
152
|
task :search_measures do
|
160
153
|
puts 'test search BCL'
|
161
154
|
bcl = ::BCL::ComponentMethods.new
|
162
|
-
bcl.login
|
163
155
|
|
164
156
|
# check for env var specifying keyword first
|
165
157
|
if ENV['bcl_search_keyword']
|
@@ -176,195 +168,6 @@ module OpenStudio
|
|
176
168
|
puts(res[:measure][:name]).to_s
|
177
169
|
end
|
178
170
|
end
|
179
|
-
|
180
|
-
# to call with argument: "openstudio:bcl:stage[true]" (true = remove existing staged content)
|
181
|
-
desc 'Copy the measures/components to a location that can be uploaded to BCL'
|
182
|
-
task :stage, [:reset] do |t, args|
|
183
|
-
puts 'Staging measures for BCL'
|
184
|
-
# initialize BCL and login
|
185
|
-
bcl = ::BCL::ComponentMethods.new
|
186
|
-
bcl.login
|
187
|
-
|
188
|
-
# process reset options: true to clear out old staged content
|
189
|
-
options = { reset: false }
|
190
|
-
if args[:reset].to_s == 'true'
|
191
|
-
options[:reset] = true
|
192
|
-
end
|
193
|
-
|
194
|
-
# ensure staged dir exists
|
195
|
-
FileUtils.mkdir_p(@staged_path)
|
196
|
-
|
197
|
-
# delete existing tarballs if reset is true
|
198
|
-
if options[:reset]
|
199
|
-
puts 'Deleting existing staged content'
|
200
|
-
FileUtils.rm_rf(Dir.glob("#{@staged_path}/*"))
|
201
|
-
end
|
202
|
-
|
203
|
-
# create new and existing directories
|
204
|
-
FileUtils.mkdir_p(@staged_path.to_s + '/update')
|
205
|
-
FileUtils.mkdir_p(@staged_path.to_s + '/push/component')
|
206
|
-
FileUtils.mkdir_p(@staged_path.to_s + '/push/measure')
|
207
|
-
|
208
|
-
# keep track of noop, update, push
|
209
|
-
noops = 0
|
210
|
-
new_ones = 0
|
211
|
-
updates = 0
|
212
|
-
|
213
|
-
# get all content directories to process
|
214
|
-
dirs = Dir.glob("#{@measures_dir}/*")
|
215
|
-
|
216
|
-
dirs.each do |dir|
|
217
|
-
next if dir.include?('Rakefile') || File.basename(dir) == 'staged'
|
218
|
-
current_d = Dir.pwd
|
219
|
-
content_name = File.basename(dir)
|
220
|
-
puts '', '---'
|
221
|
-
puts "Generating #{content_name}"
|
222
|
-
|
223
|
-
Dir.chdir(dir)
|
224
|
-
|
225
|
-
# figure out whether to upload new or update existing
|
226
|
-
files = Pathname.glob('**/*')
|
227
|
-
uuid = nil
|
228
|
-
vid = nil
|
229
|
-
content_type = 'measure'
|
230
|
-
|
231
|
-
paths = []
|
232
|
-
files.each do |file|
|
233
|
-
# don't tar tests/outputs directory
|
234
|
-
next if file.to_s.start_with?('tests/output') # From measure testing process
|
235
|
-
next if file.to_s.start_with?('tests/test') # From openstudio-measure-tester-gem
|
236
|
-
next if file.to_s.start_with?('tests/coverage') # From openstudio-measure-tester-gem
|
237
|
-
next if file.to_s.start_with?('test_results') # From openstudio-measure-tester-gem
|
238
|
-
paths << file.to_s
|
239
|
-
if file.to_s =~ /^.{0,2}component.xml$/ || file.to_s =~ /^.{0,2}measure.xml$/
|
240
|
-
if file.to_s.match?(/^.{0,2}component.xml$/)
|
241
|
-
content_type = 'component'
|
242
|
-
end
|
243
|
-
# extract uuid and vid
|
244
|
-
uuid, vid = bcl.uuid_vid_from_xml(file)
|
245
|
-
end
|
246
|
-
end
|
247
|
-
puts "UUID: #{uuid}, VID: #{vid}"
|
248
|
-
|
249
|
-
# note: if uuid is missing, will assume new content
|
250
|
-
action = bcl.search_by_uuid(uuid, vid)
|
251
|
-
puts "#{content_name} ACTION TO TAKE: #{action}"
|
252
|
-
# new content functionality needs to know if measure or component. update is agnostic.
|
253
|
-
if action == 'noop' # ignore up-to-date content
|
254
|
-
puts " - WARNING: local #{content_name} uuid and vid match BCL... no update will be performed"
|
255
|
-
noops += 1
|
256
|
-
next
|
257
|
-
elsif action == 'update'
|
258
|
-
# puts "#{content_name} labeled as update for BCL"
|
259
|
-
destination = @staged_path + '/' + action + '/' + "#{content_name}.tar.gz"
|
260
|
-
updates += 1
|
261
|
-
elsif action == 'push'
|
262
|
-
# puts "#{content_name} labeled as new content for BCL"
|
263
|
-
destination = @staged_path + '/' + action + '/' + content_type + "/#{content_name}.tar.gz"
|
264
|
-
new_ones += 1
|
265
|
-
end
|
266
|
-
|
267
|
-
puts "destination: #{destination}"
|
268
|
-
|
269
|
-
# copy over only if 'reset_receipts' is set to TRUE. otherwise ignore if file exists already
|
270
|
-
if File.exist?(destination)
|
271
|
-
if options[:reset]
|
272
|
-
FileUtils.rm(destination)
|
273
|
-
::BCL.tarball(destination, paths)
|
274
|
-
else
|
275
|
-
puts "*** WARNING: File #{content_name}.tar.gz already exists in staged directory... keeping existing file. To overwrite, set reset_receipts arg to true ***"
|
276
|
-
end
|
277
|
-
else
|
278
|
-
::BCL.tarball(destination, paths)
|
279
|
-
end
|
280
|
-
Dir.chdir(current_d)
|
281
|
-
end
|
282
|
-
puts '', "****STAGING DONE**** #{new_ones} new content, #{updates} updates, #{noops} skipped (already up-to-date on BCL)", ''
|
283
|
-
end
|
284
|
-
|
285
|
-
desc 'Upload measures from the specified location.'
|
286
|
-
task :push do
|
287
|
-
puts 'Push measures to BCL'
|
288
|
-
|
289
|
-
# initialize BCL and login
|
290
|
-
bcl = ::BCL::ComponentMethods.new
|
291
|
-
bcl.login
|
292
|
-
reset = false
|
293
|
-
|
294
|
-
total_count = 0
|
295
|
-
successes = 0
|
296
|
-
errors = 0
|
297
|
-
skipped = 0
|
298
|
-
|
299
|
-
# grab all the new measure and component tar files and push to bcl
|
300
|
-
['measure', 'component'].each do |content_type|
|
301
|
-
items = []
|
302
|
-
paths = Pathname.glob(@staged_path.to_s + "/push/#{content_type}/*.tar.gz")
|
303
|
-
paths.each do |path|
|
304
|
-
# puts path
|
305
|
-
items << path.to_s
|
306
|
-
end
|
307
|
-
|
308
|
-
items.each do |item|
|
309
|
-
puts item.split('/').last
|
310
|
-
total_count += 1
|
311
|
-
|
312
|
-
receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt'
|
313
|
-
if !reset && File.exist?(receipt_file)
|
314
|
-
skipped += 1
|
315
|
-
puts 'SKIP: receipt file found'
|
316
|
-
next
|
317
|
-
end
|
318
|
-
|
319
|
-
valid, res = bcl.push_content(item, true, "nrel_#{content_type}")
|
320
|
-
if valid
|
321
|
-
successes += 1
|
322
|
-
else
|
323
|
-
errors += 1
|
324
|
-
if res.key?(:error)
|
325
|
-
puts " ERROR MESSAGE: #{res[:error]}"
|
326
|
-
else
|
327
|
-
puts "ERROR: #{res.inspect.chomp}"
|
328
|
-
end
|
329
|
-
end
|
330
|
-
puts '', '---'
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
# grab all the updated content (measures and components) tar files and push to bcl
|
335
|
-
items = []
|
336
|
-
paths = Pathname.glob(@staged_path.to_s + '/update/*.tar.gz')
|
337
|
-
paths.each do |path|
|
338
|
-
# puts path
|
339
|
-
items << path.to_s
|
340
|
-
end
|
341
|
-
items.each do |item|
|
342
|
-
puts item.split('/').last
|
343
|
-
total_count += 1
|
344
|
-
|
345
|
-
receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt'
|
346
|
-
if !reset && File.exist?(receipt_file)
|
347
|
-
skipped += 1
|
348
|
-
puts 'SKIP: receipt file found'
|
349
|
-
next
|
350
|
-
end
|
351
|
-
|
352
|
-
valid, res = bcl.update_content(item, true)
|
353
|
-
if valid
|
354
|
-
successes += 1
|
355
|
-
else
|
356
|
-
errors += 1
|
357
|
-
if res.key?(:error)
|
358
|
-
puts " ERROR MESSAGE: #{res[:error]}"
|
359
|
-
else
|
360
|
-
puts "ERROR MESSAGE: #{res.inspect.chomp}"
|
361
|
-
end
|
362
|
-
end
|
363
|
-
puts '', '---'
|
364
|
-
end
|
365
|
-
|
366
|
-
puts "****UPLOAD DONE**** #{total_count} total, #{successes} success, #{errors} failures, #{skipped} skipped"
|
367
|
-
end
|
368
171
|
end
|
369
172
|
end
|
370
173
|
end
|
@@ -121,15 +121,15 @@ module OpenStudio
|
|
121
121
|
|
122
122
|
# test to see if bundle is installed
|
123
123
|
check_bundle = run_command('bundle -v', get_clean_env)
|
124
|
-
if !check_bundle
|
125
|
-
raise "Failed to run command 'bundle -v', check that bundle is installed"
|
124
|
+
if !check_bundle && !File.exist?(@dirname)
|
125
|
+
raise "Failed to run command 'bundle -v', check that bundle is installed"
|
126
126
|
end
|
127
127
|
|
128
128
|
# TODO: check that ruby version is correct
|
129
129
|
|
130
130
|
# check existing config
|
131
131
|
needs_config = true
|
132
|
-
if File.exist?('./.bundle/config')
|
132
|
+
if File.exist?('./.bundle/config') # checking wrt gemfile_dir
|
133
133
|
puts 'config exists'
|
134
134
|
needs_config = false
|
135
135
|
config = YAML.load_file('./.bundle/config')
|
@@ -166,10 +166,8 @@ module OpenStudio
|
|
166
166
|
end
|
167
167
|
|
168
168
|
needs_update = needs_config || needs_platform
|
169
|
-
if !needs_update
|
170
|
-
|
171
|
-
needs_update = true
|
172
|
-
end
|
169
|
+
if !needs_update && (!File.exist?('Gemfile.lock') || File.mtime(@gemfile_path) > File.mtime('Gemfile.lock'))
|
170
|
+
needs_update = true
|
173
171
|
end
|
174
172
|
|
175
173
|
puts "needs_update = #{needs_update}"
|
@@ -241,7 +239,7 @@ module OpenStudio
|
|
241
239
|
puts "Error running command: '#{command}'"
|
242
240
|
puts "stdout: #{stdout_str}"
|
243
241
|
puts "stderr: #{stderr_str}"
|
244
|
-
|
242
|
+
$stdout.flush
|
245
243
|
result = false
|
246
244
|
end
|
247
245
|
ensure
|
@@ -318,10 +316,10 @@ module OpenStudio
|
|
318
316
|
|
319
317
|
puts 'SYSTEM CALL:'
|
320
318
|
puts the_call
|
321
|
-
|
319
|
+
$stdout.flush
|
322
320
|
result = run_command(the_call, get_clean_env)
|
323
321
|
puts "DONE, result = #{result}"
|
324
|
-
|
322
|
+
$stdout.flush
|
325
323
|
|
326
324
|
return result
|
327
325
|
end
|
@@ -358,10 +356,10 @@ module OpenStudio
|
|
358
356
|
|
359
357
|
puts 'SYSTEM CALL:'
|
360
358
|
puts the_call
|
361
|
-
|
359
|
+
$stdout.flush
|
362
360
|
result &&= run_command(the_call, get_clean_env)
|
363
361
|
puts "DONE, result = #{result}"
|
364
|
-
|
362
|
+
$stdout.flush
|
365
363
|
end
|
366
364
|
|
367
365
|
return result
|
@@ -425,7 +423,7 @@ module OpenStudio
|
|
425
423
|
measures = Dir.glob(File.join(measures_dir, '**/**/resources/*.rb'))
|
426
424
|
end
|
427
425
|
|
428
|
-
#
|
426
|
+
# NOTE: some older measures like AEDG use 'OsLib_SomeName' instead of 'os_lib_some_name'
|
429
427
|
# this script isn't replacing those copies
|
430
428
|
|
431
429
|
# loop through resource files
|
@@ -523,11 +521,9 @@ module OpenStudio
|
|
523
521
|
return false
|
524
522
|
end
|
525
523
|
|
526
|
-
if File.exist?(File.join(doc_templates_dir, 'LICENSE.md'))
|
527
|
-
|
528
|
-
|
529
|
-
FileUtils.cp(File.join(doc_templates_dir, 'LICENSE.md'), File.join(root_dir, 'LICENSE.md'))
|
530
|
-
end
|
524
|
+
if File.exist?(File.join(doc_templates_dir, 'LICENSE.md')) && File.exist?(File.join(root_dir, 'LICENSE.md'))
|
525
|
+
puts 'updating LICENSE.md in root dir'
|
526
|
+
FileUtils.cp(File.join(doc_templates_dir, 'LICENSE.md'), File.join(root_dir, 'LICENSE.md'))
|
531
527
|
end
|
532
528
|
|
533
529
|
ruby_regex = /^\#\s?[\#\*]{12,}.*copyright.*?\#\s?[\#\*]{12,}\s*$/mi
|
@@ -593,7 +589,7 @@ module OpenStudio
|
|
593
589
|
puts ' CANNOT add license to file automatically, add it manually and it will update automatically in the future'
|
594
590
|
next
|
595
591
|
end
|
596
|
-
File.open(dir_file, 'w') { |write| write << f.insert(0, path[:license]
|
592
|
+
File.open(dir_file, 'w') { |write| write << f.insert(0, "#{path[:license]}\n") }
|
597
593
|
end
|
598
594
|
end
|
599
595
|
end
|
@@ -631,7 +627,7 @@ module OpenStudio
|
|
631
627
|
|
632
628
|
if @options[:run_simulations]
|
633
629
|
cli = OpenStudio.getOpenStudioCLI
|
634
|
-
out_log = run_osw_path
|
630
|
+
out_log = "#{run_osw_path}.log"
|
635
631
|
# if Gem.win_platform?
|
636
632
|
# # out_log = "nul"
|
637
633
|
# else
|
@@ -655,10 +651,10 @@ module OpenStudio
|
|
655
651
|
|
656
652
|
puts 'SYSTEM CALL:'
|
657
653
|
puts the_call
|
658
|
-
|
654
|
+
$stdout.flush
|
659
655
|
result = run_command(the_call, get_clean_env)
|
660
656
|
puts "DONE, result = #{result}"
|
661
|
-
|
657
|
+
$stdout.flush
|
662
658
|
else
|
663
659
|
puts 'simulations are not performed, since to the @options[:run_simulations] is set to false'
|
664
660
|
end
|
data/lib/openstudio/extension.rb
CHANGED
@@ -209,11 +209,9 @@ module OpenStudio
|
|
209
209
|
def self.set_measure_argument(osw, measure_dir_name, argument_name, argument_value, step_name = nil)
|
210
210
|
result = false
|
211
211
|
osw[:steps].each do |step|
|
212
|
-
if step[:measure_dir_name] == measure_dir_name
|
213
|
-
|
214
|
-
|
215
|
-
result = true
|
216
|
-
end
|
212
|
+
if step[:measure_dir_name] == measure_dir_name && (step_name.nil? || step[:name] == step_name)
|
213
|
+
step[:arguments][argument_name.to_sym] = argument_value
|
214
|
+
result = true
|
217
215
|
end
|
218
216
|
end
|
219
217
|
|
@@ -239,10 +237,8 @@ module OpenStudio
|
|
239
237
|
def self.measure_in_osw(osw, measure_dir_name, step_name = nil)
|
240
238
|
result = false
|
241
239
|
osw[:steps].each do |step|
|
242
|
-
if step[:measure_dir_name] == measure_dir_name
|
243
|
-
|
244
|
-
result = true
|
245
|
-
end
|
240
|
+
if step[:measure_dir_name] == measure_dir_name && (step_name.nil? || step[:name] == step_name)
|
241
|
+
result = true
|
246
242
|
end
|
247
243
|
end
|
248
244
|
|
@@ -6,12 +6,12 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'openstudio-extension'
|
7
7
|
spec.version = OpenStudio::Extension::VERSION
|
8
8
|
spec.platform = Gem::Platform::RUBY
|
9
|
-
spec.authors = ['Katherine Fleming', 'Nicholas Long', 'Daniel Macumber']
|
10
|
-
spec.email = ['katherine.fleming@nrel.gov', 'nicholas.long@nrel.gov', 'daniel.macumber@nrel.gov']
|
9
|
+
spec.authors = ['Katherine Fleming', 'Nicholas Long', 'Daniel Macumber', 'David Goldwasser']
|
10
|
+
spec.email = ['katherine.fleming@nrel.gov', 'nicholas.long@nrel.gov', 'daniel.macumber@nrel.gov', 'david.goldwasser@nrel.gov']
|
11
11
|
|
12
12
|
spec.homepage = 'https://openstudio.net'
|
13
13
|
spec.summary = 'openstudio base gem for creating generic extensions with encapsulated data and measures.'
|
14
|
-
spec.description = 'openstudio base gem for creating generic extensions with encapsulated data and measures.'
|
14
|
+
spec.description = 'openstudio base gem for creating generic extensions with encapsulated data and measures. Also contains ruby libraries that required by many measures.'
|
15
15
|
spec.metadata = {
|
16
16
|
'bug_tracker_uri' => 'https://github.com/NREL/openstudio-extension-gem/issues',
|
17
17
|
'changelog_uri' => 'https://github.com/NREL/openstudio-extension-gem/blob/develop/CHANGELOG.md',
|
@@ -28,14 +28,14 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.required_ruby_version = '~> 2.7.0'
|
30
30
|
|
31
|
-
spec.add_dependency 'bcl', '~> 0.7.
|
31
|
+
spec.add_dependency 'bcl', '~> 0.7.1'
|
32
32
|
spec.add_dependency 'bundler', '>= 2.1.0'
|
33
33
|
spec.add_dependency 'octokit', '~> 4.18.0' # for change logs
|
34
|
-
spec.add_dependency '
|
35
|
-
spec.add_dependency '
|
34
|
+
spec.add_dependency 'openstudio_measure_tester', '~> 0.3.1'
|
35
|
+
spec.add_dependency 'openstudio-workflow', '~> 2.3.0'
|
36
36
|
spec.add_dependency 'parallel', '~> 1.19.1'
|
37
37
|
|
38
|
-
spec.add_development_dependency 'openstudio-standards', '~> 0.2.13
|
38
|
+
spec.add_development_dependency 'openstudio-standards', '~> 0.2.13' # for os_lib unit tests
|
39
39
|
spec.add_development_dependency 'rake', '~> 13.0'
|
40
40
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
41
41
|
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstudio-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katherine Fleming
|
8
8
|
- Nicholas Long
|
9
9
|
- Daniel Macumber
|
10
|
+
- David Goldwasser
|
10
11
|
autorequire:
|
11
12
|
bindir: exe
|
12
13
|
cert_chain: []
|
13
|
-
date: 2021-
|
14
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: bcl
|
@@ -18,14 +19,14 @@ dependencies:
|
|
18
19
|
requirements:
|
19
20
|
- - "~>"
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.7.
|
22
|
+
version: 0.7.1
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
27
|
- - "~>"
|
27
28
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.7.
|
29
|
+
version: 0.7.1
|
29
30
|
- !ruby/object:Gem::Dependency
|
30
31
|
name: bundler
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,33 +56,33 @@ dependencies:
|
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: 4.18.0
|
57
58
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
59
|
+
name: openstudio_measure_tester
|
59
60
|
requirement: !ruby/object:Gem::Requirement
|
60
61
|
requirements:
|
61
62
|
- - "~>"
|
62
63
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
+
version: 0.3.1
|
64
65
|
type: :runtime
|
65
66
|
prerelease: false
|
66
67
|
version_requirements: !ruby/object:Gem::Requirement
|
67
68
|
requirements:
|
68
69
|
- - "~>"
|
69
70
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
71
|
+
version: 0.3.1
|
71
72
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
73
|
+
name: openstudio-workflow
|
73
74
|
requirement: !ruby/object:Gem::Requirement
|
74
75
|
requirements:
|
75
76
|
- - "~>"
|
76
77
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
+
version: 2.3.0
|
78
79
|
type: :runtime
|
79
80
|
prerelease: false
|
80
81
|
version_requirements: !ruby/object:Gem::Requirement
|
81
82
|
requirements:
|
82
83
|
- - "~>"
|
83
84
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
+
version: 2.3.0
|
85
86
|
- !ruby/object:Gem::Dependency
|
86
87
|
name: parallel
|
87
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,14 +103,14 @@ dependencies:
|
|
102
103
|
requirements:
|
103
104
|
- - "~>"
|
104
105
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.2.13
|
106
|
+
version: 0.2.13
|
106
107
|
type: :development
|
107
108
|
prerelease: false
|
108
109
|
version_requirements: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
111
|
- - "~>"
|
111
112
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.2.13
|
113
|
+
version: 0.2.13
|
113
114
|
- !ruby/object:Gem::Dependency
|
114
115
|
name: rake
|
115
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,11 +140,12 @@ dependencies:
|
|
139
140
|
- !ruby/object:Gem::Version
|
140
141
|
version: '3.9'
|
141
142
|
description: openstudio base gem for creating generic extensions with encapsulated
|
142
|
-
data and measures.
|
143
|
+
data and measures. Also contains ruby libraries that required by many measures.
|
143
144
|
email:
|
144
145
|
- katherine.fleming@nrel.gov
|
145
146
|
- nicholas.long@nrel.gov
|
146
147
|
- daniel.macumber@nrel.gov
|
148
|
+
- david.goldwasser@nrel.gov
|
147
149
|
executables: []
|
148
150
|
extensions: []
|
149
151
|
extra_rdoc_files: []
|
@@ -231,7 +233,7 @@ licenses: []
|
|
231
233
|
metadata:
|
232
234
|
bug_tracker_uri: https://github.com/NREL/openstudio-extension-gem/issues
|
233
235
|
changelog_uri: https://github.com/NREL/openstudio-extension-gem/blob/develop/CHANGELOG.md
|
234
|
-
source_code_uri: https://github.com/NREL/openstudio-extension-gem/tree/v0.
|
236
|
+
source_code_uri: https://github.com/NREL/openstudio-extension-gem/tree/v0.5.0
|
235
237
|
post_install_message:
|
236
238
|
rdoc_options: []
|
237
239
|
require_paths:
|