Interface ControllerDeviceInterface

All Superinterfaces:
Serializable
All Known Implementing Classes:
ControllerDeviceBaseClass, IntegratedSafetySystemExample.ESDController, IntegratedSafetySystemExample.HIPPSController, ModelPredictiveController

public interface ControllerDeviceInterface extends Serializable
General contract for feedback controllers operating on measurement devices in NeqSim. Implementations typically provide proportional-integral-derivative (PID) control but the API is prepared for other regulators. The interface exposes unit-aware set points and measurements, tuning parameters, auto tuning hooks, gain scheduling and performance logging features.
Version:
$Id: $Id
Author:
Even Solbraa
  • Method Details

    • getMeasuredValue

      double getMeasuredValue()

      getMeasuredValue.

      Returns:
      a double
    • getMeasuredValue

      default double getMeasuredValue(String unit)

      getMeasuredValue.

      Parameters:
      unit - a String object
      Returns:
      a double
    • setControllerSetPoint

      void setControllerSetPoint(double signal)

      setControllerSetPoint.

      Parameters:
      signal - a double
    • setControllerSetPoint

      default void setControllerSetPoint(double signal, String unit)

      setControllerSetPoint.

      Parameters:
      signal - a double
      unit - a String object
    • getControllerSetPoint

      double getControllerSetPoint()

      getControllerSetPoint.

      Returns:
      current controller set point
    • getUnit

      String getUnit()

      getUnit.

      Returns:
      a String object
    • setUnit

      void setUnit(String unit)

      setUnit.

      Parameters:
      unit - a String object
    • setTransmitter

      void setTransmitter(MeasurementDeviceInterface device)

      setTransmitter.

      Parameters:
      device - a MeasurementDeviceInterface object
    • runTransient

      default void runTransient(double initResponse, double dt)

      runTransient.

      Calculates controller output. Sets calc identifier UUID.
      Parameters:
      initResponse - Init value for response calculation
      dt - Delta time [s]
    • runTransient

      void runTransient(double initResponse, double dt, UUID id)

      runTransient.

      Calculates controller output. Sets calc identifier UUID.
      Parameters:
      initResponse - Init value for response calculation
      dt - Delta time [s]
      id - Calculation identifier
    • getResponse

      double getResponse()

      getResponse.

      Returns:
      a double
    • isReverseActing

      boolean isReverseActing()

      isReverseActing.

      Returns:
      a boolean
    • setReverseActing

      void setReverseActing(boolean reverseActing)

      setReverseActing.

      Parameters:
      reverseActing - a boolean
    • setControllerParameters

      void setControllerParameters(double Kp, double Ti, double Td)

      Set PID tuning parameters.

      Parameters:
      Kp - Proportional gain
      Ti - Integral time in seconds
      Td - Derivative time in seconds
    • setOutputLimits

      default void setOutputLimits(double min, double max)

      Set minimum and maximum controller output for anti-windup handling.

      Parameters:
      min - Minimum controller response
      max - Maximum controller response
    • setDerivativeFilterTime

      default void setDerivativeFilterTime(double timeConstant)

      Set derivative filter time constant. Set to zero to disable filtering.

      Parameters:
      timeConstant - Filter time constant in seconds
    • autoTune

      default void autoTune(double ultimateGain, double ultimatePeriod)

      Auto tune controller using ultimate gain and period from a closed-loop test.

      Parameters:
      ultimateGain - Ultimate gain where oscillations start
      ultimatePeriod - Ultimate period of sustained oscillations [s]
    • autoTune

      default void autoTune(double ultimateGain, double ultimatePeriod, boolean tuneDerivative)

      Auto tune controller using ultimate gain and period from a closed-loop test with optional derivative tuning.

      Parameters:
      ultimateGain - Ultimate gain where oscillations start
      ultimatePeriod - Ultimate period of sustained oscillations [s]
      tuneDerivative - true to tune derivative action, false to tune PI only
    • setStepResponseTuningMethod

      default void setStepResponseTuningMethod(ControllerDeviceInterface.StepResponseTuningMethod method)

      Select the tuning correlations that should be used when calling one of the step response auto-tuning helpers.

      Parameters:
      method - tuning rule to use
    • getStepResponseTuningMethod

      default ControllerDeviceInterface.StepResponseTuningMethod getStepResponseTuningMethod()

      Retrieve the currently selected step-response tuning correlations.

      Returns:
      the active tuning method
    • autoTuneStepResponse

      default void autoTuneStepResponse(double processGain, double timeConstant, double deadTime)

      Auto tune controller from an open-loop step response using process gain, time constant and dead time.

      Parameters:
      processGain - Process gain from step response
      timeConstant - Process time constant [s]
      deadTime - Process dead time [s]
    • autoTuneStepResponse

      default void autoTuneStepResponse(double processGain, double timeConstant, double deadTime, boolean tuneDerivative)

      Auto tune controller from an open-loop step response using process gain, time constant and dead time with optional derivative tuning.

      Parameters:
      processGain - Process gain from step response
      timeConstant - Process time constant [s]
      deadTime - Process dead time [s]
      tuneDerivative - true to tune derivative action, false to tune PI only
    • autoTuneFromEventLog

      default boolean autoTuneFromEventLog()

      Automatically tune the controller parameters using the recorded controller event log. The implementation typically analyses a previously executed step test and estimates the process dynamics before calculating PID settings.

      Returns:
      true if tuning succeeded, otherwise false
    • autoTuneFromEventLog

      default boolean autoTuneFromEventLog(boolean tuneDerivative)

      Automatically tune the controller parameters using the recorded controller event log with the option to omit derivative tuning.

      Parameters:
      tuneDerivative - true to tune derivative action, false to tune PI only
      Returns:
      true if tuning succeeded, otherwise false
    • addGainSchedulePoint

      default void addGainSchedulePoint(double processValue, double Kp, double Ti, double Td)

      Add a gain schedule point that switches controller parameters when the measured value exceeds the specified threshold.

      Parameters:
      processValue - Measurement threshold for parameter set
      Kp - Proportional gain at this operating point
      Ti - Integral time [s] at this operating point
      Td - Derivative time [s] at this operating point
    • getEventLog

      default List<ControllerEvent> getEventLog()

      Retrieve the controller event log.

      Returns:
      list of controller events
    • resetEventLog

      default void resetEventLog()

      Reset the controller event log.

    • getIntegralAbsoluteError

      default double getIntegralAbsoluteError()

      Get the integral of absolute error accumulated during the simulation.

      Returns:
      integral of absolute error
    • getSettlingTime

      default double getSettlingTime()

      Get the settling time computed from the event log.

      Returns:
      settling time in seconds
    • resetPerformanceMetrics

      default void resetPerformanceMetrics()

      Reset accumulated performance metrics.

    • equals

      boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      int hashCode()
      Overrides:
      hashCode in class Object
    • setActive

      void setActive(boolean isActive)

      setActive.

      Set if controller is active
      Parameters:
      isActive - Set true to make controller active.
    • isActive

      boolean isActive()

      isActive.

      Specifies if controller is active
      Returns:
      a boolean