Skip to content

Commit 1c4b5e5

Browse files
committed
Check that the independent variable isn't in parameters
1 parent 52b5068 commit 1c4b5e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/systems/diffeqs/odesystem.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,15 @@ struct ODESystem <: AbstractODESystem
7676

7777
function ODESystem(deqs, iv, dvs, ps, observed, tgrad, jac, Wfact, Wfact_t, name, systems, defaults, structure, connection_type)
7878
check_dependence(dvs,iv)
79+
check_parameters(ps,iv)
7980
new(deqs, iv, dvs, ps, observed, tgrad, jac, Wfact, Wfact_t, name, systems, defaults, structure, connection_type)
8081
end
8182
end
82-
83+
function check_parameters(ps,iv)
84+
for p in ps
85+
isequal(iv,p) && throw(ArgumentError("Independent variable $iv not allowed in parameters."))
86+
end
87+
end
8388
function check_dependence(dvs,iv)
8489
for dv in dvs
8590
isequal(iv, iv_from_nested_derivative(dv)) || throw(ArgumentError("Variable $dv is not a function of independent variable $iv."))

0 commit comments

Comments
 (0)