# Phase Balancing and Reactive Power Support Services for Microgrids
## 4 Microgrid Central Controller
### Real Time Hardware In the Loop Investigation of the Proposed Solution  
The proposed MGCC was enabled to validate its performance for the provision of Q-PB service. Figure 10 shows the average per minute samples of the estimated capacity for each ancillary service and the estimated reference values by the MGCC. It should be highlighted that the positive sequence reactive power capacity (\(\hat{Q}_{PV}^{+1}/\hat{Q}_{ESS}^{+1}\)) and negative sequence current (\(\hat{I}_{PV}^{-1}/\hat{I}_{ESS}^{-1}\)) capacity of the PV/ESS must be always less than their reference values to respect the nominal limits of the inverters. Therefore, the reference values generated from the MGCC respects the capacities estimated according to the new PQ controller presented in Section 3. As can be observed in Figure 10, the \(\hat{Q}_{PV}^{+1}\) and \(\hat{I}_{PV}^{-1}\) were reduced during the noon. The reason behind that is the increase of the positive sequence _d-axis_ current of the PV systems caused by the increased solar irradiation that reduces the capacity for ancillary services according to Equation (7). Further, the ESS capacity for positive sequence reactive power (\(\hat{Q}_{ESS}^{+1}\)) and negative sequence current (\(\hat{I}_{ESS}^{-1}\)) is affected from the ESS scheduled cycle. Therefore, the availability for ancillary services provision is considerably reduced when the ESS was charging/discharging.  
As can be seen in Figure 10 the positive sequence reactive power reference of the PV inverters (\(Q_{PV}^{+1*}\)) was decreased during the noon due to the reduction of the weights (\(w_{n}\)) associated with the PV systems caused by the increase of their energy production (reduction of the available capacity for ancillary services (\(\hat{I}_{as}\))). This change on the adaptive weights is also reflected on the ESS in which its reference positive sequence reactive power (\(Q_{ESS}^{+1*}\)) was increased during that time to compensate the availability reduction of the PV systems. In a similar way, the magnitude of the negative sequence reference current of the PV systems (\(\hat{\mathbf{i}}_{PV}^{-1*}\)) and ESS (\(\hat{\mathbf{i}}_{ESS}^{-1*}\)) are also affected by the change of the weights.  
Figure 10: Reference and available capacity of reactive power and unbalance current for PVs and ESS.  
Then, the positive sequence reactive power at the PCC (\(Q_{grid}^{+1}\)) and the negative sequence current at the PCC (\(\mathbf{i}_{grid}^{-1}\)) were evaluated in case when the MGCC was enabled (_MGCC-ON_) and in case of the base scenario where it was disabled (_MGCC-OFF_). The results of the average per minute samples are shown in Figure 11. As can be seen, the \(Q_{grid}^{+1}\) and \(\mathbf{i}_{grid}^{-1}\) were completely eliminated when the MGCC is activated. The proposed central controller concurrently compensates the positive sequence reactive power and negative sequence current according to the loading conditions while respecting the nominal capacities of the inverters. It should be noted that, in case the available capacity of the PVs/ESS is less than the requested reference reactive power and negative sequence current, the inverters would inject the maximum allowable current (\(I_{nom}\)). Hence, the grid reactive power and negative sequence grid current would not be eliminated completely to ensure that the inverters are not over-loaded.  
In case an existing solution (as the one used in Reference [25]) for the inverter controller is used to provide the Q-PB service, priority will always be given to reactive power support while unbalance compensation would be provided only in case there would be enough available inverter capacity. On the other hand, the proposed solution enables the fair compensation of Q-PB service due to the new developed inverter controller while the priority is set according to the loading conditions at the MG's PCC. From the distribution system operator point of view, these remarkable improvements can have a great impact on the power quality, the energy losses and the effective utilization of the grid.