Skip to content

Commit 2440940

Browse files
committed
Bugfixes: 1. Don't overwrite max usage units in the tariffs we produce. 2. Only throw an error if the max usage unit is not kWh AND a max usage value is provided. The units apply to the max value usage only, the rate value is always $/kWh; see the OpenEI URDB website for confirmation.
1 parent 5c3fc81 commit 2440940

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

ReportUtilityBills/measure.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -598,20 +598,16 @@ def get_utility_rates(hpxml_path, fuels, utility_rates, bill_scenario, pv_monthl
598598
rate.energy_weekday_schedule = tariff[:energyweekdayschedule]
599599
rate.energy_weekend_schedule = tariff[:energyweekendschedule]
600600

601-
if rate.energy_rate_structure.collect { |r| r.collect { |s| s.keys.include?(:rate) } }.flatten.any? { |t| !t }
601+
if rate.energy_rate_structure.collect { |r| r.collect { |s| !s.keys.include?(:rate) } }.flatten.any?
602602
warnings << "#{tariff_name}: Every tier must contain a rate; utility bills will not be calculated."
603603
end
604604

605605
if rate.energy_rate_structure.collect { |r| r.collect { |s| s.keys } }.flatten.uniq.include?(:sell)
606-
warnings << "#{tariff_name}: No tier may contain a sell key; utility bills will not be calculated."
606+
warnings << "#{tariff_name}: Tariffs with sell rates are not currently supported; utility bills will not be calculated."
607607
end
608608

609-
if rate.energy_rate_structure.collect { |r| r.collect { |s| s.keys.include?(:unit) } }.flatten.any? { |t| !t }
610-
warnings << "#{tariff_name}: Every tier must contain a unit; utility bills will not be calculated."
611-
end
612-
613-
if rate.energy_rate_structure.collect { |r| r.collect { |s| s[:unit] == 'kWh' } }.flatten.any? { |t| !t }
614-
warnings << "#{tariff_name}: All rates must be in units of kWh; utility bills will not be calculated."
609+
if rate.energy_rate_structure.collect { |r| r.collect { |s| s[:unit] != 'kWh' && s.keys.include?(:max) } }.flatten.any?
610+
warnings << "#{tariff_name}: Only max usage units of kWh are currently supported; utility bills will not be calculated."
615611
end
616612
end
617613
end

ReportUtilityBills/measure.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>report_utility_bills</name>
55
<uid>ca88a425-e59a-4bc4-af51-c7e7d1e960fe</uid>
6-
<version_id>3d2f01b2-edf3-4915-ae9c-67503d6833e7</version_id>
7-
<version_modified>2024-10-16T21:07:31Z</version_modified>
6+
<version_id>ec7741e4-75b1-4c66-b40a-21ef0e5aa8f1</version_id>
7+
<version_modified>2024-10-16T22:56:39Z</version_modified>
88
<xml_checksum>15BF4E57</xml_checksum>
99
<class_name>ReportUtilityBills</class_name>
1010
<display_name>Utility Bills Report</display_name>
@@ -180,7 +180,7 @@
180180
<filename>measure.rb</filename>
181181
<filetype>rb</filetype>
182182
<usage_type>script</usage_type>
183-
<checksum>FB222527</checksum>
183+
<checksum>4D23174A</checksum>
184184
</file>
185185
<file>
186186
<filename>detailed_rates/README.md</filename>
@@ -294,7 +294,7 @@
294294
<filename>detailed_rates/openei_rates.zip</filename>
295295
<filetype>zip</filetype>
296296
<usage_type>resource</usage_type>
297-
<checksum>111E79AB</checksum>
297+
<checksum>FCDE5F5D</checksum>
298298
</file>
299299
<file>
300300
<filename>simple_rates/HouseholdConsumption.csv</filename>
@@ -318,7 +318,7 @@
318318
<filename>util.rb</filename>
319319
<filetype>rb</filetype>
320320
<usage_type>resource</usage_type>
321-
<checksum>D61BE969</checksum>
321+
<checksum>22F928DB</checksum>
322322
</file>
323323
<file>
324324
<filename>Contains Demand Charges.json</filename>
Binary file not shown.

ReportUtilityBills/resources/util.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,16 +614,16 @@ def process_usurdb(filepath)
614614
next if rate['energyweekdayschedule'].nil? || rate['energyweekendschedule'].nil? || rate['energyratestructure'].nil?
615615

616616
# ignore rates without a "rate" key
617-
next if rate['energyratestructure'].collect { |r| r.collect { |s| s.keys.include?('rate') } }.flatten.any? { |t| !t }
617+
next if rate['energyratestructure'].collect { |r| r.collect { |s| !s.keys.include?('rate') } }.flatten.any?
618618

619619
# ignore rates with negative "rate" value
620-
next if rate['energyratestructure'].collect { |r| r.collect { |s| s['rate'] >= 0 } }.flatten.any? { |t| !t }
620+
next if rate['energyratestructure'].collect { |r| r.collect { |s| s['rate'] < 0 } }.flatten.any?
621621

622622
# ignore rates with a "sell" key
623623
next if rate['energyratestructure'].collect { |r| r.collect { |s| s.keys } }.flatten.uniq.include?('sell')
624624

625-
# set rate units to 'kWh'
626-
rate['energyratestructure'].collect { |r| r.collect { |s| s['unit'] = 'kWh' } }
625+
# ignore rates where max usage is provided but max units are not 'kWh'
626+
next if rate['energyratestructure'].collect { |r| r.collect { |s| s['unit'] != 'kWh' && s.keys.include?('max') } }.flatten.any?
627627

628628
residential_rates << { 'items' => [rate] }
629629
end

0 commit comments

Comments
 (0)