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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.travis.yml +2 -3
  4. data/CHANGELOG.md +25 -0
  5. data/Gemfile +1 -5
  6. data/LICENSE.md +1 -1
  7. data/Rakefile +1 -1
  8. data/lib/openstudio-analysis.rb +2 -1
  9. data/lib/openstudio/analysis.rb +23 -27
  10. data/lib/openstudio/analysis/algorithm_attributes.rb +1 -1
  11. data/lib/openstudio/analysis/formulation.rb +1 -1
  12. data/lib/openstudio/analysis/server_api.rb +8 -14
  13. data/lib/openstudio/analysis/support_files.rb +1 -1
  14. data/lib/openstudio/analysis/translator/datapoints.rb +24 -38
  15. data/lib/openstudio/analysis/translator/excel.rb +2 -2
  16. data/lib/openstudio/analysis/translator/workflow.rb +10 -13
  17. data/lib/openstudio/analysis/version.rb +2 -2
  18. data/lib/openstudio/analysis/workflow.rb +9 -18
  19. data/lib/openstudio/analysis/workflow_step.rb +67 -78
  20. data/lib/openstudio/helpers/hash.rb +1 -1
  21. data/lib/openstudio/helpers/string.rb +1 -1
  22. data/{spec/openstudio/server_api_spec.rb → lib/openstudio/helpers/utils.rb} +26 -28
  23. data/lib/openstudio/weather/epw.rb +1 -1
  24. data/openstudio-analysis.gemspec +17 -14
  25. data/update_license.rb +3 -3
  26. metadata +57 -194
  27. data/spec/files/0_1_09_no_variables.xlsx +0 -0
  28. data/spec/files/0_1_09_outputvars.xlsx +0 -0
  29. data/spec/files/0_1_09_setup_version_2.xlsx +0 -0
  30. data/spec/files/0_1_09_small_list.xlsx +0 -0
  31. data/spec/files/0_1_09_small_list_incomplete.xlsx +0 -0
  32. data/spec/files/0_1_09_small_list_repeat_vars.xlsx +0 -0
  33. data/spec/files/0_1_09_small_list_validation_errors.xlsx +0 -0
  34. data/spec/files/0_1_10_proxy.xlsx +0 -0
  35. data/spec/files/0_1_10_proxy_user.xlsx +0 -0
  36. data/spec/files/0_1_10_template_input.xlsx +0 -0
  37. data/spec/files/0_1_11_discrete_variables.xlsx +0 -0
  38. data/spec/files/0_1_12_discrete_dynamic_columns.xlsx +0 -0
  39. data/spec/files/0_2_0_template.xlsx +0 -0
  40. data/spec/files/0_2_0_template_simpletest.xlsx +0 -0
  41. data/spec/files/0_3_0_dynamic_uuids.xlsx +0 -0
  42. data/spec/files/0_3_0_measure_existence.xlsx +0 -0
  43. data/spec/files/0_3_0_outputs.xlsx +0 -0
  44. data/spec/files/0_3_3_short_names.xlsx +0 -0
  45. data/spec/files/0_3_5_multiple_measure_paths.xlsx +0 -0
  46. data/spec/files/0_3_7_unique_measure_names.xlsx +0 -0
  47. data/spec/files/0_3_7_worker_init_final.xlsx +0 -0
  48. data/spec/files/0_4_0_lhs_discrete_continuous.xlsx +0 -0
  49. data/spec/files/0_4_0_multiple_seeds.xlsx +0 -0
  50. data/spec/files/0_4_0_pivot_test.xlsx +0 -0
  51. data/spec/files/analysis/examples/discrete_lhs_example.json +0 -809
  52. data/spec/files/analysis/examples/medium_office_example.json +0 -1674
  53. data/spec/files/analysis/examples/medium_office_workflow.json +0 -1298
  54. data/spec/files/measures/ActualMeasureNoJson/measure.rb +0 -80
  55. data/spec/files/measures/ActualMeasureNoJson/measure.xml +0 -2
  56. data/spec/files/measures/ExampleMeasure/measure.json +0 -3
  57. data/spec/files/measures/ExampleMeasure/measure.rb +0 -5
  58. data/spec/files/measures/ExampleMeasure/measure.xml +0 -1
  59. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.json +0 -36
  60. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.rb +0 -22
  61. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.xml +0 -5
  62. data/spec/files/measures/NoMeasureRbFile/.gitkeep +0 -0
  63. data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.json +0 -3
  64. data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.rb +0 -5
  65. data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.xml +0 -1
  66. data/spec/files/measures/SetThermostatSchedules/measure.json +0 -63
  67. data/spec/files/measures/SetThermostatSchedules/measure.rb +0 -254
  68. data/spec/files/measures/SetThermostatSchedules/measure.xml +0 -2
  69. data/spec/files/measures/example_measure_auto_directory_name/measure.json +0 -3
  70. data/spec/files/measures/example_measure_auto_directory_name/measure.rb +0 -5
  71. data/spec/files/measures/example_measure_auto_directory_name/measure.xml +0 -1
  72. data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.json +0 -3
  73. data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.rb +0 -5
  74. data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.xml +0 -1
  75. data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.rb +0 -5
  76. data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.xml +0 -1
  77. data/spec/files/measures/rotate_building/measure.rb +0 -5
  78. data/spec/files/measures/rotate_building/measure.xml +0 -1
  79. data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.rb +0 -5
  80. data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.xml +0 -1
  81. data/spec/files/measures_second_path/measure_in_another_dir/measure.json +0 -3
  82. data/spec/files/measures_second_path/measure_in_another_dir/measure.rb +0 -5
  83. data/spec/files/measures_second_path/measure_in_another_dir/measure.xml +0 -1
  84. data/spec/files/partial_weather.epw +0 -32
  85. data/spec/files/partial_weather_2.epw +0 -32
  86. data/spec/files/small_seed.osm +0 -4622
  87. data/spec/files/worker_init/first_file.rb +0 -15
  88. data/spec/files/worker_init/second_file.sh +0 -4
  89. data/spec/files/workflow/analysis.osa +0 -1334
  90. data/spec/files/workflow/datapoint_0.osd +0 -65
  91. data/spec/files/workflow/datapoint_1.osd +0 -65
  92. data/spec/files/workflow/datapoint_2.osd +0 -65
  93. data/spec/files/workflow/datapoint_wrong_osa_id.osd +0 -65
  94. data/spec/integration/server_api_spec.rb +0 -83
  95. data/spec/openstudio/excel_spec.rb +0 -606
  96. data/spec/openstudio/formulation_spec.rb +0 -200
  97. data/spec/openstudio/hash_spec.rb +0 -56
  98. data/spec/openstudio/osw_spec.rb +0 -129
  99. data/spec/openstudio/string_spec.rb +0 -34
  100. data/spec/openstudio/support_files_spec.rb +0 -89
  101. data/spec/openstudio/weather_spec.rb +0 -80
  102. data/spec/openstudio/workflow_spec.rb +0 -126
  103. data/spec/openstudio/workflow_step_spec.rb +0 -158
  104. data/spec/schema/osa.json +0 -613
  105. data/spec/schema/osa.png +0 -0
  106. data/spec/schema/osd.json +0 -110
  107. data/spec/schema/osd.png +0 -0
  108. data/spec/spec_helper.rb +0 -56
@@ -1,80 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) 2008-2019, 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
-
36
- require 'spec_helper'
37
-
38
- describe OpenStudio::Weather::Epw do
39
- before :all do
40
- @s = OpenStudio::Analysis::SupportFiles.new
41
- expect(@s).to be_a OpenStudio::Analysis::SupportFiles
42
- end
43
-
44
- it 'should process the header of a weather file' do
45
- epw = OpenStudio::Weather::Epw.load('spec/files/partial_weather.epw')
46
- expect(epw.valid?).to be true
47
- expect(epw.city).to eq 'Denver Intl Ap'
48
- expect(epw.state).to eq 'CO'
49
- expect(epw.country).to eq 'USA'
50
- expect(epw.data_type).to eq 'TMY3'
51
- expect(epw.wmo).to eq 725650
52
- expect(epw.lat).to eq 39.83
53
- expect(epw.lon).to eq -104.65
54
- expect(epw.gmt).to eq -7.0
55
- expect(epw.elevation).to eq 1650.0
56
-
57
- expect(epw.header_data.size).to eq 7
58
- expect(epw.weather_data.size).to eq 24
59
- end
60
-
61
- it 'should read and write the weather file' do
62
- o = 'spec/files/partial_weather.epw'
63
- epw = OpenStudio::Weather::Epw.load(o)
64
- f = 'spec/files/export/weather/weather_out.epw'
65
- File.delete(f) if File.exist? f
66
- expect(epw.save_as(f)).to eq true
67
- expect(File.exist?(f)).to eq true
68
- expect(File.size(o)).to eq File.size(f)
69
- end
70
-
71
- it 'should append weather data' do
72
- o = 'spec/files/partial_weather.epw'
73
- epw = OpenStudio::Weather::Epw.load(o)
74
-
75
- epw.append_weather_data(o)
76
-
77
- f = 'spec/files/export/weather/weather_out_appended.epw'
78
- epw.save_as(f)
79
- end
80
- end
@@ -1,126 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) 2008-2019, 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
-
36
- require 'spec_helper'
37
-
38
- describe OpenStudio::Analysis::Workflow do
39
- before :all do
40
- @w = OpenStudio::Analysis::Workflow.new
41
- end
42
-
43
- it 'should create a workflow' do
44
- expect(@w).not_to be nil
45
- expect(@w).to be_a OpenStudio::Analysis::Workflow
46
- end
47
-
48
- it 'should add a measure' do
49
- p = 'spec/files/measures/IncreaseInsulationRValueForRoofs'
50
- expect(@w.add_measure_from_path('insulation', 'Increase Insulation', p)).to be_an OpenStudio::Analysis::WorkflowStep
51
-
52
- p = 'spec/files/measures/ActualMeasureNoJson'
53
- FileUtils.remove "#{p}/measure.json" if File.exist? "#{p}/measure.json"
54
- m = @w.add_measure_from_path('a_measure', 'Actual Measure', p)
55
- expect(m).to be_a OpenStudio::Analysis::WorkflowStep
56
- expect(m.measure_definition_class_name).to eq 'RotateBuilding'
57
- end
58
-
59
- it 'should fix the path of the measure' do
60
- p = 'spec/files/measures/IncreaseInsulationRValueForRoofs/measure.rb'
61
- m = @w.add_measure_from_path('insulation', 'Increase Insulation', p)
62
- expect(m).to be_an OpenStudio::Analysis::WorkflowStep
63
- expect(m.measure_definition_directory).to eq './measures/IncreaseInsulationRValueForRoofs'
64
- expect(m.measure_definition_directory_local).to eq 'spec/files/measures/IncreaseInsulationRValueForRoofs'
65
- end
66
-
67
- it 'should clear out a workflow' do
68
- p = 'spec/files/measures/SetThermostatSchedules'
69
- @w.add_measure_from_path('thermostat', 'thermostat', p)
70
- @w.add_measure_from_path('thermostat 2', 'thermostat 2', p)
71
-
72
- expect(@w.items.size).to be > 1
73
- @w.clear
74
- expect(@w.items.size).to eq 0
75
-
76
- @w.add_measure_from_path('thermostat', 'thermostat', p)
77
- @w.add_measure_from_path('thermostat 2', 'thermostat 2', p)
78
- expect(@w.items.size).to eq 2
79
- end
80
-
81
- it 'should find a workflow step' do
82
- @w.clear
83
-
84
- p = 'spec/files/measures/SetThermostatSchedules'
85
- @w.add_measure_from_path('thermostat', 'thermostat', p)
86
- @w.add_measure_from_path('thermostat_2', 'thermostat 2', p)
87
-
88
- m = @w.find_measure('thermostat_2')
89
- expect(m).not_to be nil
90
- expect(m).to be_a OpenStudio::Analysis::WorkflowStep
91
- expect(m.name).to eq 'thermostat_2'
92
- end
93
-
94
- it 'should find a workflow step and make a variable' do
95
- @w.clear
96
-
97
- p = 'spec/files/measures/SetThermostatSchedules'
98
- @w.add_measure_from_path('thermostat', 'thermostat', p)
99
- @w.add_measure_from_path('thermostat_2', 'thermostat 2', p)
100
-
101
- m = @w.find_measure('thermostat_2')
102
- expect(m.argument_names).to eq ['__SKIP__', 'zones', 'cooling_sch', 'heating_sch', 'material_cost']
103
-
104
- d = {
105
- type: 'uniform',
106
- minimum: 5,
107
- maximum: 7,
108
- mean: 6.2
109
- }
110
- m.make_variable('cooling_sch', 'Change the cooling schedule', d)
111
-
112
- d = {
113
- type: 'uniform',
114
- minimum: 5,
115
- maximum: 7,
116
- mean: 6.2
117
- }
118
- m.make_variable('heating_sch', 'Change the heating schedule', d)
119
-
120
- expect(@w.measures.size).to eq 2
121
- expect(@w.items.size).to eq 2
122
- expect(@w.items.size).to eq 2
123
-
124
- expect(@w.all_variables.size).to eq 2
125
- end
126
- end
@@ -1,158 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) 2008-2019, 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
-
36
- require 'spec_helper'
37
-
38
- describe OpenStudio::Analysis::WorkflowStep do
39
- it 'should create a workflow' do
40
- s = OpenStudio::Analysis::WorkflowStep.new
41
- expect(s).not_to be nil
42
- expect(s).to be_a OpenStudio::Analysis::WorkflowStep
43
- end
44
-
45
- it 'should add a measure' do
46
- h = 'spec/files/measures/IncreaseInsulationRValueForRoofs/measure.json'
47
- s = OpenStudio::Analysis::WorkflowStep.from_measure_hash(
48
- 'my_instance',
49
- 'my instance display name',
50
- h,
51
- JSON.parse(File.read(h), symbolize_names: true)
52
- )
53
- puts s
54
- end
55
-
56
- it 'should tag a discrete variable' do
57
- h = 'spec/files/measures/SetThermostatSchedules/measure.json'
58
- measure = OpenStudio::Analysis::WorkflowStep.from_measure_hash(
59
- 'my_instance',
60
- 'my instance display name',
61
- h,
62
- JSON.parse(File.read(h), symbolize_names: true)
63
- )
64
-
65
- expect(measure.name).to eq 'my_instance'
66
- v = {
67
- type: 'discrete',
68
- minimum: 'low string',
69
- maximum: 'high string',
70
- mean: 'middle string',
71
- values: ['a', 'b', 'c', 'd'],
72
- weights: [0.25, 0.25, 0.25, 0.25]
73
- }
74
- r = measure.make_variable('cooling_sch', 'my variable', v)
75
- expect(r).to eq true
76
- end
77
-
78
- it 'should tag a continuous variable' do
79
- h = 'spec/files/measures/SetThermostatSchedules/measure.json'
80
- measure = OpenStudio::Analysis::WorkflowStep.from_measure_hash(
81
- 'my_instance',
82
- 'my instance display name',
83
- h,
84
- JSON.parse(File.read(h), symbolize_names: true)
85
- )
86
-
87
- expect(measure.name).to eq 'my_instance'
88
- v = {
89
- type: 'triangle',
90
- minimum: 0.5,
91
- maximum: 20,
92
- mean: 10
93
- }
94
- o = {
95
- static_value: 24601
96
- }
97
- r = measure.make_variable('cooling_sch', 'my variable', v, o)
98
-
99
- h = measure.to_hash
100
-
101
- expect(h[:variables].first[:static_value]).to eq 24601
102
- expect(h[:variables].first.key?(:step_size)).to eq false
103
-
104
- expect(r).to eq true
105
- end
106
-
107
- it 'should tag a normal continuous variable' do
108
- h = 'spec/files/measures/SetThermostatSchedules/measure.json'
109
- measure = OpenStudio::Analysis::WorkflowStep.from_measure_hash(
110
- 'my_instance',
111
- 'my instance display name',
112
- h,
113
- JSON.parse(File.read(h), symbolize_names: true)
114
- )
115
-
116
- expect(measure.name).to eq 'my_instance'
117
- v = {
118
- type: 'normal',
119
- minimum: 0.5,
120
- maximum: 20,
121
- mean: 10,
122
- standard_deviation: 2
123
- }
124
- r = measure.make_variable('cooling_sch', 'my variable', v)
125
-
126
- h = measure.to_hash
127
-
128
- expect(h[:variables].first.key?(:step_size)).to eq false
129
-
130
- expect(r).to eq true
131
- end
132
-
133
- it 'should tag a uniform variable' do
134
- h = 'spec/files/measures/SetThermostatSchedules/measure.json'
135
- measure = OpenStudio::Analysis::WorkflowStep.from_measure_hash(
136
- 'my_instance',
137
- 'my instance display name',
138
- h,
139
- JSON.parse(File.read(h), symbolize_names: true)
140
- )
141
-
142
- expect(measure.name).to eq 'my_instance'
143
- v = {
144
- type: 'uniform',
145
- minimum: 0.5,
146
- maximum: 20,
147
- mean: 10
148
- }
149
- r = measure.make_variable('cooling_sch', 'my variable', v)
150
-
151
- h = measure.to_hash
152
-
153
- # puts JSON.pretty_generate(h)
154
- expect(h[:variables].first.key?(:step_size)).to eq false
155
-
156
- expect(r).to eq true
157
- end
158
- end
@@ -1,613 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "description": "JSON Schema for the OpenStudioAnalysis File Type",
4
- "type": "object",
5
- "properties": {
6
- "analysis": {
7
- "$ref": "#/definitions/Analysis"
8
- }
9
- },
10
- "required": [
11
- "analysis"
12
- ],
13
- "additionalProperties": false,
14
- "definitions": {
15
- "Output": {
16
- "description": "Hash",
17
- "type": "object",
18
- "properties": {
19
- "units": {
20
- "description": "Haystack compliant unit string, or empty string if not applicable",
21
- "type": "string"
22
- },
23
- "objective_function": {
24
- "description": "Determines if output is part of an objective function",
25
- "type": "boolean"
26
- },
27
- "objective_function_index": {
28
- "description": "Key used to define multi-objective functions, null if not applicable",
29
- "type": "number"
30
- },
31
- "objective_function_target": {
32
- "description": "Key used to define target of the objective function, null if not applicable",
33
- "type": [
34
- "number",
35
- "null"
36
- ]
37
- },
38
- "objective_function_group": {
39
- "description": "Optional key used to define multi-objective functions",
40
- "type": "number"
41
- },
42
- "scaling_factor": {
43
- "description": "????",
44
- "type": "null"
45
- },
46
- "display_name": {
47
- "description": "User facing name of objective which must be unique",
48
- "type": "string"
49
- },
50
- "display_name_short": {
51
- "description": "User facing name less that 20 characters",
52
- "type": "string"
53
- },
54
- "metadata_id": {
55
- "description": "??????",
56
- "type": [
57
- "string",
58
- "null"
59
- ]
60
- },
61
- "name": {
62
- "description": "Snake cased output machine name",
63
- "type": "string"
64
- },
65
- "visualize": {
66
- "description": "Determines if variable will be include in plots on the server",
67
- "type": "boolean"
68
- },
69
- "export": {
70
- "description": "?????",
71
- "type": "boolean"
72
- },
73
- "variable_type": {
74
- "description": "Allowed values of 'string', 'bool', or 'number'",
75
- "type": "string"
76
- }
77
- },
78
- "required": [
79
- "units",
80
- "objective_function",
81
- "objective_function_index",
82
- "objective_function_target",
83
- "scaling_factor",
84
- "display_name",
85
- "metadata_id",
86
- "name"
87
- ],
88
- "additionalProperties": false
89
- },
90
- "Algorithm Attributes": {
91
- "title": "algorithm",
92
- "description": "Hash of attributes associated with the analysis_type",
93
- "type": "object",
94
- "additionalProperties": {
95
- "description": "Attributes defined by analysis type"
96
- }
97
- },
98
- "Argument": {
99
- "title": "argument",
100
- "description": "Individual argument instance",
101
- "type": "object",
102
- "properties": {
103
- "display_name": {
104
- "description": "User-facing display name which must be unique",
105
- "type": "string"
106
- },
107
- "display_name_short": {
108
- "description": "Optional user-facing display name under 20 characters",
109
- "type": "string"
110
- },
111
- "name": {
112
- "description": "Machine readable snake-cased name of argument as defined in the measure.xml",
113
- "type": "string"
114
- },
115
- "value_type": {
116
- "description": "Accepts inputs of 'string', 'bool', and 'number'",
117
- "type": "string"
118
- },
119
- "default_value": {
120
- "description": "Default value for argument, if defined in the measure.xml file",
121
- "type": [
122
- "string",
123
- "number",
124
- "boolean"
125
- ]
126
- },
127
- "value": {
128
- "description": "Value to set argument to in analysis",
129
- "type": [
130
- "string",
131
- "number",
132
- "boolean"
133
- ]
134
- },
135
- "machine_name": {
136
- "description": "????",
137
- "type": "string"
138
- },
139
- "uuid": {
140
- "description": "UUID for the measure from the measure.xml",
141
- "type": "string"
142
- },
143
- "version_uuid": {
144
- "description": "UUID for the measure version form the measure.xml",
145
- "type": "string"
146
- }
147
- },
148
- "required": [
149
- "display_name",
150
- "name",
151
- "value",
152
- "machine_name",
153
- "uuid",
154
- "version_uuid"
155
- ],
156
- "additionalProperties": false
157
- },
158
- "Workflow Step": {
159
- "description": "Individual measure definition",
160
- "type": "object",
161
- "properties": {
162
- "name": {
163
- "description": "Snake-cased machine readable measure name which must be unique",
164
- "type": "string"
165
- },
166
- "display_name": {
167
- "description": "User facing measure name which must also be unique",
168
- "type": "string"
169
- },
170
- "measure_type": {
171
- "description": "Accepts values of 'Ruby' 'EnergyPlus' and 'Reporting'",
172
- "type": "string"
173
- },
174
- "description": {
175
- "description": "Measure description",
176
- "type": "string"
177
- },
178
- "taxonomy": {
179
- "description": "Measure taxonomy tag",
180
- "type": "string"
181
- },
182
- "measure_definition_class_name": {
183
- "description": "Class name of measure.rb file",
184
- "type": "string"
185
- },
186
- "measure_definition_directory": {
187
- "description": "??",
188
- "type": "string"
189
- },
190
- "measure_definition_directory_local": {
191
- "description": "Local path to the measure directory",
192
- "type": "string"
193
- },
194
- "measure_definition_display_name": {
195
- "description": "?????",
196
- "type": "string"
197
- },
198
- "measure_definition_name": {
199
- "description": "?????",
200
- "type": "string"
201
- },
202
- "measure_definition_name_xml": {
203
- "description": "?????",
204
- "type": "null"
205
- },
206
- "measure_definition_uuid": {
207
- "description": "UUID of measure in measure.xml",
208
- "type": "string"
209
- },
210
- "measure_definition_version_uuid": {
211
- "description": "UUID of measure version in measure.xml",
212
- "type": "string"
213
- },
214
- "arguments": {
215
- "$ref": "#/definitions/Argument Array"
216
- },
217
- "variables": {
218
- "$ref": "#/definitions/Variable Array"
219
- },
220
- "workflow_index": {
221
- "description": "Index in workflow array, indexing from 0",
222
- "type": "number"
223
- },
224
- "workflow_step_type": {
225
- "description": "???????",
226
- "type": "string"
227
- },
228
- "version_uuid": {
229
- "description": "UUID of measure version from the measure.xml",
230
- "type": "string"
231
- },
232
- "uuid": {
233
- "description": "UUID of measure from the measure.xml",
234
- "type": "string"
235
- }
236
- },
237
- "required": [
238
- "name",
239
- "display_name",
240
- "measure_type",
241
- "measure_definition_class_name",
242
- "measure_definition_directory",
243
- "measure_definition_uuid",
244
- "measure_definition_version_uuid",
245
- "arguments",
246
- "variables",
247
- "workflow_index",
248
- "workflow_step_type",
249
- "version_uuid",
250
- "uuid"
251
- ],
252
- "additionalProperties": false
253
- },
254
- "Uncertainty Definition": {
255
- "title": "uncertainty_description",
256
- "description": "Set of attributes defining the variability of the input",
257
- "type": "object",
258
- "properties": {
259
- "type": {
260
- "description": "Uncertainty type, accepting values of 'triangle', 'uniform', 'discrete', and 'normal'",
261
- "type": "string",
262
- "oneof": [
263
- "triangle",
264
- "uniform",
265
- "normal",
266
- "discrete"
267
- ]
268
- },
269
- "attributes": {
270
- "$ref": "#/definitions/Distribution Definition"
271
- }
272
- },
273
- "required": [
274
- "type",
275
- "attributes"
276
- ],
277
- "additionalProperties": false
278
- },
279
- "Design Alternative": {
280
- "description": "Individual design alternative instance",
281
- "type": "object",
282
- "properties": {
283
- "name": {
284
- "description": "Name of design alternative",
285
- "type": "string"
286
- },
287
- "description": {
288
- "description": "Description of design alternative",
289
- "type": "string"
290
- },
291
- "seed": {
292
- "$ref": "#/definitions/Seed Object"
293
- },
294
- "options": {
295
- "description": "Each option corresponds to one WorkflowStep (i.e. Measure). Options are listed in order",
296
- "type": "array",
297
- "items": {
298
- "type": "object",
299
- "properties": {
300
- "measure_name": {
301
- "description": "Name of the measure in this workflow",
302
- "type": "string"
303
- },
304
- "workflow_index": {
305
- "description": "Index of the measure in the workflow",
306
- "type": "number"
307
- },
308
- "name": {
309
- "description": "Name of the user specified option",
310
- "type": "string"
311
- },
312
- "description": {
313
- "description": "Description of the user specified option",
314
- "type": "string"
315
- }
316
- },
317
- "additionalProperties": false
318
- }
319
- }
320
- },
321
- "required": [
322
- "name",
323
- "description"
324
- ],
325
- "additionalProperties": false
326
- },
327
- "Variable": {
328
- "description": "Individual variable instance",
329
- "type": "object",
330
- "properties": {
331
- "argument": {
332
- "$ref": "#/definitions/Argument"
333
- },
334
- "display_name": {
335
- "description": "User-facing display name which must be unique",
336
- "type": "string"
337
- },
338
- "display_name_short": {
339
- "description": "Optional user-facing name under 20 characters",
340
- "type": "string"
341
- },
342
- "variable_type": {
343
- "description": "Definition of variable type",
344
- "type": "string",
345
- "oneof": [
346
- "variable",
347
- "pivot"
348
- ]
349
- },
350
- "units": {
351
- "description": "Haystack compliant units with an empty string if not defined.",
352
- "type": "null"
353
- },
354
- "minimum": {
355
- "description": "????",
356
- "type": "number"
357
- },
358
- "maximum": {
359
- "description": "????",
360
- "type": "number"
361
- },
362
- "relation_to_output": {
363
- "description": "????",
364
- "type": "null"
365
- },
366
- "static_value": {
367
- "description": "Value to default to in the case of this variable not being perturbed in a datapoint",
368
- "type": "number"
369
- },
370
- "uuid": {
371
- "description": "Variable UUID to link against in the .osd file",
372
- "type": "string"
373
- },
374
- "version_uuid": {
375
- "description": "???",
376
- "type": "string"
377
- },
378
- "variable": {
379
- "description": "????",
380
- "type": "boolean"
381
- },
382
- "uncertainty_description": {
383
- "$ref": "#/definitions/Uncertainty Definition"
384
- },
385
- "workflow_index": {
386
- "description": "???????",
387
- "type": "number"
388
- },
389
- "machine_name": {
390
- "description": "???????",
391
- "type": "string"
392
- }
393
- },
394
- "required": [
395
- "argument",
396
- "display_name",
397
- "variable_type",
398
- "units",
399
- "static_value",
400
- "uuid",
401
- "version_uuid",
402
- "uncertainty_description",
403
- "machine_name"
404
- ],
405
- "additionalProperties": false
406
- },
407
- "Problem": {
408
- "title": "problem",
409
- "description": "Defines procedure for running the analysis",
410
- "type": "object",
411
- "properties": {
412
- "analysis_type": {
413
- "description": "Type of analysis to be run, e.g. LHS or nsga2",
414
- "type": "string",
415
- "oneof": [
416
- "morris",
417
- "lhs",
418
- "rgenound",
419
- "nsga_nrel",
420
- "spea",
421
- "sequential_search",
422
- "single_run",
423
- "batch_run",
424
- "doe",
425
- "repeat_run",
426
- "optim",
427
- "baseline_perturbation",
428
- "preflight"
429
- ]
430
- },
431
- "algorithm": {
432
- "$ref": "#/definitions/Algorithm Attributes"
433
- },
434
- "workflow": {
435
- "$ref": "#/definitions/Workflow"
436
- },
437
- "random_seed": {
438
- "description": "Random seed to set server to for the execution of the OSA file",
439
- "type": "number"
440
- },
441
- "name": {
442
- "description": "??????",
443
- "type": "string"
444
- },
445
- "design_alternatives": {
446
- "description": "Array of design alternative names and descriptions",
447
- "type": "array",
448
- "items": {
449
- "$ref": "#/definitions/Design Alternative"
450
- }
451
- }
452
- },
453
- "required": [
454
- "analysis_type",
455
- "algorithm",
456
- "workflow",
457
- "random_seed"
458
- ],
459
- "additionalProperties": false
460
- },
461
- "Output Array": {
462
- "description": "Array of objects which define user-desired outputs from the analysis ",
463
- "type": "array",
464
- "items": {
465
- "$ref": "#/definitions/Output"
466
- }
467
- },
468
- "Workflow": {
469
- "description": "Definition of measures to be applied in the analysis",
470
- "type": "array",
471
- "items": {
472
- "$ref": "#/definitions/Workflow Step"
473
- }
474
- },
475
- "Seed Object": {
476
- "title": "seed",
477
- "description": "Seed osm or idf file for default use",
478
- "type": "object",
479
- "properties": {
480
- "file_type": {
481
- "description": "Accepted values of 'osm' and 'idf'",
482
- "type": "string",
483
- "oneonf": [
484
- "osm",
485
- "idf"
486
- ]
487
- },
488
- "path": {
489
- "description": "Path to the seed file from the project directory",
490
- "type": "string"
491
- }
492
- },
493
- "required": [
494
- "file_type"
495
- ],
496
- "additionalProperties": false
497
- },
498
- "Weather File": {
499
- "title": "weather_file",
500
- "description": "Weather file for default use in the simulation",
501
- "type": "object",
502
- "properties": {
503
- "file_type": {
504
- "description": "Weather file type, e.g. TMY3",
505
- "type": "string"
506
- },
507
- "path": {
508
- "description": "Path to weather file from the project directory",
509
- "type": "string"
510
- }
511
- },
512
- "required": [
513
- "file_type",
514
- "path"
515
- ],
516
- "additionalProperties": false
517
- },
518
- "Analysis": {
519
- "title": "analysis",
520
- "description": "Analysis object",
521
- "type": "object",
522
- "properties": {
523
- "display_name": {
524
- "description": "User facing string, spaces & capitals allowed",
525
- "type": "string"
526
- },
527
- "name": {
528
- "description": "snake_cassed machine name",
529
- "type": "string"
530
- },
531
- "output_variables": {
532
- "$ref": "#/definitions/Output Array"
533
- },
534
- "problem": {
535
- "$ref": "#/definitions/Problem"
536
- },
537
- "seed": {
538
- "$ref": "#/definitions/Seed Object"
539
- },
540
- "weather_file": {
541
- "$ref": "#/definitions/Weather File"
542
- },
543
- "file_format_version": {
544
- "description": "1.0",
545
- "type": "number"
546
- },
547
- "_id": {
548
- "description": "UUID of the OSA file",
549
- "type": "string"
550
- },
551
- "uuid": {
552
- "description": "UUID of the OSA file",
553
- "type": "string"
554
- },
555
- "project_id": {
556
- "description": "?????",
557
- "type": "string"
558
- }
559
- },
560
- "required": [
561
- "output_variables",
562
- "problem",
563
- "seed",
564
- "weather_file",
565
- "_id",
566
- "uuid",
567
- "project_id"
568
- ],
569
- "additionalProperties": false
570
- },
571
- "Argument Array": {
572
- "description": "Array of fixed inputs for the measure",
573
- "type": "array",
574
- "items": {
575
- "$ref": "#/definitions/Argument"
576
- }
577
- },
578
- "Variable Array": {
579
- "description": "Array of variable inputs for the measure",
580
- "type": "array",
581
- "items": {
582
- "$ref": "#/definitions/Variable"
583
- }
584
- },
585
- "Distribution Definition": {
586
- "title": "attributes",
587
- "description": "Array of attributes defining the distribution type properties",
588
- "type": "array",
589
- "items": {
590
- "title": "Distribution Attributes",
591
- "type": "object",
592
- "properties": {
593
- "name": {
594
- "type": "string"
595
- },
596
- "value": {
597
- "type": [
598
- "array",
599
- "string",
600
- "number",
601
- "boolean"
602
- ]
603
- }
604
- },
605
- "required": [
606
- "name",
607
- "value"
608
- ],
609
- "additionalProperties": false
610
- }
611
- }
612
- }
613
- }