Skip to content

Commit 9466ed7

Browse files
feat: add schedule field in System
1 parent 4057a38 commit 9466ed7

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/systems/system.jl

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
struct Schedule{V <: BipartiteGraphs.Matching}
2+
"""
3+
Maximal matching of variables to equations calculated during structural simplification.
4+
"""
5+
var_eq_matching::V
6+
"""
7+
Mapping of `Differential`s of variables to corresponding derivative expressions.
8+
"""
9+
dummy_sub::Dict{Any, Any}
10+
end
11+
112
struct System <: AbstractSystem
213
tag::UInt
314
eqs::Vector{Equation}
@@ -39,6 +50,7 @@ struct System <: AbstractSystem
3950
Nothing, Tuple{Vector{IgnoredAnalysisPoint}, Vector{IgnoredAnalysisPoint}}}
4051
parent::Union{Nothing, System}
4152
isscheduled::Bool
53+
schedule::Union{Schedule, Nothing}
4254

4355
function System(
4456
tag, eqs, noise_eqs, jumps, constraints, costs, consolidate, unknowns, ps,
@@ -48,7 +60,8 @@ struct System <: AbstractSystem
4860
metadata = nothing, gui_metadata = nothing,
4961
is_dde = false, tstops = [], tearing_state = nothing, namespacing = true,
5062
complete = false, index_cache = nothing, ignored_connections = nothing,
51-
parent = nothing, isscheduled = false; checks::Union{Bool, Int} = true)
63+
parent = nothing, isscheduled = false, schedule = nothing; checks::Union{
64+
Bool, Int} = true)
5265
if (checks == true || (checks & CheckComponents) > 0) && iv !== nothing
5366
check_independent_variables([iv])
5467
check_variables(unknowns, iv)
@@ -72,7 +85,7 @@ struct System <: AbstractSystem
7285
guesses, systems, initialization_eqs, continuous_events, discrete_events,
7386
connector_type, assertions, metadata, gui_metadata, is_dde,
7487
tstops, tearing_state, namespacing, complete, index_cache, ignored_connections,
75-
parent, isscheduled)
88+
parent, isscheduled, schedule)
7689
end
7790
end
7891

@@ -308,7 +321,7 @@ function validate_vars_and_find_ps!(auxvars, auxps, sysvars, iv)
308321
elseif length(arguments(var)) == 1
309322
arg = only(arguments(var))
310323
operation(var)(iv) sts ||
311-
throw(ArgumentError("Variable $var is not a variable of the ODESystem. Called variables must be variables of the ODESystem."))
324+
throw(ArgumentError("Variable $var is not a variable of the System. Called variables must be variables of the System."))
312325

313326
isequal(arg, iv) || isparameter(arg) || arg isa Integer ||
314327
arg isa AbstractFloat ||
@@ -336,12 +349,12 @@ end
336349
SymbolicIndexingInterface.is_time_dependent(sys::System) = get_iv(sys) !== nothing
337350

338351
"""
339-
is_dde(sys::System)
352+
is_dde(sys::AbstractSystem)
340353
341354
Return a boolean indicating whether a system represents a set of delay
342355
differential equations.
343356
"""
344-
is_dde(sys::System) = has_is_dde(sys) && get_is_dde(sys)
357+
is_dde(sys::AbstractSystem) = has_is_dde(sys) && get_is_dde(sys)
345358

346359
function _check_if_dde(eqs, iv, subsystems)
347360
is_dde = any(ModelingToolkit.is_dde, subsystems)

0 commit comments

Comments
 (0)