IMPACT Integrated Multiple Predictive Algorithm Control Tool

By Tony Lawson,2014-06-19 06:31
8 views 0
IMPACT Integrated Multiple Predictive Algorithm Control Tool

Integrated Multiple Predictive Algorithm Control Tool.

Tool for the Second Edition of the book MPC

By E.F.Camacho and C.Bordons


1. Introduction 2

    2. Installation 2

    3. User‟s interface 3

    4. System Source files for Impact 4 5. System 7

    6. The System File Window 8

    7. Controller 9

     7.1. GPC: Generalized Predictive Control 10

     7.2. SPG: GPC with Smith Predictor 11

     7.3. DMC: Dynamic Matrix Control 12

     7.4. PFC: Predictive Functional Control 14

     7.5. SSMPC: State Space MPC 14

    8. Experiment 17

    9. Indications to perform an experiment 23 10. Acceding variables through Matlab workspace 25 11. Possible errors 26


    Files from the book: the way of preloading an experiment

     12.1. Example source Code 28

     12.2. Glossary of code for preloading 29

IMPACT: Integrated Multiple Predictive Algorithm Control Tool.


    The objective of this program is to show several linear predictive controllers inside an only user interface that allows simulating systems in such an easy and fast way. It gives the opportunity to change the parameters of a simulation to analyze the differences produced.

    The controllers implemented under the interface are:

    ~ GPC (Generalized Predictive Control)

    ~ SPGPC (GPC with Smith Predictor)

    ~ DMC (Dynamic Matrix Control)

    ~ PFC (Predictive Functional Control)

    ~ SSMPC (State Space Model Predictive Control)

    The algorithms for all these controllers have been programmed for a generic multivariable case to work with SISO and MIMO systems.

    The interface will let to select the system to simulate, the controller to be used, and the design parameters of this control. Regarding to the parameters relative to the experiment, it will be possible to set its duration, reference to reach, constraints and additional fields, such as noise and disturbances.

    The result of the simulation will be a graphic, time versus outputs, and it will be possible to add other ones to get more information about the experiment.


    1. Unzip the file IMPACT.ZIP into a directory, this will result in the files needed

    for this program (p files), and some subdirectories with the examples (m files).

    2. It is necessary to add the path of this directory into the Matlab path in order to

    run IMPACT correctly.


    Typing impact in the MATLAB Command Window brings up the IMPACT interface with the next figure:

The interface is divided in three different parts:

    ~ SYSTEM: This part loads the system file to be simulated, changes its properties

    (matrices) and saves a system created by the user in a file.

    ~ CONTROLLER: It sets the kind of MPC controller to be used, and allows

    changing the specific tuning parameters, such as horizons or weighting matrices.

    ~ EXPERIMENT: It establishes the main features of the simulation: time,

    reference parameters, constraints, noises, disturbances and graphics to be


    Apply and Cancel are the buttons that start the simulation or close the interface respectively. Apply makes all the calculations of the experiment verifying the correct filling of the fields in the interface, and advising through warning or error windows about possible errors.


     A system source file in IMPACT will contain the different matrices that model the behaviour of a system.

    The following forms of modelling a system are accepted by IMPACT.

1. Carima Model.

    11d11 (z)?y(t)z?(z)?u(t1);?C(z)?e(t)

     -dA and B model the system, and the delay factor (z) have been integrated in B.

    For example a model with d=3 given by:

    131 (1;az)?y(t)z?(b;bz)?u(t1);e(t)01

will be described in the system file in the next way:

A=[1 a]; B=[0 0 0 b0 b1];

    This model is used by controllers GPC, SPGPC and DMC, for this case with a previous transformation from CARIMA into a Step Response model.

2. Step Response Model


    y(t)g?u(ti) ?ii1

    Used by DMC, it is implemented by the matrix g in the file. The length of this

    matrix sets the upper value of the prediction horizon in the DMC controller. The variable gninputs contains the inputs of the system, necessary if IMPACT works with the step response model.

3. Space State Model



    M, N and Q describe the system. In the file their names are the variables Mm,

    Nm and Qm. They are used by PFC and SSMPC controllers.

    These models are used by the simulator of the process, but it is possible that the controller uses a different model of the system, i.e. an Error Modelling, that can be enabled in the interface. In this case the file system will contain other matrices named by Ap and Bp for the CARIMA, gp for the Step response, and Mp, Np and Qp for the

    State Space Model.

A general information about the system in the file is contained in the cell array sinfo.

    The system file also contains two variables that set the reference for the system:

    1. Constant Reference: vrefc, that contains a constant reference for the outputs. It is a column vector with the Set-Points in the case of using a constant reference in the experiment. Notice that its size will be the number of outputs of the system.

    2. Variable Reference: vrefv, built by the creator of the system file to describe changes in the Set-Point. It is a matrix whose vectors are the Set-Points for each output. The length of these vectors will be adapted to the simulation time of the experiment.

    An example of the structure of a m-file accepted by IMPACT is the next one (SISO system):

% e1s1d0.m

    % Model Matrices

    A=[1 -0.8];


    % Error Model Matrices:.

    Ap=[1 -0.875];


    %Step response model and error modelling

    g =[0;0.2;0.36;0.488;0.5904;0.67232;0.737856;0.7902;0.83222;...



    gninputs=1; %Needed if the system only works with g

    %State-Space Model

    Mm=0.8; Nm=0.5; Qm=0.4;

    %State Space Error Modelling

    Mp=0.9; Np=0.5; Qp=0.35;

%Information of the system


    %Constant SP


    %Built Variable SP built on vrefv

    intt=50;totalt=100; %Local variables to built vrefv

    vrefv=[0.5*ones(1,intt) , 0.25*ones(1,(totalt-intt)+1)];

There are several options for the system files that are described in Appendix I. These

    ones are designed specifically to load an experiment directly with the system file. They have been used with the example and exercise files that accompany this software, corresponding to the chapters of the book MPC.

    In spite of this, these options can be used by the user to create his system and experiment files.


    The system part initially present two fields:

    ~ A list menu that includes the m-files of the directory

    ~ A button that allows changing the directory which the system files are included


Pressing this button the next window appears:

    Current directory

    It moves to the

    directory above

    List of subdirectories

    In the field “Directory” it is possible to write directly the root of the system file location. To search it, press the button to go to the directory above of choose in the list menu some of the subdirectories to continue. When the root directory is ready, press the button Apply.

    Then the main window loads the names of all the m-files in the root in the field FILE. You can display it and choose some of the system files.

    CAUTION 1: When a file is selected, the program executes the m-file, so this one has to store the parameters required by the interface. However if you choose another kind of system, the results could be unpredictable, causing errors. In this case close the IMPACT interface and load it again, selecting an appropriate system.

    CAUTION 2: Type the name of the unit in the edit field if you want to change from C:\ the unit that stores the system files.

    Selecting one of the system file the system is completed with the next fields:

     Button that

     opens the General Information system about the system window

    In the case of selecting a system file with the possibility of loading an experiment from the file, such as files with examples and exercises of the book, a new button appears. Pressing LOAD EXPERIMENT all the parameters of the experiment and the control are loaded (see Appendix I for more information).

    This step is quite enough to continue the selection of the controller and the experiment. If you want to see more details of the system, change it of save a new system into a file, press the System Info button to open the System File Window.


    All the fields indicated in the previous point could be showed by pressing the System Info in the main menu.

    The fields Inputs, Outputs and Delays are automatically calculated by IMPACT through the given model.

    Then, it is possible to change the system by some of its model descriptions, writing directly over the edit fields. In this case the fields inputs, outputs and delays, can be automatically reloaded, changing the matrices of the system.

    Press Cancel if you do not want to load the changes. The changes will be enabled pressing “Save Changes and Close”.

If we want to save the changed system pressing on Save in a File, a new window

    appears, asking for the name and the root of the file.

    Change the directory or the file name to the wished one. A general information about the system (commentaries, description, 5 lines maximum) could be added too. Pressing SAVE button the changes are completed and the file is saved.


    This part enables the type of controller to be used, and the possibility of considering a modelling error for the system load above.

The modelling error button enables it for Prediction Model , Ap,Bp, or Mp,Np and Qp

    instead of the model represented by A,B or Mm, Nm and Qm. This mode will be

    possible only if the system file contains an error modelling, in other case a warning window will be displayed.



    This control uses the CARIMA model, where B contains the delay factor:

    1111 (z)?y(t)(z)?u(t1);?C(z)?e(t)

    where the unmeasurable disturbance is given by a white noise coloured by C(z-1).

    The objective function is a quadratic cost function of he form::


    ˆJ( N1, N2, N u) = y(t;j|t)w(t;j);u(t;j1|t)RQ??jNj11

    ˆWhere is the optimal prediction in t+j of the system output computed in t, w y(t;j/t)

    is the reference trajectory. N1 and N2 are the initial and the final value of the prediction horizon and Nu is the control horizon. R and Q are positive matrices that represent the weightings for the trajectory and the control respectively. Considering the effect of the delay d in the system, the horizons N1 and N2 have been

    chosen in the following way:



    N will be the prediction horizon parameter of the GPC.

Four parameters are necessary for tuning the controller:



    ~ Q1, CONTROL WEIGHT. Column vector that contains the weighting of each

    control input. Its size is [q1;…;qn], being n: number of inputs.

    ~ R1, REFERENCE WEIGHT. Column vector that contains the weighting of each

    output with size number of outputs.

    Q1 and R1 appear initially as column vectors with 1s. The program internally uses a diagonal matrices Q and R, whose diagonals are the elements of Q1 and R1.

Report this document

For any questions or suggestions please email