openstudio-analysis 0.1.14 → 0.1.15

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/openstudio/analysis/server_api.rb +1 -1
  4. data/lib/openstudio/analysis/translator/excel.rb +25 -2
  5. data/lib/openstudio/analysis/version.rb +1 -1
  6. data/spec/files/analysis/medium_office.json +1786 -0
  7. data/spec/files/{export/analysis/output_vars.zip → analysis/medium_office.zip} +0 -0
  8. data/spec/files/discrete_dynamic_columns.xlsx +0 -0
  9. data/spec/files/discrete_variables.xlsx +0 -0
  10. data/spec/files/template_0_2_0.xlsx +0 -0
  11. data/spec/files/~$template_0_2_0.xlsx +0 -0
  12. data/spec/files/~$template_input_0.1.10.xlsx +0 -0
  13. data/spec/openstudio/analysis/translator/excel_spec.rb +299 -272
  14. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.62.xml +9 -0
  15. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.63.xml +9 -0
  16. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.62.xml +9 -0
  17. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.63.xml +9 -0
  18. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.62.xml +7 -0
  19. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.63.xml +7 -0
  20. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.20.xml +33 -0
  21. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.21.xml +18 -0
  22. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.4.xml +33 -0
  23. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.5.xml +17 -0
  24. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.62.xml +20 -0
  25. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.63.xml +20 -0
  26. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.28.xml +9 -0
  27. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.29.xml +9 -0
  28. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.34.xml +9 -0
  29. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.35.xml +9 -0
  30. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.14.xml +36 -0
  31. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.15.xml +36 -0
  32. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.11.xml +21 -0
  33. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.12.xml +21 -0
  34. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.62.xml +9 -0
  35. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.63.xml +9 -0
  36. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.62.xml +9 -0
  37. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.63.xml +9 -0
  38. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.62.xml +23 -0
  39. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.63.xml +23 -0
  40. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.62.xml +9 -0
  41. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.63.xml +9 -0
  42. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.11.xml +13 -0
  43. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.12.xml +13 -0
  44. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.62.xml +7 -0
  45. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.63.xml +7 -0
  46. metadata +76 -22
  47. data/spec/files/export/analysis/discrete_dynamic_seed.json +0 -445
  48. data/spec/files/export/analysis/discrete_dynamic_seed.zip +0 -0
  49. data/spec/files/export/analysis/discrete_seed.json +0 -712
  50. data/spec/files/export/analysis/discrete_seed.zip +0 -0
  51. data/spec/files/export/analysis/medium_office.json +0 -648
  52. data/spec/files/export/analysis/medium_office.zip +0 -0
  53. data/spec/files/export/analysis/output_vars.json +0 -707
  54. data/spec/files/export/analysis/small_seed.json +0 -665
  55. data/spec/files/export/analysis/small_seed.zip +0 -0
Binary file
Binary file
Binary file
@@ -1,288 +1,315 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OpenStudio::Analysis::Translator::Excel do
4
- context "no variables defined" do
5
- let(:path) { "spec/files/no_variables.xlsx" }
6
-
7
- before(:each) do
8
- @excel = OpenStudio::Analysis::Translator::Excel.new(path)
9
- end
10
-
11
- it "should have measure path" do
12
- expect(@excel.measure_path).to eq("./measures")
13
- end
14
-
15
- it "should have excel data" do
16
- puts @excel
17
- expect(@excel).not_to be_nil
18
- end
19
-
20
- it "should process the excel file" do
21
- expect(@excel.process).to eq(true)
22
-
23
- # after processing the measures directory should be what is in the excel file
24
- expect(@excel.measure_path).to eq(File.expand_path(File.join("spec", "files", "measures")))
25
- end
26
-
27
- it "should not work because no variables defined" do
28
- #old_path = @excel.measure_path
29
- #@excel.measure_path = "path/does/not/exist"
30
- #
31
- end
32
-
33
- it "should not export to a JSON" do
34
- @excel.process
35
- expect { @excel.save_analysis }.to raise_error("Argument 'r_value' did not process. Most likely it did not have all parameters defined.")
36
- end
37
- end
38
-
39
- context "small list of incomplete variables" do
40
- before(:all) do
41
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_incomplete.xlsx")
42
- end
43
-
44
- it "should fail to process" do
45
- expect { @excel.process }.to raise_error("Variable adjust_thermostat_setpoints_by_degrees:cooling_adjustment must have a mean")
46
- end
47
- end
48
-
49
- context "small list with with repeated variable names" do
50
- before(:all) do
51
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_repeat_vars.xlsx")
52
- end
53
-
54
- it "should fail to process" do
55
- expect { @excel.process }.to raise_error("duplicate variable names found in list [\"Insulation R-value (ft^2*h*R/Btu).\"]")
56
- end
57
- end
58
-
59
- context "small list of variables should not validate" do
60
- before(:all) do
61
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_validation_errors.xlsx")
62
- end
63
-
64
- it "should fail to process" do
65
- expect { @excel.process }.to raise_error("Variable min is greater than variable max for adjust_thermostat_setpoints_by_degrees:heating_adjustment")
66
- end
67
- end
68
-
69
- context "small list of variables" do
70
- before(:all) do
71
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list.xlsx")
72
- @excel.process
73
- end
74
- it "should have a model" do
75
- expect(@excel.models.first).not_to be_nil
76
- expect(@excel.models.first[:name]).to eq("small_seed")
77
- end
78
-
79
- it "should have a weather file" do
80
- expect(@excel.weather_files.first).not_to be_nil
81
- puts @excel.weather_files.first
82
- expect(@excel.weather_files.first.include?("partial_weather.epw")).to eq(true)
83
- end
84
-
85
- it "should have notes and source" do
86
- @excel.variables['data'].each do |measure|
87
- measure['variables'].each do |var|
88
- if var['machine_name'] == 'lighting_power_reduction'
89
- expect(var['distribution']['source']).to eq("some data source")
90
- elsif var['machine_name'] == 'demo_cost_initial_const'
91
- expect(var['notes']).to eq("some note")
92
- end
93
- end
94
- end
95
- end
96
-
97
- it "should write a json" do
98
- @excel.save_analysis
99
- expect(File).to exist("spec/files/export/analysis/small_seed.json")
100
- expect(File).to exist("spec/files/export/analysis/small_seed.zip")
101
-
102
- expect(JSON.parse(File.read("spec/files/export/analysis/small_seed.json"))).not_to be_nil
103
-
104
- end
105
- end
106
-
107
- context "setup version 0.1.9" do
108
- before(:all) do
109
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/setup_version_2.xlsx")
110
- @excel.process
111
- end
112
-
113
- it "should have a version and machine name" do
114
- expect(@excel.version).to eq("0.1.9")
115
- expect(@excel.machine_name).to eq("example_analysis")
116
- end
117
- it "should have the new settings" do
118
- expect(@excel.settings["server_instance_type"]).to eq("m2.xlarge")
119
- end
120
-
121
- it "should have algorithm setup" do
122
- expect(@excel.algorithm["number_of_samples"]).to eq(100)
123
- expect(@excel.algorithm["number_of_generations"]).to eq(20)
124
- expect(@excel.algorithm["sample_method"]).to eq("all_variables")
125
- expect(@excel.algorithm["number_of_generations"]).to be_a Integer
126
- expect(@excel.algorithm["tolerance"]).to eq(0.115)
127
- expect(@excel.algorithm["tolerance"]).to be_a Float
128
-
129
- end
130
-
131
- it "should create a valid hash" do
132
- h = @excel.create_analysis_hash
133
-
134
- expect(h['analysis']['problem']['analysis_type']).to eq("lhs")
135
- expect(h['analysis']['problem']['algorithm']).not_to be_nil
136
- expect(h['analysis']['problem']['algorithm']['number_of_samples']).to eq(100)
137
- expect(h['analysis']['problem']['algorithm']['sample_method']).to eq("all_variables")
138
- end
139
- end
140
-
141
- context "proxy setup" do
142
- before(:all) do
143
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/proxy.xlsx")
144
- @excel.process
145
- end
146
-
147
- it "should have a proxy setting" do
148
- expect(@excel.settings["proxy_host"]).to eq("192.168.0.1")
149
- expect(@excel.settings["proxy_port"]).to eq(8080)
150
- expect(@excel.settings["proxy_username"]).to be_nil
151
-
152
- end
153
- end
154
-
155
- context "proxy setup with user" do
156
- before(:all) do
157
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/proxy_user.xlsx")
158
- @excel.process
159
- end
160
-
161
- it "should have a user" do
162
- expect(@excel.settings["proxy_host"]).to eq("192.168.0.1")
163
- expect(@excel.settings["proxy_port"]).to eq(8080)
164
- expect(@excel.settings["proxy_username"]).to eq("a_user")
165
- end
166
- end
167
-
168
- context "discrete variables" do
169
- before(:all) do
170
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/discrete_variables.xlsx")
171
- @excel.process
172
- end
173
-
174
- it "should have parsed the spreadsheet" do
175
- @excel.variables['data'].each do |measure|
176
- measure['variables'].each do |var|
177
-
178
- end
179
- end
180
- end
181
-
182
- it "should save the file" do
183
- @excel.save_analysis
184
- end
185
- end
186
-
187
- context "discrete with dynamic columns" do
188
- before(:all) do
189
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/discrete_dynamic_columns.xlsx")
190
- @excel.process
191
- end
192
-
193
- it "should have parsed the spreadsheet" do
194
- @excel.variables['data'].each do |measure|
195
- measure['variables'].each do |var|
196
- puts var.inspect
197
- end
198
- end
199
- end
200
-
201
- it "should save the file" do
202
- @excel.save_analysis
203
- end
204
- end
205
-
206
- context "setup output variables" do
207
- before(:all) do
208
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/outputvars.xlsx")
209
- @excel.process
210
- end
211
-
212
- it "should have a model" do
213
- expect(@excel.models.first).not_to be_nil
214
- expect(@excel.models.first[:name]).to eq("output_vars")
215
- end
216
-
217
- it "should have a weather file" do
218
- expect(@excel.weather_files.first).not_to be_nil
219
- puts @excel.weather_files.first
220
- expect(@excel.weather_files.first.include?("partial_weather.epw")).to eq(true)
221
- end
222
-
223
- it "should have notes and source" do
224
- @excel.variables['data'].each do |measure|
225
- measure['variables'].each do |var|
226
- if var['machine_name'] == 'lighting_power_reduction'
227
- expect(var['distribution']['source']).to eq("some data source")
228
- elsif var['machine_name'] == 'demo_cost_initial_const'
229
- expect(var['notes']).to eq("some note")
230
- end
231
- end
232
- end
233
- end
234
-
235
- it "should have typed booleans" do
236
- expect(@excel.run_setup['use_server_as_worker']).to eq(true)
237
- expect(@excel.run_setup['allow_multiple_jobs']).to eq(true)
238
- end
239
-
240
- it "should have algorithm setup" do
241
- expect(@excel.algorithm["number_of_samples"]).to eq(100)
242
- expect(@excel.algorithm["number_of_generations"]).to eq(20)
243
- expect(@excel.algorithm["sample_method"]).to eq("all_variables")
244
- expect(@excel.algorithm["number_of_generations"]).to be_a Integer
245
- #expect(@excel.algorithm["tolerance"]).to eq(0.115)
246
- #expect(@excel.algorithm["tolerance"]).to be_a Float
247
-
248
- end
249
-
250
- it "should create a valid hash" do
251
- h = @excel.create_analysis_hash
252
-
253
- expect(h['analysis']['problem']['analysis_type']).to eq("nsga")
254
- expect(h['analysis']['problem']['algorithm']).not_to be_nil
255
- expect(h['analysis']['problem']['algorithm']['number_of_samples']).to eq(100)
256
- expect(h['analysis']['problem']['algorithm']['sample_method']).to eq("all_variables")
257
- end
258
-
259
-
260
- it "should write a json" do
261
- @excel.save_analysis
262
- expect(File).to exist("spec/files/export/analysis/output_vars.json")
263
- expect(File).to exist("spec/files/export/analysis/output_vars.zip")
264
-
265
- expect(JSON.parse(File.read("spec/files/export/analysis/output_vars.json"))).not_to be_nil
266
-
267
- end
268
- end
269
-
270
- context "version 0.1.10" do
4
+ #context "no variables defined" do
5
+ # let(:path) { "spec/files/no_variables.xlsx" }
6
+ #
7
+ # before(:each) do
8
+ # @excel = OpenStudio::Analysis::Translator::Excel.new(path)
9
+ # end
10
+ #
11
+ # it "should have measure path" do
12
+ # expect(@excel.measure_path).to eq("./measures")
13
+ # end
14
+ #
15
+ # it "should have excel data" do
16
+ # puts @excel
17
+ # expect(@excel).not_to be_nil
18
+ # end
19
+ #
20
+ # it "should process the excel file" do
21
+ # expect(@excel.process).to eq(true)
22
+ #
23
+ # # after processing the measures directory should be what is in the excel file
24
+ # expect(@excel.measure_path).to eq(File.expand_path(File.join("spec", "files", "measures")))
25
+ # end
26
+ #
27
+ # it "should not work because no variables defined" do
28
+ # #old_path = @excel.measure_path
29
+ # #@excel.measure_path = "path/does/not/exist"
30
+ # #
31
+ # end
32
+ #
33
+ # it "should not export to a JSON" do
34
+ # @excel.process
35
+ # expect { @excel.save_analysis }.to raise_error("Argument 'r_value' did not process. Most likely it did not have all parameters defined.")
36
+ # end
37
+ #end
38
+ #
39
+ #context "small list of incomplete variables" do
40
+ # before(:all) do
41
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_incomplete.xlsx")
42
+ # end
43
+ #
44
+ # it "should fail to process" do
45
+ # expect { @excel.process }.to raise_error("Variable adjust_thermostat_setpoints_by_degrees:cooling_adjustment must have a mean")
46
+ # end
47
+ #end
48
+ #
49
+ #context "small list with with repeated variable names" do
50
+ # before(:all) do
51
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_repeat_vars.xlsx")
52
+ # end
53
+ #
54
+ # it "should fail to process" do
55
+ # expect { @excel.process }.to raise_error("duplicate variable names found in list [\"Insulation R-value (ft^2*h*R/Btu).\"]")
56
+ # end
57
+ #end
58
+ #
59
+ #context "small list of variables should not validate" do
60
+ # before(:all) do
61
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_validation_errors.xlsx")
62
+ # end
63
+ #
64
+ # it "should fail to process" do
65
+ # expect { @excel.process }.to raise_error("Variable min is greater than variable max for adjust_thermostat_setpoints_by_degrees:heating_adjustment")
66
+ # end
67
+ #end
68
+ #
69
+ #context "small list of variables" do
70
+ # before(:all) do
71
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list.xlsx")
72
+ # @excel.process
73
+ # end
74
+ # it "should have a model" do
75
+ # expect(@excel.models.first).not_to be_nil
76
+ # expect(@excel.models.first[:name]).to eq("small_seed")
77
+ # end
78
+ #
79
+ # it "should have a weather file" do
80
+ # expect(@excel.weather_files.first).not_to be_nil
81
+ # puts @excel.weather_files.first
82
+ # expect(@excel.weather_files.first.include?("partial_weather.epw")).to eq(true)
83
+ # end
84
+ #
85
+ # it "should have notes and source" do
86
+ # @excel.variables['data'].each do |measure|
87
+ # measure['variables'].each do |var|
88
+ # if var['machine_name'] == 'lighting_power_reduction'
89
+ # expect(var['distribution']['source']).to eq("some data source")
90
+ # elsif var['machine_name'] == 'demo_cost_initial_const'
91
+ # expect(var['notes']).to eq("some note")
92
+ # end
93
+ # end
94
+ # end
95
+ # end
96
+ #
97
+ # it "should write a json" do
98
+ # @excel.save_analysis
99
+ # expect(File).to exist("spec/files/export/analysis/small_seed.json")
100
+ # expect(File).to exist("spec/files/export/analysis/small_seed.zip")
101
+ #
102
+ # expect(JSON.parse(File.read("spec/files/export/analysis/small_seed.json"))).not_to be_nil
103
+ #
104
+ # end
105
+ #end
106
+ #
107
+ #context "setup version 0.1.9" do
108
+ # before(:all) do
109
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/setup_version_2.xlsx")
110
+ # @excel.process
111
+ # end
112
+ #
113
+ # it "should have a version and machine name" do
114
+ # expect(@excel.version).to eq("0.1.9")
115
+ # expect(@excel.machine_name).to eq("example_analysis")
116
+ # end
117
+ # it "should have the new settings" do
118
+ # expect(@excel.settings["server_instance_type"]).to eq("m2.xlarge")
119
+ # end
120
+ #
121
+ # it "should have algorithm setup" do
122
+ # expect(@excel.algorithm["number_of_samples"]).to eq(100)
123
+ # expect(@excel.algorithm["number_of_generations"]).to eq(20)
124
+ # expect(@excel.algorithm["sample_method"]).to eq("all_variables")
125
+ # expect(@excel.algorithm["number_of_generations"]).to be_a Integer
126
+ # expect(@excel.algorithm["tolerance"]).to eq(0.115)
127
+ # expect(@excel.algorithm["tolerance"]).to be_a Float
128
+ #
129
+ # end
130
+ #
131
+ # it "should create a valid hash" do
132
+ # h = @excel.create_analysis_hash
133
+ #
134
+ # expect(h['analysis']['problem']['analysis_type']).to eq("lhs")
135
+ # expect(h['analysis']['problem']['algorithm']).not_to be_nil
136
+ # expect(h['analysis']['problem']['algorithm']['number_of_samples']).to eq(100)
137
+ # expect(h['analysis']['problem']['algorithm']['sample_method']).to eq("all_variables")
138
+ # end
139
+ #end
140
+ #
141
+ #context "proxy setup" do
142
+ # before(:all) do
143
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/proxy.xlsx")
144
+ # @excel.process
145
+ # end
146
+ #
147
+ # it "should have a proxy setting" do
148
+ # expect(@excel.settings["proxy_host"]).to eq("192.168.0.1")
149
+ # expect(@excel.settings["proxy_port"]).to eq(8080)
150
+ # expect(@excel.settings["proxy_username"]).to be_nil
151
+ #
152
+ # end
153
+ #end
154
+ #
155
+ #context "proxy setup with user" do
156
+ # before(:all) do
157
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/proxy_user.xlsx")
158
+ # @excel.process
159
+ # end
160
+ #
161
+ # it "should have a user" do
162
+ # expect(@excel.settings["proxy_host"]).to eq("192.168.0.1")
163
+ # expect(@excel.settings["proxy_port"]).to eq(8080)
164
+ # expect(@excel.settings["proxy_username"]).to eq("a_user")
165
+ # end
166
+ #end
167
+ #
168
+ #context "discrete variables" do
169
+ # before(:all) do
170
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/discrete_variables.xlsx")
171
+ # @excel.process
172
+ # end
173
+ #
174
+ # it "should have parsed the spreadsheet" do
175
+ # @excel.variables['data'].each do |measure|
176
+ # measure['variables'].each do |var|
177
+ #
178
+ # end
179
+ # end
180
+ # end
181
+ #
182
+ # it "should save the file" do
183
+ # @excel.save_analysis
184
+ # end
185
+ #end
186
+ #
187
+ #context "discrete with dynamic columns" do
188
+ # before(:all) do
189
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/discrete_dynamic_columns.xlsx")
190
+ # @excel.process
191
+ # end
192
+ #
193
+ # it "should have parsed the spreadsheet" do
194
+ # @excel.variables['data'].each do |measure|
195
+ # measure['variables'].each do |var|
196
+ # puts var.inspect
197
+ # end
198
+ # end
199
+ # end
200
+ #
201
+ # it "should save the file" do
202
+ # @excel.save_analysis
203
+ # end
204
+ #end
205
+ #
206
+ #context "setup output variables" do
207
+ # before(:all) do
208
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/outputvars.xlsx")
209
+ # @excel.process
210
+ # end
211
+ #
212
+ # it "should have a model" do
213
+ # expect(@excel.models.first).not_to be_nil
214
+ # expect(@excel.models.first[:name]).to eq("output_vars")
215
+ # end
216
+ #
217
+ # it "should have a weather file" do
218
+ # expect(@excel.weather_files.first).not_to be_nil
219
+ # puts @excel.weather_files.first
220
+ # expect(@excel.weather_files.first.include?("partial_weather.epw")).to eq(true)
221
+ # end
222
+ #
223
+ # it "should have notes and source" do
224
+ # @excel.variables['data'].each do |measure|
225
+ # measure['variables'].each do |var|
226
+ # if var['machine_name'] == 'lighting_power_reduction'
227
+ # expect(var['distribution']['source']).to eq("some data source")
228
+ # elsif var['machine_name'] == 'demo_cost_initial_const'
229
+ # expect(var['notes']).to eq("some note")
230
+ # end
231
+ # end
232
+ # end
233
+ # end
234
+ #
235
+ # it "should have typed booleans" do
236
+ # expect(@excel.run_setup['use_server_as_worker']).to eq(true)
237
+ # expect(@excel.run_setup['allow_multiple_jobs']).to eq(true)
238
+ # end
239
+ #
240
+ # it "should have algorithm setup" do
241
+ # expect(@excel.algorithm["number_of_samples"]).to eq(100)
242
+ # expect(@excel.algorithm["number_of_generations"]).to eq(20)
243
+ # expect(@excel.algorithm["sample_method"]).to eq("all_variables")
244
+ # expect(@excel.algorithm["number_of_generations"]).to be_a Integer
245
+ # #expect(@excel.algorithm["tolerance"]).to eq(0.115)
246
+ # #expect(@excel.algorithm["tolerance"]).to be_a Float
247
+ #
248
+ # end
249
+ #
250
+ # it "should create a valid hash" do
251
+ # h = @excel.create_analysis_hash
252
+ #
253
+ # expect(h['analysis']['problem']['analysis_type']).to eq("nsga")
254
+ # expect(h['analysis']['problem']['algorithm']).not_to be_nil
255
+ # expect(h['analysis']['problem']['algorithm']['number_of_samples']).to eq(100)
256
+ # expect(h['analysis']['problem']['algorithm']['sample_method']).to eq("all_variables")
257
+ # end
258
+ #
259
+ #
260
+ # it "should write a json" do
261
+ # @excel.save_analysis
262
+ # expect(File).to exist("spec/files/export/analysis/output_vars.json")
263
+ # expect(File).to exist("spec/files/export/analysis/output_vars.zip")
264
+ #
265
+ # expect(JSON.parse(File.read("spec/files/export/analysis/output_vars.json"))).not_to be_nil
266
+ #
267
+ # end
268
+ #end
269
+ #
270
+ #context "version 0.1.10" do
271
+ # before(:all) do
272
+ # @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/template_input_0.1.10.xlsx")
273
+ # end
274
+ #
275
+ # it "should process" do
276
+ # expect(@excel.process).to eq(true)
277
+ # end
278
+ #
279
+ # it "should have new setting variables" do
280
+ # puts @excel.settings.inspect
281
+ # expect(@excel.settings["user_id"]).to eq('new_user')
282
+ # expect(@excel.settings["openstudio_server_version"]).to eq('1.3.2')
283
+ # expect(@excel.cluster_name).to eq('analysis_cluster')
284
+ # puts @excel.run_setup.inspect
285
+ # expect(@excel.run_setup["analysis_name"]).to eq('LHS Example Project')
286
+ # end
287
+ #end
288
+
289
+ context "version 0.2.0" do
271
290
  before(:all) do
272
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/template_input_0.1.10.xlsx")
291
+ @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/template_0_2_0.xlsx")
273
292
  end
274
-
293
+
275
294
  it "should process" do
276
295
  expect(@excel.process).to eq(true)
277
296
  end
278
-
297
+
279
298
  it "should have new setting variables" do
280
299
  puts @excel.settings.inspect
281
300
  expect(@excel.settings["user_id"]).to eq('new_user')
282
301
  expect(@excel.settings["openstudio_server_version"]).to eq('1.3.2')
283
- expect(@excel.cluster_name).to eq('analysis_cluster')
302
+ expect(@excel.cluster_name).to eq('analysis_cluster_name')
284
303
  puts @excel.run_setup.inspect
285
- expect(@excel.run_setup["analysis_name"]).to eq('LHS Example Project')
304
+ expect(@excel.run_setup["analysis_name"]).to eq('Name goes here')
305
+ end
306
+
307
+ it "should have the new measure directory column" do
308
+ expect(@excel.variables['data'][1]['measure_file_name_directory']).to eq('ReduceLightingLoadsByPercentage')
309
+ end
310
+
311
+ it "should write a json" do
312
+ @excel.save_analysis
286
313
  end
287
314
  end
288
315