Open
Description
julia> sol[sys.conversion.y]
ERROR: ArgumentError: Symbol conversion₊y(t) is not present in the system.
MWE:
using ModelingToolkit
using OrdinaryDiffEq
t = ModelingToolkit.t_nounits
k = ShiftIndex(t)
function Float2Bool2(; name)
@variables begin
u(t)::Float64
y(t)::Bool
end
equations = [
y ~ u != 0
]
DiscreteSystem(equations, t; name)
end
function Model2(; name)
@variables begin
x(t) = 1
end
systems = @named begin
conversion = Float2Bool2()
end
equations = [
x(k) ~ 0.99x(k-1)
conversion.u ~ x
]
DiscreteSystem(equations, t; name, systems)
end
@mtkbuild sys = Model2()
prob = DiscreteProblem(sys, [], (0,10))
sol = solve(prob, FunctionMap())
sol[sys.conversion.y]