Controller

class Controller.PIDController(Kp, Ki, Kd, setpoint)[source]

A PID (Proportional-Integral-Derivative) controller for computing control output based on the difference between a setpoint and a process value.

__init__(Kp, Ki, Kd, setpoint)[source]

Initialize the PID controller with the given parameters. It is assumed that the setpoint is a function of the PID controller and that the parameters are in the form of numpy arrays.

Parameters:
  • Kp (float or numpy.ndarray) – The proportional gain parameter.

  • Ki (float or numpy.ndarray) – The integral gain parameter.

  • Kd (float or numpy.ndarray) – The derivative gain parameter.

  • setpoint (float) – The target value for the PID controller.

calculate(process_value)[source]

Calculate the PID output for a given process value.

Parameters:

process_value (float) – The value of the process to be controlled.

Returns:

The output of the PID controller.

Return type:

float

set_goal(setpoint)[source]

Set the goal that will be used for this step.

Parameters:

setpoint (float) – The goal to be reached.