MATLAB Examples

Home Energy Management System

This example shows a home energy management system switching between grid power and distributed power sources.

By Hiroumi Mita, MathWorks Japan.



A photovoltaics system, grid power, and a battery are connected to a home energy management system (HEMS) as complementary power sources.

The photovoltaics system is connected directly to the HEMS. The system is rated to 5 kW and is defined by a current-voltage look-up table. The Maximum Power Point Tracking (MPPT) control takes maximum power from the solar panel using a unidirectional DC/DC converter. To track to maximum power point, as calculated by the MPPT control, a cascade control mechanism drives a unidirectional DC/DC converter. The cascade control mechanism is a series of voltage, current, and PWM controllers.

A controller composed of a Power Conditioning System and Battery Control System is also connected directly to the HEMS.

The power grid is connected to the house from a pole-mounted distribution transformer. It can absorb surplus power from the HEMS or demanded supply power to the HEMS. The connection between the grid and the HEMS is controlled by a bidirectional DC/AC inverter.

Two loads of 3 kW can be connected to the HEMS. They consume a total of 6 kW of electrical power when both are connected.


Run the example model and observe the signals on the scopes in the Additional Scopes subsystem.

1. Initially, the battery is not connected to the system and the two loads are not yet enabled. The power generated by the photovoltaics is held nearly constant at the rated 5 kW by the MPPT control and is returned to the power grid.

2. Load 1 (3 kW) is turned ON and consumes more than half of the power generated by the photovoltaics system. The remaining power is returned to the power grid.

3. Load 2 is turned ON for a total of 6 kW of consumed power. The photovoltaics system does not supply sufficient power, therefore complementary power is provided by the grid.

4. Loads 1 and 2 are then disconnected and the Battery is connected to the system. Loads 1 and 2 are then reconnected in the same sequence as above. The management system can now be disconnected from the power grid since the combination of solar power and battery power is sufficient to supply the total load.