Open
Description
It would be nice to have some way of constructing discrete-time systems using a model macro. @mtkmodel
currently only creates ODESystem
s.
It could be either a new macro, or a kwarg to the existing one.
Example (not working)
using ModelingToolkit
t = ModelingToolkit.t_nounits
k = ShiftIndex(t)
@mtkmodel Float2Bool begin
@variables begin
u(t)::Float64
y(t)::Bool
end
@equations begin
y ~ u != 0
end
end
@mtkmodel Model begin
@variables begin
x(t) = 0
end
@components begin
conversion = Float2Bool()
end
@equations begin
x(k) ~ 0.99x(k-1)
conversion.u ~ x
end
end
@named model = Model()
prob = DiscreteProblem(sys, [], (0,10))