|
390 | 390 | # Compares programmatic and DSL system with observables.
|
391 | 391 | let
|
392 | 392 | # Model declarations.
|
393 |
| - rn_dsl = @reaction_network rn_observed begin |
| 393 | + rn_dsl = @reaction_network begin |
394 | 394 | @observables begin
|
395 | 395 | X ~ x + 2x2y
|
396 | 396 | Y ~ y + x2y
|
|
411 | 411 | r6 = Reaction(d, [y], nothing, [1], nothing)
|
412 | 412 | r7 = Reaction(d, [x2y], nothing, [1], nothing)
|
413 | 413 | obs_eqs = [X ~ x + 2x2y, Y ~ y + x2y]
|
414 |
| - rn_prog = ReactionSystem([r1, r2, r3, r4, r5, r6, r7], t, [x, y, x2y], [k, kB, kD, d]; observed = obs_eqs, name=:rn_observed) |
| 414 | + rn_prog = ReactionSystem([r1, r2, r3, r4, r5, r6, r7], t, [x, y, x2y], [k, kB, kD, d]; observed = obs_eqs) |
415 | 415 |
|
416 | 416 | # Make simulations.
|
417 | 417 | u0 = [x => 1.0, y => 0.5, x2y => 0.0]
|
|
453 | 453 | @test sol[:X][1] == u0[:X1]^2 + ps[:op_1]*(u0[:X2] + 2*u0[:X3]) + u0[:X1]*u0[:X4]/ps[:op_2] + ps[:p]
|
454 | 454 | end
|
455 | 455 |
|
| 456 | +# Checks that ivs are correctly found |
| 457 | +let |
| 458 | + rn = @reaction_network begin |
| 459 | + @ivs t x y |
| 460 | + @species V1(t) V2(t,x) V3(t, y) W1(t) W2(t, y) |
| 461 | + @observables begin |
| 462 | + V ~ V1 + 2V2 + 3V3 |
| 463 | + W ~ W1 + W2 |
| 464 | + end |
| 465 | + end |
| 466 | + V,W = getfield.(observed(rn), :lhs) |
| 467 | + @test isequal(arguments(ModelingToolkit.unwrap(V)), [rn.iv, rn.sivs[1], rn.sivs[2]]) |
| 468 | + @test isequal(arguments(ModelingToolkit.unwrap(W)), [rn.iv, rn.sivs[2]]) |
| 469 | +end |
| 470 | + |
456 | 471 | # Declares observables implicitly/explicitly.
|
457 | 472 | let
|
458 | 473 | # Basic case.
|
|
0 commit comments