Security-constrained optimisation: outages of generators, links and storage
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design
Direzione di ricerca
This is a design proposal, not a ready task: the formulation and the API (outages=, slack_weights=) still need maintainer agreement before code is written. Start by reading calculate_BODF and _add_security_constraints in the optimization module, then _iter_balance_coeffs and lpf_contingency for the bus-injection and power-flow sides. The sketched tests (lpf() reproducing the constrained flows, link, storage, no branch-outage regression) are the definition of done, but expect the discussion to settle the shape first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
n.optimize.optimize_security_constrained() keeps branch flows within limits after the outage of a line or transformer. The loss of a large generator or an HVDC link also shifts flows onto the remaining lines, but it is not covered.
The three lines have equal reactances, and G3 is the cheap generator. If it trips, G1 and G2 replace it in equal shares. With the cheapest dispatch, line 2-3 is then overloaded (left). The secure dispatch moves 60 MW from G3 to G1 before the outage (right). This is a security constraint for a generator outage.
Usage
outages = pd.MultiIndex.from_tuples(
[("Line", "1"), ("Generator", "1 Gas"), ("Link", "my HVDC")]
)
n.optimize.optimize_security_constrained(outages=outages, slack_weights="p_nom")
branch_outages keeps its meaning, and the default stays all lines and transformers. slack_weights sets who replaces the lost power. It has no default.
Formulation
Today. After the outage of branch $c$, the flow on branch $k$ is its old flow plus a share of the lost flow. The share is the branch outage distribution factor (BODF), a constant of the grid:
$$\left| f_{k,t} + \mathrm{BODF}{kc} , f{c,t} \right| \le F_k$$
New idea. The outage of a generator has the same form. Two things change: bus $b$ loses the output $p_{u,t}$ of the generator, and the remaining generators replace it in fixed shares. Let $\alpha_n$ be the share that arrives at bus $n$, with $\sum_n \alpha_n = 1$. The power transfer distribution factors (PTDF) turn both changes into a flow change on branch $k$:
$$\mathrm{UODF}{ku} = \sum_n \mathrm{PTDF}{kn} , \alpha_n - \mathrm{PTDF}_{kb}$$
$$\left| f_{k,t} + \mathrm{UODF}{ku} , p{u,t} \right| \le F_k$$
- The factor in (1) is a constant, like the BODF. I call it the unit outage distribution factor (UODF).
- (2) is the existing constraint with another factor and another variable. It adds no variables.
Other units work in the same way. A link takes $p$ from its first bus and gives $\eta , p$ to its second, so (1) has one PTDF term per bus, and only the difference $(\eta - 1) , p$ is replaced. Storage units, stores and processes follow from their injections.
Who replaces the lost power. In a real grid, the remaining generators raise their output automatically within seconds. The model takes the shares from slack_weights, as n.pf() does: a static weight per generator, for example p_nom. The failed generator gets no share. The result depends strongly on the shares, which is why there is no default.
How other models do it.
- Fixed shares are the classic choice: the response to a generator outage is a predefined adjustment of the other generators (Monticelli et al., 1987). The Californian market operator shares the loss by the capacity of the online units that respond to frequency (Singhal et al., 2019).
- Other models optimise the response with one variable per generator and outage, limited by its spare capacity (Monticelli et al., 1987). This is larger but checks that the spare capacity exists, which fixed shares do not (Singhal et al., 2019). It can follow later through the same code, together with reserves (#2096).
Implementation sketch
Outage factors (1), next to calculate_BODF:
def calculate_UODF(self, units: pd.MultiIndex, slack_weights: pd.Series) -> pd.DataFrame:
"""Flow change on each branch per MW of each lost unit."""
Constraint (2): _add_security_constraints takes the flow change instead of building it from the BODF. Its loop over the existing branch limits stays.
def _add_security_constraints(m, sub_network, added_flows, selection, suffix):
for c_outage_, added_flow in added_flows.items():
... # existing loop: con.lhs + added_flow against con.rhs
added_flows = {
"Line-outage": BODF * m["Line-s"], # today
"Generator-outage": UODF * m["Generator-p"], # new
}
Also:
optimize_security_constrained(outages=..., slack_weights=...); keepbranch_outages.- Injections per bus:
_iter_balance_coeffsforLinkandProcess;p_dispatchandp_storeforStorageUnit. n.lpf_contingency()accepts the same outages and weights.- Fail fast: no generator with a weight in the sub-network; weights that depend on dispatch.
Tests
- Power flow:
n.lpf()without the lost unit, with its output shared by the weights, reproduces the flows of (2). - Link: inside one synchronous area and between two.
- Other units: storage unit, store, process.
- No regression: unchanged results for branch outages only.
- Lingua principale
- Python
- Stelle
- 2.3k
- Fork
- 745
- Merge medio
- 1g 14h
- PR unite (30g)
- 76
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PyPSA/PyPSA
-
import_from_pandapower_net sets line s_nom to 1/√3 of the thermal ratingForse già presa @michaelserikov l’ha presa 10 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
PyPSA/PyPSA#2162 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
get_projection_from_crs crashes on unknown CRS instead of falling back to PlateCarreeForse già presa @OnodOfTheNorth l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PyPSA/PyPSA#2150 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
n.lpf_contingency() returns AttributeError: 'DataFrame' object has no attribute 'to_frame'Forse già presa @Blizzeq l’ha presa 26 giorni fa. Apertaneeds triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
PyPSA/PyPSA#2082 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
get_switchable_as_dense ignores order of inds and silently drops unknown namesForse già presa @musaaero l’ha presa 27 giorni fa. Apertabreaking components API data validation
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
PyPSA/PyPSA#1977 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Feature: ImportsApertacomposite
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
PyPSA/PyPSA#2212 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Rose22/openlumara#166 ·
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
enhancement feature/signals self-driving team/self-driving
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PostHog/posthog#144208 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
LMPrado-DZ23/open_notas_br#14 ·
I maintainer di solito rispondono entro 1 giorno