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)

vTotalSCost

\(\marketcost_{\periodindex,\scenarioindex}\)

Total system component cost

vTotalCComponent

\(\marketrevenue_{\periodindex,\scenarioindex}\)

Total system component revenue

vTotalRComponent

\(\elemarketcostgrid_{\periodindex,\scenarioindex}\)

Total fixed electricity network cost

vTotalEleNCost

\(\elemarketcosttax_{\periodindex,\scenarioindex}\)

Total tax and surcharges electricity cost

vTotalEleXCost

\(\elemarketcost_{\periodindex,\scenarioindex,\timeindex}\)

Total variable electricity market cost

vTotalEleMCost

\(\hydmarketcost_{\periodindex,\scenarioindex,\timeindex}\)

Total variable hydrogen market cost

vTotalHydMCost

\(\elemaintopercost_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity operational cost

vTotalEleOCost

\(\elemaintopercost_{\periodindex,\scenarioindex,\timeindex}\)

Total hydrogen operational cost

vTotalHydOCost

\(\eledegradationcost_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity degradation cost

vTotalEleDCost

\(\hyddegradationcost_{\periodindex,\scenarioindex,\timeindex}\)

Total hydrogen degradation cost

vTotalHydDCost

\(\elemarketrevenuetax_{\periodindex,\scenarioindex}\)

Total tax electricity revenue

vTotalEleXRev

\(\elemarketrevenue_{\periodindex,\scenarioindex,\timeindex}\)

Total variable electricity market revenue

vTotalEleMRev

\(\hydmarketrevenue_{\periodindex,\scenarioindex,\timeindex}\)

Total variable hydrogen market revenue

vTotalHydMRev

\(\elepeakdemandcost_{\periodindex,\scenarioindex}\)

Total electricity peak cost

vTotalElePeakCost

\(\elenetusecost_{\periodindex,\scenarioindex}\)

Total electricity network usage cost

vTotalEleNetUseCost

\(\elecaptariffcost_{\periodindex,\scenarioindex}\)

Total electricity capacity tariff cost

vTotalEleCapTariffCost

\(\elemarketcostDA_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity day-ahead market cost

vTotalEleMrkDACost

\(\elemarketcostPPA_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity PPA market cost

vTotalEleMrkPPACost

\(\elemarketrevenueDA_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity day-ahead market revenue

vTotalEleMrkDARev

\(\elemarketrevenuePPA_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity PPA market revenue

vTotalEleMrkPPARev

\(\elemarketrevenueancillary_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity frequency market revenue

vTotalEleMrkFrqRev

\(\hydmarketcostPPA_{\periodindex,\scenarioindex,\timeindex}\)

Total hydrogen PPA market cost

vTotalHydMrkPPACost

\(\hydmarketrevenuePPA_{\periodindex,\scenarioindex,\timeindex}\)

Total hydrogen PPA market revenue

vTotalHydMrkPPARev

\(\elemarketcostVAT_{\periodindex,\scenarioindex}\)

Total electricity VAT cost

vTotalEleVATCost

\(\elemarketrevenueincentive_{\periodindex,\scenarioindex}\)

Total electricity incentives revenue

vTotalEleISRev

\(\elegenerationcost_{\periodindex,\scenarioindex,\timeindex}\)

Total variable electricity production cost

vTotalEleGCost

\(\hydgenerationcost_{\periodindex,\scenarioindex,\timeindex}\)

Total variable hydrogen production cost

vTotalHydGCost

\(\eleemissioncost_{\periodindex,\scenarioindex,\timeindex}\)

Total electricity emission cost

vTotalEleECost

\(\eleconsumptioncost_{\periodindex,\scenarioindex,\timeindex}\)

Total variable electricity consumption cost

vTotalEleCCost

\(\hydconsumptioncost_{\periodindex,\scenarioindex,\timeindex}\)

Total variable hydrogen consumption cost

vTotalHydCCost

\(\eleunservedenergycost_{\periodindex,\scenarioindex,\timeindex}\)

Total system electricity reliability cost

vTotalEleRCost

\(\hydunservedenergycost_{\periodindex,\scenarioindex,\timeindex}\)

Total system hydrogen reliability cost

vTotalHydRCost

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

vEleBuy

\(\velemarketsell_{\periodindex,\scenarioindex,\timeindex,\traderindex}\)

Electricity sold to the market

kW

vEleSell

\(\vhydmarketbuy_{\periodindex,\scenarioindex,\timeindex,\traderindex}\)

Hydrogen bought from the market

kgH2

vHydBuy

\(\vhydmarketsell_{\periodindex,\scenarioindex,\timeindex,\traderindex}\)

Hydrogen sold to the market

kgH2

vHydSell

\(\velepeakdemand_{\periodindex,\scenarioindex,\monthindex,\traderindex,\peakindex}\)

Electricity peak demand for tariff calculation

kW

vEleDemPeak

\(\vhydpeakdemand_{\periodindex,\scenarioindex,\monthindex,\traderindex,\peakindex}\)

Hydrogen peak demand for tariff calculation

kgH2

vHydDemPeak

\(\velepeakdemandindbin_{\periodindex,\scenarioindex,\timeindex,\traderindex,\peakindex}\)

Binary indicator for electricity peak demand

‘{0,1}’

vElePeakHourInd

\(\vhydpeakdemandindbin_{\periodindex,\scenarioindex,\timeindex,\traderindex,\peakindex}\)

Binary indicator for hydrogen peak demand

‘{0,1}’

vHydPeakHourInd

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

vEleTotalOutput

\(\vhydproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Hydrogen output from a generator

kgH2

vHydTotalOutput

\(\velesecondblockproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Elec. production above min. stable level

kW

vEleTotalOutput2ndBlock

\(\vhydsecondblockproduction_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Hyd. production above min. stable level

kgH2

vHydTotalOutput2ndBlock

Consumption & Demand#

Symbol

Description

Unit

Pyomo Component

\(\veleconsumption_{\periodindex,\scenarioindex,\timeindex,\eleconsindex}\)

Electricity consumption (ESS & electrolyzer)

kW

vEleTotalCharge

\(\vhydconsumption_{\periodindex,\scenarioindex,\timeindex,\hydconsindex}\)

Hydrogen consumption (ESS & thermal units)

kgH2

vHydTotalCharge

\(\velesecondblockconsumption_{\periodindex,\scenarioindex,\timeindex,\eleconsindex}\)

Elec. charge above min. stable level (ESS & electrolyzer)

kW

vEleTotalCharge2ndBlock

\(\vhydsecondblockconsumption_{\periodindex,\scenarioindex,\timeindex,\hydconsindex}\)

Hyd. charge above min. stable level (ESS & thermal units)

kgH2

vHydTotalCharge2ndBlock

\(\veledemand_{\periodindex,\scenarioindex,\timeindex,\demandindex}\)

Electricity demand served

kW

vEleDemand

\(\vhyddemand_{\periodindex,\scenarioindex,\timeindex,\demandindex}\)

Hydrogen demand served

kgH2

vHydDemand

\(\veleloadshed_{\periodindex,\scenarioindex,\timeindex,\demandindex}\)

Unserved electricity (energy not supplied)

kW

vENS

\(\vhydloadshed_{\periodindex,\scenarioindex,\timeindex,\demandindex}\)

Unserved hydrogen (hydrogen not supplied)

kgH2

vHNS

\(\veledemflex_{\periodindex,\scenarioindex,\timeindex,\demandindex}\)

Flexible electricity demand

kW

vEleDemFlex

Storage#

Symbol

Description

Unit

Pyomo Component

\(\veleinventory_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Stored energy in an elec. ESS (State of Charge)

kWh

vEleInventory

\(\vhydinventory_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Stored energy in a hyd. ESS (State of Charge)

kgH2

vHydInventory

\(\veleenergyinflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Inflows of an electricity ESS

kWh

vEleEnergyInflows

\(\veleenergyoutflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Outflows of an electricity ESS

kWh

vEleEnergyOutflows

\(\vhydenergyinflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Inflows of a hydrogen ESS

kgH2

vHydEnergyInflows

\(\vhydenergyoutflow_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Outflows of a hydrogen ESS

kgH2

vHydEnergyOutflows

\(\velespillage_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Spilled energy from an electricity ESS

kWh

vEleSpillage

\(\vhydspillage_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Spilled energy from a hydrogen ESS

kgH2

vHydSpillage

Ancillary Services#

Symbol

Description

Unit

Pyomo Component

\(rp^{FN}_{neg}, rc^{FN}_{nes}\)

FCR from a producer (gen/ESS) or consumer (ESS)

kW

vEleReserveProd_FN, vEleReserveCons_FN

\(\vPupward_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Upwards FCR-D from a producer (gen/ESS)

kW

vEleReserveProd_Up_FD

\(\vPdownward_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Downwards FCR-D from a producer (gen/ESS)

kW

vEleReserveProd_Down_FD

\(\vCupward_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Upwards FCR-D from a consumer (ESS)

kW

vEleReserveCons_Up_FD

\(\vCdownward_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Downwards FCR-D from a consumer (ESS)

kW

vEleReserveCons_Down_FD

Network#

Symbol

Description

Unit

Pyomo Component

\(\veleflow_{\periodindex,\scenarioindex,\timeindex,\busindexa,\busindexb,\circuitindex}\)

Electricity flow on a transmission line

kW

vEleNetFlow

\(\vhydflow_{\periodindex,\scenarioindex,\timeindex,\busindexa,\busindexb,\circuitindex}\)

Hydrogen flow in a pipeline

kgH2

vHydNetFlow

\(\theta_{\periodindex,\scenarioindex,\timeindex,\busindex}\)

Voltage angle at a node (for DC power flow)

rad

vEleNetTheta

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}’

vEleGenCommitment

\(\velestartupbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Startup of an elec. unit

‘{0,1}’

vEleGenStartUp

\(\veleshutdownbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Shutdown of an elec. unit

‘{0,1}’

vEleGenShutDown

\(\vhydcommitbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Commitment of a hydrogen unit

‘{0,1}’

vHydGenCommitment

\(\vhydstartupbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Startup of a hydrogen unit

‘{0,1}’

vHydGenStartUp

\(\vhydshutdownbin_{\periodindex,\scenarioindex,\timeindex,\genindex}\)

Shutdown of a hydrogen unit

‘{0,1}’

vHydGenShutDown

\(\velestoroperatbin_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Operating state of an elec. ESS (charge/discharge)

‘{0,1}’

vEleStorOperat

\(\vhydstoroperatbin_{\periodindex,\scenarioindex,\timeindex,\storageindex}\)

Operating state of a hyd. ESS (charge/discharge)

‘{0,1}’

vHydStorOperat

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.