File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ get_unit(x::Real) = unitless
6969get_unit (x:: DQ.AbstractQuantity ) = screen_unit (x)
7070get_unit (x:: AbstractArray ) = map (get_unit, x)
7171get_unit (x:: Num ) = get_unit (unwrap (x))
72+ get_unit (x:: Symbolics.Arr ) = get_unit (unwrap (x))
7273get_unit (op:: Differential , args) = get_unit (args[1 ]) / get_unit (op. x)
7374get_unit (op:: Difference , args) = get_unit (args[1 ]) / get_unit (op. t)
7475get_unit (op:: typeof (getindex), args) = get_unit (args[1 ])
Original file line number Diff line number Diff line change 239239 @test mm2units == MT. oneunit (mm2units)
240240 @test mmunits == mm2units
241241end
242+
243+ # test for array variable units https://github.com/SciML/ModelingToolkit.jl/issues/3009
244+ let
245+ @variables x_vec (t)[1 : 3 ] [unit = u " 1" ] x_mat (t)[1 : 3 , 1 : 3 ] [unit = u " 1" ]
246+ @test MT. get_unit (x_vec) == u " 1"
247+ @test MT. get_unit (x_mat) == u " 1"
248+ end
You can’t perform that action at this time.
0 commit comments