# Phase Balancing and Reactive Power Support Services for Microgrids
## 4 Microgrid Central Controller
### Real-Time Simulation-Base Scenario  
A real-time simulation of the MG has been developed in OPAL-RT (OP5707) to validate the effectiveness of the proposed MGCC to compensate current asymmetries and reactive power as illustrated in Figure 7. Two cores have been utilized to develop the MGCC (core #1) and the microgrid network (core #2) with a fixed control step of 200 us and 50 us respectively. Further, the MG model has been constructed with ARTEMIS library while RT-EVENTS library has been used to develop the detailed models of the grid tied inverters. In addition, a human machine interface (HMI) has been built using the LabVIEW to allow real-time management of the MG through the MGCC. Initially, the proposed MGCC for ancillary services provision was deactivated to create a base scenario for our investigation. The real-time simulation was running for a whole day to investigate the loading conditions of the MG during a typical day according to field measurements. Figure 8 shows the per phase active (\(P_{a}\), \(P_{b}\), \(P_{c}\)) and reactive power (\(Q_{a}\), \(Q_{b}\), \(Q_{c}\)) at the buildings of the MG. As can be seen, a considerable amount of reactive power is absorbed by the buildings causing therefore reduction of the power factor and increase of the energy losses. In addition, asymmetries can be observed among the different phases (\(a\),\(b\),\(c\)) during the whole day of operation. These asymmetries reduce the utilization of the available capacity of the lines for active power and deteriorate the power quality of the grid. Figure 6: Structure of the microgrid central controller. Figure 9 demonstrates the average per minute samples of the active and reactive power produced by the PV plants and the active (\(P_{\textit{grid}}^{+1}\)) and reactive power (\(Q_{\textit{grid}}^{+1}\)) exchange at the MG's PCC. Considering the PVs energy production, the three PV systems were producing the same energy since the buildings are located very close to each other, so they share the same solar irradiation. Hence, Figure 9 shows the generated power only from one of the three PV systems. Further, the ESS was scheduled to operate according to the optimal energy management scheme developed in Reference [9]. It should be noted that other more advanced discharging strategies can also integrated within the ESS inverter to allow cooperation with the PV inverters considering building level energy optimization as in Reference [34]. More specifically, the ESS is scheduled to charge/discharge with 25 kW according to the electricity  
Figure 7: Schematic diagram of the real time simulation. price. The ESS was scheduled to charge from 02:00-04:00 and 14:30-16:30 while it was scheduled to discharge from 09:00-11:00 and 19:00-21:00. It should be noted that an initial state of charge of 50% was assumed during the scenarios. Further, during the base scenario, there is not any control on the reactive power of the PV systems and ESS (\(Q_{PV}\) = 0 kVAr and \(Q_{ESS}\) = 0 kVAr). The scheduling of the DG is performed every day according to the forecasted demand conditions when the MG is grid-connected. It should be noted that in grid-connected mode only the active power  
Figure 8: Active and reactive power per phase at each building. Figure 9: Average active and reactive power of PVs and at PCC. of the DG (\(P_{DG}\)) is dispatched while the reactive power of the DG (\(Q_{DG}\)) is set to 0 kVAr. In cases where the MG is operating in islanded mode, the DG will be the master generator regulating the voltage and the frequency of the MG. In this case study, the active power of the DG was set at 15 kW according to the demand on that particular day and \(Q_{DG}\) was set to 0 kVAr since the MG was in grid-connected mode.