## 3 Proposed Collaborative Control Algorithm
### Independent Voltage Regulation Algorithm  
According to the voltage tolerance range of the IEEE 1159-2009 standard [37], voltage deviation is divided into voltage rise and voltage drop, respectively. A voltage drop indicates that the root mean square of voltage is between 0.1 and 0.9 p.u. of the rated voltage for a duration of between 0.5 and 1 min, and a voltage drop of more than 1 min is considered to be an undervoltage. A voltage rise indicates that the voltage is between 1.1 and 1.8 p.u. of the rated voltage for a duration of between 0.5 and 1 min, and a voltage rise of more than 1 min is considered to be an overvoltage.  
In the distribution network, the power injected to a node will affect the voltage of other nodes. As a result, the charging and discharging of BESSs at different locations of the grid has different impact on the voltage regulation. Voltage sensitivity matrix control strategy is applied for determining the optimal active power adjustment of each node for the voltage regulation in this study. According to the sensitivity matrix, the nodes with high sensitivity coefficient are preferentially selected in the voltage regulation, and the nodes with low sensitivity coefficient are chosen for the coordinated frequency regulation.  
The voltage sensitivity coefficient [38] can be obtained by the following two power flow calculation formulas  
\[P_{i}=|U_{i}|\sum_{j=1}^{n}\left|U_{j}\right||Y_{ij}|\cos\bigl{(}\theta_{ij}- \delta_{i}+\delta_{j}\bigr{)} \tag{12}\]  
\[Q_{i}=-|U_{i}|\sum_{j=1}^{n}\left|U_{j}\right||Y_{ij}|\sin\bigl{(}\theta_{ij} -\delta_{i}+\delta_{j}\bigr{)} \tag{13}\]  
where \(i,j\) denote the nodes number. \(P,Q,U,\delta,Y\) and \(\theta\) denote, respectively, the active power flow, reactive power flow, phasor bus voltage, voltage angle, line admittance, and impedance angle.  
The system Jacobian matrix is updated at each iteration until convergence tolerance is satisfied, and the resultant Jacobian matrix \(J\) is inversed to compute the \(S\) matrix.  
\[\left[\begin{array}{c}\Delta\theta\\ \Delta U\end{array}\right]=J^{-1}\left[\begin{array}{c}\Delta P\\ \Delta Q\end{array}\right] \tag{14}\]  
Let the S matrix equal to the \(J^{-1}\)  
\[S=J^{-1}=\left[\begin{array}{cc}S_{\theta P}&S_{\theta Q}\\ S_{UP}&S_{\theta Q}\end{array}\right] \tag{15}\]  
The variation of the voltage amplitude \(\Delta U\) and the variation of the phase angle \(\Delta\theta\) is decoupled by Equation (14). \(\Delta U\) can be calculated by Equation (16).  
\[\Delta U=S_{UP}\cdot\Delta P_{V}+S_{UQ}\cdot\Delta Q \tag{16}\]  
If only the active power regulating of the BESSs is considered, then Equation (17) will become  
\[\Delta P_{V}=S_{UP}^{-1}\cdot\Delta U \tag{17}\]  
where \(\Delta P_{V}\) is the power which can regulate the voltage to the permissible range.  
The specific voltage regulation algorithm of each node is divided into five steps, which is shown in Figure 4.  
Step 1: Get the voltage regulation power (\(\Delta P_{VI}\)) of this node from control center.  
Step 2: In order to prevent the BESSs suffering damage while grid voltage being too high or too low, it is necessary to perform grid voltage detection. If the voltage is between 0.1 and 0.9 p.u., the BESS is ready to be discharged. On the other hand, if the voltage is between 1.1 and 1.8 p.u., the BESSis ready to be charged. When the magnitude of the voltage is less than 0.1 p.u or greater than 1.8 p.u., the BESS is disconnected from the system [29; 37].  
Step 3: Detect the SOC value of BESSs in this node by the SOC control strategy shown in Figure 3. Count the number (\(N\)) of BESSs which the SOC is in the normal range. The total regulation amount of this node is evenly distributed to the \(N\) BESSs.  
Step 4: BESSs perform charging or discharging operations.  
Step 5: Perform grid voltage detection again. If Vs is not between 0.9 and 1.1p.u., steps 1-4 are repeated.