Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I run the copy&paste examples, such as https://mtk.sciml.ai/stable/tutorials/acausal_components/ :
using ModelingToolkit, Plots, DifferentialEquations @variables t @connector function Pin(;name) sts = @variables v(t)=1.0 i(t)=1.0 [connect = Flow] ODESystem(Equation[], t, sts, []; name=name) end function Ground(;name) @named g = Pin() eqs = [g.v ~ 0] compose(ODESystem(eqs, t, [], []; name=name), g) end function OnePort(;name) @named p = Pin() @named n = Pin() sts = @variables v(t)=1.0 i(t)=1.0 eqs = [ v ~ p.v - n.v 0 ~ p.i + n.i i ~ p.i ] compose(ODESystem(eqs, t, sts, []; name=name), p, n) end function Resistor(;name, R = 1.0) @named oneport = OnePort() @unpack v, i = oneport ps = @parameters R=R eqs = [ v ~ i * R ] extend(ODESystem(eqs, t, [], ps; name=name), oneport) end function Capacitor(;name, C = 1.0) @named oneport = OnePort() @unpack v, i = oneport ps = @parameters C=C D = Differential(t) eqs = [ D(v) ~ i / C ] extend(ODESystem(eqs, t, [], ps; name=name), oneport) end function ConstantVoltage(;name, V = 1.0) @named oneport = OnePort() @unpack v = oneport ps = @parameters V=V eqs = [ V ~ v ] extend(ODESystem(eqs, t, [], ps; name=name), oneport) end R = 1.0 C = 1.0 V = 1.0 @named resistor = Resistor(R=R) @named capacitor = Capacitor(C=C) @named source = ConstantVoltage(V=V) @named ground = Ground() rc_eqs = [ connect(source.p, resistor.p) connect(resistor.n, capacitor.p) connect(capacitor.n, source.n) connect(capacitor.n, ground.g) ] @named _rc_model = ODESystem(rc_eqs, t) @named rc_model = compose(_rc_model, [resistor, capacitor, source, ground]) sys = structural_simplify(rc_model) u0 = [ capacitor.v => 0.0 ] prob = ODAEProblem(sys, u0, (0, 10.0)) sol = solve(prob, Tsit5()) plot(sol)
the tutorial on the website shows that the plot has a meaningful label:
While if I run locally, the plot label is a generic integer:
If I explicitly call plot(sol, vars=[capacitor.v]) the label of the plot is correct:
plot(sol, vars=[capacitor.v])
I am not sure if the problem is strictly related to ModelingToolkit.jl, but I did not know where to open the issue otherwise.
ModelingToolkit.jl
Status of installed packages:
Status `~/.julia/environments/v1.7/Project.toml` [0c46a032] DifferentialEquations v7.1.0 [961ee093] ModelingToolkit v8.3.2 [91a5bcdd] Plots v1.25.6 [0c5d862f] Symbolics v4.3.0
The text was updated successfully, but these errors were encountered:
It's probably the default handling in SciMLBase that needs an update.
https://github.com/SciML/SciMLBase.jl/blob/v1.26.0/src/solutions/solution_interface.jl#L158
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
If I run the copy&paste examples, such as https://mtk.sciml.ai/stable/tutorials/acausal_components/ :
the tutorial on the website shows that the plot has a meaningful label:

While if I run locally, the plot label is a generic integer:

If I explicitly call

plot(sol, vars=[capacitor.v])
the label of the plot is correct:I am not sure if the problem is strictly related to
ModelingToolkit.jl
, but I did not know where to open the issue otherwise.Status of installed packages:
The text was updated successfully, but these errors were encountered: