openstudio-ee 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +7 -0
  4. data/Rakefile +0 -2
  5. data/lib/measures/GLHEProExportLoadsforGroundHeatExchangerSizing/measure.rb +1 -1
  6. data/lib/measures/GLHEProExportLoadsforGroundHeatExchangerSizing/measure.xml +3 -4
  7. data/lib/measures/nze_hvac/measure.rb +8 -6
  8. data/lib/measures/nze_hvac/measure.xml +9 -9
  9. data/lib/openstudio/ee_measures/version.rb +1 -1
  10. data/openstudio-ee.gemspec +6 -8
  11. metadata +11 -50
  12. data/lib/measures/ImproveFanTotalEfficiencybyPercentage/measure.rb +0 -333
  13. data/lib/measures/ImproveFanTotalEfficiencybyPercentage/measure.xml +0 -150
  14. data/lib/measures/ReplaceFanTotalEfficiency/measure.rb +0 -330
  15. data/lib/measures/ReplaceFanTotalEfficiency/measure.xml +0 -150
  16. data/lib/measures/add_apszhp_to_each_zone/measure.rb +0 -607
  17. data/lib/measures/add_apszhp_to_each_zone/measure.xml +0 -184
  18. data/lib/measures/add_energy_recovery_ventilator/measure.rb +0 -354
  19. data/lib/measures/add_energy_recovery_ventilator/measure.xml +0 -78
  20. data/lib/measures/improve_simple_glazing_by_percentage/measure.rb +0 -81
  21. data/lib/measures/improve_simple_glazing_by_percentage/measure.xml +0 -70
  22. data/lib/measures/reduce_water_use_by_percentage/measure.rb +0 -61
  23. data/lib/measures/reduce_water_use_by_percentage/measure.xml +0 -62
  24. data/lib/measures/replace_hvac_with_gshp_and_doas/measure.rb +0 -511
  25. data/lib/measures/replace_hvac_with_gshp_and_doas/measure.xml +0 -375
  26. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_AedgMeasures.rb +0 -454
  27. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Constructions.rb +0 -221
  28. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Geometry.rb +0 -41
  29. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_HVAC.rb +0 -1682
  30. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_HelperMethods.rb +0 -114
  31. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_LightingAndEquipment.rb +0 -99
  32. data/lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Schedules.rb +0 -142
  33. data/lib/measures/replace_simple_glazing/measure.rb +0 -86
  34. data/lib/measures/replace_simple_glazing/measure.xml +0 -78
  35. data/lib/measures/set_boiler_thermal_efficiency/measure.rb +0 -520
  36. data/lib/measures/set_boiler_thermal_efficiency/measure.xml +0 -78
  37. data/lib/measures/set_water_heater_efficiency_heat_lossand_peak_water_flow_rate/measure.rb +0 -207
  38. data/lib/measures/set_water_heater_efficiency_heat_lossand_peak_water_flow_rate/measure.xml +0 -78
  39. data/lib/measures/tenant_star_internal_loads/measure.rb +0 -134
  40. data/lib/measures/tenant_star_internal_loads/measure.xml +0 -67
  41. data/lib/measures/tenant_star_internal_loads/resources/os_lib_helper_methods.rb +0 -401
  42. data/lib/measures/vr_fwith_doas/measure.rb +0 -468
  43. data/lib/measures/vr_fwith_doas/measure.xml +0 -298
  44. data/lib/measures/vr_fwith_doas/resources/OsLib_AedgMeasures.rb +0 -454
  45. data/lib/measures/vr_fwith_doas/resources/OsLib_Constructions.rb +0 -221
  46. data/lib/measures/vr_fwith_doas/resources/OsLib_Geometry.rb +0 -41
  47. data/lib/measures/vr_fwith_doas/resources/OsLib_HVAC.rb +0 -1516
  48. data/lib/measures/vr_fwith_doas/resources/OsLib_HelperMethods.rb +0 -114
  49. data/lib/measures/vr_fwith_doas/resources/OsLib_LightingAndEquipment.rb +0 -99
  50. data/lib/measures/vr_fwith_doas/resources/OsLib_Schedules.rb +0 -142
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1f51dd9876af66e73f11f916596a843d40abef627ca4920effca222b1a12518
4
- data.tar.gz: 8764a7e76b29e452ba9b12945c92a164f985ee6ada6849498368aea3caa0f4f8
3
+ metadata.gz: 0247d977cb8a0949c64794b9dd08254ee6a1437a87b73fd836fcb07b35ce69be
4
+ data.tar.gz: 9e96d741e93ab51f4ed08c7a700522ce590b31a7ab736c38f9bbc844da2f1631
5
5
  SHA512:
6
- metadata.gz: 2f9b65251ccef1b28f7e16a95d4dedc9265b11899ec9128db9503bc66e50262622c1399ac834eaa60e264af2a5e1558d85a441925ea42ca9f067787ab4a96851
7
- data.tar.gz: 517716774a902e7852c8527ab68b181af8f6754d6f10830b51815864f13e65330415583c042d6d34152ad21e6576c90f92e23b133802191941b9460f679b90ef
6
+ metadata.gz: 74fe06c5122a0cbe4e45f33d12818b7e5278c1dba119d9e13eb926604026742f409d76d5cb58d151603f0a56b096c5f2c3e530cec09698207a0af579f09ff150
7
+ data.tar.gz: 07cb1f9e69ec817df5add2de647feb1c304f762714884f439be4a32de51b93eb4311485f6fcfd955313c330a340819804d754a52bd55e791bf75310986bd2ff9
@@ -2,4 +2,4 @@ AllCops:
2
2
  Exclude:
3
3
  - 'spec/test_measures/**/*'
4
4
  inherit_from:
5
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
5
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
@@ -1,6 +1,13 @@
1
1
  # OpenStudio EE Gem
2
2
 
3
+ ## Version 0.3.0
4
+
5
+ * Support for OpenStudio 3.1
6
+ * Update OpenStudio Standards to 0.2.12
7
+ * Update OpenStudio Extension gem to 0.3.1
8
+
3
9
  ## Version 0.2.1
10
+
4
11
  * Update openstudio-extension to 0.2.5
5
12
  * Adds the following to lib/measures:
6
13
  * ImproveFanTotalEfficiencyByPercentage
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # *******************************************************************************
4
2
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
5
3
  # All rights reserved.
@@ -53,7 +53,7 @@ class GLHEProExportLoadsforGroundHeatExchangerSizing < OpenStudio::Measure::Repo
53
53
  end
54
54
 
55
55
  # define the arguments that the user will input
56
- def arguments
56
+ def arguments(model = nil)
57
57
  args = OpenStudio::Measure::OSArgumentVector.new
58
58
 
59
59
  return args
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>glhe_pro_export_loadsfor_ground_heat_exchanger_sizing</name>
5
5
  <uid>7bb0ce67-cffb-4ef6-b7fb-093c7c43e263</uid>
6
- <version_id>9e7b6db7-cdf7-46cd-98af-e527072e4431</version_id>
7
- <version_modified>20200423T205217Z</version_modified>
6
+ <version_id>ba9023aa-374a-4a78-9c7d-09cbd752e093</version_id>
7
+ <version_modified>20200714T172140Z</version_modified>
8
8
  <xml_checksum>2C8A3EEF</xml_checksum>
9
9
  <class_name>GLHEProExportLoadsforGroundHeatExchangerSizing</class_name>
10
10
  <display_name>GLHEProExportLoadsforGroundHeatExchangerSizing</display_name>
@@ -164,7 +164,7 @@
164
164
  <filename>measure.rb</filename>
165
165
  <filetype>rb</filetype>
166
166
  <usage_type>script</usage_type>
167
- <checksum>6358E258</checksum>
167
+ <checksum>496F92E3</checksum>
168
168
  </file>
169
169
  <file>
170
170
  <filename>README.md</filename>
@@ -174,4 +174,3 @@
174
174
  </file>
175
175
  </files>
176
176
  </measure>
177
- <error>wrong number of arguments (given 1, expected 0)</error>
@@ -427,18 +427,20 @@ class NzeHvac < OpenStudio::Measure::ModelMeasure
427
427
  return false
428
428
  end
429
429
 
430
- # check that the directory name isn't too long for a sizing run; sometimes this isn't necessary
431
- # if "#{Dir.pwd} }/SizingRun".length > 90
432
- # runner.registerError("Directory path #{Dir.pwd}/SizingRun is greater than 90 characters and too long perform a sizing run.")
433
- # return false
434
- # end
435
-
436
430
  # check that weather file exists for a sizing run
437
431
  if !model.weatherFile.is_initialized
438
432
  runner.registerError('Weather file not set. Cannot perform sizing run.')
439
433
  return false
440
434
  end
441
435
 
436
+ # ensure sizing OA method is aligned
437
+ model.getControllerMechanicalVentilations.each do |controller|
438
+ controller.setSystemOutdoorAirMethod('ZoneSum')
439
+ end
440
+
441
+ # logic to ensure variable, not cycling, pump operation for chillers
442
+ model.getChillerElectricEIRs.each { |chiller| chiller.setChillerFlowMode('LeavingSetpointModulated') }
443
+
442
444
  # log the build messages and errors to a file before sizing run in case of failure
443
445
  log_messages_to_file("#{Dir.pwd}/openstudio-standards.log", debug = true)
444
446
 
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>nze_hvac</name>
5
5
  <uid>f060dff2-b28d-4194-a6af-e66d88ddb33c</uid>
6
- <version_id>83e77929-f391-407a-8aef-20994f5b7e37</version_id>
7
- <version_modified>20200316T215557Z</version_modified>
6
+ <version_id>6d156aab-dd02-41ed-9285-82c07a45707c</version_id>
7
+ <version_modified>20201112T192500Z</version_modified>
8
8
  <xml_checksum>0E5E4776</xml_checksum>
9
9
  <class_name>NzeHvac</class_name>
10
10
  <display_name>NZEHVAC</display_name>
@@ -309,6 +309,12 @@
309
309
  <usage_type>license</usage_type>
310
310
  <checksum>E0468DD6</checksum>
311
311
  </file>
312
+ <file>
313
+ <filename>NZEHVAC_Test.rb</filename>
314
+ <filetype>rb</filetype>
315
+ <usage_type>test</usage_type>
316
+ <checksum>1BA0611D</checksum>
317
+ </file>
312
318
  <file>
313
319
  <version>
314
320
  <software_program>OpenStudio</software_program>
@@ -318,13 +324,7 @@
318
324
  <filename>measure.rb</filename>
319
325
  <filetype>rb</filetype>
320
326
  <usage_type>script</usage_type>
321
- <checksum>B06BEFD1</checksum>
322
- </file>
323
- <file>
324
- <filename>NZEHVAC_Test.rb</filename>
325
- <filetype>rb</filetype>
326
- <usage_type>test</usage_type>
327
- <checksum>1BA0611D</checksum>
327
+ <checksum>CF08F01B</checksum>
328
328
  </file>
329
329
  </files>
330
330
  </measure>
@@ -37,6 +37,6 @@
37
37
 
38
38
  module OpenStudio
39
39
  module EeMeasures
40
- VERSION = '0.2.1'
40
+ VERSION = '0.3.0'
41
41
  end
42
42
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  lib = File.expand_path('lib', __dir__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
  require 'openstudio/ee_measures/version'
@@ -14,10 +12,10 @@ Gem::Specification.new do |spec|
14
12
  spec.summary = 'Library and measures for OpenStudio for energy efficiency use cases'
15
13
  spec.description = 'Library and measures for OpenStudio for energy efficiency use cases'
16
14
  spec.metadata = {
17
- 'bug_tracker_uri' => 'https://github.com/NREL/openstudio-ee-gem/issues',
18
- 'changelog_uri' => 'https://github.com/NREL/openstudio-ee-gem/blob/develop/CHANGELOG.md',
19
- # 'documentation_uri' => 'https://www.rubydoc.info/gems/openstudio-ee-gem/#{gem.version}',
20
- 'source_code_uri' => "https://github.com/NREL/openstudio-ee-gem/tree/v#{spec.version}"
15
+ 'bug_tracker_uri' => 'https://github.com/NREL/openstudio-ee-gem/issues',
16
+ 'changelog_uri' => 'https://github.com/NREL/openstudio-ee-gem/blob/develop/CHANGELOG.md',
17
+ # 'documentation_uri' => 'https://www.rubydoc.info/gems/openstudio-ee-gem/#{gem.version}',
18
+ 'source_code_uri' => "https://github.com/NREL/openstudio-ee-gem/tree/v#{spec.version}"
21
19
  }
22
20
 
23
21
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -30,8 +28,8 @@ Gem::Specification.new do |spec|
30
28
  spec.required_ruby_version = '~> 2.5.0'
31
29
 
32
30
  spec.add_dependency 'bundler', '~> 2.1'
33
- spec.add_dependency 'openstudio-extension', '~> 0.2.5'
34
- spec.add_dependency 'openstudio-standards', '~> 0.2.11'
31
+ spec.add_dependency 'openstudio-extension', '~> 0.3.1'
32
+ spec.add_dependency 'openstudio-standards', '~> 0.2.12'
35
33
 
36
34
  spec.add_development_dependency 'rake', '~> 13.0'
37
35
  spec.add_development_dependency 'rspec', '~> 3.9'
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-ee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Goldwasser
8
8
  - Nicholas Long
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-10-28 00:00:00.000000000 Z
12
+ date: 2020-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -31,28 +31,28 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.2.5
34
+ version: 0.3.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.2.5
41
+ version: 0.3.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: openstudio-standards
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 0.2.11
48
+ version: 0.2.12
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 0.2.11
55
+ version: 0.2.12
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -158,8 +158,6 @@ files:
158
158
  - lib/measures/ImproveFanBeltEfficiency/README.md.erb
159
159
  - lib/measures/ImproveFanBeltEfficiency/measure.rb
160
160
  - lib/measures/ImproveFanBeltEfficiency/measure.xml
161
- - lib/measures/ImproveFanTotalEfficiencybyPercentage/measure.rb
162
- - lib/measures/ImproveFanTotalEfficiencybyPercentage/measure.xml
163
161
  - lib/measures/ImproveMotorEfficiency/LICENSE.md
164
162
  - lib/measures/ImproveMotorEfficiency/README.md
165
163
  - lib/measures/ImproveMotorEfficiency/README.md.erb
@@ -205,12 +203,6 @@ files:
205
203
  - lib/measures/ReduceVentilationByPercentage/README.md.erb
206
204
  - lib/measures/ReduceVentilationByPercentage/measure.rb
207
205
  - lib/measures/ReduceVentilationByPercentage/measure.xml
208
- - lib/measures/ReplaceFanTotalEfficiency/measure.rb
209
- - lib/measures/ReplaceFanTotalEfficiency/measure.xml
210
- - lib/measures/add_apszhp_to_each_zone/measure.rb
211
- - lib/measures/add_apszhp_to_each_zone/measure.xml
212
- - lib/measures/add_energy_recovery_ventilator/measure.rb
213
- - lib/measures/add_energy_recovery_ventilator/measure.xml
214
206
  - lib/measures/add_variable_speed_rtu_control_logic/LICENSE.md
215
207
  - lib/measures/add_variable_speed_rtu_control_logic/README.md
216
208
  - lib/measures/add_variable_speed_rtu_control_logic/README.md.erb
@@ -227,47 +219,16 @@ files:
227
219
  - lib/measures/fan_assist_night_ventilation/measure.rb
228
220
  - lib/measures/fan_assist_night_ventilation/measure.xml
229
221
  - lib/measures/fan_assist_night_ventilation/resources/FanAssistNightVentilationMeasureGuide.pdf
230
- - lib/measures/improve_simple_glazing_by_percentage/measure.rb
231
- - lib/measures/improve_simple_glazing_by_percentage/measure.xml
232
222
  - lib/measures/nze_hvac/LICENSE.md
233
223
  - lib/measures/nze_hvac/README.md
234
224
  - lib/measures/nze_hvac/README.md.erb
235
225
  - lib/measures/nze_hvac/measure.rb
236
226
  - lib/measures/nze_hvac/measure.xml
237
- - lib/measures/reduce_water_use_by_percentage/measure.rb
238
- - lib/measures/reduce_water_use_by_percentage/measure.xml
239
- - lib/measures/replace_hvac_with_gshp_and_doas/measure.rb
240
- - lib/measures/replace_hvac_with_gshp_and_doas/measure.xml
241
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_AedgMeasures.rb
242
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Constructions.rb
243
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Geometry.rb
244
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_HVAC.rb
245
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_HelperMethods.rb
246
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_LightingAndEquipment.rb
247
- - lib/measures/replace_hvac_with_gshp_and_doas/resources/OsLib_Schedules.rb
248
- - lib/measures/replace_simple_glazing/measure.rb
249
- - lib/measures/replace_simple_glazing/measure.xml
250
227
  - lib/measures/replace_water_heater_mixed_with_thermal_storage_chilled_water/LICENSE.md
251
228
  - lib/measures/replace_water_heater_mixed_with_thermal_storage_chilled_water/README.md
252
229
  - lib/measures/replace_water_heater_mixed_with_thermal_storage_chilled_water/README.md.erb
253
230
  - lib/measures/replace_water_heater_mixed_with_thermal_storage_chilled_water/measure.rb
254
231
  - lib/measures/replace_water_heater_mixed_with_thermal_storage_chilled_water/measure.xml
255
- - lib/measures/set_boiler_thermal_efficiency/measure.rb
256
- - lib/measures/set_boiler_thermal_efficiency/measure.xml
257
- - lib/measures/set_water_heater_efficiency_heat_lossand_peak_water_flow_rate/measure.rb
258
- - lib/measures/set_water_heater_efficiency_heat_lossand_peak_water_flow_rate/measure.xml
259
- - lib/measures/tenant_star_internal_loads/measure.rb
260
- - lib/measures/tenant_star_internal_loads/measure.xml
261
- - lib/measures/tenant_star_internal_loads/resources/os_lib_helper_methods.rb
262
- - lib/measures/vr_fwith_doas/measure.rb
263
- - lib/measures/vr_fwith_doas/measure.xml
264
- - lib/measures/vr_fwith_doas/resources/OsLib_AedgMeasures.rb
265
- - lib/measures/vr_fwith_doas/resources/OsLib_Constructions.rb
266
- - lib/measures/vr_fwith_doas/resources/OsLib_Geometry.rb
267
- - lib/measures/vr_fwith_doas/resources/OsLib_HVAC.rb
268
- - lib/measures/vr_fwith_doas/resources/OsLib_HelperMethods.rb
269
- - lib/measures/vr_fwith_doas/resources/OsLib_LightingAndEquipment.rb
270
- - lib/measures/vr_fwith_doas/resources/OsLib_Schedules.rb
271
232
  - lib/openstudio-ee-measures.rb
272
233
  - lib/openstudio/ee_measures.rb
273
234
  - lib/openstudio/ee_measures/extension.rb
@@ -278,8 +239,8 @@ licenses: []
278
239
  metadata:
279
240
  bug_tracker_uri: https://github.com/NREL/openstudio-ee-gem/issues
280
241
  changelog_uri: https://github.com/NREL/openstudio-ee-gem/blob/develop/CHANGELOG.md
281
- source_code_uri: https://github.com/NREL/openstudio-ee-gem/tree/v0.2.1
282
- post_install_message:
242
+ source_code_uri: https://github.com/NREL/openstudio-ee-gem/tree/v0.3.0
243
+ post_install_message:
283
244
  rdoc_options: []
284
245
  require_paths:
285
246
  - lib
@@ -294,9 +255,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
255
  - !ruby/object:Gem::Version
295
256
  version: '0'
296
257
  requirements: []
297
- rubyforge_project:
258
+ rubyforge_project:
298
259
  rubygems_version: 2.7.6.2
299
- signing_key:
260
+ signing_key:
300
261
  specification_version: 4
301
262
  summary: Library and measures for OpenStudio for energy efficiency use cases
302
263
  test_files: []
@@ -1,333 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # start the measure
4
- class ImproveFanTotalEfficiencybyPercentage < OpenStudio::Ruleset::ModelUserScript
5
- # define the name that a user will see, this method may be deprecated as
6
- # the display name in PAT comes from the name field in measure.xml
7
- def name
8
- return 'Improve Fan Total Efficiency by Percentage'
9
- end
10
-
11
- # define the arguments that the user will input
12
- def arguments(model)
13
- args = OpenStudio::Ruleset::OSArgumentVector.new
14
-
15
- # populate choice argument for constructions that are applied to surfaces in the model
16
- loop_handles = OpenStudio::StringVector.new
17
- loop_display_names = OpenStudio::StringVector.new
18
-
19
- # putting air loops and names into hash
20
- loop_args = model.getAirLoopHVACs
21
- loop_args_hash = {}
22
- loop_args.each do |loop_arg|
23
- loop_args_hash[loop_arg.name.to_s] = loop_arg
24
- end
25
-
26
- # looping through sorted hash of air loops
27
- loop_args_hash.sort.map do |key, value|
28
- show_loop = false
29
- components = value.supplyComponents
30
- components.each do |component|
31
- if !component.to_FanConstantVolume.empty?
32
- show_loop = true
33
- end
34
- if !component.to_FanVariableVolume.empty?
35
- show_loop = true
36
- end
37
- if !component.to_FanOnOff.empty?
38
- show_loop = true
39
- end
40
- end
41
-
42
- # if loop as object of correct type then add to hash.
43
- if show_loop == true
44
- loop_handles << value.handle.to_s
45
- loop_display_names << key
46
- end
47
- end
48
-
49
- # add building to string vector with air loops
50
- building = model.getBuilding
51
- loop_handles << building.handle.to_s
52
- loop_display_names << '*All Air Loops*'
53
-
54
- # make an argument for air loops
55
- object = OpenStudio::Ruleset::OSArgument.makeChoiceArgument('object', loop_handles, loop_display_names, true)
56
- object.setDisplayName('Choose an Air Loop to Alter.')
57
- object.setDefaultValue('*All Air Loops*') # if no loop is chosen this will run on all air loops
58
- args << object
59
-
60
- # TODO: - change this to choice list from design document
61
- # make an argument to add new space true/false
62
- motor_eff = OpenStudio::Ruleset::OSArgument.makeDoubleArgument('motor_eff', true)
63
- motor_eff.setDisplayName('Fan Total Efficiency Improvement(%).')
64
- motor_eff.setDefaultValue(3.0)
65
- args << motor_eff
66
-
67
- # bool argument to remove existing costs
68
- remove_costs = OpenStudio::Ruleset::OSArgument.makeBoolArgument('remove_costs', true)
69
- remove_costs.setDisplayName('Remove Baseline Costs From Effected Fans?')
70
- remove_costs.setDefaultValue(false)
71
- args << remove_costs
72
-
73
- # make an argument for material and installation cost
74
- material_cost = OpenStudio::Ruleset::OSArgument.makeDoubleArgument('material_cost', true)
75
- material_cost.setDisplayName('Material and Installation Costs per Motor ($).')
76
- material_cost.setDefaultValue(0.0)
77
- args << material_cost
78
-
79
- # make an argument for demolition cost
80
- demolition_cost = OpenStudio::Ruleset::OSArgument.makeDoubleArgument('demolition_cost', true)
81
- demolition_cost.setDisplayName('Demolition Costs per Motor ($).')
82
- demolition_cost.setDefaultValue(0.0)
83
- args << demolition_cost
84
-
85
- # make an argument for duration in years until costs start
86
- years_until_costs_start = OpenStudio::Ruleset::OSArgument.makeIntegerArgument('years_until_costs_start', true)
87
- years_until_costs_start.setDisplayName('Years Until Costs Start (whole years).')
88
- years_until_costs_start.setDefaultValue(0)
89
- args << years_until_costs_start
90
-
91
- # make an argument to determine if demolition costs should be included in initial construction
92
- demo_cost_initial_const = OpenStudio::Ruleset::OSArgument.makeBoolArgument('demo_cost_initial_const', true)
93
- demo_cost_initial_const.setDisplayName('Demolition Costs Occur During Initial Construction?')
94
- demo_cost_initial_const.setDefaultValue(false)
95
- args << demo_cost_initial_const
96
-
97
- # make an argument for expected life
98
- expected_life = OpenStudio::Ruleset::OSArgument.makeIntegerArgument('expected_life', true)
99
- expected_life.setDisplayName('Expected Life (whole years).')
100
- expected_life.setDefaultValue(20)
101
- args << expected_life
102
-
103
- # make an argument for o&m cost
104
- om_cost = OpenStudio::Ruleset::OSArgument.makeDoubleArgument('om_cost', true)
105
- om_cost.setDisplayName('O & M Costs per Motor ($).')
106
- om_cost.setDefaultValue(0.0)
107
- args << om_cost
108
-
109
- # make an argument for o&m frequency
110
- om_frequency = OpenStudio::Ruleset::OSArgument.makeIntegerArgument('om_frequency', true)
111
- om_frequency.setDisplayName('O & M Frequency (whole years).')
112
- om_frequency.setDefaultValue(1)
113
- args << om_frequency
114
-
115
- return args
116
- end # end the arguments method
117
-
118
- # define what happens when the measure is cop
119
- def run(model, runner, user_arguments)
120
- super(model, runner, user_arguments)
121
-
122
- # use the built-in error checking
123
- if !runner.validateUserArguments(arguments(model), user_arguments)
124
- return false
125
- end
126
-
127
- # assign the user inputs to variables
128
- object = runner.getOptionalWorkspaceObjectChoiceValue('object', user_arguments, model) # model is passed in because of argument type
129
- motor_eff = runner.getDoubleArgumentValue('motor_eff', user_arguments)
130
- remove_costs = runner.getBoolArgumentValue('remove_costs', user_arguments)
131
- material_cost = runner.getDoubleArgumentValue('material_cost', user_arguments)
132
- demolition_cost = runner.getDoubleArgumentValue('demolition_cost', user_arguments)
133
- years_until_costs_start = runner.getIntegerArgumentValue('years_until_costs_start', user_arguments)
134
- demo_cost_initial_const = runner.getBoolArgumentValue('demo_cost_initial_const', user_arguments)
135
- expected_life = runner.getIntegerArgumentValue('expected_life', user_arguments)
136
- om_cost = runner.getDoubleArgumentValue('om_cost', user_arguments)
137
- om_frequency = runner.getIntegerArgumentValue('om_frequency', user_arguments)
138
-
139
- # check the loop for reasonableness
140
- apply_to_all_loops = false
141
- loop = nil
142
- if object.empty?
143
- handle = runner.getStringArgumentValue('loop', user_arguments)
144
- if handle.empty?
145
- runner.registerError('No loop was chosen.')
146
- else
147
- runner.registerError("The selected loop with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
148
- end
149
- return false
150
- else
151
- if !object.get.to_Loop.empty?
152
- loop = object.get.to_Loop.get
153
- elsif !object.get.to_Building.empty?
154
- apply_to_all_loops = true
155
- else
156
- runner.registerError('Script Error - argument not showing up as loop.')
157
- return false
158
- end
159
- end # end of if loop.empty?
160
-
161
- # check the user_name for reasonableness
162
- if (motor_eff <= 1) || (motor_eff >= 5)
163
- runner.registerWarning('Requested motor efficiency improvement is not between expected values of 1% and 5%')
164
- end
165
- # motor efficiency will be checked motor by motor to see warn if higher than 0.96 and error if not between or equal to 0 and 1
166
-
167
- # set flags to use later
168
- costs_requested = false
169
-
170
- # set values to use later
171
- yr0_capital_totalCosts_baseline = 0
172
- yr0_capital_totalCosts_proposed = 0
173
-
174
- # If demo_cost_initial_const is true then will be applied once in the lifecycle. Future replacements use the demo cost of the new construction.
175
- demo_costs_of_baseline_objects = 0
176
-
177
- # check costs for reasonableness
178
- if material_cost.abs + demolition_cost.abs + om_cost.abs == 0
179
- runner.registerInfo('No costs were requested for motors improvements.')
180
- else
181
- costs_requested = true
182
- end
183
-
184
- # check lifecycle arguments for reasonableness
185
- if (years_until_costs_start < 0) && (years_until_costs_start > expected_life)
186
- runner.registerError('Years until costs start should be a non-negative integer less than Expected Life.')
187
- end
188
- if (expected_life < 1) && (expected_life > 100)
189
- runner.registerError('Choose an integer greater than 0 and less than or equal to 100 for Expected Life.')
190
- end
191
- if om_frequency < 1
192
- runner.registerError('Choose an integer greater than 0 for O & M Frequency.')
193
- end
194
-
195
- # short def to make numbers pretty (converts 4125001.25641 to 4,125,001.26 or 4,125,001). The definition be called through this measure
196
- def neat_numbers(number, roundto = 2) # round to 0 or 2)
197
- if roundto == 2
198
- number = format '%.2f', number
199
- else
200
- number = number.round
201
- end
202
- # regex to add commas
203
- number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\1,').reverse
204
- end # end def neat_numbers
205
-
206
- # helper that loops through lifecycle costs getting total costs under "Construction" or "Salvage" category and add to counter if occurs during year 0
207
- def get_total_costs_for_objects(objects)
208
- counter = 0
209
- objects.each do |object|
210
- object_LCCs = object.lifeCycleCosts
211
- object_LCCs.each do |object_LCC|
212
- if (object_LCC.category == 'Construction') || (object_LCC.category == 'Salvage')
213
- if object_LCC.yearsFromStart == 0
214
- counter += object_LCC.totalCost
215
- end
216
- end
217
- end
218
- end
219
- return counter
220
- end # end of def get_total_costs_for_objects(objects)
221
-
222
- # get loops for measure
223
- if apply_to_all_loops
224
- loops = model.getAirLoopHVACs
225
- else
226
- loops = []
227
- loops << loop # only run on a single space type
228
- end
229
-
230
- # get cop values
231
- initial_motor_efficiency_values = []
232
- missing_initial_motor_efficiency = 0
233
-
234
- # loop through air loops
235
- loops.each do |loop|
236
- supply_components = loop.supplyComponents
237
-
238
- # find fans on loop
239
- supply_components.each do |supply_component|
240
- hVACComponent = supply_component.to_FanConstantVolume
241
- if hVACComponent.empty?
242
- hVACComponent = supply_component.to_FanVariableVolume
243
- end
244
- if hVACComponent.empty?
245
- hVACComponent = supply_component.to_FanOnOff
246
- end
247
-
248
- # alter components of correct type
249
- if !hVACComponent.empty?
250
- hVACComponent = hVACComponent.get
251
-
252
- # change and report changes to fans and motors
253
- initial_motor_efficiency = hVACComponent.fanEfficiency
254
- target_motor_efficiency = initial_motor_efficiency + motor_eff * 0.01
255
- initial_motor_efficiency_values << initial_motor_efficiency
256
- if target_motor_efficiency > 1
257
- hVACComponent.setFanEfficiency(1.0)
258
- runner.registerWarning("Requested efficiency of #{target_motor_efficiency * 100}% for #{hVACComponent.name} is not possible. Setting motor efficiency to 100%.")
259
- elsif target_motor_efficiency < 0
260
- hVACComponent.setFanEfficiency(0.0)
261
- runner.registerWarning("Requested efficiency of #{target_motor_efficiency * 100}% for #{hVACComponent.name} is not possible. Setting motor efficiency to 0%.")
262
- else
263
- hVACComponent.setFanEfficiency(target_motor_efficiency)
264
- runner.registerInfo("Changing the motor efficiency from #{initial_motor_efficiency * 100}% to #{target_motor_efficiency * 100}% for '#{hVACComponent.name}' onloop '#{loop.name}.'")
265
- if target_motor_efficiency > 0.96
266
- runner.registerWarning("Requested efficiency for #{hVACComponent.name} is greater than 96%.")
267
- end
268
- end
269
-
270
- # get initial year 0 cost
271
- yr0_capital_totalCosts_baseline += get_total_costs_for_objects([hVACComponent])
272
-
273
- # demo value of baseline costs associated with unit
274
- demo_LCCs = hVACComponent.lifeCycleCosts
275
- demo_LCCs.each do |demo_LCC|
276
- if demo_LCC.category == 'Salvage'
277
- demo_costs_of_baseline_objects += demo_LCC.totalCost
278
- end
279
- end
280
-
281
- # remove all old costs
282
- if !hVACComponent.lifeCycleCosts.empty? && (remove_costs == true)
283
- runner.registerInfo("Removing existing lifecycle cost objects associated with #{hVACComponent.name}")
284
- removed_costs = hVACComponent.removeLifeCycleCosts
285
- end
286
-
287
- # add new costs
288
- if costs_requested == true
289
-
290
- # adding new cost items
291
- lcc_mat = OpenStudio::Model::LifeCycleCost.createLifeCycleCost("LCC_Mat - #{hVACComponent.name}", hVACComponent, material_cost, 'CostPerEach', 'Construction', expected_life, years_until_costs_start)
292
- # cost for if demo_initial_Construction == true is added at the end of the measure
293
- lcc_demo = OpenStudio::Model::LifeCycleCost.createLifeCycleCost("LCC_Demo - #{hVACComponent.name}", hVACComponent, demolition_cost, 'CostPerEach', 'Salvage', expected_life, years_until_costs_start + expected_life)
294
- lcc_om = OpenStudio::Model::LifeCycleCost.createLifeCycleCost("LCC_OM - #{hVACComponent.name}", hVACComponent, om_cost, 'CostPerEach', 'Maintenance', om_frequency, 0)
295
-
296
- # get final year 0 cost
297
- yr0_capital_totalCosts_proposed += get_total_costs_for_objects([hVACComponent])
298
-
299
- end # end of costs_requested == true
300
-
301
- end # end if not hVACComponent.empty?
302
- end # end supply_components.each do
303
- end # end loops.each do
304
-
305
- # add one time demo cost of removed windows if appropriate
306
- if demo_cost_initial_const == true
307
- building = model.getBuilding
308
- lcc_baseline_demo = OpenStudio::Model::LifeCycleCost.createLifeCycleCost('LCC_baseline_demo', building, demo_costs_of_baseline_objects, 'CostPerEach', 'Salvage', 0, years_until_costs_start).get # using 0 for repeat period since one time cost.
309
- runner.registerInfo("Adding one time cost of $#{neat_numbers(lcc_baseline_demo.totalCost, 0)} related to demolition of baseline objects.")
310
-
311
- # if demo occurs on year 0 then add to initial capital cost counter
312
- if lcc_baseline_demo.yearsFromStart == 0
313
- yr0_capital_totalCosts_proposed += lcc_baseline_demo.totalCost
314
- end
315
- end
316
-
317
- if initial_motor_efficiency_values.size + missing_initial_motor_efficiency == 0
318
- runner.registerAsNotApplicable('The affected loop(s) does not contain any fans, the model will not be altered.')
319
- return true
320
- end
321
-
322
- # reporting initial condition of model
323
- runner.registerInitialCondition("The starting motor efficiency values in affected loop(s) range from #{initial_motor_efficiency_values.min * 100}% to #{initial_motor_efficiency_values.max * 100}%. Initial year 0 capital costs for affected fans is $#{neat_numbers(yr0_capital_totalCosts_baseline, 0)}.")
324
-
325
- # reporting final condition of model
326
- runner.registerFinalCondition("#{initial_motor_efficiency_values.size + missing_initial_motor_efficiency} fans had motor efficiency values set to altered. Final year 0 capital costs for affected fans is $#{neat_numbers(yr0_capital_totalCosts_proposed, 0)}.")
327
-
328
- return true
329
- end # end the cop method
330
- end # end the measure
331
-
332
- # this allows the measure to be used by the application
333
- ImproveFanTotalEfficiencybyPercentage.new.registerWithApplication