openstudio-extension 0.4.2 → 0.5.1
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 +27 -0
- data/Gemfile +1 -2
- 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 +145 -21
- 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 +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1d5fc1ae05ebc04e7ba917e74002f1c9c574fb03354c1dc9a8a12dd5fa1f897
|
4
|
+
data.tar.gz: 876541d14c4ccc7a97eb7a617d40c7dc68f58f1a49959491d51919e8af068f17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3df31fdd6f8bd2805af4c69effc71f3ebb50c4ea1863f728737140623b42b87ebd5f2a05555b13eb8a0b2237a1eb73b8184723593bd89805a157bed4ec545ff
|
7
|
+
data.tar.gz: 20e1d537b0bd4ac570a6c8e90aa44de68434aaa573b1142fe560b340c9b9d8dca2182cea1c3dc9b6ca42c688afebe25ca3c5f1d2cf9382ed549645aa06a46ce3
|
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,7 +1,34 @@
|
|
1
1
|
# OpenStudio Extension Gem
|
2
2
|
|
3
|
+
## Version 0.5.1
|
4
|
+
|
5
|
+
* Fix adjancent surface matching
|
6
|
+
|
7
|
+
## Version 0.5.0
|
8
|
+
|
9
|
+
* Update OpenStudio Workflow Gem to 2.3.0 (support for epJSON)
|
10
|
+
* Fixed [#133]( https://github.com/NREL/openstudio-extension-gem/pull/133 ), cleanup readme and rework BCL tasks
|
11
|
+
* Fixed [#135]( https://github.com/NREL/openstudio-extension-gem/pull/135 ), Intersect tests 072021
|
12
|
+
* Fixed [#136]( https://github.com/NREL/openstudio-extension-gem/pull/136 ), Osm from haystack
|
13
|
+
* Fixed [#137]( https://github.com/NREL/openstudio-extension-gem/issues/137 ), Edge case error in hospital bar
|
14
|
+
* Fixed [#138]( https://github.com/NREL/openstudio-extension-gem/issues/138 ), os_lib_model_generation does not assign SWH type correctly
|
15
|
+
* Fixed [#139]( https://github.com/NREL/openstudio-extension-gem/pull/139 ), fix swh_src assignment operators
|
16
|
+
* Fixed [#142]( https://github.com/NREL/openstudio-extension-gem/pull/142 ), added arg for hoo_var_method and updated test to use it
|
17
|
+
|
18
|
+
## Version 0.4.4
|
19
|
+
|
20
|
+
* Update BCL gem to version 0.7.1 which upgrades REXML and Spreadsheet with security patches
|
21
|
+
* Minor updates to documentation
|
22
|
+
|
23
|
+
## Version 0.4.3
|
24
|
+
|
25
|
+
* Update measure tester gem which upgrades Rubocop to 1.15
|
26
|
+
* Update styles to v4 based on new version of Rubocop
|
27
|
+
|
3
28
|
## Version 0.4.2
|
4
29
|
|
30
|
+
* Fixes [#113](https://github.com/NREL/openstudio-extension-gem/issues/113) Fix bad args behavior on bar_from_building_type_ratios
|
31
|
+
* Fixes [#103](https://github.com/NREL/openstudio-extension-gem/issues/103) make check_upstream_measure_for_arg more robust for non string arguments
|
5
32
|
* Updatd version of openstudio-standards for development to openstudio-standards 0.2.13
|
6
33
|
* 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
|
7
34
|
|
data/Gemfile
CHANGED
@@ -3,7 +3,6 @@ source 'http://rubygems.org'
|
|
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
|
+
# gem 'openstudio-standards', github: 'NREL/openstudio-standards', branch: 'fix/901_2016_2019_properties' # for os_lib unit tests
|
7
7
|
|
8
8
|
gemspec
|
9
|
-
|
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
|
@@ -1143,12 +1146,13 @@ module OsLib_ModelGeneration
|
|
1143
1146
|
spaces_temp = OpenStudio::Model::SpaceVector.new
|
1144
1147
|
spaces_temp << space_a
|
1145
1148
|
spaces_temp << space_b
|
1149
|
+
# attempt to intersect and match walls on a story, but later secondary match will look for missted matches and turn them to adiabaitc
|
1146
1150
|
# intersect and sort
|
1147
1151
|
OpenStudio::Model.intersectSurfaces(spaces_temp)
|
1148
1152
|
OpenStudio::Model.matchSurfaces(spaces_temp)
|
1149
1153
|
end
|
1150
1154
|
end
|
1151
|
-
runner.registerInfo("Intersecting and matching surfaces in story #{story.name}, this will create additional geometry.")
|
1155
|
+
runner.registerInfo("Intersecting and matching surfaces in story #{story.name}, this will create additional geometry. Diagnstoic intersection and matching done a in paris of spaces.")
|
1152
1156
|
end
|
1153
1157
|
end
|
1154
1158
|
|
@@ -1169,6 +1173,8 @@ module OsLib_ModelGeneration
|
|
1169
1173
|
story.spaces.sort.each do |space|
|
1170
1174
|
story_spaces << space
|
1171
1175
|
end
|
1176
|
+
# attempt to intersect and match walls on a story, but later secondary match will look for missted matches and turn them to adiabaitc
|
1177
|
+
# intersect and sort
|
1172
1178
|
OpenStudio::Model.intersectSurfaces(story_spaces)
|
1173
1179
|
OpenStudio::Model.matchSurfaces(story_spaces)
|
1174
1180
|
runner.registerInfo("Intersecting and matching surfaces in story #{story.name}, this will create additional geometry.")
|
@@ -1193,6 +1199,75 @@ module OsLib_ModelGeneration
|
|
1193
1199
|
end
|
1194
1200
|
end
|
1195
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
|
+
# should also be only for a single bar
|
1209
|
+
story_bounding = {}
|
1210
|
+
missed_match_count = 0
|
1211
|
+
|
1212
|
+
# gather new spaces by story
|
1213
|
+
new_spaces.each do |space|
|
1214
|
+
story = space.buildingStory.get
|
1215
|
+
if story_bounding.has_key?(story)
|
1216
|
+
story_bounding[story][:spaces] << space
|
1217
|
+
else
|
1218
|
+
story_bounding[story] = {:spaces => [space]}
|
1219
|
+
end
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
# get bounding box for each story
|
1223
|
+
story_bounding.each do |story,v|
|
1224
|
+
|
1225
|
+
# get bounding_box
|
1226
|
+
bounding_box = OpenStudio::BoundingBox.new
|
1227
|
+
v[:spaces].each do |space|
|
1228
|
+
space.surfaces.each do |space_surface|
|
1229
|
+
bounding_box.addPoints(space.transformation * space_surface.vertices)
|
1230
|
+
end
|
1231
|
+
end
|
1232
|
+
min_x = bounding_box.minX.get
|
1233
|
+
min_y = bounding_box.minY.get
|
1234
|
+
max_x = bounding_box.maxX.get
|
1235
|
+
max_y = bounding_box.maxY.get
|
1236
|
+
ext_wall_toll = 0.01
|
1237
|
+
|
1238
|
+
# check surfaces again against min/max and change to adiabatic if not fully on one min or max x or y
|
1239
|
+
# todo - may need to look at aidiabiatc constructions in downstream measure. Some may be exterior party wall others may be interior walls
|
1240
|
+
v[:spaces].each do |space|
|
1241
|
+
space.surfaces.each do |space_surface|
|
1242
|
+
next if not space_surface.surfaceType == "Wall"
|
1243
|
+
next if space_surface.outsideBoundaryCondition == "Surface" # if if found a match leave it alone, don't change to adiabiatc
|
1244
|
+
surface_bounding_box = OpenStudio::BoundingBox.new
|
1245
|
+
surface_bounding_box.addPoints(space.transformation * space_surface.vertices)
|
1246
|
+
surface_on_outside = false
|
1247
|
+
# check xmin
|
1248
|
+
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
|
1249
|
+
# check xmax
|
1250
|
+
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
|
1251
|
+
# check ymin
|
1252
|
+
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
|
1253
|
+
# check ymax
|
1254
|
+
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
|
1255
|
+
|
1256
|
+
# change if not exterior
|
1257
|
+
if !surface_on_outside
|
1258
|
+
space_surface.setOutsideBoundaryCondition("Adiabatic")
|
1259
|
+
missed_match_count += 1
|
1260
|
+
end
|
1261
|
+
end
|
1262
|
+
end
|
1263
|
+
end
|
1264
|
+
|
1265
|
+
if missed_match_count > 0
|
1266
|
+
runner.registerInfo("#{missed_match_count} surfaces that were exterior appear to be interior walls and had boundary condition chagned to adiabiatic.")
|
1267
|
+
end
|
1268
|
+
|
1269
|
+
end
|
1270
|
+
|
1196
1271
|
# sort stories (by name for now but need better way)
|
1197
1272
|
sorted_stories = {}
|
1198
1273
|
new_spaces.each do |space|
|
@@ -1697,9 +1772,6 @@ module OsLib_ModelGeneration
|
|
1697
1772
|
end
|
1698
1773
|
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)
|
1699
1774
|
|
1700
|
-
positive_args = ['total_bldg_floor_area']
|
1701
|
-
positive = OsLib_HelperMethods.checkDoubleAndIntegerArguments(runner, user_arguments, 'min' => 0.0, 'max' => nil, 'min_eq_bool' => false, 'max_eq_bool' => false, 'arg_array' => positive_args)
|
1702
|
-
|
1703
1775
|
one_or_greater_args = ['num_stories_above_grade']
|
1704
1776
|
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)
|
1705
1777
|
|
@@ -1710,13 +1782,13 @@ module OsLib_ModelGeneration
|
|
1710
1782
|
'party_wall_stories_south',
|
1711
1783
|
'party_wall_stories_east',
|
1712
1784
|
'party_wall_stories_west',
|
1785
|
+
'total_bldg_floor_area',
|
1713
1786
|
'single_floor_area',
|
1714
1787
|
'bar_width']
|
1715
1788
|
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)
|
1716
1789
|
|
1717
1790
|
# return false if any errors fail
|
1718
1791
|
if !fraction then return false end
|
1719
|
-
if !positive then return false end
|
1720
1792
|
return false if !one_or_greater
|
1721
1793
|
return false if !non_neg
|
1722
1794
|
|
@@ -1815,10 +1887,6 @@ module OsLib_ModelGeneration
|
|
1815
1887
|
args = bar_arg_check_setup(model,runner,user_arguments,false) # false stops it from checking args on used in bar_from_building_type_ratios
|
1816
1888
|
if !args then return false end
|
1817
1889
|
|
1818
|
-
# identify primary building type for building form defaults
|
1819
|
-
primary_building_type = "PrimarySchool" # see what building type represents the most floro area
|
1820
|
-
building_form_defaults = building_form_defaults(primary_building_type)
|
1821
|
-
|
1822
1890
|
# process arg into hash
|
1823
1891
|
space_type_hash_name = {}
|
1824
1892
|
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 }
|
@@ -1866,6 +1934,11 @@ module OsLib_ModelGeneration
|
|
1866
1934
|
building_type_fraction_of_building += ratio
|
1867
1935
|
end
|
1868
1936
|
|
1937
|
+
# identify primary building type for building form defaults
|
1938
|
+
primary_building_type = building_type_hash.keys.first # update to choose building with highest ratio
|
1939
|
+
runner.registerInfo("Creating bar with space type ratio proided as argument.")
|
1940
|
+
runner.registerInfo("Using building type from first ratio #{primary_building_type} as the primary building type. This is used for building form defaults.")
|
1941
|
+
|
1869
1942
|
# todo - confirm if this will get normalized up/down later of if I should fix or stop here instead of just a warning
|
1870
1943
|
if building_type_fraction_of_building > 1.0
|
1871
1944
|
runner.registerWarning("Sum of Space Type Ratio of #{building_type_fraction_of_building} is greater than the expected value of 1.0")
|
@@ -1877,6 +1950,8 @@ module OsLib_ModelGeneration
|
|
1877
1950
|
|
1878
1951
|
# if aspect ratio, story height or wwr have argument value of 0 then use smart building type defaults
|
1879
1952
|
primary_building_type = args['bldg_type_a']
|
1953
|
+
runner.registerInfo("Creating bar space type ratios by building type based on ratios from prototype models.")
|
1954
|
+
runner.registerInfo("#{primary_building_type} will be used for building form defaults.")
|
1880
1955
|
|
1881
1956
|
end
|
1882
1957
|
|
@@ -2512,7 +2587,7 @@ module OsLib_ModelGeneration
|
|
2512
2587
|
runner.registerValue('ew_wall_area_ip', wall_ew_ip, 'ft^2')
|
2513
2588
|
# for now using perimeter of ground floor and average story area (building area / num_stories)
|
2514
2589
|
runner.registerValue('floor_area_to_perim_ratio', model.getBuilding.floorArea / (OsLib_Geometry.calculate_perimeter(model) * num_stories))
|
2515
|
-
runner.registerValue('
|
2590
|
+
runner.registerValue('bar_width_output', OpenStudio.convert(bars['primary'][:width], 'm', 'ft').get, 'ft')
|
2516
2591
|
|
2517
2592
|
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
|
2518
2593
|
runner.registerInfo('Target facade area by orientation not validated when party walls are applied')
|
@@ -2709,6 +2784,29 @@ module OsLib_ModelGeneration
|
|
2709
2784
|
return false
|
2710
2785
|
end
|
2711
2786
|
|
2787
|
+
# if haystack_file used find the file
|
2788
|
+
# 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
|
2789
|
+
if args['haystack_file']
|
2790
|
+
haystack_file = runner.workflow.findFile(args['haystack_file'])
|
2791
|
+
if haystack_file.is_initialized
|
2792
|
+
haystack_file = haystack_file.get.to_s
|
2793
|
+
|
2794
|
+
# load JSON file
|
2795
|
+
json = nil
|
2796
|
+
File.open(haystack_file, 'r') do |file|
|
2797
|
+
json = file.read
|
2798
|
+
# uncomment to inspect haystack json
|
2799
|
+
# puts json
|
2800
|
+
end
|
2801
|
+
|
2802
|
+
else
|
2803
|
+
runner.registerError("Did not find #{args['haystack_file']} in paths described in OSW file.")
|
2804
|
+
return false
|
2805
|
+
end
|
2806
|
+
else
|
2807
|
+
haystack_file = nil
|
2808
|
+
end
|
2809
|
+
|
2712
2810
|
# make sure daylight savings is turned on up prior to any sizing runs being done.
|
2713
2811
|
if args['enable_dst']
|
2714
2812
|
start_date = '2nd Sunday in March'
|
@@ -2934,9 +3032,9 @@ module OsLib_ModelGeneration
|
|
2934
3032
|
if args['htg_src'] == 'NaturalGas' || args['htg_src'] == 'DistrictHeating'
|
2935
3033
|
args['swh_src'] = 'NaturalGas' # If building has gas service, probably uses natural gas for SWH
|
2936
3034
|
elsif args['htg_src'] == 'Electricity'
|
2937
|
-
args['swh_src']
|
3035
|
+
args['swh_src'] = 'Electricity' # If building is doing space heating with electricity, probably used for SWH
|
2938
3036
|
elsif args['htg_src'] == 'DistrictAmbient'
|
2939
|
-
args['swh_src']
|
3037
|
+
args['swh_src'] = 'HeatPump' # If building has district ambient loop, it is fancy and probably uses HPs for SWH
|
2940
3038
|
else
|
2941
3039
|
args['swh_src'] = nil # Use inferences built into OpenStudio Standards for each building and space type
|
2942
3040
|
end
|
@@ -3092,12 +3190,20 @@ module OsLib_ModelGeneration
|
|
3092
3190
|
sys_type # same as primary system type
|
3093
3191
|
end
|
3094
3192
|
|
3095
|
-
#
|
3096
|
-
|
3193
|
+
# group zones
|
3194
|
+
if haystack_file.nil?
|
3195
|
+
# Group zones by story
|
3196
|
+
bldg_zone_lists = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3197
|
+
else
|
3198
|
+
# todo - group zones using haystack file instead of building stories
|
3199
|
+
# todo - need to do something similar to use haystack to indentify secondary zones
|
3200
|
+
bldg_zone_lists = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3201
|
+
runner.registerInfo("***This code will define which zones are on air loops for inferred system***")
|
3202
|
+
end
|
3097
3203
|
|
3098
3204
|
# On each story, add the primary system to the primary zones
|
3099
3205
|
# and add the secondary system to any zones that are different.
|
3100
|
-
|
3206
|
+
bldg_zone_lists.each do |story_group|
|
3101
3207
|
# Differentiate primary and secondary zones, based on
|
3102
3208
|
# operating hours and internal loads (same as 90.1 PRM)
|
3103
3209
|
pri_sec_zone_lists = standard.model_differentiate_primary_secondary_thermal_zones(model, story_group)
|
@@ -3137,12 +3243,21 @@ module OsLib_ModelGeneration
|
|
3137
3243
|
# Group the zones by occupancy type. Only split out non-dominant groups if their total area exceeds the limit.
|
3138
3244
|
sys_groups = standard.model_group_zones_by_type(model, OpenStudio.convert(20_000, 'ft^2', 'm^2').get)
|
3139
3245
|
sys_groups.each do |sys_group|
|
3140
|
-
|
3141
|
-
|
3246
|
+
|
3247
|
+
# group zones
|
3248
|
+
if haystack_file.nil?
|
3249
|
+
# Group zones by story
|
3250
|
+
bldg_zone_groups = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3251
|
+
else
|
3252
|
+
# todo - group zones using haystack file instead of building stories
|
3253
|
+
# todo - need to do something similar to use haystack to indentify secondary zones
|
3254
|
+
bldg_zone_groups = standard.model_group_zones_by_story(model, sys_group['zones'])
|
3255
|
+
runner.registerInfo("***This code will define which zones are on air loops for user specified system***")
|
3256
|
+
end
|
3142
3257
|
|
3143
3258
|
# Add the user specified HVAC system for each story.
|
3144
3259
|
# Single-zone systems will get one per zone.
|
3145
|
-
|
3260
|
+
bldg_zone_groups.each do |zones|
|
3146
3261
|
unless model.add_cbecs_hvac_system(standard, args['system_type'], zones)
|
3147
3262
|
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.")
|
3148
3263
|
return false
|
@@ -3157,8 +3272,17 @@ module OsLib_ModelGeneration
|
|
3157
3272
|
# Infer the current hours of operation schedule for the building
|
3158
3273
|
op_sch = standard.model_infer_hours_of_operation_building(model)
|
3159
3274
|
|
3275
|
+
# setup hoo_var_method (should be hours or fractional)
|
3276
|
+
if args.has_key?('hoo_var_method')
|
3277
|
+
hoo_var_method = args['hoo_var_method']
|
3278
|
+
else
|
3279
|
+
# support measures that don't supply this argument
|
3280
|
+
hoo_var_method = 'hours'
|
3281
|
+
end
|
3282
|
+
|
3160
3283
|
# Convert existing schedules in the model to parametric schedules based on current hours of operation
|
3161
|
-
|
3284
|
+
runner.registerInfo("Generating parametric schedules from ruleset schedules using #{hoo_var_method} variable method for hours of operation fromula.")
|
3285
|
+
standard.model_setup_parametric_schedules(model, hoo_var_method: hoo_var_method)
|
3162
3286
|
|
3163
3287
|
# Create start and end times from start time and duration supplied
|
3164
3288
|
wkdy_start_time = nil
|
@@ -3254,11 +3378,11 @@ module OsLib_ModelGeneration
|
|
3254
3378
|
|
3255
3379
|
# change night cycling control to "Thermostat" cycling and increase thermostat tolerance to 1.99999
|
3256
3380
|
manager_night_cycles = model.getAvailabilityManagerNightCycles
|
3257
|
-
|
3381
|
+
runner.registerInfo("Changing thermostat tollerance to 1.99999 for #{manager_night_cycles.size} night cycle manager objects.")
|
3382
|
+
|
3258
3383
|
manager_night_cycles.each do |night_cycle|
|
3259
3384
|
night_cycle.setThermostatTolerance(1.9999)
|
3260
3385
|
night_cycle.setCyclingRunTimeControlType("Thermostat")
|
3261
|
-
runner.registerInfo(" night_cycle == #{night_cycle}")
|
3262
3386
|
end
|
3263
3387
|
|
3264
3388
|
# 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
|
|
@@ -28,11 +28,11 @@ 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
38
|
spec.add_development_dependency 'openstudio-standards', '~> 0.2.13' # for os_lib unit tests
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katherine Fleming
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2021-
|
14
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bcl
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.7.
|
22
|
+
version: 0.7.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.7.
|
29
|
+
version: 0.7.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bundler
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,33 +56,33 @@ dependencies:
|
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 4.18.0
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
59
|
+
name: openstudio_measure_tester
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: 0.3.1
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
71
|
+
version: 0.3.1
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
73
|
+
name: openstudio-workflow
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
76
|
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: 2.3.0
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: 2.3.0
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: parallel
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,7 +233,7 @@ licenses: []
|
|
233
233
|
metadata:
|
234
234
|
bug_tracker_uri: https://github.com/NREL/openstudio-extension-gem/issues
|
235
235
|
changelog_uri: https://github.com/NREL/openstudio-extension-gem/blob/develop/CHANGELOG.md
|
236
|
-
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.1
|
237
237
|
post_install_message:
|
238
238
|
rdoc_options: []
|
239
239
|
require_paths:
|