This is my first post so please correct me if I’m doing something wrong.
I have the non-linear model of my system and successfully implemented a non-linear MPC using matlab as interface. However, the solving time is a bit to high on the target hardware. I would like to linearize my model and use a different solver to achieve lower computational time. The main problem is that, to have a coherent model, I think that I should linearize at each step of the prediction horizon using the previous step states and control actions. Is there a way to do so?
I think this is exactly what an SQP method (or the RTI) does. It solvers at every MPC step an QP (you can think of it as local linear MPC) - where the QP is obtained by evaluating the linearization’s at the previous iterate. For more technical details on this you can read https://publications.syscop.de/Gros2016.pdf which exactly explains the connection between LTV MPC and nonlinear MPC.
To help you with your problem in practice, you probably have tried different horizon lengths, samplings time.
You may use also multiphase OCP (lookt at the acados examplse) and have a finer discretization at the beginning and coarser in the reminder of the MPC prediction horizon, and this can save you lot of computation time without harming the closed loop performance much.
Do you have a least squres objective? What kind of numerical integration do you use in your MPC?
Changing these things can speed up quite a bit.
I set cost_type to ‘linear_ls’ and sim_method to ‘erk’.
I’m indeed using as nlp_solver ‘sqp_rti’, I got what you say but shouldn’t it be faster if it wouldn’t need to lineatize but just replace the previous iteration states in a matrix? If I linearize the system I would get the matrices which would be function of the linearization point, for the solver it would be just a plug in and matrices operations.
Thank you for the insights, I’m a student and I still have to learn a lot about optimization .