Skip to content

Commit d95f966

Browse files
committed
Check that independent variables are defined as @parameters
1 parent f5378df commit d95f966

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

src/systems/diffeqs/odesystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ struct ODESystem <: AbstractODESystem
184184
discrete_subsystems = nothing, solved_unknowns = nothing,
185185
split_idxs = nothing, parent = nothing; checks::Union{Bool, Int} = true)
186186
if checks == true || (checks & CheckComponents) > 0
187+
check_independent_variables([iv])
187188
check_variables(dvs, iv)
188189
check_parameters(ps, iv)
189190
check_equations(deqs, iv)

src/systems/diffeqs/sdesystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ struct SDESystem <: AbstractODESystem
137137
complete = false, index_cache = nothing, parent = nothing;
138138
checks::Union{Bool, Int} = true)
139139
if checks == true || (checks & CheckComponents) > 0
140+
check_independent_variables([iv])
140141
check_variables(dvs, iv)
141142
check_parameters(ps, iv)
142143
check_equations(deqs, iv)

src/systems/discrete_system/discrete_system.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct DiscreteSystem <: AbstractTimeDependentSystem
101101
complete = false, index_cache = nothing, parent = nothing;
102102
checks::Union{Bool, Int} = true)
103103
if checks == true || (checks & CheckComponents) > 0
104+
check_independent_variables([iv])
104105
check_variables(dvs, iv)
105106
check_parameters(ps, iv)
106107
end

src/systems/jumps/jumpsystem.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct JumpSystem{U <: ArrayPartition} <: AbstractTimeDependentSystem
118118
complete = false, index_cache = nothing;
119119
checks::Union{Bool, Int} = true) where {U <: ArrayPartition}
120120
if checks == true || (checks & CheckComponents) > 0
121+
check_independent_variables([iv])
121122
check_variables(unknowns, iv)
122123
check_parameters(ps, iv)
123124
end

src/utils.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ const CheckAll = 1 << 0
102102
const CheckComponents = 1 << 1
103103
const CheckUnits = 1 << 2
104104

105+
function check_independent_variables(ivs)
106+
for iv in ivs
107+
isparameter(iv) || throw(ArgumentError("Independent variable $iv is not a parameter."))
108+
end
109+
end
110+
105111
function check_parameters(ps, iv)
106112
for p in ps
107113
isequal(iv, p) &&

0 commit comments

Comments
 (0)