Skip to content

Feature/markets - #924

Open
manarjar wants to merge 10 commits into
GenXProject:developfrom
manarjar:feature/markets
Open

manarjar wants to merge 10 commits into
GenXProject:developfrom
manarjar:feature/markets

Conversation

@manarjar

Copy link
Copy Markdown

Description

This PR adds a markets module that lets zones buy and sell electricity from an external market at hourly prices.

Main changes:

  • Markets module (src/model/policies/markets.jl): hourly buy/sell variables per market zone, with import/export limits from Zones_markets.csv and prices from Market_price.csv. Market purchases and sales enter the power balance and the objective.
  • Generation-based sell limit: new eTotalGenerationByZone expression aggregating net generation from thermal (incl. fusion parasitic load), VRE, must-run, hydro, storage (net of charging), VRE-STOR, and Allam cycle resources. Hourly sales in each zone are capped by this expression. Flexible demand and electrolyzers are excluded since they don't generate.
  • Market emissions: import emissions from Market_emissions.csv are added to a new eTotalEmissionsByZone expression, which is used in all CO2 cap formulations and in emissions.csv. Exports are not credited, since their emissions are already counted at the generating resources.
  • Inputs, settings, outputs: load_markets_data.jl, a new Markets setting (off by default), and write_markets.jl.
  • Refactor: write_power_balance.jl now uses named columns instead of integer indices, so new components can be added to the power balance without tracking positions.
  • Example: example_systems/12_single_zone_w_markets.

What type of PR is this? (check all applicable)

  • Feature
  • Bug Fix
  • Documentation Update
  • Code Refactor
  • Performance Improvements

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and .md files under /docs/src have been updated if necessary.
  • The latest changes on the target branch have been incorporated, so that any conflicts are taken care of before merging. This can be accomplished either by merging in the target branch (e.g. 'git merge develop') or by rebasing on top of the target branch (e.g. 'git rebase develop'). Please do not hesitate to reach out to the GenX development team if you need help with this.
  • Code has been tested to ensure all functionality works as intended.
  • CHANGELOG.md has been updated (if this is a 'notable' change).
  • I consent to the release of this PR's code under the GNU General Public license.

How this can be tested

Run the included example system example_systems/12_single_zone_w_markets:

julia> cd("example_systems/12_single_zone_w_markets/")
julia> include("Run.jl")

With Markets: 1 in settings/genx_settings.yml, the model should:

  • Write market results to results/ (markets.csv), with hourly buy and sell decisions responding to Market_price.csv
  • Keep hourly sales at or below total zonal generation (eTotalGenerationByZone)
  • Include import emissions from Market_emissions.csv in the zonal emissions, the CO2 cap, and emissions.csv
  • Show the market buy and sell terms in power_balance.csv

To check that existing behavior is unchanged, run any existing example with markets disabled (Markets: 0, the default). Results should match develop.

Post-approval checklist for GenX core developers

After the PR is approved

  • Check that the latest changes on the target branch are incorporated, either via merge or rebase
  • Remember to squash and merge if incorporating into develop

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant