Class SoftSensor

All Implemented Interfaces:
Serializable, MeasurementDeviceInterface, NamedInterface

public class SoftSensor extends StreamMeasurementDeviceBaseClass
Soft sensor for calculating derived properties from primary measurements and thermodynamic models.

Soft sensors provide real-time estimates of properties that cannot be directly measured, using a combination of available measurements and physics-based models. This is essential for AI-augmented production optimization.

Supported properties include:

  • Gas-Oil Ratio (GOR)
  • Water Cut
  • Density
  • Viscosity
  • Compressibility
  • Heating Value
Version:
1.0
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • propertyType

      private SoftSensor.PropertyType propertyType
    • inputValues

      private Map<String,Double> inputValues
    • lastEstimate

      private double lastEstimate
    • lastSensitivity

      private double[] lastSensitivity
  • Constructor Details

    • SoftSensor

      public SoftSensor(String name, StreamInterface stream, SoftSensor.PropertyType propertyType)
      Creates a new soft sensor.
      Parameters:
      name - the sensor name/tag
      stream - the stream to analyze
      propertyType - the property to estimate
  • Method Details

    • getUnitForProperty

      private static String getUnitForProperty(SoftSensor.PropertyType type)
      Gets the default unit for a property type.
      Parameters:
      type - property descriptor
      Returns:
      canonical engineering unit for the property
    • setInputs

      public void setInputs(Map<String,Double> inputs)
      Sets input values for the estimation.
      Parameters:
      inputs - map of input names to values
    • setInput

      public void setInput(String name, double value)
      Sets a single input value.
      Parameters:
      name - input name (e.g., "pressure", "temperature")
      value - input value
    • estimate

      public double estimate()
      Estimates the property value from current inputs.
      Returns:
      estimated property value
    • estimate

      public double estimate(Map<String,Double> inputs)
      Estimates the property value from specified inputs.
      Parameters:
      inputs - map of input values
      Returns:
      estimated property value
    • calculateProperty

      private double calculateProperty(SystemInterface fluid)
      Calculates the property from a flashed fluid.
      Parameters:
      fluid - equilibrated fluid instance
      Returns:
      property value expressed in the default unit
    • calculateGOR

      private double calculateGOR(SystemInterface fluid)
    • calculateWaterCut

      private double calculateWaterCut(SystemInterface fluid)
    • calculateHeatingValue

      private double calculateHeatingValue(SystemInterface fluid)
    • calculateBubblePoint

      private double calculateBubblePoint(SystemInterface fluid)
    • calculateDewPoint

      private double calculateDewPoint(SystemInterface fluid)
    • calculateOilFVF

      private double calculateOilFVF(SystemInterface fluid)
    • calculateGasFVF

      private double calculateGasFVF(SystemInterface fluid)
    • calculateSolutionGOR

      private double calculateSolutionGOR(SystemInterface fluid)
    • getSensitivity

      public double[] getSensitivity()
      Calculates sensitivity (Jacobian) of the output to input changes.

      Uses finite differences to estimate partial derivatives.

      Returns:
      array of sensitivities [dOutput/dPressure, dOutput/dTemperature]
    • getLastSensitivity

      public double[] getLastSensitivity()
      Gets the last calculated sensitivities.
      Returns:
      array of [dOutput/dP, dOutput/dT]
    • getUncertaintyBounds

      public UncertaintyBounds getUncertaintyBounds(double pressureUncertainty, double temperatureUncertainty)
      Gets uncertainty bounds for the estimate.
      Parameters:
      pressureUncertainty - pressure measurement uncertainty in bar
      temperatureUncertainty - temperature measurement uncertainty in K
      Returns:
      uncertainty bounds for the estimated property
    • getPropertyType

      public SoftSensor.PropertyType getPropertyType()
      Gets the property type being estimated.
      Returns:
      the property type
    • setPropertyType

      public void setPropertyType(SoftSensor.PropertyType propertyType)
      Sets the property type to estimate.
      Parameters:
      propertyType - the property type
    • getMeasuredValue

      public double getMeasuredValue(String unit)
      Description copied from class: MeasurementDeviceBaseClass

      Get Measured value in specified unit.

      Specified by:
      getMeasuredValue in interface MeasurementDeviceInterface
      Overrides:
      getMeasuredValue in class MeasurementDeviceBaseClass
      Parameters:
      unit - a String object
      Returns:
      a double