Discrete-Time Sliding Mode Filter with Adaptive Gain

Shanhai Jin 1, Yonggao Jin 1, Xiaodan Wang 1 and Xiaogang Xiong 2,* 1 School of Engineering, Yanbian University, Yanji 133002, China; jinshanhai@ybu.edu.cn (S.J.); ygao@ybu.edu.cn (Y.J.); wangxiaodan@ybu.edu.cn (X.W.) 2 School of Mechanical Engineering and Automation, Harbin Institute of Technology Shenzhen Graduate School, Shenzhen 518055, China * Correspondence: xiongxg@hitsz.edu.cn; Tel.: +86-755-2603-3774


Introduction
Sensor signals are important in feedback control of mechatronic systems.However, due to measurement errors and environmental disturbances, sensor signals are usually noisy and uncertain.Various filters are developed for obtaining smooth and reliable signals.Among them, linear filters are perhaps the first option due to their simplicity.They, however, proportionally transfer any noise component into the output.Furthermore, they produce a large phase lag, which may result in instability of feedback controlled systems, in the case of strong noise attenuation.
In order to avoid drawbacks of linear filters, nonlinear filters have been studied.For instance, median filters [1] are developed for attenuating high-frequency noise.However, it is reported [2] that they require expensive computational costs.As another example, stochastic filters, e.g., Kalman filters [3,4], are applied in some applications.However, a dynamic model of the signal source, which is not always available, is required.Moreover, their performance is related to the model accuracy.
The super-twisting algorithm [5,6] based sliding mode observers [7][8][9] have attracted much attention in the last decade.In these observers, finite time convergence can be theoretically realized in continuous-time analysis.However, in discrete-time implementation, the convergence accuracy depends on the sampling period, typically with finite difference [10,11].In addition, a dynamic model is also required.
The sliding mode filter that employs a certain kind of parabolic-shaped sliding surface has been studied [12,13].One of the major advantages of the filter is that finite time convergence of the output to the input is achieved in the case of a constant input being provided.Moreover, the filter does not require a dynamic model.Some evaluation results [14][15][16] of the filter and its applications [17][18][19] were reported.However, the filter is prone to overshoot.
Regarding the drawback of the filter [12,13], Jin et al. [20] proposed a new model-free parabolic sliding mode filter, which is referred to as PSMF, for effectively removing noise in feedback control systems.It is reported [21] that the noise removing capability of parabolic sliding mode filter (PSMF) is almost the same as that of the second-order Butterworth low-pass filter (2-LPF), but its phase lag is smaller than that of 2-LPF.In addition, PSMF is less prone to overshoot, and it produces smaller phase lag compared with the filter [12,13].Moreover, the discrete-time algorithm of PSMF, which is derived by using the backward Euler discretization, does not produce chattering.The effectiveness of PSMF has been experimentally validated [21,22].
This paper presents a new model-free discrete-time sliding mode filter for removing noise by balancing the tradeoff between the filtering smoothness and the suppression of delay.The presented filter is an extension of PSMF by including an adaptive gain, of which value is determined by an adaptive method inspired by a first-order adaptive windowing filter [23].The results of numerical examples and experiments show that the presented filter performs better than PSMF.
The rest of this paper is organized as follows: Section 2 gives a brief overview of related works; Section 3 presents a new model-free discrete-time sliding mode filter; Sections 4 and 5 validate the effectiveness of the presented filter through numerical examples and experiments, respectively; and Section 6 covers concluding remarks.In addition, the Appendix provides a list of main abbreviations and notations used in the paper.

Parabolic Sliding Mode Filters
In a paper [20], Jin et al. proposed a model-free sliding mode filter employing a parabolic-shaped sliding surface (PSMF), of which continuous-time representation is given as follows: where Here, u ∈ R is the input, x 1 ∈ R is the output, x 2 ∈ R is the derivative of x 1 , and F > 0 and H > 1 are parameters.In addition, sgn() is the set-valued signum function defined as follows: where the argument z ∈ R is a scalar.It should be noted that the return value of sgn() is a set instead of zero when z = 0.In PSMF, ẋ2 can be considered as the acceleration of the output x 1 , and F can be seen as the gain of the acceleration.Figure 1 illustrates the parabolic-shaped sliding surface (thick curve) and the trajectories of the state (x 1 , x 2 ) (thin curves) of PSMF in x 1 -x 2 space.In PSMF, when σx 2 < 0 and σx 2 > 0, ẋ2 satisfies ẋ2 = |F| and ẋ2 = |HF|, respectively.And thus, the state (x 1 , x 2 ) moves toward to the parabolic sliding surface in x 1 -x 2 space.Here, it should be mentioned that, in the case of σx 2 > 0 with H = 1 (i.e., the filter [12,13]), the state moves parallel to the sliding surface, i.e., the state cannot reach the sliding surface in the regions of σx 2 > 0, resulting in overshoot during the convergence.After the state reaches the sliding surface, i.e., σ = 0, the state is constrained on the surface and it moves along the surface to the target state (u, 0).It may be worth noticing that such a behavior of PSMF is similar to that of a system under a bang-bang controller.
x 1 {x 2 state space The paper [20] also presented a discrete-time algorithm of PSMF, which is analytically derived by using the backward Euler discretization (i.e., by replacing x 2 by (x 1 (k) − x 1 (k − 1))/T) and the following equivalent relation [20]: where a ∈ R and b ∈ R satisfy a ≤ b, and clip() is the function defined as follows: clip(a, b, z) Specifically, the complete algorithm of PSMF is as follows (see [20] for detailed derivation): Here, T is the sampling interval, k is the discrete-time index, and Φ() is the function defined as follows: In Algorithm 1, x * 2 (k) is the value of x 2 (k) that satisfies σ(k) = 0, and x 2 (k) is determined in order to follow x * 2 (k) under the constraint of acceleration, as shown in Figure 2.
Figure 3 shows the block diagram of the discrete-time algorithm of PSMF.One can observe that, due to the use of the backward Euler discretization and the equivalent relation ( 4), the algorithm is free from discontinuous functions.Thus, the numerical implementation of PSMF does not produce chattering, which has been considered one of the major problems of numerical implementation of sliding mode techniques.Such a way of realizing chattering-free implementation of discrete-time sliding modes is also reported in Refs.[24][25][26].In Ref. [21], it is reported that the noise removing capability of PSMF is almost the same as that of 2-LPF, but its phase lag is smaller than that of 2-LPF.Moreover, compared with the filter [12,13], PSMF is less prone to overshoot, and it produces smaller phase lag.The effectiveness of PSMF has been experimentally validated [21,22].

First-Order Adaptive Windowing
In a paper [23], Janabi-Sharifi et al. proposed a discrete-time differentiator, of which the full name is "first-order adaptive windowing (FOAW)".The basic principle of FOAW is that the window size is chosen as small for a rapid motion to instantly reflect fast varying signals, while it is chosen as large for a slow motion to obtain a smooth signal.Specifically, the complete algorithm of FOAW is as follows: where u(k) is the input, x 2 (k) is the output, and N max ∈ N and R > 0 are parameters.
In FOAW, the current and previous input values are used for windowing, as shown in Figure 4. Specifically, the algorithm checks whether all of the points {u(k), u(k − 1), . . ., u(k − n − 1), u(k − n)} are inside the region constructed by the two end points u(k) and u(k − n), and the parameter R, as shown in Figure 5.If it is the case, the window size n is further increased for providing a smoother signal.The increase of n is continued until at least one point of previous input values lies outside the region, as also illustrated in Figure 5, or n reaches its maximum value N max .Then, the last value of v obtained by the finite-time differentiation is provided as the output x 2 (k).In such a way, FOAW optimizes the tradeoff between the output smoothness and the suppression of delay.

Discrete-Time Sliding Mode Filter with Adaptive Gain
This section presents a new model-free discrete-time sliding mode filter, which is an extension of PSMF.The presented filter is derived through a discretization scheme inspired by the principle of FOAW.
The motivation for proposing a new filter comes from the following limitation of PSMF.That is, due to the fixed acceleration gain F, the output of PSMF cannot follow an input of which acceleration exceeds that of PSMF, whereas the output becomes sensitive to the noise contained in the input of which acceleration is far below that of PSMF.Towards this problem, the contribution of the presented filter is that its acceleration gain F adaptively changes according to the motion of input to realize balance between the output smoothness and the suppression of delay.
In order to achieve the above-mentioned balance, let us consider the following modification of PSMF.That is, for a rapid input motion, the value of F should be set large for instantly reflecting fast varying signals.On the other hand, for a slow motion, the value should be set small for obtaining smooth signals.
The remaining problem is how to adaptively determine the value of F according to the motion of the input.Towards this problem, a modified adaptive method inspired by the principle of FOAW is applied.In the light of this idea, the algorithm of an extended PSMF, which is named parabolic sliding mode filter with adaptive gain (AG-PSMF), is obtained as follows: where N c > 0 is a parameter.In AG-PSMF, a modification of FOAW determines the window size through the process of steps 1-8.It should be noted here that AG-PSMF uses the previous outputs for windowing, as shown in Figures 6 and 7, while FOAW employs the current and previous inputs, as described in Section 2.2.Then, in step 9, F * (k) is obtained by applying the adaptively determined window size for balancing the tradeoff, the output smoothness and the suppression of delay.After that, in step 10, x * 2 (k) is determined under the constraint of F * (k), and in step 11, x 2 (k) is determined in order to follow x * 2 (k) .Finally, in step 12, x 1 (k) is obtained by integrating x 2 (k).
x 2 (k)¡x 2 (k¡1) x 2 (k¡1) x 2 (k) Figure 8 shows the behaviors of AG-PSMF and PSMF for the following input with step changes: In this case, it is shown that the convergence of AG-PSMF is faster than that of PSMF.This is because the adaptively changing gain F * (k) of AG-PSMF adjusts the shape of sliding surface according to current input and system states.

Numerical Examples
This section reports the performance of AG-PSMF according to the following sinusoidal input and triangular input: arcsin(sin(30t)) + 0.008 (t) otherwise, (9) where ε ∼ N (0, 1) is the unit white Gaussian noise with zero mean.Parameters F = 1000, H = 3, N max = 5, N c = 4 and R = 0.00075 are used.In addition, the sampling interval T = 0.001 s is applied.
Figures 9 and 10 show the outputs of AG-PSMF.For comparison, the outputs of PSMF with F = 1000 and H = 3 are also included in the figures.The initial states of both filters are zeros at t = 0 s.The results show that both filters effectively remove the noise component for a slowly varying input, but AG-PSMF produces smaller phase lag than PSMF does, as shown in Figures 9b,c and 10b,c.For a fast varying input, i.e., the input after t = 2 s, the output amplitude of AG-PSMF is closer to that of signal components of inputs compared with that of PSMF, as illustrated in Figures 9d-g and 10d-g.In addition, the phase lag of AG-PSMF is smaller than that of PSMF.Such advantages of AG-PSMF is attributed to the use of adaptive gain, which optimizes the tradeoff between filtering smoothness and suppression of delay.

Experimental Evaluation
This section validates the effectiveness of AG-PSMF in position control.For comparison, the performances of position controls without filter and with PSMF were also evaluated.Figure 11 shows the experimental setup, which consisted of a DC motor with an optical encoder, a 16-bit motor controller and a motor driver.

Motor controller
Motor driver Encoder In the case of without a filter, the following discrete-time proportional-derivative (PD) controller was used: whereas the following discrete-time PD controller was employed for the cases of PSMF and AG-PSMF: Here, θ d (k) is the desired trajectory, θ(k) is the current position, ω d (k) is the desired velocity, ω(k) is the current velocity, v(k) is the control voltage, K p > 0 is the proportional gain, and K d > 0 is the derivative gain.In addition, in the cases of PSMF and AG-PSMF, θ f (k) is the estimated position, and ω f (k) is the estimated velocity.Figure 12 shows the block diagrams of the PD-controlled systems used in the experiments.It should be noted that velocity signals were obtained by using the finite difference method.All experiments were implemented at sampling interval T = 0.001 s.
Figure 13 shows the PD-controlled results with the following desired trajectory: In addition, Figure 14 It should be mentioned that the measure AMP provides information on the controlled position, while AMD can be considered as a measure of the intensity of high-frequency vibration of the device.
It should be said that, for a better position control, both AMP and AMD should be kept small.In the figures, one can observe that the controller (10) produced the highest AMD among the three cases.This is because finite difference produced high-frequency noise in the velocity signal by magnifying quantized encoder error contained in the position signal.As a result, there was high-frequency vibration in the device.On the other hand, the controller (11) with PSMF avoided high-frequency vibration during the period of 0 ≤ t ≤ 6 s owing to the smoothed position signal.However, it resulted in instability of the device after t > 6 s because of the fact that, the output of PSMF cannot follow the fast varying input signal with limited acceleration.Compared with the above-mentioned two control schemes, the controller (11) with AG-PSMF simultaneously reduced AMP and AMD, i.e., the controlled position followed the desired trajectory effectively without producing high-frequency vibration.These results clearly show the advantage of AG-PSMF.

Conclusions
This paper has presented a new model-free discrete-time sliding mode filter, which is named AG-PSMF, for removing noise by balancing the tradeoff between the filtering smoothness and the suppression of delay.The presented AG-PSMF is an extension of a previous parabolic sliding mode filter (PSMF) by including an adaptive gain, of which value is determined by an adaptive method inspired by FOAW.The effectiveness of AG-PSMF is validated through numerical examples and experiments.
One issue that is not addressed here but remains as a future study is to develop guidelines for selecting parameter values.In addition, the effectiveness of AG-PSMF is only validated through numerical methods, and thus theoretical validation should be conducted in future study.

Figure 1 .
Figure 1.The parabolic-shaped sliding surface (thick curve) and trajectories of the state of parabolic sliding mode filter (PSMF) (thin curve).
illustrates the quantized position control performances through the data of the average magnitude of position error |θ d − θ| and the average magnitude of duty ratio (normalized control voltage v) change rate | ḋ|, which are respectively defined as follows: AMP 1 11000 − 1000 11000 ∑ k=1000 |θ d (k) − θ(k)|, ) − d(k − 1)T .