Types
This section describes systems types implemented in MathematicalSystems.jl
.
Abstract Systems
MathematicalSystems.AbstractSystem
— TypeAbstractSystem
Abstract supertype for all system types.
MathematicalSystems.AbstractContinuousSystem
— TypeAbstractContinuousSystem
Abstract supertype for all continuous system types.
MathematicalSystems.AbstractDiscreteSystem
— TypeAbstractDiscreteSystem
Abstract supertype for all discrete system types.
Continuous Systems
MathematicalSystems.ContinuousIdentitySystem
— TypeContinuousIdentitySystem <: AbstractContinuousSystem
Trivial identity continuous-time system of the form:
\[ x(t)' = 0 \; \forall t.\]
Fields
statedim
– number of state variables
MathematicalSystems.ConstrainedContinuousIdentitySystem
— TypeConstrainedContinuousIdentitySystem <: AbstractContinuousSystem
Trivial identity continuous-time system with domain constraints of the form:
\[ x(t)' = 0, \; x(t) ∈ \mathcal{X} \; \forall t.\]
Fields
statedim
– number of state variablesX
– state constraints
MathematicalSystems.LinearContinuousSystem
— TypeLinearContinuousSystem
Continuous-time linear system of the form:
\[ x(t)' = A x(t) \; \forall t.\]
Fields
A
– state matrix
MathematicalSystems.AffineContinuousSystem
— TypeAffineContinuousSystem
Continuous-time affine system of the form:
\[ x(t)' = A x(t) + c \; \forall t.\]
Fields
A
– state matrixc
– affine term
MathematicalSystems.LinearControlContinuousSystem
— TypeLinearControlContinuousSystem
Continuous-time linear control system of the form:
\[ x(t)' = A x(t) + B u(t) \; \forall t.\]
Fields
A
– state matrixB
– input matrix
MathematicalSystems.AffineControlContinuousSystem
— TypeAffineControlContinuousSystem
Continuous-time affine control system of the form:
\[ x(t)' = A x(t) + B u(t) + c, \; \forall t.\]
Fields
A
– state matrixB
– input matrixc
– affine term
MathematicalSystems.ConstrainedLinearContinuousSystem
— TypeConstrainedLinearContinuousSystem
Continuous-time linear system with domain constraints of the form:
\[ x(t)' = A x(t), \; x(t) ∈ \mathcal{X} \; \forall t.\]
Fields
A
– state matrixX
– state constraints
MathematicalSystems.ConstrainedAffineContinuousSystem
— TypeConstrainedAffineContinuousSystem
Continuous-time affine system with domain constraints of the form:
\[ x(t)' = A x(t) + c, \; x(t) ∈ \mathcal{X} \; \forall t.\]
Fields
A
– state matrixc
– affine termX
– state constraints
MathematicalSystems.ConstrainedAffineControlContinuousSystem
— TypeConstrainedAffineControlContinuousSystem
Continuous-time affine control system with domain constraints of the form:
\[ x(t)' = A x(t) + B u(t) + c, \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U} \; \forall t.\]
Fields
A
– state matrixB
– input matrixc
– affine termX
– state constraintsU
– input constraints
MathematicalSystems.ConstrainedLinearControlContinuousSystem
— TypeConstrainedLinearControlContinuousSystem
Continuous-time linear control system with domain constraints of the form:
\[ x(t)' = A x(t) + B u(t), \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U} \; \forall t.\]
Fields
A
– state matrixB
– input matrixX
– state constraintsU
– input constraints
MathematicalSystems.LinearDescriptorContinuousSystem
— TypeLinearDescriptorContinuousSystem
Continuous-time linear descriptor system of the form:
\[ E x(t)' = A x(t) \; \forall t.\]
Fields
A
– state matrixE
– matrix, same size asA
MathematicalSystems.ConstrainedLinearDescriptorContinuousSystem
— TypeConstrainedLinearDescriptorContinuousSystem
Continuous-time linear system with domain constraints of the form:
\[ E x(t)' = A x(t), \; x(t) ∈ \mathcal{X} \; \forall t.\]
Fields
A
– state matrixE
– matrix, same size asA
X
– state constraints
MathematicalSystems.PolynomialContinuousSystem
— TypePolynomialContinuousSystem
Continuous-time polynomial system of the form:
\[ x(t)' = p(x(t)) \; \forall t.\]
Fields
p
– polynomial vector fieldstatedim
– number of state variables
MathematicalSystems.ConstrainedPolynomialContinuousSystem
— TypeConstrainedPolynomialContinuousSystem
Continuous-time polynomial system with domain constraints:
\[ x(t)' = p(x(t)), \; x(t) ∈ \mathcal{X} \; \forall t.\]
Fields
p
– polynomial vector fieldX
– constraint setstatedim
– number of state variables
MathematicalSystems.BlackBoxContinuousSystem
— TypeBlackBoxContinuousSystem <: AbstractContinuousSystem
Continuous-time system defined by a right-hand side of the form:
\[ x(t)' = f(x(t)) \; \forall t.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variables
MathematicalSystems.ConstrainedBlackBoxContinuousSystem
— TypeConstrainedBlackBoxContinuousSystem <: AbstractContinuousSystem
Continuous-time system defined by a right-hand side with domain constraints of the form:
\[ x(t)' = f(x(t)), \; x(t) ∈ \mathcal{X} \; \forall t.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesX
– state constraints
MathematicalSystems.BlackBoxControlContinuousSystem
— TypeBlackBoxControlContinuousSystem <: AbstractContinuousSystem
Continuous-time control system defined by a right-hand side of the form:
\[ x(t)' = f(x(t), u(t)) \; \forall t.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variables
MathematicalSystems.ConstrainedBlackBoxControlContinuousSystem
— TypeConstrainedBlackBoxControlContinuousSystem <: AbstractContinuousSystem
Continuous-time control system defined by a right-hand side with domain constraints of the form:
\[ x(t)' = f(x(t), u(t)), \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U} \; \forall t.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variablesX
– state constraintsU
– input constraints
MathematicalSystems.NoisyLinearContinuousSystem
— TypeNoisyLinearContinuousSystem
Continuous-time linear system with additive disturbance of the form:
\[ x(t)' = A x(t) + D w(t) \; \forall t.\]
Fields
A
– state matrixD
– noise matrix
MathematicalSystems.NoisyConstrainedLinearContinuousSystem
— TypeNoisyConstrainedLinearContinuousSystem
Continuous-time linear system with additive disturbance and domain constraints of the form:
\[ x(t)' = A x(t) + D w(t), \; x(t) ∈ \mathcal{X}, \; w(t) ∈ \mathcal{W} \; \forall t.\]
Fields
A
– state matrixD
– noise matrixX
– state constraintsW
– disturbance set
MathematicalSystems.NoisyLinearControlContinuousSystem
— TypeNoisyLinearControlContinuousSystem
Continuous-time linear control system with additive disturbance of the form:
\[ x(t)' = A x(t) + B u(t) + D w(t) \; \forall t.\]
Fields
A
– state matrixB
– input matrixD
– noise matrix
MathematicalSystems.NoisyConstrainedLinearControlContinuousSystem
— TypeNoisyConstrainedLinearControlContinuousSystem
Continuous-time linear control system with additive disturbance and domain constraints of the form:
\[ x(t)' = A x(t) + B u(t) + D w(t), \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U}, \; w(t) ∈ \mathcal{W} \; \forall t.\]
Fields
A
– state matrixB
– input matrixD
– noise matrixX
– state constraintsU
– input constraintsW
– disturbance set
MathematicalSystems.NoisyAffineControlContinuousSystem
— TypeNoisyAffineControlContinuousSystem
Continuous-time affine control system with additive disturbance of the form:
\[ x(t)' = A x(t) + B u(t) + c + D w(t) \; \forall t.\]
Fields
A
– state matrixB
– input matrixc
– affine termD
– noise matrix
MathematicalSystems.NoisyConstrainedAffineControlContinuousSystem
— TypeNoisyConstrainedAffineControlContinuousSystem
Continuous-time affine control system with additive disturbance and domain constraints of the form:
\[ x(t)' = A x(t) + B u(t) + c + D w(t), \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U}, \; w(t) ∈ \mathcal{W} \; \forall t.\]
Fields
A
– state matrixB
– input matrixc
– affine termD
– noise matrixX
– state constraintsU
– input constraintsW
– disturbance set
MathematicalSystems.NoisyBlackBoxControlContinuousSystem
— TypeNoisyBlackBoxControlContinuousSystem <: AbstractContinuousSystem
Continuous-time disturbance-affected control system defined by a right-hand side of the form:
\[ x(t)' = f(x(t), u(t), w(t)) \; \forall t.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variablesnoisedim
– number of noise variables
MathematicalSystems.NoisyConstrainedBlackBoxControlContinuousSystem
— TypeNoisyConstrainedBlackBoxControlContinuousSystem <: AbstractContinuousSystem
Continuous-time disturbance-affected control system defined by a right-hand side with domain constraints of the form:
\[ x(t)' = f(x(t), u(t), w(t)), \quad x(t) ∈ \mathcal{X}, \quad u(t) ∈ \mathcal{U}, \quad w(t) ∈ \mathcal{W} \quad \forall t.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variablesnoisedim
– number of noise variablesX
– state constraintsU
– input constraintsW
– disturbance set
MathematicalSystems.SecondOrderLinearContinuousSystem
— TypeSecondOrderLinearContinuousSystem
Continuous-time second order linear system of the form:
\[ Mx''(t) + Cx'(t) + Kx(t) = 0\; \forall t.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrix
MathematicalSystems.SecondOrderAffineContinuousSystem
— TypeSecondOrderAffineContinuousSystem
Continuous-time second order affine system of the form:
\[ Mx''(t) + Cx'(t) + Kx(t) = b\; \forall t.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrixb
– affine term
MathematicalSystems.SecondOrderConstrainedAffineControlContinuousSystem
— TypeSecondOrderConstrainedAffineControlContinuousSystem
Continuous-time second order constrained affine control system of the form:
\[ Mx''(t) + Cx'(t) + Kx(t) = Bu(t) + d, \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U} \; \forall t.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrixB
– input matrixd
– affine termX
– state constraintsU
– input constraints
MathematicalSystems.SecondOrderConstrainedLinearControlContinuousSystem
— TypeSecondOrderConstrainedLinearControlContinuousSystem
Continuous-time second order constrained linear control system of the form:
\[ Mx''(t) + Cx'(t) + Kx(t) = Bu(t), \; x(t) ∈ \mathcal{X}, \; u(t) ∈ \mathcal{U} \; \forall t.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrixB
– input matrixX
– state constraintsU
– input constraints
MathematicalSystems.SecondOrderContinuousSystem
— TypeSecondOrderContinuousSystem
Continuous-time second-order system of the form:
\[ Mx''(t) + Cx'(t) + f_i(x) = f_e(t) \forall t\]
Fields
M
– mass matrixC
– viscosity matrixfi
– internal forcesfe
– external forces
Notes
Typically fi(x)
is a state-dependent function, and fe
is a given vector. In this implementation, their respective types, FI
and FE
, are generic.
MathematicalSystems.SecondOrderConstrainedContinuousSystem
— TypeSecondOrderConstrainedContinuousSystem
Continuous-time constrained second-order system of the form:
\[ Mx''(t) + Cx'(t) + f_i(x) = f_e(t) \forall t, x ∈ X, f_e(t) ∈ U\]
Fields
M
– mass matrixC
– viscosity matrixfi
– internal forcesfe
– external forcesX
– state setU
– input set
Discrete Systems
MathematicalSystems.DiscreteIdentitySystem
— TypeDiscreteIdentitySystem <: AbstractDiscreteSystem
Trivial identity discrete-time system of the form:
\[ x_{k+1} = x_k \; \forall k.\]
Fields
statedim
– number of state variables
MathematicalSystems.ConstrainedDiscreteIdentitySystem
— TypeConstrainedDiscreteIdentitySystem <: AbstractDiscreteSystem
Trivial identity discrete-time system with domain constraints of the form:
\[ x_{k+1} = x_k, \; x_k ∈ \mathcal{X} \; \forall k.\]
Fields
statedim
– number of state variablesX
– state constraints
MathematicalSystems.LinearDiscreteSystem
— TypeLinearDiscreteSystem
Discrete-time linear system of the form:
\[ x_{k+1} = A x_k \; \forall k.\]
Fields
A
– state matrix
MathematicalSystems.AffineDiscreteSystem
— TypeAffineDiscreteSystem
Discrete-time affine system of the form:
\[ x_{k+1} = A x_k + c \; \forall k.\]
Fields
A
– state matrixc
– affine term
MathematicalSystems.LinearControlDiscreteSystem
— TypeLinearControlDiscreteSystem
Discrete-time linear control system of the form:
\[ x_{k+1} = A x_k + B u_k \; \forall k.\]
Fields
A
– state matrixB
– input matrix
MathematicalSystems.AffineControlDiscreteSystem
— TypeAffineControlDiscreteSystem
Continuous-time affine control system of the form:
\[ x_{k+1} = A x_k + B u_k + c, \; \forall k.\]
Fields
A
– state matrixB
– input matrixc
– affine term
MathematicalSystems.ConstrainedLinearDiscreteSystem
— TypeConstrainedLinearDiscreteSystem
Discrete-time linear system with domain constraints of the form:
\[ x_{k+1} = A x_k, \; x_k ∈ \mathcal{X} \; \forall k.\]
Fields
A
– state matrixX
– state constraints
MathematicalSystems.ConstrainedAffineDiscreteSystem
— TypeConstrainedAffineDiscreteSystem
Discrete-time affine system with domain constraints of the form:
\[ x_{k+1} = A x_k + c, \; x_k ∈ \mathcal{X} \; \forall k.\]
Fields
A
– state matrixc
– affine termX
– state constraints
MathematicalSystems.ConstrainedLinearControlDiscreteSystem
— TypeConstrainedLinearControlDiscreteSystem
Discrete-time linear control system with domain constraints of the form:
\[ x_{k+1} = A x_k + B u_k, \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U} \; \forall k.\]
Fields
A
– state matrixB
– input matrixX
– state constraintsU
– input constraints
MathematicalSystems.ConstrainedAffineControlDiscreteSystem
— TypeConstrainedAffineControlDiscreteSystem
Continuous-time affine control system with domain constraints of the form:
\[ x_{k+1} = A x_k + B u_k + c, \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U} \; \forall k.\]
Fields
A
– state matrixB
– input matrixc
– affine termX
– state constraintsU
– input constraints
MathematicalSystems.LinearDescriptorDiscreteSystem
— TypeLinearDescriptorDiscreteSystem
Discrete-time linear descriptor system of the form:
\[ E x_{k+1} = A x_k \; \forall k.\]
Fields
A
– state matrixE
– matrix, same size asA
MathematicalSystems.ConstrainedLinearDescriptorDiscreteSystem
— TypeConstrainedLinearDescriptorDiscreteSystem
Discrete-time linear system with domain constraints of the form:
\[ E x_{k+1} = A x_k, \; x_k ∈ \mathcal{X} \; \forall k.\]
Fields
A
– state matrixE
– matrix, same size asA
X
– state constraints
MathematicalSystems.PolynomialDiscreteSystem
— TypePolynomialDiscreteSystem
Discrete-time polynomial system of the form:
\[ x_{k+1} = p(x_k) \; \forall k.\]
Fields
p
– polynomial vector fieldstatedim
– number of state variables
MathematicalSystems.ConstrainedPolynomialDiscreteSystem
— TypeConstrainedPolynomialDiscreteSystem
Discrete-time polynomial system with domain constraints:
\[ x_{k+1} = p(x_k), \; x_k ∈ \mathcal{X} \; \forall k.\]
Fields
p
– polynomialX
– constraint setstatedim
– number of state variables
MathematicalSystems.BlackBoxDiscreteSystem
— TypeBlackBoxDiscreteSystem <: AbstractDiscreteSystem
Discrete-time system defined by a right-hand side of the form:
\[ x_{k+1} = f(x_k) \; \forall k.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variables
MathematicalSystems.ConstrainedBlackBoxDiscreteSystem
— TypeConstrainedBlackBoxDiscreteSystem <: AbstractDiscreteSystem
Discrete-time system defined by a right-hand side with domain constraints of the form:
\[ x_{k+1} = f(x_k), \; x_k ∈ \mathcal{X} \; \forall k.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesX
– state constraints
MathematicalSystems.BlackBoxControlDiscreteSystem
— TypeBlackBoxControlDiscreteSystem <: AbstractDiscreteSystem
Discrete-time control system defined by a right-hand side of the form:
\[ x_{k+1} = f(x_k, u_k) \; \forall k.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variables
MathematicalSystems.ConstrainedBlackBoxControlDiscreteSystem
— TypeConstrainedBlackBoxControlDiscreteSystem <: AbstractDiscreteSystem
Discrete-time control system defined by a right-hand side with domain constraints of the form:
\[ x_{k+1} = f(x_k, u_k), \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U} \; \forall k.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variablesX
– state constraintsU
– input constraints
MathematicalSystems.NoisyLinearDiscreteSystem
— TypeNoisyLinearDiscreteSystem
Discrete-time linear system with additive disturbance of the form:
\[ x_{k+1} = A x_k + D w_k \; \forall k.\]
Fields
A
– state matrixD
– noise matrix
MathematicalSystems.NoisyConstrainedLinearDiscreteSystem
— TypeNoisyConstrainedLinearDiscreteSystem
Discrete-time linear system with additive disturbance and domain constraints of the form:
\[ x_{k+1} = A x_k + D w_k, \; x_k ∈ \mathcal{X}, \; w(t) ∈ \mathcal{W} \; \forall k.\]
Fields
A
– state matrixD
– noise matrixX
– state constraintsW
– disturbance set
MathematicalSystems.NoisyLinearControlDiscreteSystem
— TypeNoisyLinearControlDiscreteSystem
Continuous-time linear control system with additive disturbance of the form:
\[ x_{k+1} = A x_k + B u_k + D w_k \; \forall k.\]
Fields
A
– state matrixB
– input matrixD
– noise matrix
MathematicalSystems.NoisyConstrainedLinearControlDiscreteSystem
— TypeNoisyConstrainedLinearControlDiscreteSystem
Continuous-time linear control system with additive disturbance and domain constraints of the form:
\[ x_{k+1} = A x_k + B u_k + D w_k, \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U}, \; w_k ∈ \mathcal{W} \; \forall k.\]
Fields
A
– state matrixB
– input matrixD
– noise matrixX
– state constraintsU
– input constraintsW
– disturbance set
MathematicalSystems.NoisyAffineControlDiscreteSystem
— TypeNoisyAffineControlDiscreteSystem
Continuous-time affine control system with additive disturbance of the form:
\[ x_{k+1} = A x_k + B u_k + c + D w_k \; \forall k.\]
Fields
A
– state matrixB
– input matrixc
– affine termD
– noise matrix
MathematicalSystems.NoisyConstrainedAffineControlDiscreteSystem
— TypeNoisyConstrainedAffineControlDiscreteSystem
Continuous-time affine control system with additive disturbance and domain constraints of the form:
\[ x_{k+1} = A x_k + B u_k + c + D w_k, \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U}, \; w_k ∈ \mathcal{W} \; \forall k.\]
Fields
A
– state matrixB
– input matrixc
– affine termD
– noise matrixX
– state constraintsU
– input constraintsW
– disturbance set
MathematicalSystems.NoisyBlackBoxControlDiscreteSystem
— TypeNoisyBlackBoxControlDiscreteSystem <: AbstractDiscreteSystem
Discrete-time disturbance-affected control system defined by a right-hand side of the form:
\[ x_{k+1} = f(x_k, u_k) \quad \forall k.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variablesnoisedim
– number of noise variables
MathematicalSystems.NoisyConstrainedBlackBoxControlDiscreteSystem
— TypeNoisyConstrainedBlackBoxControlDiscreteSystem <: AbstractDiscreteSystem
Discrete-time disturbance-affected control system defined by a right-hand side with domain constraints of the form:
\[ x_{k+1} = f(x_k, u_k), \quad x_k ∈ \mathcal{X}, \quad u_k ∈ \mathcal{U}, \quad w_k ∈ \mathcal{W} \quad \forall k.\]
Fields
f
– function that holds the right-hand sidestatedim
– number of state variablesinputdim
– number of input variablesnoisedim
– number of noise variablesX
– state constraintsU
– input constraintsW
– disturbance set
MathematicalSystems.SecondOrderLinearDiscreteSystem
— TypeSecondOrderLinearDiscreteSystem
Discrete-time second order linear system of the form:
\[ Mx_{k+2} + Cx_{k+1} + Kx_k = 0\; \forall k.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrix
MathematicalSystems.SecondOrderAffineDiscreteSystem
— TypeSecondOrderAffineDiscreteSystem
Discrete-time second order affine system of the form:
\[ Mx_{k+2} + Cx_{k+1} + Kx_k = b\; \forall k.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrixb
– affine term
MathematicalSystems.SecondOrderConstrainedAffineControlDiscreteSystem
— TypeSecondOrderConstrainedAffineControlDiscreteSystem
Discrete-time second order constrained affine control system of the form:
\[ Mx_{k+2} + Cx_{k+1} + Kx_k = Bu_k + d, \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U} \; \forall k.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrixB
– input matrixd
– affine termX
– state constraintsU
– input constraints
MathematicalSystems.SecondOrderConstrainedLinearControlDiscreteSystem
— TypeSecondOrderConstrainedLinearControlDiscreteSystem
Discrete-time second order constrained linear control system of the form:
\[ Mx_{k+2} + Cx_{k+1} + Kx_k = Bu_k, \; x_k ∈ \mathcal{X}, \; u_k ∈ \mathcal{U} \; \forall k.\]
Fields
M
– mass matrixC
– viscosity matrixK
– stiffness matrixB
– input matrixX
– state constraintsU
– input constraints
MathematicalSystems.SecondOrderDiscreteSystem
— TypeSecondOrderDiscreteSystem
Discrete-time second-order system of the form:
\[ Mx_{k+2} + Cx_{k} + f_i(x_k) = f_e(t_k) \forall k.\]
Fields
M
– mass matrixC
– viscosity matrixfi
– internal forcesfe
– external forces
Notes
Typically fi(x_k)
is a state-dependent function, and fe
is a given vector. In this implementation, their respective types, FI
and FE
, are generic.
MathematicalSystems.SecondOrderConstrainedDiscreteSystem
— TypeSecondOrderConstrainedDiscreteSystem
Discrete-time constrained second-order system of the form:
\[ Mx_{k+2} + Cx_{k} + f_i(x_k) = f_e(t_k) \forall k, x_k ∈ X, f_e(t_k) ∈ U\]
Fields
M
– mass matrixC
– viscosity matrixfi
– internal forcesfe
– external forcesX
– state setU
– input set
Discretization Algorithms
MathematicalSystems.AbstractDiscretizationAlgorithm
— TypeAbstractDiscretizationAlgorithm
Abstract supertype for all discretization algorithms.
Note
For implementing a custom discretization algorithm, a type definition struct NewDiscretizationAlgorithm <: AbstractDiscretizationAlgorithm end
and a _discretize
method
_discretize(::NewDiscretizationAlgorithm, ΔT::Real,
A::AbstractMatrix, B::AbstractMatrix, c::AbstractVector, D::AbstractMatrix)
are required.
MathematicalSystems.ExactDiscretization
— TypeExactDiscretization <: AbstractDiscretizationAlgorithm
Exact discretization algorithm for affine systems.
Algorithm
This algorithm consists of integrating the continuous differential equation over a specified time interval to obtain an associated difference equation. The algorithm applies to any system of the form x' = Ax + Bu + c + Dw
where the state matrix A
is invertible, and other system types, e.g. linear systems x' = Ax
which are included in the above formulation.
Without loss of generality, consider a NoisyAffineControlledContinuousSystem
with system dynamics $x' = Ax + Bu + c + Dw$.
The exact discretization is calculated by integrating on both sides of the continuous ODE over the time span [t, t + ΔT]
, for a fixed input u
and fixed noise realization w
at time t
. The resulting discretization writes as $x^+ = A^d x + B^d u + c^d + D^d w$ where $A^d = \exp^{A ~ ΔT}$, $B^d = A^{-1}(A^d - I)B$, $c^d = A^{-1}(A^d - I)c$ and $D^d = A^{-1}(A^d - I)D$.
The algorithm described above is a well known result from the literature [1].
[1] Wikipedia
MathematicalSystems.EulerDiscretization
— TypeEulerDiscretization <: AbstractDiscretizationAlgorithm
Euler discretization algorithm for affine systems.
Algorithm
This algorithm consists of a first-order approximation to obtain an associated difference equation. The algorithm applies to any system of the form x' = Ax + Bu + c + Dw
, and other system types, e.g. linear systems x' = Ax
which are included in the above formulation.
Without loss of generality, consider a NoisyAffineControlledContinuousSystem
with system dynamics $x' = Ax + Bu + c + Dw$.
The Euler discretization is calculated by taking the first-order approximation of the exact discretization ExactDiscretization
. The resulting discretization writes as $x^+ = A^d x + B^d u + c^d + D^d w$ where $A^d = I + ΔT ~ A$, $B^d = ΔT ~ B$, $c^d = ΔT ~ c$ and $D^d = ΔT ~ D$.
The algorithm described above is a well-known result from the literature [1].
[1] Wikipedia
Initial Value Problems
MathematicalSystems.InitialValueProblem
— TypeInitialValueProblem{S <: AbstractSystem, XT} <: AbstractSystem
Parametric composite type for initial value problems. It is parameterized in the system's type and the initial state's type
Fields
s
– systemx0
– initial state
Examples
The linear system $x' = -x$ with initial condition $x₀ = [-1/2, 1/2]$:
julia> s = LinearContinuousSystem([-1.0 0.0; 0.0 -1.0]);
julia> x₀ = [-1/2, 1/2];
julia> p = InitialValueProblem(s, x₀);
julia> initial_state(p) # same as p.x0
2-element Vector{Float64}:
-0.5
0.5
julia> statedim(p)
2
julia> inputdim(p)
0
MathematicalSystems.IVP
— TypeIVP
IVP
is an alias for InitialValueProblem
.
MathematicalSystems.initial_state
— Functioninitial_state(ivp::InitialValueProblem)
Return the initial state of an initial-value problem.
Input
ivp
– initial-value problem
Output
The initial state of an initial-value problem.
MathematicalSystems.system
— Functionsystem(ivp::InitialValueProblem)
Return the system wrapped by an initial-value problem.
Input
ivp
– initial-value problem
Output
The system of the given initial-value problem.
Identity Operator
MathematicalSystems.IdentityMultiple
— TypeIdentityMultiple{T} < AbstractMatrix{T} where T
A scalar multiple of the identity matrix of given order and numeric type.
Fields
M
– uniform scaling operator of typeT
n
– size of the identity matrix
Notes
This type can be used to create multiples of the identity of given size. Since only the multiple and the order are stored, the allocations are minimal.
Internally, the type wraps Julia's lazy multiple of the identity operator, UniformScaling
. IdentityMultiple
subtypes AbstractMatrix
, hence it can be used in usual matrix arithmetic and for dispatch on AbstractMatrix
.
The difference between UniformScaling
and IdentityMultiple
is that while the size of the former is generic, the size of the latter is fixed.
Examples
Only specifying the matrix size represents an identity matrix:
julia> using MathematicalSystems: IdentityMultiple
julia> I2 = Id(2)
IdentityMultiple{Float64} of value 1.0 and order 2
julia> I2 + I2
IdentityMultiple{Float64} of value 2.0 and order 2
julia> 4*I2
IdentityMultiple{Float64} of value 4.0 and order 2
The scaling (default 1.0
) can be passed as the second argument:
julia> I2r = Id(2, 1//1)
IdentityMultiple{Rational{Int64}} of value 1//1 and order 2
julia> I2r + I2r
IdentityMultiple{Rational{Int64}} of value 2//1 and order 2
julia> 4*I2r
IdentityMultiple{Rational{Int64}} of value 4//1 and order 2
Alternatively, use the constructor passing the UniformScaling
(I
):
julia> using LinearAlgebra
julia> I2 = IdentityMultiple(2.0*I, 2)
IdentityMultiple{Float64} of value 2.0 and order 2
julia> I2r = IdentityMultiple(2//1*I, 2)
IdentityMultiple{Rational{Int64}} of value 2//1 and order 2
MathematicalSystems.Id
— FunctionId(n::Int, [λ]::Number=1.0)
Convenience constructor of an IdentityMultiple
.
Input
n
– dimensionλ
– (optional; default:1.0
) scaling factor
Output
An IdentityMultiple
of the given size and scaling factor.
Input Types
MathematicalSystems.AbstractInput
— TypeAbstractInput
Abstract supertype for all input types.
Notes
The input types defined here implement an iterator interface, such that other methods can build upon the behavior of inputs which are either constant or varying.
Iteration is supported with an index number called iterator state. The iteration function Base.iterate
takes and returns a tuple (input
, state
), where input
represents the value of the input, and state
is an index which counts the number of times this iterator was called.
A convenience function nextinput(input, n)
is also provided and it returns the first n
elements of input
.
MathematicalSystems.ConstantInput
— TypeConstantInput{UT} <: AbstractInput
Type representing an input that remains constant in time.
Fields
U
– input set
Examples
The constant input holds a single element and its length is infinite. To access the field U
, you can use Base's iterate
given a state, or the method nextinput
given the number of desired input elements:
julia> c = ConstantInput(-1//2)
ConstantInput{Rational{Int64}}(-1//2)
julia> iterate(c, 1)
(-1//2, nothing)
julia> iterate(c, 2)
(-1//2, nothing)
julia> collect(nextinput(c, 4))
4-element Vector{Rational{Int64}}:
-1//2
-1//2
-1//2
-1//2
The elements of this input are rational numbers:
julia> eltype(c)
Rational{Int64}
To transform a constant input, you can use map
as in:
julia> map(x->2*x, c)
ConstantInput{Rational{Int64}}(-1//1)
MathematicalSystems.VaryingInput
— TypeVaryingInput{UT, VUT<:AbstractVector{UT}} <: AbstractInput
Type representing an input that may vary with time.
Fields
U
– vector of input sets
Examples
The varying input holds a vector and its length equals the number of elements in the vector. Consider an input given by a vector of rational numbers:
julia> v = VaryingInput([-1//2, 1//2])
VaryingInput{Rational{Int64}, Vector{Rational{Int64}}}(Rational{Int64}[-1//2, 1//2])
julia> length(v)
2
julia> eltype(v)
Rational{Int64}
Base's iterate
method receives the input and an integer state and returns the input element and the next iteration state:
julia> iterate(v, 1)
(-1//2, 2)
julia> iterate(v, 2)
(1//2, 3)
The method nextinput
receives a varying input and an integer n
and returns an iterator over the first n
elements of this input (where n=1
by default):
julia> typeof(nextinput(v))
Base.Iterators.Take{VaryingInput{Rational{Int64}, Vector{Rational{Int64}}}}
julia> collect(nextinput(v, 1))
1-element Vector{Rational{Int64}}:
-1//2
julia> collect(nextinput(v, 2))
2-element Vector{Rational{Int64}}:
-1//2
1//2
You can collect the inputs in an array, or equivalently use list comprehension, (or use a for
loop):
julia> collect(v)
2-element Vector{Rational{Int64}}:
-1//2
1//2
julia> [3*vi for vi in v]
2-element Vector{Rational{Int64}}:
-3//2
3//2
Since this input type is finite, querying more elements than its length returns the full vector:
julia> collect(nextinput(v, 4))
2-element Vector{Rational{Int64}}:
-1//2
1//2
To transform a varying input, you can use map
as in:
julia> map(x->3*x, v)
VaryingInput{Rational{Int64}, Vector{Rational{Int64}}}(Rational{Int64}[-3//2, 3//2])
Maps
MathematicalSystems.AbstractMap
— TypeAbstractMap
Abstract supertype for all map types.
MathematicalSystems.IdentityMap
— TypeIdentityMap
An identity map
\[ x ↦ x.\]
Fields
dim
– dimension
MathematicalSystems.ConstrainedIdentityMap
— TypeConstrainedIdentityMap
An identity map with state constraints of the form
\[ x ↦ x, x ∈ \mathcal{X}.\]
Fields
dim
– dimensionX
– state constraints
MathematicalSystems.LinearMap
— TypeLinearMap
A linear map
\[ x ↦ Ax\]
Fields
A
– matrix
MathematicalSystems.ConstrainedLinearMap
— TypeConstrainedLinearMap
A linear map with state constraints of the form
\[ x ↦ Ax, x ∈ \mathcal{X}.\]
Fields
A
– matrixX
– state constraints
MathematicalSystems.AffineMap
— TypeAffineMap
An affine map
\[ x ↦ Ax + c.\]
Fields
A
– matrixc
– vector
MathematicalSystems.ConstrainedAffineMap
— TypeConstrainedAffineMap
An affine map with state constraints of the form
\[ x ↦ Ax + c, x ∈ \mathcal{X}.\]
Fields
A
– matrixc
– vectorX
– state constraints
MathematicalSystems.LinearControlMap
— TypeLinearControlMap
A linear control map
\[ (x, u) ↦ Ax + Bu.\]
Fields
A
– matrixB
– matrix
MathematicalSystems.ConstrainedLinearControlMap
— TypeConstrainedLinearControlMap
A linear control map with state and input constraints
\[ (x, u) ↦ Ax + Bu, x ∈ \mathcal{X}, u ∈ \mathcal{U}.\]
Fields
A
– matrixB
– matrixX
– state constraintsU
– input constraints
MathematicalSystems.AffineControlMap
— TypeAffineControlMap
An affine control map
\[ (x, u) ↦ Ax + Bu + c.\]
Fields
A
– matrixB
– matrixc
– vector
MathematicalSystems.ConstrainedAffineControlMap
— TypeConstrainedAffineControlMap
An affine control map with state and input constraints
\[ (x, u) ↦ Ax + Bu + c, x ∈ \mathcal{X}, u ∈ \mathcal{U}.\]
Fields
A
– matrixB
– matrixc
– vectorX
– state constraintsU
– input constraints
MathematicalSystems.ResetMap
— TypeResetMap
A reset map
\[ x ↦ R(x),\]
such that a subset of the variables is given a specified value, and the rest are unchanged.
Fields
dim
– dimensiondict
– dictionary whose keys are the indices of the variables that are reset, and whose values are the new values
MathematicalSystems.ConstrainedResetMap
— TypeConstrainedResetMap
A reset map with state constraints of the form
\[ x ↦ R(x), x ∈ \mathcal{X},\]
such that the specified variables are assigned a given value, and the remaining variables are unchanged.
Fields
dim
– dimensionX
– state constraintsdict
– dictionary whose keys are the indices of the variables that are reset, and whose values are the new values
MathematicalSystems.BlackBoxMap
— TypeBlackBoxMap
A black-box map of the form
\[ x ↦ h(x).\]
Fields
dim
– state dimensionoutput_dim
– output dimensionh
– output function
MathematicalSystems.ConstrainedBlackBoxMap
— TypeConstrainedBlackBoxMap
A constrained black-box map of the form
\[ x ↦ h(x), x ∈ \mathcal{X}.\]
Fields
dim
– state dimensionoutput_dim
– output dimensionh
– output functionX
– state constraints
MathematicalSystems.BlackBoxControlMap
— TypeBlackBoxControlMap
A black-box control map of the form
\[ (x, u) ↦ h(x, u).\]
Fields
dim
– state dimensioninput_dim
– input dimensionoutput_dim
– output dimensionh
– output function
MathematicalSystems.ConstrainedBlackBoxControlMap
— TypeConstrainedBlackBoxControlMap
A constrained black-box control map of the form
\[ (x, u) ↦ h(x, u), x ∈ \mathcal{X}, u ∈ \mathcal{U}.\]
Fields
dim
– state dimensioninput_dim
– input dimensionoutput_dim
– output dimensionh
– output functionX
– state constraintsU
– input constraints
Systems with Output
MathematicalSystems.SystemWithOutput
— TypeSystemWithOutput{ST<:AbstractSystem, MT<:AbstractMap} <: AbstractSystem
Parametric composite type for systems with outputs. It is parameterized in the system's type (ST
) and in the map's type (MT
).
Fields
s
– system of typeST
outputmap
– output map of typeMT
MathematicalSystems.LinearTimeInvariantSystem
— FunctionLinearTimeInvariantSystem(A, B, C, D)
A linear time-invariant system with of the form
\[x' = Ax + Bu,\\ y = Cx + Du.\]
Input
A
– matrixB
– matrixC
– matrixD
– matrix
Output
A system with output such that the system is a linear control continuous system and the output map is a linear control map.
LinearTimeInvariantSystem(A, B, C, D, X, U)
A linear time-invariant system with state and input constraints of the form
\[x' = Ax + Bu,\\ y = Cx + Du,\]
where $x(t) ∈ X$ and $u(t) ∈ U$ for all $t$.
Input
A
– matrixB
– matrixC
– matrixD
– matrixX
– state constraintsU
– input constraints
Output
A system with output such that the system is a constrained linear control continuous system and the output map is a constrained linear control map.
MathematicalSystems.LTISystem
— FunctionLTISystem
LTISystem
is an alias for LinearTimeInvariantSystem
.
Vector Fields
MathematicalSystems.VectorField
— TypeVectorField{T<:Function}
Type that computes the vector field of an AbstractContinuousSystem
.
Fields
field
– function for calculating the vector field
Macros
MathematicalSystems.@system
— Macrosystem(expr...)
Return an instance of the system type corresponding to the given expressions.
Input
expr
– expressions separated by commas which define the dynamic equation, the constraint sets or the dimensionality of the system
Output
A system that best matches the given expressions.
Notes
Terms. The expression expr
contains one or more of the following sub-expressions:
- dynamic equation, either continuous, e.g.
x' = Ax
, or discrete, e.g.x⁺ = Ax
- set constraints, e.g.
x ∈ X
- input constraints, e.g.
u ∈ U
- dimensionality, e.g.
dim: (2,1)
ordim = 1
- specification of the input variable, e.g.
input: u
orinput = u
- specification of the noise variable, e,g,
noise: w
ornoise = w
The macro call is then formed by separating the previous sub-expressions (which we simply call terms hereafter), as in:
@system(dynamic eq., set constr., input constr., input specif., noise spec., dimens.)
The different terms that compose the system's definition do not have to appear in any particular order. Moreover, the only mandatory term is the dynamic equation; the other terms are optional and default values may apply depending on the system type; this is explained next.
Dynamic equation. The time derivative in a continuous system is specified by using '
, as in x' = A*x
. A discrete system is specified using ⁺
(which can be written with the combination of keys \^+[TAB]
), as in x⁺ = A*x
. Moreover, the asterisk denoting matrix-vector products is optional. For instance, both x' = Ax
and x' = A*x
are parsed as the linear continuous system whose state matrix is A
. The matrix is supposed to be defined at the call site.
Default values. When the dynamic equation is parsed, the variable on the left-hand side is interpreted as the state variable. The input variable is by default u
and the noise variable is by default w
. If we want to change the default name of the input variable, this can be done by adding the term input: var
(or equivalently, input=var)
where var
corresponds to the new name of the input variable, eg. @system(x' = A*x + B*v, input:v)
. Similarly, a noise variable is specified with noise: var
or noise=var
.
Exceptions. The following exceptions and particular cases apply:
If the right-hand side has the form
A*x + B*foo
,A*x + B*foo + c
orf(x, foo)
, the equation is parsed as a controlled linear (affine) or controlled black-box system with inputfoo
. Note that in this case,input
variable does not correspond to the default value ofu
, butfoo
is parsed as being the input.If the left-hand side contains a multiplicative term in the form
E*x⁺
orE*x'
, the equation is parsed as an algebraic equation and hence gives rise to a descriptor system. In this case, the asterisk*
operator is mandatory.Systems of the form
x' = α*x
whereα
is a scalar are parsed as linear systems. The default dimension is1
andα
is parsed asFloat64
; if the system is higher-dimensional, usedim
, as inx' = 2x, dim=3
.
Examples
Let us first create a continuous linear system using this macro:
julia> A = [1. 0; 0 1.];
julia> @system(x' = A*x)
LinearContinuousSystem{Float64, Matrix{Float64}}([1.0 0.0; 0.0 1.0])
A discrete system is defined by using ⁺
:
julia> @system(x⁺ = A*x)
LinearDiscreteSystem{Float64, Matrix{Float64}}([1.0 0.0; 0.0 1.0])
Additionally, a set definition x ∈ X
can be added to create a constrained system. For example, a discrete controlled affine system with constrained states and inputs writes as:
julia> using LazySets
julia> B = Matrix([1.0 0.5]');
julia> c = [1.0, 1.5];
julia> X = BallInf(zeros(2), 10.0);
julia> U = BallInf(zeros(1), 2.0);
julia> @system(x' = A*x + B*u + c, x ∈ X, u ∈ U)
ConstrainedAffineControlContinuousSystem{Float64, Matrix{Float64}, Matrix{Float64}, Vector{Float64}, BallInf{Float64, Vector{Float64}}, BallInf{Float64, Vector{Float64}}}([1.0 0.0; 0.0 1.0], [1.0; 0.5;;], [1.0, 1.5], BallInf{Float64, Vector{Float64}}([0.0, 0.0], 10.0), BallInf{Float64, Vector{Float64}}([0.0], 2.0))
For the creation of a black-box system, the state, input and noise dimensions have to be defined separately. For a constrained controlled black-box system, the macro writes as
julia> f(x, u) = x + u;
julia> @system(x⁺ = f(x, u), x ∈ X, u ∈ U, dim: (2,2))
ConstrainedBlackBoxControlDiscreteSystem{typeof(f), BallInf{Float64, Vector{Float64}}, BallInf{Float64, Vector{Float64}}}(f, 2, 2, BallInf{Float64, Vector{Float64}}([0.0, 0.0], 10.0), BallInf{Float64, Vector{Float64}}([0.0], 2.0))
MathematicalSystems.@ivp
— Macroivp(expr...)
Return an instance of the initial-value problem type corresponding to the given expressions.
Input
expr
– expressions separated by commas which define the dynamic equation, the constraint sets or the dimensionality of the system, and the set of initial states (required)
Output
An initial-value problem that best matches the given expressions.
Notes
This macro behaves like the @system
macro, the sole difference being that in @ivp
the constraint on the set of initial states is mandatory. For the technical details we refer to the documentation of @system
.
The macro can also be called with a system
argument of type AbstractSystem
in the form @ivp(system, state(0) ∈ initial_set)
.
Examples
julia> p = @ivp(x' = -x, x(0) ∈ [1.0]);
julia> typeof(p)
InitialValueProblem{LinearContinuousSystem{Float64, IdentityMultiple{Float64}}, Vector{Float64}}
julia> initial_state(p)
1-element Vector{Float64}:
1.0
julia> sys = @system(x' = [1 0; 0 1] * x);
julia> @ivp(sys, x(0) ∈ [-1, 1])
InitialValueProblem{LinearContinuousSystem{Int64, Matrix{Int64}}, Vector{Int64}}(LinearContinuousSystem{Int64, Matrix{Int64}}([1 0; 0 1]), [-1, 1])
MathematicalSystems.@map
— Macromap(ex, args)
Return an instance of the map type corresponding to the given expression.
Input
ex
– an expression defining the map, in the form of an anonymous functionargs
– additional optional arguments
Output
A map that best matches the given expression.
Examples
Let us first create a linear map using this macro:
julia> @map x -> [1 0; 0 0]*x
LinearMap{Int64, Matrix{Int64}}([1 0; 0 0])
We can create an affine system as well:
julia> @map x -> [1 0; 0 0]*x + [2, 0]
AffineMap{Int64, Matrix{Int64}, Vector{Int64}}([1 0; 0 0], [2, 0])
Additional arguments can be passed to @map
using the function-call form, i.e. separating the arguments by commas, and using parentheses around the macro call. For example, an identity map of dimension 5 can be defined as:
julia> @map(x -> x, dim=5)
IdentityMap(5)
A state constraint on such map can be specified passing the additional argument x ∈ X
.
An identity map can alternatively be created by giving a the size of the identity matrix as Id(n)
, for example:
julia> @map x -> Id(5)*x
IdentityMap(5)