Distributed control of "ball on beam" system

XI International PhD Workshop
OWD 2009, 17–20 October 2009
Distributed control of "ball on beam" system
Michał Ganobis, University of Science and Technology AGH
Abstract
This paper presents possibilities of control
for unstable dynamic systems basing on "ball on
beam" example.
First section is a short introduction. In the second section, system is presented - its structure,
equations and equilibrium points. Using 1st Lapunov method and Kalman matrix it is proven
that the system is unstable, but controllable.
Third section shortly describes design of LQR
controller for the "ball on beam".
In the fourth part short description of simulation framework (Matlab/Simulink, TrueTime library) is introduced. The influence of specific parameters of Ethernet (such as throughput, probability of losing packet, and minimal frame size) on
control quality is described. It is shown, that insufficient network parameters can destabilize control loop.
The last part of the paper is a proposition of
control loop design using buffers. It is proven that
appropriate buffers and simple observer are sufficient to design asymptotically stable control for
"ball and beam" system.
Fig. 1. "Ball on beam" system
A "ball on beam" is a well-known example of
unstable, controllable dynamic system. Simplicity
and possibility of constructing a real object in laboratory make it one of the most popular examples
in control theory. Additionally, "ball and beam"
can be used as a simple model of more complicated problems related with variable moment of
inertia (e.g. stabilizing of airplane flight or robot
manipulators).
2. Control system
System consists of rotating beam, and a solid ball
rolling on it. We assume beam’s torque as an input. The structure of the system is presented on
figure (1).
We assume, that:
1. Introduction
Distributed control systems are significant part of
a modern automatic control. Its applications can
be found in many kind of industries, as oil refining, power stations, automotive, and many others.
In these systems, measurements and process itself
are separated, and communicate via network (e.g.
Ethernet, Modbus or CAN) - as a result, influence
of a network has to be taken into consideration.
•
•
•
•
•
ball does not slide on the beam
there is no dynamic friction in the system
the ball is perfectly round and homogeneous
the ball has a constant contact with the beam
the beam is perfectly flat and symmetric
State equations for the system described above
are as follow (see [3] or [1])
479
ẋ1 = x2

0

 0
J (x s ) = 
 0
 g
−b
(1)
2
ẋ2 = a(x1 x4 − g sin x3 )
(2)
ẋ3 = x4
(3)
u
−2x1 x2 x4 − g x1 cos x3
+ 2
(4)
ẋ4 =
x12 + b
x1 + b
λ1 =
x1 - position of the ball [m]
x2 - velocity of the ball [m/s]
x3 - angular position of the beam [rad ]
x4 - angular velocity of the beam [rad /s]
I = 0.1 - beam’s moment of interia [k g · m 2 ]
I b - ball’s moment of inertia [k g · m 2 ]
m = 0.1, R = 0.01 - weight [k g ] and radius
[m] of the ball
• a = 1Ib
•
•
•
•
•
•
•
•b=
mR2
I +I b
m
System (1) can be linearized in its equilibrium
point (x = [0, 0, 0, 0]). Jacobi matrix of this system takes form

0

 ax4 2
J (x) = 
 0

f1 (x)
1
0
0
− ga cos x3
0
0
f2 (x)
f3 (x)

0

2a x1 x4 


0

f4 (x)
0
0
1
0






where eigenvalues of J are
where
1+
1
0
0 − ga
0
0
0
0
p
λ2 = − p
λ3 =
jp
λ4 = − j p
with p =
p
4
g 2 b 3a
,
b
j 2 = −1
For positive values a, b , Re(λ1 ) > 0 - the system is unstable.
Observability of the system can be proven using Kalman matrix (see e.g. [4]), which takes a
form

0

 0
Q =
 0

1
b
0
0
1
b
0
0
ga
−b
0
0
ga
−b
0
0
0






(5)
Because det Q > 0, system is considered observable.
3. Optimal control of "Ball on beam" system
where
f1 (x) =
−2x2 x4 − g cos x3
+2
f2 (x) =
f3 (x) =
f4 (x) =
+
x1 2 + b
(2x1 x2 x4 + g x1 cos x3 )x1
This section shortly presents an optimal control
of the system using LQR controller, i.e. minimizing quality index given by (6)
Q(u) =
(x1 2 + b )2
−2x1 x4
x1 2 + b
g x1 sin x3
x1 2 + b
−2x1 x2
x1 2 + b
In the equilibrium point we have
Z
∞
(x(t )0 Q x(t ) + u(t )0 Ru(t ))d t
(6)
0
with assumptions
• Q = Q 0 , R = R0 ,
• Q ≥0
• R>0
In further experiments we assume Q = I , R =
0.01
Solving Riccati’s equation for linearized system leads us to the controller vector
480
Fig. 2. Trajectories for closed loop (LQR)
K = [−23.8184 −17.5655 67.4050 15.3235]
(7)
Trajectories of the system with above controller are presented on figure (2)
Fig. 3. Simulink model of the system
4. Distributed control via Ethernet and its simulations
Control loop for "ball on beam" system via
Ethernet network was simulated using MATLAB/Simulink environment and TrueTime library (see [5]). Full simulation system is presented on figure (3). The most important parts are:
• "Ball on beam" block - represents model of the
system, designed using equations (1)
• "Sensor" block - represents a sensor, its responsibility is a conversion of measurements to digital form appropriate for Ethernet network
• "Controller" - represents a digital controller
• "Actuator" - represents actuator, which converts data received via Ethernet to input for
"ball on beam" system.
• "Network" - represents model of Ethernet network
To measure a quality of control, we use an integral of squared error in finite time T = 5
4 Z
X
(
J (x, T ) =
i=1
T
0
xi2 d t )
Default parameters for simulations were:
• throughput DR = 18000 b/s
• probability of packet loss LP = 0
(8)
Fig. 4. Influence of throughput
• minimal frame size MFS = 46 octets
Influence of particular network parameters are
presented on plots (4), (5), (6).
It can be noticed, that throughput below
7500b/s causes with worse quality of control.
Destabilization of the system occurs for about
6000b/s. Similarly, too big value of minimal frame
size also causes with destabilization (control systems should use big amount of small packets - this
is the reason why too big minimal frame size is
not appropriate for control purposes). Interesting
results can also be obtained when probability of
losing packet is changed - quality of control decreases rapidly for some values (plot has a shape
of "stairs"). Stability is lost for about 0.175.
481
• Introduce a new state variables, related with
delays of the buffers
• Design discrete controller for obtained system
First of all, discrete form (as below) of the system is needed.
x(k + 1) = Ad x(k) + Bd u(k)
y(k + 1) = Cd x(k)
(9)
(10)
Appropriate matrices can be calculated using
equations
Fig. 5. Influence of packet loss probability
Bd
= e AT
ZT
=
e AT B d t
Cd
= C
Ad
(11)
(12)
0
(13)
As a result, for sampling time T = 0.1, the following matrices are obtained
Fig. 6. Influence of minimal frame size
5. Design of distributed control system
Typical approach to design of distributed control
systems is to design a system neglecting its distributed character, and then analyzing the influence of the network in various aspects (as e.g. delays) [2].
In this section, some methodology using
buffers will be presented, and applied to "ball on
beam" system.
The main problem for distributed control systems (e.g. via Ethernet) is a variable delay introduced by network. This problem can be solved by
introducing buffers - after such introduction, system has constant delays, which are easier to handle. The main idea of presented approach is as follows:
• Create discrete-time model of the system
• Determine max delay of the network
• Add buffers to the system to make delays constant


1.0004
0.1000 −0.0491 −0.0016


 0.0160
1.0004 −0.9811 −0.0491 


Ad = 

−0.0491
−0.0016
1.0004
0.1000


−0.9811 −0.0491 0.0160
1.0004
(14)
Bd =
”
0 −0.016 0.05 1
Cd =
”
1 1 1 1
—
—0
(15)
(16)
In the second step we determine network
delay. Experiments have proven, that the biggest
obtained delay was way smaller than discretization step T = 0.1.
Third step is adding buffers on input and output of the system. Because delays are smaller than
discretization step, one-sample buffers are sufficient. System with buffers is presented on figure
(7)
Now we have discrete system with one-step delay on input and all outputs. For discrete systems,
it is possible to treat one-step delay as a new state
variable. Using this approach, we obtain extended
state space, defined as
482
Fig. 7. Control system with buffers
–
x(k + 1)
z(k + 1)
™
=
–
Ad
0
™
™–
x(k)
Γ1 (τ)
+
z(k)
0
™
–
Γ0 (τ)
+
u(k) (17)
1
Fig. 8. DLQR with state observer
Ke2 = [0.7345 − 23.8684 − 7.9602 27.8963
8.6184 0 0 0 0] (22)
where
Γ1 (τ) =
Z
T
As
Γ0 (τ) =
e Bd s,
T −τ
Z
T −τ
0
e As B d s
6. Conclusions
(18)
Then, using equation (17),(18) (see e.g. [2]) all
delays can be incorporated. A new 9-rank system
is created, with matrices as presented below

 0
Ae = 
 Bd
0
Be =
”
Ce =
0
Ad
Cd

0 
0 

0
1 0 ... 0
–
0
0
0 In×n
—0
As one can see on figure (8), trajectories of the
system with above controller are asymptotically
stable
(19)
(20)
™
(21)
To create optimal LQR controller, full state of
the system has to be known. To obtain the full
state, a simple observer is introduced, basing on
the following rules:
• x1 is a control one sample before
• x2−5 can be obtained basing on output (i.e. the
state delayed for one sample), and internal system model
• x6−9 are available directly as an output
Basing on above system, DLQR controller parameters can be calculated:
In this paper, a method for design distributed control via Ethernet for "ball on beam" system is presented. Model of the system in a form of differential state equations is introduced. Basic properties,
as instability and controllability of the system are
proven. The influence of particular network parameters as throughput, probability of frame loss,
and minimal size of a frame are shown. A method
for design control system with compensation of
variable delay using buffers is proposed. The simulations show that system with such controller
guarantees stabilization of the system.
Bibliography
[1] Michał Ganobis. Przegl˛
ad możliwości sterowania systemem o zmiennym momencie bezwładności typu ball on beam. Automatyka, Uczelniane Wydawnictwa Naukowo-Techniczne AGH,
12(2):197–210, 2008.
[2] Wojciech Grega. Metody i algorytmy sterowania
cyfowego w układach scentralizowanych i rozproszonych. Uczelniane Wydawnictwa NaukowoDydaktyczne, AGH w Krakowie, 2004.
[3] Wojciech
Mitkowski
Jerzy
Baranowski,
Michał Ganobis.
Observer design for variable moment of inertia system.
Materiały
konferencji Computer Methods and Systems, 2007.
483
[4] Wojciech Mitkowski. Stabilizacja Systemów Dynamicznych. Wydawnictwo AGH, Kraków, 1991.
[5] Martin Ohlin, Dan Henriksson, and Anton
Cervin. TrueTime 1.5 - Reference Manual. Department of Automatic Control, Lund University, 2007.
Authors:
M.Sc.Michał Ganobis
University of Science and Technology AGH
al.Mickiewicza 30
30-059 Kraków
email: [email protected]
This work was supported by Ministry of Science and Higher Education in Poland in the
years 2008-2011 as a research project No N
N514 414034
484