openstudio-geb 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -3
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +7 -17
  5. data/files/seasonal_shedding_peak_hours.json +1 -0
  6. data/files/seasonal_shifting_peak_hours.json +1 -0
  7. data/files/seasonal_shifting_take_hours.json +1 -0
  8. data/lib/measures/AddElectricVehicleChargingLoad/measure.rb +247 -21
  9. data/lib/measures/AddElectricVehicleChargingLoad/tests/CZ06RV2.epw +8768 -0
  10. data/lib/measures/AddElectricVehicleChargingLoad/tests/add_electric_vehicle_charging_load_test.rb +40 -141
  11. data/lib/measures/AddElectricVehicleChargingLoad/tests/test.osm +55 -55
  12. data/lib/measures/AdjustThermostatSetpointsByDegreesForPeakHours/measure.rb +963 -442
  13. data/lib/measures/add_ceiling_fan/measure.rb +2 -2
  14. data/lib/measures/add_chilled_water_storage_tank/measure.rb +2 -2
  15. data/lib/measures/add_exterior_blinds_and_control/measure.rb +6 -5
  16. data/lib/measures/add_interior_blinds_and_control/measure.rb +5 -5
  17. data/lib/measures/add_rooftop_pv_simple/measure.rb +13 -10
  18. data/lib/measures/apply_dynamic_coating_to_roof_wall/measure.rb +2 -2
  19. data/lib/measures/average_ventilation_for_peak_hours/measure.rb +5 -5
  20. data/lib/measures/enable_occupancy_driven_lighting/measure.rb +2 -2
  21. data/lib/measures/precooling/measure.rb +964 -354
  22. data/lib/measures/preheating/measure.rb +940 -356
  23. data/lib/measures/reduce_epd_by_percentage_for_peak_hours/measure.rb +509 -300
  24. data/lib/measures/reduce_lpd_by_percentage_for_peak_hours/measure.rb +534 -309
  25. data/lib/openstudio/geb/run.rb +5 -1
  26. data/lib/openstudio/geb/utilities.rb +3 -2
  27. data/lib/openstudio/geb/version.rb +1 -1
  28. data/openstudio-geb.gemspec +7 -6
  29. metadata +24 -48
@@ -10,6 +10,7 @@ require 'openstudio/measure/ShowRunnerOutput'
10
10
  require 'minitest/autorun'
11
11
  require_relative '../measure.rb'
12
12
  require 'fileutils'
13
+ require 'json'
13
14
 
14
15
  class AddElectricVehicleChargingLoadTest < Minitest::Test
15
16
  # def setup
@@ -28,137 +29,8 @@ class AddElectricVehicleChargingLoadTest < Minitest::Test
28
29
  # create an instance of a runner
29
30
  runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
30
31
 
31
- # get arguments and test that they are what we are expecting
32
- arguments = measure.arguments(model)
33
- assert_equal(10, arguments.size)
34
- assert_equal('bldg_use_type', arguments[0].name)
35
- assert_equal('home', arguments[0].printValue)
36
-
37
-
38
- # set argument values to bad values and run the measure
39
- argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
40
-
41
- bldg_use_type = arguments[0].clone
42
- assert(bldg_use_type.setValue('workplace'))
43
- argument_map['bldg_use_type'] = bldg_use_type
44
-
45
- num_ev_chargers = arguments[1].clone
46
- assert(num_ev_chargers.setValue(3))
47
- argument_map['num_ev_chargers'] = num_ev_chargers
48
-
49
- num_evs = arguments[2].clone
50
- assert(num_evs.setValue(10))
51
- argument_map['num_evs'] = num_evs
52
-
53
- # avg_arrival_time = arguments[4].clone
54
- # assert(avg_arrival_time.setValue('9:00'))
55
- # argument_map['avg_arrival_time'] = avg_arrival_time
56
- #
57
- avg_leave_time = arguments[5].clone
58
- assert(avg_leave_time.setValue('23:30'))
59
- argument_map['avg_leave_time'] = avg_leave_time
60
-
61
- start_charge_time = arguments[6].clone
62
- assert(start_charge_time.setValue('17:00'))
63
- argument_map['start_charge_time'] = start_charge_time
64
-
65
- avg_charge_hours = arguments[7].clone
66
- assert(avg_charge_hours.setValue(4))
67
- argument_map['avg_charge_hours'] = avg_charge_hours
68
-
69
- # charge_on_sat = arguments[8].clone
70
- # assert(charge_on_sat.setValue(false))
71
- # argument_map['charge_on_sat'] = charge_on_sat
72
- #
73
- # charge_on_sun = arguments[9].clone
74
- # assert(charge_on_sun.setValue(false))
75
- # argument_map['charge_on_sun'] = charge_on_sun
76
-
77
-
78
- measure.run(model, runner, argument_map)
79
- result = runner.result
80
- puts "errors: #{result.errors.inspect}"
81
- puts "warnings: "
82
- result.warnings.each{|warning| puts warning.logMessage}
83
- show_output(result)
84
- assert(result.value.valueName == 'Success')
85
- assert(result.errors.empty?)
86
-
87
- # save the model
88
- # output_file_path = OpenStudio::Path.new('tests/test.osm')
89
- output_file_path = File.join(File.dirname(__FILE__), 'test.osm')
90
- model.save(output_file_path,true)
91
- end
92
-
93
- def test_number_of_arguments_and_argument_names
94
- # create an instance of the measure
95
- measure = AddElectricVehicleChargingLoad.new
96
-
97
- # make an empty model
98
- model = OpenStudio::Model::Model.new
99
-
100
- # get arguments and test that they are what we are expecting
101
- arguments = measure.arguments(model)
102
- assert_equal(1, arguments.size)
103
- assert_equal('space_name', arguments[0].name)
104
- end
105
-
106
- def test_bad_argument_values
107
- # create an instance of the measure
108
- measure = AddElectricVehicleChargingLoad.new
109
-
110
- # create runner with empty OSW
111
- osw = OpenStudio::WorkflowJSON.new
112
- runner = OpenStudio::Measure::OSRunner.new(osw)
113
-
114
- # make an empty model
115
- model = OpenStudio::Model::Model.new
116
-
117
32
  # get arguments
118
33
  arguments = measure.arguments(model)
119
- argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
120
-
121
- # create hash of argument values
122
- args_hash = {}
123
- args_hash['space_name'] = ''
124
-
125
- # populate argument with specified hash value if specified
126
- arguments.each do |arg|
127
- temp_arg_var = arg.clone
128
- if args_hash.key?(arg.name)
129
- assert(temp_arg_var.setValue(args_hash[arg.name]))
130
- end
131
- argument_map[arg.name] = temp_arg_var
132
- end
133
-
134
- # run the measure
135
- measure.run(model, runner, argument_map)
136
- result = runner.result
137
-
138
- # show the output
139
- show_output(result)
140
-
141
- # assert that it ran correctly
142
- assert_equal('Fail', result.value.valueName)
143
- end
144
-
145
- def test_good_argument_values
146
- # create an instance of the measure
147
- measure = AddElectricVehicleChargingLoad.new
148
-
149
- # create runner with empty OSW
150
- osw = OpenStudio::WorkflowJSON.new
151
- runner = OpenStudio::Measure::OSRunner.new(osw)
152
-
153
- # load the test model
154
- translator = OpenStudio::OSVersion::VersionTranslator.new
155
- path = "#{File.dirname(__FILE__)}/example_model.osm"
156
- model = translator.loadModel(path)
157
- assert(!model.empty?)
158
- model = model.get
159
-
160
- # store the number of spaces in the seed model
161
- num_spaces_seed = model.getSpaces.size
162
34
 
163
35
  # get arguments
164
36
  arguments = measure.arguments(model)
@@ -167,7 +39,26 @@ class AddElectricVehicleChargingLoadTest < Minitest::Test
167
39
  # create hash of argument values.
168
40
  # If the argument has a default that you want to use, you don't need it in the hash
169
41
  args_hash = {}
170
- args_hash['space_name'] = 'New Space'
42
+ # for workplace
43
+ # args_hash['bldg_use_type'] = 'workplace'
44
+ # args_hash['num_ev_chargers'] = 3
45
+ # args_hash['num_evs'] = 10
46
+ # args_hash['charger_level'] = 'Level 2'
47
+ # args_hash['avg_arrival_time'] = '9:00'
48
+ # args_hash['arrival_time_variation_in_mins'] = 60
49
+ # args_hash['avg_charge_hours'] = 2.5
50
+ # args_hash['charge_time_variation_in_mins'] = 60
51
+
52
+ # for commercial station
53
+ args_hash['bldg_use_type'] = 'commercial station'
54
+ args_hash['num_ev_chargers'] = 7
55
+ args_hash['num_evs'] = 28
56
+ args_hash['charger_level'] = 'DC charger'
57
+ args_hash['avg_arrival_time'] = '14:00'
58
+ args_hash['arrival_time_variation_in_mins'] = 300
59
+ args_hash['avg_charge_hours'] = 2
60
+ args_hash['charge_time_variation_in_mins'] = 30
61
+
171
62
  # using defaults values from measure.rb for other arguments
172
63
 
173
64
  # populate argument with specified hash value if specified
@@ -179,23 +70,31 @@ class AddElectricVehicleChargingLoadTest < Minitest::Test
179
70
  argument_map[arg.name] = temp_arg_var
180
71
  end
181
72
 
182
- # run the measure
183
73
  measure.run(model, runner, argument_map)
184
74
  result = runner.result
185
-
186
- # show the output
75
+ puts "errors: #{result.errors.inspect}"
76
+ puts "warnings: "
77
+ result.warnings.each{|warning| puts warning.logMessage}
187
78
  show_output(result)
188
-
189
- # assert that it ran correctly
190
- assert_equal('Success', result.value.valueName)
191
- assert(result.info.size == 1)
192
- assert(result.warnings.empty?)
193
-
194
- # check that there is now 1 space
195
- assert_equal(1, model.getSpaces.size - num_spaces_seed)
79
+ assert(result.value.valueName == 'Success')
80
+ assert(result.errors.empty?)
196
81
 
197
82
  # save the model to test output directory
198
83
  output_file_path = "#{File.dirname(__FILE__)}//output/test_output.osm"
199
84
  model.save(output_file_path, true)
85
+
86
+ # test run the modified model
87
+ osw = {}
88
+ osw["weather_file"] = File.join(File.dirname(__FILE__ ), "CZ06RV2.epw")
89
+ osw["seed_file"] = output_file_path
90
+ osw_path = "#{File.dirname(__FILE__)}//output/test_output.osw"
91
+ File.open(osw_path, 'w') do |f|
92
+ f << JSON.pretty_generate(osw)
93
+ end
94
+ cli_path = OpenStudio.getOpenStudioCLI
95
+ cmd = "\"#{cli_path}\" run -w \"#{osw_path}\""
96
+ puts cmd
97
+ system(cmd)
200
98
  end
99
+
201
100
  end
@@ -1,47 +1,47 @@
1
1
 
2
2
  OS:Version,
3
- {15c822a5-8680-412d-9051-4c5f5bf84af1}, !- Handle
4
- 3.1.0; !- Version Identifier
3
+ {710267aa-03b7-4f18-b675-4210bf362bb2}, !- Handle
4
+ 3.7.0; !- Version Identifier
5
5
 
6
6
  OS:Schedule:Ruleset,
7
- {cd6f08cb-2d6b-4ead-b510-9973ab57fb3c}, !- Handle
7
+ {5e51be1d-47a4-45a6-831f-69e2b394fc9c}, !- Handle
8
8
  EV Charging Power Draw, !- Name
9
- {49fe0c88-4ae2-4960-b3e1-046e84601563}, !- Schedule Type Limits Name
10
- {4af36474-1ece-45a3-872e-112cb929f330}; !- Default Day Schedule Name
9
+ {f4a971c0-7bb6-4f09-b54b-593ad91e646f}, !- Schedule Type Limits Name
10
+ {6bcacd24-481f-4f28-9dba-45fc1174e22a}; !- Default Day Schedule Name
11
11
 
12
12
  OS:Schedule:Day,
13
- {4af36474-1ece-45a3-872e-112cb929f330}, !- Handle
13
+ {6bcacd24-481f-4f28-9dba-45fc1174e22a}, !- Handle
14
14
  EV Charging Default, !- Name
15
- {49fe0c88-4ae2-4960-b3e1-046e84601563}, !- Schedule Type Limits Name
15
+ {f4a971c0-7bb6-4f09-b54b-593ad91e646f}, !- Schedule Type Limits Name
16
16
  , !- Interpolate to Timestep
17
17
  8, !- Hour 1
18
- 0, !- Minute 1
18
+ 8, !- Minute 1
19
19
  0, !- Value Until Time 1
20
20
  8, !- Hour 2
21
- 6, !- Minute 2
21
+ 19, !- Minute 2
22
22
  0.333333333333333, !- Value Until Time 2
23
23
  8, !- Hour 3
24
- 13, !- Minute 3
24
+ 20, !- Minute 3
25
25
  0.666666666666667, !- Value Until Time 3
26
- 20, !- Hour 4
27
- 5, !- Minute 4
26
+ 14, !- Hour 4
27
+ 34, !- Minute 4
28
28
  1, !- Value Until Time 4
29
- 20, !- Hour 5
30
- 20, !- Minute 5
29
+ 14, !- Hour 5
30
+ 39, !- Minute 5
31
31
  0.666666666666667, !- Value Until Time 5
32
- 23, !- Hour 6
33
- 8, !- Minute 6
32
+ 16, !- Hour 6
33
+ 21, !- Minute 6
34
34
  0.333333333333333, !- Value Until Time 6
35
35
  24, !- Hour 7
36
36
  0, !- Minute 7
37
- 0; !- Value Until Time 7
37
+ -1.2335811384724e-16; !- Value Until Time 7
38
38
 
39
39
  OS:Schedule:Rule,
40
- {311feac1-7062-41ae-b8f1-51dc8e415ed6}, !- Handle
40
+ {f33ae947-b72d-4290-aaef-fe86f9501ffc}, !- Handle
41
41
  EV Charging Power Saturday, !- Name
42
- {cd6f08cb-2d6b-4ead-b510-9973ab57fb3c}, !- Schedule Ruleset Name
42
+ {5e51be1d-47a4-45a6-831f-69e2b394fc9c}, !- Schedule Ruleset Name
43
43
  1, !- Rule Order
44
- {6d266ac8-247e-491c-b8cd-a96ec0f017e7}, !- Day Schedule Name
44
+ {8ec2458e-65f1-4aeb-990f-bedc9b3fadfa}, !- Day Schedule Name
45
45
  , !- Apply Sunday
46
46
  , !- Apply Monday
47
47
  , !- Apply Tuesday
@@ -51,83 +51,83 @@ OS:Schedule:Rule,
51
51
  Yes; !- Apply Saturday
52
52
 
53
53
  OS:Schedule:Day,
54
- {6d266ac8-247e-491c-b8cd-a96ec0f017e7}, !- Handle
54
+ {8ec2458e-65f1-4aeb-990f-bedc9b3fadfa}, !- Handle
55
55
  EV Charging Default 1, !- Name
56
- {49fe0c88-4ae2-4960-b3e1-046e84601563}, !- Schedule Type Limits Name
56
+ {f4a971c0-7bb6-4f09-b54b-593ad91e646f}, !- Schedule Type Limits Name
57
57
  , !- Interpolate to Timestep
58
58
  8, !- Hour 1
59
- 0, !- Minute 1
59
+ 8, !- Minute 1
60
60
  0, !- Value Until Time 1
61
61
  8, !- Hour 2
62
- 6, !- Minute 2
62
+ 19, !- Minute 2
63
63
  0.333333333333333, !- Value Until Time 2
64
64
  8, !- Hour 3
65
- 13, !- Minute 3
65
+ 20, !- Minute 3
66
66
  0.666666666666667, !- Value Until Time 3
67
- 20, !- Hour 4
68
- 5, !- Minute 4
67
+ 14, !- Hour 4
68
+ 34, !- Minute 4
69
69
  1, !- Value Until Time 4
70
- 20, !- Hour 5
71
- 20, !- Minute 5
70
+ 14, !- Hour 5
71
+ 39, !- Minute 5
72
72
  0.666666666666667, !- Value Until Time 5
73
- 23, !- Hour 6
74
- 8, !- Minute 6
73
+ 16, !- Hour 6
74
+ 21, !- Minute 6
75
75
  0.333333333333333, !- Value Until Time 6
76
76
  24, !- Hour 7
77
77
  0, !- Minute 7
78
- 0; !- Value Until Time 7
78
+ -1.2335811384724e-16; !- Value Until Time 7
79
79
 
80
80
  OS:Schedule:Rule,
81
- {f7becaf9-071a-4de9-979d-ee534e725aa2}, !- Handle
81
+ {a4dc317b-a25b-488b-8b39-3a45a92069f4}, !- Handle
82
82
  EV Charging Power Sunday, !- Name
83
- {cd6f08cb-2d6b-4ead-b510-9973ab57fb3c}, !- Schedule Ruleset Name
83
+ {5e51be1d-47a4-45a6-831f-69e2b394fc9c}, !- Schedule Ruleset Name
84
84
  0, !- Rule Order
85
- {8a773ccc-0531-4ec0-8b6c-00d4f6f4dc2d}, !- Day Schedule Name
85
+ {41604025-03c3-4af2-8370-f6ac84c8e3b7}, !- Day Schedule Name
86
86
  Yes; !- Apply Sunday
87
87
 
88
88
  OS:Schedule:Day,
89
- {8a773ccc-0531-4ec0-8b6c-00d4f6f4dc2d}, !- Handle
89
+ {41604025-03c3-4af2-8370-f6ac84c8e3b7}, !- Handle
90
90
  EV Charging Default 2, !- Name
91
- {49fe0c88-4ae2-4960-b3e1-046e84601563}, !- Schedule Type Limits Name
91
+ {f4a971c0-7bb6-4f09-b54b-593ad91e646f}, !- Schedule Type Limits Name
92
92
  , !- Interpolate to Timestep
93
93
  8, !- Hour 1
94
- 0, !- Minute 1
94
+ 8, !- Minute 1
95
95
  0, !- Value Until Time 1
96
96
  8, !- Hour 2
97
- 6, !- Minute 2
97
+ 19, !- Minute 2
98
98
  0.333333333333333, !- Value Until Time 2
99
99
  8, !- Hour 3
100
- 13, !- Minute 3
100
+ 20, !- Minute 3
101
101
  0.666666666666667, !- Value Until Time 3
102
- 20, !- Hour 4
103
- 5, !- Minute 4
102
+ 14, !- Hour 4
103
+ 34, !- Minute 4
104
104
  1, !- Value Until Time 4
105
- 20, !- Hour 5
106
- 20, !- Minute 5
105
+ 14, !- Hour 5
106
+ 39, !- Minute 5
107
107
  0.666666666666667, !- Value Until Time 5
108
- 23, !- Hour 6
109
- 8, !- Minute 6
108
+ 16, !- Hour 6
109
+ 21, !- Minute 6
110
110
  0.333333333333333, !- Value Until Time 6
111
111
  24, !- Hour 7
112
112
  0, !- Minute 7
113
- 0; !- Value Until Time 7
113
+ -1.2335811384724e-16; !- Value Until Time 7
114
114
 
115
115
  OS:Exterior:FuelEquipment:Definition,
116
- {e3509498-6b91-4e72-83b1-4e5ae20fef10}, !- Handle
117
- 21000.0 w EV Charging Definition, !- Name
118
- 21000; !- Design Level {W}
116
+ {1c7425ee-61c5-4424-a7a2-680290c07aab}, !- Handle
117
+ 28799.999999999996 w EV Charging Definition, !- Name
118
+ 28800; !- Design Level {W}
119
119
 
120
120
  OS:Exterior:FuelEquipment,
121
- {7a05dd98-4879-49b2-bd7d-bca187c06148}, !- Handle
122
- 21000.0 w EV Charger, !- Name
123
- {e3509498-6b91-4e72-83b1-4e5ae20fef10}, !- Exterior Fuel Equipment Definition Name
124
- {cd6f08cb-2d6b-4ead-b510-9973ab57fb3c}, !- Schedule Name
121
+ {31a42d85-55dc-43ec-b0a8-beace3568b41}, !- Handle
122
+ 28799.999999999996 w EV Charger, !- Name
123
+ {1c7425ee-61c5-4424-a7a2-680290c07aab}, !- Exterior Fuel Equipment Definition Name
124
+ {5e51be1d-47a4-45a6-831f-69e2b394fc9c}, !- Schedule Name
125
125
  Electricity, !- Fuel Use Type
126
126
  , !- Multiplier
127
127
  Electric Vehicles; !- End-Use Subcategory
128
128
 
129
129
  OS:ScheduleTypeLimits,
130
- {49fe0c88-4ae2-4960-b3e1-046e84601563}, !- Handle
130
+ {f4a971c0-7bb6-4f09-b54b-593ad91e646f}, !- Handle
131
131
  Fractional, !- Name
132
132
  0, !- Lower Limit Value
133
133
  1, !- Upper Limit Value