# Design of a Partially Grid-Connected Photovoltaic Microgrid Using IoT Technology
## 2 Microgrid Operation and Control  
Normal operation of a power system requires a perfect balance of active and reactive powers between generation and load as given using:  
\[\sum_{G=1}^{N_{g}}P_{G}=\sum_{L=1}^{N_{L}}P_{L}+P_{loss} \tag{1}\]  
\[\sum_{G=1}^{N_{g}}Q_{G}=\sum_{L=1}^{N_{L}}Q_{L}+Q_{loss} \tag{2}\]  
where \(P_{G}\) and \(P_{L}\) are the generated and load demand active power, respectively. \(Q_{G}\) and \(Q_{L}\) are the generated and load reactive power, respectively. \(N_{g}\) and \(N_{L}\) are numbers of distributed generators and distributed loads, respectively. \(P_{loss}\) and \(Q_{loss}\) are the active and reactive power losses, respectively. Also, there is a considerable power generation reserve that is used to compensate for any violation in generation scheduling during the operational planning phase. Basically, the power system involves continuous transition among three different states as shown in Figure 1. The steady state describes the normal operation of the electrical power system in which there will be a perfect balance of active and reactive powers between generation and demand. The frequency and voltage are used as the indicators for this balance and set to operate within specific allowable limits. The system operates in the emergency state for a specific time according to the type and nature of the disturbance. The emergency state involves a change in either voltage or frequency beyond the allowable limits. The power system control includes mechanisms that respond by fixing the problems and providing restorative actions that may include isolating faulted parts or shedding some loads from the system. Microgrids are quite different from classical power systems due to the intermittent nature of generation resources. The operation of microgrids in both grid-connected and islanded modes has been investigated in the literature [37; 38; 39]. Microgrid operation emphasizes the supply of critical loads during power outages. In this case, some loads are usually disconnected using shedding algorithms that are classified into three main types namely: traditional, semi-adaptive, and adaptive algorithms [37]. The under voltage load shedding (UVLS) algorithm is simple to use and widely used in the literature [40; 41; 42; 43]. In this paper, the UVLS algorithm is used to initiate the load shedding process. However, instead of disconnecting the load from the microgrid, it is transferred to the grid using fast solid-state transfer switches controlled by wireless signals transmitted through a LoRaWAN network and IoT control. Figure 2a shows a simple two-node system with a source or a distributed generation (DG) unit, which feeds a reactive power load through a line segment of resistance and reactance \(R\) and \(X\), respectively [44]. Since the load is a reactive power load, the current is lagging the voltage at the load terminal by an angle \(\theta\). Hence, the source voltage must lead the load voltage by an angle \(\delta\), which is usually referred to as the torque or power angle. This system is also represented by the phasor diagram shown in Figure 2b with the source voltage considered as a reference. In this system, the source voltage is given by \(V_{s}\angle 0\), the  
Figure 1: Operation of modern power systems.