openstudio-common-measures 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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +3 -1
  4. data/CHANGELOG.md +8 -0
  5. data/README.md +14 -0
  6. data/lib/measures/ReportModelChanges/measure.xml +2 -2
  7. data/lib/measures/add_ems_emissions_reporting/LICENSE.MD.txt +15 -0
  8. data/lib/measures/add_ems_emissions_reporting/LICENSE.md +27 -0
  9. data/lib/measures/add_ems_emissions_reporting/README.md +17 -0
  10. data/lib/measures/add_ems_emissions_reporting/measure.rb +268 -0
  11. data/lib/measures/add_ems_emissions_reporting/measure.xml +247 -0
  12. data/lib/measures/add_ems_emissions_reporting/resources/future_annual_co2e.csv +17 -0
  13. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2020.csv +8761 -0
  14. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2022.csv +8761 -0
  15. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2024.csv +8761 -0
  16. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2026.csv +8761 -0
  17. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2028.csv +8761 -0
  18. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2030.csv +8761 -0
  19. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2032.csv +8761 -0
  20. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2034.csv +8761 -0
  21. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2036.csv +8761 -0
  22. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2038.csv +8761 -0
  23. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2040.csv +8761 -0
  24. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2042.csv +8761 -0
  25. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2044.csv +8761 -0
  26. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2046.csv +8761 -0
  27. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2048.csv +8761 -0
  28. data/lib/measures/add_ems_emissions_reporting/resources/future_hourly_co2e_2050.csv +8761 -0
  29. data/lib/measures/add_ems_emissions_reporting/resources/historical_annual_co2e.csv +9 -0
  30. data/lib/measures/add_ems_emissions_reporting/resources/historical_hourly_co2e_2019.csv +8761 -0
  31. data/lib/measures/hvac_psychrometric_chart/measure.xml +4 -3
  32. data/lib/measures/set_run_period/measure.xml +2 -2
  33. data/lib/measures/view_data/measure.xml +8 -8
  34. data/lib/measures/view_data/resources/report.html.in +1149 -956
  35. data/lib/measures/view_model/measure.xml +29 -60
  36. data/lib/measures/view_model/resources/report.html.in +1152 -959
  37. data/lib/openstudio/common_measures/version.rb +1 -1
  38. data/openstudio-common-measures.gemspec +2 -2
  39. metadata +31 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 541beaf68995c607e48fc05f7cfe05668d012e2e87bb2d443b6ebbe55f2159c9
4
- data.tar.gz: 5be5b201dff7796ba33d3bda9b8eeb65de28338d66881369c22359c3a28e357d
3
+ metadata.gz: aef91215d3cc45d5b5686f4c94e82b7aa44d2610cdeac9de7019b4706233715c
4
+ data.tar.gz: d70ac47cbce72e9b8e79cad8e864a01b7271d8ff4d88c070e96b06cba2ccdfb8
5
5
  SHA512:
6
- metadata.gz: a36f9fdf655284051f5d57e006ff1dda8b024fd983bc81ef4da4387279a056425b795f223247f6abaea87c95a63fe2e07eee9b5cc3416c0cabd0e18f5fc03bd4
7
- data.tar.gz: 677cd178a8d2ee08d9d2b241cd9727b82e5d8a531b2bb07a58c793c3dc85b23384312cb74883fb2bf356a223d95beb1edf62dccecea1e7639b5c423537a535e2
6
+ metadata.gz: 96765829e90d5133823178efdccd0983e523c291f0d2fc620c1a04084d83d9cdf8aa07f52320cf83acc10c46b0ef28681637d5e88425e985eb9e37ab1b30a777
7
+ data.tar.gz: 646027cdd27160feb03555e26f2104c05660b3dfa8f1b852254c1b87fa91c9e80871a16cf36b114d84408726cc103e87a0a637cfe805cca9f6c8a45b84e5bd7d
data/.gitignore CHANGED
@@ -12,6 +12,7 @@
12
12
  /test/
13
13
  /lib/measures/test_results
14
14
  /lib/measures/*/tests/output
15
+ /lib/measures/*/tests/files
15
16
  /lib/measures/staged
16
17
 
17
18
  .rubocop*s3*
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
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Version 0.4.0
4
4
 
5
+ * Support for OpenStudio 3.3 (upgrade to extension gem 0.5.1 and standards gem 0.2.15)
6
+ * Fixed [#80]( https://github.com/NREL/openstudio-common-measures-gem/pull/80 ), Custom emissions reporting measure
7
+ * Fixed [#82]( https://github.com/NREL/openstudio-common-measures-gem/pull/82 ), adding compatibility matrix and contribution policy
8
+ * Fixed [#84]( https://github.com/NREL/openstudio-common-measures-gem/pull/84 ), Add latest CO2 CSVs from LBNL
9
+ * Adding surface search to view model and view data commited by macumber
10
+
11
+ ## Version 0.4.0
12
+
5
13
  * Support Ruby ~> 2.7
6
14
  * Support for OpenStudio 3.2 (upgrade to extension gem 0.4.2 and standards gem 0.2.13)
7
15
  * Add EV measure load files
data/README.md CHANGED
@@ -34,6 +34,20 @@ bundle exec rake openstudio:test_with_openstudio
34
34
 
35
35
  - [ ] Update measures to follow coding standards
36
36
 
37
+ # Compatibility Matrix
38
+
39
+ |OpenStudio Common Measures Gem|OpenStudio|Ruby|
40
+ |:--------------:|:----------:|:--------:|
41
+ | 0.5.0 | 3.3 | 2.7 |
42
+ | 0.4.0 - 0,4.2 | 3.2 | 2.7 |
43
+ | 0.3.0 - 0.3.2 | 3.1 | 2.5 |
44
+ | 0.2.0 - 0.2.1 | 3.0 | 2.5 |
45
+ | 0.1.2 and below | 2.9 and below | 2.2.4 |
46
+
47
+ # Contributing
48
+
49
+ Please review the [OpenStudio Contribution Policy](https://openstudio.net/openstudio-contribution-policy) if you would like to contribute code to this gem.
50
+
37
51
  # Releasing
38
52
 
39
53
  * Update CHANGELOG.md
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.0</schema_version>
4
4
  <name>report_model_changes</name>
5
5
  <uid>6d66b426-908f-4528-9fe5-523b9d2f49c5</uid>
6
- <version_id>00be21f8-d770-48fa-bc1e-4ecfd626e5dd</version_id>
7
- <version_modified>20210423T144506Z</version_modified>
6
+ <version_id>a4712e0a-6080-4534-a6b8-16e9312c623e</version_id>
7
+ <version_modified>20210708T213307Z</version_modified>
8
8
  <xml_checksum>1E1F8B97</xml_checksum>
9
9
  <class_name>ReportModelChanges</class_name>
10
10
  <display_name>ReportModelChanges</display_name>
@@ -0,0 +1,15 @@
1
+
2
+
3
+ OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
+
7
+ (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
+
9
+ (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
+
11
+ (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission from the respective party.
12
+
13
+ (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -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,17 @@
1
+ ## Add EMS to Report Emissions
2
+ ## Description
3
+ This measure reports emissions based on user-provided CSVs.
4
+
5
+ ## Modeler Description
6
+ This measure uses EnergyPlus' Energy Management System to log and report emissions based on user provided CSV file(s).
7
+
8
+ ## Measure Type
9
+ EnergyPlusMeasure
10
+
11
+ ## Arguments
12
+ ## Subregion
13
+ Name: sub_regn, Type: string, Units: none, Required: true, Model Dependent: false. This argument is the eGrid subregion. Options are: AZNM, CAMX, ERCT, FRCC, MROE, MROW, NEWE, NWPP, NYST, RFCE, RFCM, RFCW, RMPA, SPNO, SPSO, SRMV, SRMW, SRSO, SRTV, and SRVC. Default is RMPA.
14
+ ## Future Year
15
+ Name: fut_year, Type: integer, Units: none, Required: true, Model Dependent: false. This argument is the future year of interest. Options are: 2020 to 2050 in two year increments. Default is 2030.
16
+ ## Historical Year
17
+ Name: his_year, Type: integer, Units: none, Required: true, Model Dependent: false. This argument is the historical year of interest. Options are: 2007, 2009, 2010, 2012, 2014, 2016, 2018, and 2019. Default is 2010.
@@ -0,0 +1,268 @@
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
+ require 'csv'
37
+ require 'openstudio-extension'
38
+ require 'openstudio/extension/core/os_lib_helper_methods'
39
+
40
+ # start the measure
41
+ class AddEMSEmissionsReporting < OpenStudio::Measure::ModelMeasure
42
+ # human readable name
43
+ def name
44
+ return 'Add EMS to Report Emissions'
45
+ end
46
+
47
+ # human readable description
48
+ def description
49
+ return 'This measure reports emissions based on user-provided future and historical years as well as future, historical hourly, and historical annual subregions.'
50
+ end
51
+
52
+ # human readable description of modeling approach
53
+ def modeler_description
54
+ return 'This measure uses the EnergyPlus Energy Management System to log and report emissions based on user-provided future and historical years as well as future, historical hourly, and historical annual subregions.'
55
+ end
56
+
57
+ # define the arguments that the user will input
58
+ def arguments(model)
59
+ args = OpenStudio::Measure::OSArgumentVector.new
60
+
61
+ # future subregion
62
+ future_subregion = OpenStudio::Measure::OSArgument.makeStringArgument('future_subregion', true)
63
+ future_subregion.setDisplayName('Future subregion')
64
+ future_subregion.setDescription('Future subregion. Options are: AZNMc, CAMXc, ERCTc, FRCCc, MROEc, MROWc, NEWEc, NWPPc, NYSTc, RFCEc, RFCMc, RFCWc, RMPAc, SPNOc, SPSOc, SRMVc, SRMWc, SRSOc, SRTVc, and SRVCc')
65
+ future_subregion.setDefaultValue('RMPAc')
66
+ args << future_subregion
67
+
68
+ # historical hourly subregion
69
+ hourly_historical_subregion = OpenStudio::Measure::OSArgument.makeStringArgument('hourly_historical_subregion', true)
70
+ hourly_historical_subregion.setDisplayName('Historical hourly subregion')
71
+ hourly_historical_subregion.setDescription('Historical hourly subregion. Options are: California, Carolinas, Central, Florida, Mid-Atlantic, Midwest, New England, New York, Northwest, Rocky Mountains, Southeast, Southwest, Tennessee, and Texas')
72
+ hourly_historical_subregion.setDefaultValue('Rocky Mountains')
73
+ args << hourly_historical_subregion
74
+
75
+ # historical annual subregion
76
+ annual_historical_subregion = OpenStudio::Measure::OSArgument.makeStringArgument('annual_historical_subregion', true)
77
+ annual_historical_subregion.setDisplayName('Historical annual subregion')
78
+ annual_historical_subregion.setDescription('Historical annual subregion. Options are: AKGD, AKMS, AZNM, CAMX, ERCT, FRCC, HIMS, HIOA, MROE, MROW, NEWE, NWPP, NYCW, NYLI, NYUP, RFCE, RFCM, RFCW, RMPA, SPNO, SPSO, SRMV, SRMW, SRSO, SRTV, and SRVC')
79
+ annual_historical_subregion.setDefaultValue('RMPA')
80
+ args << annual_historical_subregion
81
+
82
+ # future year
83
+ future_year = OpenStudio::Measure::OSArgument.makeIntegerArgument('future_year', true)
84
+ future_year.setDisplayName('Future Year')
85
+ future_year.setDescription('Future Year. Options are: 2020 to 2050 in two year increments')
86
+ future_year.setDefaultValue(2020)
87
+ args << future_year
88
+
89
+ # hourly historical year
90
+ hourly_historical_year = OpenStudio::Measure::OSArgument.makeIntegerArgument('hourly_historical_year', true)
91
+ hourly_historical_year.setDisplayName('Hourly Historical Year')
92
+ hourly_historical_year.setDescription('Hourly Historical Year. Options are: 2019.')
93
+ hourly_historical_year.setDefaultValue(2019)
94
+ args << hourly_historical_year
95
+
96
+ # annual historical year
97
+ annual_historical_year = OpenStudio::Measure::OSArgument.makeIntegerArgument('annual_historical_year', true)
98
+ annual_historical_year.setDisplayName('Annual Historical Year')
99
+ annual_historical_year.setDescription('Annual Historical Year. Options are: 2007, 2009, 2010, 2012, 2014, 2016, 2018, and 2019.')
100
+ annual_historical_year.setDefaultValue(2019)
101
+ args << annual_historical_year
102
+
103
+ return args
104
+ end
105
+
106
+ # define what happens when the measure is run
107
+ def run(model, runner, usr_args)
108
+ super(model, runner, usr_args)
109
+
110
+ # use the built-in error checking
111
+ return false unless runner.validateUserArguments(arguments(model), usr_args)
112
+
113
+ # assign the user inputs to variables
114
+ future_subregion = runner.getStringArgumentValue('future_subregion', usr_args)
115
+ hourly_historical_subregion = runner.getStringArgumentValue('hourly_historical_subregion', usr_args)
116
+ annual_historical_subregion = runner.getStringArgumentValue('annual_historical_subregion', usr_args)
117
+ future_year = runner.getIntegerArgumentValue('future_year', usr_args)
118
+ hourly_historical_year = runner.getIntegerArgumentValue('hourly_historical_year', usr_args)
119
+ annual_historical_year = runner.getIntegerArgumentValue('annual_historical_year', usr_args)
120
+
121
+ fut_hr_path = "#{__dir__}/resources/future_hourly_co2e_#{future_year}.csv"
122
+ his_hr_path = "#{__dir__}/resources/historical_hourly_co2e_#{hourly_historical_year}.csv"
123
+ fut_yr_path = "#{__dir__}/resources/future_annual_co2e.csv"
124
+ his_yr_path = "#{__dir__}/resources/historical_annual_co2e.csv"
125
+
126
+ # find external files
127
+ if ((File.exist?(fut_hr_path)) and (File.exist?(fut_yr_path)) and (File.exist?(his_hr_path)) and (File.exist?(his_yr_path)))
128
+ fut_hr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, fut_hr_path)
129
+ his_hr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, his_hr_path)
130
+ fut_yr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, fut_yr_path)
131
+ his_yr_file = OpenStudio::Model::ExternalFile.getExternalFile(model, his_yr_path)
132
+ if ((fut_hr_file.is_initialized) and (his_hr_file.is_initialized) and (fut_yr_file.is_initialized) and (his_yr_file.is_initialized))
133
+ fut_hr_file = fut_hr_file.get
134
+ his_hr_file = his_hr_file.get
135
+ fut_yr_file = fut_yr_file.get
136
+ his_yr_file = his_yr_file.get
137
+ fut_hr_data = CSV.read(fut_hr_path, headers: true)
138
+ his_hr_data = CSV.read(his_hr_path, headers: true)
139
+ fut_yr_data = CSV.read(fut_yr_path, headers: true)
140
+ his_yr_data = CSV.read(his_yr_path, headers: true)
141
+ end
142
+ else
143
+ runner.registerError("Could not find CSV file at one of more of the following paths: #{fut_hr_path}, #{his_hr_path}, #{fut_yr_path}, or #{his_yr_path}")
144
+ return false
145
+ end
146
+
147
+ # add schedule type limits for schedule file
148
+ lim_type = OpenStudio::Model::ScheduleTypeLimits.new(model)
149
+ lim_type.setName('Emissions Sch File Type Limits')
150
+
151
+ # add future schedule file
152
+ sch_file = OpenStudio::Model::ScheduleFile.new(fut_hr_file)
153
+ sch_file.setName("#{future_subregion} #{future_year} Future Hourly Emissions Sch")
154
+ sch_file.setScheduleTypeLimits(lim_type)
155
+ sch_file.setColumnNumber(fut_hr_data.headers.index(future_subregion) + 1)
156
+ sch_file.setRowstoSkipatTop(1)
157
+ sch_file.setNumberofHoursofData(8760)
158
+ sch_file.setColumnSeparator('Comma')
159
+ sch_file.setInterpolatetoTimestep(false)
160
+ sch_file.setMinutesperItem(60)
161
+
162
+ # add historical schedule file
163
+ sch_file = OpenStudio::Model::ScheduleFile.new(his_hr_file)
164
+ sch_file.setName("#{hourly_historical_subregion} #{hourly_historical_year} Historical Hourly Emissions Sch")
165
+ sch_file.setScheduleTypeLimits(lim_type)
166
+ sch_file.setColumnNumber(his_hr_data.headers.index(hourly_historical_subregion) + 1)
167
+ sch_file.setRowstoSkipatTop(1)
168
+ sch_file.setNumberofHoursofData(8760)
169
+ sch_file.setColumnSeparator('Comma')
170
+ sch_file.setInterpolatetoTimestep(false)
171
+ sch_file.setMinutesperItem(60)
172
+
173
+ # add EMS sensor for future schedule file
174
+ sch_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
175
+ sch_sens.setKeyName("#{future_subregion} #{future_year} Future Hourly Emissions Sch")
176
+ sch_sens.setName('Fut_Sen')
177
+
178
+ # add EMS sensor for historical schedule file
179
+ sch_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
180
+ sch_sens.setKeyName("#{hourly_historical_subregion} #{hourly_historical_year} Historical Hourly Emissions Sch")
181
+ sch_sens.setName('His_Sen')
182
+
183
+ # add whole-building electricity sensor
184
+ sch_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Facility Total Purchased Electricity Energy')
185
+ sch_sens.setKeyName('Whole Building')
186
+ sch_sens.setName('Ele_Sen')
187
+
188
+ ems_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
189
+ ems_prgm.setName('Emissions_Calc_Prgm')
190
+ ems_prgm.addLine('SET fut_hr_val = Fut_Sen')
191
+ ems_prgm.addLine('SET his_hr_val = His_Sen')
192
+ fut_yr_data.each {|r| ems_prgm.addLine("SET fut_yr_val = #{r[future_subregion]}") if r[0].to_i == future_year}
193
+ his_yr_data.each {|r| ems_prgm.addLine("SET his_yr_val = #{r[annual_historical_subregion]}") if r[0].to_i == annual_historical_year}
194
+ ems_prgm.addLine('SET elec = Ele_Sen')
195
+ ems_prgm.addLine('SET conv = 1000000 * 60 * 60') # J to MWh (1000000J/MJ * 60hr/min * 60 min/sec)
196
+ ems_prgm.addLine('SET fut_hr = fut_hr_val * elec / conv')
197
+ ems_prgm.addLine('SET his_hr = his_hr_val * elec / conv')
198
+ ems_prgm.addLine('SET fut_yr = fut_yr_val * elec / conv')
199
+ ems_prgm.addLine('SET his_yr = his_yr_val * elec / conv')
200
+
201
+ # add EMS program calling manager
202
+ mgr_prgm = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
203
+ mgr_prgm.setName('Emissions Calc Prgm')
204
+ mgr_prgm.setCallingPoint('EndOfSystemTimestepBeforeHVACReporting')
205
+ mgr_prgm.setProgram(ems_prgm, 0)
206
+
207
+ # add future hourly EMS output variable
208
+ ems_var1 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'fut_hr')
209
+ ems_var1.setName("#{future_subregion}_#{future_year}_Hourly_Emissions_Var")
210
+ ems_var1.setEMSVariableName('fut_hr')
211
+ ems_var1.setTypeOfDataInVariable('Summed')
212
+ ems_var1.setUpdateFrequency('SystemTimestep')
213
+ ems_var1.setEMSProgramOrSubroutineName(ems_prgm)
214
+ ems_var1.setUnits('kg')
215
+
216
+ # add historical hourly EMS output variable
217
+ ems_var2 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'his_hr')
218
+ ems_var2.setName("#{hourly_historical_subregion.gsub(' ','_')}_#{hourly_historical_year}_Hourly_Emissions_Var")
219
+ ems_var2.setEMSVariableName('his_hr')
220
+ ems_var2.setTypeOfDataInVariable('Summed')
221
+ ems_var2.setUpdateFrequency('SystemTimestep')
222
+ ems_var2.setEMSProgramOrSubroutineName(ems_prgm)
223
+ ems_var2.setUnits('kg')
224
+
225
+ # add future annual EMS output variable
226
+ ems_var3 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'fut_yr')
227
+ ems_var3.setName("#{future_subregion}_#{future_year}_Annual_Emissions_Var")
228
+ ems_var3.setEMSVariableName('fut_yr')
229
+ ems_var3.setTypeOfDataInVariable('Summed')
230
+ ems_var3.setUpdateFrequency('SystemTimestep')
231
+ ems_var3.setEMSProgramOrSubroutineName(ems_prgm)
232
+ ems_var3.setUnits('kg')
233
+
234
+ # add historical annual EMS output variable
235
+ ems_var4 = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, 'his_yr')
236
+ ems_var4.setName("#{annual_historical_subregion}_#{annual_historical_year}_Annual_Emissions_Var")
237
+ ems_var4.setEMSVariableName('his_yr')
238
+ ems_var4.setTypeOfDataInVariable('Summed')
239
+ ems_var4.setUpdateFrequency('SystemTimestep')
240
+ ems_var4.setEMSProgramOrSubroutineName(ems_prgm)
241
+ ems_var4.setUnits('kg')
242
+
243
+ # add future hourly reporting output variable
244
+ out_var1 = OpenStudio::Model::OutputVariable.new("#{future_subregion}_#{future_year}_Hourly_Emissions_Var", model)
245
+ out_var1.setKeyValue('EMS')
246
+ out_var1.setReportingFrequency('hourly')
247
+
248
+ # add historical hourly reporting output variable
249
+ out_var2 = OpenStudio::Model::OutputVariable.new("#{hourly_historical_subregion.gsub(' ','_')}_#{hourly_historical_year}_Hourly_Emissions_Var", model)
250
+ out_var2.setKeyValue('EMS')
251
+ out_var2.setReportingFrequency('hourly')
252
+
253
+ # add future annual reporting output variable
254
+ out_var3 = OpenStudio::Model::OutputVariable.new("#{future_subregion}_#{future_year}_Annual_Emissions_Var", model)
255
+ out_var3.setKeyValue('EMS')
256
+ out_var3.setReportingFrequency('hourly')
257
+
258
+ # add historical annual reporting output variable
259
+ out_var4 = OpenStudio::Model::OutputVariable.new("#{annual_historical_subregion}_#{annual_historical_year}_Annual_Emissions_Var", model)
260
+ out_var4.setKeyValue('EMS')
261
+ out_var4.setReportingFrequency('hourly')
262
+
263
+ return true
264
+ end
265
+ end
266
+
267
+ # register the measure to be used by the application
268
+ AddEMSEmissionsReporting.new.registerWithApplication
@@ -0,0 +1,247 @@
1
+ <?xml version="1.0"?>
2
+ <measure>
3
+ <schema_version>3.0</schema_version>
4
+ <name>add_ems_emissions_reporting</name>
5
+ <uid>e8fe9153-5e70-4769-afa0-6da0045aa529</uid>
6
+ <version_id>0395788b-e770-4887-bec9-149c0b88bcf9</version_id>
7
+ <version_modified>20211013T192425Z</version_modified>
8
+ <xml_checksum>976EB6EB</xml_checksum>
9
+ <class_name>AddEMSEmissionsReporting</class_name>
10
+ <display_name>Add EMS to Report Emissions</display_name>
11
+ <description>This measure reports emissions based on user-provided future and historical years as well as future, historical hourly, and historical annual subregions.</description>
12
+ <modeler_description>This measure uses the EnergyPlus Energy Management System to log and report emissions based on user-provided future and historical years as well as future, historical hourly, and historical annual subregions.</modeler_description>
13
+ <arguments>
14
+ <argument>
15
+ <name>future_subregion</name>
16
+ <display_name>Future subregion</display_name>
17
+ <description>Future subregion. Options are: AZNMc, CAMXc, ERCTc, FRCCc, MROEc, MROWc, NEWEc, NWPPc, NYSTc, RFCEc, RFCMc, RFCWc, RMPAc, SPNOc, SPSOc, SRMVc, SRMWc, SRSOc, SRTVc, and SRVCc</description>
18
+ <type>String</type>
19
+ <required>true</required>
20
+ <model_dependent>false</model_dependent>
21
+ <default_value>RMPAc</default_value>
22
+ </argument>
23
+ <argument>
24
+ <name>hourly_historical_subregion</name>
25
+ <display_name>Historical hourly subregion</display_name>
26
+ <description>Historical hourly subregion. Options are: California, Carolinas, Central, Florida, Mid-Atlantic, Midwest, New England, New York, Northwest, Rocky Mountains, Southeast, Southwest, Tennessee, and Texas</description>
27
+ <type>String</type>
28
+ <required>true</required>
29
+ <model_dependent>false</model_dependent>
30
+ <default_value>Rocky Mountains</default_value>
31
+ </argument>
32
+ <argument>
33
+ <name>annual_historical_subregion</name>
34
+ <display_name>Historical annual subregion</display_name>
35
+ <description>Historical annual subregion. Options are: AKGD, AKMS, AZNM, CAMX, ERCT, FRCC, HIMS, HIOA, MROE, MROW, NEWE, NWPP, NYCW, NYLI, NYUP, RFCE, RFCM, RFCW, RMPA, SPNO, SPSO, SRMV, SRMW, SRSO, SRTV, and SRVC</description>
36
+ <type>String</type>
37
+ <required>true</required>
38
+ <model_dependent>false</model_dependent>
39
+ <default_value>RMPA</default_value>
40
+ </argument>
41
+ <argument>
42
+ <name>future_year</name>
43
+ <display_name>Future Year</display_name>
44
+ <description>Future Year. Options are: 2020 to 2050 in two year increments</description>
45
+ <type>Integer</type>
46
+ <required>true</required>
47
+ <model_dependent>false</model_dependent>
48
+ <default_value>2020</default_value>
49
+ </argument>
50
+ <argument>
51
+ <name>hourly_historical_year</name>
52
+ <display_name>Hourly Historical Year</display_name>
53
+ <description>Hourly Historical Year. Options are: 2019.</description>
54
+ <type>Integer</type>
55
+ <required>true</required>
56
+ <model_dependent>false</model_dependent>
57
+ <default_value>2019</default_value>
58
+ </argument>
59
+ <argument>
60
+ <name>annual_historical_year</name>
61
+ <display_name>Annual Historical Year</display_name>
62
+ <description>Annual Historical Year. Options are: 2007, 2009, 2010, 2012, 2014, 2016, 2018, and 2019.</description>
63
+ <type>Integer</type>
64
+ <required>true</required>
65
+ <model_dependent>false</model_dependent>
66
+ <default_value>2019</default_value>
67
+ </argument>
68
+ </arguments>
69
+ <outputs />
70
+ <provenances />
71
+ <tags>
72
+ <tag>Equipment.Equipment Controls</tag>
73
+ </tags>
74
+ <attributes>
75
+ <attribute>
76
+ <name>Measure Type</name>
77
+ <value>ModelMeasure</value>
78
+ <datatype>string</datatype>
79
+ </attribute>
80
+ <attribute>
81
+ <name>Intended Software Tool</name>
82
+ <value>Apply Measure Now</value>
83
+ <datatype>string</datatype>
84
+ </attribute>
85
+ <attribute>
86
+ <name>Intended Software Tool</name>
87
+ <value>OpenStudio Application</value>
88
+ <datatype>string</datatype>
89
+ </attribute>
90
+ <attribute>
91
+ <name>Intended Software Tool</name>
92
+ <value>Parametric Analysis Tool</value>
93
+ <datatype>string</datatype>
94
+ </attribute>
95
+ </attributes>
96
+ <files>
97
+ <file>
98
+ <filename>LICENSE.md</filename>
99
+ <filetype>md</filetype>
100
+ <usage_type>license</usage_type>
101
+ <checksum>A21A3ED2</checksum>
102
+ </file>
103
+ <file>
104
+ <filename>example_model.osm</filename>
105
+ <filetype>osm</filetype>
106
+ <usage_type>test</usage_type>
107
+ <checksum>8EA06A27</checksum>
108
+ </file>
109
+ <file>
110
+ <filename>README.md</filename>
111
+ <filetype>md</filetype>
112
+ <usage_type>readme</usage_type>
113
+ <checksum>D90928F0</checksum>
114
+ </file>
115
+ <file>
116
+ <filename>future_annual_co2e.csv</filename>
117
+ <filetype>csv</filetype>
118
+ <usage_type>resource</usage_type>
119
+ <checksum>68D6F2FF</checksum>
120
+ </file>
121
+ <file>
122
+ <filename>future_hourly_co2e_2020.csv</filename>
123
+ <filetype>csv</filetype>
124
+ <usage_type>resource</usage_type>
125
+ <checksum>7F6FBFEF</checksum>
126
+ </file>
127
+ <file>
128
+ <filename>future_hourly_co2e_2022.csv</filename>
129
+ <filetype>csv</filetype>
130
+ <usage_type>resource</usage_type>
131
+ <checksum>B3366E3F</checksum>
132
+ </file>
133
+ <file>
134
+ <filename>future_hourly_co2e_2024.csv</filename>
135
+ <filetype>csv</filetype>
136
+ <usage_type>resource</usage_type>
137
+ <checksum>B2CCE349</checksum>
138
+ </file>
139
+ <file>
140
+ <filename>future_hourly_co2e_2026.csv</filename>
141
+ <filetype>csv</filetype>
142
+ <usage_type>resource</usage_type>
143
+ <checksum>A4F2D252</checksum>
144
+ </file>
145
+ <file>
146
+ <filename>future_hourly_co2e_2028.csv</filename>
147
+ <filetype>csv</filetype>
148
+ <usage_type>resource</usage_type>
149
+ <checksum>300261DB</checksum>
150
+ </file>
151
+ <file>
152
+ <filename>future_hourly_co2e_2030.csv</filename>
153
+ <filetype>csv</filetype>
154
+ <usage_type>resource</usage_type>
155
+ <checksum>3915B70B</checksum>
156
+ </file>
157
+ <file>
158
+ <filename>future_hourly_co2e_2032.csv</filename>
159
+ <filetype>csv</filetype>
160
+ <usage_type>resource</usage_type>
161
+ <checksum>DB3FE58C</checksum>
162
+ </file>
163
+ <file>
164
+ <filename>future_hourly_co2e_2034.csv</filename>
165
+ <filetype>csv</filetype>
166
+ <usage_type>resource</usage_type>
167
+ <checksum>6D1F32C2</checksum>
168
+ </file>
169
+ <file>
170
+ <filename>future_hourly_co2e_2036.csv</filename>
171
+ <filetype>csv</filetype>
172
+ <usage_type>resource</usage_type>
173
+ <checksum>0F38FDD7</checksum>
174
+ </file>
175
+ <file>
176
+ <filename>future_hourly_co2e_2038.csv</filename>
177
+ <filetype>csv</filetype>
178
+ <usage_type>resource</usage_type>
179
+ <checksum>87850670</checksum>
180
+ </file>
181
+ <file>
182
+ <filename>future_hourly_co2e_2040.csv</filename>
183
+ <filetype>csv</filetype>
184
+ <usage_type>resource</usage_type>
185
+ <checksum>546B4C66</checksum>
186
+ </file>
187
+ <file>
188
+ <filename>future_hourly_co2e_2042.csv</filename>
189
+ <filetype>csv</filetype>
190
+ <usage_type>resource</usage_type>
191
+ <checksum>ACB58818</checksum>
192
+ </file>
193
+ <file>
194
+ <filename>future_hourly_co2e_2044.csv</filename>
195
+ <filetype>csv</filetype>
196
+ <usage_type>resource</usage_type>
197
+ <checksum>6304E0BA</checksum>
198
+ </file>
199
+ <file>
200
+ <filename>future_hourly_co2e_2046.csv</filename>
201
+ <filetype>csv</filetype>
202
+ <usage_type>resource</usage_type>
203
+ <checksum>31F8B3E2</checksum>
204
+ </file>
205
+ <file>
206
+ <filename>future_hourly_co2e_2048.csv</filename>
207
+ <filetype>csv</filetype>
208
+ <usage_type>resource</usage_type>
209
+ <checksum>6AAE5452</checksum>
210
+ </file>
211
+ <file>
212
+ <filename>future_hourly_co2e_2050.csv</filename>
213
+ <filetype>csv</filetype>
214
+ <usage_type>resource</usage_type>
215
+ <checksum>EA30D696</checksum>
216
+ </file>
217
+ <file>
218
+ <filename>historical_annual_co2e.csv</filename>
219
+ <filetype>csv</filetype>
220
+ <usage_type>resource</usage_type>
221
+ <checksum>5001E3BC</checksum>
222
+ </file>
223
+ <file>
224
+ <filename>historical_hourly_co2e_2019.csv</filename>
225
+ <filetype>csv</filetype>
226
+ <usage_type>resource</usage_type>
227
+ <checksum>6C952ECC</checksum>
228
+ </file>
229
+ <file>
230
+ <filename>add_ems_emissions_reporting_test.rb</filename>
231
+ <filetype>rb</filetype>
232
+ <usage_type>test</usage_type>
233
+ <checksum>2124C39D</checksum>
234
+ </file>
235
+ <file>
236
+ <version>
237
+ <software_program>OpenStudio</software_program>
238
+ <identifier>2.5.1</identifier>
239
+ <min_compatible>2.5.1</min_compatible>
240
+ </version>
241
+ <filename>measure.rb</filename>
242
+ <filetype>rb</filetype>
243
+ <usage_type>script</usage_type>
244
+ <checksum>097E1A3B</checksum>
245
+ </file>
246
+ </files>
247
+ </measure>