TP ENSPS ISAV / Master IRIV 1
Practical work : predictive control ENSPS 3A / Master IRIV AR
Predictive control
Introduction
The goal of this practical work is to learn the basic concepts of predictive control. It’s the GPC (Generalized Predictive Control) that will be studied.
1 Preliminary work
1.1 Software
• Switch on the PC. Boot the Ubuntu distribution.
• Login.
• Launch a terminal.
• Download the archive on the web server (ask for the link).
• Extract the files with tar zfxv <file name>in a personal directory you created.
• Go into the extracted directory withcd gpc.
• You can compile with make -f <Makefile.xxx>where xxxis the executable you want to generate.
• You can launch Matlab by typingmatlabin a terminal.
1.2 Elementary system
We start with an elementary system constituted only by a delay. LetG(z) =z−1.
• Put this system in CARMA form. Give the expressions ofA(q−1)andB(q−1).
• Find this system prediction equation : yˆ=G˜u+ ˆf with ˆ
y= [ˆy(t+ 1), ...,y(tˆ +N2)]T the vector of the output predictions
˜
u= [∆u(t), ...,∆u(t+Nu−1)]T the vector of the control increments ˆf = [ ˆf(t+ 1), ...,fˆ(t+N2)]T the vector of the free response samples and
G aN2×Numatrix.
IntegersN2 etNu are respectively the optimization and the control horizons..
• For λ = 0 (no influence of control signal energy in the cost function) and for Nu = N2, determineu˜opt.
• Only the first sampleu˜is applied to the system. Determine the control lawu(t) =F(u(t−1), r(t+ 1), y(t)) withr(t+ 1)the reference one step ahead in the future.
• With a constant reference equal to zero, determine the equivalent transfer functionU(z)/Y(z).
What is the class of this system ? What kind of disturbance is it able to reject ?
TP ENSPS ISAV / Master IRIV 2
1.3 System with one integrator
In this section we will treat the case of a pure integrator system : G(z) =1−z−1z−1.
• Rewrite this system in the CARMA form. Give the expressions of A(q−1)andB(q−1).
• Write the prediction equation : yˆ=G˜u+ ˆf.
• Verify that Gis constituted by the samples of the system step response.
• Forλ= 0and forNu=N2, calculateu˜opt.
• Numeric application : N2 = 3, r = [0 1 1]T. Give the expression of u˜opt if the initial condition is null. Simulate the response of the system to the control signalujust calculated.
Conclusion ? Same question with N2 = 10, r= [0 0 0 0 0 1 1 1 1 1]T. Same question with forλ= 1. Use the scripting features ofmatlabfor this question.
2 C code simulation
This program is used to test the behavior of the GPC controller with various types of systems. It uses functions that are coded in the filegpc.c. This code is generic, it can be used on every kind of system. For example it was used to control of a medial robot for beating heart surgery. The source
can be freely downloaded from the AVR website (http://eavr.u-strasbg.fr/->Recherche->Ressources).
2.1 Integrator
• Open the fileintergrateur.c.
• Try to understand its architecture. Indications : Init_gpc Dimensions initialization
na Dimension ofA(q−1)
nb Dimension ofB(q−1)
nc Dimension ofC(q−1)(nc >0)
m Number of inputs
n Number of outputs
hi N1(N1= 1in this practical work)
hc Ni, control horizon
hp N2, optimization horizon
Lambda Control energy ponderation
Calcul_gpc Optimal gain computation (see ingpc.c) NB_PAS_SIMULATION Number of iterations of the simulation Correcteur_gpc Current control signal computation Simu Simulation of one sampling time
• Compile this program withmake -f Makefile.integrateur.
• Launch this program withintegrateur>integrateur.out.
• Load the simulation output data in matlabwith>>load integrateur.out.
• Visualize the simulation result inmatlab with>>plot(integrateur). Check that it is the same than the one obtained in the previous section.
• Define λ= 1. Simulate. Visualize.
• Verify the expression ofGby uncommenting lines 516–517 ingpc.c. Comment them again after the simulation. Conclusion ?
TP ENSPS ISAV / Master IRIV 3
2.2 Low damped system
In this section, we will study GPC control of a system with a very small damping factor. Its transfer function is :
G(z) = 9.606.10−3z−1+ 2.354.10−2z−2+ 2.965.10−3z−3 1−2.046z−1+ 1.169z−2−0.09z−3
• Simulate the system step response in open loop using simulink.
• Open file mono.c.
• Compile this program.
• Launch the simulation and visualize the results usingmatlab. Comment.
• Simulate a step disturbance by uncommenting lines 191–193 inmono.c.
• Increase then decreaseλ. Comment.
• Increase then decreaseN2. Comment.
• Increase then decreaseNu. Comment.
• Revert to initial values (λ= 0.01,Nu = 20, N2= 70). This time, instead of a step distur- bance, program a white noise of amplitude 0.1 (man 3 randis your friend). Simulate the response with c1=−0.1 etc1=−0.999. Conclusion.
2.3 2 inputs 2 outputs system
• Open the filemulti22.c
• Compile. Simulate. Visualize. Comment.
• Try other values for the tuning parameters.
2.4 2 inputs one output system
• Open the filemulti21.c
• Compile. Simulate. Visualize. Comment.
2.5 1 input 2 outputs system
This system is uncontrollable. However, it is possible to compute a GPC control for it.
• Open the filemulti12.c
• Compile. Simulate. Visualize. Comment.