# Nonlinear/Linear Switched Control of Inverted Pendulum System: Stability Analysis and Real-Time Implementation

Authors: Amira Tiga; Chekib Ghorbel; Naceur Benhadj Braiek
Journal: Mathematical Problems in Engineering
 (2019)

---

## Abstract

This paper treats the problems of stability analysis and control synthesis of the switched inverted pendulum system with nonlinear/linear controllers. The proposed control strategy consists of switching between backstepping and linear state feedback controllers on swing-up and stabilization zones, respectively. First, the backstepping controller is implemented to guarantee the rapid convergence of the pendulum to the desired rod angle from the vertical position. Next, the state feedback is employed to stabilize and maintain the system on the upright position inherently unstable. Based on the quadratic Lyapunov approach, the switching between the two zones is analyzed in order to determine a sufficient domain in which the stability of the desired equilibrium point is justified. A real-time experimentation shows a reduction of84% of the samples below the classical scheme when using only the backstepping control in the entire operating region. Furthermore, the reduction percentage has become 92% in comparison with the composite linear/linear controller.


---

## Body

## 1. Introduction

For several years, stability analysis and control synthesis of switched systems have received an increasing interest. This class of systems consists of a finite number of subsystems and a logical rule that orchestrates switching between them. Mathematically, these subsystems are usually described by differential equations. Examples of such switched systems can be found in chemical processes [1], power converters [2], automotive industry, electrical circuits [3], and many other fields.The most control structure of switched systems used in literature is to design the same number of linear subsystems and linear subcontrollers. Therefore, necessary and sufficient stability conditions are in general based on switched quadratic Lyapunov functions [4]. However, the main disadvantage of this structure consists of the complexity in designing several controllers and that does not easily account for all interactions between them. Lately, some researchers suggested another switching structure by applying only one controller [5]. Thus, a common quadratic Lyapunov function is used for all subsystems which ensures the asymptotic quadratic stability [5]. Despite the simplicity of this structure, there are many control and performance problems that could profit from it, for instance, the existence of systems that cannot be asymptotically stabilized by a single control law.Among the large variety of analysis and control problems of switched systems is the guarantee of a sufficient stability domain of the desired equilibrium point. In fact, the knowledge if a given initial state lies within such a stable region is a question of practical importance in many engineering applications as the synthesis of the preferment nonlinear controller [6]. Therefore, the majority of studies concerned with this object are setting in the Lyapunov method which is essentially applied to complex and nonlinear systems. Nevertheless, stability analysis of switched systems used in general is the Popov criterion [7], the circle criterion [8], and the positive-real lemma.In this paper, we have focused on an alternative switched control structure which includes both backstepping and linear feedback control laws. Indeed, this strategy ensures the rapidity of the system behavior in the closed loop and the minimization of subsystems and subcontroller numbers. Thereafter, the switch between these models has been analyzed using the quadratic Lyapunov approach and Sylvester’s criterion.One of the most important mechanical systems which treats extensively the issues cited above is the inverted pendulum. This system, inherently unstable with highly nonlinear dynamics, belongs to the class of underactuated systems having fewer control inputs than degrees of freedom. This renders the control task more challenging making this process a classical benchmark for testing and comparing different control techniques.The evolution space of the considered system can be decomposed into two operating zones: swing-up and stabilization zones in which nonlinear and linear feedback controllers are applied, respectively.This paper is organized as follows: Section2 depicts the proposed alternative switched control strategy. Section 3 outlines the mathematical model and the design of nonlinear/linear composite controller of the inverted pendulum system. Section 4 deals with determination of a sufficient domain in which the stability of the equilibrium point is justified.


## 2. Problem Formulation

A switched system consists of a finite number of dynamical subsystems and a switching unit that orchestrates between them. Indeed, the most control structure used, as depicted in Figure1, contains the same number of linear models Mi, for i=1,2,…,r, and linear subcontrollers Ci, for i=1,2,…,r. At each switching time instant, only one model and its subcontroller are active.Figure 1
Switched system control structure containing linear multicontrollers.Therefore, some important results of necessary and sufficient stability conditions have been obtained in [9, 10]. However, the major disadvantage of this structure is in the design of several subcontrollers and that does not easily account for all interactions between them.Some other researchers suggested another switched control structure, shown in Figure2, which consists of the design of a linear centralized controller C for all linear models Mi,i=1,2,…,r. This technique is simple to implement since it requires the design of only one controller.Figure 2
Switched system control structure containing linear centralized controllers.On the contrary, there are many control and performance problems that could profit from this approach; for instance, various objectives cannot be met by a single controller.In this paper, we have focused on an alternative switched structure, as can be seen in Figure3. Therefore, we have designed linear and nonlinear controllers in swing-up and stabilization zones, respectively. Indeed, this method ensures the rapidity of the closed-loop system behavior and the minimization of subsystems and subcontroller numbers. Thereafter, the switch between the two zones has been analyzed in order to determine a sufficient stability domain using the quadratic Lyapunov approach and Sylvester’s criterion.Figure 3
Proposed switched system control structure.This alternative switch structure can be perfectly applied to the inverted pendulum system, the mechanical model of which is illustrated in Figure4 [11, 12].Figure 4
Inverted pendulum system.This process consists of a rod and a moving cart in the horizontal direction. Its parameters are defined in Table1.Table 1
Inverted pendulum parameters.
Symbol
Parameter
Values
g
Gravity
9.81
m
/
s
2
l
Pole length
0.36
to
0.4
m
M
Mass of cart
2.4
kg
m
Mass of pendulum
0.23
kg
J
Moment of inertia of the pole
0.009
kg
⋅
m
2
b
Cart friction coefficient
0.05
Ns
/
m
d
Pendulum damping coefficient
0.005
Nms
/
radThe educational kit of the considered process, shown in Figure5, consists of a track of 1 m length with limit switches between −0.4 and 0.4m, PC Pentium 4 with PCI-1711 card, cable adaptor, optical encoders with HCTL2016 ICs, digital pendulum controller, cart, DC motor, pendulum with weight, Advantech PCI-1711 device driver, and adjustable feet with belt tension adjustment.Figure 5
Inverted pendulum experiment.In the next section, the proposed control structure will be applied to the inverted pendulum system in order to show its efficiency.


## 3. Switched Control Design

Our work aims to design a nonlinear (NL) control law, in the swing-up zone, to guarantee the rapid convergence of the pendulum from down position into the stabilization zone. Then, the switch to the linear (L) controller permits to stabilize it at the desired open-loop unstable equilibrium point.


### 3.1. Mathematical Modeling

The mathematical model of the inverted pendulum is depicted by the following nonlinear equations:(1)m+Mx¨+bx˙+mlθ¨cosθ−mlθ˙2sinθ=F,mlx¨cosθ+J+ml2θ¨−mglsinθ+dθ˙=0,where x (m) is the position of the cart, x˙ (m/s) is the velocity, θ (rad) is the rod angle from the vertical position, θ˙ (rad/s) is the angular velocity, and F (N) is the force.For(2)X=x1=xx2=x˙x3=θx4=θ˙,Equation (1) can be rewritten as follows:(3)x˙1=x2,x˙2=f1X+g1XF,x˙3=x4,x˙4=f2X+g2XF,with(4)f1X=ρ1XσX,f2X=ρ2XσX,g1X=J+ml2σX,g2X=−mlcosx3σX,ρ1X=J+ml2mlx42sinx3−J+ml2bx2−m2l2gcosx3sinx3+mldx4cosx3,ρ2X=−m2l2x42sinx3cosx3−dm+Mx4+m+Mmglsinx3+mlbx2cosx3,σX=m+MJ+ml2−mlcosx32.


### 3.2. Composite NL/L Controller

The proposed control strategy is based on switching between backstepping and linear state feedback on swing-up and stabilization zones, respectively. Therefore, the switching rule of the global control lawF is distributed into Fswp and Fstb in swing-up and stabilization zones, respectively, as depicted in Figure 6.Figure 6
Swing-up and stabilization zones.


#### 3.2.1. Linear Feedback Control in the Stabilization Zone

In this zone, system (3) can be linearized using the small-angle approximations which are as follows: sinθ≃θ,cosθ≃1, and θ˙2≃0. Then, it can be described by the following linear state equation:(5)X˙=AX+BFstb,with(6)A=01000a2a3a400010a5a6a7,B=0b10b2,a2=−J+ml2bm+MJ+ml2−ml2,a3=−ml2gm+MJ+ml2−ml2,a4=mldm+MJ+ml2−ml2,a5=mlbm+MJ+ml2−ml2,a6=m+Mmglm+MJ+ml2−ml2,a7=−m+Mdm+MJ+ml2−ml2,b1=J+ml2m+MJ+ml2−ml2,b2=−mlm+MJ+ml2−ml2.Based on the pole placement technique, we have applied the linear state feedback controller:(7)Fstb=−KstbX,where Kstb is the state feedback gain. From equations (5) and (7), we have in closed loop:(8)X˙=ABFX,where ABF=A−BKstb.


#### 3.2.2. Backstepping Controller in Swing-Up Zone

Backstepping control is known as a construction approach in the sense that it has a systematic way of constructing the Lyapunov function along with the control input design. To ensure the negativeness of the derivative of the every step Lyapunov function, it usually requires the cancelation of the indefinite cross-coupling terms [13].This NL controller is used to move the cartx until θ attains θlimit. The design of Fswp in the swing-up zone is illustrated as below:Step 1.
A new control variableε1 is defined as(9)ε1=x1−xref,where xref is the desired setpoint. Then, the derivative of ν1=1/2ε12 is obtained as(10)ν˙1=ε1ε˙1=ε1x2−x˙ref.
The function of stabilizationx2d is presented as follows:(11)x2d=x˙ref−c1ε1,where c1 is a positive constant.Step 2.
A second errorε2 is given by the following equation:(12)ε2=x2−x2d.
The derivative ofν2=ν1+1/2ε22 is described as follows:(13)ν˙2=ε1x2−x˙ref+ε2f1X+g1XF−x˙2d.
Thereafter, the backstepping control lawFswp is depicted as(14)Fswp=g1X−1x˙2d−f1X−ε1−c2ε2,where c2 is a positive constant.


## 3.1. Mathematical Modeling

The mathematical model of the inverted pendulum is depicted by the following nonlinear equations:(1)m+Mx¨+bx˙+mlθ¨cosθ−mlθ˙2sinθ=F,mlx¨cosθ+J+ml2θ¨−mglsinθ+dθ˙=0,where x (m) is the position of the cart, x˙ (m/s) is the velocity, θ (rad) is the rod angle from the vertical position, θ˙ (rad/s) is the angular velocity, and F (N) is the force.For(2)X=x1=xx2=x˙x3=θx4=θ˙,Equation (1) can be rewritten as follows:(3)x˙1=x2,x˙2=f1X+g1XF,x˙3=x4,x˙4=f2X+g2XF,with(4)f1X=ρ1XσX,f2X=ρ2XσX,g1X=J+ml2σX,g2X=−mlcosx3σX,ρ1X=J+ml2mlx42sinx3−J+ml2bx2−m2l2gcosx3sinx3+mldx4cosx3,ρ2X=−m2l2x42sinx3cosx3−dm+Mx4+m+Mmglsinx3+mlbx2cosx3,σX=m+MJ+ml2−mlcosx32.


## 3.2. Composite NL/L Controller

The proposed control strategy is based on switching between backstepping and linear state feedback on swing-up and stabilization zones, respectively. Therefore, the switching rule of the global control lawF is distributed into Fswp and Fstb in swing-up and stabilization zones, respectively, as depicted in Figure 6.Figure 6
Swing-up and stabilization zones.


### 3.2.1. Linear Feedback Control in the Stabilization Zone

In this zone, system (3) can be linearized using the small-angle approximations which are as follows: sinθ≃θ,cosθ≃1, and θ˙2≃0. Then, it can be described by the following linear state equation:(5)X˙=AX+BFstb,with(6)A=01000a2a3a400010a5a6a7,B=0b10b2,a2=−J+ml2bm+MJ+ml2−ml2,a3=−ml2gm+MJ+ml2−ml2,a4=mldm+MJ+ml2−ml2,a5=mlbm+MJ+ml2−ml2,a6=m+Mmglm+MJ+ml2−ml2,a7=−m+Mdm+MJ+ml2−ml2,b1=J+ml2m+MJ+ml2−ml2,b2=−mlm+MJ+ml2−ml2.Based on the pole placement technique, we have applied the linear state feedback controller:(7)Fstb=−KstbX,where Kstb is the state feedback gain. From equations (5) and (7), we have in closed loop:(8)X˙=ABFX,where ABF=A−BKstb.


### 3.2.2. Backstepping Controller in Swing-Up Zone

Backstepping control is known as a construction approach in the sense that it has a systematic way of constructing the Lyapunov function along with the control input design. To ensure the negativeness of the derivative of the every step Lyapunov function, it usually requires the cancelation of the indefinite cross-coupling terms [13].This NL controller is used to move the cartx until θ attains θlimit. The design of Fswp in the swing-up zone is illustrated as below:Step 1.
A new control variableε1 is defined as(9)ε1=x1−xref,where xref is the desired setpoint. Then, the derivative of ν1=1/2ε12 is obtained as(10)ν˙1=ε1ε˙1=ε1x2−x˙ref.
The function of stabilizationx2d is presented as follows:(11)x2d=x˙ref−c1ε1,where c1 is a positive constant.Step 2.
A second errorε2 is given by the following equation:(12)ε2=x2−x2d.
The derivative ofν2=ν1+1/2ε22 is described as follows:(13)ν˙2=ε1x2−x˙ref+ε2f1X+g1XF−x˙2d.
Thereafter, the backstepping control lawFswp is depicted as(14)Fswp=g1X−1x˙2d−f1X−ε1−c2ε2,where c2 is a positive constant.


## 3.2.1. Linear Feedback Control in the Stabilization Zone

In this zone, system (3) can be linearized using the small-angle approximations which are as follows: sinθ≃θ,cosθ≃1, and θ˙2≃0. Then, it can be described by the following linear state equation:(5)X˙=AX+BFstb,with(6)A=01000a2a3a400010a5a6a7,B=0b10b2,a2=−J+ml2bm+MJ+ml2−ml2,a3=−ml2gm+MJ+ml2−ml2,a4=mldm+MJ+ml2−ml2,a5=mlbm+MJ+ml2−ml2,a6=m+Mmglm+MJ+ml2−ml2,a7=−m+Mdm+MJ+ml2−ml2,b1=J+ml2m+MJ+ml2−ml2,b2=−mlm+MJ+ml2−ml2.Based on the pole placement technique, we have applied the linear state feedback controller:(7)Fstb=−KstbX,where Kstb is the state feedback gain. From equations (5) and (7), we have in closed loop:(8)X˙=ABFX,where ABF=A−BKstb.


## 3.2.2. Backstepping Controller in Swing-Up Zone

Backstepping control is known as a construction approach in the sense that it has a systematic way of constructing the Lyapunov function along with the control input design. To ensure the negativeness of the derivative of the every step Lyapunov function, it usually requires the cancelation of the indefinite cross-coupling terms [13].This NL controller is used to move the cartx until θ attains θlimit. The design of Fswp in the swing-up zone is illustrated as below:Step 1.
A new control variableε1 is defined as(9)ε1=x1−xref,where xref is the desired setpoint. Then, the derivative of ν1=1/2ε12 is obtained as(10)ν˙1=ε1ε˙1=ε1x2−x˙ref.
The function of stabilizationx2d is presented as follows:(11)x2d=x˙ref−c1ε1,where c1 is a positive constant.Step 2.
A second errorε2 is given by the following equation:(12)ε2=x2−x2d.
The derivative ofν2=ν1+1/2ε22 is described as follows:(13)ν˙2=ε1x2−x˙ref+ε2f1X+g1XF−x˙2d.
Thereafter, the backstepping control lawFswp is depicted as(14)Fswp=g1X−1x˙2d−f1X−ε1−c2ε2,where c2 is a positive constant.


## 4. System Analysis in the Stabilization Zone: Estimation of a Stability Domain

It is necessary to guarantee the switched NL/L controlled system stability, when it is provided by the linear feedback control law (7). Therefore, we have to determine the sufficient stability domain:(15)ξP,c=X∈R4VX≤c,V˙X<0,where c is a real-positive constant and VX is the positive definite quadratic Lyapunov function expressed as follows:(16)VX=XTPX.The symmetric positive definite matrixP is determined by solving the Lyapunov equation:(17)ABFTP+PABF=−Q,where Q=QT>0. Asymptotic stability of the equilibrium X=0R4 of the nonlinear model (3) provided of a feedback linear control law (7) is guaranteed when the derivative of VX:(18)V˙X=X˙TPX+XTPX˙,is negative definite.Equation (18) can be rewritten as(19)V˙X=XTξXX,where(20)ξX=a11⋅a12⋅a13⋅a14⋅0a22⋅a23⋅a24⋅00a33⋅a34⋅000a44⋅,and the parameters aij⋅ are detailed in Appendix.As also, the matrixξX can be transformed in the following symmetric form:(21)ψX=12ξX+ξTX.By applying Sylvester’s criterion, the closed-loop system is asymptotically stable ifψX<0. Accordingly, the elementary determinants Δi, for i=1,2,3,4, should satisfy(22)Δ1=a11⋅<−ε,Δ2=2a11⋅a12⋅a12⋅2a22⋅>ε,Δ3=2a11⋅a12⋅a13⋅a12⋅2a22⋅a23⋅a13⋅a23⋅2a33⋅<−ε,Δ4=detψX>ε,where ε>0.Subsequently, by solving the inequality system (22), the condition V˙X<0 leads to x3≤θmax which can be rewritten as(23)LX≤θmax,where L=0010. Thus, we state the following result.Theorem 1.
The equilibrium pointX=0R4 of the nonlinear system (3) provided of a feedback linear control law (7) is asymptotically stable in the attraction domain:(24)ξP,c=X∈R4XTPX≤θmaxLS−12,if there exist a positive definite matrix P, a solution of Lyapunov equation (17), and a not unitary orthogonal matrix S such that P=STS.Proof 1.
The proof of the above theorem is based on the quadratic Lyapunov functionVX described by equation (16) and its time derivative V˙X given by equation (19). Therefore, based on the eigen decomposition, the matrix P can be reduced in the form:(25)P=GTDG,where G is an orthogonal matrix and D is a diagonal matrix. Then, by writing D=WTW, we obtain(26)P=STS,where S=WG.
Consequently, the quadratic Lyapunov functionVX can be expressed by the following equation:(27)VX=Z2,where Z=SX. Then, the condition V˙X<0 leads to inequality (23) which becomes(28)LS−1Z≤θmax.
On the contrary, we have(29)LS−1Z≤LS−1Z.
From conditions (28) and (29), we consider that(30)LS−1Z≤θmax,or otherwise,(31)Z≤θmaxLS−1.
Therefore, the asymptotic stability domainξP,c given in (24) is justified.


## 5. Results and Discussion

This section deals with the results obtained using the composite NL/L controller in real time. Indeed, we have set the backstepping controller parameters in the swing-up zone:c1=3.7 and c2=2.6. In the stabilization zone, by selecting the desired closed-loop poles: Pdes=−1.5−2.8−4.5−6, we have determined the following state feedback controller gain: Kstb=−12−51−351−116.Furthermore, by applying the proposed theorem, we have numerically obtained the following:(32)P=5.932.070.190.632.078.275.734.860.195.7323.489.770.634.869.77155.81,Q=4815−27841566−2151−27−21168−368451−36558,G=0.74−0.640.180.006−0.66−0.700.260.080.040.310.94−0.080.0040.030.070.99,S=1.53−1.310.370.01−1.88−1.980.740.020.211.554.68−0.410.060.440.9312.48,θmax=0.58,c=8.25.Hence, the evolution of the four elementary determinantsΔ1∼Δ4 is depicted in Figures 7–10, respectively.Figure 7
Evolution ofΔ1θ.Figure 8
Evolution ofΔ2θ.Figure 9
Evolution ofΔ3θ.Figure 10
Evolution ofΔ4θ,θ˙.Based on the proposed strategy, we have carried out the real-time control experiment of the inverted pendulurm system. Therefore, the composite backstepping/linear state controller feedback has been implemented to swing rapidly the pendulum from its initial position into the desired angle and, then, to guarantee its stabilization.The experimental results of positionx (m), angle θ (rad), and force F (N) are shown in Figure 11.Figure 11
Real-time trajectories of (a)x (m), (b) θ (rad), and (c) F (N) with the composite NL/L controller.
(a)
(b)
(c)To valid the above experimental study, we have verified, at the switch timet1=2.92s corresponding to θlimit=π/8rad, that VXlimit=XlimitTPXlimit=7.62<c where the real-time values of the considered state variables are given by xlimit=−0.19m, x˙limit=−0.04m/s, θlimit=π/8rad, and θ˙limit=0.14rad/s.In conclusion, real-time results show that the NL/L controller provides excellent performance. In fact, this type of control guarantees more rapidity with comparison to the response of the backstepping controller in the entire operating region, illustrated in Figure12, and on the contrary with the response of the composite L/L controller, depicted in Figure 13. Indeed, the swing-up phase has taken 15.4 and 42 seconds to stabilize the inverted pendulum when using the NL controller in the entire operating zone and the composite L/L controller, respectively.Figure 12
Real-time trajectories of (a)x (m), (b) θ (rad), and (c) F (N) with only backstepping control in the entire operating region.
(a)
(b)
(c)Figure 13
Real-time trajectories of (a)x (m), (b) θ (rad), and (c) F (N) with the composite L/L controller.
(a)
(b)
(c)The reader can find a video that shows the performance of the real-time composite backstepping/linear state feedback controller implemented for the inverted pendulum system:https://www.youtube.com/watch?reload=9v=m2PsGHmlH04feature=youtu.be.


## 6. Conclusion

In this paper, we have applied an alternative switched control structure consisting of backstepping and linear state feedback controllers in swing-up and stabilization zones, respectively. Indeed, the nonlinear controller was implemented to guarantee the rapid convergence of the pendulum from down position into the stabilization zone. Then, the switch to the linear controller stabilizes it at the equilibrium point.Based on the quadratic Lyapunov approach and Sylvester’s criterion, we have determined a sufficient stability domain in which the equilibrium point of the considered closed-loop system is justified.A real-time experimentation shows the effectiveness of the proposed control strategy and proves a reduction of84% of the samples below the conventional scheme when applying only the backstepping controller in the entire operating region. Furthermore, the reduction percentage has become 92% in comparison with the composite linear/linear controller.



---

*Source: 2391587-2019-08-07.xml*