MPC: step response starts with unwanted negative swing when using previewing

2 views (last 30 days)
I am working with the mpc toolbox and try to use previewing for the setpoint. Whenever I do this, the step response starts with an unwanted negative swing, which gets worse by using a longer prediction horizon.
I attached a minimal example to demonstrate the problem on a simple PT2.
I use direct state feedback, wherefore I removed the output disturbance model of the mpc, so I do not have an extra state for disturbance. I wrote code to rewrite the "normal" set point data into a matrix, which contains a complete, receding reference horizon at each time step. This data is then used as reference for the mpc controller, by which it can use previewing.
The previewing works basically, as seen in the results. The controller reacts to the step before it occurs, but the step response starts with a negative swing. This swing doesn't seem to me like the optimal solution, therefore I can't understand why the mpc computes such a solution.
I tried tuning the weights, the lenghts of the horizon, the sample time, etc. but it all leads to the same results. The reference signal with the receding horizon, which my code produces, looks just as intended: each timestep contains a vector with the upcoming setpoint values along the horizon. A possible solution is to use a lower bound for the output, so the controller is forced to avoid a negative swing. But you would have to define such a lower bound everytime a step is made and it is not a very clean solution.
Does someone know where this negative swing come from and how to properly avoid it?

Accepted Answer

Emmanouil Tzorakoleftherakis
Edited: Emmanouil Tzorakoleftherakis on 19 Jan 2021
It appears that the optimization thinks that moving in the opposite direction first is "optimal". You can change that by adding a weight on the MV to make them stick closer to zero, e.g.
mpcobj.Weights.ManipulatedVariables = .3;
If you set the above, the controller works as expected (you may need to set a dist model to make steady state error zero).
---------------------
There seems to be something wrong with how the previewing is set up in Simulink. Please refer to this page for an example. I believe at each time step you need to provide a reference signal that is 20x1 in your case (since p=20) and to implement previewing, that signal needs to shift at each time step.
  2 Comments
Felix Thömmes
Felix Thömmes on 19 Jan 2021
I think my signal "Setpoint" is exactly what you are describing. It contains at each timestep a 20x1 vector, which contains the reference over the predicition horizon. But in case I made a mistake, I tried using the "future sample extractor" from the example you referred to as reference signal for the mpc controller, which leads to the same results, that I got before: If the prediction horizon is about ~13 sec long (either by changing the sample time or the number of prediction steps), the step response starts with a negative swing. The longer the horizon the worse the response.
I was wondering why there was no negative swing in the referred example itself, so i looked into it. It uses a lower bound of zero for the manipulated variable, which is why there is no negative swing. If you remove the lower bound it also produces the same results as my example.
Can you only avoid the negative swing by using bounds?
Emmanouil Tzorakoleftherakis
A few things: the example I pointed to I believe represents a nonminimum phase system with a RHP zero, so it makes sense that it first moves in the opposite direction.
In your example this does not seem to be the case, so it appears that the optimization thinks that moving in the opposite direction first is "optimal". You can change that by adding a weight on the MV to make them stick closer to zero, e.g.
mpcobj.Weights.ManipulatedVariables = .3;
If you set the above, the controller works as expected (you may need to set a dist model to make steady state error zero).
I updated my answer above

Sign in to comment.

More Answers (0)

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!