## 3 Two-Level Control Design
### Higher-Level Inverse Dynamic Control
\begin{array}{ll}\frac{d}{dt}\big{(}\mathbf{v}_{i}^{*}-\mathbf{v}_{i}\big{)} =\frac{d}{dt}\mathbf{v}_{i}^{*}+j\omega\mathbf{v}_{i}+\frac{1}{\mathbf{C}_{i} }\Bigg{(}\mathbf{i}_{load\ i}-\frac{2}{3}\frac{\mathbf{S}_{i}}{\mathbf{v}_{i} }\Bigg{)}&i=3,\\ \frac{d}{dt}\big{(}{v_{i}^{+}}^{-}-{v_{i}^{+}}\big{)}=\frac{d}{dt}{v_{i}^{+}}^ {*}+\frac{1}{\mathbf{C}_{i}}\bigg{(}\overset{+}{\mathbf{i}}_{load\ i}-\frac{ \mathbf{P}_{i}^{+}}{{v_{i}^{+}}}\Bigg{)}&i=[4;6].\end{array}  \tag{15}\]  
The dynamic voltage error equation should contain, in addition to the tracking error itself, the tracking error integral to enforce null static error, and tracking error derivatives up to the order necessary to obtain explicit dependence of the controlled variable \(\varepsilon_{i}\) from the control variable \(\mathbf{S}_{i}\) or \(P_{i}\). From (15), it is observed that only one derivative term is needed, so that the dynamic voltage error equations are defined as:  
\[ \begin{array}{ll}\eta_{i}=\big{(}\mathbf{v}_{i}^{*}-\mathbf{v}_{i}\big{)}+ K_{1}\frac{d}{dt}\big{(}\mathbf{v}_{i}^{*}-\mathbf{v}_{i}\big{)}+\frac{1}{ \mathbf{K}_{2}}\int{\big{(}\mathbf{v}_{i}^{*}-\mathbf{v}_{i}\big{)}dt}&i=3,\\ \eta_{i}^{+}=\big{(}{v_{i}^{+}}^{*}-{v_{i}^{+}}\big{)}+K_{1}\frac{d}{dt}\big{(}{ v_{i}^{+}}^{*}-{v_{i}^{-}}\big{)}+\frac{1}{\mathbf{K}_{2}}\int{\big{(}{v_{i}^{+}}^{*}-{v _{i}^{+}}\big{)}dt}\\ \eta_{i}^{-}=\big{(}{v_{i}^{-}}^{*}-{v_{i}^{-}}\big{)}+K_{1}\frac{d}{dt}\big{(} {v_{i}^{-}}^{*}-{v_{i}^{-}}\big{)}+\frac{1}{\mathbf{K}_{2}}\int{\big{(}{v_{i}^ {-}}^{*}-{v_{i}^{-}}\big{)}dt}\end{array}  \tag{16}\]  
where \(K_{1}\), \(K_{2}\) are time constants to be assigned to obtain the desired damping and dynamic response. Consider now the system in a sliding condition, so that \(i_{i}=i^{*}\), and, as a consequence, \(P_{i}=P_{i}^{*}\). By substituting (15) in (16), it is possible to obtain the port reference power:  
\[ \begin{split}\mathbf{S}_{i}^{*}=\frac{3}{2}\mathbf{v}_{i}\Big{[} \Big{(}C_{i}\frac{d}{dt}v_{i}^{*}+j\omega C_{i}\mathbf{v}_{i}^{-}+\hat{\mathbf{ i}}_{load\ i}\Big{)}+g_{1i}\Big{(}\mathbf{v}_{i}^{*}-\mathbf{v}_{i}^{-} \Big{)}+g_{2i}\!\int\Big{(}\mathbf{v}_{i}^{*}-\mathbf{v}_{i}^{-}\Big{)}dt \Big{]},\ i=3,\\ P_{i}^{+*}=v_{i}^{+}\Big{[}C_{i}\frac{d}{dt}v_{i}^{*+}+i_{load}^{*}+g _{1i}(v_{i}^{+*}-v_{i}^{+})+g_{2i}\!\int\Big{(}v_{i}^{+*}-v_{i}^{+})dt\Big{]} \\ p_{i}^{-*}=v_{i}^{-}\Big{[}C_{i}\frac{d}{dt}v_{i}^{-}+i_{load}^{* -}+g_{1i}(v_{i}^{-*}-v_{i}^{-})+g_{2i}\!\int\Big{(}v_{i}^{-*}-v_{i}^{-})dt \Big{]}\end{split} \Bigg{\}},\ i=[4;6],\end{split} \tag{17}\]  
where \(g_{1i}=C_{i}/K_{1}\), \(g_{2i}=C_{i}/(K_{1}K_{2})\). Note that (17) provides the reference power that realizes the control of the external port voltages with dynamics assigned by coefficients \(g_{1i},g_{2i}\). Furthermore, one can note that (17) is formally equivalent to a PI regulator with feed-forward/compensation terms: in (17), between square brackets, the first term between round brackets can be considered a feed-forward/compensation term, while the second and third terms are, respectively, proportional and integral terms. After the control of \(\mathbf{v}_{3}\), \(v_{4}\), \(v_{5}\), \(v_{6}\) is defined, control references for ports 1 and 2 are designed in terms of port powers with the aim of controlling the MC internal bus voltage. In these regards, the global reference power that must be absorbed from ports 1 and 2 to maintain the internal bus voltage is defined as \(P_{g}^{*}=P_{1}^{*}+P_{2}^{*}\).