openstudio-analysis 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openstudio/analysis/server_api.rb +59 -62
  3. data/lib/openstudio/analysis/translator/excel.rb +186 -189
  4. data/lib/openstudio/analysis/version.rb +1 -1
  5. data/lib/openstudio/helpers/string.rb +4 -5
  6. data/spec/files/analysis/medium_office.json +192 -192
  7. data/spec/files/analysis/medium_office.zip +0 -0
  8. data/spec/files/export/analysis/Kats model v2.json +16 -16
  9. data/spec/files/export/analysis/Kats model v2.zip +0 -0
  10. data/spec/files/export/analysis/discrete_dynamic_seed.json +16 -16
  11. data/spec/files/export/analysis/discrete_dynamic_seed.zip +0 -0
  12. data/spec/files/export/analysis/discrete_seed.json +91 -91
  13. data/spec/files/export/analysis/discrete_seed.zip +0 -0
  14. data/spec/files/export/analysis/output_vars.json +83 -83
  15. data/spec/files/export/analysis/output_vars.zip +0 -0
  16. data/spec/files/export/analysis/small_seed.json +83 -83
  17. data/spec/files/export/analysis/small_seed.zip +0 -0
  18. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.rb +372 -375
  19. data/spec/openstudio/analysis/server_api_spec.rb +6 -6
  20. data/spec/openstudio/analysis/translator/excel_spec.rb +182 -188
  21. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.65.xml +9 -0
  22. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.66.xml +9 -0
  23. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.67.xml +9 -0
  24. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.65.xml +9 -0
  25. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.66.xml +9 -0
  26. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.67.xml +9 -0
  27. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.65.xml +7 -0
  28. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.66.xml +7 -0
  29. data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.67.xml +7 -0
  30. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.23.xml +18 -0
  31. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.24.xml +18 -0
  32. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.25.xml +18 -0
  33. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.7.xml +17 -0
  34. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.8.xml +17 -0
  35. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.9.xml +17 -0
  36. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.65.xml +20 -0
  37. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.66.xml +20 -0
  38. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.67.xml +20 -0
  39. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.31.xml +9 -0
  40. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.32.xml +9 -0
  41. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.33.xml +9 -0
  42. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.37.xml +9 -0
  43. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.38.xml +9 -0
  44. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.39.xml +9 -0
  45. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.17.xml +36 -0
  46. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.18.xml +36 -0
  47. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.19.xml +36 -0
  48. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.14.xml +21 -0
  49. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.15.xml +21 -0
  50. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.16.xml +21 -0
  51. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.65.xml +9 -0
  52. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.66.xml +9 -0
  53. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.67.xml +9 -0
  54. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.65.xml +9 -0
  55. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.66.xml +9 -0
  56. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.67.xml +9 -0
  57. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.65.xml +23 -0
  58. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.66.xml +23 -0
  59. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.67.xml +23 -0
  60. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.65.xml +9 -0
  61. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.66.xml +9 -0
  62. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.67.xml +9 -0
  63. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.14.xml +13 -0
  64. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.15.xml +13 -0
  65. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.16.xml +13 -0
  66. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.0.xml +19 -0
  67. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.1.xml +19 -0
  68. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0-simple.xml +19 -0
  69. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.0.xml +32 -0
  70. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.1.xml +32 -0
  71. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-2-0.2.xml +32 -0
  72. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.65.xml +7 -0
  73. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.66.xml +7 -0
  74. data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.67.xml +7 -0
  75. data/spec/spec_helper.rb +1 -3
  76. metadata +127 -19
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OpenStudio::Analysis::ServerApi do
4
- context "create a new localhost instance" do
4
+ context 'create a new localhost instance' do
5
5
  before(:all) do
6
6
  @api = OpenStudio::Analysis::ServerApi.new
7
7
  end
8
8
 
9
- it "should set the default host to localhost" do
10
- expect(@api.hostname).to eq("http://localhost:8080")
9
+ it 'should set the default host to localhost' do
10
+ expect(@api.hostname).to eq('http://localhost:8080')
11
11
  end
12
12
  end
13
13
 
14
- context "test not localhost" do
15
- it "should have a not localhost URL" do
16
- options = {hostname: "http://abc.def.ghi"}
14
+ context 'test not localhost' do
15
+ it 'should have a not localhost URL' do
16
+ options = { hostname: 'http://abc.def.ghi' }
17
17
  api = OpenStudio::Analysis::ServerApi.new(options)
18
18
  expect(api.hostname).to eq(options[:hostname])
19
19
  end
@@ -1,347 +1,341 @@
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
-
4
+ context 'no variables defined' do
5
+ let(:path) { 'spec/files/no_variables.xlsx' }
6
+
7
7
  before(:each) do
8
8
  @excel = OpenStudio::Analysis::Translator::Excel.new(path)
9
9
  end
10
-
11
- it "should have measure path" do
12
- expect(@excel.measure_path).to eq("./measures")
10
+
11
+ it 'should have measure path' do
12
+ expect(@excel.measure_path).to eq('./measures')
13
13
  end
14
-
15
- it "should have excel data" do
14
+
15
+ it 'should have excel data' do
16
16
  puts @excel
17
17
  expect(@excel).not_to be_nil
18
18
  end
19
-
20
- it "should process the excel file" do
19
+
20
+ it 'should process the excel file' do
21
21
  expect(@excel.process).to eq(true)
22
-
22
+
23
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")))
24
+ expect(@excel.measure_path).to eq(File.expand_path(File.join('spec', 'files', 'measures')))
25
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"
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
30
  #
31
31
  end
32
-
33
- it "should not export to a JSON" do
32
+
33
+ it 'should not export to a JSON' do
34
34
  @excel.process
35
35
  expect { @excel.save_analysis }.to raise_error("Argument 'r_value' did not process. Most likely it did not have all parameters defined.")
36
36
  end
37
37
  end
38
-
39
- context "small list of incomplete variables" do
38
+
39
+ context 'small list of incomplete variables' do
40
40
  before(:all) do
41
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_incomplete.xlsx")
41
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/small_list_incomplete.xlsx')
42
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")
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
46
  end
47
47
  end
48
-
49
- context "small list with with repeated variable names" do
48
+
49
+ context 'small list with with repeated variable names' do
50
50
  before(:all) do
51
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_repeat_vars.xlsx")
51
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/small_list_repeat_vars.xlsx')
52
52
  end
53
-
54
- it "should fail to process" do
53
+
54
+ it 'should fail to process' do
55
55
  expect { @excel.process }.to raise_error("duplicate variable names found in list [\"Insulation R-value (ft^2*h*R/Btu).\"]")
56
56
  end
57
57
  end
58
-
59
- context "small list of variables should not validate" do
58
+
59
+ context 'small list of variables should not validate' do
60
60
  before(:all) do
61
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list_validation_errors.xlsx")
61
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/small_list_validation_errors.xlsx')
62
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")
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
66
  end
67
67
  end
68
-
69
- context "small list of variables" do
68
+
69
+ context 'small list of variables' do
70
70
  before(:all) do
71
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/small_list.xlsx")
71
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/small_list.xlsx')
72
72
  @excel.process
73
73
  end
74
- it "should have a model" do
74
+ it 'should have a model' do
75
75
  expect(@excel.models.first).not_to be_nil
76
- expect(@excel.models.first[:name]).to eq("small_seed")
76
+ expect(@excel.models.first[:name]).to eq('small_seed')
77
77
  end
78
-
79
- it "should have a weather file" do
78
+
79
+ it 'should have a weather file' do
80
80
  expect(@excel.weather_files.first).not_to be_nil
81
81
  puts @excel.weather_files.first
82
- expect(@excel.weather_files.first.include?("partial_weather.epw")).to eq(true)
82
+ expect(@excel.weather_files.first.include?('partial_weather.epw')).to eq(true)
83
83
  end
84
-
85
- it "should have notes and source" do
84
+
85
+ it 'should have notes and source' do
86
86
  @excel.variables['data'].each do |measure|
87
87
  measure['variables'].each do |var|
88
88
  if var['machine_name'] == 'lighting_power_reduction'
89
- expect(var['distribution']['source']).to eq("some data source")
89
+ expect(var['distribution']['source']).to eq('some data source')
90
90
  elsif var['machine_name'] == 'demo_cost_initial_const'
91
- expect(var['notes']).to eq("some note")
91
+ expect(var['notes']).to eq('some note')
92
92
  end
93
93
  end
94
94
  end
95
95
  end
96
-
97
- it "should write a json" do
96
+
97
+ it 'should write a json' do
98
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
-
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
104
  end
105
105
  end
106
-
107
- context "setup version 0.1.9" do
106
+
107
+ context 'setup version 0.1.9' do
108
108
  before(:all) do
109
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/setup_version_2.xlsx")
109
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/setup_version_2.xlsx')
110
110
  @excel.process
111
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
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
132
  h = @excel.create_analysis_hash
133
-
134
- expect(h['analysis']['problem']['analysis_type']).to eq("lhs")
133
+
134
+ expect(h['analysis']['problem']['analysis_type']).to eq('lhs')
135
135
  expect(h['analysis']['problem']['algorithm']).not_to be_nil
136
136
  expect(h['analysis']['problem']['algorithm']['number_of_samples']).to eq(100)
137
- expect(h['analysis']['problem']['algorithm']['sample_method']).to eq("all_variables")
137
+ expect(h['analysis']['problem']['algorithm']['sample_method']).to eq('all_variables')
138
138
  end
139
139
  end
140
-
141
- context "proxy setup" do
140
+
141
+ context 'proxy setup' do
142
142
  before(:all) do
143
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/proxy.xlsx")
143
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/proxy.xlsx')
144
144
  @excel.process
145
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
-
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
152
  end
153
153
  end
154
-
155
- context "proxy setup with user" do
154
+
155
+ context 'proxy setup with user' do
156
156
  before(:all) do
157
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/proxy_user.xlsx")
157
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/proxy_user.xlsx')
158
158
  @excel.process
159
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")
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
165
  end
166
166
  end
167
-
168
- context "discrete variables" do
167
+
168
+ context 'discrete variables' do
169
169
  before(:all) do
170
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/discrete_variables.xlsx")
170
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/discrete_variables.xlsx')
171
171
  @excel.process
172
172
  end
173
-
174
- it "should have parsed the spreadsheet" do
173
+
174
+ it 'should have parsed the spreadsheet' do
175
175
  @excel.variables['data'].each do |measure|
176
176
  measure['variables'].each do |var|
177
-
177
+
178
178
  end
179
179
  end
180
180
  end
181
-
182
- it "should save the file" do
181
+
182
+ it 'should save the file' do
183
183
  @excel.save_analysis
184
184
  end
185
185
  end
186
-
187
- context "discrete with dynamic columns" do
186
+
187
+ context 'discrete with dynamic columns' do
188
188
  before(:all) do
189
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/discrete_dynamic_columns.xlsx")
189
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/discrete_dynamic_columns.xlsx')
190
190
  @excel.process
191
191
  end
192
-
193
- it "should have parsed the spreadsheet" do
192
+
193
+ it 'should have parsed the spreadsheet' do
194
194
  @excel.variables['data'].each do |measure|
195
195
  measure['variables'].each do |var|
196
196
  puts var.inspect
197
197
  end
198
198
  end
199
199
  end
200
-
201
- it "should save the file" do
200
+
201
+ it 'should save the file' do
202
202
  @excel.save_analysis
203
203
  end
204
204
  end
205
-
206
- context "setup output variables" do
205
+
206
+ context 'setup output variables' do
207
207
  before(:all) do
208
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/outputvars.xlsx")
208
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/outputvars.xlsx')
209
209
  @excel.process
210
210
  end
211
-
212
- it "should have a model" do
211
+
212
+ it 'should have a model' do
213
213
  expect(@excel.models.first).not_to be_nil
214
- expect(@excel.models.first[:name]).to eq("output_vars")
214
+ expect(@excel.models.first[:name]).to eq('output_vars')
215
215
  end
216
-
217
- it "should have a weather file" do
216
+
217
+ it 'should have a weather file' do
218
218
  expect(@excel.weather_files.first).not_to be_nil
219
219
  puts @excel.weather_files.first
220
- expect(@excel.weather_files.first.include?("partial_weather.epw")).to eq(true)
220
+ expect(@excel.weather_files.first.include?('partial_weather.epw')).to eq(true)
221
221
  end
222
-
223
- it "should have notes and source" do
222
+
223
+ it 'should have notes and source' do
224
224
  @excel.variables['data'].each do |measure|
225
225
  measure['variables'].each do |var|
226
226
  if var['machine_name'] == 'lighting_power_reduction'
227
- expect(var['distribution']['source']).to eq("some data source")
227
+ expect(var['distribution']['source']).to eq('some data source')
228
228
  elsif var['machine_name'] == 'demo_cost_initial_const'
229
- expect(var['notes']).to eq("some note")
229
+ expect(var['notes']).to eq('some note')
230
230
  end
231
231
  end
232
232
  end
233
233
  end
234
-
235
- it "should have typed booleans" do
234
+
235
+ it 'should have typed booleans' do
236
236
  expect(@excel.run_setup['use_server_as_worker']).to eq(true)
237
237
  expect(@excel.run_setup['allow_multiple_jobs']).to eq(true)
238
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
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
251
  h = @excel.create_analysis_hash
252
-
253
- expect(h['analysis']['problem']['analysis_type']).to eq("nsga")
252
+
253
+ expect(h['analysis']['problem']['analysis_type']).to eq('nsga')
254
254
  expect(h['analysis']['problem']['algorithm']).not_to be_nil
255
255
  expect(h['analysis']['problem']['algorithm']['number_of_samples']).to eq(100)
256
- expect(h['analysis']['problem']['algorithm']['sample_method']).to eq("all_variables")
256
+ expect(h['analysis']['problem']['algorithm']['sample_method']).to eq('all_variables')
257
257
  end
258
-
259
-
260
- it "should write a json" do
258
+
259
+ it 'should write a json' do
261
260
  @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
-
261
+ expect(File).to exist('spec/files/export/analysis/output_vars.json')
262
+ expect(File).to exist('spec/files/export/analysis/output_vars.zip')
263
+
264
+ expect(JSON.parse(File.read('spec/files/export/analysis/output_vars.json'))).not_to be_nil
265
+
267
266
  end
268
267
  end
269
-
270
- context "version 0.1.10" do
268
+
269
+ context 'version 0.1.10' do
271
270
  before(:all) do
272
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/template_input_0.1.10.xlsx")
271
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/template_input_0.1.10.xlsx')
273
272
  end
274
-
275
- it "should process" do
273
+
274
+ it 'should process' do
276
275
  expect(@excel.process).to eq(true)
277
276
  end
278
-
279
- it "should have new setting variables" do
277
+
278
+ it 'should have new setting variables' do
280
279
  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')
280
+ expect(@excel.settings['user_id']).to eq('new_user')
281
+ expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
283
282
  expect(@excel.cluster_name).to eq('analysis_cluster')
284
283
  puts @excel.run_setup.inspect
285
- expect(@excel.run_setup["analysis_name"]).to eq('LHS Example Project')
284
+ expect(@excel.run_setup['analysis_name']).to eq('LHS Example Project')
286
285
  end
287
286
  end
288
-
289
- context "version 0.2.0" do
287
+
288
+ context 'version 0.2.0' do
290
289
  before(:all) do
291
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/template_0_2_0.xlsx")
290
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/template_0_2_0.xlsx')
292
291
  end
293
-
294
- it "should process" do
292
+
293
+ it 'should process' do
295
294
  expect(@excel.process).to eq(true)
296
295
  end
297
-
298
- it "should have new setting variables" do
296
+
297
+ it 'should have new setting variables' do
299
298
  puts @excel.settings.inspect
300
- expect(@excel.settings["user_id"]).to eq('new_user')
301
- expect(@excel.settings["openstudio_server_version"]).to eq('1.3.2')
299
+ expect(@excel.settings['user_id']).to eq('new_user')
300
+ expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
302
301
  expect(@excel.cluster_name).to eq('analysis_cluster_name')
303
302
  puts @excel.run_setup.inspect
304
- expect(@excel.run_setup["analysis_name"]).to eq('Name goes here')
303
+ expect(@excel.run_setup['analysis_name']).to eq('Name goes here')
305
304
  end
306
-
307
- it "should have the new measure directory column" do
305
+
306
+ it 'should have the new measure directory column' do
308
307
  expect(@excel.variables['data'][1]['measure_file_name_directory']).to eq('ReduceLightingLoadsByPercentage')
309
308
  end
310
-
311
- it "should write a json" do
312
- @excel.save_analysis
309
+
310
+ it 'should write a json' do
311
+ @excel.save_analysis
313
312
  end
314
313
  end
315
314
 
316
- context "version 0.2.0 simple" do
315
+ context 'version 0.2.0 simple' do
317
316
  before(:all) do
318
- @excel = OpenStudio::Analysis::Translator::Excel.new("spec/files/template_0_2_0_simpletest.xlsx")
317
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/template_0_2_0_simpletest.xlsx')
319
318
  end
320
319
 
321
- it "should process" do
320
+ it 'should process' do
322
321
  expect(@excel.process).to eq(true)
323
322
  end
324
323
 
325
- it "should have new setting variables" do
324
+ it 'should have new setting variables' do
326
325
  puts @excel.settings.inspect
327
- expect(@excel.settings["user_id"]).to eq('new_user')
328
- expect(@excel.settings["openstudio_server_version"]).to eq('1.3.2')
326
+ expect(@excel.settings['user_id']).to eq('new_user')
327
+ expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
329
328
  puts @excel.run_setup.inspect
330
329
  end
331
330
 
332
- it "should have the new measure directory column" do
331
+ it 'should have the new measure directory column' do
333
332
  expect(@excel.variables['data'][1]['measure_file_name_directory']).to eq('AdjustThermostatSetpointsByDegrees')
334
333
  expect(@excel.variables['data'][0]['measure_file_name_directory']).to eq('baseline')
335
334
  end
336
335
 
337
- it "should write a json" do
336
+ it 'should write a json' do
338
337
  @excel.save_analysis
339
338
  end
340
339
  end
341
340
 
342
-
343
-
344
341
  end
345
-
346
-
347
-
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi create a new localhost instance" tests="1" time="0.007202" failures="0" errors="0" skipped="0" timestamp="2014-04-28T23:21:40-06:00">
3
+ <testcase name="OpenStudio::Analysis::ServerApi create a new localhost instance should set the default host to localhost" time="0.000942">
4
+ </testcase>
5
+ <system-out>
6
+ </system-out>
7
+ <system-err>
8
+ </system-err>
9
+ </testsuite>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi create a new localhost instance" tests="1" time="0.004394" failures="0" errors="0" skipped="0" timestamp="2014-04-29T00:50:44-06:00">
3
+ <testcase name="OpenStudio::Analysis::ServerApi create a new localhost instance should set the default host to localhost" time="0.000538">
4
+ </testcase>
5
+ <system-out>
6
+ </system-out>
7
+ <system-err>
8
+ </system-err>
9
+ </testsuite>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi create a new localhost instance" tests="1" time="0.006187" failures="0" errors="0" skipped="0" timestamp="2014-04-29T00:55:44-06:00">
3
+ <testcase name="OpenStudio::Analysis::ServerApi create a new localhost instance should set the default host to localhost" time="0.000486">
4
+ </testcase>
5
+ <system-out>
6
+ </system-out>
7
+ <system-err>
8
+ </system-err>
9
+ </testsuite>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi test not localhost" tests="1" time="0.000614" failures="0" errors="0" skipped="0" timestamp="2014-04-28T23:21:40-06:00">
3
+ <testcase name="OpenStudio::Analysis::ServerApi test not localhost should have a not localhost URL" time="0.000357">
4
+ </testcase>
5
+ <system-out>
6
+ </system-out>
7
+ <system-err>
8
+ </system-err>
9
+ </testsuite>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi test not localhost" tests="1" time="0.000617" failures="0" errors="0" skipped="0" timestamp="2014-04-29T00:50:44-06:00">
3
+ <testcase name="OpenStudio::Analysis::ServerApi test not localhost should have a not localhost URL" time="0.000339">
4
+ </testcase>
5
+ <system-out>
6
+ </system-out>
7
+ <system-err>
8
+ </system-err>
9
+ </testsuite>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi test not localhost" tests="1" time="0.00074" failures="0" errors="0" skipped="0" timestamp="2014-04-29T00:55:44-06:00">
3
+ <testcase name="OpenStudio::Analysis::ServerApi test not localhost should have a not localhost URL" time="0.000463">
4
+ </testcase>
5
+ <system-out>
6
+ </system-out>
7
+ <system-err>
8
+ </system-err>
9
+ </testsuite>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi" tests="0" time="0.000174" failures="0" errors="0" skipped="0" timestamp="2014-04-28T23:21:40-06:00">
3
+ <system-out>
4
+ </system-out>
5
+ <system-err>
6
+ </system-err>
7
+ </testsuite>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="OpenStudio::Analysis::ServerApi" tests="0" time="0.000154" failures="0" errors="0" skipped="0" timestamp="2014-04-29T00:50:44-06:00">
3
+ <system-out>
4
+ </system-out>
5
+ <system-err>
6
+ </system-err>
7
+ </testsuite>