Skip to content

Fix PV grid connection fee edge case#2206

Merged
shorowit merged 2 commits intomasterfrom
pv_grid_connection_fee_bugfix
Apr 30, 2026
Merged

Fix PV grid connection fee edge case#2206
shorowit merged 2 commits intomasterfrom
pv_grid_connection_fee_bugfix

Conversation

@shorowit
Copy link
Copy Markdown
Contributor

@shorowit shorowit commented Apr 30, 2026

Pull Request Description

Closes #2205.

Checklist

Not all may apply:

  • Schematron validator (EPvalidator.sch) has been updated
  • Sample files have been added/updated (openstudio tasks.rb update_hpxmls)
  • Tests have been added/updated (e.g., HPXMLtoOpenStudio/tests/test*.rb and/or workflow/tests/test*.rb)
  • Documentation has been updated
  • Changelog has been updated
  • openstudio tasks.rb update_measures has been run
  • No unexpected changes to simulation results of sample files

Comment on lines +906 to +913
def test_pv_none_with_pv_grid_fee_dollars
# Check PV grid fee not applied if no PV
@hpxml.header.utility_bill_scenarios[-1].pv_monthly_grid_connection_fee_dollars = 7.50
@hpxml_bldg.pv_systems.clear
actual_bills, actual_monthly_bills = _bill_calcs(@fuels_pv_none_simple, @hpxml)
_check_bills(@expected_bills, actual_bills)
_check_monthly_bills(actual_bills, actual_monthly_bills)
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails before the bugfix.

Comment on lines -327 to +330
pv_monthly_fee = bill_scenario.pv_monthly_grid_connection_fee_dollars
has_pv = hpxml_buildings.map { |hpxml_bldg| hpxml_bldg.pv_systems.map { |pv_system| pv_system.max_power_output }.sum }.sum > 0
if has_pv
pv_monthly_fee = bill_scenario.pv_monthly_grid_connection_fee_dollars
end
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is the bugfix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow that was fast! Thanks @shorowit!

@expected_bills['Test: Electricity: PV Credit (USD)'] = -177
expected_bills = _get_expected_bills(@expected_bills)
_check_bills(expected_bills, actual_bills)
_check_bills(@expected_bills, actual_bills)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated cleanup throughout to reduce LOC and simplify _bill_calcs method signature.

@shorowit shorowit merged commit 8d0dd05 into master Apr 30, 2026
7 checks passed
@shorowit shorowit deleted the pv_grid_connection_fee_bugfix branch April 30, 2026 23:01
@github-project-automation github-project-automation Bot moved this from Triage to Done in OpenStudio-HPXML Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

PV monthly grid connection fee can apply even if no PV

2 participants