Académique Documents
Professionnel Documents
Culture Documents
Bachelor of Technology in
Electrical Engineering
By
Opeolu VO
STUDENT NUMBER: 210210648
NOVEMBER 2015
Declaration
I, Victory Opeolu Oluwadamilare, declare that the contents of this project represent
my own unaided work, and that the project has not previously been submitted for
academic examination towards any qualification. Furthermore, it represents my own
opinions and not necessarily those of the Cape Peninsula University of Technology.
Signed Date
ii
Abstract
Most pendulum control system analysis are linear i.e. pendulum is moving uniformly
without any change in mass/distortion/angle. This research shows the control of a
nonlinear pendulum using the Model Reference adaptive control (MRAC)scheme
adaptive model of the pendulum when it is nonlinear i.e. it no longer moves
uniformly.
The main objectives of this project are to:
The nonlinear control of the pendulum is developed using model reference adaptive
control scheme. After reviewing various papers, the Lyapunov method for stability is
found to be the most reliable approach to solve the nonlinearities in nonlinear
systems. The focus of this research is to develop a model reference adaptive control
algorithm for a nonlinear pendulum on the basis of Lyapunov stability theory.
After the linear and the nonlinear models of the pendulum were developed, the
results are computer-generated using appropriate MATLAB and Simulink.
iii
Acknowledgements
I dedicate my project work to God for I could not have done any of it without His help and
grace.
I would also like to thank my supervisor, Mr Mfoumboulou for his help en route to completing
this project. He has been a major influence with his insights into control engineering.
The financial assistance of the National Research Foundation towards this project is
acknowledged. Opinions expressed in this project and the conclusions arrived at, are those
of the author, and are not necessarily to be attributed to the National Research Foundation.
iv
Glossary
x System ststes
Adjustment parameter
Natural Frequency
ym Reference model output
y Plant output
- State error
%OS Percentage Overshoot
v
Table of Contents
Declaration.................................................................................................................ii
Acknowledgements..................................................................................................iv
Glossary .................................................................................................................... v
Symbols and Abbreviations ........................................................................................ v
Table of Contents .....................................................................................................vi
List of figures .......................................................................................................... vii
1. Adaptive Control ............................................................................................... 1
1.1. Introduction .................................................................................................... 1
1.1.1. Brief History................................................................................................. 1
1.1.2. Applications................................................................................................. 1
2. PROBLEM DESCRIPTION ................................................................................. 3
2.1. Problem Statement ..................................................................................... 3
2.2. Research Aim .............................................................................................. 3
2.3. Research Objectives ................................................................................... 3
3. Mathematical model .......................................................................................... 4
3.1. Introduction ................................................................................................. 4
3.2. Modelling of physical systems .................................................................. 4
3.3. Modelling of pendulum system .................................................................. 4
3.4. Nonlinear model .......................................................................................... 6
3.5. Linearized Pendulum .................................................................................. 7
3.6. Pendulum analysis and Simulation ........................................................... 9
3.7. Results Analysis ....................................................................................... 10
3.8. Nonlinear vs Linear Pendulum................................................................. 11
4. Control design ................................................................................................. 13
4.1. Linear system ............................................................................................ 13
4.1.1. Controllability ..................................................................................... 13
4.1.2. Observability ....................................................................................... 14
4.2. Linear Control Design Techniques .......................................................... 14
4.2.1. Pole placement Control...................................................................... 14
4.3. Nonlinear Control Systems ...................................................................... 16
4.3.1. Model Reference Adaptive control .................................................... 17
4.3.2. MRAC working principle .................................................................... 17
vi
5. Adaptive controller design for pendulum system ........................................ 20
5.1. Reference Model ....................................................................................... 20
5.2. Lyapunov controller design ..................................................................... 20
5.3. Simulation of Model reference adaptive control system and results ... 22
6. Conclusion....................................................................................................... 24
7. References ....................................................................................................... 25
Appendices A: Simulink Blocks.............................................................................. A
Appendices B: MATLAB Script File ........................................................................C
List of figures
vii
1. Adaptive Control
1.1. Introduction
Adaptive control is coined from the word adapt which means to adjust or to
conform. Based on this broad definition, according to Landau, et al. (2011),
adaptive control can be defined as a set of techniques used for automatic
adjustment of a controller(s) in real time so as to maintain a specific and
consistent level of performance of the control system when the disturbance
factors of the plant dynamic model are unknown and/or change in time. The
adaptive controller is inherently nonlinear and therefore, the analysis and
design rely on the Lyapunov Stability theory (Lavretsky, 2011).
2
2. PROBLEM DESCRIPTION
3
3. Mathematical model
3.1. Introduction
A mathematical model according to (Dahleh, et al., 2011) is simply the behavioural
representation of physical objects/systems in mathematical terms. They are in form
of equations used in describing the behaviour of the system.
4
For small angles of deflection, the periodic motion is harmonic i.e. the pendulum
moves easily and smoothly with no external disturbances. For this condition
(harmonic motion), the period of the simple pendulum is given by the following
formula:
= 2 (3.1)
2
= 4 (3. 2)
However, we know practically that due to obstacles such as air resistance and
friction, the pendulum will not oscillate forever. The oscillatory amplitude reduces
gradually due to the frictional forces until the system is ultimately at rest, thereby
giving damped oscillations.
There are three classifications of damped oscillations (University of Georgia, 2015;
Slung.com, 2015) namely:
- Critically-damped: The damping force is such that the system returns
to equilibrium as quickly as possible and stops at that point.
- Over-damped: The damping force is greater than the minimum
needed to prevent oscillations, thereby returning the system to
equilibrium without oscillating. Also, it takes longer to do so than a
critically damped system.
- Under-damped: It oscillates about the equilibrium point, with the
amplitude decreasing with each cycle.
These classifications are illustrated in Figure 3 below:
5
Using equation 2, the gravitational acceleration can be determined by the slope of
the T2 vs. L graph.
The equation of motion may also be obtained by applying Newtons second law for
rotational systems:
= = 2 ( ), =
2
sin = 2 2 (3.3)
It is also assumed that the damping constant k, is proportional to velocity, and its
represented as a negative force because the damping force is in the opposite
direction of motion.
2
2 sin = 2 2 (3.4)
() = () + () (3.6)
() = () + () (3.7)
() , ()
Due to the compactness this representation, large and complex systems can be
analysed easily using these two equations.
The state of the system is he collection of variables required to describe a system
at any point in time. In this case, the variables are the angle/position and the
angular velocity.
() = 1 () ()
() = 2 () ( )
1 () = 2
2 () = 2 2 1 + 2
6
The vector representation
2 () 0
[ 1] = [ ] + [1
] (3.8)
2 sin 1 () 2 1 () 2
1 ()
() = [1 0] [ ] (3.9)
2 ()
Expressing (a) and (b) as a standard nonlinear model,
2 () 0
() = [ ] ; () = [1
] (3.10)
sin 1 () 2 1 () 2
0 1 0
= [ cos ()] ;
= [1 2 ] ; 1 1 ,
1
2 1
1 ()
() = [1 0] [ ] (3.13)
2 ()
which is in th format:
() = +
() = () + ()
The parameters for the simple pendulum are shown in the table below:
7
Parameter Value
Ball mass, m [kg] 0.5
Length of the string, l [m] 0.5
Damping coefficient due to frictin, k [Kg.m2/s] 0.2
Acceleration due to gravity, g [m/s2] 9.81
The transfer function of this system can then be calculated using the formula:
() = ( )1
0 1 0
= [ ] ; = [ ] ; = [1 0]; = 0;
19.62 1.6 8
1
0 0 1 0
() = [1 0] [[ ] [ ]] [ ]
0 19.62 1.6 8
8
() = (3.14)
2 +1.6+19.62
This system is further analysed with MATLAB to check for the stability of the
system using command [zer, pol] = tf2zp(num, den)
From the system, it is seen that the poles are on the left which is the stable region.
8
3.6. Pendulum analysis and Simulation
Simulation is an activity in which an actual or proposed system is replaced by an
abstract model (generally said to be a simulation model), having almost the same
cause-and-effect relationships as the actual system (Kriger, 2015). It involves the
generation of an artificial history to draw inferences concerning the operationg
characteristics of the system that is represented.
Simulations allows a clear understanding of how a system behaves, thereby
choosing the most applicable control technique for stabilizing the system. In this
case, MATLAB is used as the programming software for both nonlinear and
linearized models. For the initial conditions, the position was assumed to start at
small angle i.e. x1 = 30 = 0.05rad and x2 = 0;
The parameters are introduced in a MATLAB m-file, saved as
pendulum_system.m, while the linear and nonlinear models is saved as
lin_nlin_Syresponse.mdl. The simulink diagrams can be found in the Figures 5
and 6below:
9
Figure 6: Linearized pendulum model in Simulink
10
Figure 8: Nonlinear Pendulum Output
11
From Figure 9, it can be seen that:
- The linear response has a similar behaviour with the nonlinear
response.
- The nonlinear response has more vibrations compared to the linear
response
- The settling time for the nonlinear system is higher than the linear
system i.e. it takes longer for the nonlinear pendulum to go to rest
position (0).
Nonlinear control is therefore important as as it ensures more accurate desired
stability properties.
12
4. Control design
In general, control system design aims to satisfy certain performance objectives such
as stability, disturbance rejection, accurate input tracking, and robustness or
insensitivity to parameter uncertainty and a design standpoint is to view the plant
system as an approximation of the nonlinear system (linearized model), to which
established linear control techniques may be applied (Shimkin, 2009).
4.1.1. Controllability
In order to get a desired response, the dynamic system under control input must
be controllable. According to (Padhi, 2010), a system is said to be controllable at
time t0, if it is possible to by means of an unconstrained control vector to transfer
the system from any initial state X0 to any other state in a finite interval of time.
The controllability of a system depends on the system matrix A and the control
influence matrix B.
.
13
0
= [ ]
8
0 1 0 8
= [ ] [ ]= [ ]
19.62 1.6 8 12.8
0 .8
= [ ];
8 12.8
The system is therefore controllable as the columns are independent of each
other. Also, using the function ctrd(A,B) in MATLAB shows the rank of the matrix
2, meaning it is controllable.
4.1.2. Observability
A system is said to be observable at time t0 if, with the system in state X(t0) ,it is
possible to determine this state from the observation of the output over a finite
interval of time.. A system must be observable to see what is going on inside a
system under observation (Rutgers University, 2015)
r U B xd x C y
H x
Figure 11: General Closed loop system with controller (Mataifa, 2015)
The desired performance of the system according to (Mataifa, 2015), the desired
performance of the closed loop can be determined by using a transfer function,
14
performance specification or location of the poles in the complex plane. However,
for this system, performance specification is used.
The settling time is assumed to be less than 0.09s and the percentage overshoot
less than 1.5%.
< 0.09
%. < 1.5%
% 1.5
( ) ( )
100 100
= %
= 1.5
= 0.8
2 +2 ( ) 2 +2 ( )
100 100
4 4
= = = 0.09 = 44.44
15
Figure 13: System response after pole placement
Using the stepinfo command in MATLAB, the following system results was found:
Rise Time: 0.0552
Settling Time: 0.0683
Settling Min: 0.0025
Settling Max: 0.0027
Overshoot: 1.4542
Undershoot: 0
Peak: 0.0027
Peak Time: 0.0954
From these results, it is seen that the settling time and the %OS are well within the
chosen range (Ts<0.09; %OS < 1.5%).
16
While linearizing the behaviour of the plant and applying a linear control method is
an effective method of controlling the system, it is only effective for a certain range
of conditions which in this case is small angles (200 of less). Large deviations from
200 upwards leads to instabilities and the eventual failure of the system to remain in
the desired position (Russell, 2011; Xie, 2003).
Reference Ym
Model
controller
parameters
Adjustment
Mechanism
r
u
y
Controller Plant
Figure 14: General Block diagram of MRAC (Coman & Boldisor, 2014)
17
the output signal, and the command signal. It is said that when, for all command
signals, the error signal is reduced to zero, a perfect model can be achieved
(Coman & Boldisor, 2014).
To develop the adjustment mechanism, mathematical approaches like Lyapunov
theory, theory of augmented error and MIT rule can be used. For this system,
Lyapunovs method is used as it provides a better stability (Sapiee, et al., 2008;
Pankaj, et al., 2011).
4.3.2.1.1. Stability
According to Remsing (2006), there is no simple concept of stability,
therefore different definitions are possible. A system is considered to
be:
- Stable if for any positive there exists a positive scalar such that
() < Implies () < for all 0 .
- Asymptotically stable if it is stable and if in addition () 0
- Unstable if it is not stable; that is, there exists an > 0 such that for
every > 0 there exists an (0 ) with (0 ) < , (1 ) < for
some 1 > 0 .
- Completely unstable if there exists an > 0 such that for every > 0
and for every (0 ) with (0 ) < , (1 ) < for some 1 > 0 .
By definition, the equilibrium state = 0 of autonomous nonlinear dynamic
system is said to be stable if:
> 0, > 0, {(0) < } { 0, () < }
18
The stated Lyapunov Stability means that the system trajectory can be kept
arbitrary close to the origin by starting sufficiently close to it (Lavretsky, 2011) as
seen in figure 7 below.
19
5. Adaptive controller design for pendulum system
The requirements towards the closed loop systems are that the error has to be
reduced to zero by a suitable control vector u. In order to include the model
equation and the plant equation in the error, it is necessary to differentiate the error
equation (5.5) according to the time:
= = + () ()
= + + () ()
= ( ) + + () ()
= + + () () (5.6)
Seeing as V() is in quadratic form and the matrix P is positive definite, it is true
that V() is positive definite.
Differentiating the positive definite function V() along the system trajectory, its time
derivative is obtained.
20
() = +
= [ + + () ()] + [ + + () ()]
= + + () () + + +
() ()
= [ + ] + 2
2 = + () () () () +
+
= + () () () () + +
= 2 [ () () + ]
= [ () () + ] (5.8)
Calculating the nonlinear linearization controller u is done by some transformations
of the expression for N
= [ + () ()] 0
= [ + ()] [()] 0 (5.9)
[ + ()] [()] . Since the expressions from both sides of the
equation are scalars, the equation can be modified to give:
[+ ()]
(5.10)
[()]
In MATLAB, the function lyap(Ar, Q) is used to calculate P.
The parameters are updated as:
1
= (5.11)
2
= , (5.12)
21
+
U
_
Yd
y C
thetha
Uc
e
y
Adjustment
Parameters
22
Figure 18: Simulink Model Reference adaptive control system
23
Figure 19 shows the controlled output of the system when the gain is 2. It shows a
low settling time and a low %OS
6. Conclusion
This thesis covers the linear and nonlinear control of the pendulum system. Pole
Placement method was used to control the linearized system and MRAS based on
Lyapunovs second method was used to design the nonlinear controller. The
controlled system is fairly stable as it has very little settling time and low overshoot.
24
7. References
25
Padhi, R., 2010. Controllability and Observability of Linear Time Invariant Systems.
Bangalore: Indian Institute of Science.
Pankaj, S., Kumar, J. S. & Nema, R., 2011. Comparative Analysis of MIT Rule and
Lyapunov Rule in Model Reference Adaptive Control Scheme. Innovative Systems
Design and Engineering, 2(4), pp. 154-163.
Portland State University, 2010. Oscillations. [Online]
Available at:
https://files4.smallpdf.com/files/2e184c6724ce4d48884710e64f156481.pdf?name=s
election.pdf
[Accessed 10 October 2015].
Priyank, J. & Nigam, M., 2013. Design of a Model Reference Adaptive Controller
using Modified MIT Rule for a second order system. Advance in Electronic and
Electric Engineering, 3(4), pp. 477-484.
Raptis, I. & Valavanis, K., 2011. Linear and Nonlinear Control of Small-Scale
Unmanned Helicopters. [Online]
Available at: http://www.springer.com/978-94-007-0022-2
[Accessed 22 October 2015].
Remsing, C., 2006. Linear Control Systems. [Online]
Available at:
https://www.ru.ac.za/media/rhodesuniversity/content/mathematics/documents/thirdye
ar/linearcontrol/AM32LC3%20Linear%20Ctrl%20Sys.pdf
[Accessed 2015 October 12].
Russell, D. A., 2011. The Simple Pendulum. [Online]
Available at: http://www.acs.psu.edu/drussell/Demos/Pendulum/Pendula.html
[Accessed 12 May 2015].
Rutgers University, 2015. Controllability abd Observability. [Online]
Available at: http://www.ece.rutgers.edu/~gajic/psfiles/chap5traCO.pdf
[Accessed 10 October 2015].
Sapiee, M. R., Abdullah, F., Noordin, A. & Jahari, A. N., 2008. PI Controller Design
Using Model Reference Adaptive Control Approaches For A Chemical Process.
Johor, SCOReD, pp. 155-1 - 155-4.
Sename, O., 2014. Modelling, analysis and control of linear systems using.
Grenoble: CNRS-INPG.
Shimkin, N., 2009. Nonlinear Control Systems. Haifa: Springer-Verlag GmbH.
Slung.com, 2015. Damped Oscillations. [Online]
Available at: http://www.splung.com/content/sid/2/page/damped_oscillations
[Accessed 11 October 2015].
The MathWorks, Inc., 2015. Linearizing Nonlinear Nodels. [Online]
Available at: http://www.mathworks.com/help/slcontrol/ug/linearizing-nonlinear-
26
models.html
[Accessed 22 October 2015].
The MathWorks, Inc., n.d. What Are State-Space Models?. [Online]
Available at: http://www.mathworks.com/help/ident/ug/what-are-state-space-
models.html
[Accessed 12 October 2015].
University of Georgia, 2015. The Simple Pendulum. [Online]
Available at: https://www.physast.uga.edu/uploads/phys1111_stancil/notes13a.pdf
[Accessed 10 October 2015].
Xie, Y., 2003. Linearized Control, Massachusetts: Massachusetts Institute of
Technology.
27
Appendices A: Simulink Blocks
A
+ U
_
Yd
y C
B
Appendices B: MATLAB Script File
% Opeolu VO
% 210210648
% Developmet of a MRAC algorithm for a pendulum system
close all
clear
clc
thetha = (3*pi)/180;
mr = 10;
lr = 10;
kr = 1.2;
m = 0.5;
l = 0.5;
g = 9.81;
k = 0.2;
i = 1/(m*l*l);
tspan = 0:0.01:10;
tspan2 = 0:0.01:1;
x=[(3*pi)/180 0];
U = zeros(size(tspan));
U2 = zeros(size(tspan2));
A = [0 1; ((-g/l)) (-k/(m*l*l))];
B = [0 i]';
C = [1 0];
D = [0];
% nonlinear plant
Ar = [0 1; ((-g/lr)*sin(x(1))) (-kr/(mr*lr*lr))];
Br = [0 i]';
Cr = [1 0];
Dr = [0];
sys = ss(A,B,C,D)
[num, den] = ss2tf(A, B, C, D)
num = round(num);
Gs = tf(sys) %transfer function of the system
C
[zer, pol] = tf2zp(num, den) % Zero pole representation
% [res, pol, k] = residue(num, den) % Residues / Pole
representation
% R = roots(den) % Roots
% zplane(zer,pol)
% pzmap(Gs)
poles = eig(A)
% ===============
p1 = -41.4 + 32.97i;
p2 = -41.4 - 32.97i;
figure
lsim(sys1, U2, tspan2,x)
ylabel('position (rad)')
title('Underdamped System Representation')
Gs1 = tf(sys1)
% ======================
% lyapunov Control
Q = [1 0; 0 1];
D
Xp = lyap(Ar,Q)
gain = 1;
% ============================================
% Simulations
% ============================================
figure
sim('lin_nlin_SysResponse.mdl') % Simulating the Simulink model
plot(sys_responses);
grid
legend('nonlinear response', 'linear response')
title('Pendulum nonlinear and linearised model response at x0 =
pi/60') %x0-initial condition
ylabel('position (rad)')
figure
plot(nlin_resp)
legend('nonlinear response')
title('Pendulum nonlinear model response at x0 = pi/60')
ylabel('position (rad)')
grid
figure
plot(lin_resp)
grid
legend('linearized response')
title('Pendulum linearized model response at x0 = pi/60')
ylabel('position (rad)')
% ========
figure
sim('math_models.mdl') % Simulating the Simulink model
plot(lin_nlin);
grid
legend('x', 'y')
% =========
E
% adaptive control
figure
sim('lyapAdaptComplete_v2.mdl') % Simulating the Simulink for
adaptive control model
plot(lyap_MRC);
grid
title('Model Reference control of nonlinear pendulum system')
ylabel('position(rad)')
legend('Reference output', 'Plant output ')