ISSN: 04532198 Volume 62, Issue 04, April, 2020 1989 Comprehensive Modelling of an Optimized Energy Management System for Photovoltaic Standalone Building Alaa Kh Abbas 1* , Adel A Obed 1 , Ahmed J Abid 1 Middle Technical University, Baghdad, Iraq 1 Corresponding author: 1* Abstract—photovoltaic standalone buildings are suffering from energy volatility which mainly caused by weather conditions, for that, it is important to adopt a smart energy management system that able to manage the loads according to the available energy. Add for that the inverter overcurrent fault, which is mainly caused by the loads’ reactive power in a well-designed system. Power factor degrades leads to a decrease in the system’s efficiency and depriving it of the use of all available energy. The proposed system in this article offers a complete solution to manage the consumed energy according to the loads' priorities, available energy, user requirements, and the weather conditions for the day and two days ahead, as well as correct the power factor automatically by reducing the apparent power as well as the total current of the invertor. The presented system adopts an ESP32 microcontroller to monitor and control the loads remotely besides correcting the power factor by adding a capacitive load from capacitors bank and as required. AC power sensors PZEM-004T v3 had been used to monitoring the load's properties include voltage, current, active power, and power factor in the load branches and on the mainline. Results show a promising system that not only managed the consumed energy wisely but also improve the building power factor by 0.9. Keywords: Automatic power factor correction (APFC); PV stand-alone building limitations; Internet of Things (IoT); Renewable energy uncertainty; Smart embedded system. 1. INTRODUCTION In recent decades, the trend towards sustainable and environmentally friendly renewable energy sources has increased due to the high costs of production and distribution of electric energy as a result of population growth, expansion of the global economy and the industrial development that has led to increasing an individual's energy requirements (Sarzynski, Larrieu, & Shrimali, 2012). However, the Disadvantages of renewable energy represented production fluctuation due to the weather conditions, for photovoltaic Output falls and fluctuate due to the movement of clouds and blocking sunlight (Bouraiou et al., 2015), The effect of this volatility is shown at peak time Which requires smart energy consumption management to match the available energy, therefore several methods adopted to solve the problem of oscillating production energy and minimize its effect on users (Shivashankar, Mekhilef, Mokhlis, & Karimi, 2016). Many researchers used different methods to increase the solar system efficiency by tracking the sun (A. Abid, Al-Naima, & Ali, 2012a, 2012b; Ahmed J Abid, 2016; Ahmed J. Abid & Fawzi Al-Naima, 2013), detection and monitoring the system faults (Ahmed J. Abid, Adel A. Obed, & Fawzi M. Al-Naima, 2018; Ahmed Jabbar Abid, Adel A Obed, & Fawzi M Al-Naima, 2018), or designing a smart energy monitoring systems (Dr Ahmed J. Abid, 2017).