The composed spec#
This page shows the spec that the surface, generators and loads make together:
The file below is spec, the spec that merge returns, written as YAML with
every default spelled out. No fragment holds this file, and the repository does
not commit it. Each component fragment read Port_p under given:, and merge
folded those readings into the entry of the surface, so Port_p is one
entry here.
The objective comes from the surface, and it reads total_cost. The generator
is the only fragment with a cost, so Generator_cost is the only term of that
sum. A second fragment with a cost would add its own term to total_cost.
The math under the file has a tab per formulation: As composed is the spec
above, and With commitment lays variants/commitment.yaml over it with
override, which makes the
generator a committed unit:
to_spec refuses a patch on its own, because the patch edits entries that
it does not declare. So the patch has math only on the spec it lands on, and
the tab prints the patch beside that math.
version: 0
dimensions:
snapshot: {dtype: datetime, description: dispatch periods}
bus: {dtype: str, description: network nodes}
port: {dtype: str, description: 'the connections components make, one label per connection'}
generator: {dtype: str, description: 'generating units, each on one port'}
load: {dtype: str, description: 'demands, each on one port'}
relations:
Port_bus: {key: port, values: bus}
Generator_port: {key: generator, values: port}
Load_port: {key: load, values: port}
parameters:
Generator_p_nom:
dims: [generator]
dtype: float
description: nominal power
Generator_marginal_cost:
dims: [generator]
dtype: float
description: cost of one unit of output
Load_p_set:
dims: [snapshot, load]
dtype: float
description: '`Load-p_set` — what a load takes in a snapshot'
variables:
Port_p:
dims: [snapshot, port]
domain: continuous
missing: absent
description: what a port puts into its bus in a snapshot, negative for a withdrawal
Generator_p:
dims: [snapshot, generator]
bounds: {lower: 0.0, upper: Generator_p_nom}
domain: continuous
missing: absent
description: '`Generator-p` — what a generator produces in a snapshot'
expressions:
Generator_cost: sum(Generator_p * Generator_marginal_cost)
total_cost:
dims: []
expression: Generator_cost
description: what running the system costs
objective: {sense: minimize, expression: total_cost}
constraints:
Bus_nodal_balance:
dims: [snapshot, bus]
expression: sum(Port_p, over=port, by=Port_bus[bus]) == 0
description: '`Bus-nodal_balance` — what the ports on a bus put in nets to nothing'
Generator_injection:
dims: [snapshot, generator]
expression: at(Port_p, by=Generator_port[port]) == Generator_p
description: 'what a generator produces is what its port injects. No PyPSA row stands for this: PyPSA
writes the generator into the balance instead'
Load_withdrawal:
dims: [snapshot, load]
expression: at(Port_p, by=Load_port[port]) == -Load_p_set
description: 'what a load takes is what its port withdraws. No PyPSA row stands for this: PyPSA writes
the load into the balance instead'
Sets#
| Symbol | Meaning |
|---|---|
| \(\mathcal{T}\) | index \(t\) — snapshot — dispatch periods |
| \(\mathcal{N}\) | index \(n\) — bus with \(\mathrm{Port\_bus}: \mathcal{J} \to \mathcal{N}\) — network nodes |
| \(\mathcal{J}\) | index \(j\) — port with \(\mathrm{Port\_bus}: \mathcal{J} \to \mathcal{N},\ \mathrm{Generator\_port}: \mathcal{G} \to \mathcal{J},\ \mathrm{Load\_port}: \mathcal{D} \to \mathcal{J}\) — the connections components make, one label per connection |
| \(\mathcal{G}\) | index \(g\) — generator with \(\mathrm{Generator\_port}: \mathcal{G} \to \mathcal{J}\) — generating units, each on one port |
| \(\mathcal{D}\) | index \(d\) — load with \(\mathrm{Load\_port}: \mathcal{D} \to \mathcal{J}\) — demands, each on one port |
Parameters#
| Symbol | Meaning |
|---|---|
| \(\mathrm{p}^{\mathrm{nom}}\) | Generator_p_nom over \(\mathcal{G}\) — nominal power |
| \(\mathrm{c}\) | Generator_marginal_cost over \(\mathcal{G}\) — cost of one unit of output |
| \(\mathrm{load}\) | Load_p_set over \(\mathcal{T} \times \mathcal{D}\) — Load-p_set — what a load takes in a snapshot |
Variables#
| Symbol | Meaning |
|---|---|
| \(f\) | Port_p over \(\mathcal{T} \times \mathcal{J}\) — what a port puts into its bus in a snapshot, negative for a withdrawal |
| \(p\) | Generator_p over \(\mathcal{T} \times \mathcal{G}\) — Generator-p — what a generator produces in a snapshot |
Definitions#
| Symbol | Meaning |
|---|---|
| \(\mathit{Generator\_cost}\) | Generator_cost (scalar) |
| \(\mathit{total\_cost}\) | total_cost (scalar) — what running the system costs |
Variable domains#
Port_p
Generator_p
Definitions#
Generator_cost
total_cost
Objective#
Subject to#
Bus_nodal_balance
Generator_injection
Load_withdrawal
parameters:
Generator_p_min_pu: { dims: [generator], description: "least output, per unit of nominal power" }
variables:
Generator_status:
dims: [snapshot, generator]
domain: binary
description: "`Generator-status` — whether a unit is on in a snapshot"
Generator_p: { bounds: { upper: null } }
constraints:
Generator_com_p_upper:
description: "`Generator-com-p-upper` — a committed unit outputs at most its nominal power; off, at most nothing"
dims: [snapshot, generator]
expression: Generator_p <= Generator_p_nom * Generator_status
Generator_com_p_lower:
description: "`Generator-com-p-lower` — a committed unit outputs at least its minimum; off, at least nothing"
dims: [snapshot, generator]
expression: Generator_p >= Generator_p_min_pu * Generator_p_nom * Generator_status
Sets#
| Symbol | Meaning |
|---|---|
| \(\mathcal{T}\) | index \(t\) — snapshot — dispatch periods |
| \(\mathcal{N}\) | index \(n\) — bus with \(\mathrm{Port\_bus}: \mathcal{J} \to \mathcal{N}\) — network nodes |
| \(\mathcal{J}\) | index \(j\) — port with \(\mathrm{Port\_bus}: \mathcal{J} \to \mathcal{N},\ \mathrm{Generator\_port}: \mathcal{G} \to \mathcal{J},\ \mathrm{Load\_port}: \mathcal{D} \to \mathcal{J}\) — the connections components make, one label per connection |
| \(\mathcal{G}\) | index \(g\) — generator with \(\mathrm{Generator\_port}: \mathcal{G} \to \mathcal{J}\) — generating units, each on one port |
| \(\mathcal{D}\) | index \(d\) — load with \(\mathrm{Load\_port}: \mathcal{D} \to \mathcal{J}\) — demands, each on one port |
Parameters#
| Symbol | Meaning |
|---|---|
| \(\mathrm{p}^{\mathrm{nom}}\) | Generator_p_nom over \(\mathcal{G}\) — nominal power |
| \(\mathrm{c}\) | Generator_marginal_cost over \(\mathcal{G}\) — cost of one unit of output |
| \(\mathrm{load}\) | Load_p_set over \(\mathcal{T} \times \mathcal{D}\) — Load-p_set — what a load takes in a snapshot |
| \(\underline{\mathrm{p}}\) | Generator_p_min_pu over \(\mathcal{G}\) — least output, per unit of nominal power |
Variables#
| Symbol | Meaning |
|---|---|
| \(f\) | Port_p over \(\mathcal{T} \times \mathcal{J}\) — what a port puts into its bus in a snapshot, negative for a withdrawal |
| \(p\) | Generator_p over \(\mathcal{T} \times \mathcal{G}\) — Generator-p — what a generator produces in a snapshot |
| \(u\) | Generator_status over \(\mathcal{T} \times \mathcal{G}\) — Generator-status — whether a unit is on in a snapshot |
Definitions#
| Symbol | Meaning |
|---|---|
| \(\mathit{Generator\_cost}\) | Generator_cost (scalar) |
| \(\mathit{total\_cost}\) | total_cost (scalar) — what running the system costs |
Variable domains#
Port_p
Generator_p
Generator_status
Definitions#
Generator_cost
total_cost
Objective#
Subject to#
Bus_nodal_balance
Generator_injection
Load_withdrawal
Generator_com_p_upper
Generator_com_p_lower