Class DisturbanceVariable

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

public class DisturbanceVariable extends MPCVariable
Represents a disturbance variable (DV) in an MPC formulation.

A disturbance variable is a measured process input that affects the controlled variables but cannot be manipulated by the controller. DVs are used for feedforward control - the MPC uses knowledge of disturbances to proactively adjust manipulated variables before the disturbance affects the outputs.

Common examples include:

  • Feed flow rate
  • Feed composition
  • Ambient temperature
  • Upstream pressure

Example usage:


// Feed flow as disturbance
DisturbanceVariable feedFlowDV =
    new DisturbanceVariable("FeedFlow", feedStream, "flowRate", "kg/hr");

// Ambient temperature as disturbance
DisturbanceVariable ambientDV =
    new DisturbanceVariable("Ambient").setUnit("C").setCurrentValue(25.0); // Manual update from
                                                                           // external source

Since:
3.0
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • previousValue

      private double previousValue
      Previous value for calculating rate of change.
    • predictedValue

      private double predictedValue
      Predicted future value (if available).
    • predictionHorizon

      private double predictionHorizon
      Time horizon for prediction (if available).
    • measured

      private boolean measured
      Whether this is a measured or estimated disturbance.
    • cvSensitivity

      private double[] cvSensitivity
      Sensitivity of CVs to this disturbance (for feedforward).
  • Constructor Details

    • DisturbanceVariable

      public DisturbanceVariable(String name)
      Construct a disturbance variable with a name.
      Parameters:
      name - unique identifier for this DV
    • DisturbanceVariable

      public DisturbanceVariable(String name, ProcessEquipmentInterface equipment, String propertyName)
      Construct a disturbance variable bound to equipment.
      Parameters:
      name - unique identifier for this DV
      equipment - the process equipment to monitor
      propertyName - the property to read
    • DisturbanceVariable

      public DisturbanceVariable(String name, ProcessEquipmentInterface equipment, String propertyName, String unit)
      Construct a disturbance variable bound to equipment with unit.
      Parameters:
      name - unique identifier for this DV
      equipment - the process equipment to monitor
      propertyName - the property to read
      unit - the unit for the property value
  • Method Details

    • getType

      public MPCVariable.MPCVariableType getType()
      Description copied from class: MPCVariable
      Get the type of this MPC variable.
      Specified by:
      getType in class MPCVariable
      Returns:
      the variable type (MV, CV, or DV)
    • getPreviousValue

      public double getPreviousValue()
      Get the previous value.
      Returns:
      the previous measurement
    • getRateOfChange

      public double getRateOfChange()
      Get the rate of change.
      Returns:
      change from previous to current value
    • getPredictedValue

      public double getPredictedValue()
      Get the predicted future value.
      Returns:
      the predicted value (if available)
    • setPrediction

      public DisturbanceVariable setPrediction(double value, double horizon)
      Set the predicted future value for feedforward control.
      Parameters:
      value - the predicted value
      horizon - the time horizon for the prediction
      Returns:
      this variable for method chaining
    • getPredictionHorizon

      public double getPredictionHorizon()
      Get the prediction time horizon.
      Returns:
      the horizon in time units
    • isMeasured

      public boolean isMeasured()
      Check if this is a measured disturbance.
      Returns:
      true if measured, false if estimated
    • setMeasured

      public DisturbanceVariable setMeasured(boolean measured)
      Set whether this disturbance is measured or estimated.
      Parameters:
      measured - true for measured, false for estimated
      Returns:
      this variable for method chaining
    • getCvSensitivity

      public double[] getCvSensitivity()
      Get the sensitivity of CVs to this disturbance.
      Returns:
      array of sensitivities (∂CV/∂DV)
    • setCvSensitivity

      public DisturbanceVariable setCvSensitivity(double... sensitivity)
      Set the sensitivity of CVs to this disturbance.

      Used by the MPC for feedforward compensation. Entry i is ∂CV[i]/∂DV.

      Parameters:
      sensitivity - array of sensitivities
      Returns:
      this variable for method chaining
    • setBounds

      public DisturbanceVariable setBounds(double min, double max)
      Description copied from class: MPCVariable
      Set bounds for this variable.
      Overrides:
      setBounds in class MPCVariable
      Parameters:
      min - minimum allowed value
      max - maximum allowed value
      Returns:
      this variable for method chaining
    • setEquipment

      public DisturbanceVariable setEquipment(ProcessEquipmentInterface equipment)
      Description copied from class: MPCVariable
      Set the bound equipment.
      Overrides:
      setEquipment in class MPCVariable
      Parameters:
      equipment - the process equipment to bind to
      Returns:
      this variable for method chaining
    • setPropertyName

      public DisturbanceVariable setPropertyName(String propertyName)
      Description copied from class: MPCVariable
      Set the property name to read/write.
      Overrides:
      setPropertyName in class MPCVariable
      Parameters:
      propertyName - the property name
      Returns:
      this variable for method chaining
    • setUnit

      public DisturbanceVariable setUnit(String unit)
      Description copied from class: MPCVariable
      Set the unit for this variable.
      Overrides:
      setUnit in class MPCVariable
      Parameters:
      unit - the unit string
      Returns:
      this variable for method chaining
    • setCurrentValue

      public void setCurrentValue(double value)
      Description copied from class: MPCVariable
      Set the current value (used for caching/tracking).
      Overrides:
      setCurrentValue in class MPCVariable
      Parameters:
      value - the current value
    • readValue

      public double readValue()
      Description copied from class: MPCVariable
      Read the current value from the bound equipment.

      This method uses reflection or equipment-specific accessors to read the property value. The implementation varies by variable type and property.

      Specified by:
      readValue in class MPCVariable
      Returns:
      the current value read from equipment
    • update

      public DisturbanceVariable update(double value)
      Update the disturbance value from an external source.

      Used when the disturbance is not directly readable from NeqSim equipment (e.g., ambient conditions from external sensors).

      Parameters:
      value - the new value
      Returns:
      this variable for method chaining
    • getExpectedCvChange

      public double getExpectedCvChange(int cvIndex)
      Calculate the expected change in a CV due to this disturbance change.
      Parameters:
      cvIndex - the index of the CV
      Returns:
      the expected CV change
    • getExpectedCvChangeFromPrediction

      public double getExpectedCvChangeFromPrediction(int cvIndex)
      Calculate the expected change in a CV due to predicted disturbance.
      Parameters:
      cvIndex - the index of the CV
      Returns:
      the expected CV change from predicted disturbance