Nonlinear and time varying systems
Most algorithms (except HeuristicILC
) work for nonlinear and/or time varying systems.
Linear time-varying systems (LTV)
To construct an LTV system model, use the constructor LTVSystem
. LTVSystems can also be obtained by calling IterativeLearningControl2.linearize
on a NonlinearSystem
. LTV models are used in exactly the same way for ILC as LTI models.
IterativeLearningControl2.LTVSystem
— TypeLTVSystem(A::Array{T, 3}, B::Array{T, 3}, C::Array{T, 3}, D::Array{T, 3}, Ts)
Construct a time-varying system from the state-space matrices A
, B
, C
, D
and sampling time Ts
.
Arguments:
A
: A matrix of size(nx, nx, N)
wherenx
is the state dimension andN
is the number of time points.B
: A matrix of size(nx, nu, N)
wherenu
is the number of inputs.C
: A matrix of size(ny, nx, N)
whereny
is the number of outputs.D
: A matrix of size(ny, nu, N)
.Ts
: The sampling time.
LTVSystem(syss::Vector{StateSpace{Discrete}})
Construct a time-varying system from a vector of LTI statspace models.
Nonlinear systems
To construct a nonlinear system model, use the constructor NonlinearSystem
. To run ILC on a NonlinearSystem
, construct a NonlinearILCProblem
rather than the standard ILCProblem
.
Everything else behaves the same for nonlinear ILC, i.e., you still call the function ilc
to run the iterations and the function compute_input
to compute the ILC input signal manually.
IterativeLearningControl2.NonlinearSystem
— TypeNonlinearSystem{F, G}
A model representation for a discrete-time nonlinear systems on the form
\[\begin{align} x_{k+1} &= f(x_k, a_k, r_k, p, t) \\ y_k &= g(x_k, a_k, r_k, p, t) \end{align}\]
where x
is the state, a
is ILC adjustment signal, r
is the reference, p
is a parameter vector and t
is the time.
If you have continuous-time dynamics it must be discretized first, see, e.g., the package SeeToDee.jl for options.
Fields:
f::F
: The dynamics functiong::G
: The output functionnx::Int
: The number of state variablesny::Int
: The number of outputsna::Int
: The number of ILC adjustment inputsTs::Float64
: The sample time
IterativeLearningControl2.NonlinearILCProblem
— TypeNonlinearILCProblem
A nonlinear version of ILCProblem
Fields:
r
: The reference trajectory, a matrix of size(ny, N)
whereny
is the number of outputs andN
is the number of time points.model
: An instance ofNonlinearSystem
x0
: The initial statep
: An optional parameter object that will be passed to the dynamics
Linearization
A nonlinear system may be linearized around an operating point or around a trajectory using the function IterativeLearningControl2.linearize
. This function returns a StateSpace
model or an LTVSystem
.
When a NonlinearILCProblem
is solved, this is performed automatically in the method of compute_input
associated with the chosen algorithm (if the algorithm is model based).