DiscreteSystem
System Constructors
ModelingToolkit.DiscreteSystem — Typestruct DiscreteSystem <: ModelingToolkit.AbstractDiscreteSystemA system of difference equations.
Fields
tag: A tag for the system. If two systems have the same tag, then they are structurally identical.
eqs: The differential equations defining the discrete system.iv: Independent variable.unknowns: Dependent (state) variables. Must not contain the independent variable.ps: Parameter variables. Must not contain the independent variable.tspan: Time span.var_to_name: Array variables.observed: Observed states.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 inDiscreteProblem.
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.
preface: Inject assignment statements before the evaluation of the RHS function.
connector_type: Type of the system.
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.
tearing_state: Cache for intermediate tearing state.
substitutions: Substitutions generated by tearing.
namespacing: If false, thensys.xno longer performs namespacing.
complete: If true, denotes the model will not be modified any further.
index_cache: Cached data for fast symbolic indexing.
parent: The hierarchical parent system before simplification.
isscheduled
Example
using ModelingToolkit
using ModelingToolkit: t_nounits as t
@parameters σ=28.0 ρ=10.0 β=8/3 δt=0.1
@variables x(t)=1.0 y(t)=0.0 z(t)=0.0
k = ShiftIndex(t)
eqs = [x(k+1) ~ σ*(y-x),
y(k+1) ~ x*(ρ-z)-y,
z(k+1) ~ x*y - β*z]
@named de = DiscreteSystem(eqs,t,[x,y,z],[σ,ρ,β]; tspan = (0, 1000.0)) # or
@named de = DiscreteSystem(eqs)Composition and Accessor Functions
get_eqs(sys)orequations(sys): The equations that define the discrete system.get_unknowns(sys)orunknowns(sys): The set of unknowns in the discrete system.get_ps(sys)orparameters(sys): The parameters of the discrete system.get_iv(sys): The independent variable of the discrete systemdiscrete_events(sys): The set of discrete events in the discrete 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
iomay take a tuple(inputs, outputs). This will convert allinputsto 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, thesimplifyfunction will be applied during the tearing process. allow_symbolic=false,allow_parameter=true, andconservative=falselimit the coefficient types during tearing. In particular,conservative=truelimits tearing to only solve for trivial linear systems where the coefficient has the absolute value of $1$.fully_determined=truecontrols 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=truecontrols whether equations are sorted lexicographically before simplification or not.
Problem Constructors
SciMLBase.DiscreteProblem — MethodDiscreteProblem(sys::DiscreteSystem; ...) -> Any
DiscreteProblem(sys::DiscreteSystem, u0map; ...) -> Any
DiscreteProblem(
sys::DiscreteSystem,
u0map,
tspan;
...
) -> Any
DiscreteProblem(
sys::DiscreteSystem,
u0map,
tspan,
parammap;
eval_module,
eval_expression,
kwargs...
) -> Any
Generates an DiscreteProblem from an DiscreteSystem.
Missing docstring for DiscreteFunction(sys::DiscreteSystem, args...). Check Documenter's build log for details.
Discrete Domain
ModelingToolkit.Shift — Typestruct Shift <: Symbolics.OperatorRepresents a shift operator.
Fields
t: Fixed Shiftsteps
Examples
julia> using Symbolics
julia> Δ = Shift(t)
(::Shift) (generic function with 2 methods)