is it possible to use neural network prediction model in Adaptive MPC ?
15 views (last 30 days)
Show older comments
Naveen kumar koritala
on 17 Nov 2023
Edited: Emmanouil Tzorakoleftherakis
on 22 Nov 2023
In the recent MATLAB release, it is possible to use a neural network prediction model instead of a system model to obtain prediction matrices over a prediction horizon for NonLinear mpc . I am wondering whether it would be possible to use the same for an adaptive MPC case.
0 Comments
Accepted Answer
Emmanouil Tzorakoleftherakis
on 21 Nov 2023
You should be able to do that, but we don't have an example to show the workflow unfortunately. You would first need to use automatic differentiation to get the A,B,C,D matrices using this command.
Then you would need to take the generated m-file and place it in a MATLAB Fcn block. An example of the latter is shown here.
Hope this helps
2 Comments
Emmanouil Tzorakoleftherakis
on 22 Nov 2023
Edited: Emmanouil Tzorakoleftherakis
on 22 Nov 2023
Please take a look at the links I provided more carefully. generateJacobianFunction (as the name implies) provides Jacobians. If you pass your dynamics as an argument, output will be a function that outputs Jx and Ju, aka A and B matrices. You can certainly use this function with multi-stage MPC, but at the end of the day it's just a function. You can tweak its signature and use it with adaptive MPC as well.
On a related note, generatematlabfunction could also potentially be used to calculate A and B, but it does not consider any MPC-specific circumstances, like for example having input disturbances in your prediction model. generatematlabfunction would not provide the correct matrices in scenarios like these. That said, you can use the generated 'state fcn' as input to 'generateJacobianFunction'. So the workflow would be:
- generatematlabfunction to get 'state fcn'
- use 'state fcn' as argument in 'generateJacobianFunction' to get linearization (if your MPC does not have disturbances, you can also potentially use the generated state fcn jacobian' from step 1 instead of this step)
- Tweak linearization function and place it in MATLAB Fcn block to use with adaptive MPC
To your last question, you don't need to call generateJacobianFunction at every time step, as the generation function is an analytical expression that depends on x and u. You can leverage this to get your linear system approximation as needed (for adaptive MPC this is required at every step).
Hope this helps
More Answers (0)
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!