openstudio-analysis 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile +1 -5
  6. data/LICENSE.md +1 -1
  7. data/Rakefile +1 -1
  8. data/lib/openstudio-analysis.rb +1 -1
  9. data/lib/openstudio/analysis.rb +23 -27
  10. data/lib/openstudio/analysis/algorithm_attributes.rb +1 -1
  11. data/lib/openstudio/analysis/formulation.rb +1 -1
  12. data/lib/openstudio/analysis/server_api.rb +8 -14
  13. data/lib/openstudio/analysis/support_files.rb +1 -1
  14. data/lib/openstudio/analysis/translator/datapoints.rb +1 -1
  15. data/lib/openstudio/analysis/translator/excel.rb +2 -2
  16. data/lib/openstudio/analysis/translator/workflow.rb +8 -12
  17. data/lib/openstudio/analysis/version.rb +2 -2
  18. data/lib/openstudio/analysis/workflow.rb +1 -1
  19. data/lib/openstudio/analysis/workflow_step.rb +63 -71
  20. data/lib/openstudio/helpers/hash.rb +1 -1
  21. data/lib/openstudio/helpers/string.rb +1 -1
  22. data/lib/openstudio/weather/epw.rb +1 -1
  23. data/openstudio-analysis.gemspec +17 -13
  24. data/update_license.rb +3 -3
  25. metadata +57 -181
  26. data/spec/files/0_1_09_no_variables.xlsx +0 -0
  27. data/spec/files/0_1_09_outputvars.xlsx +0 -0
  28. data/spec/files/0_1_09_setup_version_2.xlsx +0 -0
  29. data/spec/files/0_1_09_small_list.xlsx +0 -0
  30. data/spec/files/0_1_09_small_list_incomplete.xlsx +0 -0
  31. data/spec/files/0_1_09_small_list_repeat_vars.xlsx +0 -0
  32. data/spec/files/0_1_09_small_list_validation_errors.xlsx +0 -0
  33. data/spec/files/0_1_10_proxy.xlsx +0 -0
  34. data/spec/files/0_1_10_proxy_user.xlsx +0 -0
  35. data/spec/files/0_1_10_template_input.xlsx +0 -0
  36. data/spec/files/0_1_11_discrete_variables.xlsx +0 -0
  37. data/spec/files/0_1_12_discrete_dynamic_columns.xlsx +0 -0
  38. data/spec/files/0_2_0_template.xlsx +0 -0
  39. data/spec/files/0_2_0_template_simpletest.xlsx +0 -0
  40. data/spec/files/0_3_0_dynamic_uuids.xlsx +0 -0
  41. data/spec/files/0_3_0_measure_existence.xlsx +0 -0
  42. data/spec/files/0_3_0_outputs.xlsx +0 -0
  43. data/spec/files/0_3_3_short_names.xlsx +0 -0
  44. data/spec/files/0_3_5_multiple_measure_paths.xlsx +0 -0
  45. data/spec/files/0_3_7_unique_measure_names.xlsx +0 -0
  46. data/spec/files/0_3_7_worker_init_final.xlsx +0 -0
  47. data/spec/files/0_4_0_lhs_discrete_continuous.xlsx +0 -0
  48. data/spec/files/0_4_0_multiple_seeds.xlsx +0 -0
  49. data/spec/files/0_4_0_pivot_test.xlsx +0 -0
  50. data/spec/files/analysis/examples/discrete_lhs_example.json +0 -809
  51. data/spec/files/analysis/examples/medium_office_example.json +0 -1674
  52. data/spec/files/analysis/examples/medium_office_workflow.json +0 -1298
  53. data/spec/files/measures/ActualMeasureNoJson/measure.rb +0 -80
  54. data/spec/files/measures/ActualMeasureNoJson/measure.xml +0 -2
  55. data/spec/files/measures/ExampleMeasure/measure.json +0 -3
  56. data/spec/files/measures/ExampleMeasure/measure.rb +0 -5
  57. data/spec/files/measures/ExampleMeasure/measure.xml +0 -1
  58. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.json +0 -36
  59. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.rb +0 -22
  60. data/spec/files/measures/IncreaseInsulationRValueForRoofs/measure.xml +0 -5
  61. data/spec/files/measures/NoMeasureRbFile/.gitkeep +0 -0
  62. data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.json +0 -3
  63. data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.rb +0 -5
  64. data/spec/files/measures/ReduceLightingLoadsByPercentage/measure.xml +0 -1
  65. data/spec/files/measures/SetThermostatSchedules/measure.json +0 -63
  66. data/spec/files/measures/SetThermostatSchedules/measure.rb +0 -254
  67. data/spec/files/measures/SetThermostatSchedules/measure.xml +0 -2
  68. data/spec/files/measures/example_measure_auto_directory_name/measure.json +0 -3
  69. data/spec/files/measures/example_measure_auto_directory_name/measure.rb +0 -5
  70. data/spec/files/measures/example_measure_auto_directory_name/measure.xml +0 -1
  71. data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.json +0 -3
  72. data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.rb +0 -5
  73. data/spec/files/measures/reduce_lighting_loads_by_percentage/measure.xml +0 -1
  74. data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.rb +0 -5
  75. data/spec/files/measures/reduce_space_infiltration_by_percentage/measure.xml +0 -1
  76. data/spec/files/measures/rotate_building/measure.rb +0 -5
  77. data/spec/files/measures/rotate_building/measure.xml +0 -1
  78. data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.rb +0 -5
  79. data/spec/files/measures/set_window_to_wall_ratio_by_facade/measure.xml +0 -1
  80. data/spec/files/measures_second_path/measure_in_another_dir/measure.json +0 -3
  81. data/spec/files/measures_second_path/measure_in_another_dir/measure.rb +0 -5
  82. data/spec/files/measures_second_path/measure_in_another_dir/measure.xml +0 -1
  83. data/spec/files/partial_weather.epw +0 -32
  84. data/spec/files/partial_weather_2.epw +0 -32
  85. data/spec/files/small_seed.osm +0 -4622
  86. data/spec/files/worker_init/first_file.rb +0 -15
  87. data/spec/files/worker_init/second_file.sh +0 -4
  88. data/spec/files/workflow/analysis.osa +0 -1334
  89. data/spec/files/workflow/datapoint_0.osd +0 -65
  90. data/spec/files/workflow/datapoint_1.osd +0 -65
  91. data/spec/files/workflow/datapoint_2.osd +0 -65
  92. data/spec/files/workflow/datapoint_wrong_osa_id.osd +0 -65
  93. data/spec/integration/server_api_spec.rb +0 -83
  94. data/spec/openstudio/excel_spec.rb +0 -606
  95. data/spec/openstudio/formulation_spec.rb +0 -200
  96. data/spec/openstudio/hash_spec.rb +0 -56
  97. data/spec/openstudio/osw_spec.rb +0 -129
  98. data/spec/openstudio/server_api_spec.rb +0 -68
  99. data/spec/openstudio/string_spec.rb +0 -34
  100. data/spec/openstudio/support_files_spec.rb +0 -89
  101. data/spec/openstudio/weather_spec.rb +0 -80
  102. data/spec/openstudio/workflow_spec.rb +0 -126
  103. data/spec/openstudio/workflow_step_spec.rb +0 -158
  104. data/spec/schema/osa.json +0 -613
  105. data/spec/schema/osa.png +0 -0
  106. data/spec/schema/osd.json +0 -110
  107. data/spec/schema/osd.png +0 -0
  108. data/spec/spec_helper.rb +0 -56
@@ -1,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,83 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
- # All rights reserved.
4
- # Redistribution and use in source and binary forms, with or without
5
- # modification, are permitted provided that the following conditions are met:
6
- #
7
- # (1) Redistributions of source code must retain the above copyright notice,
8
- # this list of conditions and the following disclaimer.
9
- #
10
- # (2) Redistributions in binary form must reproduce the above copyright notice,
11
- # this list of conditions and the following disclaimer in the documentation
12
- # and/or other materials provided with the distribution.
13
- #
14
- # (3) Neither the name of the copyright holder nor the names of any contributors
15
- # may be used to endorse or promote products derived from this software without
16
- # specific prior written permission from the respective party.
17
- #
18
- # (4) Other than as required in clauses (1) and (2), distributions in any form
19
- # of modifications or other derivative works may not use the "OpenStudio"
20
- # trademark, "OS", "os", or any other confusingly similar designation without
21
- # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
- #
23
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
- # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
- # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
- # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
- # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
- # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
- # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
- # *******************************************************************************
35
-
36
- require 'spec_helper'
37
-
38
- describe OpenStudio::Analysis::ServerApi, type: :integration do
39
- before :all do
40
- @host = 'http://localhost:8080'
41
- end
42
-
43
- context 'create and delete a project', type: :api_integration do
44
- before :all do
45
- @api = OpenStudio::Analysis::ServerApi.new
46
- expect(@api.hostname).to eq(@host)
47
- end
48
-
49
- it 'should create the project' do
50
- project_id = @api.new_project({})
51
- 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}/
52
-
53
- # get the projects from the api
54
- project_ids = @api.get_project_ids
55
- expect(project_ids.include?(project_id)).to eq true
56
-
57
- # delete the project
58
- r = @api.delete_project project_id
59
- expect(r).to be true
60
- end
61
-
62
- it 'should not be able to delete a non-existent project' do
63
- r = @api.delete_project('not_a_uuid')
64
- expect(r).to eq false
65
- end
66
-
67
- it 'create multiple projects and then delete them all' do
68
- (1..20).each do |_p|
69
- project_id = @api.new_project({})
70
- 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}/
71
- end
72
-
73
- r = @api.delete_all
74
- expect(r).to eq true
75
- end
76
-
77
- it 'should upload an analysis' do
78
- puts Dir.pwd
79
- j = 'spec/files/analysis/medium_office.json'
80
- z = 'spec/files/analysis/medium_office.zip'
81
- end
82
- end
83
- end
@@ -1,606 +0,0 @@
1
- # *******************************************************************************
2
- # OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
3
- # All rights reserved.
4
- # Redistribution and use in source and binary forms, with or without
5
- # modification, are permitted provided that the following conditions are met:
6
- #
7
- # (1) Redistributions of source code must retain the above copyright notice,
8
- # this list of conditions and the following disclaimer.
9
- #
10
- # (2) Redistributions in binary form must reproduce the above copyright notice,
11
- # this list of conditions and the following disclaimer in the documentation
12
- # and/or other materials provided with the distribution.
13
- #
14
- # (3) Neither the name of the copyright holder nor the names of any contributors
15
- # may be used to endorse or promote products derived from this software without
16
- # specific prior written permission from the respective party.
17
- #
18
- # (4) Other than as required in clauses (1) and (2), distributions in any form
19
- # of modifications or other derivative works may not use the "OpenStudio"
20
- # trademark, "OS", "os", or any other confusingly similar designation without
21
- # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
- #
23
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
- # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
- # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
- # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
- # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
- # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
- # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
- # *******************************************************************************
35
-
36
- require 'spec_helper'
37
-
38
- describe OpenStudio::Analysis::Translator::Excel do
39
- before :all do
40
- clean_dir = File.expand_path 'spec/files/export/analysis'
41
-
42
- if Dir.exist? clean_dir
43
- FileUtils.rm_rf clean_dir
44
- end
45
- end
46
-
47
- context 'no variables defined' do
48
- let(:path) { 'spec/files/0_1_09_no_variables.xlsx' }
49
-
50
- before(:each) do
51
- @excel = OpenStudio::Analysis::Translator::Excel.new(path)
52
- end
53
-
54
- it 'should have excel data' do
55
- expect(@excel).not_to be_nil
56
- end
57
-
58
- it 'should process the excel file' do
59
- expect(@excel.process).to eq(true)
60
-
61
- # after processing the measures directory should be what is in the excel file
62
- expect(@excel.measure_paths[0]).to eq(File.expand_path(File.join('spec', 'files', 'measures')))
63
- end
64
-
65
- it 'should not work because no variables defined' do
66
- # old_path = @excel.measure_path
67
- # @excel.measure_path = "path/does/not/exist"
68
- #
69
- end
70
-
71
- it 'should not export to a JSON' do
72
- @excel.process
73
- end
74
- end
75
-
76
- context 'small list of incomplete variables' do
77
- before(:all) do
78
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list_incomplete.xlsx')
79
- end
80
-
81
- it 'should fail to process' do
82
- expect { @excel.process }.to raise_error('Variable adjust_thermostat_setpoints_by_degrees:cooling_adjustment must have a mean')
83
- end
84
- end
85
-
86
- context 'small list with with repeated variable names' do
87
- before(:all) do
88
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list_repeat_vars.xlsx')
89
- end
90
-
91
- it 'should fail to process' do
92
- expect { @excel.process }.to raise_error('duplicate variable names found in list ["Insulation R-value (ft^2*h*R/Btu)."]')
93
- end
94
- end
95
-
96
- context 'small list of variables should not validate' do
97
- before(:all) do
98
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list_validation_errors.xlsx')
99
- end
100
-
101
- it 'should fail to process' do
102
- error_message = 'Variable min is greater than variable max for adjust_thermostat_setpoints_by_degrees:heating_adjustment'
103
- expect { @excel.process }.to raise_error(error_message)
104
- end
105
- end
106
-
107
- context 'small list of variables' do
108
- before(:all) do
109
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_small_list.xlsx')
110
- @excel.process
111
- end
112
- it 'should have a model' do
113
- expect(@excel.models.first).not_to be_nil
114
- expect(@excel.models.first[:name]).to eq('small_seed')
115
- end
116
-
117
- it 'should have a weather file' do
118
- expect(@excel.weather_files.first).not_to be_nil
119
- expect(@excel.weather_files.first.include?('partial_weather')).to eq(true)
120
- end
121
-
122
- it 'should have notes and source' do
123
- @excel.variables['data'].each do |measure|
124
- measure['variables'].each do |var|
125
- if var['machine_name'] == 'lighting_power_reduction'
126
- expect(var['distribution']['source']).to eq('some data source')
127
- elsif var['machine_name'] == 'demo_cost_initial_const'
128
- expect(var['notes']).to eq('some note')
129
- end
130
- end
131
- end
132
- end
133
-
134
- it 'should write a json' do
135
- @excel.save_analysis
136
- expect(File).to exist('spec/files/export/analysis/example_analysis.json')
137
- expect(File).to exist('spec/files/export/analysis/example_analysis.zip')
138
-
139
- expect(JSON.parse(File.read('spec/files/export/analysis/example_analysis.json'))).not_to be_nil
140
- end
141
- end
142
-
143
- context 'setup version 0.1.9' do
144
- before(:all) do
145
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_setup_version_2.xlsx')
146
- @excel.process
147
- end
148
-
149
- it 'should have a version and analysis name in machine format' do
150
- expect(@excel.version).to eq('0.1.9')
151
- expect(@excel.analysis_name).to eq('example_analysis')
152
- end
153
- it 'should have the new settings' do
154
- expect(@excel.settings['server_instance_type']).to eq('m2.xlarge')
155
- end
156
-
157
- it 'should have algorithm setup' do
158
- h = @excel.analysis
159
-
160
- expect(h.algorithm['number_of_samples']).to eq(100)
161
- expect(h.algorithm['number_of_generations']).to eq(20)
162
- expect(h.algorithm['sample_method']).to eq('all_variables')
163
- expect(h.algorithm['number_of_generations']).to be_a Integer
164
- expect(h.algorithm['tolerance']).to eq(0.115)
165
- expect(h.algorithm['tolerance']).to be_a Float
166
- end
167
-
168
- it 'should create a valid hash' do
169
- h = @excel.analysis
170
-
171
- expect(h.analysis_type).to eq('lhs')
172
- expect(h.algorithm).to be_a OpenStudio::Analysis::AlgorithmAttributes
173
- expect(h.algorithm['number_of_samples']).to eq(100)
174
- expect(h.algorithm['sample_method']).to eq('all_variables')
175
- end
176
- end
177
-
178
- context 'proxy setup' do
179
- before(:all) do
180
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_10_proxy.xlsx')
181
- @excel.process
182
- end
183
-
184
- it 'should have a proxy setting' do
185
- expect(@excel.settings['proxy_host']).to eq('192.168.0.1')
186
- expect(@excel.settings['proxy_port']).to eq(8080)
187
- expect(@excel.settings['proxy_username']).to be_nil
188
- end
189
- end
190
-
191
- context 'proxy setup with user' do
192
- before(:all) do
193
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_10_proxy_user.xlsx')
194
- @excel.process
195
- end
196
-
197
- it 'should have a user' do
198
- expect(@excel.settings['proxy_host']).to eq('192.168.0.1')
199
- expect(@excel.settings['proxy_port']).to eq(8080)
200
- expect(@excel.settings['proxy_username']).to eq('a_user')
201
- end
202
- end
203
-
204
- context 'discrete variables' do
205
- before(:all) do
206
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_11_discrete_variables.xlsx')
207
- @excel.process
208
- end
209
-
210
- it 'should have parsed the spreadsheet' do
211
- @excel.variables['data'].each do |measure|
212
- measure['variables'].each do |var|
213
- # TODO: Add some tests!
214
- if var['name'] == 'alter_design_days'
215
- expect(var['type']).to eq 'bool'
216
- expect(var['distribution']['discrete_values']).to match_array [true, false]
217
- expect(var['distribution']['discrete_weights']).to match_array [0.8, 0.2]
218
- end
219
- end
220
- end
221
- end
222
-
223
- it 'should save the file' do
224
- @excel.save_analysis
225
- expect(File.exist?('spec/files/export/analysis/example_analysis.json')).to eq true
226
- expect(File.exist?('spec/files/export/analysis/example_analysis.zip')).to eq true
227
- end
228
- end
229
-
230
- context 'discrete with dynamic columns' do
231
- before(:all) do
232
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_12_discrete_dynamic_columns.xlsx')
233
- @excel.process
234
- end
235
-
236
- it 'should have parsed the spreadsheet' do
237
- @excel.variables['data'].each do |measure|
238
- measure['variables'].each do |_var|
239
- # TODO: test something?
240
- end
241
- end
242
- end
243
-
244
- it 'should save the file' do
245
- @excel.save_analysis
246
- expect(File.exist?('spec/files/export/analysis/test_model.json')).to eq true
247
- expect(File.exist?('spec/files/export/analysis/test_model.zip')).to eq true
248
- end
249
- end
250
-
251
- context 'setup output variables' do
252
- before(:all) do
253
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_09_outputvars.xlsx')
254
- @excel.process
255
- end
256
-
257
- it 'should have a model' do
258
- expect(@excel.models.first).not_to be_nil
259
- expect(@excel.models.first[:name]).to eq('0_1_09_outputvars')
260
- end
261
-
262
- it 'should have a weather file' do
263
- expect(@excel.weather_files.first).not_to be_nil
264
- expect(@excel.weather_files.first.include?('partial_weather')).to eq(true)
265
- end
266
-
267
- it 'should have notes and source' do
268
- @excel.variables['data'].each do |measure|
269
- measure['variables'].each do |var|
270
- if var['machine_name'] == 'lighting_power_reduction'
271
- expect(var['distribution']['source']).to eq('some data source')
272
- elsif var['machine_name'] == 'demo_cost_initial_const'
273
- expect(var['notes']).to eq('some note')
274
- end
275
- end
276
- end
277
- end
278
-
279
- it 'should have algorithm setup' do
280
- expect(@excel.algorithm['number_of_samples']).to eq(100)
281
- expect(@excel.algorithm['number_of_generations']).to eq(20)
282
- expect(@excel.algorithm['sample_method']).to eq('all_variables')
283
- expect(@excel.algorithm['number_of_generations']).to be_a Integer
284
- # expect(@excel.algorithm["tolerance"]).to eq(0.115)
285
- # expect(@excel.algorithm["tolerance"]).to be_a Float
286
- end
287
-
288
- it 'should create a valid hash' do
289
- h = @excel.analysis
290
-
291
- expect(h.analysis_type).to eq('nsga')
292
- expect(h.algorithm).to be_a OpenStudio::Analysis::AlgorithmAttributes
293
- expect(h.algorithm['number_of_samples']).to eq(100)
294
- expect(h.algorithm['sample_method']).to eq('all_variables')
295
- end
296
-
297
- it 'should write a json' do
298
- @excel.save_analysis
299
- expect(File).to exist('spec/files/export/analysis/0_1_09_outputvars.json')
300
- expect(File).to exist('spec/files/export/analysis/0_1_09_outputvars.zip')
301
- expect(JSON.parse(File.read('spec/files/export/analysis/0_1_09_outputvars.json'))).not_to be_nil
302
- end
303
- end
304
-
305
- context 'version 0.1.10' do
306
- before(:all) do
307
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_1_10_template_input.xlsx')
308
- end
309
-
310
- it 'should process' do
311
- expect(@excel.process).to eq(true)
312
- end
313
-
314
- it 'should have new setting variables' do
315
- expect(@excel.settings['user_id']).to eq('new_user')
316
- expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
317
- expect(@excel.cluster_name).to eq('analysis_cluster')
318
- expect(@excel.run_setup['analysis_name']).to eq('LHS Example Project')
319
- end
320
- end
321
-
322
- context 'version 0.2.0' do
323
- before(:all) do
324
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_2_0_template.xlsx')
325
- end
326
-
327
- it 'should process' do
328
- expect(@excel.process).to eq(true)
329
- expect(@excel.settings['user_id']).to eq('new_user')
330
- expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
331
- expect(@excel.cluster_name).to eq('analysis_cluster_name')
332
- expect(@excel.run_setup['analysis_name']).to eq('Name goes here')
333
- expect(@excel.variables['data'][1]['measure_file_name_directory']).to eq('ReduceLightingLoadsByPercentage')
334
- end
335
-
336
- it 'should write a json' do
337
- @excel.save_analysis
338
- end
339
- end
340
-
341
- context 'version 0.2.0 simple' do
342
- before(:all) do
343
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_2_0_template_simpletest.xlsx')
344
- end
345
-
346
- it 'should process' do
347
- expect(@excel.process).to eq(true)
348
- end
349
-
350
- it 'should have new setting variables' do
351
- expect(@excel.settings['user_id']).to eq('new_user')
352
- expect(@excel.settings['openstudio_server_version']).to eq('1.3.2')
353
- end
354
-
355
- it 'should have the new measure directory column' do
356
- expect(@excel.variables['data'][0]['measure_file_name_directory']).to eq('ExampleMeasure')
357
- expect(@excel.variables['data'][0]['display_name']).to eq('Baseline')
358
- end
359
-
360
- it 'should write a json' do
361
- @excel.save_analysis
362
- expect(File.exist?('spec/files/export/analysis/simple_test.json')).to eq true
363
- expect(File.exist?('spec/files/export/analysis/simple_test.zip')).to eq true
364
- end
365
- end
366
-
367
- context 'version 0.3.0 objective functions' do
368
- before(:all) do
369
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_0_outputs.xlsx')
370
- expect(@excel.process).to eq(true)
371
- end
372
-
373
- it 'should have new setting variables' do
374
- expect(@excel.settings['user_id']).to eq('new_user')
375
- expect(@excel.settings['openstudio_server_version']).to eq('1.6.1')
376
- end
377
-
378
- it 'should have typed outputs' do
379
- h = @excel.analysis
380
-
381
- expect(h.outputs).to be_an Array
382
- h.outputs.each do |o|
383
- if o['name'] == 'standard_report_legacy.total_energy'
384
- expect(o['variable_type']).to eq 'double'
385
- expect(o['objective_function']).to eq true
386
- expect(o['objective_function_index']).to eq 0
387
- expect(o['objective_function_target']).to eq nil
388
- expect(o['scaling_factor']).to eq nil
389
- expect(o['objective_function_group']).to eq 1
390
- end
391
- if o['name'] == 'standard_report_legacy.total_source_energy'
392
- expect(o['variable_type']).to eq 'double'
393
- expect(o['objective_function']).to eq true
394
- expect(o['objective_function_index']).to eq 1
395
- expect(o['objective_function_target']).to eq 25.1
396
- expect(o['scaling_factor']).to eq 25.2
397
- expect(o['objective_function_group']).to eq 7
398
- end
399
- end
400
- end
401
-
402
- it 'should write a json' do
403
- @excel.save_analysis
404
- expect(File.exist?('spec/files/export/analysis/0_3_0_outputs.json')).to eq true
405
- expect(File.exist?('spec/files/export/analysis/0_3_0_outputs.zip')).to eq true
406
-
407
- # check the JSON
408
- h = JSON.parse(File.read('spec/files/export/analysis/0_3_0_outputs.json'))
409
- expect(h['analysis']['weather_file']).to be_a Hash
410
- expect(h['analysis']['weather_file']['path']).to match /partial_weather.*epw/
411
- end
412
- end
413
-
414
- context 'version 0.3.0 measure existence checks' do
415
- before(:all) do
416
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_0_measure_existence.xlsx')
417
- end
418
-
419
- it 'should process' do
420
- expect(@excel.process).to eq(true)
421
-
422
- model_name = @excel.models.first[:name]
423
- expect(model_name).to eq '0_3_0_outputs'
424
- end
425
-
426
- it 'should error out with missing measure information' do
427
- expect { @excel.save_analysis }.to raise_error /Measure in directory.*not contain a measure.rb.*$/
428
- end
429
- end
430
-
431
- context 'version 0.3.0 dynamic uuid assignments' do
432
- before(:all) do
433
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_0_dynamic_uuids.xlsx')
434
- expect(@excel.process).to eq(true)
435
- end
436
-
437
- it 'should process' do
438
- model_uuid = @excel.models.first[:name]
439
- 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}/
440
- end
441
-
442
- it 'should error out with missing measure information' do
443
- @excel.save_analysis
444
- model_uuid = @excel.models.first[:name]
445
- expect(File.exist?('spec/files/export/analysis/0_3_0_dynamic_uuids.json')).to eq true
446
- expect(File.exist?('spec/files/export/analysis/0_3_0_dynamic_uuids.zip')).to eq true
447
- end
448
- end
449
-
450
- context 'version 0.3.3 and short display names' do
451
- before :all do
452
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_3_short_names.xlsx')
453
- expect(@excel.process).to eq(true)
454
- end
455
-
456
- it 'should process' do
457
- model_uuid = @excel.models.first[:name]
458
- 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}/
459
- end
460
-
461
- it 'should process and save short display names' do
462
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_3_short_names.xlsx')
463
- expect(@excel.process).to eq(true)
464
- @excel.save_analysis
465
- model_uuid = @excel.models.first[:name]
466
- expect(File.exist?('spec/files/export/analysis/0_3_3_short_names.json')).to eq true
467
- expect(File.exist?('spec/files/export/analysis/0_3_3_short_names.zip')).to eq true
468
-
469
- @excel.outputs['output_variables'].each do |o|
470
- expect(o['display_name_short']).to eq 'Site EUI' if o['name'] == 'standard_report_legacy.total_energy'
471
- expect(o['display_name_short']).to eq 'Natural Gas Heating Intensity' if o['name'] == 'standard_report_legacy.heating_natural_gas'
472
- end
473
-
474
- # Check the JSON
475
- j = JSON.parse(File.read('spec/files/export/analysis/0_3_3_short_names.json'))
476
-
477
- expect(j['analysis']['output_variables'].first['display_name']).to eq 'Total Site Energy Intensity'
478
- expect(j['analysis']['output_variables'].first['display_name_short']).to eq 'Site EUI'
479
- expect(j['analysis']['problem']['workflow'][0]['variables'][0]['argument']['display_name']).to eq 'Orientation'
480
- expect(j['analysis']['problem']['workflow'][0]['variables'][0]['argument']['display_name_short']).to eq 'Shorter Display Name'
481
- expect(j['analysis']['problem']['workflow'][1]['arguments'][1]['display_name']).to eq 'unknown'
482
- expect(j['analysis']['problem']['workflow'][1]['arguments'][1]['display_name_short']).to eq 'un'
483
- end
484
- end
485
-
486
- context 'version 0.3.5 and measure paths' do
487
- before :all do
488
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_5_multiple_measure_paths.xlsx')
489
- expect(@excel.process).to eq(true)
490
- end
491
-
492
- it 'should save the analysis' do
493
- @excel.save_analysis
494
- model_uuid = @excel.models.first[:name]
495
-
496
- expect(File.exist?('spec/files/export/analysis/0_3_5_multiple_measure_paths.json')).to eq true
497
- expect(File.exist?('spec/files/export/analysis/0_3_5_multiple_measure_paths.zip')).to eq true
498
-
499
- expect(@excel.settings['openstudio_server_version']).to eq('1.8.0')
500
- expect(@excel.settings['spreadsheet_version']).to eq '0.3.5'
501
- expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
502
- expect(@excel.settings['worker_instance_type']).to eq 'c3.2xlarge'
503
-
504
- expect(@excel.aws_tags).to eq(['org=5500', 'nothing=else matters'])
505
- end
506
- end
507
-
508
- context 'version 0.3.7 and worker init-final scripts' do
509
- before :all do
510
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_7_worker_init_final.xlsx')
511
- expect(@excel.process).to eq(true)
512
- end
513
-
514
- it 'should save the analysis' do
515
- @excel.save_analysis
516
- model_uuid = @excel.models.first[:name]
517
-
518
- expect(File.exist?('spec/files/export/analysis/0_3_7_worker_init_final.json')).to eq true
519
- expect(File.exist?('spec/files/export/analysis/0_3_7_worker_init_final.zip')).to eq true
520
-
521
- expect(@excel.worker_inits.size).to eq 2
522
- expect(@excel.worker_inits[0][:name]).to eq 'initialize me'
523
- expect(@excel.worker_inits[0][:args]).to eq '["first_arg",2,{a_hash: "input"}]'
524
-
525
- # test the eval'ing of the args
526
- a = eval(@excel.analysis.worker_inits.first[:metadata][:args])
527
- expect(a[0]).to eq 'first_arg'
528
- expect(a[1]).to eq 2
529
- expect(a[2]).to be_a Hash
530
- expect(a[2][:a_hash]).to eq 'input'
531
-
532
- expect(File.basename(@excel.analysis.worker_inits.first[:file])).to eq 'first_file.rb'
533
- expect(File.basename(@excel.analysis.worker_inits.last[:file])).to eq 'second_file.sh'
534
-
535
- expect(@excel.analysis.worker_finalizes.size).to eq 1
536
- expect(File.basename(@excel.analysis.worker_finalizes.first[:file])).to eq 'first_file.rb'
537
- end
538
- end
539
-
540
- context 'version 0.3.7 and worker init-final scripts' do
541
- before :all do
542
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_4_0_lhs_discrete_continuous.xlsx')
543
- end
544
-
545
- it 'should fail to process' do
546
- @excel.process
547
- # expect { @excel.process }.to raise_error("Measure Display Names are not unique for 'Rotate Building Relative to Current Orientation', 'Nothing Important'")
548
-
549
- @excel.save_analysis
550
- end
551
- end
552
-
553
- context 'version 0.4.0 multiple seed models' do
554
- before :all do
555
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_4_0_multiple_seeds.xlsx')
556
- expect(@excel.process).to eq(true)
557
- end
558
-
559
- it 'should save the analysis' do
560
- expect { @excel.analysis }.to raise_error /There are more than one seed models defined in the excel file. Call .analyses. to return the array/
561
- model_uuid = "#{@excel.name.to_underscore}_#{@excel.models.first[:name]}"
562
-
563
- @excel.save_analysis # this will save all the analyses
564
-
565
- @excel.models.each do |f|
566
- model_uuid = "#{@excel.name.to_underscore}_#{f[:name]}"
567
- puts model_uuid
568
- expect(File.exist?("spec/files/export/analysis/#{model_uuid}.json")).to eq true
569
- expect(File.exist?("spec/files/export/analysis/#{model_uuid}.zip")).to eq true
570
- end
571
-
572
- expect(@excel.settings['openstudio_server_version']).to eq('1.11.0-rc2')
573
- expect(@excel.settings['spreadsheet_version']).to eq '0.4.0'
574
- expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
575
- expect(@excel.settings['worker_instance_type']).to eq 'c3.4xlarge'
576
- expect(@excel.aws_tags).to eq(['org=5500'])
577
- end
578
- end
579
-
580
- context 'version 0.4.0 pivot test' do
581
- before :all do
582
- @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_4_0_pivot_test.xlsx')
583
- expect(@excel.process).to eq(true)
584
- end
585
-
586
- it 'should save the analysis' do
587
- a = @excel.analysis
588
-
589
- @excel.save_analysis # this will save all the analyses
590
-
591
- j = JSON.parse(File.read('spec/files/export/analysis/pivot_test.json'))
592
-
593
- expect(j['analysis']['problem']['workflow'][0]['name']).to eq 'reduce_lighting_loads_by_percentage'
594
- expect(j['analysis']['problem']['workflow'][0]['variables'][0]['variable_type']).to eq 'pivot'
595
- expect(j['analysis']['problem']['workflow'][0]['variables'][0]['pivot']).to eq true
596
- expect(j['analysis']['problem']['workflow'][1]['variables'][0]['variable']).to eq true
597
- expect(j['analysis']['problem']['workflow'][1]['variables'][0]['pivot']).to eq nil
598
-
599
- expect(@excel.settings['openstudio_server_version']).to eq('1.11.0-rc2')
600
- expect(@excel.settings['spreadsheet_version']).to eq '0.4.0'
601
- expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
602
- expect(@excel.settings['worker_instance_type']).to eq 'c3.4xlarge'
603
- expect(@excel.aws_tags).to eq(['org=5500'])
604
- end
605
- end
606
- end