Uebung CAE
Uebung CAE
Uebung CAE
The Pendulum-Cart system defines a classic problem in dynamics and control theory and
is widely used as a benchmark for testing control algorithms. A simplified variation of this
system is illustrated in Figure 2 where a mathematical pendulum is connected to a pair
of only-rolling wheels with one translation degree of freedom. This models the Wheeled
Inverted Pendulum system. An example for that is the Robot Suricate (Figure 1) built by
the students at LRS / University of Kaiserslautern.
In the simplified model, the point mass mp is connected to the cart with the mass mc via
a massless arm with the length L. q1 is the displacement of the cart and q2 is the angle of
the pendulum. As input, u is assumed to be a force.
In our exercises, we will handle the stabilization problem around the upper position of
the pendulum. We will only consider the linearised model. The overall objective will be
broken down into the following tasks:
• Design of state observers and investigating the closed loop including an observer.
– Page 1 –
CAE in der Regelungstechnik: Exercises
The equations of motion for the described system can be derived using different methods
such as Lagrange-Formalism or Newton-Euler. The result is in any case a nonlinear system
in the following form:
M (q) q̈ + h(q, q̇) = gq u
with
mc + mp −L mp cos q2
M (q) =
2
−L mp cos q2 L mp
L mp q̇22 sin q2 d1 q̇1
0
h(q, q̇) = + , gq =
1
−L g mp sin q2 d2 q̇2
where d1 and d2 are the so-called damping factors representing friction in the cart displa-
cement and the joint respectively.
q
A state-space representation can be derived using the equations above defining x =
q̇
q̇1 0
ẋ = F (x) + G (x) u =
q̇2 +
0 u
−1 −1
−M (q) h(q, q̇) M (q) gq
Linearising about the operation point q1∗ = q2∗ = 0 yields the linear state-space equation
for the system
ẋ = A x + B u (1)
with
0 0 1 0
0
0 0 0 1
0
A= g mp d1 d2 , B = 1 .
0 − −
mc mc L mc
mc
g (mc + mp ) d1 d2 (mc + mp ) 1
0 − −
L mc L mc L2 mc mp L mc
We the following values:
mc = 1.5, mp = 0.5, g = 9.82, L = 1, d1 = d2 = 0.01
– Page 2 –
CAE in der Regelungstechnik: Exercises
Task 1
Within the first task, we analyse the system and compare its different representations.
1. Within a MATLAB script, build the state-space model of the system using the
matrices A, B and proper matrices C and D by the command ss! Suppose the
angle q2 as the system output!
2. Use Matlab commands like pole, eig and zero to analyse the system. Is the
system stable? Is it minimal-phase? Draw the zero-pole-map of the system using
pzmap! Are the results different? Why?
3. Convert the system into the corresponding transfer function using tf! How can
you do the same using ss2tf? Create also the Zero-Pole-Gain representation of
the system by converting using zpk.
4. For sake of re-usability, write a MATLAB-function that generates the dynamical
system in different representations! Use your code from the subtasks above! Your
MATLAB-function should take the parameter set mp , mc , g, L, d1 and d2 as
input. Also, the function should have an input to decide whether the position
q1 or the angle q2 are supposed to be taken as the output of the system. Use
for example a string ’MyStr’ as input. The output arguments are the 3 system
representations.
5. Use your MATLAB-function now to create the system in 3 representations again
and compare them, for instance by their poles and zeros! The output of the SISO
system is supposed to be the angle q2 . Are they equal? If there is a difference,
how would you explain it?
– Page 3 –
CAE in der Regelungstechnik: Exercises
Task 2
In this task, we consider the results from the task 1 to continue with system analysis
and a first controller design. Use your MATLAB-function from the previous exercise
to regenerate the system.
– Page 4 –
CAE in der Regelungstechnik: Exercises
Task 3
In the controller designed in the last task, we detected a problem with the total stability
of the system. That was, though the input-output mapping of the system seemed to
be stabilized using a proper controller and the angle of the pendulum converted to
zero, the position of the cart diverged. Within this task, we will investigate the system
features to find out the reason for this problem and how to avoid it.
– Page 5 –
CAE in der Regelungstechnik: Exercises
Task 4
The previous controller assumes the knowledge and, thus, the measurement of every
state. In the praxis, this is hardy achievable. Instead of applying various sensors to
measure the states, a state observer is often used to estimate the states using the
system outputs only. Within this task we will extend the previous controller by a state
observer.
1. For what condition can the entire state of the system be estimated? Check if this
condition is fulfilled!
2. Design a state observer using pole placement! Note that the observer should be
faster than the controller to avoid undesired behaviour in the closed loop!
3. Design an optimal state observer using LQR algorithm!
4. Vary different parameter and compare the simulation results!
5. Test your controller on the ”real” non-linear system provided in on-line! Does
everything work properly? If not, what could be the reason? In this case try to
tune the controller to make the closed-loop stable!
– Page 6 –
CAE in der Regelungstechnik: Exercises
Task 5
To end up with a real-life control system, we need to use time-discrete controllers.
Often, a time-discrete representation of the system is used to consider the whole closed
loop a time-discrete system. The control algorithm and the observer are implemented
on a digital device and A/D-converters sample the output signals.
1. Convert the system into time-discrete by c2d! Use the sample time Ts = 0.1 s!
2. Design a time-discrete controller and a time-discrete observer by pole placement
using the equivalent poles to the continuous controller from the previous task!
Verify your results by simulation!
3. Design a time-discrete LQR controller and a time-discrete LQR observer using
dlqr and verify them by simulation! What is the difference to lqrd?
– Page 7 –