MPC in Under supervision of: Dr S.K. Hosseini S. By: S.H. Edjtahed M.G. Farajzadeh D.

54
MPC in Under supervision of: Dr S.K. Hosseini S. http://ejtahed.fumblog.um.ac.ir By: S.H. Edjtahed M.G. Farajzadeh D.

Transcript of MPC in Under supervision of: Dr S.K. Hosseini S. By: S.H. Edjtahed M.G. Farajzadeh D.

Page 1: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MPC inUnder supervision of:

Dr S.K. Hosseini S.

http://ejtahed.fumblog.um.ac.ir

By:

S.H. Edjtahed

M.G. Farajzadeh D.

Page 2: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MPC in MATLAB:

• MATLAB MPC Toolbox (Morari)

• IMPACT Toolbox (Camacho)

• MPCTools (Akesson)

•BLOM (Berkeley Lib. for Optimization MPC)

•MPT (Multi Parametric Toolbox)

•jMPC (Jonathan Currie)

Page 3: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

• SOSTOOLS Toolbox (caltech)

• YALMIP Toolbox (Camacho)

• CVX Toolbox (Johan Löfberg)

• MATLAB LMI Toolbox (Gahinet et al)

• MPC in LabView (Telemark University College)

• MPC with MATLAB (a Book by Wang)

Page 4: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

Overview:MATLAB MPC Toolbox

1. MPC Modeling in MATLAB

2. Case Study introduction

3. MPC in GUI (mpctool)

4. MPC in Command Line

5. MPC in Simulink

Page 5: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC ModelingMATLAB MPC Toolbox

Page 6: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC Modeling: Plant ModelMATLAB MPC Toolbox

Page 7: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC Modeling: Plant Model

The MPC controller performs all

the estimation and optimization

calculations using a:

discrete-time,

delay-free,

state-space system,

with dimensionless input and

output variables.

MATLAB MPC Toolbox

Page 8: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC Modeling: Plant ModelMATLAB MPC Toolbox

Page 9: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC Modeling: Plant ModelMATLAB MPC Toolbox

Page 10: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC Modeling: LTI Object propertyMATLAB MPC Toolbox

Page 11: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

1. MPC Modeling: MIMO PlantsMATLAB MPC Toolbox

Page 12: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

Servo MechanismMATLAB MPC Toolbox

2. Case Study introduction:

Page 13: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

2. Case Study :Modeling

Page 14: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

2. Case Study :Plant Definition

Page 15: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

2. Case Study :Plant Definition

Page 16: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

>> mpctool

MATLAB MPC Toolbox

3. MPC in GUI (mpctool)

Page 17: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Specifying signal properties

Page 18: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Specifying controller properties

Page 19: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Specifying controller properties

Page 20: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Specifying controller properties

Page 21: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Specifying scenario

Page 22: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Simulation results

Page 23: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Correcting controller properties

Page 24: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

3. MPC in GUI (mpctool): Simulation results

Page 25: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

4. MPC in Command Line

1.Defining the Plant Model

2.MPC commands

3.Constructing an MPC Object

4.Setting, Getting, and Displaying Object Properties

5.Running a Simulation

6.Plotting the results

Steps:

Page 26: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

4. MPC in Command Line

1.Defining Parameters

2.Defining Sys model

4.1. Defining the Plant Model:

Page 27: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

4. MPC in Command Line4.2. MPC commands:

4.3. Constructing an MPC Object

Page 28: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

4. MPC in Command Line

4.4. Setting, Getting, and Displaying Object Properties

Page 29: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

4. MPC in Command Line4.5. Running a Simulation

4.6. Plotting the results

Page 30: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

5. MPC in Simulink

Page 31: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

5. MPC in Simulink

Page 32: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MATLAB MPC Toolbox

5. MPC in Simulink

Page 33: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

Integrated Multiple Predictive Algorithm

Control Tool

The controllers implemented under IMPACT: GPC (Generalized Predictive Control) SPGPC (GPC with Smith Predictor) DMC (Dynamic Matrix Control) PFC (Predictive Functional Control) SSMPC (State Space Model Predictive Control)

Page 34: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

add the path of IMPACT directory into the Matlab path in order to run IMPACT correctly.

Type in Command window of MATLAB:>> impact

Containing (Systems + Experiments): All Simulation Examples of the Book

All exercise corresponding to the chapters of the book MPC.

You can add your own!

All Simulation Results is available here in FUMBlog:

Page 35: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

For MIMO systemsselect the:

system to simulatecontroller to be usedparameters of MPC

set: durationreference to reachconstraints noisedisturbances

result: outputs , U , DU

Page 36: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

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 showed

Page 37: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

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

1. Carima Model.

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

2. Step Response Model (DMC)

The variable gninputs contains the inputs of the system

3. Space State Model

the variables Mm, Nm and Qm.(PFC and SSMPC)

Error Modelling:

Ap,Bp for the CARIMA--- gp for the Step response--- Mp, Np and Qp for State Space

sinfo:General information about the system in a cell array

2 variables for reference: Constant: vrefc Variable: vrefv

Page 38: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.
Page 39: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

Linear Matrix Inequality in MATLAB

>> lmidem

Page 40: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

For all 3 Solvers:Input: an LMI systemOutput: x* (decision variable)

Page 41: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.
Page 42: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.
Page 43: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.
Page 44: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

>> lmiedit

Page 45: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

Solving LMI:

Page 46: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.
Page 47: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

See Problem Definition at FUMblog: http://ejtahed.fumblog.um.ac.ir

Page 48: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

umax=2Q1=[1 0; 0 0]B1=B2=[0 0.1*0.787]’

YQ

Page 49: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

An useful MATLAB function for Designing RMPC With LMI

Available at FUMblog: http://ejtahed.fumblog.um.ac.ir

Page 50: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

A useful function for Designing CGPC with MATLAB

Page 51: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

A useful function for Designing CGPC with MATLAB

Available at FUMblog: http://ejtahed.fumblog.um.ac.ir

Page 52: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

MPC in LabView

Page 53: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

All Thing is Available at: http://ejtahed.fumblog.um.ac.ir

Page 54: MPC in Under supervision of: Dr S.K. Hosseini S.  By: S.H. Edjtahed M.G. Farajzadeh D.

References:

http://www.mathworks.com/ http://www.i2c2.aut.ac.nz/Resources/Software/jMPCToolbox.html https://www.embotech.com/FORCES-Pro/How-to-use/MATLAB-Interface/Simple-MPC-Example http://www-control.eng.cam.ac.uk/jmm/mpcbook/software/software.html http://www.mpc.berkeley.edu/mpc-course-material http://forces.ethz.ch/doku.php?id=examples:simplempc#simple_mpc_example http://www.control.lth.se/user/johan.akesson/mpctools/ http://www.mpclab.net/Trac/ http://control.ee.ethz.ch/research/software.php http://cvxr.com/cvx/ http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Main.WhatIsYALMIP http://www.cds.caltech.edu/sostools/ http://ejtahed.fumblog.um.ac.ir/