Variables#
The optimization model determines the values of numerous decision variables to minimize the total system cost while satisfying all constraints. These variables represent the physical and economic operations of the energy system. They are defined as Var objects in Pyomo within the create_variables function.
The main variables are indexed by the sets, primarily by period (\(\periodindex\)), scenario (\(\scenarioindex\)), and timestep (\(\timeindex\)), and are written in lowercase letters.
Costs & Objective#
These high-level variables are used to structure the objective function, representing the total costs and revenues over the entire optimization horizon.
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\alpha\) |
Total system cost (the main objective function) |
€ |
|
\(\marketcost_{\periodindex,\scenarioindex}\) |
Total system component cost |
€ |
|
\(\marketrevenue_{\periodindex,\scenarioindex}\) |
Total system component revenue |
€ |
|
\(\elemarketcostgrid_{\periodindex,\scenarioindex}\) |
Total fixed electricity network cost |
€ |
|
\(\elemarketcosttax_{\periodindex,\scenarioindex}\) |
Total tax and surcharges electricity cost |
€ |
|
\(\elemarketcost_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable electricity market cost |
€ |
|
\(\hydmarketcost_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable hydrogen market cost |
€ |
|
\(\elemaintopercost_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity operational cost |
€ |
|
\(\elemaintopercost_{\periodindex,\scenarioindex,\timeindex}\) |
Total hydrogen operational cost |
€ |
|
\(\eledegradationcost_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity degradation cost |
€ |
|
\(\hyddegradationcost_{\periodindex,\scenarioindex,\timeindex}\) |
Total hydrogen degradation cost |
€ |
|
\(\elemarketrevenuetax_{\periodindex,\scenarioindex}\) |
Total tax electricity revenue |
€ |
|
\(\elemarketrevenue_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable electricity market revenue |
€ |
|
\(\hydmarketrevenue_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable hydrogen market revenue |
€ |
|
\(\elepeakdemandcost_{\periodindex,\scenarioindex}\) |
Total electricity peak cost |
€ |
|
\(\elenetusecost_{\periodindex,\scenarioindex}\) |
Total electricity network usage cost |
€ |
|
\(\elecaptariffcost_{\periodindex,\scenarioindex}\) |
Total electricity capacity tariff cost |
€ |
|
\(\elemarketcostDA_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity day-ahead market cost |
€ |
|
\(\elemarketcostPPA_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity PPA market cost |
€ |
|
\(\elemarketrevenueDA_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity day-ahead market revenue |
€ |
|
\(\elemarketrevenuePPA_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity PPA market revenue |
€ |
|
\(\elemarketrevenueancillary_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity frequency market revenue |
€ |
|
\(\hydmarketcostPPA_{\periodindex,\scenarioindex,\timeindex}\) |
Total hydrogen PPA market cost |
€ |
|
\(\hydmarketrevenuePPA_{\periodindex,\scenarioindex,\timeindex}\) |
Total hydrogen PPA market revenue |
€ |
|
\(\elemarketcostVAT_{\periodindex,\scenarioindex}\) |
Total electricity VAT cost |
€ |
|
\(\elemarketrevenueincentive_{\periodindex,\scenarioindex}\) |
Total electricity incentives revenue |
€ |
|
\(\elegenerationcost_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable electricity production cost |
€ |
|
\(\hydgenerationcost_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable hydrogen production cost |
€ |
|
\(\eleemissioncost_{\periodindex,\scenarioindex,\timeindex}\) |
Total electricity emission cost |
€ |
|
\(\eleconsumptioncost_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable electricity consumption cost |
€ |
|
\(\hydconsumptioncost_{\periodindex,\scenarioindex,\timeindex}\) |
Total variable hydrogen consumption cost |
€ |
|
\(\eleunservedenergycost_{\periodindex,\scenarioindex,\timeindex}\) |
Total system electricity reliability cost |
€ |
|
\(\hydunservedenergycost_{\periodindex,\scenarioindex,\timeindex}\) |
Total system hydrogen reliability cost |
€ |
|
Market & Trading#
These variables represent the interactions with external energy markets.
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\velemarketbuy_{\periodindex,\scenarioindex,\timeindex,\traderindex}\) |
Electricity bought from the market |
kW |
|
\(\velemarketsell_{\periodindex,\scenarioindex,\timeindex,\traderindex}\) |
Electricity sold to the market |
kW |
|
\(\vhydmarketbuy_{\periodindex,\scenarioindex,\timeindex,\traderindex}\) |
Hydrogen bought from the market |
kgH2 |
|
\(\vhydmarketsell_{\periodindex,\scenarioindex,\timeindex,\traderindex}\) |
Hydrogen sold to the market |
kgH2 |
|
\(\velepeakdemand_{\periodindex,\scenarioindex,\monthindex,\traderindex,\peakindex}\) |
Electricity peak demand for tariff calculation |
kW |
|
\(\vhydpeakdemand_{\periodindex,\scenarioindex,\monthindex,\traderindex,\peakindex}\) |
Hydrogen peak demand for tariff calculation |
kgH2 |
|
\(\velepeakdemandindbin_{\periodindex,\scenarioindex,\timeindex,\traderindex,\peakindex}\) |
Binary indicator for electricity peak demand |
‘{0,1}’ |
|
\(\vhydpeakdemandindbin_{\periodindex,\scenarioindex,\timeindex,\traderindex,\peakindex}\) |
Binary indicator for hydrogen peak demand |
‘{0,1}’ |
|
Asset Operations (Generation, Storage, and Demand)#
These variables control the physical operation of all assets in the system.
Generation#
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\veleproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Electricity output from a generator |
kW |
|
\(\vhydproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Hydrogen output from a generator |
kgH2 |
|
\(\velesecondblockproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Elec. production above min. stable level |
kW |
|
\(\vhydsecondblockproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Hyd. production above min. stable level |
kgH2 |
|
Consumption & Demand#
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\veleconsumption_{\periodindex,\scenarioindex,\timeindex,\eleconsindex}\) |
Electricity consumption (ESS & electrolyzer) |
kW |
|
\(\vhydconsumption_{\periodindex,\scenarioindex,\timeindex,\hydconsindex}\) |
Hydrogen consumption (ESS & thermal units) |
kgH2 |
|
\(\velesecondblockconsumption_{\periodindex,\scenarioindex,\timeindex,\eleconsindex}\) |
Elec. charge above min. stable level (ESS & electrolyzer) |
kW |
|
\(\vhydsecondblockconsumption_{\periodindex,\scenarioindex,\timeindex,\hydconsindex}\) |
Hyd. charge above min. stable level (ESS & thermal units) |
kgH2 |
|
\(\veledemand_{\periodindex,\scenarioindex,\timeindex,\demandindex}\) |
Electricity demand served |
kW |
|
\(\vhyddemand_{\periodindex,\scenarioindex,\timeindex,\demandindex}\) |
Hydrogen demand served |
kgH2 |
|
\(\veleloadshed_{\periodindex,\scenarioindex,\timeindex,\demandindex}\) |
Unserved electricity (energy not supplied) |
kW |
|
\(\vhydloadshed_{\periodindex,\scenarioindex,\timeindex,\demandindex}\) |
Unserved hydrogen (hydrogen not supplied) |
kgH2 |
|
\(\veledemflex_{\periodindex,\scenarioindex,\timeindex,\demandindex}\) |
Flexible electricity demand |
kW |
|
Storage#
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\veleinventory_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Stored energy in an elec. ESS (State of Charge) |
kWh |
|
\(\vhydinventory_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Stored energy in a hyd. ESS (State of Charge) |
kgH2 |
|
\(\veleenergyinflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Inflows of an electricity ESS |
kWh |
|
\(\veleenergyoutflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Outflows of an electricity ESS |
kWh |
|
\(\vhydenergyinflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Inflows of a hydrogen ESS |
kgH2 |
|
\(\vhydenergyoutflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Outflows of a hydrogen ESS |
kgH2 |
|
\(\velespillage_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Spilled energy from an electricity ESS |
kWh |
|
\(\vhydspillage_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Spilled energy from a hydrogen ESS |
kgH2 |
|
Ancillary Services#
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(rp^{FN}_{neg}, rc^{FN}_{nes}\) |
FCR from a producer (gen/ESS) or consumer (ESS) |
kW |
|
\(\vPupward_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Upwards FCR-D from a producer (gen/ESS) |
kW |
|
\(\vPdownward_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Downwards FCR-D from a producer (gen/ESS) |
kW |
|
\(\vCupward_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Upwards FCR-D from a consumer (ESS) |
kW |
|
\(\vCdownward_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Downwards FCR-D from a consumer (ESS) |
kW |
|
Network#
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\veleflow_{\periodindex,\scenarioindex,\timeindex,\busindexa,\busindexb,\circuitindex}\) |
Electricity flow on a transmission line |
kW |
|
\(\vhydflow_{\periodindex,\scenarioindex,\timeindex,\busindexa,\busindexb,\circuitindex}\) |
Hydrogen flow in a pipeline |
kgH2 |
|
\(\theta_{\periodindex,\scenarioindex,\timeindex,\busindex}\) |
Voltage angle at a node (for DC power flow) |
rad |
|
Binary & Logical#
These binary (0 or 1) variables model on/off decisions, operational states, and logical constraints.
Symbol |
Description |
Unit |
Pyomo Component |
|---|---|---|---|
\(\velecommitbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Commitment of an elec. unit |
‘{0,1}’ |
|
\(\velestartupbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Startup of an elec. unit |
‘{0,1}’ |
|
\(\veleshutdownbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Shutdown of an elec. unit |
‘{0,1}’ |
|
\(\vhydcommitbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Commitment of a hydrogen unit |
‘{0,1}’ |
|
\(\vhydstartupbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Startup of a hydrogen unit |
‘{0,1}’ |
|
\(\vhydshutdownbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\) |
Shutdown of a hydrogen unit |
‘{0,1}’ |
|
\(\velestoroperatbin_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Operating state of an elec. ESS (charge/discharge) |
‘{0,1}’ |
|
\(\vhydstoroperatbin_{\periodindex,\scenarioindex,\timeindex,\storageindex}\) |
Operating state of a hyd. ESS (charge/discharge) |
‘{0,1}’ |
|
Variable Bounding and Fixing#
To improve performance and ensure physical realism, the model applies tight bounds to variables and, in some cases, fixes them entirely during a pre-processing step within the create_variables function.
Bounding:
Each decision variable is bounded using physical and economic parameters provided in the input data. For example, the vEleTotalOutput of a generator is bounded between 0 and its maximum power capacity (pEleMaxPower) for each specific time step. This ensures that the solver only explores a feasible solution space.
Fixing:
Variable fixing is a powerful technique used to reduce the complexity of the optimization problem. If a variable’s value can be determined with certainty before the solve, it is fixed to that value. This effectively removes it from the set of variables the solver needs to determine. Examples include:
Unavailable Assets: If a generator has a maximum capacity of zero at a certain time (e.g., due to a planned outage or no renewable resource), its output variable (
vEleTotalOutput) is fixed to 0 for that time.Logical Constraints: If a storage unit has no charging capacity, its charging variable (
vEleTotalCharge) is fixed to 0.Reference Values: The voltage angle (
vEleNetTheta) of the designated reference node is fixed to 0 to provide a reference for the DC power flow calculation.
Benefits:
This strategy of tightly bounding and fixing variables is crucial for the model’s performance and scalability. By reducing the number of free variables and constraining the solution space, it:
Creates a tighter model formulation, which can be solved more efficiently.
Reduces the overall problem size, leading to faster computation times.
Improves the model’s scalability, allowing it to handle larger and more complex energy systems without a prohibitive increase in solve time.