Configuration of the numerical simulation method


I have 3 questions regarding the solver parameters (in Matlab interface) for the numerical simulation method:

  1. What is the meaning of “opts_struct.sim_method_num_steps”? Obviously, it does not refer to the number of stages (“intermediate points”) since there is another parameter for that. Aren’t all Runge Kutta methods one-step procedures?

  2. The parameter “opts_struct.sim_method_newton_iter” is only required for implicit methods. Is this correct?

  3. What do I have to do in order to use discrete-time dynamics equations? I’ve tried the following, but this results in a crash of Matlab during code generation:

ocp_model.set(‘dyn_type’, ‘discrete’);
ocp_model.set(‘dyn_expr_phi’, model.expr_phi); % CASADI expression

ocp_opts.set(‘sim_method’, ‘’); % not sure about that, I’ve found no example, maybe this is the problem?

The error on the terminal after Matlab crashing is:

error: field num_stages not available in ocp_nlp_dynamics_disc_opts_set

The error occurs even if I set ‘sim_method_num_stages’ to some value.


Hi Martin,

let me try to answer one after another.

  1. This option divides the time horizon for the integrator uniformly into sim_method_num_steps many intervals, the Runge-Kutta method is applied to each of these subintervals.

  2. yes, only relevant for implicit methods.

  3. Discrete time dynamics replace the integrator, so the options above are not used.
    Indeed the option to use discrete time dynamics was broken, thanks for reporting.
    I fixed it and modified a test such that it is tested on travis.
    Just merged it into acados/master,


Hi Jonathan,

many thanks for the quick help :+1: !