## 2 Background  
### Microgrid and Energy Management System  
The decentralised electricity generation model has many advantages over the conventional centralised systems that consist of remote generation units. In a centralised generation model, power flows in one direction, from a small number of large generators to many consumers over a long distance. Therefore, the centralised model requires large power plants to meet the demand and significant transmission lines to connect households and businesses with their power source, resulting in colossal air pollutant emissions, wastage of generation, and land use. The fact that it requires a high integration level also means that its system is extremely vulnerable to disturbances in the supply chain. Therefore, its attractiveness is reducing, and the penetration of small-scale decentralised systems or microgrids is emerging and increasingly invested. The microgrid is essentially a local energy grid with control capability and autonomous operation, which can be disconnected from the primary grid when required [3]. In opposition to centralised systems, power in a microgrid flows in both directions. As it is built locally using renewable sources, it is more efficient, more reliable, lower cost, and cleaner than the centralised model. The three main types of a microgrid are remote, grid-connected, and networked microgrids. In this study, a grid-connected microgrid focuses on the most suitable system for commercial and residential buildings. A grid-connected microgrid can operate in either grid-connected mode or stand-alone mode based on the requirement. In grid-connected mode, the microgrid imports or exports the power from and to the grid depending on generation and load conditions and market policies based on contractual obligations. On the other hand, in islanding mode, the microgrid disconnects from the utility when an abnormal condition occurs in the grid, and the microgrid has to satisfy the load with the required level of power quality by utilising the local storage and renewable resources [4]. Therefore, the energy management strategies used are different, and a coordinated control approach for microgrid energy management is required to minimise the errors between the forecasting and real-time data in the schedule, and dispatch layers of the system [5]. The setup of monitoring and optimising energy consumption to regulate the energy flow is commonly known as an energy management system (EMS). A microgrid usually requires an energy management system to assign active and reactive power references, ensuring cooperation between the controllable units to achieve stable and economic operation [5]. The latest research shows that the objective of energy management of a microgrid is to minimise the microgrid's operating costs such as fuel costs, operating maintenance costs, and purchase cost of electricity from the conventional power grids [5]. One of the key features that allow a microgrid energy management system to achieve its objective is to have a robust and accurate forecasting technique of load demand/generation profile capability. In a residential setting, energy management works on optimising energy consumption, equipment efficiency, detecting faults in a deteriorating system, implementing ways to reduce energy wastage, and recovering energy wastage for other purposes. The EMS inferences provide data visualisation to household owners to better understand their usage patterns and recommendations on smart energy usage to drive better behaviour in their daily use. As an effect, maintenance cost is reduced because equipment usage is optimised [6]. Not only capturing and presenting historical data, but an EMS can also help forecast a household or a building's energy consumption by using an intelligent machine learning algorithm. It also allows the developers to accurately identify the sizing of power resources required to meet a built or a new unit's demand.