Class StepResponse

java.lang.Object
neqsim.process.mpc.StepResponse
All Implemented Interfaces:
Serializable

public class StepResponse extends Object implements Serializable
Represents a step response from a single input to a single output.

A step response captures how a controlled variable responds over time to a step change in a manipulated variable. This data is used for system identification and model-based control.

The class provides methods to:

  • Access raw step response data
  • Fit first-order plus dead-time (FOPDT) models
  • Fit second-order plus dead-time (SOPDT) models
  • Export step coefficients for DMC-style controllers
Since:
3.0
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • mvName

      private final String mvName
      Name of the manipulated variable.
    • cvName

      private final String cvName
      Name of the controlled variable.
    • time

      private final double[] time
      Time points (in seconds).
    • response

      private final double[] response
      CV response values at each time point.
    • stepSize

      private final double stepSize
      Step size applied to MV.
    • baselineValue

      private final double baselineValue
      Baseline CV value before step.
    • sampleTime

      private final double sampleTime
      Sample time interval.
    • cvUnit

      private final String cvUnit
      Unit for the CV.
    • mvUnit

      private final String mvUnit
      Unit for the MV.
    • fittedGain

      private double fittedGain
    • fittedTimeConstant

      private double fittedTimeConstant
    • fittedDeadTime

      private double fittedDeadTime
    • fittedBias

      private double fittedBias
    • fitError

      private double fitError
  • Constructor Details

    • StepResponse

      public StepResponse(String mvName, String cvName, double[] time, double[] response, double stepSize, double baselineValue, double sampleTime, String mvUnit, String cvUnit)
      Construct a step response.
      Parameters:
      mvName - name of the manipulated variable
      cvName - name of the controlled variable
      time - array of time points (seconds)
      response - array of CV response values
      stepSize - the step size applied to MV
      baselineValue - CV value before the step
      sampleTime - sample interval in seconds
      mvUnit - unit for MV
      cvUnit - unit for CV
  • Method Details

    • getMvName

      public String getMvName()
      Get the MV name.
      Returns:
      manipulated variable name
    • getCvName

      public String getCvName()
      Get the CV name.
      Returns:
      controlled variable name
    • getTime

      public double[] getTime()
      Get the time array.
      Returns:
      copy of time points
    • getResponse

      public double[] getResponse()
      Get the response array.
      Returns:
      copy of response values
    • getNormalizedResponse

      public double[] getNormalizedResponse()
      Get the normalized response (change from baseline per unit MV change).
      Returns:
      normalized step response coefficients
    • getStepSize

      public double getStepSize()
      Get the step size.
      Returns:
      the MV step magnitude
    • getBaselineValue

      public double getBaselineValue()
      Get the baseline CV value.
      Returns:
      CV value before step
    • getSampleTime

      public double getSampleTime()
      Get the sample time.
      Returns:
      sample interval in seconds
    • getNumSamples

      public int getNumSamples()
      Get the number of samples.
      Returns:
      length of response array
    • getGain

      public double getGain()
      Get the steady-state gain (Kp).

      The gain is calculated as the final response change divided by the step size.

      Returns:
      the steady-state gain
    • fitFOPDT

      public StepResponse fitFOPDT()
      Fit a first-order plus dead-time (FOPDT) model to the response.

      The FOPDT model is: y(t) = K * (1 - exp(-(t-θ)/τ)) for t > θ, else 0 where K is gain, τ is time constant, θ is dead time.

      Returns:
      this step response with fitted parameters
    • calculateFitError

      private double calculateFitError()
      Calculate the mean squared error of the FOPDT fit.
      Returns:
      the MSE
    • getTimeConstant

      public double getTimeConstant()
      Get the fitted time constant.
      Returns:
      τ in seconds
    • getDeadTime

      public double getDeadTime()
      Get the fitted dead time.
      Returns:
      θ in seconds
    • getFitError

      public double getFitError()
      Get the FOPDT fit error.
      Returns:
      mean squared error
    • getStepCoefficients

      public double[] getStepCoefficients(int numCoefficients)
      Get step response coefficients for DMC-style controllers.

      Returns the normalized step response at each sample time, which can be used directly in Dynamic Matrix Control algorithms.

      Parameters:
      numCoefficients - number of coefficients to return
      Returns:
      array of step response coefficients
    • convolve

      public double[] convolve(double[] mvMoves)
      Simulate the CV response to an MV trajectory using convolution.
      Parameters:
      mvMoves - array of MV move increments
      Returns:
      predicted CV trajectory
    • getSettlingTime

      public double getSettlingTime()
      Get the settling time (time to reach 95% of final value).
      Returns:
      settling time in seconds
    • getRiseTime

      public double getRiseTime()
      Get the rise time (time from 10% to 90% of final value).
      Returns:
      rise time in seconds
    • hasInverseResponse

      public boolean hasInverseResponse()
      Check if the response shows inverse response (wrong-way behavior).
      Returns:
      true if inverse response detected
    • toString

      public String toString()
      Overrides:
      toString in class Object