# Stateflow-Based Energy Management Strategy for Hybrid Energy System to Mitigate Load Shedding
## 1 Introduction
Adding to the complexity of the problem is coping with the intermittency of PV power, the need to maintain the level of the state of charge of the ESU within the acceptable limit, and to minimize the fuel consumption of the generators. Despite many studies for the grid-connected system [6; 11], limited research has been done on load shedding. For instance, the optimal power dispatch in solar assisted uninterruptible power supply systems for residential application is investigated in [10; 12]. Both research works, however, focused toward the feasibility of the designed system in terms of costs. Furthermore, the energy management scheme is proposed for hospital buildings in Gaza that experience frequent grid outages [13]. Authors in this work consider the hypothetical scenarios of grid outage; further, their EMS did not analyze the performance of the system at nighttime, i.e., during the absence of PV power. Recently, another research work analyzed the control operation of a microgrid with a PV and diesel generator backup system under the time-of-use (TOU) tariff policy [8]. The case study was performed for a university campus in Kenya, and the performance of the proposed system was investigated under a grid black-out scenario. This work presents a good analysis of the instantaneous response of energy resources during a grid outage. However, in this control operation, the recurring scenario of load shedding is not analyzed. In addition, their design does not include the battery storage system; thus, the charging and discharging behavior during operation cannot be noticed. The main objective of the above studies is to obtain uninterrupted continuity of the power supply, which is also the main aim of this work; however, the EMS introduced in this paper stands out from other studies as it considers an additional constraint in the form of actual load shedding schedule. The paper advances the EMS design by implementing the proposed control using SF, which has not been reported before. Modeling the EMS using SF has many advantages in terms of reducing the complexity and simplifying the control tasks, providing a better understanding of the HES operation, and increasing the ability to reconfigure operating conditions and accommodate new subsystems at any stage. Hence, it makes a good case study of how supply and demand might be balanced on an hour-by-hour basis and grid stability maintained by taking the benefit from the SFs' inherent ability to simulate the event-driven system. The main contributions of this paper are twofold: first, the design of an integrated framework of HES to address the problem of load shedding, and second, the implementation of the EMS in the SF environment and observation of the resiliency of HES using annual data of an actual load shedding schedule and the weather profile (temperature, irradiance) of the studied location. The paper is organized as follows. Section 2 introduces the architecture of the proposed HES used in the test case. It also outlines the hierarchical control objectives implemented through different levels in a hierarchy. Then, the main concepts pertaining to the SF are explained using a simple example. The implementation of the proposed EMS in an SF environment is explained in detail. The modeling methods and the specification of HES components, along with a description of location of the area, is described in Section 3. The case study is based on the load shedding condition imposed on a locality in the city of Quetta, Pakistan. The sun irradiance data are also obtained from the same area. Section 4 demonstrates the operation of HES based on several modes of operation, in an SF environment. Accordingly, the results and discussion part are presented in Section 5. Finally, Section 6 concludes the paper.