Machine Learning / Case study
Personal project · public data
Belgian Electricity Prices: Pipeline, Forecast and Battery
A data pipeline and a price forecast on ten years of Belgian electricity data, used to plan when a battery should charge and discharge.
- SQL
- Databricks
- Power BI
- Forecasting
- Python
At a glance
- Problem:
- a battery earns money by charging when electricity is cheap and selling when it is expensive, but the plan has to be made before the prices are known.
- What I built:
- an extract-load-transform pipeline in PostgreSQL and the same pipeline in Databricks, a Power BI report, a machine-learning price forecast and a daily battery schedule.
- Result:
- the forecast error drops from 23.2 to 17.2 EUR/MWh against a same-hour-yesterday forecast, tested on 2024 prices the model never saw.


Problem
A battery earns money by charging when electricity is cheap and selling when it is expensive, but the plan has to be made before the prices are known.
Data
Belgian day-ahead hourly prices 2015 to 2024 from the ENTSO-E Transparency Platform (87,577 hourly records, no missing values or duplicate hours after cleaning) and Elia open data on the total load of the Belgian grid. About 500,000 rows in all.
Pipeline
Python loads the raw price and load files into PostgreSQL unchanged; SQL builds clean hourly price and load tables and a joined table; a check compares the result with the file the notebooks use (87,577 rows, same first and last hour, same price total).
The same steps run in Databricks SQL as bronze, silver and gold tables, and the same check passes.
A one-page Power BI report reads the gold table: four key figures, average price by month and by hour, grid load against price, and negative-price hours by year.
Forecast and battery
A gradient-boosting model forecasts tomorrow's prices from calendar features and past prices. Data split by time: train 2015 to 2022, validate 2023, test 2024.
Each day a linear optimiser plans a 2 MWh / 1 MW battery from the forecast only, and the plan is then settled at the real prices.
Results
- Price forecast error (mean absolute error) in 2024: 17.18 EUR/MWh, against 23.19 for the same-hour-yesterday forecast.
- All 366 daily battery plans in 2024 were solved and stayed within the battery's limits.
- The PostgreSQL and Databricks pipelines both pass the same check: 87,577 hours, same first and last hour, same price total.
Tools
Python (pandas, scikit-learn), PostgreSQL, SQL, Databricks SQL, Power BI (DAX), Git.