Clear Filters
Clear Filters

Advice on adding a manipulatable variable target to MPC

6 views (last 30 days)
I've designed an MPC in MATLAB using the mpc function and successfully simulated it in Simulink using the MPC block in closed loop with a non-linear simulation model.
>> size(mpcobj)
MPC controller with 4 measured output(s), 0 unmeasured output(s),
3 manipulated input(s), 0 measured disturbance(s), 4 unmeasured disturbance(s)
I now want to add a target to one of the manipulatable variables as explained here, which I did as follows:
>> mpcobj.MV(1).Target = mpcobj.MV(1).Max;
Since I have 3 MVs and 2 CVs this should have an effect.
Note: I actually have 4 measured outputs but I have set the weights to zero on 2 of them:
>> mpcobj.Weights.OutputVariables
ans =
1 0 0 10
All my input and output scalings are set to one (I handle scaling manually outside the MPC block).
mpcobj.MV(1)
ans =
struct with fields:
Min: -61.3500
Max: 38.6500
MinECR: 0
MaxECR: 0
RateMin: -Inf
RateMax: Inf
RateMinECR: 0
RateMaxECR: 0
Target: 38.6500
Name: 'MV1'
Units: ''
ScaleFactor: 1
Type: 'continuous'
However, there is no difference in my simulation outputs with the MV target and without it.
  • What else should I be checking?
  • Is there a weight parameter for this MV target error that I should be increasing?
  1 Comment
Bill Tubbs
Bill Tubbs on 2 Oct 2022
Some more information. The reason I think the MV target should have an effect is that I noticed differences in the simulation outputs when only changing the ManipulatedVariablesRate parameters.
For example, here are two simulation outputs (showing only the 2nd output variable, and the response to an input disturbance at t=5):
In one case (ManipulatedVariablesRate(2) = 5) this output is pushed up to its maximum constraint (red dotted line) and in the other (ManipulatedVariablesRate(2) = 2) it is not. I think this proves that there is 'slack' in the system - i.e. no unique steady-state solution to the MPC. Therefore adding the additional target to the objective function should reduce the degrees of freedom.

Sign in to comment.

Accepted Answer

Bill Tubbs
Bill Tubbs on 2 Oct 2022
As usual, I figured it out a few minutes after posting this question!
It actually says this in the documentation page I linked to in the question:
mpcobj.weights.manipulated = [0.3 0]; % weight difference MV#1 - Target#1
Although this statement doesn't work for me (maybe the documentation is out of date?), I found if I set the Weights.ManipulatedVariables property of my mpc to a non-zero value, the MV target becomes effective:
mpcobj.Weights.ManipulatedVariables(1) = 0.3;
Quite obvious in retrospect but I wasn't aware of this parameter.

More Answers (0)

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!