Description
I'm really not sure what's going on here, but the variable type of Initial(p)
seems to be silently changed to variable instead of parameter when substituting h = 1. This doesn't happen when any number other than 1 is substituted, or for normal parameters.
@constants h = 1
@variables x
eq = x ~ h * Initial(x)
dvs = Set(); ps = Set()
ModelingToolkit.collect_vars!(dvs, ps, eq, nothing; op = Initial) # dvs = Set(x), ps = Set(Initial(x))
empty!(dvs); empty!(ps)
eq = Symbolics.substitute(eq, h => 1) # eq = x ~ Initial(x)
ModelingToolkit.collect_vars!(dvs, ps, eq, nothing; op = Initial) # dvs = Set(x, Initial(x)), ps = Set()
ModelingToolkit.isparameter(eq.rhs) # false
on 9.65.0