I am trying to use ModelingToolkit (MTK). In the first example in the documentation,
using ModelingToolkit, Plots, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D
@mtkmodel FOL begin
@parameters begin
τ = 3.0 # parameters
end
@variables begin
x(t) = 0.0 # dependent variables
end
@equations begin
D(x) ~ (1 - x) / τ
end
end
@mtkcompile fol = FOL()
This example doesn’t run with the latest version of MTK: I get an error message that @mtkmodel is not defined in Main.
OK – based on previous discussion, I know that MTK is in a transition to a new way to describe components – but my understanding was that the “old way” would still work, but with a warning. The new style works, though:
@component function FOL(;name)
params = @parameters begin
τ = 3.0 # parameters
end
vars = @variables begin
x(t) = 0.0 # dependent variables
end
eqs = [
D(x) ~ (1 - x) / τ
]
System(eqs, t, vars, params; name)
end
@mtkcompile fol = FOL()
Question: Where is the “new style” documented?? Although I know the basics of the new style, it is not easy to guess how to make acausal models. E.g., @components doesn’t exist any more, the error message tells me.