add_sectors uses two different state columns, STATE and reeds_state

Aperta
#904 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
40/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start in workflow/scripts/add_sectors.py at assign_bus_2_state (around L42-L67) and check how it sets STATE against the reeds_state column used by add_sector_foundation (L115). Then look at convert_generators_2_links (L473-L504) and the policy code in workflow/scripts/opts/policy.py. Done means one state column drives every consumer, with buses lacking reeds_state falling back to coordinates, and the sector test runs still agreeing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement Sector
Feature Request

add_sectors works out the state of a bus in two different ways:

  • reeds_state, the state of the bus' ReEDS zone, set when the network is built. add_sector_foundation creates the state fuel buses ({ST} gas, {ST} coal, ...) from it (L115), GasData.get_states_in_model uses it (L191-L197), and so do the state policy constraints (opts/policy.py).
  • STATE, set in assign_bus_2_state from the state nearest to the bus coordinates (L42-L67). convert_generators_2_links attaches the plants to the state fuel buses by it (L473-L504), and so do build_heat and the hydrogen links in #879.

The two agree in every network I checked: all my sector test runs, plus two western substation-level networks with about 2,000 and 2,700 AC buses. But if a bus ever gets a STATE different from its reeds_state (say, a cluster whose center falls in the neighboring state), its plants would draw fuel from another state's bus, or from one that doesn't exist, and the bus would count toward one state's policies but another state's fuel.

Suggested Solution

Use one column. The simplest fix is for assign_bus_2_state to take STATE from reeds_state where a bus has one, and fall back to the coordinates only for buses without it. Then a bus belongs to the same state everywhere in the model, policies included.

Additional Info

Came up in the review of #879: https://github.com/PyPSA/pypsa-usa/pull/879#discussion_r4512525990

Lingua principale
Python
Stelle
154
Fork
58
Merge medio
3g 9h
PR unite (30g)
51

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PyPSA/pypsa-usa

Tutte le issue di PyPSA/pypsa-usa

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.