When I am defining ocp_model.set(‘sym_p’, model.sym_p) for my model parameter and then generating S-function for my Solver and Sim_solver and then comparing the output of sim_solver with x1(1st node ) output of the acados solver. They aren’t matching at all. Whereas when I define my parameters in the model itself before generating S-function(without any input for parameter in acados or sim_solver), the output of sim_solver with x1(1st node ) output of the acados solver are the same.

Can anyone help me with troubleshooting this issue?

Do you define an input port for the Simulink S-function?
Note that the interactions with the solver in Matlab do not influence the generated code and thus not influence the solver used in Simulink.

x1 - simulated state and x1- state at node 1 ideally should match as it is same integrator being used in solver. But they are turning out to be different. x1-simulated state seems to correct(corroborated with MATLAB) where as x1(state at node 1 output from Acados solver(s-function0 isn’t matching).

Hi @FreyJo ,
Did you get the chance to look into this?
Plus I wanted to ask is there a way to just pass parameter for 1 stage instead concatenating it over the horizon(N+1). Like in matlab we define p for 1 timestep( that is ocp_model.set(‘p’,p))