A Comparative Study and Optimization of Switching Functions for Sliding-Mode Observer in Sensorless Control of PMSM

The sensorless control of the permanent magnet synchronous motor (PMSM) has attracted wide attention due to its high reliability, economic and safety benefits. A fast and high-precision rotor-position estimation is inevitable for the implementation of sensorless control. Sliding-mode observer (SMO) is a preferred solution for sensorless control by many industrial companies. This article addresses the comparison of different switching functions employed in the control structure of sensorless field-oriented control with SMO. The switching functions are classified and their influence on the performance of the PMSM is verified for different shaping coefficients (SC). In addition, a statistical evaluation of the switching functions is provided to find the optimal values of SC. An experimental and statistical evaluation validated the substitutability of signum and hyperbolic switching functions and optimal values of SC have been found.


Introduction
Permanent magnet synchronous motors (PMSMs) are widely used in various applications with high demands on movement dynamics and positioning precision. Positioncontrolled drives with PMSM are generally denoted as servodrives. In modern servodrives, field-oriented control (FOC) with the sensor for position measurement becomes the standard control topology. However, the position sensor is a sensitive part of the servodrive in terms of mechanical and electrical robustness and, therefore, decreases the overall reliability of the drive. In addition, the position sensor requires additional mounting space in the servomotor housing that increases the overall space requirements of the drive solution. Different reasons for the elimination of the position sensor from the FOC topology exist. The replacement of the sensor by estimation of the position value leads to enhanced reliability, especially in harsh environments. Position estimation can also be used as a backup in case of failure of the position sensor, making it the fault-tolerant drive. Moreover, for low-cost servodrives, the position sensor can be a substantial part of a unit price and the replacement of the sensor by position estimation may lead to a significant cost reduction. Sensorless control of PMSM methods can be divided into the following groups [1]: Methods for medium-and high-speed drives. They work reliably for speeds above 10% of the rated drive speed.

2.
Methods for low-speed drives. The low-speed operation is often considered as speeds below 10% of the rated speed. 3.
Hybrid sensorless control methods for the whole speed range. They are a combination of low-and high-speed methods.
At medium-and high-speed ranges, methods based on the motor model, which uses measured voltages and currents for the rotor position and speed estimation, are widely used. The estimation of the permanent magnet's flux or electromotive force (EMF) is used as these physical variables contain the information about rotor position [2]. This group of methods includes a flux observer (FO) [3,4], Luenberger observer (LO) [5,6], model reference adaptive system (MRAS) [7,8], extended Kalman filter (EKF) [9,10] and slidingmode observer (SMO). A detailed review of these methods is provided in [11,12].
The SMO belongs to the most used algorithms due to its simple structure, low sensitivity to parameter variation, low computational requirements and high insensitivity to disturbances [13]. Therefore, different SMO sensorless methods have been widely accepted and implemented in PMSM control using microcontrollers. Application examples are provided by Texas Instruments [14], Microchip [15] or NXP [16].
A general theory of sliding mode is widely developed and a design of a sliding-mode observer can be found in [17]. By its nature, SMO is inevitably linked to the chattering problem. The chattering problem is described as oscillations appearing in the implementation of SMO and caused by high-frequency (HF) switching of SMO, exciting unmodeled dynamics in the closed loop. HF switching is caused by employing a discontinuous signum function inside the control structure. In many cases, a low-pass filter (LPF) is added to the control structure of SMO to eliminate chattering. Applying the LPF causes unwanted side effects as a phase delay and gain attenuation and thus needs additional compensation strategies. The elimination of the LPF from the control structure can be obtained by using higher-order sliding-mode controller (HOSMO) [18]. The HOSMO can mitigate chattering, but it requires the knowledge of switching function derivatives, which makes it more complex for microprocessor implementation. Recent works have been focused on solving this problem by applying super-twisting sliding-mode observers (STSMO). In [19], a simple adaptive STSMO with a compensation of voltage source inverter nonlinearity was proposed. The STSMO with a robust moving average filter was investigated in [20], with the ability of start-up from a very low speed (<4% of nominal speed), but the complexity of the observer design increased as more parameters had to be tuned.
The most used and yet still simple chattering-reduction method for SMO is to replace the discontinuous switching function with some type of continuous function [20]. This is also referred as a boundary layer approach [21]. The principle of continuous switching is to construct a boundary layer and to generate a quasi-SMO instead of a pure SMO. The thickness of the boundary layer impacts the performance of the quasi-SMO. If the boundary layer is narrow the approaching speed of the sliding-mode motion increases but it results in chattering and harmonic distortions. On the other side, the wide boundary range suppresses chattering but reduces the robustness of the control system [22,23]. The boundary region is determined by the shape coefficient (SC) which is unique for each switching function. Appropriate adjustment of SC is necessary to reduce chatters and to improve the control system performance [23]. Different continuous switching functions used in sensorless PMSM control with SMO can be found in the literature: • Signum function [24][25][26][27]; • Saturation function [28][29][30]; • Sigmoid function [13,[31][32][33][34]; • Hyperbolic function [22,23].
The SC is in most cases selected as a constant value that is obtained by a trial-and-error procedure. An advanced approach [23] is the real-time adjustment of the SC. Even in that case, the values of the SC are given as a set of random constant values. Therefore, a study provided in this paper gives guidelines to find the values of the SC that would be optimal for the given implementation of SMO.
The optimization is widely used in the design of electric drives. The subject of the optimization is the motor construction [35,36], the selection of the control type [37] or the settings of the controller parameters [10,36,38]. The optimization is also used in adaptive control where it is a part of the process of control parameters adjustment to a change in external conditions [39]. In this paper, the optimization is used for a selection of the switching function and also to find the SC values. The paper is an extension of [40] and its main contributions are:

1.
Systematic classification of different types of switching functions; 2.
Experimental verification of different switching functions with the proposed SOSMO; 4.
Statistical evaluation of a large set of measurements to find the optimal values of SC.

Implementation of SOSMO for Sensorless Control of PMSM
The state equation of SM-PMSM using the αβ stator currents as state variables is defined as: i where u α and u β are the applied stator voltage components, i α and i β are the stator current components, e α = −ω e λ PM sin(θ e ) and e β = ω e λ PM cos(θ e ) are the stator back-EMF voltage components, where ω e is the electrical angular velocity and λ PM = 2 3 k t p = k e p is the permanent magnet flux, where k t is the motor torque constant, k e is the EMF constant and p is the number of pole pairs, R s = R 2ph /2, where R 2ph is the phase-to-phase resistance and L s = L 2ph /2 = L d = L q , where L 2ph is the phase-to-phase inductance and L d , L q are the direct and quadrature axis inductances.
It can be seen from (1) that the back-EMF components include the value of rotor position and velocity. The amplitude of the back-EMF components cannot be directly measured during the control process and its estimation is thus required. A second-order sliding-mode observer (SOSMO) [41] is used in this paper for the speed and position estimation. The mathematical model of SOSMO can be defined as: where superscript (ˆ) indicates an observed value and z α , z β are the observer feedback signals. If the actual motor parameters, i.e., the resistance and the inductance of the windings are the same as in the observer equations, the applied voltage components are known and the current components are measured, the only unknown values are the back-EMF components. Thus, matching the observed currents to the measured currents yields the actual back-EMF values. The observer's task is to force the observed current to match the measured current, thus, the sliding surface is given as: whereī α ,ī β represents the error between the observed and measured current components.
The switching action will occur when: Equation (4) defines the sliding surface or the switching surface of the SOSMO. The phase plane is divided into two areas in which the switching function has differ-ent signs. The differences between actual and observed currentsī α ,ī β enter the switching function. The outputs of the switching function are the feedback observer signals z α , z β : The back EMF-components are obtained by filtering the feedback observer signals with the LPF. The observed electrical position can be extracted from the estimated back-EMF components using an arctan function or a phase-locked loop (PLL) circuit. The latter is used in this paper and the design of the PLL can be found in [1].
The implementation of the SOSMO with the field-oriented control of PMSM is shown in Figure 1. The initial position detection and start-up are executed with a resolver. Then, above 10% of the nominal speed, the algorithm is switched to the sensorless mode. This approach is used to provide a fair comparison of different switching functions under exactly the same conditions for each measurement.

Classification of Switching Functions
Observer feedback signals z α , z β from the previous section can be calculated in different ways based on the type of switching function used in the control structure and the value of its shaping coefficient (SC). The switching function and value of the SC have a significant impact on the chattering of the observed values, having further impact on the performance of the sensorless drive. The purpose of the z α , z β signals is to force the trajectories of current differencesī α andī β towards the sliding surface. It was shown in several works that the discrete function (signum) causes chattering and so continuous functions are preferred. Different types of switching functions are shown in Figure 2.

Signum Function
The signum function is defined as follows: The sign of the current error is determined by the signum function and then multiplied by the feedback gain k 1 . The value of k 1 is discussed in Section 3.5. The average value of the feedback signals from (6) in a short time interval represents the estimated back-EMF values [17]. Therefore, its components can be obtained using the LPF: where ω c is the cut-off frequency of the LPF. For each type of switching function, the resulting observed back-EMF components are obtained using the LPF as defined in (7). The cut-off frequency is selected to filter out the high-frequency components, but ω c should not affect the fundamental component of the feedback signal during the filtration process. The observed back-EMF components will be further used for the position and speed calculation. The LPF introduces a phase lag and a compensation of the observed position values is necessary [42].
For an ideal SOSMO, the signum function is executed with the infinite frequency and the trajectories of the current differences reach and stay on the sliding hyperplane, i.e., s(t) = 0 andṡ(t) = 0. However, the switching frequency is limited in a real application, which is the reason why the chattering phenomenon occurs. To suppress the chattering of the observer, one of the available solutions is to use other types of switching function as a substitute for the signum function: saturation, sigmoid or hyperbolic function.

Saturation Function
The signum function is replaced by the saturation function. If the absolute value of the current differencesī α andī β is lower than a predefined value E max the feedback signal will change into a linear transient region [15]: The value of k 1 is discussed in Section 3.5. E max is a shaping coefficient for the saturation function.

Sigmoid Function
If a sigmoid function is used, the discontinuous signum function given by (6) is fully replaced by a continuous function F(ī) and the observer feedback signals can be written as follows: where the function F(ī) is defined as [43]: where α is the shaping coefficient of the sigmoid function. If the value E max in the saturation function is selected high enough, or if the value of α in the sigmoid function is selected small enough, the continuous output (i.e., observed back-EMF values) will be achieved even without the filtering by the LPF. This simplifies the control system and the compensation of LPF is not necessary anymore. However, removing the LPF reduces the dynamic performance of the observer due to the sluggish response of the controller.

Hyperbolic Function
The hyperbolic function is defined as follows: where m is the shaping coefficient. The hyperbolic function defined by (11) belongs to the class of sigmoid functions but its SC is defined in a different manner [43]. However, it can be shown that the hyperbolic function can be applied as a substitute for the sigmoid function, if the following condition is met: m = 1 2 α.

Feedback Switching Gain
The value of the feedback gain k 1 plays an important role in the observer's performance and stability. The selection of k 1 for the the signum function can be found in [17], for the saturation function in [28] and for the sigmoid function in [43]. The following must stand to ensure stability for all three functions:

Experimental Results of Different Switching Functions in Sensorless Control
An SM-PMSM with the parameters shown in Table 1 was used for the experimental testing. A prototype of a voltage source inverter (VSI) controlled by an Opal RT OP5600 hardware-in-the-loop simulator was used to drive the machine. Two different sampling rates were implemented: the SOSMO and the current loop were sampled at 20 kHz and the speed control loop was sampled at a 2 kHz sampling frequency. The parameters of all controllers are shown in Table 1. The current controllers were designed by direct synthesis method for the desired time constant T n = 1.5 ms, which results in a bandwidth of approximately 670 Hz. The PI speed controller was initially designed for the operation with the sensor. Then, it was experimentally tuned in sensorless control by a trial-and-error approach and the P-component of the PI controller was reduced to make its value fit the full range of shaping coefficients for all switching functions. When a satisfactory value of the P-component was found, it was not changed throughout all experiments. This ensured the fairest possible comparison of switching functions. The rotor position and speed estimation using the SOSMO observer are approximately reliable above 5-10% of the nominal speed. Therefore, some type of start-up procedure is required. In this paper, the position sensor was used to reach a certain speed level followed by the switch-over to sensorless control. This approach was chosen due to its simplicity, to accomplish a smooth initial position detection and to provide a fair comparison of all switching functions across all the values of SC. A switchover speed of 300 rpm was selected, which represents 10% of the nominal speed. Below that speed, the observation fails, as the back-EMF amplitude has a critically low value to be reliably observable.
All four switching functions were experimentally tested with the same SOSMO, for the same parameters of the PI controller and with the same PLL circuit to provide the most objective comparison. For each measurement, the same level of a step load torque was applied to the PMSM by loading with the induction machine controlled by a frequency converter.
Different types of switching functions and SC were used. The results are shown in Experimental results for the SOSMO implemented with a signum function are shown in Figure 3. The point of switchover from the sensor to sensorless control is visible at the time around t = 1 s. A substantial chattering effect can be observed in the waveforms of the currents and actual speed, which makes this switching function the worst candidate for implementation in the sensorless control. The speed error ∆ω m has valid values only in the sensorless mode. Even if the estimated speed is calculated in both modes with sensor and sensorless, it has very unprecise values at low speeds, where the back-EMF voltages are very low. The saturation function was experimentally tested for six different values of SC (see values of E max in Table 2). Experimental results for the SOSMO with the saturation function E max = 20 are shown in Figure 4. When comparing Figures 3 and 4, the chattering effect in the estimated speed is significantly reduced. In addition, the electrical position error ∆θ e is also reduced. The results in Figure 4 indicate that the saturation function has better performance in the sensorless control when compared with the signum function. However, it can be shown that the selection of some other values of E max may cause the chattering effect to reappear. It would be very convenient to find out the exact value of E max for which the chattering effect is minimal.
The sigmoid function was experimentally tested for six different values of SC (see values of α in Table 2). The experimental results for the SOSMO implemented with the signum function for α = 0.04 are shown in Figure 5. When comparing Figures 4 and 5, the chattering effect in the current waveforms is at a comparable level, but the electrical position error is quite reduced. The results in Figure 5 indicate that the sigmoid function has slightly better performance in sensorless control when compared with the saturation function.    It should be again emphasized that a direct correlation between sigmoid and hyperbolic function exists. Based on a comparison of (9) with (11), it can be shown that m = 1 2 α. Therefore, the sigmoid switching function can be used instead of the hyperbolic switching function and vice versa. This issue has not been discussed in the available literature so far.
The hyperbolic function was experimentally tested for 10 different values of SC (see values of m in Table 2). The experimental results for the hyperbolic function with m = 0.02 are shown in Figure 6. The value of m was selected on purpose to compare the experimental results with the sigmoid function for α = 0.04. When comparing Figures 5 and 6, no visible differences in chattering effect for the speed and current waveforms can be observed. The values of the mechanical speed and electrical position errors have a very similar level.

Multiobjective Optimization Problem for Values of SC
In the previous section, the comparison of the suitability of different switching functions was performed by evaluation of the speed, position and current responses. The values of SC were varied in order to reach the lowest possible chattering effect. Experimental results indicated that some optimal value of SC for each switching function should exist. Moreover, the comparison of SC only by visual examination of the speed, position and current waveforms is not enough to specify which value of SC is optimal. Therefore, some quantitative criterion must be introduced.
For most real-world problems, there are several objective functions (i.e., quantitative criteria) for comparing different solutions. These criteria are often conflicting as improving one leads to a deterioration of the other. Trying to find the "best" solution leads to two different approaches. The first is the multiple-criteria decision-making (MCDM) [44] that explicitly evaluates multiple conflicting criteria values of the finite set of possible solutions. The optimization model can be defined as: minimize q (13) subject to q ∈ Q, where q is the vector of p objective functions and Q is the set of alternative solutions. The alternative approach is a multiobjective optimization (MOO) that uses various optimization methods to generate feasible solutions defined by the design parameters. The optimization model can be defined as [37]: subject to where f and x are an objective function vector and a design parameter vector, respectively; g and m are the constraints and number of constraints, respectively; and x l and x u are the lower and upper boundaries of x.
In this paper, MCDM was used to select the best solution from the set of feasible solutions from the experiment. The MOO approach is not applicable because different switching functions have different shape coefficients and there is no uniform parameter space. MCDM compares different solutions to make the decision. In the case of multiple criteria, the evaluated objective of a solution is a vector. Two ways are offered to compare objective vectors and corresponding solutions.
The first defines the dominance of one solution over another [37]. The solution x dominates the solution y if the solution x is better than y in all criteria. The set of solutions that are not dominated by any solution in the set of feasible solutions is called the Pareto optimal set (or Pareto front). A simple search algorithm can be designed to find all Pareto optimal solutions from the existing set of feasible solutions.
The second approach reduces a multiobjective function to a single objective function by calculating one number as a weighted sum of objectives [45]. The best solution is the one with the lowest value (minimization problem). In this case, only one solution is optimal for a chosen set of weights. However, changing the weights leads to a different optimal solution. Both approaches were used in this paper.
Two different objective functions were selected: the root-mean-square error (RMSE) of the mechanical speed and the root-mean-square error of the electrical position, defined as follows: where ∆θ e (k) = θ e (k) −θ e (k). (21) ∆ω m (k) and ∆θ e (k) is a mechanical speed error and electrical position error, respectively; ω e (k),ω m (k) and θ e (k),θ e (k) are the kth samples of the actual and estimated mechanical speed and electrical position, respectively. n is the length of the dataset used for the calculation of the RMSE. The weighted objective is the sum of the objectives according to (18) and (19). As the objectives have different scales, their normalization is necessary before the summing. The weighted objective wo is calculated as: where w ω and w θ are weights and max(RMSEx), min(RMSEx) are extreme values of the objectives from all measurements. Preliminary experiments were used to determine the range of shaping coefficients of the switching functions. Then, the full-scale experiments were executed as a series of repetitive measurements for exactly the same conditions (the same initial position detection, the same PI controller and PLL, and the same value of a load torque applied at the same time). A total of 319 experiments were executed, containing 138 measurements for the hyperbolic, 90 for the saturation, 90 for the sigmoid, and one measurement for the signum function to obtain statistically significant data for further investigation. A standard dataset had 12 measurements but three extended datasets of 30 measurements were executed to confirm the data normality required by statistical procedures. The possible erroneous values were identified and excluded from the datasets by a generalized extreme Studentized deviate test for outliers [46].
The values in Table 2 are the average of RMSEs obtained from the datasets for each single value of SC. The 95% confidence interval of values in Table 2 relative to measured RMSE ω m , or relative to 2π for RMSE θ e , is ±0.3% on average, and ±0.5% in the worst case. This means that the true mean of the measured data lies within these intervals with a probability of 95% and it is not statistically significantly different from the average estimate. Figure 7 shows the overview of the optimization results in the RMSE ω m and RMSE θ e space. Each solution is marked with one mark showing the switching function used and other marks showing whether the solution is Pareto optimal or optimal according to the weighted objective. The signum function is not displayed in the figure because the values of the objectives were very far from the optimum. Figure 8 shows the objective values of the Pareto optimal solutions in the same order from left to right as shown in Figure 7. The weighted objectives of the ten best solutions for weights w ω = 0.3 and w θ = 0.7 are shown in Figure 9. As has been stated, hyperbolic and sigmoidal functions are interchangeable. The results of the experiments in Figure 7 confirm this statement although the overlapping of solutions is not accurate. The inaccurate overlap is a consequence of the fact that the SC values of α and m do not coincide with each other, as the measurement itself is random in nature. Considering this, we grouped together solutions that used the hyperbolic and sigmoid functions. After analyzing the optimization results we can state:

1.
The signum function gives the worst values of objective functions and serves only as a reference point.

2.
The solutions from the group of hyperbolic and sigmoid functions dominate over those of the saturation function.

3.
Multiobjective optimization gives several "good" solutions, so it is necessary to use additional preferences to select the best one. 4.
The optimal solutions according to the weighted objective lie on the Pareto front.
Based on the performed analysis, we lean toward the solution using the hyperbolic switching function with a shape coefficient m = 0.008 (sigmoid with α = 0.016). This is the optimal solution according to the weighted criterion with weights w ω = 0.3 and w θ = 0.7. The selected weights show that a smaller deviation of the electrical position than the deviation of the mechanical speed is preferred. The use of a saturation switching function is the second option if the time to calculate the hyperbolic function is unacceptable for given hardware. The fact that all Pareto optimal solutions belong to the same switching function (hyperbolic-sigmoid) opens the possibility for using M0O to search the exact SC value instead of selecting an optimal solution from the set of feasible ones. This may be the subject of future research.

Conclusions
This article has proposed a comparison of different switching functions and addresses the influence of their shaping coefficients on the performance of the sensorless control of PMSM. The results confirm that the signum function should be replaced with the sigmoid or hyperbolic function. This is caused by the utilization of the transient region of these switching functions, which enables the observer to exploit some additional "degree of freedom" during the observation process. It was proven that the sigmoid and hyperbolic switching functions are substitutable. In addition, a statistical evaluation of experiments with different values of shaping coefficients was completed by calculating the electrical position and mechanical speed root-mean-square-error values. Finally, a multiobjective optimization for given parameters resulted in several Pareto optimal solutions. Future research should aim to add some more optimization objectives, such as speed settling time or overshoot, for a customization and expansion of the optimization problem. In addition, the shaping coefficients affect both the chattering effect and the robustness of the system. A selection of new optimization parameters that correlate with the robustness of the system is also viable.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.