Different Solver Status in MATLAB vs Simulink (Acados S-Function)

Hello,

I’m new to Acados and need a bit of help. I’m using an S-Function in Simulink. During simulation, I get a solver status of 1, and I’ve checked the entire system—there are no NaN values anywhere.
To make debugging easier, I started running the solver in MATLAB using the same parameters and constraints. However, in MATLAB, I get a solver status of 2.
I don’t understand why the solver status is different in MATLAB and Simulink with the same setup. What could be the reasons for this? Why might the solver work in MATLAB but not in Simulink?
I would really appreciate any help you can provide.

Thanks in advance! :folded_hands:

Hi :waving_hand:

differences between the behaviour in MATLAB and Simulink are typically due to different initializations. Please check how the iterates are initialized in Matlab and Simulink.

As a next step, you could compile acados with the flag ACADOS_DEBUG_SQP_PRINT_QPS_TO_FILE. With this flag, the QPs as well as the iterates are saved to file and you can compare when and where the differences between Simulink and Matlab occur.

Hope this is helpful!
Katrin

1 Like