openstudio-model-articulation 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -1
  3. data/CHANGELOG.md +13 -0
  4. data/Gemfile +2 -2
  5. data/README.md +14 -0
  6. data/lib/measures/SetWindowToWallRatioByFacade/measure.rb +10 -3
  7. data/lib/measures/SetWindowToWallRatioByFacade/measure.xml +10 -4
  8. data/lib/measures/add_empd_material_properties/LICENSE.md +27 -0
  9. data/lib/measures/add_empd_material_properties/README.md +116 -0
  10. data/lib/measures/add_empd_material_properties/README.md.erb +42 -0
  11. data/lib/measures/add_empd_material_properties/docs/.gitkeep +0 -0
  12. data/lib/measures/add_empd_material_properties/measure.rb +247 -0
  13. data/lib/measures/add_empd_material_properties/measure.xml +201 -0
  14. data/lib/measures/create_DOE_prototype_building/measure.xml +2 -2
  15. data/lib/measures/create_bar_from_building_type_ratios/README.md +109 -35
  16. data/lib/measures/create_bar_from_building_type_ratios/README.md.erb +54 -35
  17. data/lib/measures/create_bar_from_building_type_ratios/measure.rb +5 -0
  18. data/lib/measures/create_bar_from_building_type_ratios/measure.xml +16 -16
  19. data/lib/measures/create_bar_from_deer_building_type_ratios/README.md +301 -79
  20. data/lib/measures/create_bar_from_deer_building_type_ratios/README.md.erb +62 -79
  21. data/lib/measures/create_bar_from_deer_building_type_ratios/measure.rb +6 -1
  22. data/lib/measures/create_bar_from_deer_building_type_ratios/measure.xml +19 -63
  23. data/lib/measures/create_bar_from_doe_building_type_ratios/README.md +298 -57
  24. data/lib/measures/create_bar_from_doe_building_type_ratios/README.md.erb +54 -57
  25. data/lib/measures/create_bar_from_doe_building_type_ratios/measure.rb +6 -1
  26. data/lib/measures/create_bar_from_doe_building_type_ratios/measure.xml +16 -20
  27. data/lib/measures/create_bar_from_space_type_ratios/README.md +94 -42
  28. data/lib/measures/create_bar_from_space_type_ratios/README.md.erb +60 -42
  29. data/lib/measures/create_bar_from_space_type_ratios/measure.rb +5 -0
  30. data/lib/measures/create_bar_from_space_type_ratios/measure.xml +19 -19
  31. data/lib/measures/create_baseline_building/measure.xml +2 -2
  32. data/lib/measures/create_deer_prototype_building/measure.xml +2 -2
  33. data/lib/measures/create_typical_building_from_model/README.md +81 -16
  34. data/lib/measures/create_typical_building_from_model/README.md.erb +36 -16
  35. data/lib/measures/create_typical_building_from_model/measure.rb +5 -0
  36. data/lib/measures/create_typical_building_from_model/measure.xml +19 -19
  37. data/lib/measures/create_typical_deer_building_from_model/README.md +173 -53
  38. data/lib/measures/create_typical_deer_building_from_model/README.md.erb +57 -53
  39. data/lib/measures/create_typical_deer_building_from_model/measure.rb +6 -1
  40. data/lib/measures/create_typical_deer_building_from_model/measure.xml +25 -25
  41. data/lib/measures/create_typical_doe_building_from_model/README.md +182 -44
  42. data/lib/measures/create_typical_doe_building_from_model/README.md.erb +58 -44
  43. data/lib/measures/create_typical_doe_building_from_model/measure.rb +6 -1
  44. data/lib/measures/create_typical_doe_building_from_model/measure.xml +25 -25
  45. data/lib/measures/radiant_slab_with_doas/measure.rb +5 -1
  46. data/lib/measures/radiant_slab_with_doas/measure.xml +9 -9
  47. data/lib/openstudio/model_articulation/version.rb +1 -1
  48. data/openstudio-model-articulation.gemspec +2 -2
  49. metadata +13 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ada0269d8c0aadbb589eb49f75011bafa85ce302c0e9bdfa4413148a154d31ed
4
- data.tar.gz: 93a7ad690679932908eb96c1d37945cf7bd9db04be84920541e0fa4ce19aa3fa
3
+ metadata.gz: 634122fa1f2f8338143d45c88cffa1dd9fa501f976e38be205494add961425f3
4
+ data.tar.gz: 12a149ba1d6069c6627cc77d3353e8c3edd88df29112d0ab8080944a2ea9c79e
5
5
  SHA512:
6
- metadata.gz: 697918537a72f4afa205095c421263bba207a977a413fe54f3bc19c19869c28932a1f054c58d02f6c068029a9b0529ab444adc788ea53b2fd73d6486c4affd14
7
- data.tar.gz: 137c18b1a0b847f2ed86166b3a530050de5a3a04d6f6fbf5d5c2ef931b2bbcf8be18460d4bbdf136fec8f7ccd31910403dd2b065141a4eafc29950e664c4f7b3
6
+ metadata.gz: 3dcb4a376d97df26b7cf2ba3ae97c8686d38e534dd9068ca8f03794abe78282ad1295d30ac7ef686855f9e320167881bf50f9a82a9cc24fdd85a2253b3704afa
7
+ data.tar.gz: f42bcd96e5bdc0fedff4e07936419b65fd3b2920ff8bb23ba5ab414e1184505219e85422be66d365d41a0a1e5cf2264ca973955db85f87b4815f16e725aa12cc
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - 'spec/test_measures/**/*'
4
+
5
+ require: rubocop-performance
4
6
  inherit_from:
5
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
7
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v4.yml
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # OpenStudio Model Articulation Gems
2
2
 
3
+ ## Version 0.5.0
4
+ * Support for OpenStudio 3.3 (upgrade to extension gem 0.5.1 and standards gem 0.2.15)
5
+ * Fixed [#73]( https://github.com/NREL/openstudio-model-articulation-gem/pull/73 ), added add_empd_material_properties measure contributed by GFlechas
6
+ * Fixed [#83]( https://github.com/NREL/openstudio-model-articulation-gem/pull/83 ), adding compatibility matrix and contribution policy
7
+ * Fixed [#85]( https://github.com/NREL/openstudio-model-articulation-gem/pull/85 ), For SetWindowToWallRatioByFacade fixed rectangle tol and pre-split at door remove windows
8
+
9
+ ## Version 0.4.1
10
+
11
+ * Support for OpenStudio 3.2.1 (upgrade to extension gem 0.4.3 and standards gem 0.2.14)
12
+ * update to use rubocop_v4
13
+ * Documentation update to some measures
14
+ * Setting up webhook for https://bcl2.nrel.gov
15
+
3
16
  ## Version 0.4.0
4
17
 
5
18
  * Support Ruby ~> 2.7
data/Gemfile CHANGED
@@ -12,10 +12,10 @@ gemspec
12
12
  allow_local = ENV['FAVOR_LOCAL_GEMS']
13
13
 
14
14
  # uncomment when you want CI to use develop branch of extension gem
15
- gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
15
+ #gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
16
16
 
17
17
  # uncomment when you want CI to use develop branch of openstudio-standards gem
18
- gem 'openstudio-standards', github: 'NREL/OpenStudio-standards', branch: 'master'
18
+ #gem 'openstudio-standards', github: 'NREL/OpenStudio-standards', branch: 'master'
19
19
 
20
20
  # Only uncomment if you need to test a different version of the extension gem
21
21
  # if allow_local && File.exist?('../OpenStudio-extension-gem')
data/README.md CHANGED
@@ -47,6 +47,20 @@ bundle exec rake openstudio:test_with_openstudio
47
47
  /usr/local/openstudio-3.0.0-beta/bin/openstudio-3.0.0-beta --verbose --bundle '/var/simdata/openstudio/Gemfile' --bundle_path '/var/simdata/openstudio/.bundle/install/' measure -r '/var/simdata/openstudio/lib/measures/radiance_measure/'
48
48
  ```
49
49
 
50
+ # Compatibility Matrix
51
+
52
+ |OpenStudio Model Articulation Gem|OpenStudio|Ruby|
53
+ |:--------------:|:----------:|:--------:|
54
+ | 0.5.0 | 3.3 | 2.7 |
55
+ | 0.4.0 - 0.4.2 | 3.2 | 2.7 |
56
+ | 0.3.0 - 0.3.1 | 3.1 | 2.5 |
57
+ | 0.2.0 - 0.2.1 | 3.0 | 2.5 |
58
+ | 0.1.1 and below | 2.9 and below | 2.2.4 |
59
+
60
+ # Contributing
61
+
62
+ Please review the [OpenStudio Contribution Policy](https://openstudio.net/openstudio-contribution-policy) if you would like to contribute code to this gem.
63
+
50
64
  ## TODO
51
65
 
52
66
  - [ ] Move articulation measures from openstudio-measures
@@ -317,6 +317,13 @@ class SetWindowToWallRatioByFacade < OpenStudio::Measure::ModelMeasure
317
317
 
318
318
  all_surfaces = [s]
319
319
  if split_at_doors == 'Split Walls at Doors' && has_doors
320
+
321
+ # remove windows before split at doors
322
+ s.subSurfaces.each do |sub_surface|
323
+ next if ['Door','OverheadDoor'].include? sub_surface.subSurfaceType
324
+ sub_surface.remove
325
+ end
326
+
320
327
  # split base surfaces at doors to create multiple base surfaces
321
328
  split_surfaces = s.splitSurfaceForSubSurfaces.to_a # frozen array
322
329
 
@@ -341,9 +348,9 @@ class SetWindowToWallRatioByFacade < OpenStudio::Measure::ModelMeasure
341
348
  vertices.each do |vertex|
342
349
  # initialize new vertex to old vertex
343
350
  # rounding values to address tolerance issue 10 digits digits in
344
- x_vals << vertex.x.round(8)
345
- y_vals << vertex.y.round(8)
346
- z_vals << vertex.z.round(8)
351
+ x_vals << vertex.x.round(4)
352
+ y_vals << vertex.y.round(4)
353
+ z_vals << vertex.z.round(4)
347
354
  end
348
355
  if x_vals.uniq.size <= 2 && y_vals.uniq.size <= 2 && z_vals.uniq.size <= 2
349
356
  rect_tri = true
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>set_window_to_wall_ratio_by_facade</name>
5
5
  <uid>c567a0bf-a7d9-4a06-afe9-bf7df79e6bf8</uid>
6
- <version_id>aff8deeb-a011-4ad8-8c0d-22e736faa347</version_id>
7
- <version_modified>20210423T142511Z</version_modified>
6
+ <version_id>a02e024d-a1ca-413a-90e2-372cfc217228</version_id>
7
+ <version_modified>20210929T221458Z</version_modified>
8
8
  <xml_checksum>6DE831F7</xml_checksum>
9
9
  <class_name>SetWindowToWallRatioByFacade</class_name>
10
10
  <display_name>Set Window to Wall Ratio by Facade</display_name>
@@ -233,13 +233,19 @@ The measure doesn?t have any cost or lifecycle arguments, however If lifecycle o
233
233
  <filename>measure.rb</filename>
234
234
  <filetype>rb</filetype>
235
235
  <usage_type>script</usage_type>
236
- <checksum>DC3FE3CF</checksum>
236
+ <checksum>6631CF18</checksum>
237
237
  </file>
238
238
  <file>
239
239
  <filename>SetWindowToWallRatioByFacade_Test.rb</filename>
240
240
  <filetype>rb</filetype>
241
241
  <usage_type>test</usage_type>
242
- <checksum>23972ACF</checksum>
242
+ <checksum>0F626DE3</checksum>
243
+ </file>
244
+ <file>
245
+ <filename>prototype_sec_sch.osm</filename>
246
+ <filetype>osm</filetype>
247
+ <usage_type>test</usage_type>
248
+ <checksum>581DA01B</checksum>
243
249
  </file>
244
250
  </files>
245
251
  </measure>
@@ -0,0 +1,27 @@
1
+ OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted
4
+ provided that the following conditions are met:
5
+
6
+ (1) Redistributions of source code must retain the above copyright notice, this list of conditions
7
+ and the following disclaimer.
8
+
9
+ (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10
+ and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+
12
+ (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
13
+ or promote products derived from this software without specific prior written permission from the
14
+ respective party.
15
+
16
+ (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
17
+ derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
18
+ designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
21
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
23
+ OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,116 @@
1
+
2
+
3
+ ###### (Automatically generated documentation)
4
+
5
+ # Add EMPD Material Properties
6
+
7
+ ## Description
8
+ Adds the properties for the effective moisture penetration depth (EMPD) Heat Balance Model with inputs for penetration depths.
9
+
10
+ ## Modeler Description
11
+ Adds the properties for the MoisturePenetrationDepthConductionTransferFunction or effective moisture penetration depth (EMPD) Heat Balance Model with inputs for penetration depths.
12
+
13
+ Leaving Change heat balance algorithm? blank will use the current OpenStudio heat balance algorithm setting.
14
+
15
+ At least 1 interior material needs to have moisture penetration depth properties set to use the EMPD heat balance algorithm.
16
+
17
+ ## Measure Type
18
+ ModelMeasure
19
+
20
+ ## Taxonomy
21
+
22
+
23
+ ## Arguments
24
+
25
+
26
+ ### Select Material
27
+
28
+ **Name:** selected_material,
29
+ **Type:** Choice,
30
+ **Units:** ,
31
+ **Required:** true,
32
+ **Model Dependent:** true
33
+
34
+ ### Set value for Water Vapor Diffusion Resistance Factor
35
+
36
+ **Name:** water_diff_fact,
37
+ **Type:** Double,
38
+ **Units:** ,
39
+ **Required:** true,
40
+ **Model Dependent:** false
41
+
42
+ ### Set value for Moisture Equation Coefficient A
43
+
44
+ **Name:** coef_a,
45
+ **Type:** Double,
46
+ **Units:** ,
47
+ **Required:** true,
48
+ **Model Dependent:** false
49
+
50
+ ### Set value for Moisture Equation Coefficient B
51
+
52
+ **Name:** coef_b,
53
+ **Type:** Double,
54
+ **Units:** ,
55
+ **Required:** true,
56
+ **Model Dependent:** false
57
+
58
+ ### Set value for Moisture Equation Coefficient C
59
+
60
+ **Name:** coef_c,
61
+ **Type:** Double,
62
+ **Units:** ,
63
+ **Required:** true,
64
+ **Model Dependent:** false
65
+
66
+ ### Set value for Moisture Equation Coefficient D
67
+
68
+ **Name:** coef_d,
69
+ **Type:** Double,
70
+ **Units:** ,
71
+ **Required:** true,
72
+ **Model Dependent:** false
73
+
74
+ ### Set value for Surface Layer Penetration Depth
75
+
76
+ **Name:** surface_penetration,
77
+ **Type:** String,
78
+ **Units:** ,
79
+ **Required:** true,
80
+ **Model Dependent:** false
81
+
82
+ ### Set value for Deep Layer Penetration Depth
83
+
84
+ **Name:** deep_penetration,
85
+ **Type:** String,
86
+ **Units:** ,
87
+ **Required:** false,
88
+ **Model Dependent:** false
89
+
90
+ ### Set value for Coating Layer Thickness
91
+
92
+ **Name:** coating,
93
+ **Type:** Double,
94
+ **Units:** ,
95
+ **Required:** true,
96
+ **Model Dependent:** false
97
+
98
+ ### Set value for Coating Layer Resistance Factor
99
+
100
+ **Name:** coating_res,
101
+ **Type:** Double,
102
+ **Units:** ,
103
+ **Required:** true,
104
+ **Model Dependent:** false
105
+
106
+ ### Change heat balance algorithm?
107
+
108
+ **Name:** algorithm,
109
+ **Type:** Choice,
110
+ **Units:** ,
111
+ **Required:** false,
112
+ **Model Dependent:** false
113
+
114
+
115
+
116
+
@@ -0,0 +1,42 @@
1
+ <%#= README.md.erb is used to auto-generate README.md. %>
2
+ <%#= To manually maintain README.md throw away README.md.erb and manually edit README.md %>
3
+ ###### (Automatically generated documentation)
4
+
5
+ # <%= name %>
6
+
7
+ ## Description
8
+ <%= description %>
9
+
10
+ ## Modeler Description
11
+ <%= modelerDescription %>
12
+
13
+ ## Measure Type
14
+ <%= measureType %>
15
+
16
+ ## Taxonomy
17
+ <%= taxonomy %>
18
+
19
+ ## Arguments
20
+
21
+ <% arguments.each do |argument| %>
22
+ ### <%= argument[:display_name] %>
23
+ <%= argument[:description] %>
24
+ **Name:** <%= argument[:name] %>,
25
+ **Type:** <%= argument[:type] %>,
26
+ **Units:** <%= argument[:units] %>,
27
+ **Required:** <%= argument[:required] %>,
28
+ **Model Dependent:** <%= argument[:model_dependent] %>
29
+ <% end %>
30
+
31
+ <% if arguments.size == 0 %>
32
+ <%= "This measure does not have any user arguments" %>
33
+ <% end %>
34
+
35
+ <% if outputs.size > 0 %>
36
+ ## Outputs
37
+ <% output_names = [] %>
38
+ <% outputs.each do |output| %>
39
+ <% output_names << output[:display_name] %>
40
+ <% end %>
41
+ <%= output_names.join(", ") %>
42
+ <% end %>
@@ -0,0 +1,247 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2021, 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 HOLDER(S) AND ANY CONTRIBUTORS
24
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
27
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
28
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ # insert your copyright here
37
+
38
+ # Measure written by Gabriel Flechas
39
+ # Assitance by Karl Heine (THANKS KARL!)
40
+ # Last edit 05/25/2021
41
+
42
+ # see the URL below for information on how to write OpenStudio measures
43
+ # http://nrel.github.io/OpenStudio-user-documentation/reference/measure_writing_guide/
44
+
45
+ # start the measure
46
+ class AddEMPDMaterialProperties < OpenStudio::Measure::ModelMeasure
47
+ # human readable name
48
+ def name
49
+ # Measure name should be the title case of the class name.
50
+ return 'Add EMPD Material Properties'
51
+ end
52
+
53
+ # human readable description
54
+ def description
55
+ return 'Adds the properties for the effective moisture penetration depth (EMPD) Heat Balance Model with inputs for penetration depths.'
56
+ end
57
+
58
+ # human readable description of modeling approach
59
+ def modeler_description
60
+ return ['Adds', 'the', 'properties', 'for', 'the', 'MoisturePenetrationDepthConductionTransferFunction', 'or', 'effective', 'moisture', 'penetration', 'depth', '(EMPD)', 'Heat', 'Balance', 'Model', 'with', 'inputs', 'for', 'penetration', 'depths.', "\n\n", 'Leaving', 'Change', 'heat', 'balance', 'algorithm?', 'blank', 'will', 'use', 'the', 'current', 'OpenStudio', 'heat', 'balance', 'algorithm', 'setting.', "\n\n", 'At', 'least', '1', 'interior', 'material', 'needs', 'to', 'have', 'moisture', 'penetration', 'depth', 'properties', 'set', 'to', 'use', 'the', 'EMPD', 'heat', 'balance', 'algorithm.'].join(' ')
61
+ end
62
+
63
+ # define the arguments that the user will input
64
+ def arguments(model)
65
+ args = OpenStudio::Measure::OSArgumentVector.new
66
+
67
+ # find the available materials
68
+ list_materials = model.getMaterials
69
+ mat_names = []
70
+ list_materials.each do |v|
71
+ mat_names.append(v.name.to_s)
72
+ end
73
+ mat_names.sort!
74
+
75
+ # Create arguments for material selection (Choice)
76
+ selected_material = OpenStudio::Measure::OSArgument.makeChoiceArgument('selected_material',
77
+ mat_names, true, true)
78
+ selected_material.setDisplayName('Select Material')
79
+ if !mat_names.empty?
80
+ selected_material.setDefaultValue(mat_names[0])
81
+ else
82
+ selected_material.setDefaultValue('No Materials In Model!')
83
+ end
84
+ args << selected_material
85
+
86
+ # create argument for Water Vapor Diffusion Resistance Factor
87
+ water_diff_fact = OpenStudio::Measure::OSArgument.makeDoubleArgument('water_diff_fact', true)
88
+ water_diff_fact.setDisplayName('Set value for Water Vapor Diffusion Resistance Factor')
89
+ water_diff_fact.setDefaultValue(0)
90
+ args << water_diff_fact
91
+
92
+ # create argument for Coefficient A
93
+ coef_a = OpenStudio::Measure::OSArgument.makeDoubleArgument('coef_a', true)
94
+ coef_a.setDisplayName('Set value for Moisture Equation Coefficient A')
95
+ coef_a.setDefaultValue(0)
96
+ args << coef_a
97
+
98
+ # create argument for Coefficient B
99
+ coef_b = OpenStudio::Measure::OSArgument.makeDoubleArgument('coef_b', true)
100
+ coef_b.setDisplayName('Set value for Moisture Equation Coefficient B')
101
+ coef_b.setDefaultValue(0)
102
+ args << coef_b
103
+
104
+ # create argument for Coefficient C
105
+ coef_c = OpenStudio::Measure::OSArgument.makeDoubleArgument('coef_c', true)
106
+ coef_c.setDisplayName('Set value for Moisture Equation Coefficient C')
107
+ coef_c.setDefaultValue(0)
108
+ args << coef_c
109
+
110
+ # create argument for Coefficient D
111
+ coef_d = OpenStudio::Measure::OSArgument.makeDoubleArgument('coef_d', true)
112
+ coef_d.setDisplayName('Set value for Moisture Equation Coefficient D')
113
+ coef_d.setDefaultValue(0)
114
+ args << coef_d
115
+
116
+ # create argument for Surface Layer Penetration Depth
117
+ surface_penetration = OpenStudio::Measure::OSArgument.makeStringArgument('surface_penetration', true)
118
+ surface_penetration.setDisplayName('Set value for Surface Layer Penetration Depth')
119
+ surface_penetration.setDefaultValue('Auto')
120
+ args << surface_penetration
121
+
122
+ # create argument for Deep Layer Penetration Depth
123
+ deep_penetration = OpenStudio::Measure::OSArgument.makeStringArgument('deep_penetration', false)
124
+ deep_penetration.setDisplayName('Set value for Deep Layer Penetration Depth')
125
+ deep_penetration.setDefaultValue('Auto')
126
+ args << deep_penetration
127
+
128
+ # create argument for Coating layer Thickness
129
+ coating = OpenStudio::Measure::OSArgument.makeDoubleArgument('coating', true)
130
+ coating.setDisplayName('Set value for Coating Layer Thickness')
131
+ coating.setDefaultValue(0)
132
+ args << coating
133
+
134
+ # create argument for Coating layer Resistance
135
+ coating_res = OpenStudio::Measure::OSArgument.makeDoubleArgument('coating_res', true)
136
+ coating_res.setDisplayName('Set value for Coating Layer Resistance Factor')
137
+ coating_res.setDefaultValue(0)
138
+ args << coating_res
139
+
140
+ # create argument for heat balance algorithm
141
+ algs = ['', 'MoisturePenetrationDepthConductionTransferFunction',
142
+ 'ConductionTransferFunction']
143
+ algorithm = OpenStudio::Measure::OSArgument.makeChoiceArgument('algorithm', algs, false)
144
+ algorithm.setDisplayName('Change heat balance algorithm?')
145
+ algorithm.setDefaultValue(algs[0])
146
+ args << algorithm
147
+
148
+ return args
149
+ end
150
+
151
+ # define what happens when the measure is run
152
+ def run(model, runner, user_arguments)
153
+ super(model, runner, user_arguments)
154
+
155
+ # use the built-in error checking
156
+ if !runner.validateUserArguments(arguments(model), user_arguments)
157
+ return false
158
+ end
159
+
160
+ # assign the user inputs to variables
161
+ selected_material = runner.getStringArgumentValue('selected_material', user_arguments)
162
+ water_diff_fact = runner.getDoubleArgumentValue('water_diff_fact', user_arguments)
163
+ coef_a = runner.getDoubleArgumentValue('coef_a', user_arguments)
164
+ coef_b = runner.getDoubleArgumentValue('coef_b', user_arguments)
165
+ coef_c = runner.getDoubleArgumentValue('coef_c', user_arguments)
166
+ coef_d = runner.getDoubleArgumentValue('coef_d', user_arguments)
167
+ surface_penetration = runner.getStringArgumentValue('surface_penetration', user_arguments)
168
+ surface_penetration = surface_penetration.to_f
169
+ deep_penetration = runner.getStringArgumentValue('deep_penetration', user_arguments)
170
+ deep_penetration = deep_penetration.to_f
171
+ coating = runner.getDoubleArgumentValue('coating', user_arguments)
172
+ coating_res = runner.getDoubleArgumentValue('coating_res', user_arguments)
173
+ algorithm = runner.getStringArgumentValue('algorithm', user_arguments)
174
+
175
+ #---------------------------------------------------------------------------
176
+ # Validate arguments
177
+ if water_diff_fact == 0
178
+ runner.registerError('The Water Vapor Diffusion Resistance Factor needs to be greater than 0.')
179
+ return false
180
+ end
181
+ if coef_a == 0
182
+ runner.registerWarning('The Moisture Equation Coefficient A has been left as 0. This is usally a non-zero value.')
183
+ end
184
+ if coef_b == 0
185
+ runner.registerWarning('The Moisture Equation Coefficient B has been left as 0. This is usally a non-zero value.')
186
+ end
187
+ if coef_c == 0
188
+ runner.registerWarning('The Moisture Equation Coefficient C has been left as 0. This is usally a non-zero value.')
189
+ end
190
+ if coef_d == 0
191
+ runner.registerWarning('The Moisture Equation Coefficient D has been left as 0. This is usally a non-zero value.')
192
+ end
193
+ #---------------------------------------------------------------------------
194
+
195
+ # Get os object for selected material
196
+ mats = model.getMaterials
197
+ mat = ''
198
+ mats.each do |m|
199
+ if m.name.to_s == selected_material
200
+ mat = m
201
+ end
202
+ end
203
+
204
+ # report initial condition of model
205
+ runner.registerInitialCondition("The building has #{mats.size} materials.")
206
+
207
+ #---------------------------------------------------------------------------
208
+ # Set algorithm and report to users
209
+ if algorithm != ''
210
+ alg = model.getHeatBalanceAlgorithm
211
+ alg.setAlgorithm(algorithm)
212
+ runner.registerInfo("Heat Balance Algorithm Set to : #{algorithm}")
213
+ end
214
+ #---------------------------------------------------------------------------
215
+
216
+ # Add moisture properties object and make changes to model
217
+ n = OpenStudio::Model::MaterialPropertyMoisturePenetrationDepthSettings.new(
218
+ mat, water_diff_fact, coef_a, coef_b, coef_c, coef_d, coating, coating_res
219
+ )
220
+
221
+ # check if the surface penetration is being autocalculated, and if not set the depth
222
+ if surface_penetration > 0
223
+ n.setSurfaceLayerPenetrationDepth(surface_penetration)
224
+ runner.registerInfo("Surface layer penetration depth set to: #{surface_penetration}")
225
+ else
226
+ n.autocalculateSurfaceLayerPenetrationDepth
227
+ runner.registerInfo('Surface layer penetration depth set to: AutoCalculate')
228
+ end
229
+
230
+ # check if the deep penetration is being autocalculated, and if not set the depth
231
+ if deep_penetration > 0
232
+ n.setDeepLayerPenetrationDepth(deep_penetration)
233
+ runner.registerInfo("Deep layer penetration depth set to: #{surface_penetration}")
234
+ else
235
+ n.autocalculateDeepLayerPenetrationDepth
236
+ runner.registerInfo('Deep layer penetration depth set to: AutoCalculate')
237
+ end
238
+
239
+ # report final condition of model
240
+ runner.registerFinalCondition("Moisture properties were added to #{selected_material}.")
241
+
242
+ return true
243
+ end
244
+ end
245
+
246
+ # register the measure to be used by the application
247
+ AddEMPDMaterialProperties.new.registerWithApplication