(Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.
-
Upload
miriam-ree -
Category
Documents
-
view
221 -
download
5
Transcript of (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.
![Page 1: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/1.jpg)
Recent Advances in Model Predictive Control
(Real time MPC)
Prepared by : Kamal Reza Varhoushi
December – 2011
![Page 2: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/2.jpg)
The philosophy behind MPC
![Page 3: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/3.jpg)
Manipulated variables : u(k-1)Controlled variables : y(k)
The model of sys used to prediction
The critical step of the predictive control
![Page 4: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/4.jpg)
open-loop optimization problem
![Page 5: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/5.jpg)
practical disadvantage of MPC
![Page 6: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/6.jpg)
Robust MPC
The uncertainty representation
Polytopic Uncertainty
Structured Feedback Uncertainty
![Page 7: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/7.jpg)
![Page 8: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/8.jpg)
Real time MPCFor each MPC problem, we need to solve an optimization problem for each sampling. So MPC limited to applications with slow dynamics (sampling time in seconds or minutes). A well-known technique for implementing fast MPC is to compute the entire control law offline (explicit MPC), in which case the online controller can be implemented as a lookup table. The control action is then implemented online in the form of a lookup table. The major drawback here is that the number of entries in the table can grow exponentially with the horizon, state, and input dimensions, so that “explicit MPC” can only be applied reliably to small problems (where the state dimension is no more than around five). So this method is not applicable for more complex problems.
![Page 9: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/9.jpg)
The new methods for fast MPC, develops by professor Boyd research group in Stanford university. These methods are based on combination of MPC with
automatic code generation.
![Page 10: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/10.jpg)
This report describe the capabilities and implementation of CVXGEN software package.
CVXGEN takes a high level description of a convex optimization family, and automatically generate flat, library-free C code that can be
compiled into high speed custom solver for the problem family
![Page 11: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/11.jpg)
![Page 12: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/12.jpg)
The main disadvantages of CVXGEN are:
1. It reduced to quadratic programming(QPs)
2. It is suitable for small and medium size problems
![Page 13: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/13.jpg)
![Page 14: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/14.jpg)
Problem statementenergy storage system that can be charged ordischarged from a source with varying energy price. A simple example is a battery connected
to a power grid
The goal is to alternate between charging and
discharging in order to maximize the average revenue
![Page 15: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/15.jpg)
Let first introduce problem variables and parameters:
![Page 16: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/16.jpg)
the energy price at time t
denote discourage excessive charging and
dischargingtime horizon T=50
![Page 17: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/17.jpg)
The easiest way to use this interface is via the
‘Matlab’ screen in CVXGEN's online
interface, Go to the website “
www.cvxgen.com” and create new project, then impose your
project data’s to the blank spaces shown in
window
![Page 18: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/18.jpg)
The second step is creating custom C codes for using in Matlab :
Download and extract the ‘cvxgen.zip’ archive for your problem. This will create a subdirectory
called CVXGEN.
Inside the cvxgen/ folder in Matlab, call
make_csolve. This will use the mex command to
compile and build your custom solver and creates
a csolve.mex* file.
![Page 19: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/19.jpg)
![Page 20: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/20.jpg)
![Page 21: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/21.jpg)
![Page 22: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/22.jpg)
![Page 23: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/23.jpg)
![Page 24: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/24.jpg)
As shown in figures, the variation of uc and ud between max and min values, determine this agreement that process has
been done in optimal way.
![Page 25: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/25.jpg)
CVXGEN implementationOnce the problem is in
canonical form, we use a standard primal dual interior
point method to find the solution
we introduce slack variables to solve
equivalent problem
![Page 26: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/26.jpg)
we find analytically the solution of the pair of primal and dual problems:
For duality formulation :
![Page 27: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/27.jpg)
Karush-Kuhn-Tucker (KKT) conditions
Each of the primal and dual algorithms
require two solves with the so-called KKT
matrixto find the solution (L) for the system KL = R.
![Page 28: (Real time MPC) Prepared by : Kamal Reza Varhoushi December – 2011.](https://reader036.fdocuments.net/reader036/viewer/2022062421/56649cac5503460f9496dde7/html5/thumbnails/28.jpg)
Thank you