## 3 Controller Design
### Controller Design and Stability Analysis  
In accordance with the approach described in this section, the first step is to construct the open-loop system error dynamics. The PMSM model can be written as  
\[\dot{\mathbf{x}}=[\mathbf{J}(\mathbf{x})-\mathbf{R}(\mathbf{x})]\
abla H( \mathbf{x})+\mathbf{g}\mathbf{u}, \tag{17}\]  
with the vector state  
\[\mathbf{x}=\left[ \begin{array}{c}x_{1}\\ x_{2}\\ x_{3}\end{array} \right]=\left[ \begin{array}{c}L_{s}i_{d}\\ L_{s}i_{q}\\ f\omega\end{array} \right], \tag{18}\]  
where the damping matrix is given by  
\[\mathbf{R}=\mathbf{R}^{\mathbf{T}}=\left[ \begin{array}{ccc}-R_{s}&0&0\\ 0&-R_{s}&0\\ 0&0&0\end{array} \right], \tag{19}\]  
and the interconnection matrix  
\[\mathbf{J}(\mathbf{x})=-\mathbf{J}^{\mathbf{T}}(\mathbf{x})=\left[ \begin{array} []{ccc}0&0&-n_{p}x_{2}\\ 0&0&-K_{m}+n_{p}x_{1}\\ n_{p}x_{2}&K_{m}-n_{p}x_{1}&0\end{array} \right]. \tag{20}\]  
Additionally, take the energy function \(H(x)=\frac{1}{2}\mathbf{x}^{\mathbf{T}}\mathbf{Q}\mathbf{x}\) with  
\[\mathbf{Q}=\left[ \begin{array}{ccc}\frac{1}{L_{s}}&0&0\\ 0&\frac{1}{L_{s}}&0\\ 0&0&\frac{1}{L}\end{array} \right]. \tag{21}\]  
First, we consider the tracking error \(\bar{\mathbf{x}}(t)=\mathbf{x}(t)-\mathbf{x}^{*}(t)\) where \(\mathbf{x}(t)\) is the vector state, \(\mathbf{x}^{*}(t)\) is the desired trajectory, and \(\bar{\mathbf{x}}(t)\) is the trajectory tracking error. Using this error definition with PMSM model, the system error dynamics can be defined as follows:  
\[\mathbf{\hat{x}}=[\mathbf{J}(\mathbf{x})-\mathbf{R}(\mathbf{x})]\
abla H( \mathbf{x})+\mathbf{g}\mathbf{u}-\mathbf{x}^{*}(t), \tag{22}\]  
According to the approach described in this section, the term \(\mathbf{x}^{*}(t)\) represents the dynamics of the desired trajectories which have to be realizable and ensures that, in a closed loop, the PCH structure is preserved. To achieve this goal, we propose, for simplicity, a model that describes the trajectories as  
\[\left[ \begin{array}{c}\dot{x}_{1}^{*}\\ \dot{x}_{2}^{*}\\ \dot{x}_{3}^{*}\end{array} \right]=\left[ \begin{array}{ccc}\frac{-R_{s}}{L_{s }}&0&\frac{n_{p}x_{2}^{*}}{I}\\ 0&\frac{-R_{s}}{L_{s}}&\frac{-K_{m}+n_{p}x_{1}^{*}}{I}\\ 0&\frac{K_{m}}{L_{s}}&0\end{array} \right]\left[ \begin{array}{c}x_{1}^{*}\\ x_{2}^{*}\\ x_{3}^{*}\end{array} \right]+\mathbf{u}_{\mathbf{a}}, \tag{23}\]  
which is the same structure as that of the PMSM model. So, this system has the PCH structure by definition. Then, the open-loop system error dynamics can be described as  
\[\left[ \begin{array}{c}\dot{\bar{x}}_{1}\\ \dot{\bar{x}}_{2}\\ \dot{\bar{x}}_{3}\end{array} \right]=\left[ \begin{array}{ccc}\frac{-R_{s}}{L_ {s}}&0&\frac{n_{p}x_{2}}{I}\\ 0&\frac{-R_{s}}{I}&\frac{-K_{m}+n_{p}x_{1}}{I}\\ 0&\frac{K_{m}}{L_{s}}&0\end{array} \right]\left[ \begin{array}{c}\dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\end{array} \right]+\bar{\mathbf{u}}, \tag{24}\]  
The next step is to design a controller that ensures the origin in (24) is asymptotically stable. For this, consider the Proposition 2. **Proposition 2**. : _Consider the open-loop system error dynamics (24) with a desired equilibrium point_  
\[\bar{\mathbf{x}}^{*}=\left[ \begin{array}{ccc}0&0&0\end{array} \right]^{T}, \tag{25}\]  
_The control law_  
\[\mathbf{u}=\left[ \begin{array}{c}-\dfrac{R_{s}(K_{d}-1)}{L_{s}}\bar{x}_{1}+ \dfrac{n_{p}}{J}\eta_{1}+\dfrac{n_{p}K_{c}}{J}\bar{x}_{2}\bar{x}_{3}\\ \dfrac{R_{s}(K_{d}-1)}{L_{s}}\bar{x}_{2}-\dfrac{n_{p}K_{c}}{J}\bar{x}_{1}\bar{x }_{3}+\dfrac{n_{p}}{J}\eta_{2}+K_{m}\bar{x}_{3}\end{array} \right], \tag{26}\]  
_where \(\eta_{1}=x_{2}x_{3}-x_{2}^{*}x_{3}^{*}\) and \(\eta_{2}=x_{1}x_{3}-x_{1}^{*}x_{3}^{*}\), renders \(\bar{\mathbf{x}}^{*}\) asymptotically stable with all internal signals bounded._  
Proof. : Assume that the closed-loop system error dynamics is  
\[\dot{\bar{\mathbf{x}}}=\mathbf{F}_{d}\
abla_{\bar{\mathbf{x}}}H_{d}(\bar{ \mathbf{x}}), \tag{27}\]  
with  
\[\mathbf{F}_{d}=\left[ \begin{array}{ccc}F_{11d}&F_{12d}&F_{13d}\\ F_{21d}&F_{22d}&F_{23d}\\ F_{31d}&F_{32d}&F_{33d}\end{array}