*5.3. Discussion*

The proposed RT-EMS has several features that make it easy to implement in MGs as well as in smart buildings. The MAS makes it easier to extend the system and add other components. New agents can be designed for new components and integrated in the agent platform and then added in the optimization system. In addition, the DDS makes it very easy to integrate any type of hardware to the existing MG. For instance, a new PV system in a smart building, can interfaced to the SCADA using a new publisher and a new topic for this new PV system. Thus, the RT-EMS is modular and easy to extend for larger MGs.

Nevertheless, the system can be improved by considering the distribution losses and constraints in the optimization. Since the present work focuses on small scale MGs e.g., smart home, where all generations and consumption units are in the same location, the losses are not significant; for this reason, this assumption was made. However, one of the future improvements of the present work is to take it into consideration. The authors considered the water heater as a controllable load as it can be easily turn on and off without affecting costumer comfort. Besides, the relatively small size of the controllable power used in this work make it comparable to a water heater. However, in a large Mg, the controllable loads could be considered as the centralized air conditioner, the washing machine or dishwasher which present a bigger power to control. A second optimization layer between MGOs that negotiate the best option for buying or selling the power depending on the market prices could be added. Besides, the grid connected mode was considered in this study. Future works can consider the islanded mode of operation that updates the RT-EMS parameters accordingly.

#### **6. Conclusions**

Smart cities are no longer a future vision but a reality. Technologies are not only shaping our modern life but also helping us to preserve the environment and adopt a more sustainable life. Several cities around the world launch programs aiming to preserve the environment. While some cities choose to promote the use of applications to ease the city traffic and therefore reduce gas emissions, others present incentives to its citizens to produce renewable energy and reduce their consumption during peak hours; In this context, developing a comprehensive EMS that would enhance cities sustainability agenda is a hot topic. Our proposed solution that incorporate fast real time optimization would be a

good asset for sustainable cities. A multiagent RT-EMS based on T-Cell algorithm was implemented and successfully experimented in the smart grid testbed at Florida International University for optimally managing a MG. Three scenarios were tested to show the effectiveness and optimal operation of the MG using the proposed technique. Comparison of simulations and experimental results show the ability of the proposed multiagent T-Cell based RT-EMS in maintaining the stability and smooth operation of the MG. In addition, the modularity and fault tolerance features were easier to implement through the MAS JADE platform. The DDS middleware also allows the interoperability between different components of the system. The results obtained by the multiagent RT-EMS highlight the effectiveness of the proposed algorithm and demonstrate a faster convergence time compared to previous works. The optimum values were obtained faster in terms of computation time as compared to existing techniques. The latency from the proposed system was 43% faster than other heuristic or deterministic methods in the literature. This significant improvement makes this proposed system more competitive for RT applications. Therefore, our proposed EMS could be envisioned as a real solution for future RT operating MG. Furthermore, this EMS could also be implemented in smart homes or smart buildings that integrate RE and need RT EMS. Through the use of RT-EMS, the MG operator not only guaranties reduction of energy consumption cost, but also, assure the maximum utilization of available RE. As a consequence, the system is more resilient and participate in reducing the negative environmental impact. The RT-EMS also apply DR when needed, which have a positive impact on the distribution system during peak hours.

**Author Contributions:** F.Z.H. conceived, implemented the software and wrote the original draft. A.F.E. and M.M.E. contributed to the experimental, review and editing work. N.K. is the responsible for funding acquisition and contributed to work investigation and supervision. N.H. contributed with materials tools and supervision. O.A.M. is the supervisor who leads the project and edits the manuscript and he is the corresponding author.

**Funding:** This research was funded by IRESEN in the framework of the Inno-PV research project "SECRETS—Sustainable Energy Clusters Realized Through Smart Grids" and the Fulbright Join Supervision program.

**Acknowledgments:** This work was supported by Energy Systems Research Laboratory, Department of Electrical and Computer Engineering, Florida International University, Miami, Florida USA.

**Conflicts of Interest:** The authors declare no conflict of interest.
