*2.1. Classification of Loads*

The connected loads in the microgrid are classified into multiple clusters to have efficient load management. The major classification is in three clusters: (i) secured critical loads; (ii) non-secured-critical loads and (iii) non-secured, non-critical loads [13]. Typically, all critical loads are a non-shedable loads, which must be served at all the time irrespective of the source of generation and cost of energy [14]. Loads that are classified as non-critical can be scheduled to achieve economic operation. Under these two major classifications, there are subsets that are distinguished as forecastable and non-forecastable loads [15]. This piece of information will help in realizing economic demand and response management (DRM) [16].

#### *2.2. Control of Air Conditioning Loads*

The cooling system is one of the major and critical energy consuming loads in any premise. Efficient management of this critical load is important to achieve economic operation. The control algorithm of a cooling system is based on an analogy between the caloric behaviour and electro kinetics and steady state operating conditions have been considered for modelling. The generation of cold source is equivalent to the cold energy stored in the walls and in the atmospheric air, during this process, there will be a loss of energy. The cooling production can be derived using Equation (1), where Tout is the outdoor temperature, *T*(*t*) is the indoor temperature, *C* is the total thermal building Capacity, *Rth* is the total thermal building resistance, *φ<sup>s</sup>* is the building cooling production. In Equation (3), *τ* = *RthC* is the building time constant.

$$\phi\_s = \mathbb{C}\frac{dT(t)}{dt} + \frac{1}{R\_{th}}(T(t) - Tout) \tag{1}$$

During load shedding operation, the cooling production is stopped: *φ<sup>s</sup>* = 0.

$$Tout = R\_{th} \mathbb{C} \frac{dT(t)}{dt} + T(t) \tag{2}$$

$$T(t) = Tout + (T\_0 - Tout) \times e^{-t/\tau} \tag{3}$$

Figure 5 shows the cycle diagram for cooling system load management, where based on the occupancy and temperature sensor input the load will be operated as per the cycle diagram. During time interval T1, the shedding command for the cooling system is activated, which will allow the room temperature to rise, but this will be maintained so as to not to reach the discomfort zone. The entire cooling system will remain shut off during the time interval T2, this is the maximum time interval for shedding affecting the comfort of occupants. During time interval T3, the shedding command will be withdrawn and temperature will start reducing till the cool set limit is reached. T4 time interval is minimum time duration required to restore the comfort temperature level. Equation (4) helps to calculate T2, while the production is stopped: *φ<sup>s</sup>* = 0 and Equation (5) helps to calculate T4. The main objective of this algorithm is to determine the time interval to attain Tcool after T2 duration, where temperature is equal to Twarm. The flow chart for the cooling system control based on the mode of operation and cost of energy is shown in Figure 6. When the grid is available (Is Grid ok = 1), then the controller will look for the cost of energy, and based on the user set point for high, low and medium cost values through the user interface, the controller will activate the respective mode of operation.

**Figure 5.** Cooling load management cycle diagram.

**Figure 6.** Cooling system control flow chart.

$$\frac{dT(t)}{dt} = -\frac{1}{R\_{th}C}(T(t) - Tout(t))\tag{4}$$

$$\frac{dT(t)}{dt} = \frac{\phi\_s}{C} - \frac{1}{R\_{th}C}(T(t) - Tout(t))\tag{5}$$

Figure 7 shows the typical cooling load control during time interval T2, where the load will be in off condition. Here the Tcool limit is set to 25 ◦C, Twarm limit is set to 30 ◦C, Total thermal resistance *Rth* = 0.00018 K/W, building time constant *τ* = 30, with these parameters, the experimental results are confirmed to be 38 min of T2, which means the cooling load was in off state with the occupancy of two people.

**Figure 7.** Typical cooling load off cycle during T2 time till discomfort level.

#### *2.3. Control of Lighting Loads*

Figure 8 shows the lighting system controller. And the Figure 9 shows the control flow chart for lighting load control. The lighting load control algorithm is based on the input from a photo sensor, occupancy sensor and the energy tariff. The EMS also has the provision to override the control by selecting manual mode of operation. If daylight is partially available, then dim control mode will be invoked to reduce the energy consumption. If occupancy is not sensed, then all the lighting loads will be turned off. The lighting controller is designed using the natural light availability from the photo sensor. The optimum required illumination is derived for the total area of surface using the standard lumen method. The availability of natural light is derived from Equation (6). The lighting controller actuator command for illuminating artificial light is calculated from the difference between the required illumination and natural light availability.

**Figure 8.** Lighting system controller.

**Figure 9.** Lighting load control flow chart.

$$L\mathbf{x}\_{\rm in} = \frac{A\_w \pi E\_v}{A\_{\rm in}(1-\rho)}\tag{6}$$

where *Aw* is surface area of window in square meter, *τ* is the light transmittance of the window, *Ev* is the luminance available on the window in lux, *Ain* is the total indoor area of surfaces in square meter, and *ρ* is the mean reflectance of the weighted area of all indoor surfaces. For design purpose, the following parameters have been considered in the analysis: building with a south-facing glass window of area (2.75 m2), and total room area of 48 m2, volume 138 m3 with reasonable thermal inertia, good light transmittance of the window glazing with *τ* = 0.817, the reflectance of all room inner surfaces considered as *ρ* = 0.4. Total electric lights of 13 lamps, 0–1000 lux, 950 W total, and a shading beam. The controller's reference set point for indoor Illuminance = {500–800} lux. With these values the controller was validated to maintain the luminous intensity to the preferred set value based on the other input parameters. Figure 10 shows the integration of lighting load control system into the EMS. If the user decides to disable automatic lighting control through EMS, override option can be used.

**Figure 10.** Lighting load control integration with EMS.

#### *2.4. Control of Water Pump Loads*

Water pumps constitute a considerable amount of load in a microgrid system. Hence the efficient control and scheduling of water pump control is critical for EMS. The level of water from the storage will be detected using a water level sensor, and this input is compared with the set point of the required level and the error signal is supplied to PID controller, the output of this controller is fed to servo motor and in turn operates the gave valve to increase or decrease the water flow to maintain the required level of water. Normally the set point is derived from the upper level sensor, and there will be a provision in the user interface to enter a manual value to supersede the sensor input limit. Figure 11 shows the control system block diagram for the pump controller. The input to the controller comes from the EMS, and Figure 12 shows the flow chart for the control algorithm based on real time pricing.

**Figure 11.** Water pump control system block diagram.

**Figure 12.** Water pump motor control flow chart.

#### **3. Modes of Operation**

The microgrid operation has been classified into two major categories: On grid mode and Off grid mode. During On grid mode of operation, the entire system is powered by the utility grid as well as sustainable energy sources. The sharing of loads between DES is controlled by the EMS as per the defined control algorithm. In Off grid mode of operation, the entire microgrid will be in islanded mode from the utility grid, all the connected loads will be served from the local energy sources and storage system connected in the network. In Transition mode, all the critical loads are served by the UPS and this mode is a state in between On grid mode and Off grid mode [17].

#### *3.1. On Grid Mode of Operation*

Table 3 shows the power flow control between DES and loads based on the cost of energy. The EMS is designed for three main tariff classifications. When the cost of energy is low and PV generation is available, then all the loads are shared between the utility grid and PV source, and any surplus power is used for charging the UPS and BESS based on their SOC [4,18]. When the cost of energy is medium, the available power from the PV source is completely utilized to serve the load and only for any power requirement deficit, the utility grid is used partially. BESS will also share the loads from the stored energy. During this tariff mode, no power is being used for charging UPS and BESS, assuming there are no surplus power available from DES. When the cost of energy is high, the load demand is shared by the DES as a priority and then partially from the utility grid for the deficit. Since the cost of energy is high, non-critical loads will be removed from the network and will be scheduled to operate later during off-peak time. Also, the critical loads will be operated at optimum power consumption mode to reduce the energy bill, like the cooling system will be operated to exploit thermal inertia without compromising comfort levels along with using natural cooling to the possible extent. During this mode, all forecastable loads will be served as the energy will be preserved in storage devices for the loads based on the demand pattern.


**Table 3.** Power sharing between DES, Grid and Loads during On Grid mode of operation.

### *3.2. Off Grid Mode of Operation*

During Off Grid mode of operation, the utility gird will be completely shut off from the microgrid network, and only DES will be present. There are three different combinations of DES operation in Off Grid mode [3,19]. Considering sufficient PV generation is available, during this time, UPS will serve all secured critical loads and BESS will be charged to serve during intermittency periods. All non-critical loads will be erased from the network as it will be scheduled during surplus power flow. When the BESS is drained, then the DG will be turned on and during this period, PV and DG will share the load. UPS will serve all the secured critical loads and simultaneously will charge its back up. Non-critical loads will be curtailed as they will only be served partially due to higher cost of DG power generation. Table 4 shows the power sharing among DES during Off Grid mode [20].

**Table 4.** Power sharing between DES, Grid and Loads during Off Grid mode of operation.


Stability and Power Sharing

In Off Grid mode it is essential that all the connected DES synchronize properly and form a grid. For grid tied inverters, a reference voltage source is required for pumping PV power into the microgrid [21]. In the proposed network, the UPS will provide the reference voltage and help the PV inverter to build power. Once the grid is formed, the stability of the grid is to be maintained by proper control of voltage (V), frequency (F), active power (P) and reactive power (Q). The grid impedance will be checked by PV inverters to sense the grid presence. The PV inverter's active power (P) is controlled as a function of frequency (F) to ensure sustained operation in islanded mode. Figure 13 shows the graph for power versus frequency control to maintain the microgrid stability. When the microgrid frequency reaches a Fstart (50.2 Hz) then the PV inverter starts to reduce the active power generation. Further, if the microgrid frequency increases and reaches a maximum allowable limit Fstop (54 Hz), then the PV inverter disconnects from the microgrid network. The slope will define the derating as % power reduction with regards to change in frequency. The slope can be configured by the user through the HMI.

$$P\_{\mathbf{e}} = \frac{\mathbf{E} \cdot \mathbf{V}}{\chi} \sin \delta \cong \frac{\mathbf{E} \cdot \mathbf{V}}{\chi} \delta \tag{7}$$

$$\mathbf{E} - \mathbf{V} \cong \frac{\mathbf{\chi}\mathbf{Q}}{\mathbf{E}}\tag{8}$$

**Figure 13.** Power gradient diagram for active power (P) versus frequency (F) control function in the PV inverter.

The generic power equation for a generator and corresponding output is given in Equation (7), where Pe is electric power delivered to Load, *E* and *V* are generated voltage and terminal voltage at load respectively. *δ* is the angular displacement between E and V. From Equation (8), it is understood that, the reactive power (Q) controls the voltage (V), when reactive power increases, the output voltage decreases. Figure 14 shows the relation between frequency versus active power and voltage versus reactive power.

Here, *ω* is the angular velocity of the generator (DG or PV generator output), *ωMG* is the angular velocity of the microgrid at the point of common coupling (PCC) [22]. The microgrid output power (P) is controlled by changing the frequency of the PV inverter or prime mover input to the DG, and similarly the reactive power (Q) is controlled by changing the output voltage or excitation to the DG. In Off grid mode, the secondary control is vital to ensure the stability as the sources are not stiff and will easily fall out of sync [23]:

$$\mathbf{f} - \mathbf{f}\_{\mathrm{o}} = -\mathbf{k}\_{\mathrm{p}}(\mathbf{P} - \mathbf{P}\_{\mathrm{o}}) \tag{10}$$

$$\mathbf{V} - \mathbf{V}\_{\mathrm{o}} = -\mathbf{k}\_{\mathrm{Q}}(\mathbf{Q} - \mathbf{Q}\_{\mathrm{o}}) \tag{11}$$

**Figure 14.** Active power (P) vs Frequency (F) relation and Reactive power (Q) vs. Voltage (V) relation at PCC.

Table 5 lists the voltage and frequency trip limits and corresponding disconnection and reconnection time for an Indian grid; these limits are critical for both on grid and Off grid mode of operation [24]. When the line to neutral voltage limit falls below 195.5 V, then within two seconds the system should disconnect, similarly when the line to neutral voltage goes above 310 V, then within 2 s the system should cease operation to avoid any damage to the connected equipment. The same conditions have been tested and validated for reliable operation and control.


**Table 5.** Power sharing between DES, grid and loads during Off Gr.

#### **4. Simulation Results**

The proposed microgrid network shown in Figure 1 has been modelled in MATLAB/Simulink brick by brick and the simulation results are presented in Figures 15 and 16. In the simulation, all the individual sources and loads are modelled using the Simulink libraries. The sources and loads are integrated and simulated for the different operating scenarios. Figure 15 shows the simulation results of On grid mode. From 0 to 0.6 s, only the utility grid and PV generation sources are supplying the entire load and charging the storage units, at t = 0.6 s, the storage unit started sharing loads by discharging its stored energy, hence reducing power drawn from the utility grid. Initially BESS charge was 77 percentage of its full capacity and UPS was at 80 percentage of full charge. From 0 to 0.6 s, the cost of energy from utility is low, at 0.6 s; the system goes to islanded mode of operation, hence the utilization is optimized to ensure reliable operation. During this entire period, DG is in off condition, and the results are captured for active and reactive power supply from all the sources.

Figure 16 shows the simulation results for change in mode of operation from Off grid to On grid mode of operation. From 0 to 0.6 s, the system operates in islanded mode, at t = 0.6 s, the utility grid is restored and the entire network is supported by PV and utility. In the absence of the utility grid, the UPS will continue to provide the reference voltage to the PV inverter and that will ensure continuity of PV generation. All the secure loads are served from the UPS and non-critical loads are curtailed to preserve energy. DG is in off condition during this period. Initially the SOC of the BESS is considered as 77 % and that of the UPS is 80 %. From time 0 to 0.6 s, the BESS discharges and load consumption is optimized to serve all critical loads for a longer duration. The results are confirmed to match the intended results and the transition from one mode to other mode is achieved smoothly without disturbing the system stability and dynamics. Figure 17 shows the results for a change in utility energy tariff, the moment the tariff increases, immediately the EMS controller changes the load sharing pattern and Figure 18 presents the results for load sharing by DES.

**Figure 15.** Simulation results in On Grid mode during low cost of energy tariff.

**Figure 16.** Simulation results in Off Grid mode with PV and BESS as source.

**Figure 17.** Simulation results for power transition in on grid mode during utility tariff change from low to high.

**Figure 18.** Simulation results for load sharing by DES in on grid mode during tariff change from low to high.

Figures 17 and 18 present the response of various sources and the control action by the EMS for the change in tariff for the cost of energy from low to high. Figure 17 shows the grid availability; it is available throughout the simulation period. From 0 to 0.6 s the cost of energy is low and during this period, the BESS stores energy and PV source and grid share the entire load and changes the storage units connected in the network. At 0.6 s, the tariff changes and cost of energy becomes high, the change in graph 1 to 3 represents per unit value, as the increase denotes the change is three times the cost that was present till 0.6 s. Immediately the EMS controller activates economic mode of operation to optimize the consumption and save cost of operation. The charging of BESS and UPS is stopped and the load sharing is done by the BESS, PV and grid. This enables minimum consumption from the utility and facilitates economic operation. However, the consumption from the PV source is unchanged. Figure 18 shows the active and reactive power supplied by PV, BESS and utility grid for the change in tariff condition at 0.6 s.

### **5. Experimental Results**

To test and validate the proposed microgrid energy management system, an experimental prototype microgrid setup has been developed comprising a PV generator (25 kW), BESS (10 kW), UPS (8 kW) and utility grid [25]. The control of individual bricks is achieved by a TMS320F28335 programmable digital signal processor chip from Texas Instruments (Dallas, TX, USA). The overall centralized controller was developed using a model M258LF42DT Programmable Logic Controller (PLC, Modicon, Schneider Electric, Reuil-Malmaison, France). For communication between the subsystems, a TSXETG100 (Schneider Electric, Reuil-Malmaison, France) serial to TCP/IP converter communication module is used.

To set the parameters, a FDM 121 Human Machine Interface (HMI) has been used (Schneider Electric, Reuil-Malmaison, France). The energy management control algorithm has been programmed in the PLC. To emulate the load conditions, lamp load and resistive load banks were used. Figure 19 shows the experimental set up used for this analysis. Detailed testing has been done to validate the performance of EMS under different load and source operating conditions. Figure 20 shows the active power output from the PV generator in islanded mode of operation. In islanded mode of operation, with the reduction in load, the network voltage will increase. To ensure stability of operation, the active power to be derated for the increase in voltage, if the voltage increases to the cut-off limit, the PV generator to be shut off. Figure 21 shows the control of active power as a function of grid frequency in islanded mode of operation [26]. Under this condition, if the generated power from DES is more than the load demand, the surplus power generated from PV source will be diverted to charge the BESS. Immediately after the battery reaches full charge level, the BESS unit will increase the frequency of its output. On detecting this increase in frequency, PV inverter active power to be curtailed as a function of frequency to follow the predefined gradient. The PV generation will ramp up if the BESS voltage level goes down. The results are in conformance to the design. Figure 22 presents the oscilloscope waveform for under frequency fault condition in islanded mode of operation, at instance 'a' the frequency has been reduced to 48.9 Hz, immediately all the loads got shut down command from EMS controller within 120 ms. Figure 23 shows a snapshot of the EMS control screen where the user can activate and deactivate the sources, and loads and change the modes of operation and set the operating parameters.

**Figure 19.** Experimental test set up with EMS controller and DES with load banks.

**Figure 20.** Active power control for the variation in frequency in islanded mode.

**Figure 21.** Active power derating with increase in grid voltage in islanded mode of operation.

**Figure 22.** Microgrid system disconnection during under frequency fault in Off-grid mode of operation.

**Figure 23.** EMS control screen snapshot from HMI.

### **6. Conclusions**

In this paper, a detailed study of a microgrid system has been carried out with the objective to formulate an efficient control algorithm to integrate, manage and control the various power generation sources like PV, DG, BESS, UPS and utility grid with the connected loads. The complexity lies in the smooth transition of load sharing from the PV source to a BESS or the utility grid during the clouding effect on the PV source. Since the penetration of PV sources are on the rise, the intermittency will pose a bigger concern to ensure the stability of microgrid operation during those conditions [27–30]. This problem was tackled by having coordinated control of PV generation and BESS management

for sharing of loads in the network. The authors have proposed a solution to effectively manage the DES and load to achieve stable operation and economic load dispatch in the entire microgrid network [15]. Faster communication topologies were deployed to achieve better response time for the control commands at local as well as centralized controllers. This work can be enhanced by interlinking multiple microgrid networks with a more complex source and load system. The load management and control can be further improvised by using artificial intelligence and optimization techniques as future work. A robust control methodology has been developed and demonstrated in a deterministic way to operate the microgrid network in a sustainable mode. The proposed methodology largely depends on the historical data of load consumption pattern, power generation forecast, and demand forecast.

**Acknowledgments:** There were no funding sources for the proposed investigation, research and its results decimation.

**Author Contributions:** All authors involved and contributed for the proposed research work, and articulated the manuscript for its current decimation format.

**Conflicts of Interest:** The authors declare no conflict of interest.
