openstudio-analysis 1.0.1 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +2 -3
- data/CHANGELOG.md +25 -0
- data/Gemfile +1 -5
- data/LICENSE.md +1 -1
- data/Rakefile +1 -1
- data/lib/openstudio-analysis.rb +2 -1
- data/lib/openstudio/analysis.rb +23 -27
- data/lib/openstudio/analysis/algorithm_attributes.rb +1 -1
- data/lib/openstudio/analysis/formulation.rb +1 -1
- data/lib/openstudio/analysis/server_api.rb +8 -14
- data/lib/openstudio/analysis/support_files.rb +1 -1
- data/lib/openstudio/analysis/translator/datapoints.rb +24 -38
- data/lib/openstudio/analysis/translator/excel.rb +2 -2
- data/lib/openstudio/analysis/translator/workflow.rb +10 -13
- data/lib/openstudio/analysis/version.rb +2 -2
- data/lib/openstudio/analysis/workflow.rb +9 -18
- data/lib/openstudio/analysis/workflow_step.rb +67 -78
- data/lib/openstudio/helpers/hash.rb +1 -1
- data/lib/openstudio/helpers/string.rb +1 -1
- data/{spec/openstudio/server_api_spec.rb → lib/openstudio/helpers/utils.rb} +26 -28
- data/lib/openstudio/weather/epw.rb +1 -1
- data/openstudio-analysis.gemspec +17 -14
- data/update_license.rb +3 -3
- metadata +57 -194
- data/spec/files/0_1_09_no_variables.xlsx +0 -0
- data/spec/files/0_1_09_outputvars.xlsx +0 -0
- data/spec/files/0_1_09_setup_version_2.xlsx +0 -0
- data/spec/files/0_1_09_small_list.xlsx +0 -0
- data/spec/files/0_1_09_small_list_incomplete.xlsx +0 -0
- data/spec/files/0_1_09_small_list_repeat_vars.xlsx +0 -0
- data/spec/files/0_1_09_small_list_validation_errors.xlsx +0 -0
- data/spec/files/0_1_10_proxy.xlsx +0 -0
- data/spec/files/0_1_10_proxy_user.xlsx +0 -0
- data/spec/files/0_1_10_template_input.xlsx +0 -0
- data/spec/files/0_1_11_discrete_variables.xlsx +0 -0
- data/spec/files/0_1_12_discrete_dynamic_columns.xlsx +0 -0
- data/spec/files/0_2_0_template.xlsx +0 -0
- data/spec/files/0_2_0_template_simpletest.xlsx +0 -0
- data/spec/files/0_3_0_dynamic_uuids.xlsx +0 -0
- data/spec/files/0_3_0_measure_existence.xlsx +0 -0
- data/spec/files/0_3_0_outputs.xlsx +0 -0
- data/spec/files/0_3_3_short_names.xlsx +0 -0
- data/spec/files/0_3_5_multiple_measure_paths.xlsx +0 -0
- data/spec/files/0_3_7_unique_measure_names.xlsx +0 -0
- data/spec/files/0_3_7_worker_init_final.xlsx +0 -0
- data/spec/files/0_4_0_lhs_discrete_continuous.xlsx +0 -0
- data/spec/files/0_4_0_multiple_seeds.xlsx +0 -0
- data/spec/files/0_4_0_pivot_test.xlsx +0 -0
- data/spec/files/analysis/examples/discrete_lhs_example.json +0 -809
- data/spec/files/analysis/examples/medium_office_example.json +0 -1674
- data/spec/files/analysis/examples/medium_office_workflow.json +0 -1298
- data/spec/files/measures/ActualMeasureNoJson/measure.rb +0 -80
- data/spec/files/measures/ActualMeasureNoJson/measure.xml +0 -2
- data/spec/files/measures/ExampleMeasure/measure.json +0 -3
- data/spec/files/measures/ExampleMeasure/measure.rb +0 -5
- data/spec/files/measures/ExampleMeasure/measure.xml +0 -1
- data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.json +0 -36
- data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.rb +0 -22
- data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.xml +0 -5
- data/spec/files/measures/NoMeasureRbFile/.gitkeep +0 -0
- data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.json +0 -3
- data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.rb +0 -5
- data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.xml +0 -1
- data/spec/files/measures/SetThermostatSchedules/measure.json +0 -63
- data/spec/files/measures/SetThermostatSchedules/measure.rb +0 -254
- data/spec/files/measures/SetThermostatSchedules/measure.xml +0 -2
- data/spec/files/measures/example_measure_auto_directory_name/measure.json +0 -3
- data/spec/files/measures/example_measure_auto_directory_name/measure.rb +0 -5
- data/spec/files/measures/example_measure_auto_directory_name/measure.xml +0 -1
- data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.json +0 -3
- data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.rb +0 -5
- data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.xml +0 -1
- data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.rb +0 -5
- data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.xml +0 -1
- data/spec/files/measures/rotate_building/measure.rb +0 -5
- data/spec/files/measures/rotate_building/measure.xml +0 -1
- data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.rb +0 -5
- data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.xml +0 -1
- data/spec/files/measures_second_path/measure_in_another_dir/measure.json +0 -3
- data/spec/files/measures_second_path/measure_in_another_dir/measure.rb +0 -5
- data/spec/files/measures_second_path/measure_in_another_dir/measure.xml +0 -1
- data/spec/files/partial_weather.epw +0 -32
- data/spec/files/partial_weather_2.epw +0 -32
- data/spec/files/small_seed.osm +0 -4622
- data/spec/files/worker_init/first_file.rb +0 -15
- data/spec/files/worker_init/second_file.sh +0 -4
- data/spec/files/workflow/analysis.osa +0 -1334
- data/spec/files/workflow/datapoint_0.osd +0 -65
- data/spec/files/workflow/datapoint_1.osd +0 -65
- data/spec/files/workflow/datapoint_2.osd +0 -65
- data/spec/files/workflow/datapoint_wrong_osa_id.osd +0 -65
- data/spec/integration/server_api_spec.rb +0 -83
- data/spec/openstudio/excel_spec.rb +0 -606
- data/spec/openstudio/formulation_spec.rb +0 -200
- data/spec/openstudio/hash_spec.rb +0 -56
- data/spec/openstudio/osw_spec.rb +0 -129
- data/spec/openstudio/string_spec.rb +0 -34
- data/spec/openstudio/support_files_spec.rb +0 -89
- data/spec/openstudio/weather_spec.rb +0 -80
- data/spec/openstudio/workflow_spec.rb +0 -126
- data/spec/openstudio/workflow_step_spec.rb +0 -158
- data/spec/schema/osa.json +0 -613
- data/spec/schema/osa.png +0 -0
- data/spec/schema/osd.json +0 -110
- data/spec/schema/osd.png +0 -0
- data/spec/spec_helper.rb +0 -56
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f09590a10cf6967fb9842c05d8c38ad2be1b3dd534b0f251a9a1e239634fedd
|
|
4
|
+
data.tar.gz: 679f353d4f85adcbd51dc9df8b2e61edd4250126a7ae49fab72058f1840e18e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39da086f21c02da1bcf3f00c371bb76f703ece1a8c3d2d1895f4585c0ac1d3ba8801858dbdeb69d922a067a733fbfe200375163b3e87917a4651a4a4f1969e3e
|
|
7
|
+
data.tar.gz: e834f1873b13b933444d2dfaade3dfc62b7b177063fb9dbf69b06a2e133603123b2cbf8e28707d61748065fa12634cb72ab715b54004fdae482857a60b43a4b4
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
OpenStudio Analysis Gem Change Log
|
|
2
2
|
==================================
|
|
3
3
|
|
|
4
|
+
Version 1.0.6
|
|
5
|
+
-------------
|
|
6
|
+
* Always include ../lib to the file paths to search
|
|
7
|
+
|
|
8
|
+
Version 1.0.5
|
|
9
|
+
-------------
|
|
10
|
+
* Upgrade to latest BCL (0.6.1)
|
|
11
|
+
* Remove the need for the measure.json (which has been deprecated in BCL gem). Now parses the measure.xml.
|
|
12
|
+
* Upgrade Faraday (1.0.1)
|
|
13
|
+
* Remove dependency on Nokogiri.
|
|
14
|
+
|
|
15
|
+
Version 1.0.4
|
|
16
|
+
-------------
|
|
17
|
+
* Update dependency Nokogiri
|
|
18
|
+
|
|
19
|
+
Version 1.0.3
|
|
20
|
+
-------------
|
|
21
|
+
* Update dependencies roo and rubyzip
|
|
22
|
+
|
|
23
|
+
Version 1.0.2
|
|
24
|
+
-------------
|
|
25
|
+
* Updates required for OpenStudio 3x
|
|
26
|
+
* Require Ruby ~> 2.5.1
|
|
27
|
+
* Update to Nokogiri ~> 1.8.2 (required for Ruby 2.5 on Windows)
|
|
28
|
+
|
|
4
29
|
Version 1.0.1
|
|
5
30
|
-------------
|
|
6
31
|
* Add support for Ruby 2.5.1 (keeping support for 2.2)
|
data/Gemfile
CHANGED
|
@@ -3,8 +3,7 @@ source 'http://rubygems.org'
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
5
|
gem 'colored', '~> 1.2'
|
|
6
|
-
gem '
|
|
7
|
-
gem 'openstudio-aws', '0.4.2'
|
|
6
|
+
gem 'openstudio-aws', '~> 0.4.2'
|
|
8
7
|
|
|
9
8
|
group :test do
|
|
10
9
|
# Don't install coveralls on window because requires devkit for json
|
|
@@ -12,7 +11,4 @@ group :test do
|
|
|
12
11
|
gem 'coveralls', require: false
|
|
13
12
|
end
|
|
14
13
|
gem 'ci_reporter_rspec'
|
|
15
|
-
gem 'rspec', '~> 3.4'
|
|
16
|
-
gem 'rubocop'
|
|
17
|
-
gem 'rubocop-checkstyle_formatter'
|
|
18
14
|
end
|
data/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
OpenStudio(R), Copyright (c) 2008-
|
|
1
|
+
OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC. All rights reserved.
|
|
2
2
|
|
|
3
3
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
|
4
4
|
that the following conditions are met:
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
data/lib/openstudio-analysis.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -70,6 +70,7 @@ require 'openstudio/analysis/translator/workflow'
|
|
|
70
70
|
# helpers / core_ext
|
|
71
71
|
require 'openstudio/helpers/string'
|
|
72
72
|
require 'openstudio/helpers/hash'
|
|
73
|
+
require 'openstudio/helpers/utils'
|
|
73
74
|
|
|
74
75
|
# weather file parsing
|
|
75
76
|
require 'openstudio/weather/epw'
|
data/lib/openstudio/analysis.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -130,35 +130,31 @@ module OpenStudio
|
|
|
130
130
|
new_wfi[:description] = wf[:description] if wf[:description]
|
|
131
131
|
new_wfi[:arguments] = []
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
wfi_arg[:units] = '' # should be haystack compatible unit strings
|
|
133
|
+
wf[:arguments]&.each do |arg|
|
|
134
|
+
wfi_arg = {}
|
|
135
|
+
wfi_arg[:display_name] = arg[:display_name] if arg[:display_name]
|
|
136
|
+
wfi_arg[:display_name_short] = arg[:display_name_short] if arg[:display_name_short]
|
|
137
|
+
wfi_arg[:name] = arg[:name] if arg[:name]
|
|
138
|
+
wfi_arg[:data_type] = arg[:value_type] if arg[:value_type]
|
|
139
|
+
wfi_arg[:default_value] = nil
|
|
140
|
+
wfi_arg[:description] = ''
|
|
141
|
+
wfi_arg[:display_units] = '' # should be haystack compatible unit strings
|
|
142
|
+
wfi_arg[:units] = '' # should be haystack compatible unit strings
|
|
144
143
|
|
|
145
|
-
|
|
146
|
-
end
|
|
144
|
+
new_wfi[:arguments] << wfi_arg
|
|
147
145
|
end
|
|
148
146
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
new_wfi[:arguments] << wfi_var
|
|
161
|
-
end
|
|
147
|
+
wf[:variables]&.each do |arg|
|
|
148
|
+
wfi_var = {}
|
|
149
|
+
wfi_var[:display_name] = arg[:argument][:display_name] if arg[:argument][:display_name]
|
|
150
|
+
wfi_var[:display_name_short] = arg[:argument][:display_name_short] if arg[:argument][:display_name_short]
|
|
151
|
+
wfi_var[:name] = arg[:argument][:name] if arg[:argument][:name]
|
|
152
|
+
wfi_var[:default_value] = nil
|
|
153
|
+
wfi_var[:data_type] = arg[:argument][:value_type] if arg[:argument][:value_type]
|
|
154
|
+
wfi_var[:description] = ''
|
|
155
|
+
wfi_var[:display_units] = arg[:units] if arg[:units]
|
|
156
|
+
wfi_var[:units] = '' # should be haystack compatible unit strings
|
|
157
|
+
new_wfi[:arguments] << wfi_var
|
|
162
158
|
end
|
|
163
159
|
|
|
164
160
|
measure_metadata << new_wfi
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -152,10 +152,8 @@ module OpenStudio
|
|
|
152
152
|
response = @conn.get "/projects/#{project_id}.json"
|
|
153
153
|
if response.status == 200
|
|
154
154
|
analyses = JSON.parse(response.body, symbolize_names: true, max_nesting: false)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
analysis_ids << analysis[:_id]
|
|
158
|
-
end
|
|
155
|
+
analyses[:analyses]&.each do |analysis|
|
|
156
|
+
analysis_ids << analysis[:_id]
|
|
159
157
|
end
|
|
160
158
|
end
|
|
161
159
|
|
|
@@ -467,16 +465,12 @@ module OpenStudio
|
|
|
467
465
|
|
|
468
466
|
formulation_json[:analysis][:problem][:workflow].each do |wf|
|
|
469
467
|
wf[:uuid] = SecureRandom.uuid
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
arg[:uuid] = SecureRandom.uuid
|
|
473
|
-
end
|
|
468
|
+
wf[:arguments]&.each do |arg|
|
|
469
|
+
arg[:uuid] = SecureRandom.uuid
|
|
474
470
|
end
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
var[:argument][:uuid] = SecureRandom.uuid if var[:argument]
|
|
479
|
-
end
|
|
471
|
+
wf[:variables]&.each do |var|
|
|
472
|
+
var[:uuid] = SecureRandom.uuid
|
|
473
|
+
var[:argument][:uuid] = SecureRandom.uuid if var[:argument]
|
|
480
474
|
end
|
|
481
475
|
end
|
|
482
476
|
else
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -58,7 +58,7 @@ module OpenStudio
|
|
|
58
58
|
attr_accessor :name
|
|
59
59
|
attr_reader :analysis_name
|
|
60
60
|
|
|
61
|
-
require '
|
|
61
|
+
require 'rexml/document'
|
|
62
62
|
|
|
63
63
|
# Pass in the filename to read
|
|
64
64
|
def initialize(csv_filename)
|
|
@@ -368,16 +368,16 @@ module OpenStudio
|
|
|
368
368
|
data = []
|
|
369
369
|
measures.each_with_index do |measure, measure_index|
|
|
370
370
|
data[measure_index] = {}
|
|
371
|
-
|
|
371
|
+
measure_parsed = find_measure(measure.to_s)
|
|
372
372
|
|
|
373
|
-
raise "Could not find measure #{measure} xml in measure_paths: '#{@measure_paths.join("\n")}'" unless
|
|
373
|
+
raise "Could not find measure #{measure} xml in measure_paths: '#{@measure_paths.join("\n")}'" unless measure_parsed
|
|
374
374
|
measure_data = {}
|
|
375
|
-
measure_data[:classname] =
|
|
376
|
-
measure_data[:name] =
|
|
377
|
-
measure_data[:display_name] =
|
|
378
|
-
measure_data[:measure_type] = measure_type
|
|
379
|
-
measure_data[:uid] =
|
|
380
|
-
measure_data[:version_id] =
|
|
375
|
+
measure_data[:classname] = measure_parsed[:classname]
|
|
376
|
+
measure_data[:name] = measure_parsed[:name]
|
|
377
|
+
measure_data[:display_name] = measure_parsed[:display_name]
|
|
378
|
+
measure_data[:measure_type] = measure_parsed[:measure_type]
|
|
379
|
+
measure_data[:uid] = measure_parsed[:uid]
|
|
380
|
+
measure_data[:version_id] = measure_parsed[:version_id]
|
|
381
381
|
data[measure_index][:measure_data] = measure_data
|
|
382
382
|
data[measure_index][:vars] = []
|
|
383
383
|
vars = measure_map[measure]
|
|
@@ -389,8 +389,8 @@ module OpenStudio
|
|
|
389
389
|
next if var.to_s == 'None'
|
|
390
390
|
var_hash = {}
|
|
391
391
|
found_arg = nil
|
|
392
|
-
|
|
393
|
-
if var.to_s == '__SKIP__' || arg
|
|
392
|
+
measure_parsed[:arguments].each do |arg|
|
|
393
|
+
if var.to_s == '__SKIP__' || arg[:name] == var.to_s
|
|
394
394
|
found_arg = arg
|
|
395
395
|
break
|
|
396
396
|
end
|
|
@@ -404,8 +404,8 @@ module OpenStudio
|
|
|
404
404
|
var_type = 'boolean'
|
|
405
405
|
var_units = ''
|
|
406
406
|
else
|
|
407
|
-
var_type = found_arg.
|
|
408
|
-
var_units = found_arg
|
|
407
|
+
var_type = found_arg[:variable_type].downcase
|
|
408
|
+
var_units = found_arg[:units]
|
|
409
409
|
end
|
|
410
410
|
|
|
411
411
|
var_hash[:name] = var.to_s
|
|
@@ -437,7 +437,8 @@ module OpenStudio
|
|
|
437
437
|
var_hash[:distribution][:type] = 'discrete'
|
|
438
438
|
var_hash[:distribution][:units] = var_hash[:units]
|
|
439
439
|
if var_hash[:type] == 'choice'
|
|
440
|
-
var_hash[:distribution][:enumerations] = found_arg.xpath('choices/choice').map { |s| s.xpath('value').text }
|
|
440
|
+
# var_hash[:distribution][:enumerations] = found_arg.xpath('choices/choice').map { |s| s.xpath('value').text }
|
|
441
|
+
# This would need to be updated if we want to do this again... sorry.
|
|
441
442
|
elsif var_hash[:type] == 'bool'
|
|
442
443
|
var_hash[:distribution][:enumerations] = []
|
|
443
444
|
var_hash[:distribution][:enumerations] << true
|
|
@@ -447,13 +448,13 @@ module OpenStudio
|
|
|
447
448
|
end
|
|
448
449
|
data[measure_index][:args] = []
|
|
449
450
|
|
|
450
|
-
|
|
451
|
+
measure_parsed[:arguments].each do |arg_xml|
|
|
451
452
|
arg = {}
|
|
452
|
-
arg[:value_type] = arg_xml
|
|
453
|
-
arg[:name] = arg_xml
|
|
454
|
-
arg[:display_name] = arg_xml
|
|
453
|
+
arg[:value_type] = arg_xml[:variable_type]
|
|
454
|
+
arg[:name] = arg_xml[:name]
|
|
455
|
+
arg[:display_name] = arg_xml[:display_name].downcase
|
|
455
456
|
arg[:display_name_short] = arg[:display_name]
|
|
456
|
-
arg[:default_value] = arg_xml
|
|
457
|
+
arg[:default_value] = arg_xml[:default_value].downcase
|
|
457
458
|
arg[:value] = arg[:default_value]
|
|
458
459
|
data[measure_index][:args] << arg
|
|
459
460
|
end
|
|
@@ -470,27 +471,12 @@ module OpenStudio
|
|
|
470
471
|
measure_xml = File.join(mp, measure_name, 'measure.xml')
|
|
471
472
|
measure_rb = File.join(mp, measure_name, 'measure.rb')
|
|
472
473
|
if File.exist?(measure_xml) && File.exist?(measure_rb)
|
|
473
|
-
|
|
474
|
+
measure_parsed = parse_measure_xml(measure_xml)
|
|
475
|
+
return measure_parsed
|
|
474
476
|
end
|
|
475
477
|
end
|
|
476
478
|
|
|
477
|
-
return nil
|
|
478
|
-
end
|
|
479
|
-
|
|
480
|
-
def parse_measure_type(measure_filename)
|
|
481
|
-
measure_string = File.read(measure_filename)
|
|
482
|
-
|
|
483
|
-
if measure_string =~ /OpenStudio::Ruleset::WorkspaceUserScript/
|
|
484
|
-
return 'EnergyPlusMeasure'
|
|
485
|
-
elsif measure_string =~ /OpenStudio::Ruleset::ModelUserScript/
|
|
486
|
-
return 'RubyMeasure'
|
|
487
|
-
elsif measure_string =~ /OpenStudio::Ruleset::ReportingUserScript/
|
|
488
|
-
return 'ReportingMeasure'
|
|
489
|
-
elsif measure_string =~ /OpenStudio::Ruleset::UtilityUserScript/
|
|
490
|
-
return 'UtilityUserScript'
|
|
491
|
-
else
|
|
492
|
-
raise "measure type is unknown with an inherited class in #{measure_filename}"
|
|
493
|
-
end
|
|
479
|
+
return nil
|
|
494
480
|
end
|
|
495
481
|
end
|
|
496
482
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -536,7 +536,7 @@ module OpenStudio
|
|
|
536
536
|
tmp_m_name = SecureRandom.uuid
|
|
537
537
|
end
|
|
538
538
|
# Only add models if the row is flagged
|
|
539
|
-
if row[0]
|
|
539
|
+
if row[0]&.casecmp('model')&.zero?
|
|
540
540
|
model_path = row[3]
|
|
541
541
|
unless (Pathname.new model_path).absolute?
|
|
542
542
|
model_path = File.expand_path(File.join(@root_path, model_path))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -65,6 +65,7 @@ module OpenStudio
|
|
|
65
65
|
@osw_version = '0.0.1'
|
|
66
66
|
@options = options
|
|
67
67
|
@file_paths = options[:file_paths] ? options[:file_paths] : []
|
|
68
|
+
@file_paths << '../lib'
|
|
68
69
|
@measure_paths = options[:measure_paths] ? options[:measure_paths] : []
|
|
69
70
|
|
|
70
71
|
# Initialize static inputs from the OSA
|
|
@@ -80,11 +81,9 @@ module OpenStudio
|
|
|
80
81
|
step_hash[:measure_dir_name] = File.basename(step[:measure_definition_directory])
|
|
81
82
|
step_hash[:arguments] = {}
|
|
82
83
|
# Measures can have no arguments -- make sure to catch it
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
step_hash[:arguments][arg[:name].to_sym] = arg[:value]
|
|
87
|
-
end
|
|
84
|
+
@osa[:problem][:workflow][i][:arguments]&.each do |arg|
|
|
85
|
+
next if arg[:value].nil?
|
|
86
|
+
step_hash[:arguments][arg[:name].to_sym] = arg[:value]
|
|
88
87
|
end
|
|
89
88
|
step_hash[:name] = step[:name] if step[:name]
|
|
90
89
|
step_hash[:description] = step[:description] if step[:description]
|
|
@@ -98,7 +97,7 @@ module OpenStudio
|
|
|
98
97
|
step_hash[:modeler_description] = step[:modeler_description] if step[:modeler_description]
|
|
99
98
|
step_hash[:taxonomy] = step[:taxonomy] if step[:taxonomy]
|
|
100
99
|
step_hash[:measure_type] = step[:measure_type]
|
|
101
|
-
step_hash[:measure_type] = 'ModelMeasure'
|
|
100
|
+
step_hash[:measure_type] = 'ModelMeasure'
|
|
102
101
|
@steps << step_hash
|
|
103
102
|
end
|
|
104
103
|
end
|
|
@@ -160,12 +159,10 @@ module OpenStudio
|
|
|
160
159
|
def process_datapoints(osd_filename_array)
|
|
161
160
|
r = []
|
|
162
161
|
osd_filename_array.each do |osd_file|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
puts "Warning: Failed to process datapoint #{osd_file} with error #{e.message} in #{e.backtrace.join('\n')}"
|
|
168
|
-
end
|
|
162
|
+
r << process_datapoint(osd_file)
|
|
163
|
+
rescue StandardError => e
|
|
164
|
+
r << nil
|
|
165
|
+
puts "Warning: Failed to process datapoint #{osd_file} with error #{e.message} in #{e.backtrace.join('\n')}"
|
|
169
166
|
end
|
|
170
167
|
|
|
171
168
|
r
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
|
|
36
36
|
module OpenStudio
|
|
37
37
|
module Analysis
|
|
38
|
-
VERSION = '1.0.
|
|
38
|
+
VERSION = '1.0.6'.freeze
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -53,8 +53,7 @@ module OpenStudio
|
|
|
53
53
|
@items.clear
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
# Add a measure to the workflow from a path.
|
|
57
|
-
# if not, the BCL gem is used to create the measure.json file.
|
|
56
|
+
# Add a measure to the workflow from a path. This will parse the measure.xml which must exist.
|
|
58
57
|
#
|
|
59
58
|
# @params instance_name [String] The name of the instance. This allows for multiple measures to be added to the workflow with uni que names
|
|
60
59
|
# @params instance_display_name [String] The display name of the instance. This allows for multiple measures to be added to the workflow with unique names
|
|
@@ -69,19 +68,11 @@ module OpenStudio
|
|
|
69
68
|
end
|
|
70
69
|
|
|
71
70
|
if Dir.exist?(local_path_to_measure) && File.directory?(local_path_to_measure)
|
|
72
|
-
# Watch out for namespace conflicts (use ::BCL)
|
|
73
|
-
b = ::BCL::ComponentMethods.new
|
|
74
71
|
measure_hash = nil
|
|
75
|
-
|
|
76
|
-
measure_hash =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
if measure_hash.nil? && File.exist?(File.join(local_path_to_measure, 'measure.json'))
|
|
82
|
-
measure_hash = JSON.parse(File.read(File.join(local_path_to_measure, 'measure.json')), symbolize_names: true)
|
|
83
|
-
elsif measure_hash.nil?
|
|
84
|
-
raise 'measure.json was not found and was not automatically created'
|
|
72
|
+
if File.exist?(File.join(local_path_to_measure, 'measure.xml'))
|
|
73
|
+
measure_hash = parse_measure_xml(File.join(local_path_to_measure, 'measure.xml'))
|
|
74
|
+
else
|
|
75
|
+
raise 'Could not find measure.xml'
|
|
85
76
|
end
|
|
86
77
|
|
|
87
78
|
add_measure(instance_name, instance_display_name, local_path_to_measure, measure_hash)
|
|
@@ -92,12 +83,12 @@ module OpenStudio
|
|
|
92
83
|
@items.last
|
|
93
84
|
end
|
|
94
85
|
|
|
95
|
-
# Add a measure from the custom hash format without reading the measure.rb or measure.
|
|
86
|
+
# Add a measure from the custom hash format without reading the measure.rb or measure.xml file
|
|
96
87
|
#
|
|
97
88
|
# @params instance_name [String] The name of the instance. This allows for multiple measures to be added to the workflow with unique names
|
|
98
89
|
# @params instance_display_name [String] The display name of the instance. This allows for multiple measures to be added to the workflow with unique names
|
|
99
90
|
# @param local_path_to_measure [String] This is the local path to the measure directory, relative or absolute. It is used when zipping up all the measures.
|
|
100
|
-
# @param measure_metadata [Hash] Format of the measure.
|
|
91
|
+
# @param measure_metadata [Hash] Format of the measure.xml in JSON format
|
|
101
92
|
# @return [Object] Returns the measure that was added as an OpenStudio::AnalysisWorkflowStep object
|
|
102
93
|
def add_measure(instance_name, instance_display_name, local_path_to_measure, measure_metadata)
|
|
103
94
|
@items << OpenStudio::Analysis::WorkflowStep.from_measure_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)
|
|
@@ -110,7 +101,7 @@ module OpenStudio
|
|
|
110
101
|
# @params instance_name [String] The name of the instance. This allows for multiple measures to be added to the workflow with unique names
|
|
111
102
|
# @params instance_display_name [String] The display name of the instance. This allows for multiple measures to be added to the workflow with unique names
|
|
112
103
|
# @param local_path_to_measure [String] This is the local path to the measure directory, relative or absolute. It is used when zipping up all the measures.
|
|
113
|
-
# @param measure_metadata [Hash] Format of the measure.
|
|
104
|
+
# @param measure_metadata [Hash] Format of the measure.xml in JSON format
|
|
114
105
|
# @return [Object] Returns the measure that was added as an OpenStudio::AnalysisWorkflowStep object
|
|
115
106
|
def add_measure_from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)
|
|
116
107
|
@items << OpenStudio::Analysis::WorkflowStep.from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)
|