openstudio-analysis 1.0.0.rc19 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +20 -0
- data/.rubocop.yml +2 -133
- data/.travis.yml +2 -2
- data/CHANGELOG.md +26 -32
- data/Gemfile +5 -6
- data/LICENSE.md +28 -0
- data/README.md +16 -8
- data/Rakefile +38 -3
- data/lib/openstudio-analysis.rb +35 -0
- data/lib/openstudio/analysis.rb +57 -26
- data/lib/openstudio/analysis/algorithm_attributes.rb +36 -1
- data/lib/openstudio/analysis/formulation.rb +41 -6
- data/lib/openstudio/analysis/server_api.rb +53 -36
- data/lib/openstudio/analysis/support_files.rb +40 -0
- data/lib/openstudio/analysis/translator/datapoints.rb +39 -4
- data/lib/openstudio/analysis/translator/excel.rb +43 -8
- data/lib/openstudio/analysis/translator/workflow.rb +54 -14
- data/lib/openstudio/analysis/version.rb +36 -1
- data/lib/openstudio/analysis/workflow.rb +37 -2
- data/lib/openstudio/analysis/workflow_step.rb +97 -70
- data/lib/openstudio/helpers/hash.rb +35 -0
- data/lib/openstudio/helpers/string.rb +36 -2
- data/lib/openstudio/weather/epw.rb +32 -17
- data/openstudio-analysis.gemspec +21 -18
- data/update_license.rb +120 -0
- metadata +62 -200
- data/LGPL-2.1.txt +0 -502
- data/LICENSE.txt +0 -65
- data/rubocop-todo.yml +0 -246
- 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 -1673
- 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.rb +0 -15
- 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 -48
- data/spec/openstudio/excel_spec.rb +0 -571
- data/spec/openstudio/formulation_spec.rb +0 -157
- data/spec/openstudio/hash_spec.rb +0 -21
- data/spec/openstudio/osw_spec.rb +0 -94
- data/spec/openstudio/server_api_spec.rb +0 -25
- data/spec/openstudio/string_spec.rb +0 -0
- data/spec/openstudio/support_files_spec.rb +0 -54
- data/spec/openstudio/weather_spec.rb +0 -45
- data/spec/openstudio/workflow_spec.rb +0 -91
- data/spec/openstudio/workflow_step_spec.rb +0 -118
- 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 -19
@@ -1,3 +1,38 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
1
36
|
module OpenStudio
|
2
37
|
module Analysis
|
3
38
|
module Translator
|
@@ -46,7 +81,7 @@ module OpenStudio
|
|
46
81
|
@name = nil
|
47
82
|
@analysis_name = nil
|
48
83
|
@settings = {}
|
49
|
-
@weather_files = []
|
84
|
+
@weather_files = []
|
50
85
|
@weather_paths = []
|
51
86
|
@models = []
|
52
87
|
@other_files = []
|
@@ -210,7 +245,7 @@ module OpenStudio
|
|
210
245
|
# @append_model_name [Boolean] Append the name of the seed model to the display name
|
211
246
|
# @return [Object] An OpenStudio::Analysis
|
212
247
|
def analysis(seed_model = nil, append_model_name = false)
|
213
|
-
raise 'There are no seed models defined in the excel file. Please add one.' if @models.
|
248
|
+
raise 'There are no seed models defined in the excel file. Please add one.' if @models.empty?
|
214
249
|
raise "There are more than one seed models defined in the excel file. Call 'analyses' to return the array" if @models.size > 1 && seed_model.nil?
|
215
250
|
|
216
251
|
seed_model = @models.first if seed_model.nil?
|
@@ -426,7 +461,7 @@ module OpenStudio
|
|
426
461
|
|
427
462
|
if b_settings
|
428
463
|
@version = row[1].chomp if row[0] == 'Spreadsheet Version'
|
429
|
-
@settings[
|
464
|
+
@settings[row[0].to_underscore.to_s] = row[1] if row[0]
|
430
465
|
if @settings['cluster_name']
|
431
466
|
@settings['cluster_name'] = @settings['cluster_name'].to_underscore
|
432
467
|
end
|
@@ -463,7 +498,7 @@ module OpenStudio
|
|
463
498
|
@measure_paths << File.expand_path(File.join(@root_path, tmp_filepath))
|
464
499
|
end
|
465
500
|
end
|
466
|
-
@run_setup[
|
501
|
+
@run_setup[row[0].to_underscore.to_s] = row[1] if row[0]
|
467
502
|
|
468
503
|
# type cast
|
469
504
|
if @run_setup['allow_multiple_jobs']
|
@@ -476,14 +511,14 @@ module OpenStudio
|
|
476
511
|
if row[0]
|
477
512
|
v = row[1]
|
478
513
|
v.to_i if v % 1 == 0
|
479
|
-
@problem[
|
514
|
+
@problem[row[0].to_underscore.to_s] = v
|
480
515
|
end
|
481
516
|
|
482
517
|
elsif b_algorithm_setup
|
483
518
|
if row[0] && !row[0].empty?
|
484
519
|
v = row[1]
|
485
520
|
v = v.to_i if v % 1 == 0
|
486
|
-
@algorithm[
|
521
|
+
@algorithm[row[0].to_underscore.to_s] = v
|
487
522
|
end
|
488
523
|
elsif b_weather_files
|
489
524
|
if row[0] == 'Weather File'
|
@@ -501,7 +536,7 @@ module OpenStudio
|
|
501
536
|
tmp_m_name = SecureRandom.uuid
|
502
537
|
end
|
503
538
|
# Only add models if the row is flagged
|
504
|
-
if row[0]
|
539
|
+
if row[0]&.casecmp('model')&.zero?
|
505
540
|
model_path = row[3]
|
506
541
|
unless (Pathname.new model_path).absolute?
|
507
542
|
model_path = File.expand_path(File.join(@root_path, model_path))
|
@@ -688,7 +723,7 @@ module OpenStudio
|
|
688
723
|
relation_to_eui: /typical\svar\sto\seui\srelationship/i,
|
689
724
|
clean: true)
|
690
725
|
end
|
691
|
-
rescue => e
|
726
|
+
rescue StandardError => e
|
692
727
|
raise "Unable to parse spreadsheet #{@xls_filename} with version #{@version} due to error: #{e.message}"
|
693
728
|
end
|
694
729
|
|
@@ -1,3 +1,38 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
1
36
|
module OpenStudio
|
2
37
|
module Analysis
|
3
38
|
module Translator
|
@@ -33,11 +68,11 @@ module OpenStudio
|
|
33
68
|
@measure_paths = options[:measure_paths] ? options[:measure_paths] : []
|
34
69
|
|
35
70
|
# Initialize static inputs from the OSA
|
36
|
-
@seed_file = File.basename
|
71
|
+
@seed_file = File.basename(@osa[:seed][:path])
|
37
72
|
if @options[:seed]
|
38
73
|
@seed_file = @options[:seed]
|
39
74
|
end
|
40
|
-
@weather_file = File.basename
|
75
|
+
@weather_file = File.basename(@osa[:weather_file][:path])
|
41
76
|
@osa_id = @osa[:_id]
|
42
77
|
@steps = []
|
43
78
|
@osa[:problem][:workflow].each_with_index do |step, i|
|
@@ -45,10 +80,9 @@ module OpenStudio
|
|
45
80
|
step_hash[:measure_dir_name] = File.basename(step[:measure_definition_directory])
|
46
81
|
step_hash[:arguments] = {}
|
47
82
|
# Measures can have no arguments -- make sure to catch it
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
83
|
+
@osa[:problem][:workflow][i][:arguments]&.each do |arg|
|
84
|
+
next if arg[:value].nil?
|
85
|
+
step_hash[:arguments][arg[:name].to_sym] = arg[:value]
|
52
86
|
end
|
53
87
|
step_hash[:name] = step[:name] if step[:name]
|
54
88
|
step_hash[:description] = step[:description] if step[:description]
|
@@ -91,8 +125,16 @@ module OpenStudio
|
|
91
125
|
end
|
92
126
|
|
93
127
|
# Overwrite the seed and weather files if they are present in the datapoint.json
|
94
|
-
|
95
|
-
|
128
|
+
if (osd[:weather_file] != '') && !osd[:weather_file].nil?
|
129
|
+
weather_file = osd[:weather_file]
|
130
|
+
else
|
131
|
+
weather_file = @weather_file
|
132
|
+
end
|
133
|
+
if (osd[:seed] != '') && !osd[:seed].nil?
|
134
|
+
seed_file = osd[:seed]
|
135
|
+
else
|
136
|
+
seed_file = @seed_file
|
137
|
+
end
|
96
138
|
|
97
139
|
# Save the OSW hash
|
98
140
|
osw = {}
|
@@ -116,12 +158,10 @@ module OpenStudio
|
|
116
158
|
def process_datapoints(osd_filename_array)
|
117
159
|
r = []
|
118
160
|
osd_filename_array.each do |osd_file|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
puts "Warning: Failed to process datapoint #{osd_file} with error #{e.message} in #{e.backtrace.join('\n')}"
|
124
|
-
end
|
161
|
+
r << process_datapoint(osd_file)
|
162
|
+
rescue StandardError => e
|
163
|
+
r << nil
|
164
|
+
puts "Warning: Failed to process datapoint #{osd_file} with error #{e.message} in #{e.backtrace.join('\n')}"
|
125
165
|
end
|
126
166
|
|
127
167
|
r
|
@@ -1,5 +1,40 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
1
36
|
module OpenStudio
|
2
37
|
module Analysis
|
3
|
-
VERSION = '1.0.
|
38
|
+
VERSION = '1.0.4'.freeze
|
4
39
|
end
|
5
40
|
end
|
@@ -1,3 +1,38 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
1
36
|
# OpenStudio::Analysis::Workflow configured the list of measures to run and in what order
|
2
37
|
module OpenStudio
|
3
38
|
module Analysis
|
@@ -118,7 +153,7 @@ module OpenStudio
|
|
118
153
|
m = add_measure(measure['name'], measure['display_name'], measure['local_path_to_measure'], hash)
|
119
154
|
|
120
155
|
measure['variables'].each do |variable|
|
121
|
-
next unless
|
156
|
+
next unless ['variable', 'pivot'].include? variable['variable_type']
|
122
157
|
|
123
158
|
dist = {
|
124
159
|
type: variable['distribution']['type'],
|
@@ -161,7 +196,7 @@ module OpenStudio
|
|
161
196
|
m = add_measure(measure[:measure_data][:name], measure[:measure_data][:display_name], measure[:measure_data][:local_path_to_measure], hash)
|
162
197
|
|
163
198
|
measure[:vars].each do |variable|
|
164
|
-
next unless
|
199
|
+
next unless ['variable', 'pivot'].include? variable[:variable_type]
|
165
200
|
|
166
201
|
dist = variable[:distribution]
|
167
202
|
opt = {
|
@@ -1,3 +1,38 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
1
36
|
# OpenStudio::Analysis::WorkflowStep is a class container for storing a measure. The generic name of step may be used later
|
2
37
|
# to include a workflow step on running EnergyPlus, radiance, etc.
|
3
38
|
module OpenStudio
|
@@ -277,40 +312,36 @@ module OpenStudio
|
|
277
312
|
# do not allow the choice variable_type
|
278
313
|
|
279
314
|
s.type = hash[:measure_type] # this is actually the measure type
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
var_type = arg[:variable_type] ? arg[:variable_type].downcase : arg[:value_type]
|
284
|
-
|
285
|
-
if var_type == 'choice'
|
286
|
-
# WARN the user that the measure had a "choice data type"
|
287
|
-
var_type = 'string'
|
288
|
-
end
|
315
|
+
hash[:arguments]&.each do |arg|
|
316
|
+
# warn the user to we need to deprecate variable_type and use value_type (which is what os server uses)
|
317
|
+
var_type = arg[:variable_type] ? arg[:variable_type].downcase : arg[:value_type]
|
289
318
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
name: arg[:name],
|
294
|
-
value_type: var_type,
|
295
|
-
default_value: arg[:default_value],
|
296
|
-
value: arg[:default_value]
|
297
|
-
}
|
319
|
+
if var_type == 'choice'
|
320
|
+
# WARN the user that the measure had a "choice data type"
|
321
|
+
var_type = 'string'
|
298
322
|
end
|
323
|
+
|
324
|
+
s.arguments << {
|
325
|
+
display_name: arg[:display_name],
|
326
|
+
display_name_short: arg[:display_name_short],
|
327
|
+
name: arg[:name],
|
328
|
+
value_type: var_type,
|
329
|
+
default_value: arg[:default_value],
|
330
|
+
value: arg[:default_value]
|
331
|
+
}
|
299
332
|
end
|
300
333
|
|
301
334
|
# Load the arguments of variables, but do not make them variables. This format is more about arugments, than variables
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
}
|
313
|
-
end
|
335
|
+
hash[:variables]&.each do |variable|
|
336
|
+
# add the arguments first
|
337
|
+
s.arguments << {
|
338
|
+
display_name: variable[:argument][:display_name],
|
339
|
+
display_name_short: variable[:argument][:display_name_short],
|
340
|
+
name: variable[:argument][:name],
|
341
|
+
value_type: variable[:argument][:value_type],
|
342
|
+
default_value: variable[:argument][:default_value],
|
343
|
+
value: variable[:argument][:default_value]
|
344
|
+
}
|
314
345
|
end
|
315
346
|
|
316
347
|
s
|
@@ -363,51 +394,47 @@ module OpenStudio
|
|
363
394
|
s.measure_definition_version_uuid = hash[:measure_definition_version_uuid]
|
364
395
|
|
365
396
|
s.type = hash[:measure_type] # this is actually the measure type
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
var_type = arg[:value_type]
|
370
|
-
|
371
|
-
if var_type == 'choice'
|
372
|
-
# WARN the user that the measure had a "choice data type"
|
373
|
-
var_type = 'string'
|
374
|
-
end
|
397
|
+
hash[:arguments]&.each do |arg|
|
398
|
+
# warn the user to we need to deprecate variable_type and use value_type (which is what os server uses)
|
399
|
+
var_type = arg[:value_type]
|
375
400
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
name: arg[:name],
|
380
|
-
value_type: var_type,
|
381
|
-
default_value: arg[:default_value],
|
382
|
-
value: arg[:value]
|
383
|
-
}
|
401
|
+
if var_type == 'choice'
|
402
|
+
# WARN the user that the measure had a "choice data type"
|
403
|
+
var_type = 'string'
|
384
404
|
end
|
405
|
+
|
406
|
+
s.arguments << {
|
407
|
+
display_name: arg[:display_name],
|
408
|
+
display_name_short: arg[:display_name_short],
|
409
|
+
name: arg[:name],
|
410
|
+
value_type: var_type,
|
411
|
+
default_value: arg[:default_value],
|
412
|
+
value: arg[:value]
|
413
|
+
}
|
385
414
|
end
|
386
415
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
s.make_variable(variable[:argument][:name], variable[:display_name], distribution, var_options)
|
410
|
-
end
|
416
|
+
hash[:variables]&.each do |variable|
|
417
|
+
# add the arguments first
|
418
|
+
s.arguments << {
|
419
|
+
display_name: variable[:argument][:display_name],
|
420
|
+
display_name_short: variable[:argument][:display_name_short],
|
421
|
+
name: variable[:argument][:name],
|
422
|
+
value_type: variable[:argument][:value_type],
|
423
|
+
default_value: variable[:argument][:default_value],
|
424
|
+
value: variable[:argument][:default_value]
|
425
|
+
}
|
426
|
+
|
427
|
+
var_options = {}
|
428
|
+
var_options[:variable_type] = variable[:variable_type]
|
429
|
+
var_options[:variable_display_name_short] = variable[:display_name_short]
|
430
|
+
var_options[:static_value] = variable[:static_value]
|
431
|
+
distribution = variable[:uncertainty_description]
|
432
|
+
distribution[:minimum] = variable[:minimum]
|
433
|
+
distribution[:mean] = distribution[:attributes].find { |a| a[:name] == 'modes' }[:value]
|
434
|
+
distribution[:maximum] = variable[:maximum]
|
435
|
+
distribution[:standard_deviation] = distribution[:attributes].find { |a| a[:name] == 'stddev' }[:value]
|
436
|
+
distribution[:step_size] = distribution[:attributes].find { |a| a[:name] == 'delta_x' }[:value]
|
437
|
+
s.make_variable(variable[:argument][:name], variable[:display_name], distribution, var_options)
|
411
438
|
end
|
412
439
|
|
413
440
|
s
|