Skip to content
Joris Gillis edited this page Sep 16, 2022 · 1 revision

Standard documentation for simulator:

simulator(str name, str solver, dict:SX dae, [float] grid, dict opts) -> Function simulator(str name, str solver, dict:MX dae, [float] grid, dict opts) -> Function simulator(str name, str solver, Function dae, [float] grid, dict opts) -> Function

.......

::

simulator(str name, str solver, dict:SX dae, [float] grid, dict opts)

Create an ODE/DAE simulator Solves an initial value problem (IVP) with the differential equation given as an implicit ODE coupled to an algebraic equation and a set of output equations:

::

Time grid: [t0, t1, ..., tN]

Initial conditions for forward integration x(t0) = x0

Sequential forward integration from t=tk to t=t{k+1} der(x) = fx(t, x, z, p, uk) ODE 0 = fz(t, x, z, p, uk) Algebraic equations yk = fy(t, x, z, p, uk) Output equations

where we assume that the problem is index-1 (i.e. dfz/dz, is invertible) and furthermore that

General information

List of available options

+------------------+-----------------+------------------+------------------+ | Id | Type | Description | Used in | +==================+=================+==================+==================+ | common_options | OT_DICT | Options for | casadi::OracleFu | | | | auto-generated | nction | | | | functions | | +------------------+-----------------+------------------+------------------+ | expand | OT_BOOL | Replace MX with | casadi::OracleFu | | | | SX expressions | nction | | | | in problem | | | | | formulation | | | | | [false] | | +------------------+-----------------+------------------+------------------+ | monitor | OT_STRINGVECTOR | Set of user | casadi::OracleFu | | | | problem | nction | | | | functions to be | | | | | monitored | | +------------------+-----------------+------------------+------------------+ | nfwd | OT_INT | Number of | casadi::Simulato | | | | forward | r | | | | sensitivities | | +------------------+-----------------+------------------+------------------+ | nondiff | OT_BOOL | Output nondiffer | casadi::Simulato | | | | entiated | r | +------------------+-----------------+------------------+------------------+ | print_stats | OT_BOOL | Print out | casadi::Simulato | | | | statistics after | r | | | | integration | | +------------------+-----------------+------------------+------------------+ | show_eval_warnin | OT_BOOL | Show warnings | casadi::OracleFu | | gs | | generated from | nction | | | | function | | | | | evaluations | | | | | [true] | | +------------------+-----------------+------------------+------------------+ | specific_options | OT_DICT | Options for | casadi::OracleFu | | | | specific auto- | nction | | | | generated | | | | | functions, | | | | | overwriting the | | | | | defaults from | | | | | common_options. | | | | | Nested | | | | | dictionary. | | +------------------+-----------------+------------------+------------------+

Input scheme: casadi::SimulatorInput (SIMULATOR_NUM_IN = 4)

+--------------+-------+---------------------------------------------------+ | Full name | Short | Description | +==============+=======+===================================================+ | SIMULATOR_X0 | x0 | Differential state at the initial time. | +--------------+-------+---------------------------------------------------+ | SIMULATOR_U | u | Controls. | +--------------+-------+---------------------------------------------------+ | SIMULATOR_Z0 | z0 | Initial guess for the algebraic variable at the | | | | initial time. | +--------------+-------+---------------------------------------------------+ | SIMULATOR_P | p | Parameters. | +--------------+-------+---------------------------------------------------+

Output scheme: casadi::SimulatorOutput (SIMULATOR_NUM_OUT = 3)

+-------------+-------+---------------------+ | Full name | Short | Description | +=============+=======+=====================+ | SIMULATOR_X | x | Differential state. | +-------------+-------+---------------------+ | SIMULATOR_Y | y | Outputs. | +-------------+-------+---------------------+ | SIMULATOR_Z | z | Algebraic variable. | +-------------+-------+---------------------+

List of plugins

  • cvodes

Note: some of the plugins in this list might not be available on your

system. Also, there might be extra plugins available to you that are not listed here. You can obtain their documentation with
Simulator.doc("myextraplugin")


cvodes

Interface to CVodes from the Sundials suite.

Extra doc: https://github.com/casadi/casadi/wiki/L_227

List of available options

+----------------------------+-----------+---------------------------------+ | Id | Type | Description | +============================+===========+=================================+ | abstol | OT_DOUBLE | Absolute tolerence for the IVP | | | | solution | +----------------------------+-----------+---------------------------------+ | disable_internal_warnings | OT_BOOL | Disable SUNDIALS internal | | | | warning messages | +----------------------------+-----------+---------------------------------+ | fsens_err_con | OT_BOOL | include the forward | | | | sensitivities in all error | | | | controls | +----------------------------+-----------+---------------------------------+ | interpolation_type | OT_STRING | Type of interpolation for the | | | | adjoint sensitivities | +----------------------------+-----------+---------------------------------+ | linear_multistep_method | OT_STRING | Simulator scheme: BDF|adams | +----------------------------+-----------+---------------------------------+ | linear_solver | OT_STRING | A custom linear solver creator | | | | function [default: qr] | +----------------------------+-----------+---------------------------------+ | linear_solver_options | OT_DICT | Options to be passed to the | | | | linear solver | +----------------------------+-----------+---------------------------------+ | max_krylov | OT_INT | Maximum Krylov subspace size | +----------------------------+-----------+---------------------------------+ | max_multistep_order | OT_INT | Maximum order for the | | | | (variable-order) multistep | | | | method | +----------------------------+-----------+---------------------------------+ | max_num_steps | OT_INT | Maximum number of simulator | | | | steps | +----------------------------+-----------+---------------------------------+ | max_order | OT_DOUBLE | Maximum order | +----------------------------+-----------+---------------------------------+ | max_step_size | OT_DOUBLE | Max step size [default: 0/inf] | +----------------------------+-----------+---------------------------------+ | min_step_size | OT_DOUBLE | Min step size [default: 0/0.0] | +----------------------------+-----------+---------------------------------+ | newton_scheme | OT_STRING | Linear solver scheme in the | | | | Newton method: | | | | DIRECT|gmres|bcgstab|tfqmr | +----------------------------+-----------+---------------------------------+ | nonlin_conv_coeff | OT_DOUBLE | Coefficient in the nonlinear | | | | convergence test | +----------------------------+-----------+---------------------------------+ | nonlinear_solver_iteration | OT_STRING | Nonlinear solver type: | | | | NEWTON|functional | +----------------------------+-----------+---------------------------------+ | quad_err_con | OT_BOOL | Should the quadratures affect | | | | the step size control | +----------------------------+-----------+---------------------------------+ | reltol | OT_DOUBLE | Relative tolerence for the IVP | | | | solution | +----------------------------+-----------+---------------------------------+ | scale_abstol | OT_BOOL | Scale absolute tolerance by | | | | nominal value | +----------------------------+-----------+---------------------------------+ | sensitivity_method | OT_STRING | Sensitivity method: | | | | SIMULTANEOUS|staggered | +----------------------------+-----------+---------------------------------+ | step0 | OT_DOUBLE | initial step size [default: | | | | 0/estimated] | +----------------------------+-----------+---------------------------------+ | steps_per_checkpoint | OT_INT | Number of steps between two | | | | consecutive checkpoints | +----------------------------+-----------+---------------------------------+ | stop_at_end | OT_BOOL | Stop the simulator at the end | | | | of the interval | +----------------------------+-----------+---------------------------------+ | use_preconditioner | OT_BOOL | Precondition the iterative | | | | solver [default: true] | +----------------------------+-----------+---------------------------------+

Joel Andersson

Extra doc: https://github.com/casadi/casadi/wiki/L_21m

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/simulator.hpp#L75

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/simulator.cpp#L75-L78

.............

.......

::

simulator(str name, str solver, dict:MX dae, [float] grid, dict opts) simulator(str name, str solver, Function dae, [float] grid, dict opts)

.............

Extra documentation

To edit, see writing tips.

Clone this wiki locally