## 3 Objectives  
The significance of an effective Energy Management System (EMS) design on the MG cannot be overstated. It is a crucial component of the controller that ensures the optimization of system performance and electrical billing, while also facilitating the achievement of environmental sustainability goals. In this study, the MG is supposed to be controlled in such a way that it would fulfil an objective function that quantifies a multitude of economic and environmental interests [26]. Stability in the power system may refer to the ability of the MG to deliver quality electrical energy reliability in spite of any perturbation, naturally this goal takes priority especially in critical infrastructure. Stability is compromised when the grid deviates dangerously from its setpoint, potentially damaging the connected loads, or when it experiences a blackout. A load current that approaches the maximum capacity of the grid poses a threat to stability, hence, employing peak shaving and valley filling (PS& VF) techniques [27], not only help with cost reduction but also assist tremendously with keeping healthy margins of stability. Additionally, in [28] a study was conducted showing the correlation between PS & VF and reduction of greenhouse gases (GHG) emissions. Of course, PS & VF has its limits depending on ESS characteristics and the flexibility of the end user. A work around this limitation can be achieved by adopting a region of inertial response, this limits the steepness of the grids current subsequently contributing to utility grid stability [29; 30]. There are two means by which an effective management can be achieved. First are methods influencing the utility of end-user I\({}_{\text{ref}}^{*}\), through taxing or rewarding laws that would incentivize the end-user to modify the consumption behaviour, this is referred to as load shifting. A heavy-handed version of load shedding works by outright forcing the rotation of partial blackouts at peak hours between network districts in what is refer to as load shedding [31]. Other than load shedding and load shifting which are of great inconvenience to the end-user, EESS output power production is the only other control option for EMSs [32]. The task of energy management in practice can be also translated to flattening the curve of consumption. The task of flattening the curve not only is economically beneficial to the end-user, moreover it enhances the stability and alleviate the stress on the utility grid during peak demand hours. Ideally, a curve is flattened to its mean value, in practice that is seldom possible, however some insights can be determined from the concept. Figure 12 showcase an arbitrary consumption profile (CP) of a domicile [33]. Ideally, the ESS should be able to charge when the load current is below average and discharge when the current is above the average, that will cause the load profile to turn into a flat line with no steep variation hence much easier to supply and regulate. In reality the ESS system has its own limitation. The fist hard limitation to be discussed is the capacity of storage, this constraint might cause the battery to suddenly disconnect in the middle of its expected operation. When SOC is below or over the allowed threshold, unexpected halt of ESS current can cause system instability; therefore, a mechanism of smooth disengaging from power production must be put in place. Another constraint adheres to the nominal charging and discharging current of the ESS, high crest factor of consumption profile indicates that the load current stay far away from the average line to an extent such that the ESS won't be able to adjust the current to the ideal average value, even with sufficient capacity, in other words and for all practical purposes; it is better to adopt a region of average power consumption rather than a fixed ideal average as illustrated in Figure 13. Average power consumption range is determined according to the capacity of the ESS and its nominal charging and discharging current.