dynax.linearize
Functions related to input-output linearization of nonlinear systems.
Functions
|
Construct the input-output linearizing feedback for a discrete-time system. |
|
Estimate the relative degree of a SISO discrete-time system. |
|
Construct an input-output linearizing feedback law. |
|
Test controllability of linear system. |
|
Estimate the relative degree of a SISO control-affine system. |
Classes
|
Coupled discrete-time system of dynamics, reference and linearizing feedback. |
|
Coupled ODE of nonlinear dynamics, linear reference and linearizing feedback. |
- dynax.linearize.relative_degree(sys, xs, output=None)[source]
Estimate the relative degree of a SISO control-affine system.
Tests that the Lie derivatives of the output are zero exactly up but not including to the relative-degree’th order for each state in xs.
- Parameters:
sys (
AbstractControlAffine) – Continous time control-affine system with well defined relative degree and single input and output.xs (
ArrayLike) – Samples of the state space stacked along the first axis.output (
int|None) – Optional index of the output if sys has multiple outputs.
- Returns:
int– Estimated relative degree of the system.
- dynax.linearize.input_output_linearize(sys, reldeg, ref, output=None, asymptotic=None, reg=None)[source]
Construct an input-output linearizing feedback law.
- Parameters:
sys (
AbstractControlAffine) – Continous time control-affine system with well defined relative degree and single input and output.reldeg (
int) – Relative degree of sys and lower bound of relative degree of ref.ref (
LinearSystem) – Linear target system with single input and output.output (
int|None) – Optional index of the output if sys has multiple outputs.asymptotic (
Sequence|None) – If None, compute the exactly linearizing law. Otherwise, compute an asymptotically linearizing law. Then asymptotic is interpreted as the sequence of length reldeg of coefficients of the characteristic polynomial of the tracking error system.reg (
float|None) – Regularization parameter that controls the linearization effort. Only effective if asymptotic is not None.
- Returns:
Callable[[Array,Array,Array|float],Array] – Feedback law u = u(x, z, v) that input-output linearizes the system.
- dynax.linearize.discrete_relative_degree(sys, xs, us, output=None)[source]
Estimate the relative degree of a SISO discrete-time system.
Tests that exactly the first relative-degree - 1 output samples are independent of the input for each (x, u) for the initial state and input samples (xs, us). In this way, the discrete relative-degree can be interpreted as a system delay.
- Parameters:
sys (
AbstractSystem) – Discrete-time dynamical system with well defined relative degree and single input and output.xs (
ArrayLike) – Initial state samples stacked along the first axis.us (
ArrayLike) – Initial input samples stacked along the first axis.output (
int|None) – Optional index of the output if the system has multiple outputs.
- Returns:
The discrete-time relative degree of the system.
See [Lee22, def 7.7.].
- dynax.linearize.discrete_input_output_linearize(sys, reldeg, ref, output=None, solver=None)[source]
Construct the input-output linearizing feedback for a discrete-time system.
This is similar to model-predictive control with a horizon of a single time step and without constraints. The reference system can be nonlinear, in which case the feedback law implements an exact tracking controller.
- Parameters:
sys (
AbstractSystem) – Discrete-time dynamical system with well defined relative degree and single input and output.reldeg (
int) – Relative degree of sys and lower bound of relative degree of ref.ref (
AbstractSystem) – Discrete-time reference system.output (
int|None) – Optional index of the output if the sys has multiple outputs.solver (
AbstractRootFinder|None) – Root finding algorithm to solve the feedback law. Defaults tooptimistix.Newtonwith absolute and relative tolerance 1e-6.
- Returns:
Callable[[Array,Array,float,float],float] – Feedback law \(u_n = u(x_n, z_n, v_n, u_{n-1})\) that input-output linearizes the system.
See [Lee22, def 7.4.].
- class dynax.linearize.DiscreteLinearizingSystem(sys, ref, reldeg, **fb_kwargs)[source]
Bases:
AbstractSystem,_CoupledSystemMixinCoupled discrete-time system of dynamics, reference and linearizing feedback.
\[\begin{split}x_{n+1} &= f^{sys}(x_n, v_n) \\ z_{n+1} &= f^{ref}(z_n, u_n) \\ y_n &= v_n = v(x_n, z_n, u_n)\end{split}\]where \(v\) is such that \(y_n^{sys} = h^{sys}(x_n, u_n)\) equals \(y^{ref}_n = h^{ref}(z_n, u_n)\).
- Parameters:
sys (
AbstractSystem) – Discrete-time dynamical system with well defined relative degree and single input and output.ref (
AbstractSystem) – Discrete-time reference system.reldeg (
int) – Discrete relative degree of sys and lower bound of discrete relative degree of ref.fb_kwargs – Additional keyword arguments passed to
discrete_input_output_linearize().
- initial_state: Array
Initial state vector.
- class dynax.linearize.LinearizingSystem(sys, ref, reldeg, **fb_kwargs)[source]
Bases:
DynamicStateFeedbackSystemCoupled ODE of nonlinear dynamics, linear reference and linearizing feedback.
\[\begin{split}ẋ &= f(x) + g(x)v \\ ż &= Az + Bu \\ y &= v = v(x, z, u)\end{split}\]where \(v\) is such that \(y^{sys} = h(x) + i(x)v\) equals \(y^{ref} = Cz + Du\).
- Parameters:
sys (
AbstractControlAffine) – Continous time control-affine system with well defined relative degree and single input and output.ref (
LinearSystem) – Linear target system with single input and output.reldeg (
int) – Relative degree of sys and lower bound of relative degree of ref.fb_kwargs – Additional keyword arguments passed to
input_output_linearize().