-
-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Description
On
(jl_uvAQbg) pkg> st
Status `/tmp/jl_uvAQbg/Project.toml`
[961ee093] ModelingToolkit v8.14.0
The following error makes no sense to me, there is no variable in this system named inertia2₊phiˍtt
.
julia> prob = ODEProblem(sys, Pair[], (0.0, 1.0))
ERROR: ArgumentError: Term{Real, Base.ImmutableDict{DataType, Any}}[inertia2₊phiˍtt(t)] are missing from the variable map.
Stacktrace:
[1] throw_missingvars(vars::Vector{Term{Real, Base.ImmutableDict{DataType, Any}}})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/variables.jl:100
[2] _varmap_to_vars(varmap::Dict{Any, Any}, varlist::Vector{Term{Real, Base.ImmutableDict{DataType, Any}}}; defaults::Dict{Any, Any}, check::Bool, toterm::typeof(Symbolics.diff2term))
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/variables.jl:94
[3] varmap_to_vars(varmap::Vector{Pair}, varlist::Vector{Term{Real, Base.ImmutableDict{DataType, Any}}}; defaults::Dict{Any, Any}, check::Bool, toterm::Function, promotetoconcrete::Nothing, tofloat::Bool, use_union::Bool)
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/variables.jl:63
[4] process_DEProblem(constructor::Type, sys::ODESystem, u0map::Vector{Pair}, parammap::SciMLBase.NullParameters; implicit_dae::Bool, du0map::Nothing, version::Nothing, tgrad::Bool, jac::Bool, checkbounds::Bool, sparse::Bool, simplify::Bool, linenumbers::Bool, parallel::Symbolics.SerialForm, eval_expression::Bool, use_union::Bool, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol, Symbol}, NamedTuple{(:has_difference, :check_length), Tuple{Bool, Bool}}})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/diffeqs/abstractodesystem.jl:648
[5] (ODEProblem{true})(sys::ODESystem, u0map::Vector{Pair}, tspan::Tuple{Float64, Float64}, parammap::SciMLBase.NullParameters; callback::Nothing, check_length::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/diffeqs/abstractodesystem.jl:744
[6] (ODEProblem{true})(sys::ODESystem, u0map::Vector{Pair}, tspan::Tuple{Float64, Float64}, parammap::SciMLBase.NullParameters) (repeats 2 times)
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/diffeqs/abstractodesystem.jl:743
[7] ODEProblem(::ODESystem, ::Vector{Pair}, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/diffeqs/abstractodesystem.jl:720
[8] ODEProblem(::ODESystem, ::Vector{Pair}, ::Vararg{Any})
@ ModelingToolkit ~/.julia/packages/ModelingToolkit/fp90z/src/systems/diffeqs/abstractodesystem.jl:720
[9] top-level scope
@ REPL[41]:1
julia> inertia2
Model inertia2 with 5 (7) equations
States (7):
phi(t) [defaults to 0.0]
w(t) [defaults to 0.0]
a(t) [defaults to 0.0]
flange_a₊phi(t) [defaults to 0.0]
flange_a₊tau(t) [defaults to 0.0]
flange_b₊phi(t) [defaults to 0.0]
flange_b₊tau(t) [defaults to 0.0]
Parameters (1):
J [defaults to 1]
Can be reproduced by
using ModelingToolkit, OrdinaryDiffEq, Plots
using ModelingToolkitStandardLibrary.Mechanical.Rotational
using ModelingToolkitStandardLibrary.Blocks: t, Sine
using ModelingToolkit: connect
@named inertia1 = Inertia(; J = 1)
@named inertia2 = Inertia(; J = 1)
@named spring = Spring(; c = 1000)
@named damper = Damper(; d = 10)
@named torque = Torque()
@named u = Sine(frequency=30/2pi)
eqs = [
connect(torque.flange, inertia1.flange_a)
connect(inertia1.flange_b, spring.flange_a, damper.flange_a)
connect(inertia2.flange_a, spring.flange_b, damper.flange_b)
connect(torque.tau, u.output)
]
@named model = ODESystem(eqs, t; systems = [torque, inertia1, inertia2, spring, damper, u])
sys = structural_simplify(model)
prob = ODEProblem(sys, Pair[], (0.0, 1.0)) # This errors
sol = solve(prob, Rodas5())
Metadata
Metadata
Assignees
Labels
No labels