## 3 Controller Design
### Controller Design and Stability Analysis
\right], \tag{28}\]  
and the desired closed-loop energy function is  
\[H_{d}(\bar{\mathbf{x}})=\dfrac{1}{2}\bar{\mathbf{x}}^{T}\mathbf{Q}_{d}\bar{ \mathbf{x}}, \tag{29}\]  
with  
\[\mathbf{Q}_{d}=\mathbf{Q}_{d}^{T}=\left[ \begin{array}{ccc}q_{1}&0&0\\ 0&q_{2}&0\\ 0&0&q_{3}\end{array} \right]. \tag{30}\]  
Equating the right-hand sides of (24) and (27) and premultiplying by \(\mathbf{G}^{\perp}(\mathbf{x})\), the so-called matching equation is obtained, which is parametrized by system structure and possible assignable energy functions. For the case of PMSM, we can choose the structure \(H(x)=\frac{1}{2}\mathbf{x}^{T}\mathbf{Q}\mathbf{x}\) for \(H_{d}\). In order to find a solution, the following equalities must be satisfied:  
\[F_{21}q_{1}\bar{x}_{1}+F_{22}q_{2}\bar{x}_{2}+F_{23}q_{3}\bar{x}_{3}=-\dfrac{R }{L}\bar{x}_{2}-\left(\dfrac{n_{p}\bar{x}_{1}-K_{m}}{J}\right)\bar{x}_{3}, \tag{31}\]  
\[F_{31}q_{1}\bar{x}_{1}+F_{32}q_{2}\bar{x}_{2}+F_{33}q_{3}\bar{x}_{3}=-\dfrac{K _{m}}{L}\bar{x}_{2}. \tag{32}\]  
Choosing  
\[\mathbf{Q}_{d}=\left[ \begin{array}{ccc}\frac{K_{1}}{L}&0&0\\ 0&\frac{K_{1}}{L}&0\\ 0&0&\frac{K_{2}}{J}\end{array} \right], \tag{33}\]  
it is possible to assign  
\[F_{21}=F_{33}=F_{31}=0, \tag{34}\]  
\[F_{32}=-K_{m}K_{c}, \tag{35}\]  
\[F_{22}=-RK_{c}, \tag{36}\]  
\[F_{23}=(n_{p}x_{1}-K_{m})K_{d}. \tag{37}\]where \(K_{c}=1/K_{1}\) and \(K_{d}=1/K_{2}\) are design parameters associated with the interconnection and damping, respectively. In order to preserve the structure, we choose  
\[F_{12}=0, \tag{38}\]  
\[F_{11}=-RK_{c}, \tag{39}\]  
\[F_{13}=n_{p}\bar{x}_{2}K_{d}. \tag{40}\]  
Hence, the closed-loop system takes the desired PCH with  
\[\mathbf{F}_{d}=\left[ \begin{array}{ccc}-R_{s}K_{d}&0&n_{p}\bar{x}_{2}K_{c}\\ 0&-R_{s}K_{d}&-\big{(}n_{p}\bar{x}_{1}-K_{m}\big{)}K_{c}\\ 0&-K_{m}K_{d}&0\end{array} \right] \tag{41}\]  
Finally, to prove stability, \(H_{d}(\bar{x})\) is taken as a Lyapunov candidate function  
\[H_{d}(\bar{\mathbf{x}})=\frac{1}{2}\bar{\mathbf{x}}^{T}\mathbf{Q}_{d}\bar{ \mathbf{x}}, \tag{42}\]  
whose time derivative is  
\[\dot{H}_{d}(\bar{\mathbf{x}})=\frac{1}{2}\Big{(}\bar{\mathbf{x}}^{T}\mathbf{Q }_{d}\dot{\bar{\mathbf{x}}}+\bar{\mathbf{x}}^{T}\mathbf{Q}_{d}\bar{\mathbf{x} }\Big{)}. \tag{43}\]  
Substituting \(\dot{\bar{\mathbf{x}}}\) in (43),  
\[\dot{H}_{d}(\bar{\mathbf{x}})=\frac{1}{2}\Big{[}\bar{\mathbf{x}}^{T}\mathbf{Q }_{d}\mathbf{F}_{d}(\mathbf{x})\mathbf{Q}_{d}\bar{\mathbf{x}}+(\mathbf{F}_{d }(\mathbf{x})\mathbf{Q}_{d}\bar{\mathbf{x}})^{T}\mathbf{Q}_{d}\bar{\mathbf{x} }\Big{]},\]  
\[=\frac{1}{2}\Big{[}\bar{\mathbf{x}}^{T}\mathbf{Q}_{d}\mathbf{F}_{d}(\mathbf{x })\mathbf{Q}_{d}\bar{\mathbf{x}}+\bar{\mathbf{x}}^{T}\mathbf{F}_{d}^{T}( \mathbf{x})\mathbf{Q}_{d}^{T}\mathbf{Q}_{d}\bar{\mathbf{x}}\Big{]}, \tag{44}\]  
Taking \(\mathbf{Q}_{d}^{T}=\mathbf{Q}_{d}\),  
\[\dot{H}_{d}(\bar{\mathbf{x}})=\frac{1}{2}\Big{[}\bar{\mathbf{x}}^{T}\mathbf{Q }_{d}\Big{(}\mathbf{F}_{d}(\mathbf{x})+\mathbf{F}_{d}^{T}(\mathbf{x})\Big{)} \mathbf{Q}_{d}\bar{\mathbf{x}}\Big{]}, \tag{45}\]  
\[\dot{H}_{d}(\bar{\mathbf{x}})=-\frac{2\bar{x}_{1}^{2}R_{s}K_{d}}{L_{s}}-\frac {2\bar{x}_{1}^{2}R_{s}K_{c}}{L_{s}}+\frac{2\bar{x}_{2}\bar{x}_{3}K_{m}K_{d}}{ JL_{s}}-\frac{2\bar{x}_{2}\bar{x}_{3}K_{m}K_{c}}{JL_{s}}. \tag{46}\]  
Choosing \(K_{d}=K_{c}\),  
\[\dot{H}_{d}(\bar{\mathbf{x}})=-\frac{2\bar{x}_{1}^{2}R_{s}K_{d}}{L_{s}}-\frac {2\bar{x}_{2}^{2}R_{s}K_{c}}{L_{s}}\leq 0. \tag{47}\]  
Since \(\dot{H}_{d}(\bar{\mathbf{x}})\) is a semi-definite negative. To prove asymptotic stability, the LaSalle's invariance principle is used. Consider the set:  
\[\{\mathbf{x}\in\mathbb{R}^{3}|\dot{H}_{d}(\bar{\mathbf{x}})=0\}, \tag{48}\]  
which implies  
\[\dot{H}_{d}(\bar{\mathbf{x}})\equiv 0\Rightarrow\bar{x}_{1}\equiv\bar{x}_{2}\equiv 0, \tag{49}\]  
According to the system (41),  
\[\left[ \begin{array}{c}\dot{\bar{x}}_{1}\\ \dot{\bar{x}}_{2}\end{array} \right]\equiv\left[ \begin{array}{c}0\\ 0\end{array} \right]\equiv