Skip to content

Commit

Permalink
test: add test for parameter dependencies across model hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianM-C committed Aug 20, 2024
1 parent 150b103 commit 4a62468
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/parameter_dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,26 @@ end
@test new_prob.ps[sys2.p2] == 3.0
end

@testset "parameter dependencies across model hierarchy" begin
sys2 = let name = :sys2
@parameters p2
@variables x(t) = 1.0
eqs = [D(x) ~ p2]
ODESystem(eqs, t, [x], [p2]; name)
end

@parameters p1 = 1.0
parameter_dependencies = [sys2.p2 ~ p1 * 2.0]
sys1 = ODESystem(
Equation[], t, [], [p1]; parameter_dependencies, name = :sys1, systems = [sys2])

sys = structural_simplify(sys1)

prob = ODEProblem(sys, [], (0.0, 1.0))
sol = solve(prob)
@test SciMLBase.successful_retcode(sol)
end

@testset "Clock system" begin
dt = 0.1
@variables x(t) y(t) u(t) yd(t) ud(t) r(t) z(t)
Expand Down

0 comments on commit 4a62468

Please sign in to comment.