openstudio-geb 0.3.2 → 0.3.3

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/measures/GEB Metrics Report/resources/os_lib_reporting.rb +5 -24
  3. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/LICENSE.md +13 -0
  4. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/README.md +152 -0
  5. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/README.md.erb +45 -0
  6. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/docs/.gitkeep +0 -0
  7. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/measure.rb +604 -0
  8. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/measure.xml +265 -0
  9. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/tests/USA_NY_Buffalo.Niagara.Intl.AP.725280_TMY3.epw +8768 -0
  10. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/tests/add_fan_assist_night_ventilation_with_hybrid_control_test.rb +94 -0
  11. data/lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/tests/medium_office_with_internal_windows.osm +13459 -0
  12. data/lib/measures/add_heat_pump_water_heater/measure.rb +2 -2
  13. data/lib/measures/apply_dynamic_coating_to_roof_wall/LICENSE.md +1 -0
  14. data/lib/measures/apply_dynamic_coating_to_roof_wall/README.md +101 -0
  15. data/lib/measures/apply_dynamic_coating_to_roof_wall/README.md.erb +45 -0
  16. data/lib/measures/apply_dynamic_coating_to_roof_wall/docs/.gitkeep +0 -0
  17. data/lib/measures/apply_dynamic_coating_to_roof_wall/measure.rb +421 -0
  18. data/lib/measures/apply_dynamic_coating_to_roof_wall/measure.xml +204 -0
  19. data/lib/measures/apply_dynamic_coating_to_roof_wall/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A.osm +13669 -0
  20. data/lib/measures/apply_dynamic_coating_to_roof_wall/tests/SF-CACZ6-HPWH-pre1978.osm +16130 -0
  21. data/lib/measures/apply_dynamic_coating_to_roof_wall/tests/USA_NY_Buffalo.Niagara.Intl.AP.725280_TMY3.epw +8768 -0
  22. data/lib/measures/apply_dynamic_coating_to_roof_wall/tests/apply_dynamic_coating_to_roof_wall_test.rb +81 -0
  23. data/lib/openstudio/geb/run.rb +34 -0
  24. data/lib/openstudio/geb/version.rb +1 -1
  25. metadata +23 -3
@@ -0,0 +1,81 @@
1
+ # insert your copyright here
2
+
3
+ require 'openstudio'
4
+ require 'openstudio/measure/ShowRunnerOutput'
5
+ require 'minitest/autorun'
6
+ require_relative '../measure.rb'
7
+ require 'fileutils'
8
+ require 'json'
9
+
10
+ class ApplyDynamicCoatingToRoofWallTest < Minitest::Test
11
+ # def setup
12
+ # end
13
+
14
+ # def teardown
15
+
16
+ def test_good_argument_values_dynamic_coating
17
+ # create an instance of the measure
18
+ measure = ApplyDynamicCoatingToRoofWall.new
19
+
20
+ # create runner with empty OSW
21
+ runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
22
+
23
+ # load the test model
24
+ translator = OpenStudio::OSVersion::VersionTranslator.new
25
+ # path = OpenStudio::Path.new(File.dirname(__FILE__) + '/MediumOffice-90.1-2010-ASHRAE 169-2013-5A.osm')
26
+ path = OpenStudio::Path.new(File.dirname(__FILE__) + '/SF-CACZ6-HPWH-pre1978.osm')
27
+ model = translator.loadModel(path)
28
+ assert(!model.empty?)
29
+ model = model.get
30
+
31
+ # forward translate OSM file to IDF file
32
+ ft = OpenStudio::EnergyPlus::ForwardTranslator.new
33
+ workspace = ft.translateModel(model)
34
+
35
+ # get arguments and test that they are what we are expecting
36
+ arguments = measure.arguments(workspace)
37
+ argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
38
+
39
+ # create hash of argument values.
40
+ # If the argument has a default that you want to use, you don't need it in the hash
41
+ args_hash = {}
42
+ args_hash['temp_lo'] = 19
43
+ args_hash['temp_hi'] = 27
44
+ args_hash['apply_where'] = 'Both'
45
+ # using defaults values from measure.rb for other arguments
46
+
47
+ # populate argument with specified hash value if specified
48
+ arguments.each do |arg|
49
+ temp_arg_var = arg.clone
50
+ if args_hash.key?(arg.name)
51
+ assert(temp_arg_var.setValue(args_hash[arg.name]))
52
+ end
53
+ argument_map[arg.name] = temp_arg_var
54
+ end
55
+
56
+ # run the measure
57
+ measure.run(workspace, runner, argument_map)
58
+ result = runner.result
59
+ assert_equal('Success', result.value.valueName)
60
+
61
+ # save the workspace to output directory
62
+ output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/output/test_output.idf')
63
+ workspace.save(output_file_path, true)
64
+
65
+ # test run the modified model
66
+ epw_file_path = File.join(File.dirname(__FILE__ ), "USA_NY_Buffalo.Niagara.Intl.AP.725280_TMY3.epw")
67
+ cmd = "#{OpenStudio.getEnergyPlusDirectory.to_s}/energyplus -d #{File.join(File.dirname(__FILE__), 'output')} -w \"#{epw_file_path}\" #{output_file_path}"
68
+ puts cmd
69
+ system(cmd)
70
+
71
+ # stdout_str, stderr_str, status = Open3.capture3(get_run_env(), cmd)
72
+ # if status.success?
73
+ # OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.command', "Successfully ran command: '#{cmd}'")
74
+ # else
75
+ # OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "Error running command: '#{cmd}'")
76
+ # OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "stdout: #{stdout_str}")
77
+ # OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "stderr: #{stderr_str}")
78
+ # end
79
+
80
+ end
81
+ end
@@ -77,6 +77,40 @@ module OpenStudio
77
77
 
78
78
  steps = []
79
79
  # measure_dict: hash of measures and their arguments => {measure_name: arguments}
80
+ # first adjust the measure sequence to be OpenStudio measure => EnergyPlus measure => Reporting measure
81
+ energyplus_measures = {}
82
+ report_measures = {}
83
+ @measure_dict.each_pair do |m_name, para_dict|
84
+ # get all EnergyPlus and Reporting measures out and remove original ones
85
+ File.open("#{para_dict['measure_dir_name']}/measure.rb", 'r') do |file|
86
+ file.each_line do |line|
87
+ if line =~ /class.+EnergyPlusMeasure/
88
+ energyplus_measures[m_name] = @measure_dict[m_name]
89
+ @measure_dict.delete(m_name)
90
+ break
91
+ elsif line =~ /class.+ReportingMeasure/
92
+ report_measures[m_name] = @measure_dict[m_name]
93
+ @measure_dict.delete(m_name)
94
+ break
95
+ end
96
+ end
97
+ end
98
+ end
99
+
100
+ # add back the EnergyPlusMeasures to the end of the measure list
101
+ unless energyplus_measures.empty?
102
+ energyplus_measures.each_key do |m_name|
103
+ @measure_dict[m_name] = energyplus_measures[m_name]
104
+ end
105
+ end
106
+ # add back the ReportingMeasures to the very end of the measure list
107
+ unless report_measures.empty?
108
+ report_measures.each_key do |m_name|
109
+ @measure_dict[m_name] = report_measures[m_name]
110
+ end
111
+ end
112
+
113
+ # add the final meausres to the osw steps in order
80
114
  @measure_dict.each_pair do |m_name, para_dict|
81
115
  measure = {}
82
116
  measure['measure_dir_name'] = para_dict['measure_dir_name']
@@ -5,6 +5,6 @@
5
5
 
6
6
  module OpenStudio
7
7
  module Geb
8
- VERSION = '0.3.2'.freeze
8
+ VERSION = '0.3.3'.freeze
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-geb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaiyu Sun
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-07-21 00:00:00.000000000 Z
12
+ date: 2023-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -197,6 +197,15 @@ files:
197
197
  - lib/measures/add_exterior_blinds_and_control/measure.xml
198
198
  - lib/measures/add_exterior_blinds_and_control/tests/add_exterior_blinds_and_control_test.rb
199
199
  - lib/measures/add_exterior_blinds_and_control/tests/example_model.osm
200
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/LICENSE.md
201
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/README.md
202
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/README.md.erb
203
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/docs/.gitkeep
204
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/measure.rb
205
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/measure.xml
206
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/tests/USA_NY_Buffalo.Niagara.Intl.AP.725280_TMY3.epw
207
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/tests/add_fan_assist_night_ventilation_with_hybrid_control_test.rb
208
+ - lib/measures/add_fan_assist_night_ventilation_with_hybrid_control/tests/medium_office_with_internal_windows.osm
200
209
  - lib/measures/add_heat_pump_water_heater/LICENSE.md
201
210
  - lib/measures/add_heat_pump_water_heater/README.md
202
211
  - lib/measures/add_heat_pump_water_heater/README.md.erb
@@ -249,6 +258,17 @@ files:
249
258
  - lib/measures/adjust_dhw_setpoint/tests/SmallHotel-2A-HPWH.osm
250
259
  - lib/measures/adjust_dhw_setpoint/tests/SmallHotel-2A.osm
251
260
  - lib/measures/adjust_dhw_setpoint/tests/adjust_dhw_setpoint_test.rb
261
+ - lib/measures/apply_dynamic_coating_to_roof_wall/LICENSE.md
262
+ - lib/measures/apply_dynamic_coating_to_roof_wall/README.md
263
+ - lib/measures/apply_dynamic_coating_to_roof_wall/README.md.erb
264
+ - lib/measures/apply_dynamic_coating_to_roof_wall/docs/.gitkeep
265
+ - lib/measures/apply_dynamic_coating_to_roof_wall/measure.rb
266
+ - lib/measures/apply_dynamic_coating_to_roof_wall/measure.xml
267
+ - lib/measures/apply_dynamic_coating_to_roof_wall/tests/MediumOffice-90.1-2010-ASHRAE
268
+ 169-2013-5A.osm
269
+ - lib/measures/apply_dynamic_coating_to_roof_wall/tests/SF-CACZ6-HPWH-pre1978.osm
270
+ - lib/measures/apply_dynamic_coating_to_roof_wall/tests/USA_NY_Buffalo.Niagara.Intl.AP.725280_TMY3.epw
271
+ - lib/measures/apply_dynamic_coating_to_roof_wall/tests/apply_dynamic_coating_to_roof_wall_test.rb
252
272
  - lib/measures/average_ventilation_for_peak_hours/LICENSE.md
253
273
  - lib/measures/average_ventilation_for_peak_hours/README.md
254
274
  - lib/measures/average_ventilation_for_peak_hours/README.md.erb
@@ -342,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
362
  - !ruby/object:Gem::Version
343
363
  version: '0'
344
364
  requirements: []
345
- rubygems_version: 3.1.4
365
+ rubygems_version: 3.0.9
346
366
  signing_key:
347
367
  specification_version: 4
348
368
  summary: OpenStudio measures for grid-interactive efficient buildings