Is it possible to provide output anticipation with the non linear Model Predictive Toolbox?

6 views (last 30 days)
I am trying to use the example code of the non linear Model Predictive Control Toolbox provided by Matworks:
openExample('mpc/SimulateClosedLoopControlUsingNonlinearMPCControllerExample')
I have changed the output reference as shown here:
Specify the output reference value.
c=[zeros(30,1);ones(70,1)];
yref = [c zeros(100,1)];
And update it in the move computation routine:
Run the simulation for 10 seconds. During each control interval:
  1. Correct the previous prediction using the current measurement.
  2. Compute optimal control moves using nlmpcmove. This function returns the computed optimal sequences in nloptions. Passing the updated options object to nlmpcmove in the next control interval provides initial guesses for the optimal sequences.
  3. Predict the model states.
  4. Apply the first computed optimal control move to the plant, updating the plant states.
  5. Generate sensor data with white noise.
  6. Save the plant states.
Duration = 10;
xHistory = x;
for ct = 1:(Duration/Ts)
% Correct previous prediction
xk = correct(EKF,y);
% Compute optimal control moves
[mv,nloptions] = nlmpcmove(nlobj,xk,mv,yref(ct,:),[],nloptions);
% Predict prediction model states for the next iteration
predict(EKF,[mv; Ts]);
% Implement first optimal control move
x = pendulumDT0(x,mv,Ts);
% Generate sensor data
y = x([1 3]) + randn(2,1)*0.01;
% Save plant states
xHistory = [xHistory x];
end
and the result is the one shown in the figure:
As you can see from the cart position graph, which is the output for that I provide a step reference (blue actual output, orange reference otput), there is no output anticipation the controller react just after the set-point changes. I would like to know if there is a method to make the nlmpc (non linear model predictive control) aware of the future reference.
In order to be clear the cart velocity is the second output and the reference is always set to 0 for it and the weight of the outputs are all set to 3.

Accepted Answer

Emmanouil Tzorakoleftherakis
Hello,
Yes it is possible to use previewing with nonlinear MPC, here is an example that shows how to do that.

More Answers (0)

Tags

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!