Skip to content

Commit 9f9141c

Browse files
committed
Add test
1 parent 88d2c6f commit 9f9141c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/input_output_handling.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,23 @@ xp1 = f_oop(x1, u, pn, 0)
265265

266266
@test xp0 matrices.A * x0 + matrices.B * [u; 0]
267267
@test xp1 matrices.A * x1 + matrices.B * [u; 0]
268+
269+
@parameters t
270+
@variables x(t)[1:3]=0
271+
@variables u(t)[1:2]
272+
D = Differential(t)
273+
y₁, y₂, y₃ = x
274+
u1, u2 = u
275+
k₁, k₂, k₃ = 1,1,1
276+
eqs = [
277+
D(y₁) ~ -k₁*y₁ + k₃*y₂*y₃ + u1
278+
D(y₂) ~ k₁*y₁ - k₃*y₂*y₃ - k₂*y₂^2 + u2
279+
y₁ + y₂ + y₃ ~ 1
280+
]
281+
282+
@named sys = ODESystem(eqs, t)
283+
inputs = [u[1], u[2]]
284+
outputs = [y₂]
285+
sys_simp, input_idxs = structural_simplify(sys, (; inputs, outputs))
286+
@test isequal(states(sys_simp), collect(x[1:2]))
287+
@test length(input_idxs) == 2

0 commit comments

Comments
 (0)