@@ -3,8 +3,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
3
3
using ModelingToolkit, Symbolics
4
4
using Nemo
5
5
6
+ @independent_variables t
6
7
@parameters a01 a21 a12
7
- @variables t x0 x1
8
+ @variables x0 x1
8
9
9
10
ring, (a, b, c, x, y) = QQ[" a" , " b" , " c" , " x" , " y" ]
10
11
@@ -20,8 +21,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
20
21
using ModelingToolkit: parameters
21
22
using Symbolics
22
23
24
+ @independent_variables t
23
25
@parameters a01 a21 a12
24
- @variables t x0 (t) x1 (t) y1 (t) [output = true ]
26
+ @variables x0 (t) x1 (t) y1 (t) [output = true ]
25
27
D = Differential (t)
26
28
27
29
eqs = [D (x0) ~ - (a01 + a21) * x0 + a12 * x1, D (x1) ~ a21 * x0 - a12 * x1, y1 ~ x0]
@@ -50,8 +52,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
50
52
# --------------------------------------------------------------------------
51
53
52
54
# check identifiabile functions
55
+ @independent_variables t
53
56
@parameters V_m k_m k01 c
54
- @variables t x (t) y1 (t) [output = true ]
57
+ @variables x (t) y1 (t) [output = true ]
55
58
D = Differential (t)
56
59
57
60
eqs = [D (x) ~ (- V_m * x) / (k_m + x) + k01 * x, y1 ~ c * x]
@@ -66,8 +69,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
66
69
@test isequal (Set (correct), Set (result))
67
70
68
71
# --------------------------------------------------------------------------
72
+ @independent_variables t
69
73
@parameters a01 a21 a12
70
- @variables t x0 (t) x1 (t) y1 (t) [output = true ]
74
+ @variables x0 (t) x1 (t) y1 (t) [output = true ]
71
75
D = Differential (t)
72
76
73
77
eqs = [D (x0) ~ - (a01 + a21) * x0 + a12 * x1, D (x1) ~ a21 * x0 - a12 * x1, y1 ~ x0]
@@ -85,8 +89,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
85
89
86
90
# --------------------------------------------------------------------------
87
91
92
+ @independent_variables t
88
93
@parameters a01 a21 a12
89
- @variables t x0 (t) x1 (t) y1 (t) [output = true ]
94
+ @variables x0 (t) x1 (t) y1 (t) [output = true ]
90
95
D = Differential (t)
91
96
92
97
eqs = [D (x0) ~ - (a01 + a21) * x0 + a12 * x1, D (x1) ~ a21 * x0 - a12 * x1, y1 ~ x0]
@@ -103,8 +108,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
103
108
104
109
# --------------------------------------------------------------------------
105
110
111
+ @independent_variables t
106
112
@parameters a01 a21 a12
107
- @variables t x0 (t) x1 (t) y1 (t)
113
+ @variables x0 (t) x1 (t) y1 (t)
108
114
D = Differential (t)
109
115
110
116
eqs = [D (x0) ~ - (a01 + a21) * x0 + a12 * x1, D (x1) ~ a21 * x0 - a12 * x1]
@@ -128,8 +134,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
128
134
)
129
135
130
136
# --------------------------------------------------------------------------
137
+ @independent_variables t
131
138
@parameters μ bi bw a χ γ k
132
- @variables t S (t) I (t) W (t) R (t) y (t)
139
+ @variables S (t) I (t) W (t) R (t) y (t)
133
140
134
141
eqs = [
135
142
D (S) ~ μ - bi * S * I - bw * S * W - μ * S + a * R,
@@ -184,8 +191,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
184
191
@test isequal (Set (correct), Set (result))
185
192
186
193
# --------------------------------------------------------------------------
194
+ @independent_variables t
187
195
@parameters mu bi bw a xi gm k
188
- @variables t S (t) I (t) W (t) R (t) y (t) [output = true ]
196
+ @variables S (t) I (t) W (t) R (t) y (t) [output = true ]
189
197
190
198
eqs = [
191
199
D (S) ~ mu - bi * S * I - bw * S * W - mu * S + a * R,
@@ -227,8 +235,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
227
235
)
228
236
229
237
# --------------------------------------------------------------------------
238
+ @independent_variables t
230
239
@parameters mu bi bw a xi gm k
231
- @variables t S (t) I (t) W (t) R (t) y (t)
240
+ @variables S (t) I (t) W (t) R (t) y (t)
232
241
233
242
eqs = [
234
243
D (S) ~ 2.0 * mu - bi * S * I - bw * S * W - mu * S + a * R,
@@ -265,8 +274,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
265
274
266
275
# ----------
267
276
277
+ @independent_variables t
268
278
@parameters a01 a21 a12
269
- @variables t x0 (t) x1 (t) y1 (t)
279
+ @variables x0 (t) x1 (t) y1 (t)
270
280
D = Differential (t)
271
281
using SpecialFunctions
272
282
@@ -291,8 +301,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
291
301
funcs_to_check = funcs_to_check,
292
302
)
293
303
# ----------
304
+ @independent_variables t
294
305
@parameters a b c
295
- @variables t x1 (t) x2 (t) y (t)
306
+ @variables x1 (t) x2 (t) y (t)
296
307
D = Differential (t)
297
308
298
309
eqs = [D (x1) ~ - a * x1 + x2 * b / (x1 + b / (c^ 2 - x2)), D (x2) ~ x2 * c^ 2 + x1]
@@ -315,8 +326,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
315
326
@test isequal (Set (result), Set (correct))
316
327
317
328
# ----------
329
+ @independent_variables t
318
330
@parameters a b
319
- @variables t c (t) x1 (t) x2 (t) y1 (t) y2 (t)
331
+ @variables c (t) x1 (t) x2 (t) y1 (t) y2 (t)
320
332
D = Differential (t)
321
333
322
334
eqs = [
@@ -339,7 +351,7 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
339
351
340
352
# ----------------------------------
341
353
# Composable models test (from https://github.com/SciML/StructuralIdentifiability.jl/issues/162)
342
- @variables t
354
+ @independent_variables t
343
355
function rabbits_creator (; name)
344
356
ps = @parameters α = 1.5
345
357
vars = @variables x (t) = 1.0 z (t) = 0.0 [input = true ]
@@ -403,7 +415,8 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
403
415
404
416
# ----------------------------------
405
417
406
- @variables t, x (t), y (t), z (t), w (t)
418
+ @independent_variables t
419
+ @variables x (t), y (t), z (t), w (t)
407
420
@parameters a
408
421
@named sys = System ([D (x) ~ a * y], t, [x], [a]; observed = [y ~ z, z ~ x])
409
422
measured_quantities = [w ~ x]
@@ -417,7 +430,8 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
417
430
418
431
# Tensor definition case as reported in
419
432
# https://github.com/SciML/StructuralIdentifiability.jl/issues/178
420
- @variables t, x (t)[1 : 2 ], y (t)[1 : 2 ]
433
+ @independent_variables t
434
+ @variables x (t)[1 : 2 ], y (t)[1 : 2 ]
421
435
@parameters k1, k2
422
436
423
437
eqs = [D (x[1 ]) ~ - k1 * x[2 ], D (x[2 ]) ~ - k2 * x[1 ]]
@@ -436,7 +450,7 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
436
450
y[1 ] ~ X[1 ] * X[2 ] + a,
437
451
y[2 ] ~ X[1 ] - X[2 ],
438
452
]
439
- @mtkbuild osys = System (eqs, t)
453
+ @named osys = System (eqs, t)
440
454
correct = OrderedDict (
441
455
X[1 ] => :locally ,
442
456
X[2 ] => :locally ,
@@ -559,8 +573,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
559
573
@testset " Discrete local identifiability, ModelingToolkit interface" begin
560
574
cases = []
561
575
576
+ @independent_variables t
562
577
@parameters α β
563
- @variables t S (t) I (t) R (t) y (t)
578
+ @variables S (t) I (t) R (t) y (t)
564
579
k = ShiftIndex (t)
565
580
566
581
eqs = [
@@ -811,8 +826,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
811
826
@testset " Exporting ModelingToolkit Model to SI Model" begin
812
827
813
828
# Creates MTK model and assesses its identifiability.
829
+ @independent_variables t
814
830
@parameters r1, r2, c1, c2, beta1, beta2, chi1, chi2
815
- @variables t, x1 (t), x2 (t), y (t), u (t)
831
+ @variables x1 (t), x2 (t), y (t), u (t)
816
832
D = Differential (t)
817
833
eqs = [
818
834
D (x1) ~ r1 * x1 * (1 - c1 * x1) + beta1 * x1 * x2 / (chi1 + x2) + u,
@@ -857,8 +873,9 @@ if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
857
873
@testset " Identifiability of MTK models with known generic initial conditions" begin
858
874
cases = []
859
875
876
+ @independent_variables t
860
877
@parameters a, b, c, d
861
- @variables t, x1 (t), x2 (t)
878
+ @variables x1 (t), x2 (t)
862
879
D = Differential (t)
863
880
x1_0 = substitute (x1, Dict (t => 0 ))
864
881
x2_0 = substitute (x2, Dict (t => 0 ))
0 commit comments