openstudio-common-measures 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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +6 -3
  4. data/Rakefile +17 -3
  5. data/lib/measures/AddDaylightSensors/LICENSE.md +27 -0
  6. data/lib/measures/AddDaylightSensors/README.md +136 -0
  7. data/lib/measures/AddDaylightSensors/README.md.erb +42 -0
  8. data/lib/measures/AddDaylightSensors/measure.rb +521 -0
  9. data/lib/measures/AddDaylightSensors/measure.xml +233 -0
  10. data/lib/measures/EnableDemandControlledVentilation/LICENSE.md +27 -0
  11. data/lib/measures/EnableDemandControlledVentilation/README.md +32 -0
  12. data/lib/measures/EnableDemandControlledVentilation/README.md.erb +42 -0
  13. data/lib/measures/EnableDemandControlledVentilation/measure.rb +154 -0
  14. data/lib/measures/EnableDemandControlledVentilation/measure.xml +99 -0
  15. data/lib/measures/EnableEconomizerControl/LICENSE.md +27 -0
  16. data/lib/measures/EnableEconomizerControl/README.md +48 -0
  17. data/lib/measures/EnableEconomizerControl/README.md.erb +42 -0
  18. data/lib/measures/EnableEconomizerControl/measure.rb +172 -0
  19. data/lib/measures/EnableEconomizerControl/measure.xml +124 -0
  20. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/LICENSE.md +27 -0
  21. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/README.md +64 -0
  22. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/README.md.erb +42 -0
  23. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/measure.rb +422 -0
  24. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/measure.xml +150 -0
  25. data/lib/measures/IncreaseInsulationRValueForRoofs/LICENSE.md +27 -0
  26. data/lib/measures/IncreaseInsulationRValueForRoofs/README.md +64 -0
  27. data/lib/measures/IncreaseInsulationRValueForRoofs/README.md.erb +42 -0
  28. data/lib/measures/IncreaseInsulationRValueForRoofs/measure.rb +422 -0
  29. data/lib/measures/IncreaseInsulationRValueForRoofs/measure.xml +143 -0
  30. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/LICENSE.md +27 -0
  31. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/README.md +97 -0
  32. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/README.md.erb +42 -0
  33. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb +450 -0
  34. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.xml +186 -0
  35. data/lib/measures/ReduceLightingLoadsByPercentage/LICENSE.md +27 -0
  36. data/lib/measures/ReduceLightingLoadsByPercentage/README.md +96 -0
  37. data/lib/measures/ReduceLightingLoadsByPercentage/README.md.erb +42 -0
  38. data/lib/measures/ReduceLightingLoadsByPercentage/measure.rb +513 -0
  39. data/lib/measures/ReduceLightingLoadsByPercentage/measure.xml +191 -0
  40. data/lib/measures/ReduceSpaceInfiltrationByPercentage/LICENSE.md +27 -0
  41. data/lib/measures/ReduceSpaceInfiltrationByPercentage/README.md +104 -0
  42. data/lib/measures/ReduceSpaceInfiltrationByPercentage/README.md.erb +42 -0
  43. data/lib/measures/ReduceSpaceInfiltrationByPercentage/measure.rb +349 -0
  44. data/lib/measures/ReduceSpaceInfiltrationByPercentage/measure.xml +181 -0
  45. data/lib/measures/ReduceVentilationByPercentage/LICENSE.md +27 -0
  46. data/lib/measures/ReduceVentilationByPercentage/README.md +40 -0
  47. data/lib/measures/ReduceVentilationByPercentage/README.md.erb +42 -0
  48. data/lib/measures/ReduceVentilationByPercentage/measure.rb +291 -0
  49. data/lib/measures/ReduceVentilationByPercentage/measure.xml +96 -0
  50. data/lib/measures/add_ems_to_control_ev_charging/{ReadMe.MD → README.md} +0 -0
  51. data/lib/measures/add_ev_load/{ReadMe.MD → README.md} +0 -0
  52. data/lib/measures/create_variable_speed_rtu/LICENSE.md +27 -0
  53. data/lib/measures/create_variable_speed_rtu/README.md +120 -0
  54. data/lib/measures/create_variable_speed_rtu/README.md.erb +42 -0
  55. data/lib/measures/create_variable_speed_rtu/measure.rb +539 -0
  56. data/lib/measures/create_variable_speed_rtu/measure.xml +207 -0
  57. data/lib/measures/generic_qaqc/measure.xml +14 -14
  58. data/lib/measures/generic_qaqc/resources/check_envelope_conductance.rb +7 -1
  59. data/lib/measures/generic_qaqc/resources/check_eui_by_end_use.rb +10 -11
  60. data/lib/measures/openstudio_results/README.md +5 -1
  61. data/lib/measures/openstudio_results/measure.rb +12 -8
  62. data/lib/measures/openstudio_results/measure.xml +56 -36
  63. data/lib/measures/openstudio_results/resources/os_lib_reporting.rb +115 -37
  64. data/lib/measures/openstudio_results/resources/os_lib_schedules.rb +27 -25
  65. data/lib/measures/set_exterior_walls_and_floors_to_adiabatic/README.md +16 -0
  66. data/lib/measures/set_exterior_walls_and_floors_to_adiabatic/measure.rb +32 -1
  67. data/lib/measures/set_exterior_walls_and_floors_to_adiabatic/measure.xml +31 -12
  68. data/lib/measures/view_data/measure.xml +8 -8
  69. data/lib/measures/view_data/resources/va3c.rb +50 -46
  70. data/lib/measures/view_model/resources/va3c.rb +50 -46
  71. data/lib/openstudio/common_measures/version.rb +1 -1
  72. data/openstudio-common-measures.gemspec +2 -2
  73. metadata +59 -9
@@ -0,0 +1,233 @@
1
+ <measure>
2
+ <schema_version>3.0</schema_version>
3
+ <name>add_daylight_sensors</name>
4
+ <uid>62babdc7-c81e-4dfd-96e8-af1628a55167</uid>
5
+ <version_id>5c889c90-31e5-40e9-835e-bb3230ad6fb8</version_id>
6
+ <version_modified>20200229T024319Z</version_modified>
7
+ <xml_checksum>0AC58119</xml_checksum>
8
+ <class_name>AddDaylightSensors</class_name>
9
+ <display_name>Add Daylight Sensor at the Center of Spaces with a Specified Space Type Assigned</display_name>
10
+ <description>This measure will add daylighting controls to spaces that that have space types assigned with names containing the string in the argument. You can also add a cost per space for sensors added to the model.</description>
11
+ <modeler_description>Make an array of the spaces that meet the criteria. Locate the sensor x and y values by averaging the min and max X and Y values from floor surfaces in the space. If a space already has a daylighting control, do not add a new one and leave the original in place. Warn the user if the space isn't assigned to a thermal zone, or if the space doesn't have any translucent surfaces. Note that the cost is added to the space not the sensor. If the sensor is removed at a later date, the cost will remain.</modeler_description>
12
+ <arguments>
13
+ <argument>
14
+ <name>space_type</name>
15
+ <display_name>Add Daylight Sensors to Spaces of This Space Type</display_name>
16
+ <type>Choice</type>
17
+ <required>true</required>
18
+ <model_dependent>false</model_dependent>
19
+ </argument>
20
+ <argument>
21
+ <name>setpoint</name>
22
+ <display_name>Daylighting Setpoint</display_name>
23
+ <type>Double</type>
24
+ <units>fc</units>
25
+ <required>true</required>
26
+ <model_dependent>false</model_dependent>
27
+ <default_value>45</default_value>
28
+ </argument>
29
+ <argument>
30
+ <name>control_type</name>
31
+ <display_name>Daylighting Control Type</display_name>
32
+ <type>Choice</type>
33
+ <required>true</required>
34
+ <model_dependent>false</model_dependent>
35
+ <default_value>Continuous/Off</default_value>
36
+ <choices>
37
+ <choice>
38
+ <value>None</value>
39
+ <display_name>None</display_name>
40
+ </choice>
41
+ <choice>
42
+ <value>Continuous</value>
43
+ <display_name>Continuous</display_name>
44
+ </choice>
45
+ <choice>
46
+ <value>Stepped</value>
47
+ <display_name>Stepped</display_name>
48
+ </choice>
49
+ <choice>
50
+ <value>Continuous/Off</value>
51
+ <display_name>Continuous/Off</display_name>
52
+ </choice>
53
+ </choices>
54
+ </argument>
55
+ <argument>
56
+ <name>min_power_fraction</name>
57
+ <display_name>Daylighting Minimum Input Power Fraction</display_name>
58
+ <description>min = 0 max = 0.6</description>
59
+ <type>Double</type>
60
+ <required>true</required>
61
+ <model_dependent>false</model_dependent>
62
+ <default_value>0.3</default_value>
63
+ </argument>
64
+ <argument>
65
+ <name>min_light_fraction</name>
66
+ <display_name>Daylighting Minimum Light Output Fraction</display_name>
67
+ <description>min = 0 max = 0.6</description>
68
+ <type>Double</type>
69
+ <required>true</required>
70
+ <model_dependent>false</model_dependent>
71
+ <default_value>0.2</default_value>
72
+ </argument>
73
+ <argument>
74
+ <name>fraction_zone_controlled</name>
75
+ <display_name>Fraction of zone controlled by daylight sensors</display_name>
76
+ <type>Double</type>
77
+ <required>true</required>
78
+ <model_dependent>false</model_dependent>
79
+ <default_value>1</default_value>
80
+ </argument>
81
+ <argument>
82
+ <name>height</name>
83
+ <display_name>Sensor Height</display_name>
84
+ <type>Double</type>
85
+ <units>inches</units>
86
+ <required>true</required>
87
+ <model_dependent>false</model_dependent>
88
+ <default_value>30</default_value>
89
+ </argument>
90
+ <argument>
91
+ <name>material_cost</name>
92
+ <display_name>Material and Installation Costs per Space for Daylight Sensor</display_name>
93
+ <type>Double</type>
94
+ <units>$</units>
95
+ <required>true</required>
96
+ <model_dependent>false</model_dependent>
97
+ <default_value>0</default_value>
98
+ </argument>
99
+ <argument>
100
+ <name>demolition_cost</name>
101
+ <display_name>Demolition Costs per Space for Daylight Sensor</display_name>
102
+ <type>Double</type>
103
+ <units>$</units>
104
+ <required>true</required>
105
+ <model_dependent>false</model_dependent>
106
+ <default_value>0</default_value>
107
+ </argument>
108
+ <argument>
109
+ <name>years_until_costs_start</name>
110
+ <display_name>Years Until Costs Start</display_name>
111
+ <type>Integer</type>
112
+ <units>whole years</units>
113
+ <required>true</required>
114
+ <model_dependent>false</model_dependent>
115
+ <default_value>0</default_value>
116
+ </argument>
117
+ <argument>
118
+ <name>demo_cost_initial_const</name>
119
+ <display_name>Demolition Costs Occur During Initial Construction</display_name>
120
+ <type>Boolean</type>
121
+ <required>true</required>
122
+ <model_dependent>false</model_dependent>
123
+ <default_value>false</default_value>
124
+ <choices>
125
+ <choice>
126
+ <value>true</value>
127
+ <display_name>true</display_name>
128
+ </choice>
129
+ <choice>
130
+ <value>false</value>
131
+ <display_name>false</display_name>
132
+ </choice>
133
+ </choices>
134
+ </argument>
135
+ <argument>
136
+ <name>expected_life</name>
137
+ <display_name>Expected Life</display_name>
138
+ <type>Integer</type>
139
+ <units>whole years</units>
140
+ <required>true</required>
141
+ <model_dependent>false</model_dependent>
142
+ <default_value>20</default_value>
143
+ </argument>
144
+ <argument>
145
+ <name>om_cost</name>
146
+ <display_name>O &amp; M Costs per Space for Daylight Sensor</display_name>
147
+ <type>Double</type>
148
+ <units>$</units>
149
+ <required>true</required>
150
+ <model_dependent>false</model_dependent>
151
+ <default_value>0</default_value>
152
+ </argument>
153
+ <argument>
154
+ <name>om_frequency</name>
155
+ <display_name>O &amp; M Frequency</display_name>
156
+ <type>Integer</type>
157
+ <units>whole years</units>
158
+ <required>true</required>
159
+ <model_dependent>false</model_dependent>
160
+ <default_value>1</default_value>
161
+ </argument>
162
+ </arguments>
163
+ <outputs/>
164
+ <provenances/>
165
+ <tags>
166
+ <tag>Electric Lighting.Electric Lighting Controls</tag>
167
+ </tags>
168
+ <attributes>
169
+ <attribute>
170
+ <name>Measure Type</name>
171
+ <value>ModelMeasure</value>
172
+ <datatype>string</datatype>
173
+ </attribute>
174
+ <attribute>
175
+ <name>Measure Function</name>
176
+ <value>Measure</value>
177
+ <datatype>string</datatype>
178
+ </attribute>
179
+ <attribute>
180
+ <name>Requires EnergyPlus Results</name>
181
+ <value>false</value>
182
+ <datatype>boolean</datatype>
183
+ </attribute>
184
+ <attribute>
185
+ <name>Uses SketchUp API</name>
186
+ <value>false</value>
187
+ <datatype>boolean</datatype>
188
+ </attribute>
189
+ </attributes>
190
+ <files>
191
+ <file>
192
+ <filename>ModelForDaylightSensors.osm</filename>
193
+ <filetype>osm</filetype>
194
+ <usage_type>test</usage_type>
195
+ <checksum>34D67AAA</checksum>
196
+ </file>
197
+ <file>
198
+ <filename>README.md.erb</filename>
199
+ <filetype>erb</filetype>
200
+ <usage_type>readmeerb</usage_type>
201
+ <checksum>703C9964</checksum>
202
+ </file>
203
+ <file>
204
+ <filename>README.md</filename>
205
+ <filetype>md</filetype>
206
+ <usage_type>readme</usage_type>
207
+ <checksum>F3117543</checksum>
208
+ </file>
209
+ <file>
210
+ <filename>LICENSE.md</filename>
211
+ <filetype>md</filetype>
212
+ <usage_type>license</usage_type>
213
+ <checksum>E0468DD6</checksum>
214
+ </file>
215
+ <file>
216
+ <version>
217
+ <software_program>OpenStudio</software_program>
218
+ <identifier>2.0.0</identifier>
219
+ <min_compatible>2.0.0</min_compatible>
220
+ </version>
221
+ <filename>measure.rb</filename>
222
+ <filetype>rb</filetype>
223
+ <usage_type>script</usage_type>
224
+ <checksum>46FDF582</checksum>
225
+ </file>
226
+ <file>
227
+ <filename>AddDaylightSensors_Test.rb</filename>
228
+ <filetype>rb</filetype>
229
+ <usage_type>test</usage_type>
230
+ <checksum>5C6D0627</checksum>
231
+ </file>
232
+ </files>
233
+ </measure>
@@ -0,0 +1,27 @@
1
+ OpenStudio(R), Copyright (c) 2008-2020, 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,32 @@
1
+
2
+
3
+ ###### (Automatically generated documentation)
4
+
5
+ # Enable Demand Controlled Ventilation
6
+
7
+ ## Description
8
+
9
+
10
+ ## Modeler Description
11
+
12
+
13
+ ## Measure Type
14
+ ModelMeasure
15
+
16
+ ## Taxonomy
17
+
18
+
19
+ ## Arguments
20
+
21
+
22
+ ### DCV Type
23
+
24
+ **Name:** dcv_type,
25
+ **Type:** Choice,
26
+ **Units:** ,
27
+ **Required:** true,
28
+ **Model Dependent:** false
29
+
30
+
31
+
32
+
@@ -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,154 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2020, 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
+ # see the URL below for information on how to write OpenStudio measures
37
+ # http://openstudio.nrel.gov/openstudio-measure-writing-guide
38
+
39
+ # see the URL below for information on using life cycle cost objects in OpenStudio
40
+ # http://openstudio.nrel.gov/openstudio-life-cycle-examples
41
+
42
+ # see the URL below for access to C++ documentation on model objects (click on "model" in the main window to view model objects)
43
+ # http://openstudio.nrel.gov/sites/openstudio.nrel.gov/files/nv_data/cpp_documentation_it/model/html/namespaces.html
44
+
45
+ # start the measure
46
+ class EnableDemandControlledVentilation < OpenStudio::Measure::ModelMeasure
47
+ # define the name that a user will see, this method may be deprecated as
48
+ # the display name in PAT comes from the name field in measure.xml
49
+ def name
50
+ return 'Enable Demand Controlled Ventilation'
51
+ end
52
+
53
+ # define the arguments that the user will input
54
+ def arguments(model)
55
+ args = OpenStudio::Measure::OSArgumentVector.new
56
+
57
+ # make choice argument economizer control type
58
+ choices = OpenStudio::StringVector.new
59
+ choices << 'EnableDCV'
60
+ choices << 'DisableDCV'
61
+ choices << 'NoChange'
62
+ dcv_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('dcv_type', choices, true)
63
+ dcv_type.setDisplayName('DCV Type')
64
+ args << dcv_type
65
+
66
+ return args
67
+ end
68
+
69
+ # define what happens when the measure is cop
70
+ def run(model, runner, user_arguments)
71
+ super(model, runner, user_arguments)
72
+
73
+ # use the built-in error checking
74
+ if !runner.validateUserArguments(arguments(model), user_arguments)
75
+ return false
76
+ end
77
+
78
+ # assign the user inputs to variables
79
+ dcv_type = runner.getStringArgumentValue('dcv_type', user_arguments)
80
+
81
+ # Note if dcv_type == NoChange
82
+ # and register as N/A
83
+ if dcv_type == 'NoChange'
84
+ runner.registerAsNotApplicable('N/A - User requested No Change in economizer operation.')
85
+ return true
86
+ end
87
+
88
+ # 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
89
+ def neat_numbers(number, roundto = 2) # round to 0 or 2)
90
+ if roundto == 2
91
+ number = format '%.2f', number
92
+ else
93
+ number = number.round
94
+ end
95
+ # regex to add commas
96
+ number.to_s.reverse.gsub(/([0-9]{3}(?=([0-9])))/, '\\1,').reverse
97
+ end
98
+
99
+ # info for initial condition
100
+ air_loops_changed = []
101
+
102
+ # loop through air loops
103
+ model.getAirLoopHVACs.each do |air_loop|
104
+ # find AirLoopHVACOutdoorAirSystem on loop
105
+ air_loop.supplyComponents.each do |supply_component|
106
+ hVACComponent = supply_component.to_AirLoopHVACOutdoorAirSystem
107
+ if !hVACComponent.empty?
108
+ hVACComponent = hVACComponent.get
109
+
110
+ # get ControllerOutdoorAir
111
+ controller_oa = hVACComponent.getControllerOutdoorAir
112
+
113
+ # get ControllerMechanicalVentilation
114
+ controller_mv = controller_oa.controllerMechanicalVentilation
115
+
116
+ if dcv_type == 'EnableDCV'
117
+ # check if demand control is enabled, if not, then enable it
118
+ if controller_mv.demandControlledVentilation == true
119
+ runner.registerInfo("#{air_loop.name} already has DCV enabled.")
120
+ else
121
+ controller_mv.setDemandControlledVentilation(true)
122
+ runner.registerInfo("Enabling DCV for #{air_loop.name}.")
123
+ air_loops_changed << air_loop
124
+ end
125
+ elsif dcv_type == 'DisableDCV'
126
+ # check if demand control is disabled, if not, then disabled it
127
+ if controller_mv.demandControlledVentilation == false
128
+ runner.registerInfo("#{air_loop.name} already has DCV disabled.")
129
+ else
130
+ controller_mv.setDemandControlledVentilation(false)
131
+ runner.registerInfo("Disabling DCV for #{air_loop.name}.")
132
+ air_loops_changed << air_loop
133
+ end
134
+ end
135
+
136
+ end
137
+ end
138
+ end
139
+
140
+ # Report N/A if none of the air loops were changed
141
+ if air_loops_changed.empty?
142
+ runner.registerAsNotApplicable('No air loops had DCV enabled or disabled.')
143
+ return true
144
+ end
145
+
146
+ # Report final condition of model
147
+ runner.registerFinalCondition("#{air_loops_changed.size} air loops now have demand controlled ventilation enabled.")
148
+
149
+ return true
150
+ end
151
+ end
152
+
153
+ # this allows the measure to be use by the application
154
+ EnableDemandControlledVentilation.new.registerWithApplication