The solution obtained with the nlmpcmove function of the mpc toolbox is not "reproducible"?
2 views (last 30 days)
Show older comments
Background: My state function is nonlinear, which contains 9 state variables x, 8 control variables 'mv' and 1 known input perturbation 'md'. The prediction time domain and control time domain are both 15. I use the nlmpcmove function of the mpc toolbox to solve for this, as follows:
[~,~,Info] = nlmpcmove(nlobj,x0,u0,[],md,nloptions);
Problem 1: I got the best input (Info.MVopt) and the corresponding state (Info.Xopt) with the above code. Then I tried to write a for loop to derive the state for some time in the future from the best input (Info.MVopt) and my discrete state function, as follows:(where mv=Info.MVopt and '5000' is the input perturbation md when using the mpc toolbox, which will enable the for loop to run properly in the future and I put it at the end)
for t = 1:15
u0 = [mv(t,:)';5000];
xplus(:,t+1) = FluidQueueStateFcn(xplus(:,t),u0,p);
end
The bad thing is that the result I got is very different from the result Info.Xopt output by MPC toolbox. I don't know what is causing this.
Problem 2: I cannot get the correct result for some given initial solution u0. I set the initial state x0 and the initial input u0 to the values shown below:
x0 = [0;80;50;60;40;50;29;70;40];
u0 = 90*ones(8, 1);
The obtained results are shown below (input u and state x are always equal to the initial values u0 and x0), with u on the left and x on the right. I checked Info.Iterations=1, which is obviously not reasonable, and I do not know the reason for this phenomenon.
0 Comments
Answers (1)
Emmanouil Tzorakoleftherakis
on 30 May 2023
Edited: Emmanouil Tzorakoleftherakis
on 30 May 2023
Hi,
For problem 1:
I am not sure what's inside that state function but presumably there is some integrator that gives you k+1. I would make sure the integration value is equal to the controller sample time. If that's not the case you may see different results.
Another thing to consider: If you implemented 'signal previewing' properly from the other thread, then the measured disturbance will not be 5000 always but will vary with time. Make sure you use the appriopriate value for the measured disturbance in your integration.
For problem 2:
I would first check the value of ExitFlag variable under 'Info'. If this is not positive, no solution was found. Maybe the problem becomes infeasible from this particular initial condition.
Hope this helps
0 Comments
See Also
Categories
Find more on Model Predictive Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!