Class SteadyStateVariable

java.lang.Object
neqsim.process.util.reconciliation.SteadyStateVariable
All Implemented Interfaces:
Serializable

public class SteadyStateVariable extends Object implements Serializable
A monitored process variable for steady-state detection.

Maintains a sliding window of recent measurements and computes statistics used by SteadyStateDetector to determine whether the variable is at steady state. The key statistics are:

  • Mean and standard deviation of the window
  • R-statistic: ratio of filtered variance to unfiltered variance
  • Slope from linear regression over the window
  • Whether the variable is at steady state according to configurable thresholds

Values are added one at a time via addValue(double). The window size and all thresholds are set on the parent SteadyStateDetector.

Version:
1.0
Author:
Process Optimization Team
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean
    Whether this variable is currently at steady state.
    private double
    Current mean of the window.
    private final String
    Variable name (tag identifier).
    private double
    R-statistic: ratio of filtered variance to unfiltered variance.
    private static final long
     
    private double
    Slope of linear regression through the window values.
    private double
    Current standard deviation of the window.
    private double
    Optional measurement uncertainty (sigma) for linking to reconciliation.
    private String
    Engineering unit string (e.g., "kg/hr", "bara", "C").
    private final List<Double>
    Sliding window of recent values.
    private int
    Maximum window size.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SteadyStateVariable(String name, int windowSize)
    Creates a steady-state monitoring variable.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addValue(double value)
    Adds a new measurement value to the sliding window.
    void
    Clears all values from the window and resets statistics.
    private void
    Computes all statistics from the current window contents.
    int
    Returns the current number of values in the window.
    double
    Returns the most recent value in the window.
    double
    Returns the mean of the current window.
    Returns the variable name.
    double
    Returns the R-statistic (filtered/unfiltered variance ratio).
    double
    Returns the slope from linear regression through the window.
    double
    Returns the standard deviation of the current window.
    double
    Returns the measurement uncertainty (sigma) for reconciliation.
    Returns the engineering unit string.
    int
    Returns the maximum window size.
    Returns the values in the current window.
    boolean
    Returns whether this variable is currently at steady state.
    boolean
    Returns whether the window is full.
    (package private) void
    setAtSteadyState(boolean atSteadyState)
    Sets the steady-state flag.
    setUncertainty(double uncertainty)
    Sets the measurement uncertainty for linking to the reconciliation engine.
    Sets the engineering unit string.
    void
    setWindowSize(int windowSize)
    Sets the maximum window size.
    Returns a summary string.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • name

      private final String name
      Variable name (tag identifier).
    • unit

      private String unit
      Engineering unit string (e.g., "kg/hr", "bara", "C").
    • window

      private final List<Double> window
      Sliding window of recent values.
    • windowSize

      private int windowSize
      Maximum window size.
    • mean

      private double mean
      Current mean of the window.
    • standardDeviation

      private double standardDeviation
      Current standard deviation of the window.
    • rStatistic

      private double rStatistic
      R-statistic: ratio of filtered variance to unfiltered variance. A value near 1.0 indicates steady state; lower values indicate transient behaviour.
    • slope

      private double slope
      Slope of linear regression through the window values. Near zero indicates steady state; positive or negative values indicate a trend.
    • atSteadyState

      private boolean atSteadyState
      Whether this variable is currently at steady state.
    • uncertainty

      private double uncertainty
      Optional measurement uncertainty (sigma) for linking to reconciliation.
  • Constructor Details

    • SteadyStateVariable

      public SteadyStateVariable(String name, int windowSize)
      Creates a steady-state monitoring variable.
      Parameters:
      name - variable identifier (e.g., DCS tag name)
      windowSize - maximum number of recent values to retain
  • Method Details

    • addValue

      public void addValue(double value)
      Adds a new measurement value to the sliding window.

      If the window exceeds its maximum size, the oldest value is removed. After adding, the mean, standard deviation, R-statistic, and slope are recalculated.

      Parameters:
      value - the new measurement reading
    • computeStatistics

      private void computeStatistics()
      Computes all statistics from the current window contents.

      Calculates: mean, standard deviation, R-statistic (filtered/unfiltered variance ratio), and slope from linear regression.

    • getName

      public String getName()
      Returns the variable name.
      Returns:
      the tag name
    • getUnit

      public String getUnit()
      Returns the engineering unit string.
      Returns:
      unit string
    • setUnit

      public SteadyStateVariable setUnit(String unit)
      Sets the engineering unit string.
      Parameters:
      unit - the unit (e.g., "kg/hr")
      Returns:
      this variable for chaining
    • getCount

      public int getCount()
      Returns the current number of values in the window.
      Returns:
      count of values in the sliding window
    • getWindowSize

      public int getWindowSize()
      Returns the maximum window size.
      Returns:
      the configured window size
    • setWindowSize

      public void setWindowSize(int windowSize)
      Sets the maximum window size.
      Parameters:
      windowSize - new window size (must be at least 3)
      Throws:
      IllegalArgumentException - if windowSize is less than 3
    • isWindowFull

      public boolean isWindowFull()
      Returns whether the window is full.
      Returns:
      true if the number of values equals the window size
    • getMean

      public double getMean()
      Returns the mean of the current window.
      Returns:
      arithmetic mean
    • getStandardDeviation

      public double getStandardDeviation()
      Returns the standard deviation of the current window.
      Returns:
      sample standard deviation
    • getRStatistic

      public double getRStatistic()
      Returns the R-statistic (filtered/unfiltered variance ratio).

      The R-statistic compares the variance of successive differences (filtered variance) to the overall sample variance (unfiltered variance). At steady state, both variances are similar and R approaches 1.0. During ramps or trends, the unfiltered variance is much larger, so R drops well below 1.0.

      Returns:
      R-statistic in the range [0, 1+] where ~1 = steady state
    • getSlope

      public double getSlope()
      Returns the slope from linear regression through the window.

      Expressed in engineering-units per sample. Divide by the sampling interval to get units per second, per minute, etc.

      Returns:
      regression slope (units per sample)
    • getLatestValue

      public double getLatestValue()
      Returns the most recent value in the window.
      Returns:
      the last added value, or NaN if empty
    • getWindowValues

      public List<Double> getWindowValues()
      Returns the values in the current window.
      Returns:
      unmodifiable list of values
    • isAtSteadyState

      public boolean isAtSteadyState()
      Returns whether this variable is currently at steady state.
      Returns:
      true if at steady state
    • setAtSteadyState

      void setAtSteadyState(boolean atSteadyState)
      Sets the steady-state flag. Called by SteadyStateDetector.
      Parameters:
      atSteadyState - true if at steady state
    • getUncertainty

      public double getUncertainty()
      Returns the measurement uncertainty (sigma) for reconciliation.
      Returns:
      uncertainty, or NaN if not set
    • setUncertainty

      public SteadyStateVariable setUncertainty(double uncertainty)
      Sets the measurement uncertainty for linking to the reconciliation engine.
      Parameters:
      uncertainty - standard deviation (sigma), must be positive
      Returns:
      this variable for chaining
      Throws:
      IllegalArgumentException - if uncertainty is not positive
    • clear

      public void clear()
      Clears all values from the window and resets statistics.
    • toString

      public String toString()
      Returns a summary string.
      Overrides:
      toString in class Object
      Returns:
      human-readable representation of this variable's SSD status