File tree 4 files changed +12
-12
lines changed
structural_transformation
4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 42
42
completed_rc_model = complete (rc_model)
43
43
@test isequal (completed_rc_model. resistor. n. i, resistor. n. i)
44
44
@test ModelingToolkit. n_expanded_connection_equations (capacitor) == 2
45
- @test length (equations (structural_simplify (rc_model, allow_parameter = false ))) == 1
45
+ @test length (equations (structural_simplify (rc_model, allow_parameter = false ))) == 2
46
46
sys = structural_simplify (rc_model)
47
47
@test_throws ModelingToolkit. RepeatedStructuralSimplificationError structural_simplify (sys)
48
48
@test length (equations (sys)) == 1
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ rng = StableRNG(22525)
7
7
8
8
@testset " Correct ImplicitDiscreteFunction" begin
9
9
@variables x (t) = 1
10
- @mtkbuild sys = ImplicitDiscreteSystem ([x (k) ~ abs ( x (k) ) * x (k - 1 ) - 3 ], t)
10
+ @mtkbuild sys = ImplicitDiscreteSystem ([x (k) ~ x (k) * x (k - 1 ) - 3 ], t)
11
11
tspan = (0 , 10 )
12
12
13
13
# u[2] - u_next[1]
Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ let pss_pendulum = partial_state_selection(pendulum)
134
134
end
135
135
136
136
let sys = structural_simplify (pendulum2)
137
- @test length (equations (sys)) == 4
138
- @test length (unknowns (sys)) == 4
137
+ @test length (equations (sys)) == 5
138
+ @test length (unknowns (sys)) == 5
139
139
140
140
u0 = [
141
141
x => sqrt (2 ) / 2 ,
Original file line number Diff line number Diff line change @@ -224,20 +224,20 @@ end
224
224
xtt = default_toterm (unwrap (D (D (x))))
225
225
@test mapping[x] == (0 ~ 1 - x^ 2 - y^ 2 )
226
226
@test mapping[y] == (D (y) ~ yt)
227
- @test mapping[D (y)] == (D (yt) ~ ( 2 xtt * x + 2 xt ^ 2 + 2 yt ^ 2 ) / ( - 2 y) )
228
- @test mapping[D (x)] == (xt ~ - yt * y / x )
229
- @test mapping[D (D (x))] == (0 ~ - xtt + x * λ)
230
- @test length (mapping) == 6
227
+ @test mapping[D (y)] == (D (yt) ~ - g + y * λ )
228
+ @test mapping[D (x)] == (0 ~ - 2 xt * x - 2 yt * y )
229
+ @test mapping[D (D (x))] == (xtt ~ x * λ)
230
+ @test length (mapping) == 5
231
231
232
232
@testset " `rename_dummy_derivatives = false`" begin
233
233
mapping = map_variables_to_equations (sys; rename_dummy_derivatives = false )
234
234
235
235
@test mapping[x] == (0 ~ 1 - x^ 2 - y^ 2 )
236
236
@test mapping[y] == (D (y) ~ yt)
237
- @test mapping[yt] == (D (yt) ~ ( 2 xtt * x + 2 xt ^ 2 + 2 yt ^ 2 ) / ( - 2 y) )
238
- @test mapping[xt] == (xt ~ - yt * y / x )
239
- @test mapping[xtt] == (0 ~ - xtt + x * λ)
240
- @test length (mapping) == 6
237
+ @test mapping[yt] == (D (yt) ~ - g + y * λ )
238
+ @test mapping[xt] == (0 ~ - 2 xt * x - 2 yt * y )
239
+ @test mapping[xtt] == (xtt ~ x * λ)
240
+ @test length (mapping) == 5
241
241
end
242
242
end
243
243
@testset " DDEs" begin
You can’t perform that action at this time.
0 commit comments