# Phase Balancing and Reactive Power Support Services for Microgrids
## 3 Advanced PV/ESS Controller
### Proposed PQ Controller with Sharing Strategy for Ancillary Services  
A new PQ controller is developed for enabling the operation of the inverter for injecting the produced PV or ESS power into the grid while providing phase balancing and reactive support services. The PQ controller calculates the available capacity (\(\hat{l}_{as}\)) of the inverter that can be used for ancillary services as defined in Equation (1),  
\[\hat{l}_{as}\ =\ \sqrt{l_{nom}^{2}-\left(i_{d-inv}^{+1}\right)^{2}}, \tag{1}\]  
where \(i_{d-inv}^{+1}\) is the projection of the positive sequence inverter current on the \(d\)-axis expressed in the synchronous reference frame (corresponds to the active power injection) and \(I_{nom}\) is the nominal-rated current of the inverter. The available capacity for ancillary services is calculated by each inverter participating in the control scheme and is sent to the MGCC through Modbus TCP/IP protocol. The MGCC online coordinates the available capacity of each inverter for ancillary services provision (\(\hat{l}_{as-n}\)), where \(n\) represents the \(n^{\text{th}}\) inverter participating in the scheme and uses this information to properly allocate the required support to each smart inverter. Further, the available current capacity for ancillary services of an inverter (\(\hat{l}_{as}\)) can be used for providing both reactive power compensation and phase balancing support while ensuring that the  
Figure 2: Overall structure of an advanced grid tied inverter with sharing capabilities between reactive power and asymmetric currents into the grid. inverter rated current is never violated. The MGCC will be responsible to determine the fair sharing between the two ancillary services considering the real-time loading conditions of the MG. Therefore, a sharing constant (\(k\)) will be calculated by the MGCC as a ratio between the required reactive power compensation and the required phase balancing support that each inverter should provide in order to achieve the central controller objectives, as will be explained in detail in Section 4.1. Therefore, the proposed PQ controller of each inverter considers the sharing constant (\(k\)) as an input for the MGCC that is able to coordinate the sharing strategy between the two ancillary services. When \(k>1\) then the reactive power compensation is prioritized, when \(k=1\) the sharing strategy equally distributes the ancillary services between reactive power compensation and phase balancing support and when \(k<1\) the strategy prioritizes the phase balancing service. As a result, the PQ controller needs to consider the sharing factor to determine the available current capacity for reactive power support (\(\hat{l}_{\textit{Q}_{\textit{inv}}}^{+1}\)) and the available current capacity for negative sequence injection-phase balancing support (\(\hat{l}_{\textit{inv}}^{-1}\)), while ensuring the rated current of the inverter (\(I_{\textit{nom}}\)). For calculating the available current capacity for each ancillary service, a detail analysis of the current injection by the inverter is required. Under a multi-functional operation of the inverter, the current injection contains both positive and negative sequence current as shown in Equation (2),  
\[\textbf{i}_{\textit{inv}}\ =\ \textbf{i}_{\textit{dq-inv}}^{+1}\ +\ \textbf{i}_{\textit{dq-inv}}^{-1}\ =\ \left[ \begin{array}{c}i_{\textit{d-inv}}^{+1}\\ i_{\textit{q-inv}}^{+1}\end{array} \right]\ +\ \left[ \begin{array}{c}i_{\textit{d-inv}}^{-1}\\ i_{\textit{q-inv}}^{-1}\end{array} \right]\, \tag{2}\]  
where \(\textbf{i}_{\textit{dq-inv}}^{+1}\) and \(\textbf{i}_{\textit{dq-inv}}^{-1}\) is the positive and negative sequence current injection by the inverter expressed in the \(dq\)-frame as they are calculated by the decoupling network [13; 24].