*3.1. Primary Control*

The primary control, also named the local voltage control, provides the independent voltage control of each DCES. It exerts into two control actions, namely the TPC control and BBC control. As shown by the scheme in Figure 3, the TPC control regulates the power flow from the RES to the CL and NCL by changing the phase-shift angle, whilst the BBC control aims for a power regulation of the CL.

**Figure 3.** The proposed primary control of the DCES.

The TPC control encompasses three actions: Phase-shift control, decoupling network, and adaptive droop adjustment, as drawn in the diagram of Figure 4 for the *i*th DCES.

The familiar phase-shift control [21] is adopted for TPC to change the power flow from port I to port II and III, where φ12 and φ13 are the phase-shift angles of the drive signals of the H-bridges at ports I and II, and at ports I and III, respectively, so as to regulate the CL voltage to be constant.

**Figure 4.** The control diagram of the three port converter (TPC).

The two ports of the TPC can be regarded as a DAB. As a result, the power equations can be obtained through a superposition theorem and the results are as follows [22].

$$\begin{cases} P\_{12} = \frac{V\_{IN}V\_{NC}{\prime}^{\prime}}{2\pi f\_{s}L\_{12}}\phi\_{12}\left(1 - \frac{\phi\_{12}}{\pi}\right) \\\ P\_{13} = \frac{V\_{IN}V\_{C}^{\prime}}{2\pi f\_{s}L\_{13}}\phi\_{13}\left(1 - \frac{\phi\_{13}}{\pi}\right) \\\ P\_{32} = \frac{V\_{NC}^{\prime}V\_{C}^{\prime}}{2\pi f\_{s}L\_{23}}\phi\_{32}\left(1 - \frac{\phi\_{32}}{\pi}\right) \end{cases} \tag{1}$$

where fs denotes the switching frequency; P12, P13, and P32 denote the power flowing from port I to port II, from port I to port III and from port III to port II, respectively. VNC and VC denote the voltages VNC and VC reflected to port I from port II and port III, respectively. It should be noticed that the power flow is determined by the phase-shift angle between the related two ports.

Based on *P*1 = *P*12 + *P*13 and *P*3 = *P*32 − *P*13, the averaged values of the currents at port I and port III can be expressed as

$$\begin{cases} I\_{IN} = \frac{P\_1}{V\_{IN}} &= \frac{N\_1 V\_{NC}}{2\pi f\_s N\_2 L\_{12}} \phi\_{12} \left( 1 - \frac{\phi\_{12}}{\pi} \right) \\ &+ \frac{N\_1 V\_C}{2\pi f\_s N\_3 L\_{13}} \phi\_{13} \left( 1 - \frac{\phi\_{13}}{\pi} \right) \\\ I\_C = \frac{P\_3}{V\_C} &= \frac{N\_1 V\_{IN}}{2\pi f\_s N\_2 L\_{13}} \phi\_{13} \left( 1 - \frac{\phi\_{13}}{\pi} \right) \\ &- \frac{N\_1^2 V\_{NC}}{2\pi f\_s N\_2 N\_3 L\_{23}} \phi\_{32} \left( 1 - \frac{\phi\_{12} - \phi\_{13}}{\pi} \right) \end{cases} \tag{2}$$

where *IIN* and *IC* denote the averaged currents at port I and port II, respectively.

⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨

It is obviously seen that both the power and current equations are nonlinear forms. To obtain the small signal model, a small-signal perturbation in the form of a small step change is applied around a quiescent operation point, which is designated as *Q*(φ130, φ120).

The elements of the relationship matrix between the current and phase angles are as follows.

$$\begin{cases} G\_{11} &= \left. \frac{\partial l\_3}{\partial \phi\_{13}} \right|\_Q = \frac{N\_1 V\_1}{2 \pi f\_s N\_3 L\_{13}} \left( 1 - \frac{2}{\pi} \phi\_{130} \right) \\ &+ \frac{N\_1^2 V\_2}{2 \pi f\_s N\_2 N\_{32} l\_{23}} \left[ 1 - \frac{2}{\pi} \left( \phi\_{120} - \phi\_{130} \right) \right] \\\ G\_{12} &= \left. \frac{\partial l\_3}{\partial \phi\_{12}} \right|\_Q = -\frac{N\_1^2 V\_2}{2 \pi f\_s N\_2 N\_3 L\_{23}} \left[ 1 - \frac{2}{\pi} \left( \phi\_{120} - \phi\_{130} \right) \right] \\\ G\_{21} &= \left. \frac{\partial l\_1}{\partial \phi\_{13}} \right|\_Q = \frac{N\_1 V\_3}{2 \pi f\_s N\_3 L\_{13}} \left( 1 - \frac{2}{\pi} \phi\_{130} \right) \\\ G\_{22} &= \left. \frac{\partial l\_1}{\partial \phi\_{12}} \right|\_Q = \frac{N\_1 V\_2}{2 \pi f\_s N\_2 L\_{12}} \left( 1 - \frac{2}{\pi} \phi\_{120} \right) \end{cases} \tag{3}$$

The equations of the small signal modeling of the TPC could be expressed as follows.

$$
\begin{bmatrix}
\Delta I\_{IN} \\
\Delta I\_{\mathbb{C}}
\end{bmatrix} = \begin{bmatrix}
\text{G}\_{11} & \text{G}\_{12} \\
\text{G}\_{21} & \text{G}\_{22}
\end{bmatrix} \begin{bmatrix}
\Delta \phi\_{13} \\
\Delta \phi\_{12}
\end{bmatrix} = \mathbf{G} \begin{bmatrix}
\Delta \phi\_{13} \\
\Delta \phi\_{12}
\end{bmatrix} \tag{4}
$$

where Δ*IIN*, Δ*I*C, Δφ13, and Δφ12 are the small-signal perturbation of *IIN*, *IC*, φ13, and φ12, respectively.

$$\mathbf{G} = \begin{bmatrix} G\_{11} & G\_{12} \\ G\_{21} & G\_{22} \end{bmatrix} \tag{5}$$

In Figure 4, since the CL voltage *VC* = *ICRC* and input port current *IIN* are influenced by both φ12 and φ13, a decoupling network is inserted in the TPC control [23] to eliminate the cross influence of the phase angles on the control of *VC* and *IIN*. A decoupling matrix **H** is designed to make **GH** a diagonal matrix to ensure one output is determined by one control input independently. As a result, two equations could be obtained as follows:

$$\begin{cases} \Delta \phi\_{12} ' G\_{21} + \Delta \phi\_{12} ' H\_{21} G\_{22} = 0\\ \Delta \phi\_{13} ' G\_{12} + \Delta \phi\_{13} ' H\_{12} G\_{11} = 0 \end{cases} \tag{6}$$

where Δφ13' and Δφ12' are the small-signal perturbation of the virtual phase-shift angle derived from Δφ13 and Δφ12 in the decoupling control.

Therefore, **H** can be derived and simplified as

$$\mathbf{H} = \begin{bmatrix} 1 & H\_{21} \\ H\_{12} & 1 \end{bmatrix} = \begin{bmatrix} 1 & -G\_{12}/G\_{11} \\ -G\_{21}/G\_{22} & 1 \end{bmatrix} \tag{7}$$

In the control system, there are two control loops, the output voltage loop is designed for port III and the input current loop is related to port I. After the design of the decoupling network, it can be assumed that there are no interactions between these loops.

More details about the phase-shift control and decoupling control of DCES with the CLP-ESU topology can be found in [12].

The third action of the TPC control is the adaptive droop [24] adjustment based on the consensus algorithm, which is firstly utilized in the proposed primary TPC control compared to the existing literature [25]. It is utilized to establish the individual power allocation for each DCES by changing the virtual equivalent resistance *Rdi* (droop coefficient) in the diagram of Figure 4. The modified CL voltage reference *<sup>V</sup>*<sup>∗</sup>*Crefi*of the *i*th DCES is obtained by

$$V\_{\rm Crefi}^{\*} = V\_{\rm Crefi1} - R\_{\rm di}I\_{\rm Ci} \tag{8}$$

where *ICi* and *Rdi* is the CL current and droop coefficient of the *i*th DCES, respectively. *VCrefi*1 is the voltage reference generated by the secondary voltage control, as explained later on.

Thus, the voltage droop can be adjusted to comply with the different load conditions of the DCESs. The adjustment is obtained by updating the droop coefficient *Rdi* as follows:

$$R\_{di} = R\_{d0} - \delta\_{Rdi} \tag{9}$$

where, *Rd*0 is the initial droop coefficient, and δ*Rdi* is its correction term. The calculation of this term is based on the consensus algorithm.

The principle of an average consensus algorithm is explicated in [18]. Let *xi* be the state variable of node *i* in a system, and let node *i* communicate with its neighboring node *j* under a communication weight *aij*, the system is in consensus only when all the state variables are equal to each other. To reach the consensus situation, the state variable *xi* is updated at time *t* by

$$\dot{\mathbf{x}}\_i(t) = \sum\_{j=1}^n a\_{ij} (\mathbf{x}\_j(t) - \mathbf{x}\_i(t)), \qquad i = 1, 2, \dots, n \tag{10}$$

where the dot over *xi* denotes the updated value of *xi*. The communication weight *aij* is a positive quantity that indicates if there is an exchange of information from node *j* to *i* and how much valued is the information. Specifically, *aij* > 0 means that there is communication between nodes *j* to *i*, whilst *aij* = 0 means there is no communication; moreover, a large value of *aij* indicates that node *j* has a high degree of influence on the update of the state variable of node *i*.

The final result of a consensus algorithm is that the state variables of each nodes approach the average of the initial values of all the nodes.

$$\lim\_{t \to \infty} \mathbf{x}\_l^\circ(t) = \frac{1}{n} \sum\_{i=1}^n \mathbf{x}\_l^\circ(0), \qquad i = 1, 2, \cdots, n \tag{11}$$

Based on the consensus algorithm, the correction term δ*Rdi* is carried in four steps: (i) Comparison of current *ICi* of *i*th CL to that of *j*th CL neighbor, (ii) weighting of the current difference (*ICj* − *ICi*) with weight *aij*, (iii) summation of the weighted current differences of the N neighbors, and iv) entering of the summation into a PI controller [24].

$$\delta\_{\rm Rdi} = k\_{\rm Pli} \sum\_{j=1}^{N} a\_{\rm ij} (I\_{\rm Cj} - I\_{\rm Ci}) + k\_{\rm Ili} \int \sum\_{j=1}^{N} a\_{\rm ij} (I\_{\rm Cj} - I\_{\rm Ci}) \,\mathrm{d}t \tag{12}$$

As a result, the update of *Rd* affects the output current and, hence, the output power of each DCES. The BBC control for the *i*th DCES has the diagram in Figure 5, where the voltage reference *VCerfi*2 is generated by the secondary SOC control. It is worthy to note right now that, in general, *VCerfi*1 and *VCerfi*2 are different since they are generated respectively by the secondary voltage and SOC controls. The reference *VCrefi*1 is used to control the TPC and regulate the power consumption of NCL, while the reference *VCrefi*2 is used to change the operation mode of BBC and regulate the power of the battery. The switching signals of the BBC switches *Q*1 and *Q*2 are delivered by two logic AND elements triggered by the output of a PI controller through the PWM generator and the outputs of two comparators.

The operation of the BBC control is as follows. When voltage *VCi* of *i*th CL DC-bus is higher than a predefined value of the reference (e.g., *VCi* > 1.01*VCrefi*2), BBC enters into the buck mode, and DCES operates in the battery-charging mode. When *VCi* is lower than a predefined value of the reference (e.g., *VCi* < 0.99*VCrefi*2), BBC enters into the boost mode, and the DCES operates in the battery-discharging mode. When *VCi* is in between 0.99*VCrefi2* and 1.01*VCrefi*2, the two sides of BBC are isolated from each other, and the DCES operates in the battery-balancing mode.

**Figure 5.** The charging and discharging control of BBC.
