openstudio-analysis 1.0.2 → 1.0.3
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 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -5
- data/LICENSE.md +1 -1
- data/Rakefile +1 -1
- data/lib/openstudio-analysis.rb +1 -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 +1 -1
- data/lib/openstudio/analysis/translator/excel.rb +2 -2
- data/lib/openstudio/analysis/translator/workflow.rb +8 -12
- data/lib/openstudio/analysis/version.rb +2 -2
- data/lib/openstudio/analysis/workflow.rb +1 -1
- data/lib/openstudio/analysis/workflow_step.rb +63 -71
- data/lib/openstudio/helpers/hash.rb +1 -1
- data/lib/openstudio/helpers/string.rb +1 -1
- data/lib/openstudio/weather/epw.rb +1 -1
- data/openstudio-analysis.gemspec +17 -13
- data/update_license.rb +3 -3
- metadata +57 -181
- 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/server_api_spec.rb +0 -68
- 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: 81aece25f5a122f27d0ccd5b001cd140d231999f0b9b4746aefd2767f82c1942
|
|
4
|
+
data.tar.gz: '0800f95fb398a0e4e7f106709dbaf94315d0501411b6ed4eac03edefb7850f3d'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc49cd8f2ed4eb2b250be27f6d35882c73ae35f8df5ec139cf3109ea8882c5e9ad01b21295815ed845f8dc8d7e8089cf3035c2e64eb0dd4c0097bf170eb6f137
|
|
7
|
+
data.tar.gz: 30d3bcc992f6934e6d7e8623c5e40d48b04554ca10947b9ef754c7929e4e94ae962ec49b66b6445c459f98b999b12f9d87cd7819ab247ff7dd26c8cadb1b9963
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
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:
|
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:
|
|
@@ -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:
|
|
@@ -80,11 +80,9 @@ module OpenStudio
|
|
|
80
80
|
step_hash[:measure_dir_name] = File.basename(step[:measure_definition_directory])
|
|
81
81
|
step_hash[:arguments] = {}
|
|
82
82
|
# 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
|
|
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]
|
|
88
86
|
end
|
|
89
87
|
step_hash[:name] = step[:name] if step[:name]
|
|
90
88
|
step_hash[:description] = step[:description] if step[:description]
|
|
@@ -160,12 +158,10 @@ module OpenStudio
|
|
|
160
158
|
def process_datapoints(osd_filename_array)
|
|
161
159
|
r = []
|
|
162
160
|
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
|
|
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')}"
|
|
169
165
|
end
|
|
170
166
|
|
|
171
167
|
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.3'.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:
|
|
@@ -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:
|
|
@@ -312,40 +312,36 @@ module OpenStudio
|
|
|
312
312
|
# do not allow the choice variable_type
|
|
313
313
|
|
|
314
314
|
s.type = hash[:measure_type] # this is actually the measure type
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
var_type = arg[:variable_type] ? arg[:variable_type].downcase : arg[:value_type]
|
|
319
|
-
|
|
320
|
-
if var_type == 'choice'
|
|
321
|
-
# WARN the user that the measure had a "choice data type"
|
|
322
|
-
var_type = 'string'
|
|
323
|
-
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]
|
|
324
318
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
name: arg[:name],
|
|
329
|
-
value_type: var_type,
|
|
330
|
-
default_value: arg[:default_value],
|
|
331
|
-
value: arg[:default_value]
|
|
332
|
-
}
|
|
319
|
+
if var_type == 'choice'
|
|
320
|
+
# WARN the user that the measure had a "choice data type"
|
|
321
|
+
var_type = 'string'
|
|
333
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
|
+
}
|
|
334
332
|
end
|
|
335
333
|
|
|
336
334
|
# Load the arguments of variables, but do not make them variables. This format is more about arugments, than variables
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
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
|
+
}
|
|
349
345
|
end
|
|
350
346
|
|
|
351
347
|
s
|
|
@@ -398,51 +394,47 @@ module OpenStudio
|
|
|
398
394
|
s.measure_definition_version_uuid = hash[:measure_definition_version_uuid]
|
|
399
395
|
|
|
400
396
|
s.type = hash[:measure_type] # this is actually the measure type
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
var_type = arg[:value_type]
|
|
405
|
-
|
|
406
|
-
if var_type == 'choice'
|
|
407
|
-
# WARN the user that the measure had a "choice data type"
|
|
408
|
-
var_type = 'string'
|
|
409
|
-
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]
|
|
410
400
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
name: arg[:name],
|
|
415
|
-
value_type: var_type,
|
|
416
|
-
default_value: arg[:default_value],
|
|
417
|
-
value: arg[:value]
|
|
418
|
-
}
|
|
401
|
+
if var_type == 'choice'
|
|
402
|
+
# WARN the user that the measure had a "choice data type"
|
|
403
|
+
var_type = 'string'
|
|
419
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
|
+
}
|
|
420
414
|
end
|
|
421
415
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
s.make_variable(variable[:argument][:name], variable[:display_name], distribution, var_options)
|
|
445
|
-
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)
|
|
446
438
|
end
|
|
447
439
|
|
|
448
440
|
s
|