You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that while units may be given to array variables, those units cannot then be "gotten". This is leading to further issues when trying to use the variables.
Expected behavior
For a symbolic array (versus an array of variables?) return the correct unit type.
Minimal Reproducible Example 👇
using ModelingToolkit, DynamicQuantities
@variablesx(t)[1:3], [unit =u"m"]
ModelingToolkit.get_unit(x)
Error & Stacktrace ⚠️
julia> ModelingToolkit.get_unit(x)
ERROR: There was an error processing arrayop expression 1.0 m.
Dimension of output index i in (i,) could not be inferred
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] (::Symbolics.var"#99#102"{Tuple{…}, Quantity{…}, Dict{…}, Dict{…}})(i::SymbolicUtils.BasicSymbolic{Int64})
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/arrays.jl:222
[3] map
@ ./tuple.jl:291 [inlined]
[4] make_shape(output_idx::Tuple{…}, expr::Quantity{…}, ranges::Dict{…})
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/arrays.jl:216
[5] Symbolics.ArrayOp(T::Type, output_idx::Tuple{…}, expr::Quantity{…}, reduce::Function, term::SymbolicUtils.BasicSymbolic{…}, ranges::Dict{…}; metadata::Nothing)
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/arrays.jl:53
[6] ArrayOp
@ ~/.julia/packages/Symbolics/qoXk1/src/arrays.jl:52 [inlined]
[7] Symbolics.ArrayOp(T::Type, output_idx::Tuple{…}, expr::Quantity{…}, reduce::Function, term::SymbolicUtils.BasicSymbolic{…})
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/arrays.jl:52
[8] _map(::Function, ::SymbolicUtils.BasicSymbolic{Vector{Real}})
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/array-lib.jl:340
[9] macro expansion
@ ~/.julia/packages/Symbolics/qoXk1/src/array-lib.jl:326 [inlined]
[10] var"Base.map_4228762831532280247"(nothing::Nothing, f::Function, x::SymbolicUtils.BasicSymbolic{Vector{Real}})
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/wrapper-types.jl:143
[11] map(f::Function, x::Symbolics.Arr{Num, 1})
@ Symbolics ~/.julia/packages/Symbolics/qoXk1/src/wrapper-types.jl:152
[12] get_unit(x::Symbolics.Arr{Num, 1})
@ ModelingToolkit ~/workspace/ModelingToolkit.jl/src/systems/unit_check.jl:70
[13] top-level scope
@ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
Describe the bug 🐞
It appears that while units may be given to array variables, those units cannot then be "gotten". This is leading to further issues when trying to use the variables.
Expected behavior
For a symbolic array (versus an array of variables?) return the correct unit type.
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: