@@ -141,6 +141,10 @@ struct ODESystem <: AbstractODESystem
141141 """
142142 gui_metadata:: Union{Nothing, GUIMetadata}
143143 """
144+ A boolean indicating if the given `ODESystem` represents a system of DDEs.
145+ """
146+ is_dde:: Bool
147+ """
144148 Cache for intermediate tearing state.
145149 """
146150 tearing_state:: Any
@@ -178,7 +182,7 @@ struct ODESystem <: AbstractODESystem
178182 torn_matching, initializesystem, initialization_eqs, schedule,
179183 connector_type, preface, cevents,
180184 devents, parameter_dependencies,
181- metadata = nothing , gui_metadata = nothing ,
185+ metadata = nothing , gui_metadata = nothing , is_dde = false ,
182186 tearing_state = nothing ,
183187 substitutions = nothing , complete = false , index_cache = nothing ,
184188 discrete_subsystems = nothing , solved_unknowns = nothing ,
@@ -198,7 +202,7 @@ struct ODESystem <: AbstractODESystem
198202 ctrl_jac, Wfact, Wfact_t, name, systems, defaults, guesses, torn_matching,
199203 initializesystem, initialization_eqs, schedule, connector_type, preface,
200204 cevents, devents, parameter_dependencies, metadata,
201- gui_metadata, tearing_state, substitutions, complete, index_cache,
205+ gui_metadata, is_dde, tearing_state, substitutions, complete, index_cache,
202206 discrete_subsystems, solved_unknowns, split_idxs, parent)
203207 end
204208end
@@ -223,7 +227,8 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
223227 parameter_dependencies = Equation[],
224228 checks = true ,
225229 metadata = nothing ,
226- gui_metadata = nothing )
230+ gui_metadata = nothing ,
231+ is_dde = nothing )
227232 name === nothing &&
228233 throw (ArgumentError (" The `name` keyword must be provided. Please consider using the `@named` macro" ))
229234 @assert all (control -> any (isequal .(control, ps)), controls) " All controls must also be parameters."
@@ -266,12 +271,15 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
266271 disc_callbacks = SymbolicDiscreteCallbacks (discrete_events)
267272 parameter_dependencies, ps′ = process_parameter_dependencies (
268273 parameter_dependencies, ps′)
274+ if is_dde === nothing
275+ is_dde = _check_if_dde (deqs, iv′, systems)
276+ end
269277 ODESystem (Threads. atomic_add! (SYSTEM_COUNT, UInt (1 )),
270278 deqs, iv′, dvs′, ps′, tspan, var_to_name, ctrl′, observed, tgrad, jac,
271279 ctrl_jac, Wfact, Wfact_t, name, systems, defaults, guesses, nothing , initializesystem,
272280 initialization_eqs, schedule, connector_type, preface, cont_callbacks,
273281 disc_callbacks, parameter_dependencies,
274- metadata, gui_metadata, checks = checks)
282+ metadata, gui_metadata, is_dde, checks = checks)
275283end
276284
277285function ODESystem (eqs, iv; kwargs... )
0 commit comments