|
687 | 687 | end
|
688 | 688 |
|
689 | 689 |
|
690 |
| -### Algebraic Equations ### |
| 690 | +### Hybrid CRN/Equations Models ### |
691 | 691 |
|
692 | 692 | # Checks creation of basic network.
|
693 | 693 | # Check indexing of output solution.
|
|
731 | 731 | ps = Dict([p => 1 + rand(rng), d => 1 + rand(rng), k => 1 + rand(rng)])
|
732 | 732 | oprob = ODEProblem(rn, u0, (0.0, 10000.0), ps; structural_simplify=true)
|
733 | 733 | sol = solve(oprob, Tsit5(); abstol=1e-9, reltol=1e-9)
|
734 |
| - @test sol[S][end] ≈ ps[p]/ps[d] |
735 |
| - @test sol[X] .+ 5 ≈ sol[k] .*sol[S] |
736 |
| - @test 3*sol[Y] .+ sol[X] ≈ sol[S] .+ sol[X].*sol[d] |
| 734 | + @test sol[S][end] ≈ sol.ps[p]/sol.ps[d] |
| 735 | + @test sol[X] .+ 5 ≈ sol.ps[k] .*sol[S] |
| 736 | + @test 3*sol[Y] .+ sol[X] ≈ sol[S] .+ sol[X].*sol.ps[d] |
737 | 737 | end
|
738 | 738 |
|
739 | 739 | # Checks that block form is not required when only a single equation is used.
|
|
816 | 816 | end
|
817 | 817 | (p,d), 0 <--> S
|
818 | 818 | end
|
| 819 | + @unpack X, Y, S, p, d, k = rn |
819 | 820 |
|
820 | 821 | # Checks that the internal structures have the correct lengths.
|
821 | 822 | @test length(species(rn)) == 1
|
|
841 | 842 | ps = Dict([p => 1 + rand(rng), d => 1 + rand(rng), k => 1 + rand(rng)])
|
842 | 843 | oprob = ODEProblem(rn, u0, (0.0, 10000.0), ps; structural_simplify=true)
|
843 | 844 | sol = solve(oprob, Tsit5(); abstol=1e-9, reltol=1e-9)
|
844 |
| - @test sol[:S][end] ≈ sol[:p]/sol[:d] |
845 |
| - @test sol[:X] .+ 5 ≈ sol[:k] .*sol[:S] |
| 845 | + @test sol[:S][end] ≈ sol.ps[:p]/sol.ps[:d] |
| 846 | + @test sol[:X] .+ 5 ≈ sol.ps[:k] .*sol[:S] |
846 | 847 | @test 5*sol[:Y][end] ≈ sol[:S][end] + sol[:X][end]
|
847 | 848 | end
|
848 | 849 |
|
|
0 commit comments