Russian Journal of Nonlinear Dynamics, 2023, vol. 19, no. 4, pp. 507-519. Full-texts are available at http://nd.ics.org.ru DOI: 10.20537/nd231101
NONLINEAR PHYSICS AND MECHANICS
MSC 2010: 93D21
Adaptive Compensation for Unknown External Disturbances for an Inverted Pendulum Based on the Internal Model Principle
H. D. Long, N. A. Dudarenko
In this paper, an adaptive compensator for unknown external disturbances for an inverted pendulum based on the internal model principle is designed. The inverted pendulum is a typical system that has many applications in social life, such as missile launchers, pendubots, human walking and segways, and so on. Furthermore, the inverted pendulum is a high-order nonlinear system, and its parameters are difficult to determine accurately. The physical constraints lead to the complexity of its control design. Besides, there are some unknown external disturbances that affect the inverted pendulum when it operates. The designed adaptive compensation ensures the outputs of the system's convergence to the desired values while also ensuring a stable system with variable parameters and unknown disturbances. The simulation results are illustrated and compared with the linear quadratic regulator (LQR) controller to show the effectiveness of the proposed compensator.
Keywords: adaptive control, unknown external disturbances, inverted pendulum, internal model principle, linear quadratic regulator
1. Introduction
Nonlinear systems affected by unknown external disturbances play an important role in the field of control engineering [1]. They need to be applied with suitable control techniques to improve the system's performance. There has been some previous work on the control design for an inverted pendulum [2-5]. In the study [2], the authors designed a control method for an inverted pendulum based on controlled Lagrangians (CL). This method has the advantage that asymptotic stabilization can be guaranteed by using energy-based Lyapunov functions.
Received April 01, 2023 Accepted October 05, 2023
Hoang Duc Long [email protected] Natalia A. Dudarenko [email protected]
ITMO University
Kronverksky pros. 49, Saint Petersburg, 197101 Russia
Besides, it leads to explicit and relatively simple control laws that can be easily implemented in practice. However, the setting time of the outputs is high, and the problem of unknown external disturbances was not considered in that paper. In the study [3], the author presented a continuous state feedback law for almost global stabilization of a planar inverted pendulum on a cart. The synthesis was carried out by exploiting energy-shaping techniques and a suitable smooth switching between positive and negative feedback. Nevertheless, the author only considered the upright pendulum position and neglected the cart's position and the limitations of the control signal. In the study [4], the authors introduced a controller for swing-up and balance of a single inverted pendulum using the state dependent Riccati equation (SDRE) method. This method was more stable and robust than the other methods. But the SDRE method requires that it be solved at every step, which is basically solving the algebraic Riccati equation (ARE) at every instant. This method has a large computational volume and delay when applied to objects that need a fast response. In the study [5], the problem of minimizing the mean square deviation of the pendulum from an unstable equilibrium position is discussed. The author constructed an optimal feedback control containing special second-order trajectories and trajectories with chattering for a linearized model. However, this method required an infinite number of switchings of the control, which made it difficult to apply to practical systems.
The adaptive compensation of unknown external disturbances and disturbance rejection for nonlinear systems have been good topics for researchers in recent years [6, 7]. In [6], the authors presented an introduction and an overview of the theoretical and practical aspects of adaptive control. Besides, some adaptive control designs were also introduced, such as self-tuning control, model-reference adaptive control, and stochastic adaptive control. In [7], the problems of designing a control law for an unstable, underactuated object and stabilizing a desired operating regime were addressed. If the number of control inputs is less than the number of degrees of freedom, then designing a control law typically presents some difficulties. The control law design for unstable systems developed in this monograph is based on methods of optimal control theory.
In this paper, the authors design an adaptive compensator for the inverted pendulum based on the internal model principle (IMP) that solves some of the problems of the previous studies. The nonlinear model of the system is considered, and the parameters of adaptive control can be updated from the state variables of the original mathematical model. The linearized model at the equilibrium point is used to calculate the matrices of the adaptive compensator. The paper is organized as follows: Section 2 presents an adaptive compensation for unknown external disturbances based on the internal model principle. Section 3 proposes the design of the compensator for the inverted pendulum affected by unknown external disturbances. In this section, the simulation results are demonstrated to prove the effectiveness of the proposed method. Some conclusions are drawn in Section 4.
2. Adaptive compensation of unknown external disturbances based on the internal model principle
Consider the following system affected by external disturbances [9, 10]:
f x(t) = Ax(t) + bu(t) + d5(t) I y(t) = cTx(t),
T _ x(0) = x0, (2.1)
where x(t) G Rn is the state vector, u(t) G Rm is the control vector, y(t) G Rp is the output vector, 5(t) G R9 is the unmeasured disturbance, A G Rnxn, b G Rnxm, and cT G Rpxn are
^ t (0)= to, (2.2)
the state matrix, control matrix and output matrix, respectively, d E Rnxq is the matrix of disturbances, and «(0) — Xq is the initial state of the system.
It will be assumed that the external disturbance 5(t) [9, 10] can be represented as the output of a linear model
U(t) — m), \ s(t) — hT at),
where {(t) E Rq is a state vector, r E Rqxq is a constant matrix, hT E Rmxq is a matrix of constant coefficients, and {(0) — {0 is the initial state of the external disturbance.
The control problem is the asymptotic stabilization of the state vector x(t) at the zero value when the system (2.1) is affected by an unknown external disturbance S(t). There are some problems when designing the compensation of the unknown external disturbance [9]:
• the state vector x(t) is inaccessible to direct measurements;
• neither the disturbance 5(t) nor the state vector {(t) are available for measurements;
• the external disturbance 5(t) is unknown (the matrices r and h are unknown).
From a mathematical point of view, this situation means that the external disturbance (2.2) is parametrically indefinite. This motivates the use of adaptive control methods to compensate for the unknown external disturbance. When designing the adaptive compensation, the following conditions are satisfied [9]:
• the parameters of the matrices r and h are unknown, while the dimension of the disturbance q is known;
• the pair (hT, r) is completely observable;
• the eigenvalues of the matrix r are different and lie on the imaginary axis (this condition guarantees the boundedness of the disturbance 5(t) and ensures the boundedness of the control signal u(t)).
2.1. The filter model of external disturbances
The disturbance model 5(t) can be represented in the filter model [8, 9] as follows:
I X(t) — Gx(t) + LS(t), I 5(t) — eTx(t),
t ^ (2.3)
where G E Rqxq is a Hurwitz matrix, L E Rqxq, the pair (G, L) is completely controllable, dT — hTM-1 E Rmxq is the matrix of constant coefficients, and x(t) E Rq is the state vector of the filter model (2.3) with the initial condition x(0).
The transformed state is
X(t) — M{(t), (2.4)
and the state transformation matrix M E Rqxq is the solution of the Sylvester equation:
Mr - GM — LhT. (2.5)
The filter model (2.3) will be used to design an adaptive compensation for unknown external disturbances. Since the matrix r and the vector h are unknown, so are the coordinate transformation matrix M and the vector 0. In other words, in the filter model (2.3), the uncertainty of the external disturbance 5(t) is reduced to the uncertainty of the vector of constant parameters 0.
2.2. Adaptive compensation of unknown external disturbances
The solution of the external disturbance compensation problem of the system (2.1) under the assumption that b = d is considered [9]. So, dimension q will be replaced by dimension m in the size of matrices and vectors (b = d G Rnxm; u G Rm; 5 G Rm; dT G Rmxm; L G Rmxm). The control system has the following form:
x(t) = Ax(t) + b(u(t) + 5(t)), (2.6)
where the items are the same as the definitions in (2.1); the matrix A and the vector b are known, and the pair (A, b) is completely controllable.
Representation (2.3) allows us to construct an observer of the state vector x(t) G Rm in the form [8, 9]
X(t)= n(t)+ Nx(t), (2.7)
where the matrix N G Rmxn satisfies the equality
Nb = L (2.8)
and the vector n(t) G Rm is generated by the filter (2.3)
n(t) = Grj(t) + (GN - NA)x(t) - Lu(t). (2.9)
Then for any initial conditions x(0), x(0) and x(0) there exists the equality [8]
lim(x(t) - x(t))=0. (2.10)
t—^^o
Indeed, the error vector of the state estimate is introduced as
*(t) = x(t) - x(t). (2.11)
Substitute (2.7) into (2.11)
*(t)= x(t) - n(t) - Nx(t). (2.12)
The derivation of (2.12) combines with (2.3), (2.6) and (2.9):
a(t) = Gx(t) - Grj(t) - GNx(t). (2.13)
From (2.12) and (2.13), the derivative model of the error has the form
a(t) = Ga(t). (2.14)
Since the matrix G is Hurwitz, the last equation, (2.14), means that the error a(t) tends to zero over time. Therefore, the control system (2.6) can be rewritten in the form
x(t) = Ax(t) + b (u(t) + dTx(t)), (2.15)
where the estimate x(t) is formed by the observer (2.7) and (2.9).
Analysis of the expression (2.15) motivates the following choice of an adaptive control algorithm
u(t) = -kTx(t) - dTx(t), (2.16)
where the vector of constant coefficients k E Rnxm is chosen in such a way that the matrix of the closed system As — A — bkT is Hurwitz, and the vector of adjustable parameters 0(t) E Rmxm is formed by the adaptation algorithm that will be synthesized by the position.
To synthesize the adaptation algorithm, we obtain a closed-loop system error model by substituting (2.16) into (2.15)
X(t) — Asx(t)+ bxT (t)0(t), (2.17)
where 0 — 0 — 9 is the error in the estimation of the parameter 0.
It is easy to see that the model (2.17) is a standard dynamic error model with a measurable state. Therefore, to adjust the parameters 0(t), the gradient algorithm of adaptation can be used, which in this case takes the form [8, 9]
9(t)— YX(t)bT Px(t), (2.18)
where y is an arbitrary positive coefficient called adaptation gain, and the symmetric positive definite matrix P is the solution of the Sylvester equation:
Al P + PAs — —Q (2.19)
with an arbitrary symmetric positive definite matrix Q.
Thus, the adaptive compensation for the unknown external disturbance S(t) affecting the control system (2.6) is illustrated by the following blocks in Fig. 1, including the disturbance observer (2.7) and (2.9), the actual adjustable controller (2.16) and the adaptation algorithm (2.18).
For any initial conditions x(0), {(0) and n(0), the chosen matrices including G (a Hurwitz matrix), L (the pair (G, L) is controllable) and Q (a symmetric positive definite matrix), an arbitrary positive coefficient y > 0, the proposed adaptive compensator provides an asymptotic stabilization of the state vector x(t) at the zero value when the control object (2.1) is affected by external unknown disturbances S(t) which is generated by the model (2.2).
3. Design of the adaptive compensator for an inverted pendulum affected by unknown external disturbances
The inverted pendulum system is a highly nonlinear benchmark control problem in the field of control systems. It consists of an inverted pendulum that rotates freely in a vertical plane about the axis, and a cart moving on a horizontal plane. The objective of the control system is to balance the inverted pendulum by applying a force (generated by the motor attached to the wheel) to the cart to which the inverted pendulum is attached. There is a harmonic external disturbance affecting the cart, such as the oscillations of the platform or mechanical oscillations. The model of the inverted pendulum is illustrated in Fig. 2.
The differential equations of the inverted pendulum are described as follows [11]:
(M + m)X — ml sin ppp + ml cos pp = u + 6 — kx, ml2p — mgl sin p = —mlX cos p,
(3.1)
where x is the cart's position coordinate (m), x is the velocity of the cart (m/s), x is the acceleration of the cart (m/s2), p is the pendulum angle from the vertical (rad), p is the angular
<q = Gr]+(GN - NA)x - lu.
Fig. 1. The adaptive compensation of unknown external disturbances
Fig. 2. The inverted pendulum model
velocity of the pendulum (rad/s), (p is the angular acceleration of the pendulum (rad/s2), g is the gravity acceleration (m/s2), M is the mass of the cart (kg), m is the mass of the pendulum
(kg), l is the length of the pendulum (m), u(t) is the force applied to the cart (N), and S(t) is the external disturbance affecting the cart (N).
The state equations of the inverted pendulum are described as follows:
X1 — X2 ,
ml sin X3X4 — mg cos x3 sin x3 + u + ö — kx2
x 2 —
X 3 — X
M + m(sin x3 )2
(3.2)
x 4
4
ml sin x3 cos x3x2 — (M + m)g sin x3 + (u + ö) cos x3 — kx2 cos x3 — (M + m(sin x3)2) l
where x1 = x; x2 = x; x3 = <p; x4 = Lp.
The matrix P of the Sylvester equation (2.19) needs to be calculated by using the linearized model around the equilibrium point x1 = 0; x2 = 0; x3 = 0; x4 = 0, which has the following form:
~ 0
X 0 1 0 0 X
X 0 0 mg M 0 X
0 0 0 1 V
(p. 0 0 (M+m)g Ml 0 }P
+
M
1
Ml.
(u + ö).
(3.3)
The parameters of the inverted pendulum are M = 2 kg; m = 1 kg; l = 0.5 m; g = 9.81 m/s2. The matrices of the inverted pendulum in the state model (3.3) are as follows:
A —
0 10 0
0 0 -fi 0
0 0 0 1
00 ® 0
u u 100 u
b — d —
0
1
2
0
1
T
10 0 0 0 0 10
(3.4)
The desired roots of the closed system are chosen to be A1 = —1, \2 = -2, A3 = —3, A4 = —4. The vector of feedback coefficients k can be calculated by using the place(A, b, poles) command of the Control System Toolbox library of the MATLAB package:
kT —
800 2579 8141 12,310"
327 506 124 981
(3.5)
To design a controller with adaptive compensation for external disturbances, the matrices G, L and Q are chosen to be
0 1 0 0 0
G — —25 0 — 10 0 0 —25 0 1 ; l — 25 2 0 ; Q =
0 0 0 —10 —25
100 0 0 0 0 100 0 0 0 0 100 0 0 0 0 100
(3.6)
These matrices guarantee some necessary conditions: Q is a symmetric positive definite matrix, G is a Hurwitz matrix, and the pair (G, L) is completely controllable.
f
0
The matrix N can be found from equality (2.8)
N =
0 0 0 0 0 25 0 0 0 0 0 0 0 0 0 25
(3.7)
The symmetric positive definite matrix P is the solution of the Sylvester equation (2.19)
P =
r 3790 19,943 8507 8167 "I
21 183 25 109
19,943 12,776 41,744 9571
183 85 85 90
8507 41,744 15,073 17,477
25 85 8 46
8167 9571 17,477 8656
. 109 90 46 99 .
(3.8)
The harmonic disturbances have a negative effect on the operation of the inverted pendulum [11]. It is assumed that the external disturbance affecting the inverted pendulum is 5(t) = = W sin(ut + The matrices of the external disturbance and the initial state of the state variables in (2.2) have the form
r =
0 1
-u2 0
dT =
1 0
£(0) =
W sin(^) uW cos(^)
(3.9)
where W, u and ^ are the amplitude, the frequency and the initial phase of external disturbance, respectively.
From the parameters (2.5), (3.5), (3.6) and (3.8), the adaptive compensator for unknown external disturbances of the inverted pendulum is considered in the following cases. Case 1: 7 = 0.1 and S(t) = 2; S(t) = 2sin(31); S(t) = 1.5sin (4t + f).
0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0
-0.1 -0.2
Outputs
Control signal
---- -1-- osition of cart x(i) ngle of pendulum <p(x) -
1 \
\ \
\ \
\ \
A
V/
0
4 6 8 Time (seconds)
10
12 0
4 6 8 Time (seconds)
Fig. 3. Case 1: 7 = 0.1 and S(t) = 2
0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 -0.1 -0.2 -0.3
Outputs
Control signal
0
I 1
----p osition of cart x(t) ngle of pendulum <p{x) ~
r 11 , 1
1 1 1 '
1 1 1 1 1 »
: \
\ V
/1 1 \ \ S /-V
\ X« \ '
4 6 8 Time (seconds)
10
12
4 6 8 Time (seconds)
Fig. 4. Case 1: 7 Outputs
0.1 and S(t) = 2sin(3t)
Control signal
4 6 S Time (seconds)
4 6 8 Time (seconds)
Fig. 5. Case 1: 7 = 0.1 and S(t) = 1.5 sin (4i+ |)
Figures 3-5 show that, when the amplitude, the frequency and the initial phase of the external disturbance S(t) change, the outputs of the inverted pendulum still converge to equilibrium points. So, the adaptive compensator is effective with unknown external disturbances.
Case 2: S(t) = 2sin(3t) and 7 =1; 7 = 10; 7 = 100.
According to Figs. 6-8, the parameter 7 is an important factor that leads to a change in the quality of the adaptive compensator. As 7 increases, so does the speed convergence of outputs to equilibrium points, but the control signal u(t) also increases (the energy of the system increases).
Case 3: The external disturbance 5(t) = 2sin(3t) and the outputs are compared with the LQR controller.
The LQR control is one of the optimal control techniques and is useful in rejection disturbances affecting control systems. The LQR controller was described in detail and applied to the inverted pendulum in some former studies [12-14]. The state feedback control u(t) = -K,x(t)
Outputs
Control signal
0.5 0.4 0.3 0.2 0.1 0 -0.1 -0.2
0
0.5 0.4 0.3 0.2 0.1 0
-0.1 -0.2
0
0.4 0.3 0.2 0.1 0 -0.1
0
3
! 1
----p osition of cart a:(i) ngle of pendulum <p(x) ~
' » • \
1 \ 1 « 1 \
1 » 1 x \
\ s
1 1 V X
20 10 0 -10 -20 -30
luM
10 12 0
4 6 8 Time (seconds)
Time (seconds)
Fig. 6. Case 2: 5(t) = 2 sin(3t) and 7 = 1 Outputs Control signal
A --- osition of ca ngle of pend rt x(i) ulum <p(x)
1 ' 1
' \ ' \ ' \ 1 \
\ \ V
V
V
4 6 8 Time (seconds)
10
Time (seconds)
Fig. 7. Case 2: S(t) = 2 sin(3t) and 7 = 10 Outputs Control signal
---- position of cart a;(i)
1 1 1 \ 1 \ 1 \
1 \ 1 1 1 \ 1 \
\ \ \
\ N
V
10
Time (seconds)
10
12
Time (seconds)
leads to minimization of the cost function [12, 13]
J _ [x Qiqr x +
(3.10)
where Qiqr and Rlqr are positive semidefinite and positive definite symmetric constant matrices, respectively.
The LQR gain vector Klqr is given by
Klqr _ Rlq^rbTPlqr,
(3.11)
where Plqr is a positive definite symmetric constant matrix obtained from the solution of the matrix algebraic Riccati equation (ARE)
A Plqr + PlqrA — Plqr bRlq^b'T Plqr + Qlqr = °
In the simulation, the chosen matrices of the LQR controller are as follows:
(3.12)
Qlqr =
100 0 0 0 0 100 0 0 0 0 100 0 0 0 0 100
R _ 1
Rlqr 1
(3.13)
Position of cart x(t)
---Adaptive compensai or
//"'s 1 —J f
1 0.8 0.6 0.4 0.2 0
-0.2 -0.4 -0.6 -0.8
Angle of pendulum ip(t)
4 6 8 Time (seconds)
10
12 0
---Adaptive compensator
A
A
i \ \ \ / 1 /
1 /
V
4 6 8 Time (seconds)
10
12
Fig. 9. Case 3: ö(t) _ 2sin(3t) and the outputs are compared with the LQR controller
The outputs of the adaptive compensator and the LQR controller are compared under the same conditions (the initial values x(0) = 0 and <^(0) = The simulation results are illustrated in Fig. 9. The results of the adaptive compensator are fully better than those of the LQR controller.
4. Conclusion
In this paper, the adaptive compensation for unknown external disturbances of the inverted pendulum based on the internal model principle is presented. The design of the adaptive compensator is based on the transformation of the external disturbance into the filter model and the design of the state observer. Besides, the convergence of outputs is guaranteed by solving the Sylvester equation, and the convergence speed depends on the parameter 7 of the adaptive compensator. The proposed method is applied to a linearized model of the inverted pendulum in the neighborhood of the upright unstable equilibrium, and the simulation results illustrate the effectiveness of this method.
In future work, the adaptive compensation for unknown external disturbances based on the internal model principle for high-order MIMO systems will be considered.
Conflict of interest
The authors declare that they have no conflict of interest.
References
[1] Dorf, R. C. and Bishop, R. H., Modern Control Systems, 14th ed., New York: Pearson, 2021.
[2] Bloch, A.M., Chang, D.E., Leonard, N.E., and Marsden, J.E., Controlled Lagrangians and the Stabilization of Mechanical Systems: 2. Potential Shaping, IEEE Trans. Automat. Contr, 2001, vol. 46, no. 10, pp. 1556-1571.
[3] Angeli, D., Almost Global Stabilization of the Inverted Pendulum via Continuous State Feedback, Automatica, 2001, vol. 37, no. 7, pp. 1103-1108.
[4] Dang, P. and Lewis, F. L., Controller for Swing-Up and Balance of Single Inverted Pendulum Using SDRE-Based Solution, in Proc. of the 31st Annual Conf. of IEEE Industrial Electronics Society (IECON, Raleigh, NC, USA, Nov 2005), 6 pp.
[5] Ronzhina, M.N., Optimal Conditions with Chattering in the Inverted Two-Link Pendulum Control Problem, J. Appl. Math. Mech, 2016, vol. 80, no. 1, pp. 16-23; see also: Prikl. Mat. Mekh, 2016, vol. 80, no. 1, pp. 24-33.
[6] Äström, K.J. and Wittenmark, B., Adaptive Control, 2nd ed., New York: Dover, 2008.
[7] Formalskii, A. M., Stabilization and Motion Control of Unstable Objects, Stud. Math. Phys., vol. 33, Berlin: de Gruyter, 2015.
[8] Grigoriev, V. V., Boykov, V. I., Paramonov, A.V., and Bystrov, S.V, Design of Control System Regulators, St. Petersburg: ITMO Univ., 2021 (Russian).
[9] Nikiforov, V. and Gerasimov, D., Adaptive Regulation: Reference Tracking and Disturbance Rejection, Cham: Springer, 2022.
[10] Bobtsov, A.A., Nikiforov, V.O., and Pyrkin, A.A., Adaptive Control of Systems with Disturbances, St. Petersburg: ITMO Univ., 2015 (Russian).
[11] Long, H.D. and Dudarenko, N.A., Analysis of a Cart-Inverted Pendulum System with Harmonic Disturbances Based on Its Criterion Matrix, Mekhatronika Avtom. Upr., 2022, vol. 23, no. 3, pp. 146-151.
[12] Prasad, L.B., Tyagi, B., and Gupta, H. O., Modelling and Simulation for Optimal Control of Nonlinear Inverted Pendulum Dynamical System Using PID Controller and LQR, in Proc. of the 6th Asia Modelling Symposium (Bali, Indonesia, 2012), pp. 138-143.
[13] Prasad, L. B., Tyagi, B., and Gupta, H. O., Optimal Control of Nonlinear Inverted Pendulum System Using PID Controller and LQR: Performance Analysis without and with Disturbance Input, Int. J. Autom. Comput, 2014, vol. 11, no. 6, pp. 661-670.
[14] Siradjuddin, I., Setiawan, B., Fahmi, A., Amalia, Z., and Rohadi, E., State Space Control Using LQR Method for a Cart-Inverted Pendulum Linearised Model, Int. J. Mech. Mechatron. Eng., 2017, vol. 17, no. 1, pp. 119-126.