JumpSystem
System Constructors
ModelingToolkit.JumpSystem
— Typestruct JumpSystem{U<:RecursiveArrayTools.ArrayPartition} <: AbstractTimeDependentSystem
A system of jump processes.
Fields
tag
: A tag for the system. If two systems have the same tag, then they are structurally identical.
eqs
: The jumps of the system. Allowable types areConstantRateJump
,VariableRateJump
,MassActionJump
.
iv
: The independent variable, usually time.unknowns
: The dependent variables, representing the state of the system. Must not contain the independent variable.ps
: The parameters of the system. Must not contain the independent variable.var_to_name
: Array variables.observed
: Observed equations.name
: The name of the system.description
: A description of the system.systems
: The internal systems. These are required to have unique names.defaults
: The default values to use when initial conditions and/or parameters are not supplied inODEProblem
.
guesses
: The guesses to use as the initial conditions for the initialization system.
initializesystem
: The system for performing the initialization.
initialization_eqs
: Extra equations to be enforced during the initialization sequence.
connector_type
: Type of the system.
continuous_events
: AVector{SymbolicContinuousCallback}
that model events. The integrator will use root finding to guarantee that it steps at each zero crossing.
discrete_events
: AVector{SymbolicDiscreteCallback}
that models events. Symbolic analog toSciMLBase.DiscreteCallback
that executes an affect when a given condition is true at the end of an integration step. Note, one must make sure to callreset_aggregated_jumps!(integrator)
if using a custom affect function that changes any unknown value or parameter.
parameter_dependencies
: Topologically sorted parameter dependency equations, where all symbols are parameters and the LHS is a single parameter.
metadata
: Metadata for the system, to be used by downstream packages.
gui_metadata
: Metadata for MTK GUI.
namespacing
: If false, thensys.x
no longer performs namespacing.
complete
: If true, denotes the model will not be modified any further.
index_cache
: Cached data for fast symbolic indexing.
isscheduled
Example
using ModelingToolkit, JumpProcesses
using ModelingToolkit: t_nounits as t
@parameters β γ
@variables S(t) I(t) R(t)
rate₁ = β*S*I
affect₁ = [S ~ S - 1, I ~ I + 1]
rate₂ = γ*I
affect₂ = [I ~ I - 1, R ~ R + 1]
j₁ = ConstantRateJump(rate₁,affect₁)
j₂ = ConstantRateJump(rate₂,affect₂)
j₃ = MassActionJump(2*β+γ, [R => 1], [S => 1, R => -1])
@named js = JumpSystem([j₁,j₂,j₃], t, [S,I,R], [β,γ])
Composition and Accessor Functions
get_eqs(sys)
orequations(sys)
: The equations that define the jump system.get_unknowns(sys)
orunknowns(sys)
: The set of unknowns in the jump system.get_ps(sys)
orparameters(sys)
: The parameters of the jump system.get_iv(sys)
: The independent variable of the jump system.discrete_events(sys)
: The set of discrete events in the jump system.
Transformations
ModelingToolkit.structural_simplify
— Functionstructural_simplify(sys; ...)
structural_simplify(
sys,
io;
additional_passes,
simplify,
split,
allow_symbolic,
allow_parameter,
conservative,
fully_determined,
kwargs...
)
Structurally simplify algebraic equations in a system and compute the topological sort of the observed equations in sys
.
Optional Arguments:
- optional argument
io
may take a tuple(inputs, outputs)
. This will convert allinputs
to parameters and allow them to be unconnected, i.e., simplification will allow models wheren_unknowns = n_equations - n_inputs
.
Optional Keyword Arguments:
- When
simplify=true
, thesimplify
function will be applied during the tearing process. allow_symbolic=false
,allow_parameter=true
, andconservative=false
limit the coefficient types during tearing. In particular,conservative=true
limits tearing to only solve for trivial linear systems where the coefficient has the absolute value of $1$.fully_determined=true
controls whether or not an error will be thrown if the number of equations don't match the number of inputs, outputs, and equations.sort_eqs=true
controls whether equations are sorted lexicographically before simplification or not.
Analyses
Problem Constructors
Missing docstring for DiscreteProblem(sys::JumpSystem, u0map, tspan)
. Check Documenter's build log for details.
JumpProcesses.JumpProblem
— MethodDiffEqBase.JumpProblem(js::JumpSystem, prob, aggregator; kwargs...)
Generates a JumpProblem from a JumpSystem.
Continuing the example from the DiscreteProblem
definition:
jprob = JumpProblem(complete(js), dprob, Direct())
sol = solve(jprob, SSAStepper())