Generator maintenance#
This file states the maintenance rows of PyPSA's Generator. It is one of the 25 whole specs of one topic each (fragments) that merge composes into the spec of examples/pypsa.yaml. Generator_maint_window states that a unit is in maintenance exactly where an event it started covers the snapshot, through a sum by a relation.
given:
parameters:
Generator_p_nom_extendable: { dims: [generator], dtype: bool }
Generator_committable: { dims: [generator], dtype: bool }
Generator_p_nom_mod: { dims: [generator] }
Generator_modules_installed: { dims: [scenario, generator] }
Generator_active: { dims: [snapshot, generator], dtype: bool }
snapshot_weightings_generators: { dims: [snapshot] }
Generator_p_nom_min: { dims: [scenario, generator] }
Generator_p_nom_max: { dims: [scenario, generator] }
variables:
Generator_status: { dims: [scenario, snapshot, generator], domain: integer }
Generator_p_nom_ext: { dims: [generator] }
conditions:
Generator_committed: { dims: [generator, snapshot] }
dimensions:
scenario:
description: the futures dispatch is chosen in, each with a weight
snapshot:
description: dispatch periods
dtype: datetime
ordered: true
generator:
description: generating units, each on one bus
relations:
Generator_maintenance_cover:
description: >-
the snapshots a maintenance event covers, by the snapshot it starts in,
data prep. In a scenario, they are the start and the snapshots after it,
until their generator weightings reach that scenario's
`maintenance_duration`. A generator that is not maintainable has no rows
dims: { scenario: scenario, generator: generator, start: snapshot, covered: snapshot }
missing: absent
parameters:
Generator_maintainable:
description: >-
whether a generator must be taken off for maintenance within the
horizon: in any scenario, as PyPSA takes the union over them
(`components.py:1000-1003`)
dims: [generator]
dtype: bool
Generator_maintenance_pu:
description: the share of the build a maintenance event takes off
dims: [scenario, generator]
Generator_maintenance_events:
description: how many maintenance events occur within the horizon
dims: [scenario, generator]
dtype: int
Generator_maintenance_duration:
description: >-
the hours of generator weightings one maintenance event covers, PyPSA's
`maintenance_duration`. It has no value where the generator is not
maintainable. No row contains it. In data prep you turn it into
`Generator_maintenance_cover` and `Generator_maintenance_start_blocked`.
The assumptions state that it fits the horizon
dims: [scenario, generator]
missing: absent
Generator_maintenance_start_blocked:
description: >-
true where no maintenance event may start, data prep. The snapshots it
would cover there run past the end of the horizon or into one the
generator is not active in. It is PyPSA's `active & ~valid`, from
`maintenance_duration` and the generator weightings
dims: [scenario, snapshot, generator]
dtype: bool
variables:
Generator_maintenance:
description: >-
`Generator-maintenance` — whether a maintainable generator is in maintenance:
continuous, and one exactly where an event covers the snapshot
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_active
missing: 0
bounds:
lower: 0
upper: 1
Generator_maintenance_start:
description: "`Generator-maintenance_start` — whether a maintenance event starts in this snapshot"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_active
missing: 0
domain: binary
Generator_maintenance_capacity:
description: >-
`Generator-maintenance_capacity` — the chosen build while in
maintenance, zero otherwise: the product the `maintcap` rows linearise
dims: [scenario, snapshot, generator]
where: Generator_maint_ext
missing: 0
bounds:
lower: 0
Generator_maintenance_status:
description: >-
`Generator-maintenance_status` — the status while in maintenance, zero
otherwise: the product the `maint-status` rows linearise, so a unit in
maintenance may also be off
dims: [scenario, snapshot, generator]
where: >-
Generator_maintainable
AND Generator_committed
AND NOT (Generator_p_nom_extendable AND NOT (Generator_p_nom_mod > 0))
missing: 0
bounds:
lower: 0
expressions:
Generator_maintenance_modules:
description: >-
how many modules of a modular committable generator can be on in
maintenance: its build cap in modules where the build is extendable,
and the modules installed where it is fixed (`constraints.py:588-594`)
dims: [scenario, generator]
cases:
extendable: { when: Generator_p_nom_extendable, expression: Generator_p_nom_max / Generator_p_nom_mod }
otherwise: Generator_modules_installed
conditions:
Generator_maint_ext:
description: >-
a maintainable generator with an extendable build that is active in the
snapshot's period, unless it is committable and modular. These are the
maintenance rows against the chosen build
condition: >-
Generator_maintainable
AND Generator_p_nom_extendable
AND NOT (Generator_committable AND Generator_p_nom_mod > 0)
AND Generator_active
constraints:
Generator_maint_event_count:
description: "`Generator-maint-event-count` — a maintainable generator holds its number of maintenance events over the horizon"
dims: [scenario, generator]
where: Generator_maintainable
expression: sum(Generator_maintenance_start, over=snapshot) == Generator_maintenance_events
Generator_maint_window:
description: >-
`Generator-maint-window` — a generator is in maintenance exactly where
an event it started covers the snapshot. Two events do not overlap,
since the maintenance status is at most one
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_active
expression: Generator_maintenance == sum(Generator_maintenance_start, over=start, by=Generator_maintenance_cover[covered])
Generator_maint_start_horizon:
description: "`Generator-maint-start-horizon` — no event starts where it could not run its whole duration"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_active AND Generator_maintenance_start_blocked
expression: Generator_maintenance_start == 0
Generator_maintcap_upper:
description: >-
`Generator-maintcap_upper` — the build taken off is at most the chosen build in
maintenance, and at most the build less its floor out of it
dims: [scenario, snapshot, generator]
where: Generator_maint_ext
expression: Generator_maintenance_capacity <= Generator_p_nom_ext - Generator_p_nom_min * (1 - Generator_maintenance)
Generator_maintcap_upper_nommax:
description: "`Generator-maintcap_upper_nommax` — out of maintenance, no build is taken off"
dims: [scenario, snapshot, generator]
where: Generator_maint_ext
expression: Generator_maintenance_capacity <= Generator_p_nom_max * Generator_maintenance
Generator_maintcap_lower_nommax:
description: "`Generator-maintcap_lower_nommax` — in maintenance, the whole chosen build is taken off"
dims: [scenario, snapshot, generator]
where: Generator_maint_ext
expression: Generator_maintenance_capacity >= Generator_p_nom_ext - Generator_p_nom_max * (1 - Generator_maintenance)
Generator_maintcap_lower_nommin:
description: "`Generator-maintcap_lower_nommin` — in maintenance, at least the floor of the build is taken off"
dims: [scenario, snapshot, generator]
where: Generator_maint_ext AND Generator_p_nom_min > 0
expression: Generator_maintenance_capacity >= Generator_p_nom_min * Generator_maintenance
Generator_maint_status_le_status:
description: "`Generator-maint-status-le-status` — the status in maintenance is at most the status"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_committed AND NOT Generator_p_nom_extendable AND NOT (Generator_p_nom_mod > 0)
expression: Generator_maintenance_status <= Generator_status
Generator_maint_status_le_maint:
description: "`Generator-maint-status-le-maint` — out of maintenance, the status in maintenance is zero"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_committed AND NOT Generator_p_nom_extendable AND NOT (Generator_p_nom_mod > 0)
expression: Generator_maintenance_status <= Generator_maintenance
Generator_maint_status_lb:
description: "`Generator-maint-status-lb` — on and in maintenance, the status in maintenance is one"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_committed AND NOT Generator_p_nom_extendable AND NOT (Generator_p_nom_mod > 0)
expression: Generator_maintenance_status >= Generator_status + Generator_maintenance - 1
Generator_maint_modstatus_le_status:
description: "`Generator-maint-modstatus-le-status` — the modules on in maintenance are at most the modules on"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_committed AND Generator_p_nom_mod > 0
expression: Generator_maintenance_status <= Generator_status
Generator_maint_modstatus_le_maint:
description: >-
`Generator-maint-modstatus-le-maint` — out of maintenance, no module is
on in maintenance. In it, at most its modules in maintenance
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_committed AND Generator_p_nom_mod > 0
expression: Generator_maintenance_status <= Generator_maintenance_modules * Generator_maintenance
Generator_maint_modstatus_lb:
description: "`Generator-maint-modstatus-lb` — in maintenance, every module on is on in maintenance"
dims: [scenario, snapshot, generator]
where: Generator_maintainable AND Generator_committed AND Generator_p_nom_mod > 0
expression: Generator_maintenance_status >= Generator_status - Generator_maintenance_modules * (1 - Generator_maintenance)
assumptions:
Generator_maintenance_events_positive:
holds: "Generator_maintenance_events > 0"
where: "Generator_maintainable"
description: >-
a maintainable generator with no event schedules no maintenance. PyPSA
refuses it (`consistency.py:1541`)
Generator_maintenance_duration_positive:
holds: "Generator_maintenance_duration > 0"
where: "Generator_maintainable"
description: >-
an event that covers no hours is no maintenance window. PyPSA refuses it
(`consistency.py:1531`)
Generator_maintenance_duration_fits_the_horizon:
holds: "Generator_maintenance_duration <= sum(snapshot_weightings_generators, over=snapshot)"
where: "Generator_maintainable"
description: >-
one event longer than the horizon, in generator weightings, blocks every
start and makes the event count infeasible. PyPSA refuses it
(`consistency.py:1552`)
Generator_maintenance_events_fit_the_horizon:
holds: "Generator_maintenance_duration * Generator_maintenance_events <= sum(snapshot_weightings_generators, over=snapshot)"
where: "Generator_maintainable"
description: >-
the events together longer than the horizon, in generator weightings,
cannot all be scheduled. PyPSA refuses it (`consistency.py:1564`)
Generator_maintenance_build_cap_is_finite:
holds: "Generator_p_nom_max < inf"
where: "Generator_maintainable AND Generator_p_nom_extendable"
description: >-
the `maintcap` rows bound the chosen build in maintenance by
`p_nom_max`, so an infinite cap is an infinite coefficient. PyPSA
refuses it (`consistency.py:1576`)
Given#
| Symbol | Meaning |
|---|---|
| \(\mathrm{on}\) | Generator_active over \(\mathcal{G} \times \mathcal{T}\), data another file declares |
| \(\mathrm{com}\) | Generator_committable over \(\mathcal{G}\), data another file declares |
| \(\mathrm{N}^{\mathrm{fix}}\) | Generator_modules_installed over \(\mathcal{G} \times \Xi\), data another file declares |
| \(\mathrm{ext}\) | Generator_p_nom_extendable over \(\mathcal{G}\), data another file declares |
| \(\overline{\mathrm{p}}^{\mathrm{nom}}\) | Generator_p_nom_max over \(\mathcal{G} \times \Xi\), data another file declares |
| \(\underline{\mathrm{p}}^{\mathrm{nom}}\) | Generator_p_nom_min over \(\mathcal{G} \times \Xi\), data another file declares |
| \(\mathrm{p}^{\mathrm{mod}}\) | Generator_p_nom_mod over \(\mathcal{G}\), data another file declares |
| \(\mathrm{w}^{\mathrm{gen}}\) | snapshot_weightings_generators over \(\mathcal{T}\), data another file declares |
| \(P\) | Generator_p_nom_ext over \(\mathcal{G}\) |
| \(u\) | Generator_status over \(\mathcal{G} \times \Xi \times \mathcal{T}\) |
| \(\mathrm{on}^{\mathrm{com}}\) | Generator_committed over \(\mathcal{G} \times \mathcal{T}\), a condition another file defines |
Sets#
| Symbol | Meaning |
|---|---|
| \(\mathcal{G}\) | index \(g\) — generator with \(\mathrm{Generator\_maintenance\_cover} \subseteq \mathcal{T} \times \mathcal{G} \times \Xi \times \mathcal{T}\), Generator_maintenance_cover is absent where the data has no row — generating units, each on one bus |
| \(\Xi\) | index \(\xi\) — scenario with \(\mathrm{Generator\_maintenance\_cover} \subseteq \mathcal{T} \times \mathcal{G} \times \Xi \times \mathcal{T}\), Generator_maintenance_cover is absent where the data has no row — the futures dispatch is chosen in, each with a weight |
| \(\mathcal{T}\) | index \(t\) — snapshot with \(\mathrm{Generator\_maintenance\_cover} \subseteq \mathcal{T} \times \mathcal{G} \times \Xi \times \mathcal{T}\), Generator_maintenance_cover is absent where the data has no row — dispatch periods |
Parameters#
| Symbol | Meaning |
|---|---|
| \(\mathrm{mnt}\) | Generator_maintainable over \(\mathcal{G}\) — whether a generator must be taken off for maintenance within the horizon: in any scenario, as PyPSA takes the union over them (components.py:1000-1003) |
| \(\tau^{\mathrm{mnt}}\) | Generator_maintenance_duration over \(\mathcal{G} \times \Xi\), absent where the data has no row — the hours of generator weightings one maintenance event covers, PyPSA's maintenance_duration. It has no value where the generator is not maintainable. No row contains it. In data prep you turn it into Generator_maintenance_cover and Generator_maintenance_start_blocked. The assumptions state that it fits the horizon |
| \(\mathrm{n}^{\mathrm{mnt}}\) | Generator_maintenance_events over \(\mathcal{G} \times \Xi\) — how many maintenance events occur within the horizon |
| \(\gamma\) | Generator_maintenance_pu over \(\mathcal{G} \times \Xi\) — the share of the build a maintenance event takes off |
| \(\mathrm{blk}\) | Generator_maintenance_start_blocked over \(\mathcal{G} \times \Xi \times \mathcal{T}\) — true where no maintenance event may start, data prep. The snapshots it would cover there run past the end of the horizon or into one the generator is not active in. It is PyPSA's active & ~valid, from maintenance_duration and the generator weightings |
Conditions#
| Symbol | Meaning |
|---|---|
| \(\mathrm{on}^{\mathrm{mnt,ext}}\) | Generator_maint_ext over \(\mathcal{G} \times \mathcal{T}\) — a maintainable generator with an extendable build that is active in the snapshot's period, unless it is committable and modular. These are the maintenance rows against the chosen build |
Variables#
| Symbol | Meaning |
|---|---|
| \(\mu\) | Generator_maintenance over \(\mathcal{G} \times \Xi \times \mathcal{T}\), \(0\) where the mask leaves it out — Generator-maintenance — whether a maintainable generator is in maintenance: continuous, and one exactly where an event covers the snapshot |
| \(\mu^{\mathrm{nom}}\) | Generator_maintenance_capacity over \(\mathcal{G} \times \Xi \times \mathcal{T}\), \(0\) where the mask leaves it out — Generator-maintenance_capacity — the chosen build while in maintenance, zero otherwise: the product the maintcap rows linearise |
| \(\mu^{\mathrm{up}}\) | Generator_maintenance_start over \(\mathcal{G} \times \Xi \times \mathcal{T}\), \(0\) where the mask leaves it out — Generator-maintenance_start — whether a maintenance event starts in this snapshot |
| \(\mu^{u}\) | Generator_maintenance_status over \(\mathcal{G} \times \Xi \times \mathcal{T}\), \(0\) where the mask leaves it out — Generator-maintenance_status — the status while in maintenance, zero otherwise: the product the maint-status rows linearise, so a unit in maintenance may also be off |
Definitions#
| Symbol | Meaning |
|---|---|
| \(\mathrm{Generator\_maintenance\_modules}\) | Generator_maintenance_modules over \(\mathcal{G} \times \Xi\) — how many modules of a modular committable generator can be on in maintenance: its build cap in modules where the build is extendable, and the modules installed where it is fixed (constraints.py:588-594) |
Conditions#
Generator_maint_ext
Variable domains#
Generator_maintenance
Generator_maintenance_capacity
Generator_maintenance_start
Generator_maintenance_status
Definitions#
Generator_maintenance_modules
Subject to#
Generator_maint_event_count
Generator_maint_modstatus_lb
Generator_maint_modstatus_le_maint
Generator_maint_modstatus_le_status
Generator_maint_start_horizon
Generator_maint_status_lb
Generator_maint_status_le_maint
Generator_maint_status_le_status
Generator_maint_window
Generator_maintcap_lower_nommax
Generator_maintcap_lower_nommin
Generator_maintcap_upper
Generator_maintcap_upper_nommax
Assumptions#
Generator_maintenance_build_cap_is_finite
Generator_maintenance_duration_fits_the_horizon
Generator_maintenance_duration_positive
Generator_maintenance_events_fit_the_horizon
Generator_maintenance_events_positive
See also
- PyPSA in 25 files, for how the fragments compose
- PyPSA in one file, for the same spec as one file, rung by rung