Problem description

Suppose as an owner of a large array of batteries, in a first step we want to compute the most optimal charging and discharging schedule given a certain time series of day-ahead electricity prices. The most simple and natural choice for tackling this problem, is to apply Linear Programming.

Forecasting

We are going to use the API provided by ENTSO-E and create a machine learning model that uses

  • Day-ahead prices
  • Load forecasts
  • Wind forecasts
  • Solar forecasts to predict the electricity price at time . Since time itself is progressing in real time as forecasts are made, we will have overlapping forecasts which we will weight according to their age.

Read more here about the Machine Learning framework planned to make these predictions: ML Forecasting of Electricity Prices

Scheduling

Linear Program

Introduce the variable , which for each time step represents : we charge our battery array or : we hold the battery charge or : we discharge the battery at least until the next time step. is the number of time steps. Furthermore, we are given the time series that associates a day-ahead price in €/MWh to every time step . Denote by the battery capacity at the first and the last time step respectively. Assume that by each charge or discharge action the battery capacity is reduced by per timestep(@fabreOptimisingBatteryEnergy2025 , 2.4). Let be the state of charge (SOC) of the battery at time step and the initial SOC. We assume constant linear increments of charge per timestep of 25%. So in other words, it takes 4 hours to charge the battery. Lastly, define the daily action limit , that is the maximum number of discharge or charge actions that can be done in within the time steps.

Optimization problem 1

Thus, the objective becomes

Subject to the following constraints:

  • Battery capacity
  • SOC
  • Number of actions

\sum_{i = 1} ^{N} |d_{i}| < n_{actions}

So far, this is a good starting point, but there are several issues. To begin with, it is not really a linear program yet. We have to replace by two decision variables:

Where if and only if the battery is charged at the -th time step and if and only if discharged. In addition, we want to be able to control the penalty for increasing the number of actions and replace the battery capacity by a general penalty term (see below). Another inaccuracy in the previous model is the assumption that charging and discharging are lossless. To make it more realistic we introduce the efficiencies and . Moreover, previously we implicitly used the assumption that the battery charges and discharges at 1 MW, which obviously is unnecessarily rigid. So, on the one hand we define the peak-power and on the other hand at each time step we redefine representing also partial power outputs or inputs.

The objective becomes