@@ -235,6 +235,7 @@ struct System <: AbstractSystem
235
235
Whether the current system is an initialization system.
236
236
"""
237
237
is_initializesystem:: Bool
238
+ is_discrete:: Bool
238
239
"""
239
240
$INTERNAL_FIELD_WARNING
240
241
Whether the system has been simplified by `mtkcompile`.
@@ -255,8 +256,8 @@ struct System <: AbstractSystem
255
256
is_dde = false , tstops = [], tearing_state = nothing , namespacing = true ,
256
257
complete = false , index_cache = nothing , ignored_connections = nothing ,
257
258
preface = nothing , parent = nothing , initializesystem = nothing ,
258
- is_initializesystem = false , isscheduled = false , schedule = nothing ;
259
- checks:: Union{Bool, Int} = true )
259
+ is_initializesystem = false , is_discrete = false , isscheduled = false ,
260
+ schedule = nothing ; checks:: Union{Bool, Int} = true )
260
261
if is_initializesystem && iv != = nothing
261
262
throw (ArgumentError ("""
262
263
Expected initialization system to be time-independent. Found independent
@@ -293,7 +294,8 @@ struct System <: AbstractSystem
293
294
guesses, systems, initialization_eqs, continuous_events, discrete_events,
294
295
connector_type, assertions, metadata, gui_metadata, is_dde,
295
296
tstops, tearing_state, namespacing, complete, index_cache, ignored_connections,
296
- preface, parent, initializesystem, is_initializesystem, isscheduled, schedule)
297
+ preface, parent, initializesystem, is_initializesystem, is_discrete,
298
+ isscheduled, schedule)
297
299
end
298
300
end
299
301
@@ -330,8 +332,8 @@ function System(eqs::Vector{Equation}, iv, dvs, ps, brownians = [];
330
332
is_dde = nothing , tstops = [], tearing_state = nothing ,
331
333
ignored_connections = nothing , parent = nothing ,
332
334
description = " " , name = nothing , discover_from_metadata = true ,
333
- initializesystem = nothing , is_initializesystem = false , preface = [] ,
334
- checks = true )
335
+ initializesystem = nothing , is_initializesystem = false , is_discrete = false ,
336
+ preface = [], checks = true )
335
337
name === nothing && throw (NoNameError ())
336
338
if ! isempty (parameter_dependencies)
337
339
@warn """
@@ -411,7 +413,7 @@ function System(eqs::Vector{Equation}, iv, dvs, ps, brownians = [];
411
413
var_to_name, name, description, defaults, guesses, systems, initialization_eqs,
412
414
continuous_events, discrete_events, connector_type, assertions, metadata, gui_metadata, is_dde,
413
415
tstops, tearing_state, true , false , nothing , ignored_connections, preface, parent,
414
- initializesystem, is_initializesystem; checks)
416
+ initializesystem, is_initializesystem, is_discrete ; checks)
415
417
end
416
418
417
419
"""
@@ -668,7 +670,7 @@ callbacks, so checking if any LHS is shifted is sufficient. If a variable is shi
668
670
the input equations there _will_ be a `Shift` equation in the simplified system.
669
671
"""
670
672
function is_discrete_system (sys:: System )
671
- any (eq -> isoperator (eq. lhs, Shift), equations (sys))
673
+ get_is_discrete (sys) || any (eq -> isoperator (eq. lhs, Shift), equations (sys))
672
674
end
673
675
674
676
SymbolicIndexingInterface. is_time_dependent (sys:: System ) = get_iv (sys) != = nothing
0 commit comments