doc: updating MTK example to v11 in manual.#340
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #340 +/- ##
=======================================
Coverage 98.59% 98.59%
=======================================
Files 27 27
Lines 5190 5190
=======================================
Hits 5117 5117
Misses 73 73 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Try |
|
Thanks for the answer but using ERROR: AssertionError: `promote_to_concrete` can't make type Missing uniform with Float64
Stacktrace:
[1] promote_to_concrete(vs::Vector{Union{Missing, Real}}; tofloat::Bool, use_union::Bool)
@ ModelingToolkitBase ~/.julia/packages/ModelingToolkitBase/uIKoY/src/utils.jl:1091
[2] varmap_to_vars(varmap::ModelingToolkitBase.AtomicArrayDict{…}, vars::Vector{…}; tofloat::Bool, use_union::Bool, container_type::Type, buffer_eltype::Type, toterm::Function, check::Bool, allow_symbolic::Bool, is_initializeprob::Bool, substitution_limit::Int64, missing_values::ModelingToolkitBase.MissingGuessValue.var"typeof(MissingGuessValue)")
@ ModelingToolkitBase ~/.julia/packages/ModelingToolkitBase/uIKoY/src/systems/problem_utils.jl:418
[3] varmap_to_vars
@ ~/.julia/packages/ModelingToolkitBase/uIKoY/src/systems/problem_utils.jl:331 [inlined]
[4] get_p(sys::System, varmap::ReadOnlyDicts.ReadOnlyDict{…}; split::Bool, kwargs::@Kwargs{})
@ ModelingToolkitBase ~/.julia/packages/ModelingToolkitBase/uIKoY/src/systems/problem_utils.jl:2059
[5] get_p
@ ~/.julia/packages/ModelingToolkitBase/uIKoY/src/systems/problem_utils.jl:2048 [inlined]
[6] generate_f_h(model::System, inputs::Vector{Num}, outputs::Vector{Num})
@ Main ~/.julia/dev/ModelPredictiveControl/docs/src/manual/mtk.md:91
[7] top-level scope
@ ~/.julia/dev/ModelPredictiveControl/docs/src/manual/mtk.md:96
Some type information was truncated. Use `show(err)` to see complete types.If I do ReadOnlyDicts.ReadOnlyDict{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}, SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}, ModelingToolkitBase.AtomicArrayDict{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}, Dict{SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}, SymbolicUtils.BasicSymbolicImpl.var"typeof(BasicSymbolicImpl)"{SymReal}}}}(τ(t) => missing) |
|
You should pass a varmap as the second argument, bindings should not be used |
|
And how do I get the varmap of the 4 parameters ? I tried passing Nothing about this in the documentation also. |
|
a varmap is just op = Dict(p1 => val1, p2 => val2, ...) |
|
Alright thanks, but I still need to access the current value that I set at the line |
|
This is how I typically do it |
|
Not sure this is the good way of proceeding, constructing an I read the wall of text about this in the documentation here : https://docs.sciml.ai/ModelingToolkit/stable/tutorials/initialization/ Two observations:
|
Hello @baggepinnen,
I'm trying to update the MTK example to v11 but i'm stuck at the
varmat_to_varsfunction here:this code prints:
Do you know why
bindings(io_sys)does not contain the parameter values anymore ?