Is there a way to use Differential Equations to solve a system in “real time”? I want to solve a dynamic system that will receive data from the Raspberry Pi to update the simulation. Thus, this system must be solved in “real time”, like, one step every 1ms. How is the best way to do this?
I don’t recall the solution though. I’d probably do it by making a timer that you then enclose into a discrete callback, and use sleep to slow down the solve so the callback finishes at around time t=n (by taking a new time and subtracting it from the start time of course). You’d then want to use a counter so that it doesn’t drift.
That was upstreamed to become the PeriodicCallback in the callback library BTW, and indeed that could be useful here (though if you’re using a fixed time step method and calling after each step, a DiscreteCallback with a condition(u,t,integrator) = true is all you need)