## 3 Controller Design
### Speed Loop Controller Design  
The process of the system reaching the sliding surface from any initial state is called reaching motion, the sliding mode accessibility condition can only ensure that the system state can reach sliding surface, but there is no limitation on the motion trajectory. The reaching law can make the system  
Figure 1: The block diagram of permanent magnets synchronous motor (PMSM) speed-regulation system. state reach sliding surface according to the designed trajectory and improve the dynamic quality of reaching motion. The differential equation of mechanical angular speed is shown as:  
\[\dot{\omega}=\frac{n_{p}\psi_{f}}{J}i_{q}-\frac{T_{L}}{J}-\frac{B_{m}\omega}{J} \tag{2}\]  
Define the state variable is defined as:  
\[x=\omega^{*}-\omega \tag{3}\]  
where \(\omega^{*}\) is reference speed. Because the first-order model of PMSM is adopted, so \(i_{q}\) is approximately equal \(i_{q}^{*}\). Conventionally, the response time of current loop is faster than speed loop, if control period of speed loop is more than 10 times of current loop, the approximate error can be neglected. The state equation can be rewritten as:  
\[\dot{x}=ax+bi_{q}^{*}+d \tag{4}\]  
where \(a=-\frac{B_{m}}{J}\), \(b=-\frac{n_{p}\psi_{f}}{J}\), \(d=\frac{T_{L}}{J}+\frac{B_{m}}{J}\omega^{*}\). There are two main disturbances in PMSM operation: external disturbance which includes load change and reference signal change, and inertial disturbance which includes parameters change and unmolded dynamics. As we know the disturbance of the system mainly consists of the following three parts: (1) disturbance caused by load change, (2) disturbance caused by speed change, (3) disturbance caused by reference speed change. However, it would be difficult to observe their disturbances separately, so we define the set of all disturbances as lumped disturbance \(R\), and the same effect can be achieved by compensating the lumped disturbance \(R\). Indeed, we expended \(R\) as a new state variable \(x_{2}\); \(x\) defined as \(x_{1}\), and establishes a new second-order model. \[\left\{ \begin{array}{l}\dot{x}_{1}=x_{2}+b\dot{i}_{q}^{*}\\ \dot{x}_{2}=\dot{R}\end{array} \right. \tag{5}\]  
\[R=\frac{B_{m}}{J}\omega+\frac{T_{L}}{J} \tag{6}\]  
where \(\frac{T_{L}}{J}\) is the disturbance caused by load change, \(\frac{B_{m}}{J}\omega\) is the viscous friction disturbance caused by speed change. The ESO is designed as:  
\[\left\{ \begin{array}{l}\dot{z}_{1}=z_{2}+\alpha_{1}(x_{1}-z_{1})+b\dot{n}_{ q}^{*}\\ \dot{z}_{2}=\alpha_{2}(x_{1}-z_{1})\end{array} \right. \tag{7}\]  
where \(\alpha_{1}\), \(\alpha_{2}\) are constant gain, \(z_{1}\), \(z_{2}\) are the estimated values of speed error and lumped disturbance, respectively. The high-gain error feedback in ESO makes the observer dynamic much faster than system; ESO is equivalent to the fast-changing subsystem in the system, which can ensure the fast convergence of the error and high estimation accuracy. But the high gain observer will produce a peak when initial set value differs greatly from system actual value. For example, for a step reference signal, the initial value of error \(e=\omega^{*}\) at \(t=0\) s. Large error can cause a large initial impact on system to cause a peak. For peak caused by difference initial value, a transition process is designed. \[\beta= \begin{cases}100(\frac{t}{t_{j}})^{3},&0\leq t\leq t_{j}\\ 100,&t\geq t_{j}\end{cases}  \tag{8}\]where \(t\) is time, \(t_{j}\) is transition time, \(\beta\) is a gain. In the initial stage \(t\to 0\), \(\beta\to 0\), which mitigate peak caused by different initial values, with \(t\to t_{j}\), \(\beta\); can smoothly transit to the normal gain value. The ESO can be redesigned as:  
\[\left\{ \begin{array}{l}\dot{z}_{1}=z_{2}+\alpha_{1}\beta(x_{1}-z_{1})+bi_{q}^ {*}\\ \dot{z}_{2}=\alpha_{2}\beta(x_{1}-z_{1})\end{array} \right.