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.


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

\[EAC(c,r,n) = \frac{c}{a_{n,r}},\quad a_{n,r} = \frac{1-(1+r)^{-n}}{r},\quad a_{n,0}=n,\]

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.


Constant parameters

Time clustered parameters

Generation technology parameters

Transmission parameters

Storage parameters

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


Generation technology variables

Shedding variables

Transmission variables

Storage variables

Voltage angle variables

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


We define the objective as cost minimization

\[\mathrm{minimize}_{p_{g,t}, \bar{p}_g, σ_{t}, f_{l,t}, \bar{f}_l, b_{s,n,t}^{+}, b_{s,n,t}^{-}} (f_1 + ... + f_7).\]

The individual objectives are defined as follows.

Investment and maintenance cost of generation capacity

\[f_1=\sum_{g,n} (I_g^G+M_g^G)\bar{p}_{g,n} \tag{f1}\]

The operational cost of generation dispatch

\[f_2=\sum_{g,n,t} C_g^G p_{g,t,n} τ_{t} \tag{f2}\]

Shedding cost

\[f_3=\sum_{n,t} C σ_{n,t} τ_{t} \tag{f3}\]

Investment and maintenance cost of transmission capacity

\[f_4=\sum_{l} (I_l^F+M_l^F) \bar{f}_l \tag{f4}\]

The operational cost of transmission flow

\[f_5=\sum_{l,t} C_l^F ⋅ |f_{l,t}| τ_{t} \tag{f5}\]

Investment cost of storage capacity

\[f_6=\sum_{s,n} I_s^S \bar{b}_{s,n} \tag{f6}\]

The operational cost of storage

\[f_7=\sum_{s,n,t} C_s^S (b_{s,n,t}^{+}+b_{s,n,t}^{-}) τ_{t} \tag{f7}\]

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


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.


Transmission lines to node $n$


Transmission lines from node $n$


Energy balance $t=1$

\[\sum_{g} p_{g,n,t} + σ_{n,t} + \sum_{l∈L_n^-} f_{l,t} - \sum_{l∈L_n^+} f_{l,t} + ξ_s b_{s,n,t} = D_{n,t},\quad ∀s,n,t=1 \tag{b1}\]

Energy balance $t>1$

\[\sum_{g} p_{g,n,t} + σ_{n,t} + \sum_{l∈L_n^-} f_{l,t} - \sum_{l∈L_n^+} f_{l,t} + ξ_s (b_{s,n,t}-b_{s,n,t-1}) = D_{n,t},\quad ∀s,n,t>1 \tag{b2}\]


Generation capacity

\[p_{g,n,t} ≤ A_{g,n,t} (Q_{g,n} + \bar{p}_{g,n}),\quad ∀g,n,t \tag{g1}\]

Minimum renewables share

\[\sum_{g∈G^r,n,t} p_{g,n,t} ≥ κ \sum_{g,n,t} p_{g,n,t} \tag{g2}\]


Shedding upper bound

\[σ_{n,t} ≤ \bar{C} D_{n,t},\quad ∀n,t \tag{g3}\]


Transmission capacity

\[f_{l,t} ≤ \bar{f}_l,\quad ∀l,t \tag{t1}\]
\[f_{l,t} ≥ -\bar{f}_l,\quad ∀l,t \tag{t2}\]

The absolute value of the transmission

\[|f_{l,t}|≥f_{l,t},\quad ∀l,t \tag{t3}\]
\[|f_{l,t}|≥-f_{l,t},\quad ∀l,t \tag{t4}\]


Charge and discharge at $t=1$

\[b_{s,n,t}^{+}≥b_{s,n,t} - b_{s,n}^0,\quad ∀s,n,t=1 \tag{s1}\]
\[b_{s,n,t}^{-}≥b_{s,n,t} - b_{s,n}^0,\quad ∀s,n,t=1 \tag{s2}\]

Charge and discharge at $t>1$

\[b_{s,n,t}^{+}≥b_{s,n,t} - b_{s,n,t-1},\quad ∀s,n,t>1 \tag{s3}\]
\[b_{s,n,t}^{-}≥b_{s,n,t} - b_{s,n,t-1},\quad ∀s,n,t>1 \tag{s4}\]

Storage capacity

\[b_{s,n,t}≤\bar{b}_{s,n},\quad ∀s,n,t \tag{s5}\]

Storage continuity

\[b_{s,n,t=1} = b_{s,n,t=t_{end}},\quad ∀s,n \tag{s6}\]

Ramping Limits

Ramping limit up and down

\[p_{g,n,t} - p_{g,n,t-1} ≥ r_g^{+}, \quad ∀g,n,t>1 \tag{r1}\]
\[p_{g,n,t} - p_{g,n,t-1} ≤ -r_g^{-}, \quad ∀g,n,t>1 \tag{r2}\]

Voltage Angles

Faraday law for accounting voltage angles

\[(θ_{n,t} - θ_{n',t}') B_l = p_{g,n,t} - p_{g,n',t}, \quad ∀g,l,n,n',t>1 \tag{v1}\]


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.



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