Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
How2use mup
J. Oravec – M. Bakošová
2016-05-23
R20160321
Disclaimer% Copyright is with the following author(s):%% (c) 2016 Juraj Oravec, Slovak University of Technology in Bratislava,% [email protected]% (c) 2016 Monika Bakosova, Slovak University of Technology in Bratislava,% [email protected]% -----------------------------------------------------------------------------------------------
1/2
Disclaimer% Legal note:% This program is free software; you can redistribute it and/or% modify it under the terms of the GNU General Public% License as published by the Free Software Foundation; either% version 2.1 of the License, or (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public% License along with this library; if not, write to the% Free Software Foundation, Inc.,% 59 Temple Place, Suite 330,% Boston, MA 02111-1307 USA
2/2
Problems to solve
RMPC
System
u(k) x(k)q(k)
Problems to solve
RMPC
System
u(k) x(k)q(k)
Problems to solve
RMPC
System
u(k) x(k)q(k)
Problems to solve
RMPC
System
u(k) x(k)q(k)
Problems to solve
RMPC
System
u(k) x(k)q(k)
RMPC
System
u(k) x(k)q(k)
Problems to solve
SDP:
RMPC
System
u(k) x(k)q(k)
Problems to solve
Control law:
RMPC
System
u(k) x(k)q(k)
Problems to solve
Control law:
Quality criterion:
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
Framework
System
u(k)
SDPFeas. Check
Control Law
SDP Solver
YALMIP
advanced analysis
feas.
infeas.
mup
x(k)
MATLAB Compatibility
r2013a
mup
r2014br2013a
mup
OpenGL
MATLAB Compatibility
r2014br2013a
mup
r2012a
OpenGL.slx
MATLAB Compatibility
r2014br2013a
mup
r2012ar2011b
OpenGL.slx.mdl
MATLAB Compatibility
r2014br2013a
mup
r2012ar2011b
OpenGL.slx.mdl
MATLAB Compatibility
• MATLAB/Simulink: rmpc_block (beginner)
• MATLAB: CLI (advanced)
How to use it ?
• MATLAB/Simulink: rmpc_block (beginner)
• MATLAB: CLI (advanced)
How to use it ?
LQR
System
u(k) x(k)
Simulink Block
u(k)x(k)
LQR
-K-
System
u(k) x(k)
x(k) u(k)
Simulink Block
bitbucket.org/oravec/mup
Simulink Block
RMPC
System
u(k) x(k)
rmpc_block
inputscost
feasibility
controllergamma
states
solver_timecounter
x(k) u(k)
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
Control law:
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
J(k)
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
J(k)
c(k)
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
J(k)
c(k)
F(k)
Control law:
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
J(k)
c(k)
γ
F(k)
SDP:
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
J(k)
c(k)
γ
F(k)
tsol
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
x(k)
u(k)
J(k)
c(k)
γ
F(k)
k
tsol
x(k)
u(k)
J(k)
c(k)
γ
F(k)
k
tsol
inputs
cost
feasibility
controller
gamma
states
rmpc_block
solver_time
counter
RMPC Configuration
RMPC Approaches
RMPC ApproachesKothare et al. (1996) Cuzzola et al. (2002) Mao (2003)Wan et al. (2003)Ding et al. (2007)Li et al. (2008) Cao et Li (2005)Huang et al. (2011)Zhang et al. (2013)
RMPC ApproachesKothare et al. (1996) Cuzzola et al. (2002) Mao (2003)Wan et al. (2003)Ding et al. (2007)Li et al. (2008) Cao et Li (2005)Huang et al. (2011)Zhang et al. (2013)NSO and ACISNSO and WACISNSO and SDLFPDLF and ACISPDLF and WACIS
RMPC ApproachesKothare et al. (1996) Cuzzola et al. (2002) Mao (2003)Wan et al. (2003)Ding et al. (2007)Li et al. (2008) Cao et Li (2005)Huang et al. (2011)Zhang et al. (2013)NSO and ACISNSO and WACISNSO and SDLFPDLF and ACISPDLF and WACISKothare et al. (1996) – Soft-ConWan et al. (2003) – Soft-ConCao et Li (2005) – Soft-ConNSO and ACIS – Soft-Con
Opt. Problem Design
• initial:speed up
• reformulation:analysis
Opt. Problem Design
• default:
• SDP:
Feasibility Tolerance
Uncertain System
Uncertain System
Uncertain System
Quality criterion
Quality criterion
Parameters
optional RMPC design and tuning parameters
Soft Constraints
Soft Constraints
enable
Soft Constraints
Soft Constraints
Setup
SDP Solver
SDP Solver
• CSDP (free)• DSDP (free)• LMILAB (comercial)• LOGDETPPA (free)• MOSEK (free for academia)• PENBMI (comercial)• PENLAB (free)• PENSDP (free for academia)• SDPA (free)• SDPLR (free)• SDPT3 (free)• SDPNAL (free)• SEDUMI (free)
users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Solvers.Solvers
Verbose Mode
• Normal• Silent• Loud (recommended)
Verbose Mode
YALMIP Verbose Mode
• Silent• Loud
YALMIP Verbose Mode
• MATLAB/Simulink: rmpc_block (beginner)
• MATLAB: CLI (advanced)
How to use it ?
%% System
A{1}=...; A{2}=...; A{3}=...; A{4}=...;
B{1}=...; B{2}=...; B{3}=...; B{4}=...;
C{1}=...; C{2}=...; C{3}=...; C{4}=...;
ts=0.5; % Sampling Time
x0=...; % Initial Conditions
1:
2:
3:
4:
5:
6:
CLI
%% System
A{1}=...; A{2}=...; A{3}=...; A{4}=...;
B{1}=...; B{2}=...; B{3}=...; B{4}=...;
C{1}=...; C{2}=...; C{3}=...; C{4}=...;
ts=0.5; % Sampling Time
x0=...; % Initial Conditions
1:
2:
3:
4:
5:
6:
CLI
%% System
A{1}=...; A{2}=...; A{3}=...; A{4}=...;
B{1}=...; B{2}=...; B{3}=...; B{4}=...;
C{1}=...; C{2}=...; C{3}=...; C{4}=...;
ts=0.5; % Sampling Time
x0=...; % Initial Conditions
1:
2:
3:
4:
5:
6:
CLI
%% Symmetric constraints
u_max=...; % Input constraints
x_max=...; % State constraints
1:
2:
3:
CLI
%% Symmetric constraints
u_max=...; % Input constraints
x_max=...; % State constraints
1:
2:
3:
CLI
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
List of avaliable methods:
1: Cao et al. (2005)
2: Cao et al. (2005) - Soft-Con
3: Cuzzola et al. (2002)
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
%% RMPC design
Wx=...; Wu=...; % Weight matrices
[method,kwd] = mup_cli_rmpc_method; % Method
mup_sdp % SDP formulation
mup_rmpc_opt % RMPC design
1:
2:
3:
4:
5:
CLI
%% Closed-loop control in k-th step
u = mup_rmpc{x,design}; % RMPC control law
1:
2:
CLI
%% Closed-loop control in k-th step
u = mup_rmpc{x,design}; % RMPC control law
1:
2:
CLI
%% Closed-loop control in k-th step
u = mup_rmpc{x,design}; % RMPC control law
1:
2:
CLI
Feasibility Check
Feasibility Check
enable
• Normal• Silent• Loud (recommended)
Verbose Mode
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...MUP:BLOCK:RMPC: Valid. (0.12)MUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.03 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...MUP:BLOCK:RMPC: Valid. (0.12)MUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.03 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...FEAS_CHK: VTX:2|I:1: Stability condition violated!FEAS_CHK: VTX:2|I:2: Stability condition violated!FEAS_CHK: VTX:1|I:1: State contraints violated!FEAS_CHK: VTX:1|I:2: State contraints violated!FEAS_CHK: VTX:2|I:1: State contraints violated!FEAS_CHK: VTX:2|I:2: State contraints violated!FEAS_CHK: VTX:3|I:1: State contraints violated!FEAS_CHK: VTX:3|I:2: State contraints violated!FEAS_CHK: Failed! (8 infeasible constraint(s) found) (0.03)MUP:BLOCK:RMPC: Feasibility check failed!MUP:BLOCK:RMPC: Instead of Robust MPC has been designed LQ controllerMUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.05 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...FEAS_CHK: VTX:2|I:1: Stability condition violated!FEAS_CHK: VTX:2|I:2: Stability condition violated!FEAS_CHK: VTX:1|I:1: State contraints violated!FEAS_CHK: VTX:1|I:2: State contraints violated!FEAS_CHK: VTX:2|I:1: State contraints violated!FEAS_CHK: VTX:2|I:2: State contraints violated!FEAS_CHK: VTX:3|I:1: State contraints violated!FEAS_CHK: VTX:3|I:2: State contraints violated!FEAS_CHK: Failed! (8 infeasible constraint(s) found) (0.03)MUP:BLOCK:RMPC: Feasibility check failed!MUP:BLOCK:RMPC: Instead of Robust MPC has been designed LQ controllerMUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.05 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...FEAS_CHK: VTX:2|I:1: Stability condition violated!FEAS_CHK: VTX:2|I:2: Stability condition violated!FEAS_CHK: VTX:1|I:1: State contraints violated!FEAS_CHK: VTX:1|I:2: State contraints violated!FEAS_CHK: VTX:2|I:1: State contraints violated!FEAS_CHK: VTX:2|I:2: State contraints violated!FEAS_CHK: VTX:3|I:1: State contraints violated!FEAS_CHK: VTX:3|I:2: State contraints violated!FEAS_CHK: Failed! (8 infeasible constraint(s) found) (0.03)MUP:BLOCK:RMPC: Feasibility check failed!MUP:BLOCK:RMPC: Instead of Robust MPC has been designed LQ controllerMUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.05 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...FEAS_CHK: VTX:2|I:1: Stability condition violated!FEAS_CHK: VTX:2|I:2: Stability condition violated!FEAS_CHK: VTX:1|I:1: State contraints violated!FEAS_CHK: VTX:1|I:2: State contraints violated!FEAS_CHK: VTX:2|I:1: State contraints violated!FEAS_CHK: VTX:2|I:2: State contraints violated!FEAS_CHK: VTX:3|I:1: State contraints violated!FEAS_CHK: VTX:3|I:2: State contraints violated!FEAS_CHK: Failed! (8 infeasible constraint(s) found) (0.03)MUP:BLOCK:RMPC: Feasibility check failed!MUP:BLOCK:RMPC: Instead of Robust MPC has been designed LQ controllerMUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.05 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...FEAS_CHK: VTX:2|I:1: Stability condition violated!FEAS_CHK: VTX:2|I:2: Stability condition violated!FEAS_CHK: VTX:1|I:1: State contraints violated!FEAS_CHK: VTX:1|I:2: State contraints violated!FEAS_CHK: VTX:2|I:1: State contraints violated!FEAS_CHK: VTX:2|I:2: State contraints violated!FEAS_CHK: VTX:3|I:1: State contraints violated!FEAS_CHK: VTX:3|I:2: State contraints violated!FEAS_CHK: Failed! (8 infeasible constraint(s) found) (0.03)MUP:BLOCK:RMPC: Feasibility check failed!MUP:BLOCK:RMPC: Instead of Robust MPC has been designed LQ controllerMUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.05 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /Normal MUP:BLOCK:RMPC: FEASIBILITY_CHECK initialized...FEAS_CHK: VTX:2|I:1: Stability condition violated!FEAS_CHK: VTX:2|I:2: Stability condition violated!FEAS_CHK: VTX:1|I:1: State contraints violated!FEAS_CHK: VTX:1|I:2: State contraints violated!FEAS_CHK: VTX:2|I:1: State contraints violated!FEAS_CHK: VTX:2|I:2: State contraints violated!FEAS_CHK: VTX:3|I:1: State contraints violated!FEAS_CHK: VTX:3|I:2: State contraints violated!FEAS_CHK: Failed! (8 infeasible constraint(s) found) (0.03)MUP:BLOCK:RMPC: Feasibility check failed!MUP:BLOCK:RMPC: Instead of Robust MPC has been designed LQ controllerMUP:BLOCK:RMPC: FEASIBILITY_CHECK: Termined. (0.05 sec)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
• Normal• Silent• Loud (recommended)
Verbose Mode
Feasibility Check /LoudFEAS_CHK: Inverse Lyapunov matrix MIN_EIG = 3.275738e+00.FEAS_CHK: I:1: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:2: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:1: Inverse SDLF matrix Q MIN_EIG = 1.482989e-06.FEAS_CHK: I:2: Inverse SDLF matrix Q MIN_EIG = 1.480064e-06.FEAS_CHK: I:1: Invariant ellipsoid matrix MIN_EIG = 1.566609e-08.FEAS_CHK: I:2: Invariant ellipsoid matrix MIN_EIG = 1.439442e-08.FEAS_CHK: VTX:1|I:1: Stability condition matrix MIN_EIG = 8.704402e-06.FEAS_CHK: VTX:1|I:2: Stability condition matrix MIN_EIG = 8.705740e-06.FEAS_CHK: VTX:2|I:1: Stability condition matrix MIN_EIG = -5.363964e-06.FEAS_CHK: VTX:2|I:1: Stability condition violated!… (shortened)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /LoudFEAS_CHK: Inverse Lyapunov matrix MIN_EIG = 3.275738e+00.FEAS_CHK: I:1: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:2: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:1: Inverse SDLF matrix Q MIN_EIG = 1.482989e-06.FEAS_CHK: I:2: Inverse SDLF matrix Q MIN_EIG = 1.480064e-06.FEAS_CHK: I:1: Invariant ellipsoid matrix MIN_EIG = 1.566609e-08.FEAS_CHK: I:2: Invariant ellipsoid matrix MIN_EIG = 1.439442e-08.FEAS_CHK: VTX:1|I:1: Stability condition matrix MIN_EIG = 8.704402e-06.FEAS_CHK: VTX:1|I:2: Stability condition matrix MIN_EIG = 8.705740e-06.FEAS_CHK: VTX:2|I:1: Stability condition matrix MIN_EIG = -5.363964e-06.FEAS_CHK: VTX:2|I:1: Stability condition violated!… (shortened)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /LoudFEAS_CHK: Inverse Lyapunov matrix MIN_EIG = 3.275738e+00.FEAS_CHK: I:1: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:2: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:1: Inverse SDLF matrix Q MIN_EIG = 1.482989e-06.FEAS_CHK: I:2: Inverse SDLF matrix Q MIN_EIG = 1.480064e-06.FEAS_CHK: I:1: Invariant ellipsoid matrix MIN_EIG = 1.566609e-08.FEAS_CHK: I:2: Invariant ellipsoid matrix MIN_EIG = 1.439442e-08.FEAS_CHK: VTX:1|I:1: Stability condition matrix MIN_EIG = 8.704402e-06.FEAS_CHK: VTX:1|I:2: Stability condition matrix MIN_EIG = 8.705740e-06.FEAS_CHK: VTX:2|I:1: Stability condition matrix MIN_EIG = -5.363964e-06.FEAS_CHK: VTX:2|I:1: Stability condition violated!… (shortened)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK
Feasibility Check /LoudFEAS_CHK: Inverse Lyapunov matrix MIN_EIG = 3.275738e+00.FEAS_CHK: I:1: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:2: Inverse SDLF matrix W MIN_EIG = 3.115516e-01.FEAS_CHK: I:1: Inverse SDLF matrix Q MIN_EIG = 1.482989e-06.FEAS_CHK: I:2: Inverse SDLF matrix Q MIN_EIG = 1.480064e-06.FEAS_CHK: I:1: Invariant ellipsoid matrix MIN_EIG = 1.566609e-08.FEAS_CHK: I:2: Invariant ellipsoid matrix MIN_EIG = 1.439442e-08.FEAS_CHK: VTX:1|I:1: Stability condition matrix MIN_EIG = 8.704402e-06.FEAS_CHK: VTX:1|I:2: Stability condition matrix MIN_EIG = 8.705740e-06.FEAS_CHK: VTX:2|I:1: Stability condition matrix MIN_EIG = -5.363964e-06.FEAS_CHK: VTX:2|I:1: Stability condition violated!… (shortened)
2.5 GHz CPU, 4GB RAM, MATLAB 2013a, MOSEK