JumpSystem
System Constructors
ModelingToolkit.JumpSystem — Typestruct JumpSystem{U<:RecursiveArrayTools.ArrayPartition} <: AbstractTimeDependentSystemA 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 variables.name: The name 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.
connector_type: Type of the system.
discrete_events: AVector{SymbolicDiscreteCallback}that models events. Symbolic analog toSciMLBase.DiscreteCallbackthat 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: A mapping from dependent parameters to expressions describing how they are calculated from other parameters.
metadata: Metadata for the system, to be used by downstream packages.
gui_metadata: Metadata for MTK GUI.
complete: If a modelsysis complete, thensys.xno longer performs namespacing.
index_cache: Cached data for fast symbolic indexing.
Example
using ModelingToolkit, JumpProcesses
@parameters β γ
@variables t 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; simplify, split, kwargs...)
Structurally simplify algebraic equations in a system and compute the topological sort of the observed equations. When simplify=true, the simplify function will be applied during the tearing process. It also takes kwargs allow_symbolic=false and allow_parameter=true which limits the coefficient types during tearing.
The optional argument io may take a tuple (inputs, outputs). This will convert all inputs to parameters and allow them to be unconnected, i.e., simplification will allow models where n_unknowns = n_equations - n_inputs.
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())