Skip to content

Commit

Permalink
Merge pull request #153 from urbanopt/emissions_fix
Browse files Browse the repository at this point in the history
Other Fuel emission factors update
  • Loading branch information
kflemin authored Jun 24, 2024
2 parents 104d15c + 10944cb commit 295ccd1
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 49 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# URBANopt Reporting Gem

## Version 0.10.1
* Other Fuel emission factors update by @rawadelkontar in https://github.com/urbanopt/urbanopt-reporting-gem/pull/153


**Full Changelog**: https://github.com/urbanopt/urbanopt-reporting-gem/compare/v0.10.0...v0.10.1

## Version 0.10.0
## What's Changed
* Additional reporting tests by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/147
* Update formatting and version in export_modelica_loads by @nllong in https://github.com/urbanopt/urbanopt-reporting-gem/pull/149
* Update feature reports for Reopt v3 by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/148
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
gem 'addressable', '2.8.1'
# pin this dependency to avoid using racc dependency (which has native extensions)
gem 'parser', '3.2.2.2'
# pin this dependency because 2.9.2 breaks OS tests (openstudio:test_with_openstudio)
gem 'regexp_parser', '2.9.0'

# if allow_local && File.exist?('../openstudio-extension-gem')
# gem 'openstudio-extension', path: '../openstudio-extension-gem'
Expand Down
37 changes: 18 additions & 19 deletions lib/measures/default_feature_reports/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ def run(runner, user_arguments)
enduses.each do |eu|
sql_r = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='#{eu}' AND ColumnName='#{ft}'")

# report each query in its corresponding feature report obeject
# report each query in its corresponding feature report object
x = ft.tr(' ', '_').downcase
if x.include? 'water'
x_u = "#{x}_qbft"
Expand Down Expand Up @@ -931,14 +931,14 @@ def run(runner, user_arguments)
conv_kg_mt = 0.001 # kg to metric ton
conv_kbtu_J = 1054852.32 # KBtu to J (1kBtu = 1054852.32 J)

##### Emisison factors for natural gas, propane, and fuel oil based on EPA eGRID data and calculated using 20-year GWP horizon based on ASHRAE 189.1
## natural gas : 277.358126 KG/MWH
## propane : 323.896704 KG/MWH
## Fuel oil : 294.962046 KG/MWH
nat_gas_val = 277.358126
lpg_val = 323.896704
fo1_val = 294.962046
fo2_val = 294.962046
##### Emisison factors for natural gas, propane, and fuel oil based on https://portfoliomanager.energystar.gov/pdf/reference/Emissions.pdf
## natural gas : 181.7 KG/MWH
## propane : 219.2 KG/MWH
## Fuel oil #1: 250.8 KG/MWH
nat_gas_val = 181.7
lpg_val = 219.2
fo1_val = 250.8
fo2_val = 253.2

##########################################################################################################################
######################################## Reporting TImeseries Results FOR CSV File #######################################
Expand Down Expand Up @@ -1046,7 +1046,7 @@ def run(runner, user_arguments)
total_hours = 1 / timesteps_per_hour.to_f # make sure timesteps_per_hour is a float in the division
# set power_conversion
power_conversion = total_hours # we set the power conversio to total_hours since we want to convert lWh to kW
puts "Power Converion: to convert kWh to kW values will be divided by #{power_conversion}"
puts "Power Conversion: to convert kWh to kW values will be divided by #{power_conversion}"

# number of values in each timeseries
n = nil
Expand Down Expand Up @@ -1184,14 +1184,13 @@ def run(runner, user_arguments)
# conv_kg_mt = 0.001 # kg to metric ton
# conv_kbtu_J = 1054852.32 # KBtu to J (1kBtu = 1054852.32 J)

# ##### Emisison factors for natural gas, propane, and fuel oil based on EPA eGRID data and calculated using 20-year GWP horizon based on ASHRAE 189.1
# ## natural gas : 277.358126 KG/MWH
# ## propane : 323.896704 KG/MWH
# ## Fuel oil : 294.962046 KG/MWH
# nat_gas_val = 277.358126
# lpg_val = 323.896704
# fo1_val = 294.962046
# fo2_val = 294.962046
# ##### Emisison factors for natural gas, propane, and fuel oil based on https://portfoliomanager.energystar.gov/pdf/reference/Emissions.pdf
# ## natural gas : 181.7 KG/MWH
# ## propane : 219.2 KG/MWH
# nat_gas_val = 181.7
# lpg_val = 219.2
# fo1_val = 250.8
# fo2_val = 253.2

if timeseries_name == 'Natural_Gas_Emissions'
newVals = Array.new(n, 0)
Expand Down Expand Up @@ -1441,7 +1440,7 @@ def run(runner, user_arguments)
else
raise 'ELECTRICITY and GAS results are not initiaized'
end
# get formated datetimes
# get formatted datetimes
timeseries_d.dateTimes.each do |datetime|
datetimes << format_datetime(datetime.to_s)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/measures/default_feature_reports/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>default_feature_reports</name>
<uid>9ee3135a-8070-4408-bfa1-b75fecf9dd4f</uid>
<version_id>0d079df4-5b14-465d-9b3c-d00e30b3def2</version_id>
<version_modified>2024-01-08T22:54:10Z</version_modified>
<version_id>1f0dd70a-ddad-4bb8-a54b-0aeb696e80d0</version_id>
<version_modified>2024-06-20T19:28:12Z</version_modified>
<xml_checksum>FB304155</xml_checksum>
<class_name>DefaultFeatureReports</class_name>
<display_name>DefaultFeatureReports</display_name>
Expand Down Expand Up @@ -128,7 +128,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>A0464D25</checksum>
<checksum>005CDD6D</checksum>
</file>
<file>
<filename>USA_CO_Golden-NREL.724666_TMY3.epw</filename>
Expand Down
2 changes: 1 addition & 1 deletion lib/measures/export_modelica_loads/measure.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<measure>
<schema_version>3.0</schema_version>
<schema_version>3.1</schema_version>
<name>export_modelica_loads</name>
<uid>7051db01-2e55-4223-b5b5-fee615b68dd0</uid>
<version_id>e682f518-4785-4917-802e-600023816cc3</version_id>
Expand Down
2 changes: 1 addition & 1 deletion lib/measures/export_time_series_modelica/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def energyPlusOutputRequests(runner, user_arguments)
# use the built-in error checking
return false unless runner.validateUserArguments(arguments(model), user_arguments)

# #Read in argumetns related to variables for output requests
# #Read in arguments related to variables for output requests
hhw_loop_name = runner.getStringArgumentValue('hhw_loop_name', user_arguments)
chw_loop_name = runner.getStringArgumentValue('chw_loop_name', user_arguments)

Expand Down
4 changes: 2 additions & 2 deletions lib/urbanopt/reporting/default_reports/construction_cost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ConstructionCost
attr_accessor :category, :item_name, :unit_cost, :cost_units, :item_quantity, :total_cost # :nodoc:

##
# ConstructionCost class intialize all construction_cost attributes:
# ConstructionCost class initialize all construction_cost attributes:
# +:category+ , +:item_name+ , +:unit_cost+ , +:cost_units+ , +:item_quantity+ , +:total_cost+
##
# [parameters:]
Expand Down Expand Up @@ -108,7 +108,7 @@ def self.merge_construction_cost(existing_cost, new_cost)
end

##
# Merges muliple construction costs together.
# Merges multiple construction costs together.
# - loops over the new_costs and find the index of the cost with identical +:item_name+.
# - if +item_name+ is identical then modify the existing_cost array by summing the :total_cost and :item_quantity. Else add the new_cost to existing_costs array.
##
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Date
attr_accessor :month, :day_of_month, :year #:nodoc:

##
# Date class intialize all date attributes:
# Date class initialize all date attributes:
# +:month+ , +:day_of_month+ , +:year+
##
# [parameters:]
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/end_use.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EndUse
:fans, :pumps, :heat_rejection, :humidification, :heat_recovery, :water_systems, :refrigeration, :generators # :nodoc:

##
# EndUse class intialize all enduse atributes: +:heating+ , +:cooling+ , +:interior_lighting+ ,
# EndUse class initialize all enduse attributes: +:heating+ , +:cooling+ , +:interior_lighting+ ,
# +:exterior_lighting+ , +:interior_equipment+ , +:exterior_equipment+ ,
# +:fans+ , +:pumps+ , +:heat_rejection+ , +:humidification+ , +:heat_recovery+ , +:water_systems+ , +:refrigeration+ , +:generators+
##
Expand Down
4 changes: 2 additions & 2 deletions lib/urbanopt/reporting/default_reports/end_uses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ module URBANopt
module Reporting
module DefaultReports
##
# Enduses class inlclude results for each fuel type.
# Enduses class include results for each fuel type.
##
class EndUses
attr_accessor :electricity_kwh, :natural_gas_kwh, :propane_kwh, :fuel_oil_kwh, :other_fuels_kwh, :district_cooling_kwh, :district_heating_kwh, :water_qbft # :nodoc:

##
# EndUses class intialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ ,
# EndUses class initialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ ,
# +:district_cooling_kwh+ , +:district_heating_kwh+ , +:water_qbft+
##
# [parameters:]
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/feature_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def save_json_report(file_name = 'default_feature_report')
##
# Saves the 'default_feature_report.csv' file to the results directory
# This method only copies the CSV feature reports from the folder generated by the reporting measure
# (<meausure number>_default_feature_reports/) to the new feature_reports/ folder
# (<measure number>_default_feature_reports/) to the new feature_reports/ folder
##
# [parameters]:
# +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
Expand Down
4 changes: 2 additions & 2 deletions lib/urbanopt/reporting/default_reports/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Generator
attr_accessor :size_kw

##
# Intialize Generator attributes from a hash. Generator attributes currently are limited to power capacity.
# Initialize Generator attributes from a hash. Generator attributes currently are limited to power capacity.
##
# [parameters:]
#
# * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
# * +hash+ - _Hash_ - A hash containing a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
#
def initialize(hash = {})
hash.delete_if { |k, v| v.nil? }
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module DefaultReports

@@logger.level = Logger::WARN
##
# Definining class variable "@@logger" to log errors, info and warning messages.
# Defining class variable "@@logger" to log errors, info and warning messages.
def self.logger
@@logger
end
Expand Down
4 changes: 2 additions & 2 deletions lib/urbanopt/reporting/default_reports/power_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module URBANopt
module Reporting
module DefaultReports
##
# power_distributio include eletrical power distribution systems information.
# power_distribution include eletrical power distribution systems information.
##
class PowerDistribution
attr_accessor :under_voltage_hours, :over_voltage_hours, :nominal_capacity,
Expand Down Expand Up @@ -89,7 +89,7 @@ def to_hash
end

##
# Merges muliple power distribution results together.
# Merges multiple power distribution results together.
##
# +new_costs+ - _Array_ - An array of ConstructionCost objects.
def merge_power_distribution
Expand Down
6 changes: 3 additions & 3 deletions lib/urbanopt/reporting/default_reports/scenario_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ScenarioReport
:timeseries_csv, :location, :program, :construction_costs, :reporting_periods, :feature_reports, :distributed_generation,
:scenario_power_distribution, :scenario_power_distribution_cost, :qaqc_flags # :nodoc:

# ScenarioReport class intializes the scenario report attributes:
# ScenarioReport class initializes the scenario report attributes:
# +:id+ , +:name+ , +:directory_name+, +:timesteps_per_hour+ , +:number_of_not_started_simulations+ ,
# +:number_of_started_simulations+ , +:number_of_complete_simulations+ , +:number_of_failed_simulations+ ,
# +:timeseries_csv+ , +:location+ , +:program+ , +:construction_costs+ , +:reporting_periods+ , +:feature_reports+,
Expand Down Expand Up @@ -74,7 +74,7 @@ def initialize(hash = {})
@reporting_periods << ReportingPeriod.new(rp)
end

# feature_report is intialized here to be used in the add_feature_report method
# feature_report is initialized here to be used in the add_feature_report method
@feature_reports = []
hash[:feature_reports].each do |fr|
@feature_reports << FeatureReport.new(fr)
Expand Down Expand Up @@ -246,7 +246,7 @@ def to_hash
# - add the array of feature_reports
# - scenario report location takes the location of the first feature in the list
##
# [parmeters:]
# [parameters:]
# +feature_report+ - _FeatureReport_ - An object of FeatureReport class.
##
def add_feature_report(feature_report)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@
]
},
"simultaneous_heating_and_cooling": {
"description": "Whether heating and cooling are occuring during the same hour when cooling load exists",
"description": "Whether heating and cooling are occurring during the same hour when cooling load exists",
"type": [
"integer",
"null"
Expand Down Expand Up @@ -784,7 +784,7 @@
"type": "string"
},
"name": {
"description": "name refers to the name of the feature (eg. Building 1, tranformer 5)",
"description": "name refers to the name of the feature (eg. Building 1, transformer 5)",
"type": "string"
},
"directory_name": {
Expand Down Expand Up @@ -870,7 +870,7 @@
"type": "string"
},
"multiplier": {
"description": "Multiplier used if this reporting period is representative of mulitple periods. For example one week simulation that represents entire month.",
"description": "Multiplier used if this reporting period is representative of multiple periods. For example one week simulation that represents entire month.",
"type": "number",
"default": 1
},
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/solar_pv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SolarPV
##
# [parameters:]
#
# * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
# * +hash+ - _Hash_ - A hash containing a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
#
def initialize(hash = {})
hash.delete_if { |k, v| v.nil? }
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Storage
##
# [parameters:]
#
# * +hash+ - _Hash_ - A hash containting +:size_kw+ and +:size_kwh+ key/value pair which represents the power and storage capacity in kilowatts (kW) and kilowatt-hours respectively.
# * +hash+ - _Hash_ - A hash containing +:size_kw+ and +:size_kwh+ key/value pair which represents the power and storage capacity in kilowatts (kW) and kilowatt-hours respectively.
#
def initialize(hash = {})
hash.delete_if { |k, v| v.nil? }
Expand Down
4 changes: 2 additions & 2 deletions lib/urbanopt/reporting/default_reports/timeseries_csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module URBANopt
module Reporting
module DefaultReports
##
# TimeseriesCSV include timesries reults reported in a CSV file.
# TimeseriesCSV include timesries results reported in a CSV file.
##
class TimeseriesCSV
attr_accessor :path, :first_report_datetime, :column_names #:nodoc:
Expand All @@ -33,7 +33,7 @@ def initialize(hash = {})
@path = hash[:path]
@first_report_datetime = hash[:first_report_datetime]

# from scenario csv shema get required reults to be aggregated
# from scenario csv shema get required results to be aggregated
@required_column_names = load_scenario_csv_schema_headers

@column_names = hash[:column_names]
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/default_reports/wind.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Wind
##
# [parameters:]
#
# * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
# * +hash+ - _Hash_ - A hash containing a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
#
def initialize(hash = {})
hash.delete_if { |k, v| v.nil? }
Expand Down
2 changes: 1 addition & 1 deletion lib/urbanopt/reporting/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

module URBANopt
module Reporting
VERSION = '0.10.0'.freeze
VERSION = '0.10.1'.freeze
end
end

0 comments on commit 295ccd1

Please sign in to comment.