## 3 Primary Controller Design
### Inner Current Controller  
The set of equations that describe the behavior of the system illustrated in Figure 2 is summarized in Equations (4)-(6) for the SESS module, BESS module, and main dc bus. The control variables \(u_{b}\) and \(u_{s}\) are binary signals taking the values 1 or 0 for power transistor activation and deactivation, respectively. \[L_{s}\frac{di_{L_{s}}}{dt} =v_{s}-v_{bus}(1-u_{s}) \tag{4a}\] \[C_{s}\frac{dv_{s}}{dt} =\frac{v_{sc}-v_{s}}{R_{s}}-i_{L_{s}}\] (4b) \[C_{sc}\frac{dv_{sc}}{dt} =\frac{v_{s}-v_{sc}}{R_{s}}\] (4c) \[L_{b}\frac{di_{L_{b}}}{dt} =v_{b}-v_{bus}(1-u_{b})\] (5a) \[C_{b}\frac{dv_{b}}{dt} =\frac{v_{ocv}-v_{b}}{R_{b}}-i_{L_{b}}\] (5b) \[C_{bus}\frac{dv_{bus}}{dt} =i_{L_{s}}(1-u_{s})+i_{L_{b}}(1-u_{b})+i_{SST}-i_{EV} \tag{6}\]  
The surface in (3) induces sliding motions in the system using the control law in (7) [20; 21; 22]. The value \(\Delta\) corresponds to a hysteresis band that will provide the required finite switching frequency in a laboratory implementation and lead to a peak-to-peak current ripple of \(2\Delta\) in the inductors. Figure 4: Cascade control loop structure. \[f(x)= \begin{cases}0,&\text{if }S_{j}(x)<-\Delta\\ 1,&\text{if }S_{j}(x)>+\Delta\end{cases}  \tag{7}\]  
with \(j=[b,s]\). The existence of a sliding motion implies the accomplishment of the invariance condition [23] for each ESS module, resulting in the equivalent control \(u_{j_{0}}\) expressed in (8) and the corresponding ideal sliding dynamics of the HESS given by (9). \[u_{j_{0}}=1-\frac{v_{j}}{v_{bus}}+\frac{L_{j}}{v_{bus}}\frac{di_{ej}}{dt} \tag{8}\]  
\[i_{s}=i_{es} \tag{9a}\] \[i_{b}=i_{eb}\] (9b) \[\frac{dv_{sc}}{dt}=\frac{1}{C_{sc}}\frac{v_{s}-v_{sc}}{R_{s}}\] (9c) \[\frac{dv_{s}}{dt}=\frac{1}{C_{s}}\bigg{(}\frac{v_{sc}-v_{s}}{R_{s} }-i_{L_{s}}\bigg{)}\] (9d) \[\frac{dv_{b}}{dt}=\frac{1}{C_{b}}\bigg{(}\frac{v_{OCV}-v_{b}}{R_{ b}}-i_{L_{b}}\bigg{)} \tag{9e}\]  
\[C_{bus}\frac{dv_{bus}}{dt}=\bigg{(}i_{es}\bigg{[}1-\frac{v_{s}}{v_{bus}}+\frac {L_{s}}{v_{bus}}\frac{di_{es}}{dt}\bigg{]}+i_{eb}\bigg{[}1-\frac{v_{b}}{v_{bus }}+\frac{L_{b}}{v_{bus}}\frac{di_{eb}}{dt}\bigg{]}+i_{SST}-i_{EV}\bigg{)} \tag{9f}\]  
Linearizing the ideal sliding dynamics around the equilibrium points \(\overline{l_{s}}\), \(\overline{V_{s}}\), \(\overline{l_{b}}\), \(\overline{V_{b}}\), and \(\overline{V_{bus}}\) yields the linearized Equation (10) for the entire system. \[\widetilde{i_{s}}=\widetilde{i_{s}} \tag{10a}\] \[\widetilde{i_{b}}=\widetilde{i_{eb}}\] (10b) \[\frac{\widetilde{dv_{sc}}}{dt}=\frac{1}{C_{sc}}\frac{\widetilde{v _{s}}-\widetilde{v_{sc}}}{R_{s}}\] (10c) \[i_{s}=i_{es} \tag{9a}\]0 (10d) \[i_{s}=i_{es} \tag{9a}\]1  
\[i_{s}=i_{es} \tag{9a}\]2 \[i_{s}=i_{es} \tag{9a}\]3  
where  
\[i_{s}=i_{es} \tag{9a}\]4  
To facilitate the control design, Table 1 provides a summary of seven transfer functions \(G_{pqj}(s)\) derived from (9) in which the inductor currents are related to another state variable. The nomenclature of the transfer functions uses three sub-indexes: the first one \"\(p\)\" differentiates the direction of the power flow, i.e., \"\(c\)\" is employed when the inductor current flows from the bus to the ESD, while \"\(d\)\" is used for the opposite direction. The second one, \"\(q\)\", indicates the type of state variable being controlled, i.e., \"\(c\)\" for the current and \"\(v\)\" for the voltage. The ESS modules in turn are referenced with \"\(s\)\" for the ESS module and \"\(b\)\" for the BESS module.