openstudio-analysis 1.0.0.rc19 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +20 -0
- data/.rubocop.yml +2 -133
- data/.travis.yml +2 -2
- data/CHANGELOG.md +26 -32
- data/Gemfile +5 -6
- data/LICENSE.md +28 -0
- data/README.md +16 -8
- data/Rakefile +38 -3
- data/lib/openstudio-analysis.rb +35 -0
- data/lib/openstudio/analysis.rb +57 -26
- data/lib/openstudio/analysis/algorithm_attributes.rb +36 -1
- data/lib/openstudio/analysis/formulation.rb +41 -6
- data/lib/openstudio/analysis/server_api.rb +53 -36
- data/lib/openstudio/analysis/support_files.rb +40 -0
- data/lib/openstudio/analysis/translator/datapoints.rb +39 -4
- data/lib/openstudio/analysis/translator/excel.rb +43 -8
- data/lib/openstudio/analysis/translator/workflow.rb +54 -14
- data/lib/openstudio/analysis/version.rb +36 -1
- data/lib/openstudio/analysis/workflow.rb +37 -2
- data/lib/openstudio/analysis/workflow_step.rb +97 -70
- data/lib/openstudio/helpers/hash.rb +35 -0
- data/lib/openstudio/helpers/string.rb +36 -2
- data/lib/openstudio/weather/epw.rb +32 -17
- data/openstudio-analysis.gemspec +21 -18
- data/update_license.rb +120 -0
- metadata +62 -200
- data/LGPL-2.1.txt +0 -502
- data/LICENSE.txt +0 -65
- data/rubocop-todo.yml +0 -246
- data/spec/files/0_1_09_no_variables.xlsx +0 -0
- data/spec/files/0_1_09_outputvars.xlsx +0 -0
- data/spec/files/0_1_09_setup_version_2.xlsx +0 -0
- data/spec/files/0_1_09_small_list.xlsx +0 -0
- data/spec/files/0_1_09_small_list_incomplete.xlsx +0 -0
- data/spec/files/0_1_09_small_list_repeat_vars.xlsx +0 -0
- data/spec/files/0_1_09_small_list_validation_errors.xlsx +0 -0
- data/spec/files/0_1_10_proxy.xlsx +0 -0
- data/spec/files/0_1_10_proxy_user.xlsx +0 -0
- data/spec/files/0_1_10_template_input.xlsx +0 -0
- data/spec/files/0_1_11_discrete_variables.xlsx +0 -0
- data/spec/files/0_1_12_discrete_dynamic_columns.xlsx +0 -0
- data/spec/files/0_2_0_template.xlsx +0 -0
- data/spec/files/0_2_0_template_simpletest.xlsx +0 -0
- data/spec/files/0_3_0_dynamic_uuids.xlsx +0 -0
- data/spec/files/0_3_0_measure_existence.xlsx +0 -0
- data/spec/files/0_3_0_outputs.xlsx +0 -0
- data/spec/files/0_3_3_short_names.xlsx +0 -0
- data/spec/files/0_3_5_multiple_measure_paths.xlsx +0 -0
- data/spec/files/0_3_7_unique_measure_names.xlsx +0 -0
- data/spec/files/0_3_7_worker_init_final.xlsx +0 -0
- data/spec/files/0_4_0_lhs_discrete_continuous.xlsx +0 -0
- data/spec/files/0_4_0_multiple_seeds.xlsx +0 -0
- data/spec/files/0_4_0_pivot_test.xlsx +0 -0
- data/spec/files/analysis/examples/discrete_lhs_example.json +0 -809
- data/spec/files/analysis/examples/medium_office_example.json +0 -1673
- data/spec/files/analysis/examples/medium_office_workflow.json +0 -1298
- data/spec/files/measures/ActualMeasureNoJson/measure.rb +0 -80
- data/spec/files/measures/ActualMeasureNoJson/measure.xml +0 -2
- data/spec/files/measures/ExampleMeasure/measure.json +0 -3
- data/spec/files/measures/ExampleMeasure/measure.rb +0 -5
- data/spec/files/measures/ExampleMeasure/measure.xml +0 -1
- data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.json +0 -36
- data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.rb +0 -22
- data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.xml +0 -5
- data/spec/files/measures/NoMeasureRbFile/.gitkeep +0 -0
- data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.json +0 -3
- data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.rb +0 -5
- data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.xml +0 -1
- data/spec/files/measures/SetThermostatSchedules/measure.json +0 -63
- data/spec/files/measures/SetThermostatSchedules/measure.rb +0 -254
- data/spec/files/measures/SetThermostatSchedules/measure.xml +0 -2
- data/spec/files/measures/example_measure_auto_directory_name/measure.json +0 -3
- data/spec/files/measures/example_measure_auto_directory_name/measure.rb +0 -5
- data/spec/files/measures/example_measure_auto_directory_name/measure.xml +0 -1
- data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.json +0 -3
- data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.rb +0 -5
- data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.xml +0 -1
- data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.rb +0 -5
- data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.xml +0 -1
- data/spec/files/measures/rotate_building/measure.rb +0 -5
- data/spec/files/measures/rotate_building/measure.xml +0 -1
- data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.rb +0 -5
- data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.xml +0 -1
- data/spec/files/measures_second_path/measure_in_another_dir/measure.json +0 -3
- data/spec/files/measures_second_path/measure_in_another_dir/measure.rb +0 -5
- data/spec/files/measures_second_path/measure_in_another_dir/measure.xml +0 -1
- data/spec/files/partial_weather.epw +0 -32
- data/spec/files/partial_weather_2.epw +0 -32
- data/spec/files/small_seed.osm +0 -4622
- data/spec/files/worker_init/first_file.rb +0 -15
- data/spec/files/worker_init/second_file.rb +0 -15
- data/spec/files/workflow/analysis.osa +0 -1334
- data/spec/files/workflow/datapoint_0.osd +0 -65
- data/spec/files/workflow/datapoint_1.osd +0 -65
- data/spec/files/workflow/datapoint_2.osd +0 -65
- data/spec/files/workflow/datapoint_wrong_osa_id.osd +0 -65
- data/spec/integration/server_api_spec.rb +0 -48
- data/spec/openstudio/excel_spec.rb +0 -571
- data/spec/openstudio/formulation_spec.rb +0 -157
- data/spec/openstudio/hash_spec.rb +0 -21
- data/spec/openstudio/osw_spec.rb +0 -94
- data/spec/openstudio/server_api_spec.rb +0 -25
- data/spec/openstudio/string_spec.rb +0 -0
- data/spec/openstudio/support_files_spec.rb +0 -54
- data/spec/openstudio/weather_spec.rb +0 -45
- data/spec/openstudio/workflow_spec.rb +0 -91
- data/spec/openstudio/workflow_step_spec.rb +0 -118
- data/spec/schema/osa.json +0 -613
- data/spec/schema/osa.png +0 -0
- data/spec/schema/osd.json +0 -110
- data/spec/schema/osd.png +0 -0
- data/spec/spec_helper.rb +0 -19
@@ -1,65 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"data_point":{
|
3
|
-
"_id":"699e4f93-8b4c-4346-b245-8a80511e5024",
|
4
|
-
"analysis_id":"b7cfff21-f518-426a-8d7d-e88425c2298b",
|
5
|
-
"created_at":"2016-05-11T16:31:05Z",
|
6
|
-
"download_information":null,
|
7
|
-
"download_status":"na",
|
8
|
-
"internal_ip_address":null,
|
9
|
-
"ip_address":null,
|
10
|
-
"name":"LHS Autogenerated 21",
|
11
|
-
"openstudio_datapoint_file_name":null,
|
12
|
-
"results":{
|
13
|
-
|
14
|
-
},
|
15
|
-
"run_end_time":null,
|
16
|
-
"run_start_time":null,
|
17
|
-
"sdp_log_file":[
|
18
|
-
|
19
|
-
],
|
20
|
-
"set_variable_values":{
|
21
|
-
"6d3a3479-42d4-4484-a7ce-45daae3169aa":0.3672873569559306,
|
22
|
-
"10ea07d7-5b88-40a5-9267-e14cc9247fb8":1,
|
23
|
-
"b8354218-68ea-40ac-813d-775b41002e59":-1,
|
24
|
-
"a3b77357-c57f-4a63-a419-408fe57e41de":0,
|
25
|
-
"ab729dec-e423-4d86-aede-eac087353251":0,
|
26
|
-
"2765cc83-cc4a-4dfd-aaa1-04f04c472867":44,
|
27
|
-
"b614f269-fef6-45ab-baf6-6e8741331a86":120,
|
28
|
-
"eb8d1aad-2087-4163-977e-0978424de46e":13,
|
29
|
-
"d1069c03-d2c4-4ade-aa9e-1b128a8af565":10,
|
30
|
-
"bb3fbef6-5e8d-45a8-a314-e64e1a7990f9":0.4,
|
31
|
-
"9dfaf70b-fb39-4598-94f5-572162e2b029":0.4
|
32
|
-
},
|
33
|
-
"status":"queued",
|
34
|
-
"status_message":"",
|
35
|
-
"updated_at":"2016-05-11T16:31:06Z",
|
36
|
-
"uuid":"699e4f93-8b4c-4346-b245-8a80511e5024",
|
37
|
-
"variable_values":null,
|
38
|
-
"set_variable_values_names":{
|
39
|
-
"add_overhangs_by_projection_factor.projection_factor":0.3672873569559306,
|
40
|
-
"adjust_thermostat_setpoints_by_degrees.cooling_adjustment":1,
|
41
|
-
"adjust_thermostat_setpoints_by_degrees.heating_adjustment":-1,
|
42
|
-
"reduce_lighting_loads_by_percentage.lighting_power_reduction_percent":0,
|
43
|
-
"rotate_building_relative_to_current_orientation.relative_building_rotation":0,
|
44
|
-
"set_chilled_water_loop_temperature.cw_temp_f":44,
|
45
|
-
"set_hot_water_loop_temperature.hw_temp_f":120,
|
46
|
-
"set_r_value_of_insulation_for_exterior_walls_to_a_specific_value.r_value":13,
|
47
|
-
"set_r_value_of_insulation_for_roofs_to_a_specific_value.r_value":10,
|
48
|
-
"window_to_wall_ratio_east.wwr":0.4,
|
49
|
-
"window_to_wall_ratio_south.wwr":0.4
|
50
|
-
},
|
51
|
-
"set_variable_values_display_names":{
|
52
|
-
"South Projection Factor":0.3672873569559306,
|
53
|
-
"Degrees Fahrenheit to Adjust Cooling Setpoint By.":1,
|
54
|
-
"Degrees Fahrenheit to Adjust heating Setpoint By.":-1,
|
55
|
-
"LPD Reduction":0,
|
56
|
-
"Rotation":0,
|
57
|
-
"Desired chilled water setpoint (F)":44,
|
58
|
-
"Desired hot water setpoint (F)":120,
|
59
|
-
"Wall R-Value":13,
|
60
|
-
"Roof R-Value":10,
|
61
|
-
"East WWR":0.4,
|
62
|
-
"South WWR":0.4
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"data_point":{
|
3
|
-
"_id":"e4be14c2-aec0-4304-8b77-49250b7e97cd",
|
4
|
-
"analysis_id":"b7cfff21-f518-426a-8d7d-e88425c2298b",
|
5
|
-
"created_at":"2016-05-11T16:31:05Z",
|
6
|
-
"download_information":null,
|
7
|
-
"download_status":"na",
|
8
|
-
"internal_ip_address":null,
|
9
|
-
"ip_address":null,
|
10
|
-
"name":"LHS Autogenerated 18",
|
11
|
-
"openstudio_datapoint_file_name":null,
|
12
|
-
"results":{
|
13
|
-
|
14
|
-
},
|
15
|
-
"run_end_time":null,
|
16
|
-
"run_start_time":null,
|
17
|
-
"sdp_log_file":[
|
18
|
-
|
19
|
-
],
|
20
|
-
"set_variable_values":{
|
21
|
-
"6d3a3479-42d4-4484-a7ce-45daae3169aa":0.15678702925331892,
|
22
|
-
"10ea07d7-5b88-40a5-9267-e14cc9247fb8":1,
|
23
|
-
"b8354218-68ea-40ac-813d-775b41002e59":-1,
|
24
|
-
"a3b77357-c57f-4a63-a419-408fe57e41de":0,
|
25
|
-
"ab729dec-e423-4d86-aede-eac087353251":0,
|
26
|
-
"2765cc83-cc4a-4dfd-aaa1-04f04c472867":44,
|
27
|
-
"b614f269-fef6-45ab-baf6-6e8741331a86":120,
|
28
|
-
"eb8d1aad-2087-4163-977e-0978424de46e":13,
|
29
|
-
"d1069c03-d2c4-4ade-aa9e-1b128a8af565":10,
|
30
|
-
"bb3fbef6-5e8d-45a8-a314-e64e1a7990f9":0.4,
|
31
|
-
"9dfaf70b-fb39-4598-94f5-572162e2b029":0.4
|
32
|
-
},
|
33
|
-
"status":"queued",
|
34
|
-
"status_message":"",
|
35
|
-
"updated_at":"2016-05-11T16:31:06Z",
|
36
|
-
"uuid":"e4be14c2-aec0-4304-8b77-49250b7e97cd",
|
37
|
-
"variable_values":null,
|
38
|
-
"set_variable_values_names":{
|
39
|
-
"add_overhangs_by_projection_factor.projection_factor":0.15678702925331892,
|
40
|
-
"adjust_thermostat_setpoints_by_degrees.cooling_adjustment":1,
|
41
|
-
"adjust_thermostat_setpoints_by_degrees.heating_adjustment":-1,
|
42
|
-
"reduce_lighting_loads_by_percentage.lighting_power_reduction_percent":0,
|
43
|
-
"rotate_building_relative_to_current_orientation.relative_building_rotation":0,
|
44
|
-
"set_chilled_water_loop_temperature.cw_temp_f":44,
|
45
|
-
"set_hot_water_loop_temperature.hw_temp_f":120,
|
46
|
-
"set_r_value_of_insulation_for_exterior_walls_to_a_specific_value.r_value":13,
|
47
|
-
"set_r_value_of_insulation_for_roofs_to_a_specific_value.r_value":10,
|
48
|
-
"window_to_wall_ratio_east.wwr":0.4,
|
49
|
-
"window_to_wall_ratio_south.wwr":0.4
|
50
|
-
},
|
51
|
-
"set_variable_values_display_names":{
|
52
|
-
"South Projection Factor":0.15678702925331892,
|
53
|
-
"Degrees Fahrenheit to Adjust Cooling Setpoint By.":1,
|
54
|
-
"Degrees Fahrenheit to Adjust heating Setpoint By.":-1,
|
55
|
-
"LPD Reduction":0,
|
56
|
-
"Rotation":0,
|
57
|
-
"Desired chilled water setpoint (F)":44,
|
58
|
-
"Desired hot water setpoint (F)":120,
|
59
|
-
"Wall R-Value":13,
|
60
|
-
"Roof R-Value":10,
|
61
|
-
"East WWR":0.4,
|
62
|
-
"South WWR":0.4
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"data_point":{
|
3
|
-
"_id":"f4a016f6-fba8-422a-aa7a-5d1bf5136527",
|
4
|
-
"analysis_id":"b7cfff21-f518-426a-8d7d-e88425c2298b",
|
5
|
-
"created_at":"2016-05-11T16:31:05Z",
|
6
|
-
"download_information":null,
|
7
|
-
"download_status":"na",
|
8
|
-
"internal_ip_address":null,
|
9
|
-
"ip_address":null,
|
10
|
-
"name":"LHS Autogenerated 10",
|
11
|
-
"openstudio_datapoint_file_name":null,
|
12
|
-
"results":{
|
13
|
-
|
14
|
-
},
|
15
|
-
"run_end_time":null,
|
16
|
-
"run_start_time":null,
|
17
|
-
"sdp_log_file":[
|
18
|
-
|
19
|
-
],
|
20
|
-
"set_variable_values":{
|
21
|
-
"6d3a3479-42d4-4484-a7ce-45daae3169aa":0.055343150682747366,
|
22
|
-
"10ea07d7-5b88-40a5-9267-e14cc9247fb8":1,
|
23
|
-
"b8354218-68ea-40ac-813d-775b41002e59":-1,
|
24
|
-
"a3b77357-c57f-4a63-a419-408fe57e41de":0,
|
25
|
-
"ab729dec-e423-4d86-aede-eac087353251":0,
|
26
|
-
"2765cc83-cc4a-4dfd-aaa1-04f04c472867":44,
|
27
|
-
"b614f269-fef6-45ab-baf6-6e8741331a86":120,
|
28
|
-
"eb8d1aad-2087-4163-977e-0978424de46e":13,
|
29
|
-
"d1069c03-d2c4-4ade-aa9e-1b128a8af565":10,
|
30
|
-
"bb3fbef6-5e8d-45a8-a314-e64e1a7990f9":0.4,
|
31
|
-
"9dfaf70b-fb39-4598-94f5-572162e2b029":0.4
|
32
|
-
},
|
33
|
-
"status":"queued",
|
34
|
-
"status_message":"",
|
35
|
-
"updated_at":"2016-05-11T16:31:06Z",
|
36
|
-
"uuid":"f4a016f6-fba8-422a-aa7a-5d1bf5136527",
|
37
|
-
"variable_values":null,
|
38
|
-
"set_variable_values_names":{
|
39
|
-
"add_overhangs_by_projection_factor.projection_factor":0.055343150682747366,
|
40
|
-
"adjust_thermostat_setpoints_by_degrees.cooling_adjustment":1,
|
41
|
-
"adjust_thermostat_setpoints_by_degrees.heating_adjustment":-1,
|
42
|
-
"reduce_lighting_loads_by_percentage.lighting_power_reduction_percent":0,
|
43
|
-
"rotate_building_relative_to_current_orientation.relative_building_rotation":0,
|
44
|
-
"set_chilled_water_loop_temperature.cw_temp_f":44,
|
45
|
-
"set_hot_water_loop_temperature.hw_temp_f":120,
|
46
|
-
"set_r_value_of_insulation_for_exterior_walls_to_a_specific_value.r_value":13,
|
47
|
-
"set_r_value_of_insulation_for_roofs_to_a_specific_value.r_value":10,
|
48
|
-
"window_to_wall_ratio_east.wwr":0.4,
|
49
|
-
"window_to_wall_ratio_south.wwr":0.4
|
50
|
-
},
|
51
|
-
"set_variable_values_display_names":{
|
52
|
-
"South Projection Factor":0.055343150682747366,
|
53
|
-
"Degrees Fahrenheit to Adjust Cooling Setpoint By.":1,
|
54
|
-
"Degrees Fahrenheit to Adjust heating Setpoint By.":-1,
|
55
|
-
"LPD Reduction":0,
|
56
|
-
"Rotation":0,
|
57
|
-
"Desired chilled water setpoint (F)":44,
|
58
|
-
"Desired hot water setpoint (F)":120,
|
59
|
-
"Wall R-Value":13,
|
60
|
-
"Roof R-Value":10,
|
61
|
-
"East WWR":0.4,
|
62
|
-
"South WWR":0.4
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"data_point":{
|
3
|
-
"_id":"f4a046f6-fba8-422a-aa7a-5d1bf5136527",
|
4
|
-
"analysis_id":"b7cfef21-f518-426a-8d7d-e88425c2298b",
|
5
|
-
"created_at":"2016-05-11T16:31:05Z",
|
6
|
-
"download_information":null,
|
7
|
-
"download_status":"na",
|
8
|
-
"internal_ip_address":null,
|
9
|
-
"ip_address":null,
|
10
|
-
"name":"LHS Autogenerated 10",
|
11
|
-
"openstudio_datapoint_file_name":null,
|
12
|
-
"results":{
|
13
|
-
|
14
|
-
},
|
15
|
-
"run_end_time":null,
|
16
|
-
"run_start_time":null,
|
17
|
-
"sdp_log_file":[
|
18
|
-
|
19
|
-
],
|
20
|
-
"set_variable_values":{
|
21
|
-
"6d3a3479-42d4-4484-a7ce-45daae3169aa":0.055343150682747366,
|
22
|
-
"10ea07d7-5b88-40a5-9267-e14cc9247fb8":1,
|
23
|
-
"b8354218-68ea-40ac-813d-775b41002e59":-1,
|
24
|
-
"a3b77357-c57f-4a63-a419-408fe57e41de":0,
|
25
|
-
"ab729dec-e423-4d86-aede-eac087353251":0,
|
26
|
-
"2765cc83-cc4a-4dfd-aaa1-04f04c472867":44,
|
27
|
-
"b614f269-fef6-45ab-baf6-6e8741331a86":120,
|
28
|
-
"eb8d1aad-2087-4163-977e-0978424de46e":13,
|
29
|
-
"d1069c03-d2c4-4ade-aa9e-1b128a8af565":10,
|
30
|
-
"bb3fbef6-5e8d-45a8-a314-e64e1a7990f9":0.4,
|
31
|
-
"9dfaf70b-fb39-4598-94f5-572162e2b029":0.4
|
32
|
-
},
|
33
|
-
"status":"queued",
|
34
|
-
"status_message":"",
|
35
|
-
"updated_at":"2016-05-11T16:31:06Z",
|
36
|
-
"uuid":"f4a016f6-fba8-422a-aa7a-5d1bf5136527",
|
37
|
-
"variable_values":null,
|
38
|
-
"set_variable_values_names":{
|
39
|
-
"add_overhangs_by_projection_factor.projection_factor":0.055343150682747366,
|
40
|
-
"adjust_thermostat_setpoints_by_degrees.cooling_adjustment":1,
|
41
|
-
"adjust_thermostat_setpoints_by_degrees.heating_adjustment":-1,
|
42
|
-
"reduce_lighting_loads_by_percentage.lighting_power_reduction_percent":0,
|
43
|
-
"rotate_building_relative_to_current_orientation.relative_building_rotation":0,
|
44
|
-
"set_chilled_water_loop_temperature.cw_temp_f":44,
|
45
|
-
"set_hot_water_loop_temperature.hw_temp_f":120,
|
46
|
-
"set_r_value_of_insulation_for_exterior_walls_to_a_specific_value.r_value":13,
|
47
|
-
"set_r_value_of_insulation_for_roofs_to_a_specific_value.r_value":10,
|
48
|
-
"window_to_wall_ratio_east.wwr":0.4,
|
49
|
-
"window_to_wall_ratio_south.wwr":0.4
|
50
|
-
},
|
51
|
-
"set_variable_values_display_names":{
|
52
|
-
"South Projection Factor":0.055343150682747366,
|
53
|
-
"Degrees Fahrenheit to Adjust Cooling Setpoint By.":1,
|
54
|
-
"Degrees Fahrenheit to Adjust heating Setpoint By.":-1,
|
55
|
-
"LPD Reduction":0,
|
56
|
-
"Rotation":0,
|
57
|
-
"Desired chilled water setpoint (F)":44,
|
58
|
-
"Desired hot water setpoint (F)":120,
|
59
|
-
"Wall R-Value":13,
|
60
|
-
"Roof R-Value":10,
|
61
|
-
"East WWR":0.4,
|
62
|
-
"South WWR":0.4
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe OpenStudio::Analysis::ServerApi, type: :integration do
|
4
|
-
before :all do
|
5
|
-
@host = 'http://localhost:8080'
|
6
|
-
end
|
7
|
-
|
8
|
-
context 'create and delete a project', type: :api_integration do
|
9
|
-
before :all do
|
10
|
-
@api = OpenStudio::Analysis::ServerApi.new
|
11
|
-
expect(@api.hostname).to eq(@host)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should create the project' do
|
15
|
-
project_id = @api.new_project({})
|
16
|
-
expect(project_id).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
|
17
|
-
|
18
|
-
# get the projects from the api
|
19
|
-
project_ids = @api.get_project_ids
|
20
|
-
expect(project_ids.include?(project_id)).to eq true
|
21
|
-
|
22
|
-
# delete the project
|
23
|
-
r = @api.delete_project project_id
|
24
|
-
expect(r).to be true
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should not be able to delete a non-existent project' do
|
28
|
-
r = @api.delete_project('not_a_uuid')
|
29
|
-
expect(r).to eq false
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'create multiple projects and then delete them all' do
|
33
|
-
(1..20).each do |_p|
|
34
|
-
project_id = @api.new_project({})
|
35
|
-
expect(project_id).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
|
36
|
-
end
|
37
|
-
|
38
|
-
r = @api.delete_all
|
39
|
-
expect(r).to eq true
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should upload an analysis' do
|
43
|
-
puts Dir.pwd
|
44
|
-
j = 'spec/files/analysis/medium_office.json'
|
45
|
-
z = 'spec/files/analysis/medium_office.zip'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,571 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe OpenStudio::Analysis::Translator::Excel do
|
4
|
-
before :all do
|
5
|
-
clean_dir = File.expand_path 'spec/files/export/analysis'
|
6
|
-
|
7
|
-
if Dir.exist? clean_dir
|
8
|
-
FileUtils.rm_rf clean_dir
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'no variables defined' do
|
13
|
-
let(:path) { 'spec/files/0_1_09_no_variables.xlsx' }
|
14
|
-
|
15
|
-
before(:each) do
|
16
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new(path)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should have excel data' do
|
20
|
-
expect(@excel).not_to be_nil
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should process the excel file' do
|
24
|
-
expect(@excel.process).to eq(true)
|
25
|
-
|
26
|
-
# after processing the measures directory should be what is in the excel file
|
27
|
-
expect(@excel.measure_paths[0]).to eq(File.expand_path(File.join('spec', 'files', 'measures')))
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should not work because no variables defined' do
|
31
|
-
# old_path = @excel.measure_path
|
32
|
-
# @excel.measure_path = "path/does/not/exist"
|
33
|
-
#
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should not export to a JSON' do
|
37
|
-
@excel.process
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'small list of incomplete variables' do
|
42
|
-
before(:all) do
|
43
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list_incomplete.xlsx')
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should fail to process' do
|
47
|
-
expect { @excel.process }.to raise_error('Variable adjust_thermostat_setpoints_by_degrees:cooling_adjustment must have a mean')
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'small list with with repeated variable names' do
|
52
|
-
before(:all) do
|
53
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list_repeat_vars.xlsx')
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should fail to process' do
|
57
|
-
expect { @excel.process }.to raise_error('duplicate variable names found in list ["Insulation R-value (ft^2*h*R/Btu)."]')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'small list of variables should not validate' do
|
62
|
-
before(:all) do
|
63
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list_validation_errors.xlsx')
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should fail to process' do
|
67
|
-
error_message = 'Variable min is greater than variable max for adjust_thermostat_setpoints_by_degrees:heating_adjustment'
|
68
|
-
expect { @excel.process }.to raise_error(error_message)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'small list of variables' do
|
73
|
-
before(:all) do
|
74
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list.xlsx')
|
75
|
-
@excel.process
|
76
|
-
end
|
77
|
-
it 'should have a model' do
|
78
|
-
expect(@excel.models.first).not_to be_nil
|
79
|
-
expect(@excel.models.first[:name]).to eq('small_seed')
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'should have a weather file' do
|
83
|
-
expect(@excel.weather_files.first).not_to be_nil
|
84
|
-
expect(@excel.weather_files.first.include?('partial_weather')).to eq(true)
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'should have notes and source' do
|
88
|
-
@excel.variables['data'].each do |measure|
|
89
|
-
measure['variables'].each do |var|
|
90
|
-
if var['machine_name'] == 'lighting_power_reduction'
|
91
|
-
expect(var['distribution']['source']).to eq('some data source')
|
92
|
-
elsif var['machine_name'] == 'demo_cost_initial_const'
|
93
|
-
expect(var['notes']).to eq('some note')
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should write a json' do
|
100
|
-
@excel.save_analysis
|
101
|
-
expect(File).to exist('spec/files/export/analysis/example_analysis.json')
|
102
|
-
expect(File).to exist('spec/files/export/analysis/example_analysis.zip')
|
103
|
-
|
104
|
-
expect(JSON.parse(File.read('spec/files/export/analysis/example_analysis.json'))).not_to be_nil
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'setup version 0.1.9' do
|
109
|
-
before(:all) do
|
110
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_setup_version_2.xlsx')
|
111
|
-
@excel.process
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'should have a version and analysis name in machine format' do
|
115
|
-
expect(@excel.version).to eq('0.1.9')
|
116
|
-
expect(@excel.analysis_name).to eq('example_analysis')
|
117
|
-
end
|
118
|
-
it 'should have the new settings' do
|
119
|
-
expect(@excel.settings['server_instance_type']).to eq('m2.xlarge')
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'should have algorithm setup' do
|
123
|
-
h = @excel.analysis
|
124
|
-
|
125
|
-
expect(h.algorithm['number_of_samples']).to eq(100)
|
126
|
-
expect(h.algorithm['number_of_generations']).to eq(20)
|
127
|
-
expect(h.algorithm['sample_method']).to eq('all_variables')
|
128
|
-
expect(h.algorithm['number_of_generations']).to be_a Integer
|
129
|
-
expect(h.algorithm['tolerance']).to eq(0.115)
|
130
|
-
expect(h.algorithm['tolerance']).to be_a Float
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'should create a valid hash' do
|
134
|
-
h = @excel.analysis
|
135
|
-
|
136
|
-
expect(h.analysis_type).to eq('lhs')
|
137
|
-
expect(h.algorithm).to be_a OpenStudio::Analysis::AlgorithmAttributes
|
138
|
-
expect(h.algorithm['number_of_samples']).to eq(100)
|
139
|
-
expect(h.algorithm['sample_method']).to eq('all_variables')
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
context 'proxy setup' do
|
144
|
-
before(:all) do
|
145
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_10_proxy.xlsx')
|
146
|
-
@excel.process
|
147
|
-
end
|
148
|
-
|
149
|
-
it 'should have a proxy setting' do
|
150
|
-
expect(@excel.settings['proxy_host']).to eq('192.168.0.1')
|
151
|
-
expect(@excel.settings['proxy_port']).to eq(8080)
|
152
|
-
expect(@excel.settings['proxy_username']).to be_nil
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
context 'proxy setup with user' do
|
157
|
-
before(:all) do
|
158
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_10_proxy_user.xlsx')
|
159
|
-
@excel.process
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'should have a user' do
|
163
|
-
expect(@excel.settings['proxy_host']).to eq('192.168.0.1')
|
164
|
-
expect(@excel.settings['proxy_port']).to eq(8080)
|
165
|
-
expect(@excel.settings['proxy_username']).to eq('a_user')
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
context 'discrete variables' do
|
170
|
-
before(:all) do
|
171
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_11_discrete_variables.xlsx')
|
172
|
-
@excel.process
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'should have parsed the spreadsheet' do
|
176
|
-
@excel.variables['data'].each do |measure|
|
177
|
-
measure['variables'].each do |var|
|
178
|
-
# TODO: Add some tests!
|
179
|
-
if var['name'] == 'alter_design_days'
|
180
|
-
expect(var['type']).to eq 'bool'
|
181
|
-
expect(var['distribution']['discrete_values']).to match_array [true, false]
|
182
|
-
expect(var['distribution']['discrete_weights']).to match_array [0.8, 0.2]
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'should save the file' do
|
189
|
-
@excel.save_analysis
|
190
|
-
expect(File.exist?('spec/files/export/analysis/example_analysis.json')).to eq true
|
191
|
-
expect(File.exist?('spec/files/export/analysis/example_analysis.zip')).to eq true
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
context 'discrete with dynamic columns' do
|
196
|
-
before(:all) do
|
197
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_12_discrete_dynamic_columns.xlsx')
|
198
|
-
@excel.process
|
199
|
-
end
|
200
|
-
|
201
|
-
it 'should have parsed the spreadsheet' do
|
202
|
-
@excel.variables['data'].each do |measure|
|
203
|
-
measure['variables'].each do |_var|
|
204
|
-
# TODO: test something?
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'should save the file' do
|
210
|
-
@excel.save_analysis
|
211
|
-
expect(File.exist?('spec/files/export/analysis/test_model.json')).to eq true
|
212
|
-
expect(File.exist?('spec/files/export/analysis/test_model.zip')).to eq true
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
context 'setup output variables' do
|
217
|
-
before(:all) do
|
218
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_outputvars.xlsx')
|
219
|
-
@excel.process
|
220
|
-
end
|
221
|
-
|
222
|
-
it 'should have a model' do
|
223
|
-
expect(@excel.models.first).not_to be_nil
|
224
|
-
expect(@excel.models.first[:name]).to eq('0_1_09_outputvars')
|
225
|
-
end
|
226
|
-
|
227
|
-
it 'should have a weather file' do
|
228
|
-
expect(@excel.weather_files.first).not_to be_nil
|
229
|
-
expect(@excel.weather_files.first.include?('partial_weather')).to eq(true)
|
230
|
-
end
|
231
|
-
|
232
|
-
it 'should have notes and source' do
|
233
|
-
@excel.variables['data'].each do |measure|
|
234
|
-
measure['variables'].each do |var|
|
235
|
-
if var['machine_name'] == 'lighting_power_reduction'
|
236
|
-
expect(var['distribution']['source']).to eq('some data source')
|
237
|
-
elsif var['machine_name'] == 'demo_cost_initial_const'
|
238
|
-
expect(var['notes']).to eq('some note')
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
it 'should have algorithm setup' do
|
245
|
-
expect(@excel.algorithm['number_of_samples']).to eq(100)
|
246
|
-
expect(@excel.algorithm['number_of_generations']).to eq(20)
|
247
|
-
expect(@excel.algorithm['sample_method']).to eq('all_variables')
|
248
|
-
expect(@excel.algorithm['number_of_generations']).to be_a Integer
|
249
|
-
# expect(@excel.algorithm["tolerance"]).to eq(0.115)
|
250
|
-
# expect(@excel.algorithm["tolerance"]).to be_a Float
|
251
|
-
end
|
252
|
-
|
253
|
-
it 'should create a valid hash' do
|
254
|
-
h = @excel.analysis
|
255
|
-
|
256
|
-
expect(h.analysis_type).to eq('nsga')
|
257
|
-
expect(h.algorithm).to be_a OpenStudio::Analysis::AlgorithmAttributes
|
258
|
-
expect(h.algorithm['number_of_samples']).to eq(100)
|
259
|
-
expect(h.algorithm['sample_method']).to eq('all_variables')
|
260
|
-
end
|
261
|
-
|
262
|
-
it 'should write a json' do
|
263
|
-
@excel.save_analysis
|
264
|
-
expect(File).to exist('spec/files/export/analysis/0_1_09_outputvars.json')
|
265
|
-
expect(File).to exist('spec/files/export/analysis/0_1_09_outputvars.zip')
|
266
|
-
expect(JSON.parse(File.read('spec/files/export/analysis/0_1_09_outputvars.json'))).not_to be_nil
|
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/0_1_10_template_input.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
|
-
expect(@excel.settings['user_id']).to eq('new_user')
|
281
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
|
282
|
-
expect(@excel.cluster_name).to eq('analysis_cluster')
|
283
|
-
expect(@excel.run_setup['analysis_name']).to eq('LHS Example Project')
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
context 'version 0.2.0' do
|
288
|
-
before(:all) do
|
289
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_2_0_template.xlsx')
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'should process' do
|
293
|
-
expect(@excel.process).to eq(true)
|
294
|
-
expect(@excel.settings['user_id']).to eq('new_user')
|
295
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
|
296
|
-
expect(@excel.cluster_name).to eq('analysis_cluster_name')
|
297
|
-
expect(@excel.run_setup['analysis_name']).to eq('Name goes here')
|
298
|
-
expect(@excel.variables['data'][1]['measure_file_name_directory']).to eq('ReduceLightingLoadsByPercentage')
|
299
|
-
end
|
300
|
-
|
301
|
-
it 'should write a json' do
|
302
|
-
@excel.save_analysis
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
context 'version 0.2.0 simple' do
|
307
|
-
before(:all) do
|
308
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_2_0_template_simpletest.xlsx')
|
309
|
-
end
|
310
|
-
|
311
|
-
it 'should process' do
|
312
|
-
expect(@excel.process).to eq(true)
|
313
|
-
end
|
314
|
-
|
315
|
-
it 'should have new setting variables' do
|
316
|
-
expect(@excel.settings['user_id']).to eq('new_user')
|
317
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
|
318
|
-
end
|
319
|
-
|
320
|
-
it 'should have the new measure directory column' do
|
321
|
-
expect(@excel.variables['data'][0]['measure_file_name_directory']).to eq('ExampleMeasure')
|
322
|
-
expect(@excel.variables['data'][0]['display_name']).to eq('Baseline')
|
323
|
-
end
|
324
|
-
|
325
|
-
it 'should write a json' do
|
326
|
-
@excel.save_analysis
|
327
|
-
expect(File.exist?('spec/files/export/analysis/simple_test.json')).to eq true
|
328
|
-
expect(File.exist?('spec/files/export/analysis/simple_test.zip')).to eq true
|
329
|
-
end
|
330
|
-
end
|
331
|
-
|
332
|
-
context 'version 0.3.0 objective functions' do
|
333
|
-
before(:all) do
|
334
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_0_outputs.xlsx')
|
335
|
-
expect(@excel.process).to eq(true)
|
336
|
-
end
|
337
|
-
|
338
|
-
it 'should have new setting variables' do
|
339
|
-
expect(@excel.settings['user_id']).to eq('new_user')
|
340
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.6.1')
|
341
|
-
end
|
342
|
-
|
343
|
-
it 'should have typed outputs' do
|
344
|
-
h = @excel.analysis
|
345
|
-
|
346
|
-
expect(h.outputs).to be_an Array
|
347
|
-
h.outputs.each do |o|
|
348
|
-
if o['name'] == 'standard_report_legacy.total_energy'
|
349
|
-
expect(o['variable_type']).to eq 'double'
|
350
|
-
expect(o['objective_function']).to eq true
|
351
|
-
expect(o['objective_function_index']).to eq 0
|
352
|
-
expect(o['objective_function_target']).to eq nil
|
353
|
-
expect(o['scaling_factor']).to eq nil
|
354
|
-
expect(o['objective_function_group']).to eq 1
|
355
|
-
end
|
356
|
-
if o['name'] == 'standard_report_legacy.total_source_energy'
|
357
|
-
expect(o['variable_type']).to eq 'double'
|
358
|
-
expect(o['objective_function']).to eq true
|
359
|
-
expect(o['objective_function_index']).to eq 1
|
360
|
-
expect(o['objective_function_target']).to eq 25.1
|
361
|
-
expect(o['scaling_factor']).to eq 25.2
|
362
|
-
expect(o['objective_function_group']).to eq 7
|
363
|
-
end
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
|
-
it 'should write a json' do
|
368
|
-
@excel.save_analysis
|
369
|
-
expect(File.exist?('spec/files/export/analysis/0_3_0_outputs.json')).to eq true
|
370
|
-
expect(File.exist?('spec/files/export/analysis/0_3_0_outputs.zip')).to eq true
|
371
|
-
|
372
|
-
# check the JSON
|
373
|
-
h = JSON.parse(File.read('spec/files/export/analysis/0_3_0_outputs.json'))
|
374
|
-
expect(h['analysis']['weather_file']).to be_a Hash
|
375
|
-
expect(h['analysis']['weather_file']['path']).to match /partial_weather.*epw/
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
context 'version 0.3.0 measure existence checks' do
|
380
|
-
before(:all) do
|
381
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_0_measure_existence.xlsx')
|
382
|
-
end
|
383
|
-
|
384
|
-
it 'should process' do
|
385
|
-
expect(@excel.process).to eq(true)
|
386
|
-
|
387
|
-
model_name = @excel.models.first[:name]
|
388
|
-
expect(model_name).to eq '0_3_0_outputs'
|
389
|
-
end
|
390
|
-
|
391
|
-
it 'should error out with missing measure information' do
|
392
|
-
expect { @excel.save_analysis }.to raise_error /Measure in directory.*not contain a measure.rb.*$/
|
393
|
-
end
|
394
|
-
end
|
395
|
-
|
396
|
-
context 'version 0.3.0 dynamic uuid assignments' do
|
397
|
-
before(:all) do
|
398
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_0_dynamic_uuids.xlsx')
|
399
|
-
expect(@excel.process).to eq(true)
|
400
|
-
end
|
401
|
-
|
402
|
-
it 'should process' do
|
403
|
-
model_uuid = @excel.models.first[:name]
|
404
|
-
expect(model_uuid).to match /[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}/
|
405
|
-
end
|
406
|
-
|
407
|
-
it 'should error out with missing measure information' do
|
408
|
-
@excel.save_analysis
|
409
|
-
model_uuid = @excel.models.first[:name]
|
410
|
-
expect(File.exist?('spec/files/export/analysis/0_3_0_dynamic_uuids.json')).to eq true
|
411
|
-
expect(File.exist?('spec/files/export/analysis/0_3_0_dynamic_uuids.zip')).to eq true
|
412
|
-
end
|
413
|
-
end
|
414
|
-
|
415
|
-
context 'version 0.3.3 and short display names' do
|
416
|
-
before :all do
|
417
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_3_short_names.xlsx')
|
418
|
-
expect(@excel.process).to eq(true)
|
419
|
-
end
|
420
|
-
|
421
|
-
it 'should process' do
|
422
|
-
model_uuid = @excel.models.first[:name]
|
423
|
-
expect(model_uuid).to match /[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}/
|
424
|
-
end
|
425
|
-
|
426
|
-
it 'should process and save short display names' do
|
427
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_3_short_names.xlsx')
|
428
|
-
expect(@excel.process).to eq(true)
|
429
|
-
@excel.save_analysis
|
430
|
-
model_uuid = @excel.models.first[:name]
|
431
|
-
expect(File.exist?('spec/files/export/analysis/0_3_3_short_names.json')).to eq true
|
432
|
-
expect(File.exist?('spec/files/export/analysis/0_3_3_short_names.zip')).to eq true
|
433
|
-
|
434
|
-
@excel.outputs['output_variables'].each do |o|
|
435
|
-
expect(o['display_name_short']).to eq 'Site EUI' if o['name'] == 'standard_report_legacy.total_energy'
|
436
|
-
expect(o['display_name_short']).to eq 'Natural Gas Heating Intensity' if o['name'] == 'standard_report_legacy.heating_natural_gas'
|
437
|
-
end
|
438
|
-
|
439
|
-
# Check the JSON
|
440
|
-
j = JSON.parse(File.read('spec/files/export/analysis/0_3_3_short_names.json'))
|
441
|
-
|
442
|
-
expect(j['analysis']['output_variables'].first['display_name']).to eq 'Total Site Energy Intensity'
|
443
|
-
expect(j['analysis']['output_variables'].first['display_name_short']).to eq 'Site EUI'
|
444
|
-
expect(j['analysis']['problem']['workflow'][0]['variables'][0]['argument']['display_name']).to eq 'Orientation'
|
445
|
-
expect(j['analysis']['problem']['workflow'][0]['variables'][0]['argument']['display_name_short']).to eq 'Shorter Display Name'
|
446
|
-
expect(j['analysis']['problem']['workflow'][1]['arguments'][1]['display_name']).to eq 'unknown'
|
447
|
-
expect(j['analysis']['problem']['workflow'][1]['arguments'][1]['display_name_short']).to eq 'un'
|
448
|
-
end
|
449
|
-
end
|
450
|
-
|
451
|
-
context 'version 0.3.5 and measure paths' do
|
452
|
-
before :all do
|
453
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_5_multiple_measure_paths.xlsx')
|
454
|
-
expect(@excel.process).to eq(true)
|
455
|
-
end
|
456
|
-
|
457
|
-
it 'should save the analysis' do
|
458
|
-
@excel.save_analysis
|
459
|
-
model_uuid = @excel.models.first[:name]
|
460
|
-
|
461
|
-
expect(File.exist?('spec/files/export/analysis/0_3_5_multiple_measure_paths.json')).to eq true
|
462
|
-
expect(File.exist?('spec/files/export/analysis/0_3_5_multiple_measure_paths.zip')).to eq true
|
463
|
-
|
464
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.8.0')
|
465
|
-
expect(@excel.settings['spreadsheet_version']).to eq '0.3.5'
|
466
|
-
expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
|
467
|
-
expect(@excel.settings['worker_instance_type']).to eq 'c3.2xlarge'
|
468
|
-
|
469
|
-
expect(@excel.aws_tags).to eq(['org=5500', 'nothing=else matters'])
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
context 'version 0.3.7 and worker init-final scripts' do
|
474
|
-
before :all do
|
475
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_7_worker_init_final.xlsx')
|
476
|
-
expect(@excel.process).to eq(true)
|
477
|
-
end
|
478
|
-
|
479
|
-
it 'should save the analysis' do
|
480
|
-
@excel.save_analysis
|
481
|
-
model_uuid = @excel.models.first[:name]
|
482
|
-
|
483
|
-
expect(File.exist?('spec/files/export/analysis/0_3_7_worker_init_final.json')).to eq true
|
484
|
-
expect(File.exist?('spec/files/export/analysis/0_3_7_worker_init_final.zip')).to eq true
|
485
|
-
|
486
|
-
expect(@excel.worker_inits.size).to eq 2
|
487
|
-
expect(@excel.worker_inits[0][:name]).to eq 'initialize me'
|
488
|
-
expect(@excel.worker_inits[0][:args]).to eq '["first_arg",2,{a_hash: "input"}]'
|
489
|
-
|
490
|
-
# test the eval'ing of the args
|
491
|
-
a = eval(@excel.analysis.worker_inits.first[:metadata][:args])
|
492
|
-
expect(a[0]).to eq 'first_arg'
|
493
|
-
expect(a[1]).to eq 2
|
494
|
-
expect(a[2]).to be_a Hash
|
495
|
-
expect(a[2][:a_hash]).to eq 'input'
|
496
|
-
|
497
|
-
expect(File.basename(@excel.analysis.worker_inits.first[:file])).to eq 'first_file.rb'
|
498
|
-
expect(File.basename(@excel.analysis.worker_inits.last[:file])).to eq 'second_file.rb'
|
499
|
-
|
500
|
-
expect(@excel.analysis.worker_finalizes.size).to eq 1
|
501
|
-
expect(File.basename(@excel.analysis.worker_finalizes.first[:file])).to eq 'first_file.rb'
|
502
|
-
end
|
503
|
-
end
|
504
|
-
|
505
|
-
context 'version 0.3.7 and worker init-final scripts' do
|
506
|
-
before :all do
|
507
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_4_0_lhs_discrete_continuous.xlsx')
|
508
|
-
end
|
509
|
-
|
510
|
-
it 'should fail to process' do
|
511
|
-
@excel.process
|
512
|
-
# expect { @excel.process }.to raise_error("Measure Display Names are not unique for 'Rotate Building Relative to Current Orientation', 'Nothing Important'")
|
513
|
-
|
514
|
-
@excel.save_analysis
|
515
|
-
end
|
516
|
-
end
|
517
|
-
|
518
|
-
context 'version 0.4.0 multiple seed models' do
|
519
|
-
before :all do
|
520
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_4_0_multiple_seeds.xlsx')
|
521
|
-
expect(@excel.process).to eq(true)
|
522
|
-
end
|
523
|
-
|
524
|
-
it 'should save the analysis' do
|
525
|
-
expect { @excel.analysis }.to raise_error /There are more than one seed models defined in the excel file. Call .analyses. to return the array/
|
526
|
-
model_uuid = "#{@excel.name.to_underscore}_#{@excel.models.first[:name]}"
|
527
|
-
|
528
|
-
@excel.save_analysis # this will save all the analyses
|
529
|
-
|
530
|
-
@excel.models.each do |f|
|
531
|
-
model_uuid = "#{@excel.name.to_underscore}_#{f[:name]}"
|
532
|
-
puts model_uuid
|
533
|
-
expect(File.exist?("spec/files/export/analysis/#{model_uuid}.json")).to eq true
|
534
|
-
expect(File.exist?("spec/files/export/analysis/#{model_uuid}.zip")).to eq true
|
535
|
-
end
|
536
|
-
|
537
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.11.0-rc2')
|
538
|
-
expect(@excel.settings['spreadsheet_version']).to eq '0.4.0'
|
539
|
-
expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
|
540
|
-
expect(@excel.settings['worker_instance_type']).to eq 'c3.4xlarge'
|
541
|
-
expect(@excel.aws_tags).to eq(['org=5500'])
|
542
|
-
end
|
543
|
-
end
|
544
|
-
|
545
|
-
context 'version 0.4.0 pivot test' do
|
546
|
-
before :all do
|
547
|
-
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_4_0_pivot_test.xlsx')
|
548
|
-
expect(@excel.process).to eq(true)
|
549
|
-
end
|
550
|
-
|
551
|
-
it 'should save the analysis' do
|
552
|
-
a = @excel.analysis
|
553
|
-
|
554
|
-
@excel.save_analysis # this will save all the analyses
|
555
|
-
|
556
|
-
j = JSON.parse(File.read('spec/files/export/analysis/pivot_test.json'))
|
557
|
-
|
558
|
-
expect(j['analysis']['problem']['workflow'][0]['name']).to eq 'reduce_lighting_loads_by_percentage'
|
559
|
-
expect(j['analysis']['problem']['workflow'][0]['variables'][0]['variable_type']).to eq 'pivot'
|
560
|
-
expect(j['analysis']['problem']['workflow'][0]['variables'][0]['pivot']).to eq true
|
561
|
-
expect(j['analysis']['problem']['workflow'][1]['variables'][0]['variable']).to eq true
|
562
|
-
expect(j['analysis']['problem']['workflow'][1]['variables'][0]['pivot']).to eq nil
|
563
|
-
|
564
|
-
expect(@excel.settings['openstudio_server_version']).to eq('1.11.0-rc2')
|
565
|
-
expect(@excel.settings['spreadsheet_version']).to eq '0.4.0'
|
566
|
-
expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
|
567
|
-
expect(@excel.settings['worker_instance_type']).to eq 'c3.4xlarge'
|
568
|
-
expect(@excel.aws_tags).to eq(['org=5500'])
|
569
|
-
end
|
570
|
-
end
|
571
|
-
end
|