This MATLAB code consists of a two-level Hierarchical Model Predictive Control (HMPC) implemented to manage a building microgrid equipped with Li-ion batteries, photovoltaic solar panels (PV) and plug-in electrical vehicles (PEV) as depicted in the following scheme. This control structure is a simplified one which highlights the tertiary control level with the implementation of the economic power dispatch.
- 1 Photovoltaic painel with real data (~0 - 1 kW)
- 1 Building with power consumption between 0 - 0.8 kW
- 1 Li-ion battery package (Capacity: 68 kWh/ Max. charging and discharging rate: +/- 10 kWh)
- 1 Electrical Vehicle with 1 Li-ion battery package (Capacity: 68 kWh/ Max. charging and discharging rate: +/- 2.5 kWh)
- Tertiary Control layer with daily market
- Horizon (Nh): 48h (wheather forecast + power consumption)
- Ts': 24h (each day the building sends to the community aggregator the electricity trading plan for the following day commitiment)
- Ts: 1h (discretization of the electricity trading plan)
- Tertiary Control layer with intraday market
- Horizon (Nh): 6h (wheather forecast + power consumption)
- Ts: 1h (electricity purchase or sell at last moment)
You can have a preview of the HMPC by seeing the simulations videos of the Hierarchical Control without disturbance and Hierarchical Control with disturbance: