Open
Description
@AayushSabharwal this is the one we discussed:
Describe the bug 🐞
When an observable is updated in a symbolic callback as in the example below (y depends on g, g gets changed in the callback), you can't symbolically index with y in the problem or solution. (this one uses the new callback handling)
eqs = [y ~ g^2 - x, D(x) ~ x]
c_evt = SymbolicContinuousCallback([t ~ 5.0], [x ~ Pre(x) + 1, g ~ Pre(g) + 1], discrete_parameters = [g], iv = t)
@mtkbuild sys = ODESystem(eqs, t, continuous_events = c_evt)
prob = ODEProblem(sys, [x => 1.0], (0., 10.), [g => 2])
prob[y] # Throws ERROR: UndefVarError: `x` not defined in `ModelingToolkit`
This has to do with the timeseries attached to y - since y depends on g the timeseries is [1], but in order to symbolically index the solution it needs to have a ContinuousTimeseries. Right now it can only use one or the other. So this requries SII to change to use interpolation for observeds depending on both unknowns and parameters.