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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/openstudio/analysis/server_api.rb +1 -1
- data/lib/openstudio/analysis/translator/excel.rb +25 -2
- data/lib/openstudio/analysis/version.rb +1 -1
- data/spec/files/analysis/medium_office.json +1786 -0
- data/spec/files/{export/analysis/output_vars.zip → analysis/medium_office.zip} +0 -0
- data/spec/files/discrete_dynamic_columns.xlsx +0 -0
- data/spec/files/discrete_variables.xlsx +0 -0
- data/spec/files/template_0_2_0.xlsx +0 -0
- data/spec/files/~$template_0_2_0.xlsx +0 -0
- data/spec/files/~$template_input_0.1.10.xlsx +0 -0
- data/spec/openstudio/analysis/translator/excel_spec.rb +299 -272
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.62.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-create-a-new-localhost-instance.63.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.62.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi-test-not-localhost.63.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.62.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-ServerApi.63.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.20.xml +33 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-variables.21.xml +18 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.4.xml +33 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-discrete-with-dynamic-columns.5.xml +17 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.62.xml +20 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-no-variables-defined.63.xml +20 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.28.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup-with-user.29.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.34.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-proxy-setup.35.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.14.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-output-variables.15.xml +36 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.11.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-setup-version-0-1-9.12.xml +21 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.62.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-incomplete-variables.63.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.62.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables-should-not-validate.63.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.62.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-of-variables.63.xml +23 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.62.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-small-list-with-with-repeated-variable-names.63.xml +9 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.11.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel-version-0-1-10.12.xml +13 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.62.xml +7 -0
- data/spec/reports/SPEC-OpenStudio-Analysis-Translator-Excel.63.xml +7 -0
- metadata +76 -22
- data/spec/files/export/analysis/discrete_dynamic_seed.json +0 -445
- data/spec/files/export/analysis/discrete_dynamic_seed.zip +0 -0
- data/spec/files/export/analysis/discrete_seed.json +0 -712
- data/spec/files/export/analysis/discrete_seed.zip +0 -0
- data/spec/files/export/analysis/medium_office.json +0 -648
- data/spec/files/export/analysis/medium_office.zip +0 -0
- data/spec/files/export/analysis/output_vars.json +0 -707
- data/spec/files/export/analysis/small_seed.json +0 -665
- data/spec/files/export/analysis/small_seed.zip +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
context "small list of incomplete variables" do
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
context "small list with with repeated variable names" do
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
context "small list of variables should not validate" do
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
context "small list of variables" do
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
context "setup version 0.1.9" do
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
context "proxy setup" do
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
context "proxy setup with user" do
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
context "discrete variables" do
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
context "discrete with dynamic columns" do
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
context "setup output variables" do
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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/
|
|
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('
|
|
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('
|
|
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
|
|