Skip to content

Commit 83ee81e

Browse files
Merge branch 'master' of https://github.com/ModiaSim/Modia.jl
2 parents 251e8bb + 4afd432 commit 83ee81e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/models/TestAutomaticStateSelection.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ else
1616
using Modia.Test
1717
end
1818

19+
20+
#=
1921
@model TwoConnectedInertias begin
2022
J1 = 2.0
2123
J2 = 3.0
@@ -86,4 +88,30 @@ end
8688
8789
result = simulate(ParallelCapacitors2, 1; logTranslation=true, logSimulation=true, tearing=false, removeSingularities=false, automaticStateSelection=true)
8890
plot(result, ("C1.v", "C2.v"), figure=4)
91+
92+
=#
93+
94+
95+
# Simulates with tearing = false and u2.state=false
96+
# Translation error if tearing = true and u2.state=false
97+
@model ParallelCapacitors2b begin
98+
C1 = 1e-3
99+
C2 = 2e-3
100+
u1 = Float(size=(), start=1.0)
101+
u2 = Float(size=(), state=false)
102+
i1 = Float(size=())
103+
v1 = Float(size=())
104+
v0 = Float(size=())
105+
@equations begin
106+
C1*der(u1) = i1
107+
C2*der(u2) = -i1
108+
u1 = v1 - v0
109+
u2 = v1 - v0
110+
v0 = 0
111+
end
112+
end
113+
result = simulate(ParallelCapacitors2b , 1.0; logTranslation=true, logSimulation=true, tearing=false, removeSingularities=false)
114+
plot(result, ("u1", "u2", "i1", "v1"), figure=6)
115+
116+
89117
end

0 commit comments

Comments
 (0)