ODESystem
Basic Operation of ODESystem
When an ODESystem is triggered, it reads its current time from its trigger link, reads its input, solves its differential equation and computes its output. Let us observe the basic operation of ODESystems with a simple example.
We first construct an ODESystem. Since an ODESystem is represented by its state equation and output equation, we need to define those equations.
julia> using Causal # hide
julia> sfunc(dx,x,u,t) = (dx .= -0.5x)
sfunc (generic function with 1 method)
julia> ofunc(x, u, t) = x
ofunc (generic function with 1 method)Let us construct the system
julia> ds = ODESystem(righthandside=sfunc, readout=ofunc, state=[1.], input=Inport(1), output=Outport(1))
ODESystem(righthandside:sfunc, readout:ofunc, state:[1.0], t:0.0, input:Inport(numpins:1, eltype:Inpin{Float64}), output:Outport(numpins:1, eltype:Outpin{Float64}))Note that ds is a single input single output ODESystem with an initial state of [1.] and initial time 0.. To drive, i.e. trigger ds, we need to launch it.
julia> oport, iport, trg, hnd = Outport(1), Inport(1), Outpin(), Inpin{Bool}()
(Outport(numpins:1, eltype:Outpin{Float64}), Inport(numpins:1, eltype:Inpin{Float64}), Outpin(eltype:Float64, isbound:false), Inpin(eltype:Bool, isbound:false))
julia> connect!(oport, ds.input)
1-element Array{Link{Float64},1}:
Link(state:open, eltype:Float64, isreadable:false, iswritable:false)
julia> connect!(ds.output, iport)
1-element Array{Link{Float64},1}:
Link(state:open, eltype:Float64, isreadable:false, iswritable:false)
julia> connect!(trg, ds.trigger)
Link(state:open, eltype:Float64, isreadable:false, iswritable:false)
julia> connect!(ds.handshake, hnd)
Link(state:open, eltype:Bool, isreadable:false, iswritable:false)
julia> task = launch(ds)
Task (runnable) @0x00007f1fcfab7340
julia> task2 = @async while true
all(take!(iport) .=== NaN) && break
end
Task (runnable) @0x00007f1fd16764a0When launched, ds is ready to driven. ds is driven from its trigger link. Note that the trigger link of ds is writable.
julia> ds.trigger.link
Link(state:open, eltype:Float64, isreadable:false, iswritable:true)Let us drive ds to the time of t of 1 second.
julia> put!(trg, 1.)When driven, ds reads current time of t from its trigger link, reads its input value from its input, solves its differential equation and computes its output values and writes its output. So, for the step to be continued, an input values must be written. Note that the input of ds is writable,
julia> ds.input[1].link
Link(state:open, eltype:Float64, isreadable:false, iswritable:true)Let us write some value.
julia> put!(oport, [5.])
1-element Array{Float64,1}:
5.0At this point, ds completed its step and put true to its handshake link to signal that its step is succeeded.
julia> hnd.link
Link(state:open, eltype:Bool, isreadable:true, iswritable:false)To complete the step and be ready for another step, we need to approve the step by reading its handshake.
julia> take!(hnd)
trueAt this point, ds can be driven further.
julia> for t in 2. : 10.
put!(trg, t)
put!(oport, [t * 10])
take!(hnd)
endNote that all the output value of ds is written to its outputbus,
julia> iport[1].link.buffer
64-element Buffer{Cyclic,Float64,1}:
0.00673796499594269
0.011109022735160188
0.018315676429473703
0.030197436083482146
0.049787140033397716
0.08208509196489891
0.13533539576281056
0.2231302805948712
0.3678795150562737
0.6065306765330802
⋮
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0When we launched ds, we constructed a task and the task is still running.
julia> task
Task (runnable) @0x00007f1fcfab7340
julia> task2
Task (runnable) @0x00007f1fd16764a0To terminate the task safely, we need to terminate ds safely.
julia> put!(trg, NaN)
julia> put!(ds.output, [NaN])
1-element Array{Float64,1}:
NaNNow, the state of the task is done.
julia> task
Task (done) @0x00007f1fcfab7340
julia> task2
Task (done) @0x00007f1fd16764a0So, it is not possible to drive ds.
Mutation in State Function in ODESystem
Consider a system with the following ODE
\[\begin{array}{l} \dot{x} = f(x, u, t) \\ y = g(x, u, t) \\ \end{array}\]
where $x \in R^d, y \in R^m, u \in R^p$. To construct and ODESystem, The signature of the state function statefunc must be of the form
function statefunc(dx, x, u, t)
dx .= ... # Update dx
endNote that statefunc does not construct dx but updates dx and does not return anything. This is for performance reasons. On the contrary, the signature of the output function outputfunc must be of the form,
function outputfunc(x, u, t)
y = ... # Compute y
return y
endNote the output value y is computed and returned from outputfunc. y is not updated but generated in the outputfunc.
Full API
Causal.@def_ode_system — Macro@def_ode_system exwhere ex is the expression to define to define a new AbstractODESystem component type. The usage is as follows:
@def_ode_system mutable struct MyODESystem{T1,T2,T3,...,TN,OP,RH,RO,ST,IP,OP} <: AbstractODESystem
param1::T1 = param1_default # optional field
param2::T2 = param2_default # optional field
param3::T3 = param3_default # optional field
⋮
paramN::TN = paramN_default # optional field
righthandside::RH = righthandeside_function # mandatory field
readout::RO = readout_function # mandatory field
state::ST = state_default # mandatory field
input::IP = input_default # mandatory field
output::OP = output_default # mandatory field
endHere, MyODESystem has N parameters. MyODESystem is represented by the righthandside and readout function. state, input and output is the state, input port and output port of MyODESystem.
righthandside must have the signature
function righthandside(dx, x, u, t, args...; kwargs...)
dx .= .... # update dx
endand readout must have the signature
function readout(x, u, t)
y = ...
return y
endNew ODE system must be a subtype of AbstractODESystem to function properly.
New ODE system must be mutable type.
Example
julia> @def_ode_system mutable struct MyODESystem{RH, RO, IP, OP} <: AbstractODESystem
α::Float64 = 1.
β::Float64 = 2.
righthandside::RH = (dx, x, u, t, α=α) -> (dx[1] = α * x[1] + u[1](t))
readout::RO = (x, u, t) -> x
state::Vector{Float64} = [1.]
input::IP = Inport(1)
output::OP = Outport(1)
end
julia> ds = MyODESystem();
julia> ds.input
1-element Inport{Inpin{Float64}}:
Inpin(eltype:Float64, isbound:false)Causal.ODESystem — Typemutable struct ODESystem{RH, RO, ST<:(AbstractArray{var"#s215",1} where var"#s215"<:Real), IP<:(Union{var"#s214", var"#s213"} where var"#s213"<:Nothing where var"#s214"<:Inport), OP<:(Union{var"#s212", var"#s190"} where var"#s190"<:Nothing where var"#s212"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a generic ODE system.
Fields
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s215",1} where var"#s215"<:RealState
input::Union{var"#s214", var"#s213"} where var"#s213"<:Nothing where var"#s214"<:InportInput. Expected to an
InportorNothingoutput::Union{var"#s212", var"#s190"} where var"#s190"<:Nothing where var"#s212"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Example
julia> ds = ODESystem(righthandside=(dx,x,u,t)->(dx.=-x), readout=(x,u,t)->x, state=[1.],input=nothing, output=Outport(1));
julia> ds.state
1-element Array{Float64,1}:
1.0Causal.ContinuousLinearSystem — Typemutable struct ContinuousLinearSystem{T1<:(AbstractArray{var"#s252",2} where var"#s252"<:Real), T2<:(AbstractArray{var"#s251",2} where var"#s251"<:Real), T3<:(AbstractArray{var"#s250",2} where var"#s250"<:Real), T4<:(AbstractArray{var"#s249",2} where var"#s249"<:Real), IP<:(Union{var"#s248", var"#s247"} where var"#s247"<:Nothing where var"#s248"<:Inport), OP<:(Union{var"#s246", var"#s245"} where var"#s245"<:Nothing where var"#s246"<:Outport), ST<:(AbstractArray{var"#s244",1} where var"#s244"<:Real), RH, RO, var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a ContinuousLinearSystem with input and output. state is the initial state and t is the time. modelargs and modelkwargs are passed into ODEProblem and solverargs and solverkwargs are passed into solve method of DifferentialEquations. alg is the algorithm to solve the differential equation of the system.
The ContinuousLinearSystem is represented by the following state and output equations.
\[\begin{array}{l} \dot{x} = A x + B u \\[0.25cm] y = C x + D u \end{array}\]
where $x$ is state. solver is used to solve the above differential equation.
Fields
A::AbstractArray{var"#s252",2} where var"#s252"<:RealA
B::AbstractArray{var"#s251",2} where var"#s251"<:RealB
C::AbstractArray{var"#s250",2} where var"#s250"<:RealC
D::AbstractArray{var"#s249",2} where var"#s249"<:RealD
input::Union{var"#s248", var"#s247"} where var"#s247"<:Nothing where var"#s248"<:InportInput. Expected to be an
InportofNothingoutput::Union{var"#s246", var"#s245"} where var"#s245"<:Nothing where var"#s246"<:OutportOutput port
state::AbstractArray{var"#s244",1} where var"#s244"<:RealState
righthandside::AnyRight-hand-side function
readout::AnyReadout function
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.LorenzSystem — Typemutable struct LorenzSystem{T1<:Real, T2<:Real, T3<:Real, T4<:Real, RH, RO, ST<:(AbstractArray{var"#s301",1} where var"#s301"<:Real), IP<:(Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:Inport), OP<:(Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a LorenzSystem with input and output. sigma, beta, rho and gamma is the system parameters. state is the initial state and t is the time. modelargs and modelkwargs are passed into ODEProblem and solverargs and solverkwargs are passed into solve method of DifferentialEquations. alg is the algorithm to solve the differential equation of the system.
If input is nothing, the state equation of LorenzSystem is
\[\begin{array}{l} \dot{x}_1 = \gamma (\sigma (x_2 - x_1)) \\[0.25cm] \dot{x}_2 = \gamma (x_1 (\rho - x_3) - x_2) \\[0.25cm] \dot{x}_3 = \gamma (x_1 x_2 - \beta x_3) \end{array}\]
where $x$ is state. solver is used to solve the above differential equation. If input is not nothing, then the state eqaution is
\[\begin{array}{l} \dot{x}_1 = \gamma (\sigma (x_2 - x_1)) + \sum_{j = 1}^3 \alpha_{1j} u_j \\[0.25cm] \dot{x}_2 = \gamma (x_1 (\rho - x_3) - x_2) + \sum_{j = 1}^3 \alpha_{2j} u_j \\[0.25cm] \dot{x}_3 = \gamma (x_1 x_2 - \beta x_3) + \sum_{j = 1}^3 \alpha_{3j} u_j \end{array}\]
where $A = [lpha_{ij}]$ is cplmat and $u = [u_{j}]$ is the value of the input. The output function is
\[ y = g(x, u, t)\]
where $t$ is time t, $y$ is the value of the output and $g$ is outputfunc.
Fields
σ::Realα
β::Realβ
ρ::Realρ
γ::Realγ
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s301",1} where var"#s301"<:RealState
input::Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ForcedLorenzSystem — Typemutable struct ForcedLorenzSystem{T1<:Real, T2<:Real, T3<:Real, T4<:Real, CM<:(AbstractArray{var"#s301",2} where var"#s301"<:Real), RH, RO, ST<:(AbstractArray{var"#s300",1} where var"#s300"<:Real), IP<:(Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:Inport), OP<:(Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a LorenzSystem that is driven by its inputs.
Fields
σ::Realσ
β::Realβ
ρ::Realρ
γ::Realγ
cplmat::AbstractArray{var"#s301",2} where var"#s301"<:RealInput coupling matrix. Expected a diagonal matrix
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s300",1} where var"#s300"<:RealState
input::Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ChenSystem — Typemutable struct ChenSystem{T1<:Real, T2<:Real, T3<:Real, T4<:Real, RH, RO, ST<:(AbstractArray{var"#s301",1} where var"#s301"<:Real), IP<:(Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:Inport), OP<:(Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a ChenSystem with input and output. a, b, c and gamma is the system parameters. state is the initial state and t is the time. modelargs and modelkwargs are passed into ODEProblem and solverargs and solverkwargs are passed into solve method of DifferentialEquations. alg is the algorithm to solve the differential equation of the system.
If input is nothing, the state equation of ChenSystem is
\[\begin{array}{l} \dot{x}_1 = \gamma (a (x_2 - x_1)) \\[0.25cm] \dot{x}_2 = \gamma ((c - a) x_1 + c x_2 + x_1 x_3) \\[0.25cm] \dot{x}_3 = \gamma (x_1 x_2 - b x_3) \end{array}\]
where $x$ is state. solver is used to solve the above differential equation. If input is not nothing, then the state eqaution is
\[\begin{array}{l} \dot{x}_1 = \gamma (a (x_2 - x_1)) + \sum_{j = 1}^3 \alpha_{1j} u_j \\[0.25cm] \dot{x}_2 = \gamma ((c - a) x_1 + c x_2 + x_1 x_3) + \sum_{j = 1}^3 \alpha_{2j} u_j \\[0.25cm] \dot{x}_3 = \gamma (x_1 x_2 - b x_3) + \sum_{j = 1}^3 \alpha_{3j} u_j \end{array}\]
where $A = [\alpha_{ij}]$ is cplmat and $u = [u_{j}]$ is the value of the input. The output function is
\[ y = g(x, u, t)\]
where $t$ is time t, $y$ is the value of the output and $g$ is outputfunc.
Fields
a::Reala
b::Realb
c::Realc
γ::Realγ
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s301",1} where var"#s301"<:RealState
input::Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:InportInput. Expected to be and
InportorNothingoutput::Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ForcedChenSystem — Typemutable struct ForcedChenSystem{T1<:Real, T2<:Real, T3<:Real, T4<:Real, CM<:(AbstractArray{var"#s301",2} where var"#s301"<:Real), RH, RO, ST<:(AbstractArray{var"#s300",1} where var"#s300"<:Real), IP<:(Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:Inport), OP<:(Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs Chen system driven by its inputs.
Fields
a::Reala
b::Realb
c::Realc
γ::Realγ
cplmat::AbstractArray{var"#s301",2} where var"#s301"<:RealInput coupling matrix. Expected to be a diaognal matrix
righthandside::Anyreadout::AnyReadout function
state::AbstractArray{var"#s300",1} where var"#s300"<:RealState
input::Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:OutportOutput pprt
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ChuaSystem — Typemutable struct ChuaSystem{DT, T1<:Real, T2<:Real, T3<:Real, RH, RO, ST<:(AbstractArray{var"#s301",1} where var"#s301"<:Real), IP<:(Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:Inport), OP<:(Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a ChuaSystem with input and output. diode, alpha, beta and gamma is the system parameters. state is the initial state and t is the time. modelargs and modelkwargs are passed into ODEProblem and solverargs and solverkwargs are passed into solve method of DifferentialEquations. alg is the algorithm to solve the differential equation of the system.
If input is nothing, the state equation of ChuaSystem is
\[\begin{array}{l} \dot{x}_1 = \gamma (\alpha (x_2 - x_1 - h(x_1))) \\[0.25cm] \dot{x}_2 = \gamma (x_1 - x_2 + x_3 ) \\[0.25cm] \dot{x}_3 = \gamma (-\beta x_2) \end{array}\]
where $x$ is state. solver is used to solve the above differential equation. If input is not nothing, then the state eqaution is
\[\begin{array}{l} \dot{x}_1 = \gamma (\alpha (x_2 - x_1 - h(x_1))) + \sum_{j = 1}^3 \theta_{1j} u_j \\[0.25cm] \dot{x}_2 = \gamma (x_1 - x_2 + x_3 ) + \sum_{j = 1}^3 \theta_{2j} u_j \\[0.25cm] \dot{x}_3 = \gamma (-\beta x_2) + \sum_{j = 1}^3 \theta_{3j} u_j \end{array}\]
where $\Theta = [\theta_{ij}]$ is cplmat and $u = [u_{j}]$ is the value of the input. The output function is
\[ y = g(x, u, t)\]
where $t$ is time t, $y$ is the value of the output and $g$ is outputfunc.
Fields
diode::AnyChua diode. See
PiecewiseLinearDiodeα::Realα
β::Realβ
γ::Realγ
righthandside::AnyRight-hand-side function
readout::AnyReaout function
state::AbstractArray{var"#s301",1} where var"#s301"<:RealState
input::Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ForcedChuaSystem — Typemutable struct ForcedChuaSystem{DT, T1<:Real, T2<:Real, T3<:Real, CM<:(AbstractArray{var"#s301",2} where var"#s301"<:Real), RH, RO, ST<:(AbstractArray{var"#s300",1} where var"#s300"<:Real), IP<:(Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:Inport), OP<:(Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a Chua system with inputs.
Fields
diode::AnyChua diode. See
PiecewiseLinearDiodeα::Realα
β::Realβ
γ::Realγ
cplmat::AbstractArray{var"#s301",2} where var"#s301"<:RealInput coupling matrix. Expected to be a digonal matrix.
righthandside::AnyRight-hand-side matrix
readout::AnyReadout function
state::AbstractArray{var"#s300",1} where var"#s300"<:RealState
input::Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.RosslerSystem — Typemutable struct RosslerSystem{T1<:Real, T2<:Real, T3<:Real, T4<:Real, RH, RO, ST<:(AbstractArray{var"#s301",1} where var"#s301"<:Real), IP<:(Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:Inport), OP<:(Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a RosllerSystem with input and output. a, b, c and gamma is the system parameters. state is the initial state and t is the time. modelargs and modelkwargs are passed into ODEProblem and solverargs and solverkwargs are passed into solve method of DifferentialEquations. alg is the algorithm to solve the differential equation of the system.
If input is nothing, the state equation of RosslerSystem is
\[\begin{array}{l} \dot{x}_1 = \gamma (-x_2 - x_3) \\[0.25cm] \dot{x}_2 = \gamma (x_1 + a x_2) \\[0.25cm] \dot{x}_3 = \gamma (b + x_3 (x_1 - c)) \end{array}\]
where $x$ is state. solver is used to solve the above differential equation. If input is not nothing, then the state eqaution is
\[\begin{array}{l} \dot{x}_1 = \gamma (-x_2 - x_3) + \sum_{j = 1}^3 \theta_{1j} u_j \\[0.25cm] \dot{x}_2 = \gamma (x_1 + a x_2 ) + \sum_{j = 1}^3 \theta_{2j} u_j \\[0.25cm] \dot{x}_3 = \gamma (b + x_3 (x_1 - c)) + \sum_{j = 1}^3 \theta_{3j} u_j \end{array}\]
where $\Theta = [\theta_{ij}]$ is cplmat and $u = [u_{j}]$ is the value of the input. The output function is
\[ y = g(x, u, t)\]
where $t$ is time t, $y$ is the value of the output and $g$ is outputfunc.
Fields
a::Reala
b::Realb
c::Realc
γ::Realγ
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s301",1} where var"#s301"<:RealState
input::Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ForcedRosslerSystem — Typemutable struct ForcedRosslerSystem{T1<:Real, T2<:Real, T3<:Real, T4<:Real, CM<:(AbstractArray{var"#s301",2} where var"#s301"<:Real), RH, RO, ST<:(AbstractArray{var"#s300",1} where var"#s300"<:Real), IP<:(Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:Inport), OP<:(Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a Rossler system driven by its input.
Fields
a::Reala
b::Realb
c::Realc
γ::Realγ
cplmat::AbstractArray{var"#s301",2} where var"#s301"<:RealInput coupling matrix. Expected a diagonal matrix
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s300",1} where var"#s300"<:RealState
input::Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:InportInput. Expected to be and
InportorNothingoutput::Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.VanderpolSystem — Typemutable struct VanderpolSystem{T1<:Real, T2<:Real, RH, RO, ST<:(AbstractArray{var"#s301",1} where var"#s301"<:Real), IP<:(Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:Inport), OP<:(Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a VanderpolSystem with input and output. mu and gamma is the system parameters. state is the initial state and t is the time. modelargs and modelkwargs are passed into ODEProblem and solverargs and solverkwargs are passed into solve method of DifferentialEquations. alg is the algorithm to solve the differential equation of the system.
If input is nothing, the state equation of VanderpolSystem is
\[\begin{array}{l} \dot{x}_1 = \gamma (x_2) \\[0.25cm] \dot{x}_2 = \gamma (\mu (x_1^2 - 1) x_2 - x_1 ) \end{array}\]
where $x$ is state. solver is used to solve the above differential equation. If input is not nothing, then the state eqaution is
\[\begin{array}{l} \dot{x}_1 = \gamma (x_2) + \sum_{j = 1}^3 \theta_{1j} u_j \\[0.25cm] \dot{x}_2 = \gamma (\mu (x_1^2 - 1) x_2 - x_1) + \sum_{j = 1}^3 \theta_{2j} u_j \end{array}\]
where $\Theta = [\theta_{ij}]$ is cplmat and $u = [u_{j}]$ is the value of the input. The output function is
\[ y = g(x, u, t)\]
where $t$ is time t, $y$ is the value of the output and $g$ is outputfunc.
Field
μ::Realμ
γ::Realγ
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s301",1} where var"#s301"<:RealState
input::Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.ForcedVanderpolSystem — Typemutable struct ForcedVanderpolSystem{T1<:Real, T2<:Real, CM<:(AbstractArray{var"#s301",2} where var"#s301"<:Real), RH, RO, ST<:(AbstractArray{var"#s300",1} where var"#s300"<:Real), IP<:(Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:Inport), OP<:(Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs a Vanderpol system driven by its input.
Fields
μ::Realμ
γ::Realγ
cplmat::AbstractArray{var"#s301",2} where var"#s301"<:RealInput coupling matrix. Expected to be a dioagonal matrix
righthandside::AnyRight-hand-side function
readout::AnyReadout function
state::AbstractArray{var"#s300",1} where var"#s300"<:RealState
input::Union{var"#s299", var"#s298"} where var"#s298"<:Nothing where var"#s299"<:InportInput. Expected to be an
InportorNothingoutput::Union{var"#s297", var"#s296"} where var"#s296"<:Nothing where var"#s297"<:OutportOutput port
trigger::Anyhandshake::Anycallbacks::Anyname::Anyid::Anyt::Anymodelargs::Anymodelkwargs::Anysolverargs::Anysolverkwargs::Anyalg::Anyintegrator::Any
Causal.Integrator — Typemutable struct Integrator{T1<:Real, RH, RO, ST<:(AbstractArray{var"#s301",1} where var"#s301"<:Real), IP<:(Union{var"#s300", var"#s299"} where var"#s299"<:Nothing where var"#s300"<:Inport), OP<:(Union{var"#s298", var"#s297"} where var"#s297"<:Nothing where var"#s298"<:Outport), var"253", var"254", var"255", Symbol, var"256", Float64, var"257", var"258", var"259", var"260", var"261", var"262"} <: AbstractODESystemConstructs an integrator whose input output relation is given by
\[u(t) = ki * \int_{0}^{t} u(\tau) d\tau\]
where $u(t)$ is the input, $y(t)$ is the output and $ki$ is the integration constant.