A Designed Energy Management System (EMS) for an Off-Grid Residential Microgrid

This paper proposes an Energy Management System (EMS) of an off-grid residential microgrid comprised of a solar photovoltaic array, wind turbine, and a battery-based energy storage system for a residential building in a remote area. The aim is to design a less complex energy management system that addresses energy resources dispatch challenge in a hybrid residential microgrid. It equitably dispatches resources and manages the generated energy to meet the residential load. The management control system algorithm is implemented using the state machine and simulated in MATLAB/Simulink environment for validation. Three scenarios are simulated, they emulate various contingencies scenarios that might rise due to the intermittency nature of the renewable resources. Simulation results show that the proposed energy management system achieves its design objectives. It maintains the power supply and demand balance, through an appropriate scheduling of resources even during contingency due to the intermittence nature of the renewable resources.


INTRODUCTION
ccess to energy in rural and urban areas is a challenge in developing countries. The reliability of power supply in electrified areas and environmental awareness opens the door for microgrids. The microgrid concept is established as an alternative solution for electrification for remote areas and as a platform for renewable energy integration in urban and suburban networks. Microgrids are defined as a cluster of loads and power generating units operating as a single controllable system with the ability to be connected or not to a grid [1]. Environmental concern and energy security are the main motivations for microgrids concept development [2]. The decarbonisation of the energy production approach to address environmental concerns sets up 1 Centre for Distributed Power and Electronic Systems (CDPES), Cape Peninsula University of Technology (CPUT) PO Box 1906, Bellville 7535, Cape Town, South Africa. Email: a cyubahiro83@yahoo.fr, b giranezam@cput.ac.za (Corresponding Author), c aboalezk@cput.ac.za, d khant@cput.ac.za space and opportunity for microgrids to flourish [3]. Furthermore, the microgrid concept has proved to be an economical alternative to the traditional top-down grid extension for remote areas and improved the reliability of energy supply in urban areas. In addition, it provides the opportunity to cut the cost of energy in urban areas while relieving the pressure off the traditional grid [4][5][6]. The early application of microgrids was in data centres, military bases and remote rural areas [7,8]. Microgrids can be classified as grid-connected or off-grid depending on their mode of operation. They can also be classified as DC or AC microgrids depending on the nature of generated current. Microgrids are also classified according to the beneficiaries or end-users. Thus they can be residential microgrids for one household or community microgrids for the entire community [9,10]. A residential microgrid usually consists of a generation unit or facility, the power conditioning equipment and residential loads, and the grid integration interface for grid-connected operation. Justo et al. [11] have presented a comparison of both systems and analyzed multiple aspects of microgrids benefits. Microgrids can be based on single or multiple renewable technologies. The latter is also referred to as a hybrid microgrid. It has higher reliability than a single technology microgrid, which is limited by the intermittence nature of the renewable source [12]. Thus, hybrid microgrids are characterized by different renewable energy resources, technologies and an energy storage system for an increased power supply reliability. Furthermore, diesel generators can also be associated with a microgrid to form a high reliable hybrid microgrid system immune to the effects of renewable resources intermittently [13,14].
Nevertheless, the benefits mentioned above of a hybrid microgrid system come with challenges: managing various intermittent resources to match the demand. Thus the control strategy, energy and power management schemes are critical aspects for hybrid microgrid operation [15]. The power management deals with operational regulation and interface parameters for each source within the microgrid, while energy management deals with the optimal matching of the load to the available, total power production [16][17][18]. In microgrids, the energy management system relies on control strategies software to achieve optimal resources [19,20].
Various authors reported on different strategies in regards to the energy management system in hybrid microgrids. A comparative analysis of energy management systems is presented in [21]; the authors compared three dispatch strategies for a hybrid energy system consisting of renewable resources, a diesel generator and an energy storage system. The three strategies are cycle charging, peak shaving and load following. They found that the cycle charging strategy was cost-effective. Olatomiwa et al. [22] presented a comprehensive review on energy management strategies in hybrid renewable energy. They analyzed various techniques and strategies used in isolated and grid-connected microgrids. The review scoped the popular approaches into linear programming and artificial intelligence approach, energy management on linear programming or artificial intelligence for a standalone and grid-connected microgrid. It was concluded that the best approach depended on the context and type of renewable energies involved. In [23] a linear programming based energy management system is presented for an islanded hybrid microgrid. The developed algorithm aimed at maintaining the supply-demand balance within the microgrid. An energy management system based on a hybrid automata algorithm and a propositional-based logic is presented in [24] for an islanded microgrid.
Most authors focused on energy management systems for application in grid-tied residential microgrids with enhanced features such as energy prediction, which rely on communication, thus rendering the system complex and expensive for application in off-grid rural areas [25]. Therefore, this paper proposes a simple, reliable and affordable algorithm for an EMS for an off-grid residential microgrid in rural areas. The system is less complex and operates based on the current status of the available resources and the residential demand, with no need for communication. The paper is organized as follows: Section 2 describes the residential microgrid. Section 3 covers the proposed energy management system for the microgrid. Section 4 presents the simulation results, and Section 5 concludes the paper.

SYSTEM DESCRIPTION
The proposed algorithm for the energy management system is applied to a residential off-grid microgrid. The latter consists of a photovoltaic unit (PV), a small wind turbine, an energy storage system (battery bank) and the load. The loads are categorized into three categories: AC, DC, and dump load for energy excess cases. The hybrid microgrid is configured as shown in Fig. 1, and a DC network is used to integrate the renewable resources. Power electronic interfaces are used for wind and PV and AC load interconnection to the DC bus. The PV and wind operate as the primary sources to supply the house loads (AC and DC). A battery-based energy storage is used to mitigate fluctuations in energy from the intermittence nature of the primary sources. The overall sizing of the microgrid was done using Homer software.

Photovoltaic system
The PV system is developed around photovoltaics cells, represented by its equivalent diode model shown in Fig. 2. It consists of a current source and a PN junction parallel with a shunt resistor Rsh and series resistor Rp. The series resistance represents the ohmic losses which occur through the electrical contacts and the resistivity of the cell material, the shunt or parallel resistance Rp is equivalent of the losses in the junction, the Id is the diode current when forward biased, Iph the photocurrent generated current by the cell due to the solar irradiation. I is the output current at the terminals of the solar cell, expressed by equation (1).
In the above equation, A is the ideality factor of the diode, and VT is called thermal voltage, V is the voltage imposed on the diode, I0 is the leakage current or the reverse saturation current of the diode, and Iph is the photocurrent. The output power PPV(t) of PV system in kW at time t is calculated using equation (2) [26]: (2) where: η = energy conversion efficiency of the PV system (%) , A = area of the generator in (m 2 ), I " t = solar irradiance (kW/m2) at time t, 0.005 = temperature correction factor [27], T ' t = outdoor temperature in(ºC) at time t and 25 = standard room temperature (ºC)

Wind System
A small power wind turbine with a horizontal axis permanent magnet synchronous generator is used. The wind turbine converts wind kinetic energy into mechanical energy to drive the generator that produces electrical energy. The turbine's input wind power converted into mechanical power is expressed by equation (3), where A is the wind turbine area through which the wind is flowing, and ρ is the air density.
The extracted mechanical power from wind in watts is given by equation (4), where νu is the upstream wind velocity at the entrance of the rotor blades in m/s and νd is the downstream wind velocity at the exist of the Rotor blades in m/s.
where Cp is the wind turbine rotor power coefficient or Betz limit.

Energy Storage System
Energy Storage System (ESS) is used to store energy excess from the main supply, PV and Wind turbine. The stored energy will be used as a backup during power shortages due to the intermittence nature of the main supply. Batteries are used as an energy storage system. The storage takes place when its state of charge is below 40%. The discharge is triggered by a command from the energy management system when an imbalance between the main supply (PV & wind) and the loads occurs. The energy stored at time t is characterized by equation (8)

EMS DESIGN
The state machine system monitors, controls, and shares energy due to its efficiency and robustness. Hence state machine control has been implemented for energy flow management between intermittent sources and the load. Note that in the present paper, the loads are clustered as load 1or load 2. In this paper, the following conditions are used for energy management: o Conditions of state machine control system • If P "\] ≥ P _ '2 && SOC < 40% The power from renewable sources, Pren, will be used to supply the load, and the excess will be used to charge batteries.
• If P "\] ≥ P _ '2 && SOC > 40% ∶ &&SOC < 90% In this case, the main power Pren available is greater than the demand, and the battery state of charge is at the nominal level of charge; thus, it can charge or discharge at any time. Therefore, the excess power from renewable energy will be used to charge the batteries.
• If P "\] ≥ P _ '2 && SOC > 90% Charing = 0; Discharging= 0; Load1On= 1; Load2On = 1; D _ '2 = 1; In this case, as the SOC of the battery is at its highest level of charging, the excess power from renewable energy will be channeled to the dump load to avoid damage to the battery bank due to over-charging.
• If else P "\] < P _ '2 && 40 < SOC < 90% Charging=0; Discharging= 1; Load1On=1; Load2On= 1; D _ '2 =0; If the renewable energy supply Pren cannot sustain the load demand PLoad, the algorithm will check the battery state of charge. If the battery SOC level is between 40% and 90 %, the power will be drawn from batteries to supply the unsatisfied load. Both loads will be connected, but the dump load will not be connected.
• If else P "\] < P _ '2 && SOC > 90% Charging=0; Discharging= 1; Load1On=1; Load2On= 1; D _ '2 =0; In the case of SOC greater than 90% and the power supplied by the renewable energy source, Pren is not enough to sustain the load demand PLoad, and the battery bank provides the power balance, the algorithm will check the status of the SOC of the battery bank and initiate the required action.
• If else P "\] < P _ '2 && SOC < 40% In case of power deficit due to the intermittence of the renewable resources coupled to the battery when the SOC is below 40%, the algorithm initiates a loadshedding. The latter tries to match the available power Pren to the demand by comparing load 1 and load 2 to the available power Pren. In the instance of the available power Pren is greater than load 1 demand PL1, and then the latter is connected while load 2 is disconnected. Otherwise, the available deficit power is compared to the power demand from load 2 PL2. If PL2 is lower than the available power Pren, load 2 is connected while load 1 is disconnected. Otherwise, the management control system disconnects all loads.

SIMULATION AND RESULTS
To test and validate the performance of the proposed energy management system algorithm, MATLAB/Simulink software environment is used. The residential microgrid load, parameters and renewable resources data modelled and used as a benchmark to test and validated the energy management system are adapted from [28].

Parameters
As shown in Fig. 3, the system comprises of wind and PV systems that supply the power together to sustain the load demand; it also has a battery-based energy storage system. The energy management system controls the battery cycle through switches. The total load consists of AC, DC and dump loads, and the proposed energy management system controls their respective switching in and out from the supply.
The PV model used in this paper is a Soltech PV model and it is a fixed model; the Soltech PV model (and parameters) is available in the Simulink. Therefore, the system is coupled with Maximum Power Point Tracking system known as MPPT, with a Perturb and Observe (P&O) algorithm to extract the maximum possible power from PV. Table 1 shows the parameters of the photovoltaic module used in this system, they are adapted from [28]. The wind model used in this study is a Permanent Magnet Synchronous Generator (PMSG) with 230V, 5kW, and 50Hz. Table 2 shows the parameters of the wind system used as adapted from [28]. The chosen energy storage system is a Lithium-Ion battery based system. Two-rows of 19 Lithium-Ion batteries are connected in series, each with 12V and 20Ah, which gives a total of 228V, 20Ah, and an overall 9120 Wh. Table 3 shows the parameters of the battery-based energy storage system used in this study as adapted from [28].   Table 4 shows the parameters of the DC/DC boost converter used in this paper as adapted from [28].

Fig. 4 presents the state machine subsystem in
Simulink, and the system intends to monitor and control the flow of energy between these intermittent energies sources. The system has three inputs: P _ '2 , Pren and SOC, load power demand, renewable energy power supply and State of Charge of the battery system, respectively. It is upon the status of the mentioned parameters that the energy management system algorithm bases its decision. The latter is translated into an output control signal for Load 1, Load 2, dump load and battery cycles. The system controls output based on the comparison between input values to decide which output is for the next decision. Fig. 5 shows the state machine logic when it is in running mode, which is shown by the boundary turning to blue colour. The proposed energy management system algorithm is implemented in state flow in MATLAB/Simulink to share the generated energy equitably. The left side presents the state of the battery comprised of three states: the default, charging, and discharging of a battery. The default describes the state where the battery is not either charging or discharging (charging = 0; discharging = 0). The other

Simulation Results
Three scenarios have been implemented in this study to test the reliability of the proposed energy management system.

ST Scenario
In this scenario, the initial state of charge of the energy storage system (SOC) is considered as 89%.
According to the criteria set, the SOC is in the range where the battery set can run into either cycle or mode: charging or discharging. The algorithm decides the battery cycle to run with respect to the states or status of the main supply Pren and the load demand PLoad. A slight variation in wind speed and solar radiations is considered, resulting in the output power variation between 5000W and 9000W; the overall load ranges between 2000 W and 8000 W. Fig. 6 shows the simulation results of the load demand, SOC of the battery, power generated by the wind turbine, and power generated by the photovoltaic system. The first row shows that the load profile varies depending on the time. The lowest load recorded is 2000W, and the highest load is 8000W. The second row presents the state of charge of a battery (SOC) which is varying. The 3rd row presents the power from a wind turbine which is not constant due to the wind speed variation input, the 4th row presents the power from PV, the 5 th row presents the power from renewable energy (wind turbine and PV) with the lowest of 5000W and the highest of 9000W, then the 6 th row presents the battery drained or accumulated power. Table 5 shows the results summary of the 1 st scenario parameters and results. From the results mentioned above, we can see that the proposed energy management successfully tracks the variations in power supply, power demand and the state of the charge of the battery, and its control according to the parameters and conditions as specified in Section 3. From the 10 th second, the energy management system algorithm initiates the battery charging as there is enough power supply, and it does stop the charge by 40 th seconds, which corresponds to the SOC is 90%, the battery is fully charged to avoid damage due to overcharging. This scenario proves the ability of the algorithm in following up the changes in the supply and dispatching the available resources in consideration of the actual demand. Moreover its control of the battery charging improves the battery lifespan by avoiding the overcharging.

nd Scenario
For this scenario, the battery-based energy storage system, the initial state of charge (SOC) is changed; and the wind turbine power output varying. The SOC is decreased to 48%, the wind turbine output power decreasing for a short period and PV Syst. The load is gradually increasing from an initial 2000W to 8000W. The simulation runs for 120 seconds, and in Table 6 simulation results summary is shown.
From Fig. 7, the first row shows the load variation from the initial start of 2000 W to a peak load of 8000W. The latter appears on 60 th second to 80 th second. At the start, the management system, taking into consideration the demand, will initiate the battery charging as shown on the 2 nd row on the same figure.
The SOC is increasing consequently. However, at the 60 th second, a sudden increase in power demand, as shown 1 st row of Figure 7, appears simultaneously with a drop in output power from the wind turbine. This causes an imbalance between the power supply and load demand. The PV system power output remains more or less constant, as shown on the 4th row of Fig, 7. The energy system resolves the imbalance by stopping the charging of the battery, hence the constant SOC for that period. The power towards charging the battery is reallocated to supply the load, which stands at 8500W. As shown on the 3 rd row of Fig. 7, from the 80 th second, the wind power output increases again, and the energy management system reconnects back the battery for charging. The 5 th row of Fig, 7 shows the battery cycles for the entire period of the simulation. These results show that the proposed algorithm adapts itself to the changes and successfully manages resources under various conditions. This scenario proves the capability of the proposed energy management system to react fast and efficiently to a sudden change in power demand by taking the right decision of load shielding the battery charging and transfer the power available towards the main load.

rd Scenario
The scenario consists of testing the algorithm's ability to manage energy resources of the residential microgrid in the instance of wind power output drops significantly. The PV system output power drops slightly, but the overall main power supply is reduced, while the load ranges between 3500W and a ceiling of 12000W. The scenario initial SOC is 89% and the simulation runs for 120 seconds. The combined installed capacity of the renewable resources is 11 kV and battery 9000 W. In Fig. 8, the 1 st row shows the load curve as it changes; we observe a variation in load demand that increases gradually to achieve a maximum of 12000W from the 60 th second to 80 th second of simulation. On 55 th second, we observe on the 3 rd row of Fig. 8 a drop in wind turbine output power. It drops to zero; this emulates the intermittence period with no wind; while The PV system output power remains around 3800W, as shown on the 4 th row of Fig. 8, but not enough to satisfy the load demand. The 2 nd row of Figure 8 shows the battery SOC; we observe that the battery is charging up to 90% at 15 th second from the start of the simulation and stops. The energy management algorithm disconnects the battery from charging. As soon as the wind power output drops to zero, the algorithm dispatches the battery for a period ranging from 55 th second to 80 th second to support the PV system to match the overall microgrid load. From the 80 th second, the wind power picks up again while the load decrease from 12000W to 6000W. The system disconnects the battery and sets it to default. From the 100 th, as the decrease in the load demand reaches  Table 7 shows a summary of the results for the 3 rd scenario.
With the three scenarios, it is proved that the the proposed energy management system successfully tracks the load change and dispatches the resources following the predefined criterias. Morever the algorithm can be slightly modified to add new option such as energy export, in the scheme of peer to peer energy trading.

CONCLUSION
The energy access is a challenge for rural community and renewable energy based hybrid residential microgrid emerged as a viable solution. However, the management of these resources requires an energy management system. Thus, this paper proposed an energy management system algorithm for a residential hybrid microgrid system. The later consists of a photovoltaic system (PV), wind turbine, and a battery based energy storage system. The proposed energy management aims at an equitable dispatch of the available power from the renewable resources; and at the same time implement various scheme during contingency that might rise due to the intermittence nature of the renewable energy resources. For testing and validation the system is simulated over a residential off-grid microgrid model developed in Matlab/Simulink environment. Three scenarios are tested , they emulate the normal condition, sudden load increasing combined with a fluctuation in the renewable power resource ; and a complete loss of one resource. The results show that the proposed energy management system, successfully manages the supply and the demand balance within the microgrid. It shows its ability to perform an adequate power resources dispatching during renewable resource energy fluctuations, through the control of energy storage system cycles. By the battery cycles control, the proposed energy management system protects the battery system from overcharging damages. Unlike others systems as presented in the introduction, the energy system presented in this paper is less complex, economic and easy to upgrade. The proposed system can be applied to grid connected or in peer to peer energy trading.