# Energy System Modeling

Mathematical reference for the energy system model. The model presented here is based on the model in [1]. We express units of parameters and variables using square brackets. In the code, we implement the model as `EnergySystemModel(::Params, ::Specs)`

method, which constructs an `EnergySystemModel`

instance.

## Utility

We calculate annualized costs using *equivalent annual cost (EAC)* formula

where $c$ is the net present cost of the project, $n$ is the number of payments, and $r$ is the interest rate.

## Indices and Sets

Indices and sets define the different objects and dimensions in the model.

- $g∈G$: Generation technologies
- $G^r⊆G$: Renewable generation technologies
- $n∈N$: Nodes
- $l∈L$: Transmission lines, bidimensional vectors $(i,j)$ where $i,j∈N$
- $t∈T$: Time steps, depending on the number of clusters per month
- $s∈S$: Storage technologies

## Parameters

Constant parameters

- $κ∈[0,1]$: Renewables participation required by the system
- $C$: Shedding cost [€/MWh]
- $\bar{C}$: Shedding capacity [MWh]
- $r≥0$: Interest rate

Time clustered parameters

- $τ_{t}$: Duration of time period $t$ [h]
- $Q_{g,n}$: Initial capacity [MW]
- $A_{g,n,t}∈[0,1]$: Availability of technology $g$ per node $n$ at time step $t$
- $D_{n,t}$: Clustered demand per node $n$ per time step $t$ [MWh]

Generation technology parameters

- $I_g^G$: Annualised investment cost for generation per MW of technology $g$ [€/MW]. Calculated as $I_g^G=EAC(c_g, t_g, r)$ where $c_g$ is the cost and $t_g$ is lifetime of technology $g$.
- $M_g^G$: Annualised maintenance cost for generation per MW of technology $g$ [€/MW]
- $C_g^G$: Operational cost per MWh of technology $g$ [€/MWh]. Calculated as $c_g/c'_g/1000$ where $c_g$ is fuel cost 1 and $c'_g$ fuel cost 2 of technology $g.$
- $r_g^{-}$: Relative ramp-down limit of technology $g$
- $r_g^{+}$: Relative ramp-up limit of technology $g$

Transmission parameters

- $I_l^F$: Annualised investment cost for transmission per line $l$ [€/MW]. Calculated as $I_l^F=EAC(c_l⋅d_l + M_l^F, t_l, r)$ where $c_l$ is cost per kilometer and $d_l$ distance in kilometers, $t_l$ the lifetime of transmission line $l.$
- $M_l^F$: Annualised maintenance cost for transmission per line $l$ [€/MW]
- $C_l^F$: Transmission cost per line $l$ [€/MWh]
- $B_l$: Susceptance per line $l$

Storage parameters

- $I_s^S$: Annualised investment cost of storage technology $s$ per MW [€/MW]. Calculated as $I_s^S=EAC(c_s, t_s, r)$ where $c_s$ is the (upfront) investment cost and $t_s$ the lifetime of storage $s.$
- $C_s^S$: Storage operational cost of storage technology $s$ [€/MWh]
- $b_{s,n}^0$: Initial capacity of storage $s$ at node $n$ [MWh]
- $ξ_s$: Round-trip efficiency of storage technology $s$

In the code, we store both indices and parameters in the `Params`

struct.

## Variables

Generation technology variables

- $p_{g,n,t}≥0$: Dispatch from technology $g$ at node $n$ in each time step $t$ [MWh]
- $\bar{p}_{g,n}≥0$: Generation capacity invested in each technology $g$ at node $n$ [MW]

Shedding variables

- $σ_{n,t}≥0$: Loss of load at node $n$ in each time step $t$ [MWh]

Transmission variables

- $f_{l,t}$: Transmission flow per line $l$ in each time step $t$ [MWh]
- $|f_{l,t}|$: Absolute value of transmission flow per line $l$ in each time step $t$ [MWh]
- $\bar{f}_l$: Transmission capacity per line $l$ [MW]

Storage variables

- $b_{s,n,t}≥0$: Storage level of storage $s$ at node $n$ in each time step $t$ [MWh]
- $\bar{b}_{s,n}≥0$: Storage capacity of storage $s$ at node $n$ [MW]
- $b_{s,n,t}^{+}≥0$: Charging of storage $s$ at node $n$ in each time step $t$ [MW]
- $b_{s,n,t}^{-}≥0$: Discharging of storage $s$ at node $n$ in each time step $t$ [MW]

Voltage angle variables

- $θ_{n,t}≥0$: Voltage angle at node $n$ in each time step $t$
- $θ'_{n,t}≥0$: Voltage angle at node $n$ in each time step $t$

We use `Variables`

struct to store the variable values after optimization. We can query the values from the model using `Variables(::EnergySystemModel)`

method.

## Objective

We define the objective as cost minimization

The individual objectives are defined as follows.

Investment and maintenance cost of generation capacity

The operational cost of generation dispatch

Shedding cost

Investment and maintenance cost of transmission capacity

The operational cost of transmission flow

Investment cost of storage capacity

The operational cost of storage

We use `Objectives`

struct to store the objetive values after optimization. We can query the values from the model using `Objectives(::EnergySystemModel)`

method.

## Constraints

In this section, we list all the constraints in the energy system model and explain their function. Each constraint is named in the code using the equation labels. We can then access the individual constraints using the standard JuMP syntax, for example, `model[:b1]`

.

We use the `Specs`

struct to control whether we include certain constraints in the model.

### Balance

Transmission lines to node $n$

Transmission lines from node $n$

Energy balance $t=1$

Energy balance $t>1$

### Generation

Generation capacity

Minimum renewables share

### Shedding

Shedding upper bound

### Transmission

Transmission capacity

The absolute value of the transmission

### Storage

Charge and discharge at $t=1$

Charge and discharge at $t>1$

Storage capacity

Storage continuity

### Ramping Limits

Ramping limit up and down

### Voltage Angles

Faraday law for accounting voltage angles

## Instances

Users can provide input parameters for different instances as a directory containing CSV and JSON files, and also include a README file, which describes the instance. Users can distribute instances as `.zip`

archives. We provide an example instance in `examples/instance`

as a reference. We describe the input format in `Params(::AbstractString)`

.

We can write `Specs`

, `Params`

, `Variables`

, and `Objectives`

structs into JSON files using `save_json`

and read them from JSON files using `load_json`

.

## References

**[1]**

Pineda, S., & Morales, J. M. (2018). Chronological time-period clustering for optimal capacity expansion planning with storage. IEEE Transactions on Power Systems, 33(6), 7162–7170. https://doi.org/10.1109/TPWRS.2018.2842093