Hi!
I have some experience with CasADi for NMPC and I hope I can help.
First of all, single shooting is not recommended for optimal control since it does not have a good numerical stability. For instance, the last state of the horizon will depend on all past inputs which is highly nonlinear. Try multiple shooting instead.
Another important aspect is warm starting. Every sampling time, use the result from the last Ts as an initial solution of the solver.
How to evaluate the model is also important. When defining the 'integrator', try the 'expand' option to transform the MX function to SX. It is also possible to use this option in the nlpsol.
Currently, it is not possible to generate code for IPOPT. One option is to use the 'jit' (just-in-time) option which generates and compiles C code to evaluate the objective, constraints and their derivatives.
I believe that the CasADi team is designing an NLP solver which allows code generation. I don't know if it is ready yet but I would keep an eye on that. Also,
ACADOS is a project which will implement fast NMPC algorithms using CasADi but it is not ready yet.
Kind Regards,
Bruno