Closed ChrisRackauckas closed 4 months ago
Can only state variables be delayed or also arbitrary intermediate, i.e. algebraic, variables? The latter would be useful in many "engineering" models, think e.g. a transport delay applied to some property of a volumetric flow that is (algebraically) mixed out of several sources (which could be state variables or algebraic relations themselves...).
If states can be delayed then algebraic variables would be able to be through the same design.
@ChrisRackauckas are the delays for difference equations in the tests here (https://github.com/SciML/ModelingToolkit.jl/blob/master/test/discretesystem.jl#L87) and use of DelayDiffEq in other tests here (https://github.com/SciML/ModelingToolkit.jl/blob/master/test/odesystem.jl#L536) indicative of significant progress on this front?
There's at least symbolic interfaces for it now, though the codegen is lacking.
This is handled via System
Delay differential equations are going to be really really hard, but this is how we can get there. We probably just want to build it onto
ODESystem
, and just add aDDEProblem
lowering. "Just" doesn't do it justice, because there's a list of issues:Building such a
build_function
will likely want to start by swapping outx(t-5)
directly toh(p,t-5)[1]
, but we will need to make that so we "CSE" the history calculations if there's many at the same time. We can leave that optimization to a later issue.