Is it possible to simulate an MTK model allocation-free?
The task is to run a simulation in a control loop with 1ms update interval in real-time.
Is it possible to simulate an MTK model allocation-free?
The task is to run a simulation in a control loop with 1ms update interval in real-time.
Under certain circumstances (ODE of not too large state dimension) it is possible.
You can use ModelingToolkit.generate_control_function
to generate the dynamics function with inputs, and then SeeToDee.Rk4
which is an allocation-free RK4 integrator when used with StaticArrays to discretize this dynamics and step it forward with your desired sample interval.