The systems package#

Submodules#

mpt4py.systems.lti_system module#

class mpt4py.systems.lti_system.LTISystem(*args, **kwargs)[source]#

Bases: StateSpace, SystemBase

Linear Time Invariant (LTI) System.

This is a wrapper of the LTI class in Python Control Library.

property Q: ndarray[tuple[Any, ...], dtype[float64]]#
property Qf: ndarray[tuple[Any, ...], dtype[float64]]#
property R: ndarray[tuple[Any, ...], dtype[float64]]#
control_invariant_set()[source]#

Compute the control invariant set of the given MPC controller.

discretize(Ts: float, *args, **kwargs) LTISystem[source]#
property input_constraints: Polyhedron#
invariant_set(K: ndarray[tuple[Any, ...], dtype[float64]], max_itr: int | None = 100, verbose: bool | None = False) Tuple[Polyhedron, bool][source]#

Compute the (maximal) invariant set using the given terminal controller \(u=Kx\).

property lqr_gain: ndarray[tuple[Any, ...], dtype[float64]]#

Compute the infinite-horizon LQR gain \(u=Kx\).

property lqr_set: Tuple[Polyhedron, bool]#

Compute the (maximal) invariant set using infinite-horizon LQR as the terminal controller.

property state_constraints: Polyhedron#
property terminal_constraints: Polyhedron#
property u_ref: ndarray[tuple[Any, ...], dtype[float64]]#
property x_ref: ndarray[tuple[Any, ...], dtype[float64]]#

mpt4py.systems.system_base module#

class mpt4py.systems.system_base.SystemBase(*args, **kwargs)[source]#

Bases: ABC, InputOutputSystem

Base class for all continuous-time dynamical systems.

cost(x: ndarray[tuple[Any, ...], dtype[float64]], u: ndarray[tuple[Any, ...], dtype[float64]]) float[source]#
abstractmethod discretize(Ts: float, *args, **kwargs) SystemBase[source]#
dynamics() ndarray[source]#

The system dynamics. If the system is continuous, return x_dot. If the system is discrete, return x_plus.

property nu: int#
property nx: int#
property ny: int#

Module contents#

class mpt4py.systems.LTISystem(*args, **kwargs)[source]

Bases: StateSpace, SystemBase

Linear Time Invariant (LTI) System.

This is a wrapper of the LTI class in Python Control Library.

property Q: ndarray[tuple[Any, ...], dtype[float64]]
property Qf: ndarray[tuple[Any, ...], dtype[float64]]
property R: ndarray[tuple[Any, ...], dtype[float64]]
control_invariant_set()[source]

Compute the control invariant set of the given MPC controller.

discretize(Ts: float, *args, **kwargs) LTISystem[source]
property input_constraints: Polyhedron
invariant_set(K: ndarray[tuple[Any, ...], dtype[float64]], max_itr: int | None = 100, verbose: bool | None = False) Tuple[Polyhedron, bool][source]

Compute the (maximal) invariant set using the given terminal controller \(u=Kx\).

property lqr_gain: ndarray[tuple[Any, ...], dtype[float64]]

Compute the infinite-horizon LQR gain \(u=Kx\).

property lqr_set: Tuple[Polyhedron, bool]

Compute the (maximal) invariant set using infinite-horizon LQR as the terminal controller.

property state_constraints: Polyhedron
property terminal_constraints: Polyhedron
property u_ref: ndarray[tuple[Any, ...], dtype[float64]]
property x_ref: ndarray[tuple[Any, ...], dtype[float64]]
class mpt4py.systems.SystemBase(*args, **kwargs)[source]

Bases: ABC, InputOutputSystem

Base class for all continuous-time dynamical systems.

cost(x: ndarray[tuple[Any, ...], dtype[float64]], u: ndarray[tuple[Any, ...], dtype[float64]]) float[source]
abstractmethod discretize(Ts: float, *args, **kwargs) SystemBase[source]
dynamics() ndarray[source]

The system dynamics. If the system is continuous, return x_dot. If the system is discrete, return x_plus.

property nu: int
property nx: int
property ny: int