@baggepinnen Sorry to come back to this, but I’ve updated my ModelingToolkit
to use v9(.20) and unfortunately I get weird errors.
(; A, B, C, D), simplified_sys = linearize(ode, [<inputs>], [<outputs>]; t=Inf, op=op)
where op
is a Dict{Num, Float64}
I get
julia> (; A, B, C, D), simplified_sys = linearize(ode, [fext], [θ]; t=10, op=op)
ERROR: BoundsError: attempt to access 13-element Vector{Vector{Int64}} at index [14]
Stacktrace:
[1] getindex
@ Base .\essentials.jl:13 [inlined]
[2] đť‘‘neighbors
@ ModelingToolkit.BipartiteGraphs <user>\.julia\packages\ModelingToolkit\WiCz5\src\bipartite_graph.jl:369 [inlined]
[3] đť‘‘neighbors
@ ModelingToolkit.BipartiteGraphs <user>\.julia\packages\ModelingToolkit\WiCz5\src\bipartite_graph.jl:368 [inlined]
[4] check_consistency(state::TearingState{ODESystem}, orig_inputs::Set{Any})
@ ModelingToolkit.StructuralTransformations <user>\.julia\packages\ModelingToolkit\WiCz5\src\structural_transformation\utils.jl:96
[5] _structural_simplify!(state::TearingState{…}, io::Tuple{…}; simplify::Bool, check_consistency::Bool, fully_determined::Bool, warn_initialize_determined::Bool, dummy_derivative::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\systemstructure.jl:691
[6] structural_simplify!(state::TearingState{…}, io::Tuple{…}; simplify::Bool, check_consistency::Bool, fully_determined::Bool, warn_initialize_determined::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\systemstructure.jl:634
[7] __structural_simplify(sys::ODESystem, io::Tuple{Vector{Num}, Vector{Num}}; simplify::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\systems.jl:83
[8] structural_simplify(sys::ODESystem, io::Tuple{Vector{Num}, Vector{Num}}; simplify::Bool, split::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\systems.jl:24
[9] structural_simplify
@ <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\systems.jl:21 [inlined]
[10] io_preprocessing(sys::ODESystem, inputs::Vector{Num}, outputs::Vector{Num}; simplify::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:1823
[11] linearization_function(sys::ODESystem, inputs::Vector{…}, outputs::Vector{…}; simplify::Bool, initialize::Bool, op::Dict{…}, p::SciMLBase.NullParameters, zero_dummy_der::Bool, initialization_solver_alg::GeneralizedFirstOrderAlgorithm{…}, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:1877
[12] linearization_function
@ <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:1867 [inlined]
[13] linearize(sys::ODESystem, inputs::Vector{…}, outputs::Vector{…}; op::Dict{…}, t::Int64, allow_input_derivatives::Bool, zero_dummy_der::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:2325
[14] top-level scope
If I do the same, but without inputs or outputs specified, I get another error :
julia> (; A, B, C, D), simplified_sys = linearize(ode, [], []; t=10, op=op)
ERROR: MethodError: no method matching parameter_values(::ModelingToolkit.MTKParameters{…})
Closest candidates are:
parameter_values(::ModelingToolkit.MTKParameters, ::ModelingToolkit.ParameterIndex)
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\parameter_buffer.jl:318
parameter_values(::Any, ::Any)
@ SymbolicIndexingInterface <user>\.julia\packages\SymbolicIndexingInterface\A1VUA\src\parameter_indexing.jl:5
parameter_values(::SymbolicIndexingInterface.ProblemState)
@ SymbolicIndexingInterface <user>\.julia\packages\SymbolicIndexingInterface\A1VUA\src\problem_state.jl:20
...
Stacktrace:
[1] set_parameter!(sys::ModelingToolkit.MTKParameters{…}, val::Float64, idx::Nothing)
@ SymbolicIndexingInterface <user>\.julia\packages\SymbolicIndexingInterface\A1VUA\src\parameter_indexing.jl:17
[2] (::SymbolicIndexingInterface.SetParameterIndex{…})(prob::ModelingToolkit.MTKParameters{…}, val::Float64)
@ SymbolicIndexingInterface <user>\.julia\packages\SymbolicIndexingInterface\A1VUA\src\parameter_indexing.jl:190
[3] (::SymbolicIndexingInterface.ParameterHookWrapper{…})(prob::ModelingToolkit.MTKParameters{…}, args::Float64)
@ SymbolicIndexingInterface <user>\.julia\packages\SymbolicIndexingInterface\A1VUA\src\parameter_indexing.jl:158
[4] (::ModelingToolkit.var"#311#326"{…})(u::Vector{…}, p::Dict{…}, t::Int64)
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:1988
[5] linearize(sys::ODESystem, lin_fun::ModelingToolkit.var"#311#326"{…}; t::Int64, op::Dict{…}, allow_input_derivatives::Bool, p::SciMLBase.NullParameters)
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:2280
[6] linearize(sys::ODESystem, inputs::Vector{…}, outputs::Vector{…}; op::Dict{…}, t::Int64, allow_input_derivatives::Bool, zero_dummy_der::Bool, kwargs::@Kwargs{})
@ ModelingToolkit <user>\.julia\packages\ModelingToolkit\WiCz5\src\systems\abstractsystem.jl:2331
[7] top-level scope
Would you have any clues as to what happens here ?