Pynamics Dummy Controller

pynamics.controllers.dummy

DummyController(n_inputs, n_outputs, sampling_time)

Bases: BaseController

This class defines the dummy controller used by the pynamics package to run open-loop simulations. The controller performs no computations.

Attributes:

Name Type Description
input_dim int

The number of controller inputs.

output_dim int

The number of control actions (one for a single-output controller / single-input system).

Ts int | float

Controller sampling time.

Methods:

Name Description
info

Display a warning.

control

Compute the control actions for the next time instant. In practice, it simply outputs the value of ref.

Source code in pynamics/controllers/dummy.py
def __init__(self, n_inputs: int, n_outputs: int, sampling_time: int | float) -> None:
    """
    Class constructor.
    """

    super().__init__(n_inputs, n_outputs, sampling_time);

    return;

control(ref, y)

Computes the control actions for the next time instant.

This method outputs the control actions for the next time instant, which in this case are simply the reference values.

Parameters:

Name Type Description Default
ref ndarray

Array of reference values. For regulation problems, this should be an array of zeros.

required
y ndarray

System state vector. Used for compatibility reasons. Unused by this 'controller'.

required

Returns:

Type Description
ndarray

Array of control actions. In this case, the reference values themselves.

Source code in pynamics/controllers/dummy.py
def control(self, ref: np.ndarray, y: np.ndarray) -> np.ndarray:
    """
    Computes the control actions for the next time instant.

    This method outputs the control actions for the next time instant, which in this case are simply the reference values.

    Parameters
    ----------
    ref : np.ndarray
        Array of reference values. For regulation problems, this should be an array of zeros.

    y : np.ndarray
        System state vector. Used for compatibility reasons. Unused by this 'controller'.

    Returns
    -------
    np.ndarray
        Array of control actions. In this case, the reference values themselves.
    """

    return ref;

info()

Provides useful information regarding the controller.

This method issues a warning to the user that this 'controller' should not be used as a benchmark of any kind. It is simply used for open-loop simulations.

Source code in pynamics/controllers/dummy.py
def info(self) -> None:
    """
    Provides useful information regarding the controller.

    This method issues a warning to the user that this 'controller' should not be used \
    as a benchmark of any kind. It is simply used for open-loop simulations.
    """

    print("pynamics Dummy Controller");
    print("-------------------------");
    print("pynamics makes use of this class in open-loop simulations. \
          It is not really a controller, as its output will simply be \
          the reference signal. No computations are performed.");
    print("WARNING: for the reasons stated above, this controller should NOT be used \
          as a baseline. Its use is equivalent to an open-loop simulation.");

    return;