How do I Tune Model Predictive Controller (MPC) in the Real Time?

29 views (last 30 days)
I performed a Real-Time Experiment with the MPC controller today and as expected I encountered some issues, The purpose of the controller is to keep in contact sample and tip, in this case tip is connected with a piezoelectric actuator and controlled by the MPC controller. but unfortunately controller is not able to follow the reference value (0V) there is a steady state error/saturation or even controller doesn't even work well, while in the simulations controller performance was excellent.
I am using MPC without Integral Action and also there is no external observer, MPC Simulink Block uses defualt Kalman Filter.
A few months ago I faced the same kind of issue with PI controller and by adjusting P and I gains I made it work, but I am not sure how can I tune MPC in real time and which parameters I have to change, if someone help me in this regards, please.
These were my parameters yesterday control horizons (Nc) = 3, prediction horizon Np 8, sampling time Ts = 0.00003. Now I changes Nc = 10 and Np = 20 and Ts = 0.001, I keep Input Weigths = 0, and Output Weight = 10.
Please help me and guide me on how can I tune MPC in real-time. I am using Simulink Desktop Real-time for implementation.

Accepted Answer

Emmanouil Tzorakoleftherakis
There could be many reasons why you don't see the expected results. First thing I would check is whether the controller can actually run at the rates you specify. The Ts values you are using are very small considering MPC solves an optimization problem online, so you may be running into overrruns. In simulation that's not much of a problem (simulations can run slower than real time) but when you try to control a real-time systemm this becomes a big requirement.
I would first go to the simulation model (which you mentioned works fine) and do a SIL test to measure how long it takes for the MPC block to run. Simulink profiler can help as well. Your Ts should be smaller than the time MPC requires to run.
  3 Comments
Emmanouil Tzorakoleftherakis
You are still trying to run the MPC controller at 1000Hz. Unless you don't have any constraints this is very likely not feasible for real-time control. You may also consider using explicit MPC instead if your state space is not very large. This approach can help speed up the control by a lot

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!