Source code for mpt4py.systems.system_base

from abc import abstractmethod, ABC
import numpy as np
from typing import Optional, Union, List
import control as ct
from mpt4py.base import Matrix, Vector


[docs] class SystemBase(ABC, ct.InputOutputSystem): """ Base class for all continuous-time dynamical systems. """ def __init__(self, *args, **kwargs): ct.InputOutputSystem.__init__(self, *args, **kwargs) pass @property def nx(self) -> int: return self.nstates @property def nu(self) -> int: return self.ninputs @property def ny(self) -> int: return self.noutputs
[docs] def dynamics(self) -> np.ndarray: """ The system dynamics. If the system is continuous, return x_dot. If the system is discrete, return x_plus. """ pass
# TODO: improve this, should allow inplace options
[docs] @abstractmethod def discretize(self, Ts: float, *args, **kwargs) -> "SystemBase": pass
[docs] def cost(self, x: Vector, u: Vector) -> float: pass