Skip to content

Commit ec3ac52

Browse files
committed
Fix typo
1 parent b1d736d commit ec3ac52

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/systems/discrete_system/discrete_system.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ struct DiscreteSystem <: AbstractTimeDependentSystem
103103
check_parameters(ps, iv)
104104
end
105105
if checks == true || (checks & CheckUnits) > 0
106-
all_dimensionless([dvs; ps; iv; ctrls]) || check_units(discreteEqs)
106+
u = __get_unit_type(dvs, ps, iv, ctrls)
107+
check_units(u, discreteEqs)
107108
end
108109
new(tag, discreteEqs, iv, dvs, ps, tspan, var_to_name, ctrls, observed, name,
109110
systems,

src/systems/pde/pdesystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct PDESystem <: ModelingToolkit.AbstractMultivariateSystem
9999
name)
100100
if checks == true || (checks & CheckUnits) > 0
101101
u = __get_unit_type(dvs, ivs, ps)
102-
check_units(u, deqs)
102+
check_units(u, eqs)
103103
end
104104

105105
eqs = eqs isa Vector ? eqs : [eqs]

src/systems/unit_check.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ end
77

88
check_units(::Nothing, _...) = true
99

10-
__get_literal_unit(x) = getmetadata(x, VariableUnit, nothing)
10+
function __get_literal_unit(x)
11+
if x isa Pair
12+
x = x[1]
13+
end
14+
if !(x isa Union{Num, Symbolic})
15+
return nothing
16+
end
17+
v = value(x)
18+
getmetadata(v, VariableUnit, nothing)
19+
end
1120
function __get_scalar_unit_type(v)
1221
u = __get_literal_unit(v)
1322
if u isa DQ.AbstractQuantity

0 commit comments

Comments
 (0)