**2. Real-Time Controller-Based Energy Management System**

For this system, the HEMS aims to minimize the daily household energy costs, reduce energy lost to the utility, and improve local PV self-consumption by controlling a HBSS using RTC. The RTC uses a rule-based algorithm to control the HBSS. During the off-peak tariff period (i.e., overnight period) the controller charges the HBSS to a preset overnight maximum charging level. During the rest of the day, the RTC discharges the HBSS—it compares the power at the point of grid connection and tries to make this power equal to zero. The main rules used for this controller are summarized as follows:

### *2.1. HBSS Discharging Mode*

