Skip to content

Commit a61f4bf

Browse files
committed
test broken dae problem with units
1 parent ba86ee6 commit a61f4bf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/dq_units.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,27 @@ end
185185

186186
@named sys = ArrayParamTest(a = [1.0, 3.0]u"cm")
187187
@test ModelingToolkit.getdefault(sys.a) [0.01, 0.03]
188+
189+
@testset "Initialization checks" begin
190+
@mtkmodel PendulumUnits begin
191+
@parameters begin
192+
g, [unit = u"m/s^2"]
193+
L, [unit = u"m"]
194+
end
195+
@variables begin
196+
x(t), [unit = u"m"]
197+
y(t), [state_priority = 10, unit = u"m"]
198+
λ(t), [unit = u"s^-2"]
199+
end
200+
@equations begin
201+
D(D(x)) ~ λ * x
202+
D(D(y)) ~ λ * y - g
203+
x^2 + y^2 ~ L^2
204+
end
205+
end
206+
@mtkbuild pend = PendulumUnits()
207+
u0 = [pend.x => 1.0, pend.y => 0.0]
208+
p = [pend.g => 1.0, pend.L => 1.0]
209+
guess = [pend.λ => 0.0]
210+
@test_broken prob = ODEProblem(pend, u0, (0.0, 1.0), p; guesses = guess)
211+
end

0 commit comments

Comments
 (0)