PMSM sliding mode control based on novel reaching law and extended state observer

To improve the dynamic quality and control performance of the permanent magnet synchronous motor speed control system, a novel sliding mode control method with improved reaching law for PMSM was proposed, which has a shorter reaching time and small system chattering. An extended state observer (ESO) based on the hyperbolic tangent function for the sliding mode controller is designed to realize the real-time tracking of the mechanical angular velocity and load disturbance of the motor, which can weaken the influence of the internal parameter perturbation and external load disturbance. The performance of the novel sliding mode controller for PMSM was simulated based on MATLAB/Simulink. An experimental platform based on dSPACE is built. The simulation and experimental results show that this novel PMSM controller can effectively suppress the system chattering and improve the dynamic performance and robustness of the system.


Introduction
Permanent magnet synchronous motor (PMSM) is widely used in various industries because of its simple structure, high power density and good dynamic performance. However, PMSM is a typical nonlinear multivariable coupling system whose parameters such as flux linkage and d-and q-axis inductance are changed due to magnetic saturation during operation, which caused uncertainty of the control effect. The stability of the control system is highly influenced by the external environment. The performance of the traditional PID controller depends on the accuracy of the system model, which is highly influenced by external disturbances. [1][2][3] Therefore, it is necessary to adopt a better control method to solve the above problems. Various control methods are proposed by researchers around the world in recent years to solve the above problems, such as adaptive control, 4,5 active disturbance rejection control, 6,7 model predictive control, [8][9][10] and sliding mode control. [11][12][13] Sliding mode control is widely used among them, due to its strong robustness, fast response speed, and insensitivity to the change of internal and external parameters perturbation of the system. However, the chattering problem existing in the traditional sliding mode control has become a barrier to improve the control performance. Therefore, scholars have proposed solutions from many different 1 perspectives. Slotine and Sastry 14 introduced the concepts of ''quasi-sliding mode'' and ''boundary layer'' in the design of sliding mode control and also used the saturation function instead of the switching function to effectively avoid or weaken the chattering. Kawamura et al. 15 designed a new type of disturbance observer to eliminate the chattering caused by the large switching gain of the system, which greatly reduces the switching gain and effectively suppresses the chattering by feedforward compensation of the external disturbance. By using the concept of convergence law, Gao 16 proposed a chattering elimination method for variable structure control systems.
Among these methods to weaken the chattering, the method of approaching law can ensure the dynamic characteristics and stability of the system, but the traditional exponential and power approaching laws cannot achieve the fast convergence to the sliding mode surface while avoiding chattering. For this purpose, Wang et al. 17 introduced a variable exponential reaching law in the sliding mode controller for PMSM with improved stability of the control variable near the sliding mode boundary. Zhang et al. 18 introduced exponential terms and system state variables based on the traditional power reaching law, which effectively solved the problem of slow reaching speed when the power reaching law is far from the sliding surface. Liu et al. 19 added a terminal attractor based on the traditional exponential reaching law to improve the dynamic quality of the speed control system, but the controller design is complex and the parameter adjustment is difficult. A saturation function was proposed by Dai et al. 20 for solving the chattering problem caused by the sign function, which weakens the chattering of the system and speeds up the convergence speed, but the quality of boundary layer selection directly affects its performance. Qu et al. 21 proposed a fast power reaching law to solve the problem of slow approaching speed when the system is far from the sliding surface, which realizes the global fast convergence of the system, the chattering of the system was suppressed through the introduction of state variables in the controller. Inspired by the above works, this paper proposes a PMSM sliding mode control strategy based on a novel convergence law and an extended state observer. Firstly, a novel reaching law is designed. Different exponents of the power term are selected according to the distance from the sliding surface, and the system state variables are introduced into the exponent term. A new reaching law with variable exponent power term and variable exponent coefficient is constructed, which effectively weakens the chattering of the system under the premise of maintaining the fast reaching speed of the control system. At the same time, an ESO based on hyperbolic tangent function is designed to realize realtime observation and accurate tracking of motor angular velocity and load disturbance, and then the observation value is feedforward for chattering compensation. The performance of the novel sliding mode controller was numerically simulated in MATLAB/ Simulink and validated through a dSPACE-based PMSM control performance test platform. The simulation and experimental results show that the proposed control strategy has better dynamic characteristics and better anti-chattering characteristics compared with PID control and traditional sliding mode control.
The main contributions of this paper are as follows: 1. The inherent chattering of sliding mode control is a key factor affecting its control performance. The reaching law proposed in this paper can weaken the inherent chattering of sliding mode control, shorten the reaching time, and improve the control performance of the system. 2. An extended state observer based on hyperbolic tangent function is designed to realize the observation of external disturbance and system parameter perturbation, and then feedforward compensation is carried out to the sliding mode controller to improve the anti-interference ability and fast response ability of the system.
The main structure of this paper is : In the second section, a new reaching law is proposed and the superiority of the new reaching law over the traditional exponential and power reaching law is verified by simulation. Section 3 designs a sliding mode controller based on ESO and verifies its stability. The discretization of the controller is arranged in the fourth section. Sections 5 and 6 show the effectiveness of the control strategy by simulation and experiment. Finally, the seventh part is the conclusions of the study.

Traditional reaching laws
In sliding mode control, the reaching law is often introduced to improve the dynamic quality of sliding mode control. Among them, exponential reaching law and power reaching law are commonly used, such as equations (1) and (2) respectively. _ s = À esgn(s) À ks ð1Þ Where e is a constant greater than zero, s for system sliding surface, k is an exponential coefficient, k . 0, q is a constant greater than zero and d is an exponential term. The analysis of traditional exponential reaching law and power reaching law shows that the traditional exponential reaching law is composed of constant velocity term and exponential term. When the system is far away from the sliding surface (s . 1), both of them work at the same time to quickly approach the sliding surface. When the system is close to the sliding surface (s \ 1), the constant velocity reaching term plays a leading role, which leads to large chattering. Although the power reaching law will slow down and reduce the chattering near the sliding surface, the reaching speed is slow when the system is away from the sliding surface.

The proposal of a novel reaching law
A novel reach law is proposed to combine the advantages of the above two reaching laws. As shown in equation (3), the novel reach law has fast convergence speed due to the large attenuation rate away from the sliding surface and reduced chattering due to the small attenuation rate approaching the sliding surface.
ð Þ e Àb x j j À ks a = 0, s j j ø 1 0\a\1, s j j\1 Where x is the state variable of the system, l and b are constants greater than zero, and a is an exponential term. As shown in equation (3), when the system is far away from the sliding surface (jsj. = 1), a = 0, the system state variable |x| is relatively large and e -b|x| tends to zero, then the system approaches the sliding surface according to the variable exponential reaching law, which has fast approaching speed adjusting by l. When the system is close to the sliding surface (jsj\1), 0 \ a \ 1, |x| is small, e -b|x| is close to 1, the exponential term is close to zero, and the power term plays a major role in reaching, the system has a low approaching speed when it is approaching the sliding surface. The chattering during the system approached the sliding mode, is reduced with the introduction of the state variable x.
Performance analysis of novel reaching law A validation system was constructed to verify the performance of the novel reaching law, as shown in equation (4).
In equation (4), The tracking error is defined as e(t), and then the tracking error and its derivative are expressed as: Where u d is the ideal angle signal. Define the sliding mode surface function as: Among them, c is the sliding mode surface coefficient, c . 0. Then by combining the three equations (4)-(6), we can get: According to (3) and (7), the sliding mode control law u(t) based on the novel reaching law can be obtained as follows: The performance of the three reaching laws is analyzed under the same parameter conditions, and the parameter settings are shown in Table 1. The ideal position signal of the system is u d (t) = sint, and the initial state Figure 1 is the phase locus of three different reaching laws, Figure 2 is the controller output of three different reaching laws, Figure 3 is the convergence rate of state variables of three different reaching laws, Figure 4 is the position tracking performance of three different reaching law. It can be seen that the novel reaching law has not only high approaching speed and chattering suppression, but also quick convergence speed of state variables x 1 and x 2 and the ability to track a given signal, compared to the power reaching law and the exponential reaching law. Thus, the new reaching law proposed in this paper has the advantages of accelerating the reaching speed and weakening the chattering of the system.

Mathematical model of permanent magnet synchronous motor
The mathematical model of the PMSM is established in the dq-axis coordinate system. The voltage equation of the PMSM with i d = 0 is shown below.
where u d , u q , i d , and i q are the dq-axis stator voltages and currents, respectively, L d , and L q are the dq-axis inductances, respectively, p is the number of pole pairs, R s is the stator resistance, c f is the permanent magnet chain, and v m is the rotor mechanical angular velocity. The PMSM torque equation with i d = 0 is given by The PMSM equation of motion is T e and T L are electromagnetic torque and load torque, respectively. J is rotational inertia, and B is viscous friction coefficient.

Design of sliding mode controller based on ESO
The traditional sliding mode control generally adopts a symbolic function, so the control process is discontinuous and inevitably brings chattering. To suppress the chattering of the sliding mode controller and improve the dynamic performance of the system, the ESO with small chattering and high observation accuracy is used to observe the disturbance and angular velocity of the system, and the observation value is feed-forward compensated to the sliding mode controller. After combining novel reaching law and ESO, A novel reaching law anti-disturbance sliding mode control (NRLASMC) strategy with disturbance rejection and compensation capability is proposed. Substituting equation (10) into equation (11), the equation of motion of the permanent magnet synchronous motor can be written as: Taking into account the effects of system disturbances and changes in system parameters, equation (12) is written as: In equation (13)A = 3pCf 2J , C =À B J , and D is the comprehensive disturbance of the system, which involves the influence of load disturbance and the changes of various parameters of the system, then Considering that disturbance D is unknown, ESO is needed to observe the disturbance and feed forward to the sliding mode controller. D can be extended to the system state variable of the ESO, and its extended state equation is: z(t) is the rate of change of the integrated disturbance D.
The traditional second-order ESO equation is: where e 1 (t) is the error between the observed and actual values of mechanical angular velocity, z 1 (t) is the observed mechanical angular velocity value, z 2 (t) is the observed total disturbance value, b 1 , b 2 are the observer gain coefficients.
To improve the observation performance of the observer and observe the total disturbance D more accurately, and at the same time improve the adaptive and dynamic response capability of the ESO, a new ESO based on the hyperbolic tangent function is designed, combining equations (14) and (15), the observer equation is as follows: Where A . 0 is the hyperbolic tangent function adjustment parameter. From equations (14) and (16), the error state equation can be obtained as follows: e 2 (t) is the estimation error of integrated disturbance. The speed tracking error is defined as: v * is the given value of mechanical angular velocity speed.
The derivative of the speed tracking error is: To further suppress the system chattering and improve the system regulation accuracy, the integration sliding mode surface is selected as followsy¨¥ Then, from equations (3), (18), and (19), the expression for the controller q-axis current can be obtained as: Parameter determination and stability analysis To determine the parameters A and B in equation (16), let From the reachability condition to the sliding mode dynamics: Combining with equation (17), equation (22) can be written as: For A greater than zero or less than zero, it is divided into two cases: So b 1 \ 2|Ce 1 + e 2 |, which can also be written as b 1 = 2a|Ce 1 + e 2 |, where if a . 1 satisfies the condition, a = 2 is chosen according to the literature. 22 The parameter A is chosen so that when the observer state variable reaches the sliding mode surface into the sliding mode there is: Combining equations (17) and (27), we can get Formula (28) can be written as : Solving differential equations can be obtained where C 1 is a constant. To ensure that the disturbance estimation error converges to zero, b 2 should be greater than 0, and the convergence rate of the disturbance estimation error can be adjusted by adjusting the value of b 2 . The Lyapunov function is used to verify the stability of the control system. The Lyapunov function is constructed as follows: The Lyapunov stability condition is According to equations (19), (20), and (21), equation (32) can be written as In equation (33), the parameters satisfy e . 0, k . 0,0 =\ a \ 1, l . 0, b . 0. When a = b, it can be known from Lyapunov function stability theorem that the designed sliding mode controller is asymptotically stable.

Discrete control system
In the actual engineering experiments, the computer real-time control is a discrete system, so the proposed control method should be discretized.

Discretization of PID control
The output of the controller is set to u, then the output value of the hth time is u(h), e is the input deviation of the controller, and the sampling period of the system is T = 100 ms, then the incremental PID discrete form is: Therefore, the incremental PID controller output is

Discretization of the NRLASMC control law
Theoretically, sliding mode control is mainly for continuous systems, and discrete systems sliding mode control can only produce quasi-sliding mode control, 23 with which the corresponding resulting convergence state is called quasi-sliding mode, then the switching band expression is Where 2D is the width of the switching band. The quasi-sliding modes are divided into ideal quasi-sliding modes that reach the sliding mode surface in a finite step and move on it, and non-ideal sliding modes that continuously traverse the switching surface within the switching band, which are called quasi-sliding modes controlled by the sliding mode variable structure.
The state variables are defined as follows: From equation (13), we can obtain: Discrete equation (38) The sliding surface function is: Discrete equation (3) s To ensure the convergence of the controller output, the exponential term coefficient k and the sampling period T in the above equation should satisfy the condition: 1-kT . 0. Combining equations (39) and (41), we get:

Numerical simulation
To verify the operating performance of NRLASMC, the control system scheme shown in Figure 5 is used to build a simulation model based on MATLAB/ Simulink, and the NRLASMC control is simulated and compared with the conventional PID control. The simulation parameters of the permanent magnet synchronous motor are shown in Table 2.
Nonsingular terminal sliding mode control based on exponential reaching law, nonsingular terminal sliding surface is: So NTSMC parameters are: g . 0, take g = 10, p 0 . q 0 as positive odds, take p 0 = 9, q 0 = 7, e 1 = 100, q 1 = 90. PID controller parameters: speed loop k p = 0.8, k i = 32, k d = 0.0015. Each parameter of the NRLASMC controller is: c = 0.01, e = 10, k = 121, l = 0.1, a = 0.5, b = 2, b 1 = 2*2|Ce 1 + e 2 |, b 2 = 2000, b 3 = 0.8. All three controllers have the same dq-axis current loop parameters. d-axis current loop PI controller parameters are k p = 27, k i = 40; q-axis current loop PI controller parameters are k p = 0.46, k i = 80. Figure 6 shows the response curves of the speed of the permanent magnet synchronous motor under the PID control, NTSMC control, and NRLASMC control strategies with a given speed of 800 rpm for the nonload start, 0.3 s for sudden load increase, and 0.7 s for the speed increase. Table 3 shows the results of comparing the performance of the three controllers. The system under NRLASMC control is better than PID and NTSMC control in terms of the speed of starting response, the size of speed drop for sudden load increase and the response speed at sudden speed increase. Figures 7 and 8 show the response curves of the torque and three-phase current of the permanent magnet synchronous motor under the PID control and NRLASMC control strategies with a given speed of 800 rpm for the non-load start, 0.3 s for sudden load increase, and 0.7 s for the speed increase.
From Figure 7, it can be obtained that when the load is suddenly increased to 0.3 N m, the system is sensitive to load perturbation under PID control, and the electromagnetic torque fluctuation is significantly higher than that of the system under NRLASMC control, and the former torque fluctuation is significantly higher than that of the latter when the speed is suddenly increased, and in addition, because the NRLASMC control adopts a novel reaching law to suppress  chattering, the suppression effect of the controller on torque pulsation is obvious. From Figure 8, the peak value and vibration of the three-phase currents at the non-load start, sudden load increase, and sudden speed increase under NRLASMC control are significantly smaller than PID control. Figure 9 is the comparison between actual load torque and ESO observed load torque, Figure 10 shows the difference between the observed angular velocity of the extended state observer and the actual angular velocity.
From Figures 9 and 10, it can be obtained that the ESO has a fast response speed and small observation error to observe the given torque, the angular velocity tracking error is small and the convergence speed is fast, so the performance can meet the system requirements.

Experimental demonstration
To further verify the effectiveness of the proposed theory and NRLASMC control strategy, a semi-physical experimental platform of PMSM based on dSPACE 1202 and ControlDesk real-time control is built, shown in Figure 11. The driver board integrates a three-phase stator current detection circuit, DC side bus voltage detection circuit, and three-phase inverter circuit, and the PMSM comes with an encoder module, which can  transmit the collected rotor position signal to the ds1202 controller.
A physical diagram corresponding to Figure 11 is built as shown in Figure 12. A performance validation experiments of the PID controller, sliding mode controller and NRLASMC controller of the PMSM are carried out through the above platform.
The PMSM parameters are the same as the simulation, the inverter switching frequency is 20 kHz, the controller sampling period is 100 ms, and the DC side bus voltage is 24 V. The controller parameters are set as in Table 4.
The e is selected as a tradeoff between response speed and chattering, too large e will cause violent chattering, so take e = 10. The sliding mode parameter k, which determines the convergence speed of the system when away from the sliding mode, can be selected appropriately large to shorten the system response time, take k = 115, according to the definition of equation (3), the selected sliding mode parameters a, l, and b are 0.7, 0.1, and 2. b 1 and b 2 are the gain coefficients of ESO, and the principle of selection is the trade-off between the disturbance tracking performance and the antinoise capability. b 3 affects the smoothness of the hyperbolic tangent function, and the compromise between the ESO chattering size and the disturbance tracking performance is selected as b 3 = 0.85.
The current loop PI parameters are the same for all three controllers. d-axis current loop parameters are: k p = 25, k i = 5, q-axis current loop parameters are: k p = 0.4, k i = 80. Since the controller used is dSPACE, it is only necessary to replace the physical parts of the pure simulation model such as PMSM, inverter, sensors, etc. with the RTI interface that comes with dSPACE in Simulink, in addition to replacing the continuous modules in the simulation with discrete modules, and then compile them into code for real-time control in ControlDesk.
In the experiment, the PMSM starts without load. Given the initial speed of 1000 rpm, the speed is increased to1200 rpm in 10 s. The speed response and q-axis current waveform of the PMSM under three control methods are compared and analyzed. The experimental results are shown in Figure 13. Table 5 shows the performance comparison of the system under the three control methods. It is clear that compared with PID control and SMC control, the system can reach the steady state without overshoot in only 0.68 s under NRLASMC control, and the peak qaxis current at start-up is lower than the former two. Therefore, the NRLASMC proposed in this paper can effectively improve the system response speed, reduce the system vibration and strengthen the steady-state performance of the system.

Conclusion
Given the shortcomings of the traditional reaching law in sliding mode control, such as slow convergence speed and large vibration, a novel reaching law is proposed, which can accelerate the convergence speed and weaken the system vibration at the same time, the proposed ESO observes the integrated disturbance of the system  accurately, the rapid response capability of the system is improved, and the inherent chattering of the sliding mode controller is suppressed obviously.
A comparing analysis for the performances of the traditional power, exponential reaching law, and the proposed novel reaching law is carried out, which shows that the proposed novel reaching law is superior to the former two in terms of the convergence speed of the control law and the state variable and the ability to track the given signal.
In addition, the NRLASMC control is compared with the traditional PID control by MATLAB/ Simulink simulation. The proposed NRLASMC has strong robustness, fast response, and small chattering. The ESO based on the hyperbolic tangent function can accurately estimate the system disturbance in real-time, and the control accuracy of the system is greatly improved.
To further verify the performance of the controller, the dSPACE-based PMSM experiments are carried out under three different control modes. The results show that the proposed NRLASMC can reduce the steadystate error of the system, and has the advantages of fast response and small chattering.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.

Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: Supported by the overseas study visit and training program for outstanding young backbone talents of Anhui Province (gxgwfx2021035), Supported by the innovation team of Anhui Polytechnic University, Special display and Imaging Technology Anhui Technology Innovation Center open project support (2020AJ06001).