Class PIDController

java.lang.Object
neqsim.process.ml.controllers.PIDController
All Implemented Interfaces:
Serializable, Controller

public class PIDController extends Object implements Controller
PID controller for setpoint tracking with integral and derivative action.

action = Kp * error + Ki * integral(error) + Kd * d(error)/dt

Version:
1.0
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • name

      private final String name
    • errorIndex

      private final int errorIndex
    • kp

      private final double kp
    • ki

      private final double ki
    • kd

      private final double kd
    • actionMin

      private final double actionMin
    • actionMax

      private final double actionMax
    • dt

      private final double dt
    • integral

      private double integral
    • previousError

      private double previousError
    • firstStep

      private boolean firstStep
  • Constructor Details

    • PIDController

      public PIDController(String name, int errorIndex, double kp, double ki, double kd, double actionMin, double actionMax, double dt)
      Create PID controller.
      Parameters:
      name - controller name
      errorIndex - index of error in observation array
      kp - proportional gain
      ki - integral gain
      kd - derivative gain
      actionMin - minimum action value
      actionMax - maximum action value
      dt - time step for integration
  • Method Details

    • computeAction

      public double[] computeAction(double[] observation)
      Description copied from interface: Controller
      Compute control action based on observation.
      Specified by:
      computeAction in interface Controller
      Parameters:
      observation - normalized observation array
      Returns:
      action array
    • reset

      public void reset()
      Description copied from interface: Controller
      Reset controller state (for stateful controllers like PID).
      Specified by:
      reset in interface Controller
    • getName

      public String getName()
      Description copied from interface: Controller
      Get controller name.
      Specified by:
      getName in interface Controller
      Returns:
      name
    • getIntegral

      public double getIntegral()
      Get current integral value.
      Returns:
      integral