Embedded adaptive fractional-order sliding mode control based on TSK fuzzy system for nonlinear fractional-order systems

An adaptive fractional-order sliding mode control (AFOSMC) is proposed to control a nonlinear fractional-order system. This scheme combines the features of sliding mode control and fractional control for improving the response of nonlinear systems. The structure of AFOSMC includes two units: fractional-order sliding mode control (FOSMC) and the tuning unit that employs a certain Takagi–Sugeno–Kang fuzzy logic system for online adjusting the parameters of FOSMC. Tuning the parameters of the FOSMC improves its performance with various control problems. Moreover, stability analysis of the proposed controller is studied using Lyapunov theorem. Finally, the developed control scheme is introduced for controlling a fractional-order gyroscope system. The proposed AFOSMC is implemented practically using a microcontroller where the test is carried out using the hardware-in-the-loop simulation. The practical results indicate the improvements and enhancements introduced by the developed controller under external disturbance, uncertainties and random noise effects.


Introduction
Fractional calculus is an ancient mathematical research branch that has almost been unapplied for many years (Podlubny 1999;Gutierrez et al. 2010).However, in recent years, this field of science has acquired many interests.It is because the mathematical approaches for fractional calculus have tremendous development.On the other hand, the fractional-order simulation has come to play a significant role in many applications and physical processes in the natural world (Sun et al. 2009;Ding and Ye 2009).Modeling of some systems in the fractional-order (FO) forms is more precise than integral models.FO chaotic systems (Ahmad and Sprott 2003), financial systems (S ˇkovra ´nek et al. 2012), biological systems (Magin 2010), viscoelastic fluids (Song and Jiang 1998) and transportation systems (Saussereau 2012) are just a few of the models used in FO calculus.One of the significant methods used for improving the control system efficiency is the fractional calculus, which is combined with other conventional control schemes, like a fractional-order optimal control (Tepljakov et al. 2015;Perng et al. 2017;Asl et al. 2018), fractional-order adaptive control (Odibat 2010), and fractional-order PID control (Agrawal 2004).
Sliding mode control (SMC) is renowned as a robust technique suited to synchronization problems (Aghababa 2012(Aghababa , 2014;;Mobayen et al. 2017).Also, it is an efficient and reliable control technique commonly applied in many applications.The most important feature of SMC is that its variable structure control where a sliding surface is designed in the state space.Furthermore, a powerful control part will switch SMC law to enforce the states into a sliding state on the designed surface.Since the system dynamics are considered through sliding surface design.Therefore, SMC can successfully deal with external disturbances and variation of the controlled system parameters.The SMC methodology was developed using various techniques and constructed based on several approaches (Chen et al. 2013;Feng et al. 2002;Jin et al. 2009;Mathiyalagan andSangeetha 2020 Tran andKang 2016;Wu et al. 1998;Yu and Zhihong 2002;Yu et al. 2005).
The FO is incorporated into the design of SMC, considering the advantages of FO calculus, which can improve the chattering problem and speed up the closed-loop response.As a significant method for improving the control efficiency, fractional calculus combines with other conventional control systems, such as fractional-order sliding mode control (FOSMC) (Zhang et al. 2014;Yin et al. 2014Yin et al. , 2015)).Recently, FOSMC has been applied in some industrial applications for improving control system performance to enhance the system response (de Oliveira et al. 2017), such as hydraulic manipulators (Wang et al. 2016), linear motor (Sun et al. 2018), synchronous motors (Zhang et al. 2012), and a kinematic model of a car (Zhang et al. 2017).FOSMC was introduced in (de Oliveira et al. 2017) based on particle swarm optimization, and it was presented in (Zhang et al. 2017) based on a linear-quadratic regulator (LQR) to control uncertain nonlinear systems.A disturbance observer based on FOSMC for nonlinear systems including mismatched disturbances was proposed in Pashaei and Badamchizadeh (2016).In Heidarpoor et al. (2017), FOSMC was constructed with a fractional-order sliding surface for DC motor speed control.Model-free FOSMC based on an extended state observer was proposed to control the nonlinear quarter car active suspension system in (Wang et al. 2018).The fractional-order fuzzy control method based on immersion and invariance approach was introduced in Mohammadzadeh and Kaynak (2020).The fuzzy control was designed based on the nonsingleton type-2 fuzzy neural network.Furthermore, the measurement errors and dynamic uncertainties were compensated, and the system stability was achieved.The fractional-order multiple-model type-3 fuzzy control for a class of uncertain nonlinear system with unmodeled dynamics was introduced in Mohammadzadeh et al. (2021).The consequent parameters for the controller were derived based on the linear inequality approach to guarantee the system stability.

Motivation
The performance of any controller highly depends upon how tightly its parameters are tuned with personalize performance indices.Therefore, it's still very important to seek different techniques to tune the controller's key parameters.Recently, researchers working on FOSMC try to develop adaptive techniques for tuning its parameters (Kumar and Rana 2017).The tuning of these parameters provides an enhancement on the system's performance.Adaptive controllers based on intelligent techniques can recognize the object's characteristic parameters online, adjust the control strategy performance on time, and hold the quality index of the control system in the best possible range.Fuzzy logic system (FLS) is rated as an active intelligent approach in control theory where it is based on artificial experience (Jana et al. 2017(Jana et al. , 2018;;Khalifa et al. 2020;Tian et al. 2010).Motivated by the discussion above, an adaptive FOSMC (AFOSMC) is presented in this paper.The adaptation algorithms for the proposed AFOSMC are performed based on the TSK-FLS where the controller parameters are updated online.Also, the proposed scheme is implemented practically using a microcontroller for controlling a fractional-order nonlinear system so that it can be applicable in real-word applications.On the other hand, external disturbance, uncertainties, and random noise effects are compensated and the closed-loop stability is studied based on Lyapunov theory to guarantee the system stability.

Novelties and contributions
The most important contributions of this study are specified as: • Enhancement of the proposed controller efficiency by dynamically adjusting its parameters online using TSK-FLS based on Lyapunov stability theorem.• The proposed controller is implemented practically using a microcontroller, which is used as an embedded controller.• The effectiveness of the proposed scheme is verified by experimental studies based on the hardware-in-the-loop methodology.
The next parts in this paper are organized as: Sect. 2 introduces some essential definitions of FC and the used approximation method of the fractional operators.The proposed FOSMC is presented in Sect.3. The adaptive FOSMC with its tuning mechanism is described in Sect. 4. Section 5 delivers the hardware-in-the-loop simulation obtained with the proposed controller.Conclusions of this study are concluded in Sect.6, and finally, the relevant references are written down.

Basic definitions of fractional calculus
There are many different definitions of the fractional-order integration and differentiation.Among these, main definitions are Grunwald -Letnikov (GL), Riemann-Liouville (RL) and Caputo (Podlubny 1998).The GL definition is given as: where b D c t denotes the fractional derivative operator with order c and terminals b; t. ½ðt À bÞ=h is integer part, c represents the FO operator, and h denotes the step size.The Gamma function used in the above equation can be defined by the following equation:

FO operators' approximation
To find the integer transfer function that approximates the dynamic behavior of a given fractional transfer function.GL approximation is one of the most used methods to approximate the FO transfer function, and it is given as (Vale ´rio and Da Costa 2013): where T s is the sampling time and z Àk is transform of t in the Laplace transform domain.

Problem formulation
Consider the following FO nonlinear system (Binazadeh and Shafiei 2013): where c 2 ½0; 1 gives the system order, x 1 and x 2 are the states, f ðx; tÞ and gðx; tÞ are nonlinear Lipchitz functions in x and piecewise continuous in t, and uðtÞ defines the input of the system.
3 Fractional-order sliding mode control FOSMC has been become an active area in recent years as a controller to respond the external disturbances and uncertainties of nonlinear systems.Choosing the sliding surface is the most important step in designing the FOSMC.Let the FO sliding surface (FOSS); dðtÞ can be selected as: where eðtÞ ¼ x d À x 2 denotes the tracking error with output desired value x d and x 2 is the system output.k p and k d are design parameters, and l denotes the FO parameter.The main objective of the FOSMC is to access the error signal e ðtÞ to the FOSS and so moving along this surface to origin point.The control law for the FOSMC should make the system output track the desired trajectory, in which e ðtÞ ¼ 0, and it is divided into two parts; the first part represents the equivalent control and it can be obtained when the trajectory close to dðtÞ ¼ 0. The second part is the hitting control, which is obtained when dðtÞ 6 ¼ 0.
The derivative of the FOSS, which is defined in Eq. ( 6), is obtained as: Equation ( 8) can be rewritten as: From Eqs. (5 and 9), we get the following: The output trajectory is maintained on FOSS; dðtÞ with an essential condition that is _ dðtÞ ¼ 0. Setting _ dðtÞ ¼ 0, we get the equivalent control law; u eq ðtÞ as: The control law for the FOSMC; uðtÞ is given as: where u sw ðtÞ is the hitting or reaching control law.Now, it is necessary to develop a reaching control law that forces the trajectories to reach and stay on the sliding surface in the finite time.The reaching control law can be obtained as shown in the following theorem.
Proof 1: By employing Lyapunov function V 1 ðtÞ ¼ 1 2 dðtÞ 2 [ 0, with its time derivative which is derived as: By substituting the control law defined in Eq. ( 12) into Eq.( 9), we get: Equation ( 16) may be reformulated as: D c d ¼ Àk p gðx; tÞ u sw ðtÞ ð 18Þ By extending D 1Àc operator to both sides of Eq. ( 18), we have: To ensure the stability of FOSMC, the reaching control law should be described as: where L and X are positive constants which satisfy _ vðtÞ 0 and the proof is completed.
From Eqs. (14, 16), the control signal can be obtained as: Applying Laplace transform to above equation, we get the control signal in s domain as: In order to implement the control signal using a microcontroller, the above control signal should be obtained in discrete form.Using the approximation method, which is defined in Eq. ( 4), the discrete form of the control law is given as: As deduced in this section, it is noted that the control law for the FOSMC and the sufficient stability condition are dependent on the gains; k p ; k d ; L; X and fractional-order parameter; l.These parameters have a valuable effect in obtaining the optimal control law and thus better system performance.Therefore, tuning of such parameters gives a significant improvement in FOSMC performance.In the next section, the adaptive FOSMC is developed using the tuning algorithm to update the controller's parameters online.

Adaptive FOSMC
The structure of the proposed AFOSMC is described in Fig. 1.It includes two units: FOSMC, which is used as the main controller, and a tuning mechanism unit that is employed to generate the parameters of FOSMC (k p ; k d ; L; X and l) using a TSK-FLS, which is described in Fig. 2.
The tuning unit has two inputs (e ðkÞ,D e ðkÞ) and one output variable h ðkÞ, where hðkÞ ¼ ½k P ; k d ; L ; X ; l .
The adaptation algorithm represented by the TSK-FLS includes four operations: fuzzification operation, TSK rule base, fuzzy inference engine and defuzzification operation.The procedure of the TSK-FLS used as tuning unit is explained in detail as follows.

Fuzzification process
The fuzzification process maps crisp inputs into fuzzy grades.The input variables can be represented by any type of membership function.In this paper, the two inputs eðkÞ and D e ðkÞ are fuzzified by a Gaussian fuzzy set, which is easier to use.It is shown in Fig. 3, and it is given as:

Rule base and inference engine
TSK type fuzzy rule is used in the inference stage and the i th rule can be described as: where A i n ðn ¼ 1; 2Þ is the fuzzy set of input variable n in rule i (i ¼ 1; :::; I) and I is the fuzzy rules number.In this TSK type fuzzy rule, the conclusion part is a linear combination of the two inputs; e k ð Þ and De k ð Þ.The firing grades of these rules are obtained as: where l A i 1 and l A i 2 refer to fuzzy membership grades for A i 1 and A i 2 , respectively.l Ri gives is the firing level of the fuzzy relation set, and indicates t-norm operation.In this paper, the product t-norm is used.

Defuzzification process
The crisp output of the TSK-FLS is obtained through the defuzzification operation as: Embedded adaptive fractional-order sliding mode control based on TSK fuzzy system for nonlinear… 15467 where is the input vector.Equation (28) may be rewritten as: where Q ¼ ½Q 1 Q 2 ::: Q I is the aggregated vector of consequent parameters in which Q i ¼ ½q i 0 q i 1 q i 2 and / ¼ ½/ 1 / 2 ::: / I defines a basis function vector and / i is obtained as in Eq. ( 30): Regarding the tuned parameters of FOSMC obtained online using TSK-FLS, the stability of the tuning unit should be ensured.It is required to update the parameters of TSK-FLS in order to strength the stability of the controller.In this section, the consequent parameters are adjusted based on an adaption equation, which is developed and obtained based on Lyapunov stability theorem.
Let the Lyapunov function is chosen as: where V 2 ðkÞ is a positive definite function, eðkÞ is the error signal, and Q ¼ ½q i 0 q i 1 q i 2 is the aggregated vector of the adjustable parameters.
Theorem 2: For Lyapunov function, DV 2 ðkÞ 0 is satisfied if and only if the parameter adjustment rule is obtained as: Proof: Let the change in the Lyapunov function is defined as: Equation (33) can be rewritten as: Let DeðkÞ ¼ eðk þ 1Þ À eðkÞ and DQðkÞ ¼ Qðk þ 1ÞÀ QðkÞ, Equation ( 34) can be rewritten as: For a very small change, Eq. ( 36) can be rewritten as: To guarantee the stability, the second condition for the stability is DV 2 ðkÞ 0. Then: After performing some mathematical operations for above equation, we obtained the updating equation which is defined in Eq. ( 32).This completes the proof.
Then, the updating parameters for the TSK-FLS are given as: where g is the learning rate constant.The consequent parameters are updated online based on the above theorem.Let q i j ðkÞ; j ¼ 0; 1; 2 to denote these parameters' values at a time k.The update equation for these parameters is described as: where g j is the learning rate for tuning the consequent parameters.To find oeðkÞ .oq i j ðkÞ, we note that q i j ðkÞ is not where w u is the change of the output toward the change in the control signal which defined as follows: In many practical cases, the derivative in Eq. ( 43) can be easily estimated or replaced ? 1 or -1 (Tanomaru and matu 1992).
The pseudo code of the proposed algorithm can be illustrated as follows: Algorithm: Pseudo code of the proposed AFOSMC algorithm 1: Initialize the controller parameters; (k p ; k d ; L; X and l)

2:
Initialize the consequent parameters of the TSK-FLS; In this section, the proposed AFOSMC, which is described in the previous sections, is implemented practically and applied to nonlinear FO system based on hardware-in-theloop simulation.

Hardware-in-the-loop simulation
Hardware-in-the-loop (HIL) simulation is increasingly being required for the design; implementation and testing of control systems, where some of the control loop components are real hardware and some are simulated.Usually, the real system is performed using software program and the control system is implemented hardware (Saleem et al. 2010).The proposed AFOSMC that is described in Sects.3 and 4 is implemented practically using an Arduino DUE microcontroller kit for controlling the gyroscope system where the sampling time for the system is 0.005 s.The communication between the MATLAB and Arduino is performed by serial communication via RS232.Figure 4 shows the real implementation of HIL simulation setup for the nonlinear FO gyroscope.

Practical results
In this section, the real-time simulation results for a nonlinear FO system representing a gyroscope system controlled using the proposed AFOSMC are presented.FO gyroscope system is tested in order to clarify AFOSMC performance.The gyroscope is considered as one of the main dynamic systems in some vital applications such as major navigation, space engineering, etc.This system is represented by a FO model that has a chaotic nature and a control input is given in the second state to overcome the chaos controlled by those equations (Binazadeh and Shafiei 2013): Embedded adaptive fractional-order sliding mode control based on TSK fuzzy system for nonlinear… 15469 where x 1 and x 2 represent the rotation angle and its derivative, respectively.j 1 ¼ 100 ; j 2 ¼ 0:5; j 3 ¼ 0:05 ; j 4 ¼ 1 ;j 5 ¼ 35:5 and x ¼ 25: D j 1 ; D j 2 ; D j 3 ; D j 4 and Dj 5 represent the uncertainties in the system parameters.The term dðtÞ expresses to the external disturbance.c indicates FO of the system, and it is selected with value 0.97 that leads to chaos for this system.The proposed AFOSMC is designed in a valuable manner to curb the chaotic behavior of FO gyroscope.The gyroscope states are initialized as x 1 ð0Þ ¼ À0:3 and x 2 ð0Þ ¼ 0:3 and it is simulated with y d ¼ 0. Several tasks are performed including external disturbance, uncertainties and random noise.
Figure 5 shows the membership functions (MFs) for the Gaussian fuzzy sets of input variables of the tuning mechanism.
For visual indications of the proposed AFOSMC performance, three control performance indices in terms of the integral of square of error (ISE), mean absolute error (MAE), and the integral of absolute error (IAE), which are defined in the following equations (Khater et al. 2019;Shaheen et al. 2018;Zaki et al. 2021) are measured and compared with the obtained performance indices of other controllers.
where eðkÞ,yðkÞ and y d ðkÞ define error signal, output of the system and desired output in discrete form, respectively.
To clarify the improvements in gyroscope system responses, the developed AFOSMC performance is compared with its counterpart of non-adaptive FOSMC based on particle swarm optimization (FOSMC-PSO) (de Oliveira et al. 2017).

Task 1: external disturbance
The performances of the proposed AFOSMC and FOSMC-PSO are indicated in this task with the external disturbance effect.Figures 6, 7, 8 show the output response, control signal and MAE values, respectively.An external disturbance dðtÞ equal to 10 is added at 6 s, and the disturbance is increased to the value 20 at 14 s.From the obtained system response, the performance of the proposed AFOSMC can track the desired output faster than the FOSMC-PSO at the transient time and after adding disturbance values.On the other hand, the obtained MAE for the proposed AFOSMC is lower than that obtained for another controller, which means that the proposed controller is able to respond the effect of external disturbance.Case 2: The uncertainty in the parameters with the values; Dj 1 ¼ À14; Dj 2 ¼ À0:2 ; Dj 3 ¼ À0:02 ; Dj 4 ¼0:2 and Dj 5 ¼ À10 are added at time equal 10 s.Figures 12,  13, 14 indicate the response of the FO system with applied controllers.As obviously from Fig. 12, the FO system has a stable response even after adding the uncertainties with the proposed AFOSMC, but the output response has large oscillations with FOSMC-PSO.Also, the obtained MAE for the proposed AFOSMC is decreased, which means that the system is stable while it is increased with FOSMC-PSO, which means that the system becomes unstable as shown in Fig. 14.Therefore, the proposed controller is able to respond to the effect of system uncertainties due to the online updating of the controller parameters using the tuning algorithm.

Task 3: the effect of random noise
The response of the gyroscope system under the effect of the random noise is shown in Figs. 15,16,17.A Gaussian noise with standard normal distribution is added to the control signal.It is clear from the system response and the obtained MAE that the performance of the proposed AFOSMC has better than another controller.

Task 4: the effect of random noise with uncertainty in the parameters:
The response of the gyroscope system under the effect of the random noise with uncertainty in the parameters is shown in Figs. 18 19,20.A Gaussian noise with standard In order to show the improvements of the proposed AFOSMC, it is compared with other adaptive SMC algorithms, which published previously such as adaptive fuzzy sliding mode control (AFSMC) (Shabani 2016) and novel fractional sliding mode control (NFSMC) (Aghababa 2012).Tables 1, 2, 3 list the values of the measured performance indices obtained for the proposed AFOSMC and other controllers.The ISE, MAE and the IAE values for the proposed AFOSMC are lower than that obtained with the other controllers.Therefore, the proposed AFOSMC is superior to overcome external disturbance, uncertainties in the parameters and random noise with a better performance compared to other controllers.This paper proposes an AFOSMC for nonlinear FO systems.The controller's stability is analyzed and ensured based on Lyapunov stability theory.The controller's key parameters are adjusted online using an intelligent tuning mechanism for providing an enhancement on system response.The proposed AFOSMC is implemented practically using the Ardunio DUE Kit for controlling the gyroscope system.All the controllers are tested with different control tasks including external disturbance, uncertainty in parameters and random noise.Practical results obtained in this paper confirm that the proposed AFOSMC c and r are the parameters of the Gaussian fuzzy set, e ¼ e ðkÞ or D eðkÞ.

Fig. 1
Fig. 1 Block diagram of the proposed AFOSMC to N where N is the total iteration number 4: Compute the error signal; eðkÞ ¼ x d À x 2 5: Compute the control signal; uðkÞ by Eq. parameters; (k p ; k d ; L; X and l)

Fig. 4
Fig. 4 Implementation of HIL simulation of a gyroscope system

Fig. 5
Fig. 5 MFs of input variables for the tuning mechanism

Fig. 10
Fig. 10 Control signal of simulated system for uncertainty in system's parameters [Task 2 (Case 1)]

Fig. 13
Fig. 13 Control signal of simulated system for uncertainty in system's parameters [Task 2 (Case 2)]

Fig. 16
Fig.16Control signal of simulated system for the effect of random noise (Task 3)

Fig. 19
Fig.19Control signal of simulated system for the effect of random noise with uncertainty in the parameters (Task 4)

Table 1
ISE for the gyroscope system

Table 3
IAE for the gyroscope system deliver better responses where it has the ability to respond disturbance, uncertainties and noise faster than other existing controllers.The measured performance indices indicated that the proposed AFOSMC has the lowest values of errors than other controllers.Finally, the proposed AFOSMC provides a superior performance in controlling nonlinear systems.In the future work, we will apply the proposed scheme to multi-input-multi-output nonlinear FO systems.Also, we will develop other tuning algorithms to estimate the optimal parameters of the FOSMC using other intelligent schemes like type-2 fuzzy neural networks.Funding Open access funding provided by The Science, Technology & Innovation Funding Authority (STDF) in cooperation with The Egyptian Knowledge Bank (EKB).No funding was received for conducting this study. could