Hello everyone,
I am planning to add terminal weights and terminal constraints to my NMPC code. However, I am not sure how to define the cost function using the standard with additional terminal cost. Can anyone help me with this?
Thank you
Best,

 채택된 답변

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis 2023년 3월 3일
편집: Emmanouil Tzorakoleftherakis 2023년 3월 8일

0 개 추천

For nonlinear mpc, the easiest way to do that is to use the multistage formulation and block. Then you can set constraints/cost for the final stage to accomplish what you need. Here is an example that you can use as a reference.
You could also do the same with the generic nonlinear MPC formulation that you are currently using, but it is a bit more complex. An example that you can follow is here. Here, you would need to provide constraints and weights as vectors for the entire prediction horizon, for each time step. So you can see how much more convenient the multistage formulation is where you have the flexibility to define cost/constraints at every stage/time step.
For linear MPC you can just set the desired weights in the standard cost and then call setterminal.

댓글 수: 6

Saskia Putri
Saskia Putri 2023년 3월 8일
Thank you for you response, I appreciate it.
I am using Nonlinear MPC block from Simulink. When I add the setterminal with code as follows:
Y = struct('Min',[0,0,0,0],'Max',[10,10,10,10],'Weight',[10 10 10 10]);
U = struct('Min',[0,0],'Max',[7,7],'Weight',[0 0]);
setterminal(nlobj, Y,U,10);
I received an error warning as follow:
Incorrect number or types of inputs or outputs for function 'setterminal'.
Do you have suggestions?
Thank you
Apologies, I misread your question. Updated my answer
Saskia Putri
Saskia Putri 2023년 3월 8일
I understand. Thank you very much for your prompt response!
Saskia Putri
Saskia Putri 2023년 3월 8일
I have one additional question, In noticed that for the Parallel Parking Using Nonlinear Model Predictive Control, they set the weight based on the preferable gain. Since I want to apply the lyapunov function to the MPC, would it be possible to use succesive linearization to get A from the NMPC model and then use lyap(A,Q) to get the terminal weight?
Thank you for your patience!
You should be able to do that. That would make the weights time varying, so you would need to provide them at runtime (here is the doc explanation for this). I cannot think of an existing example with nonlinear mpc that does that, but here is a linear mpc one. The concept is similar.
Saskia Putri
Saskia Putri 2023년 3월 8일
Thank you very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Model Predictive Control Toolbox에 대해 자세히 알아보기

제품

릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by