Class EnKFParameterEstimator

java.lang.Object
neqsim.process.calibration.EnKFParameterEstimator
All Implemented Interfaces:
Serializable

public class EnKFParameterEstimator extends Object implements Serializable
Ensemble Kalman Filter (EnKF) estimator for online calibration of process parameters.

This estimator uses the Ensemble Kalman Filter algorithm to estimate unknown process parameters (such as heat transfer coefficients, valve coefficients, fouling factors) by matching simulation outputs to measured plant data.

Key Features:

  • Sequential updates - processes one measurement at a time, perfect for live data
  • Uncertainty quantification - provides confidence intervals for estimates
  • Handles nonlinear models naturally through ensemble propagation
  • Anomaly detection - identifies when measurements deviate from model
  • Drift tracking - detects gradual parameter changes over time

Usage Example:


// Create estimator for a process system
EnKFParameterEstimator estimator = new EnKFParameterEstimator(processSystem);

// Define tunable parameters (what we want to estimate)
estimator.addTunableParameter("Pipe1.heatTransferCoefficient", "W/(m2·K)", 1.0, 100.0, 15.0);
estimator.addTunableParameter("Pipe2.heatTransferCoefficient", "W/(m2·K)", 1.0, 100.0, 15.0);

// Define measurements (what we observe)
estimator.addMeasuredVariable("HPManifold.temperature", "C", 0.5); // 0.5°C noise std
estimator.addMeasuredVariable("LPManifold.temperature", "C", 0.5);

// Initialize the filter
estimator.initialize(50, 42); // 50 ensemble members, seed 42

// In live loop:
Map<String, Double> measurements = getMeasurementsFromPlant();
EnKFResult result = estimator.update(measurements);

System.out.println("Estimates: " + Arrays.toString(result.getEstimates()));
System.out.println("Uncertainties: " + Arrays.toString(result.getUncertainties()));

Integration with Existing NeqSim Components:

Version:
1.0
Author:
NeqSim Development Team
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • processSystem

      private ProcessSystem processSystem
      The process system to calibrate.
    • variableAccessor

      private transient ProcessVariableAccessor variableAccessor
      Variable accessor for reading/writing process variables.
    • tunableParameters

      Tunable parameters to estimate.
    • measuredVariables

      Measured variables to match.
    • ensemble

      private double[][] ensemble
    • ensembleMean

      private double[] ensembleMean
    • ensembleStd

      private double[] ensembleStd
    • ensembleSize

      private int ensembleSize
    • rng

      private transient Random rng
    • initialized

      private boolean initialized
    • processNoiseStd

      private double processNoiseStd
    • maxChangePerUpdate

      private double maxChangePerUpdate
    • previousEstimate

      private double[] previousEstimate
    • updateCount

      private int updateCount
    • lastPrediction

      private double[] lastPrediction
    • history

  • Constructor Details

    • EnKFParameterEstimator

      public EnKFParameterEstimator(ProcessSystem processSystem)
      Creates an EnKF estimator for a process system.
      Parameters:
      processSystem - the process system to calibrate
  • Method Details

    • addTunableParameter

      public EnKFParameterEstimator addTunableParameter(String path, String unit, double minValue, double maxValue, double initialValue)
      Adds a tunable parameter to estimate.
      Parameters:
      path - variable path (e.g., "Pipe1.heatTransferCoefficient")
      unit - unit of measurement
      minValue - minimum bound
      maxValue - maximum bound
      initialValue - initial/prior value
      Returns:
      this estimator for chaining
    • addTunableParameter

      public EnKFParameterEstimator addTunableParameter(String path, String unit, double minValue, double maxValue, double initialValue, double initialUncertainty)
      Adds a tunable parameter with explicit uncertainty.
      Parameters:
      path - variable path
      unit - unit of measurement
      minValue - minimum bound
      maxValue - maximum bound
      initialValue - initial value
      initialUncertainty - initial standard deviation
      Returns:
      this estimator for chaining
    • addMeasuredVariable

      public EnKFParameterEstimator addMeasuredVariable(String path, String unit, double noiseStd)
      Adds a measured variable to match.
      Parameters:
      path - variable path (e.g., "Separator.temperature")
      unit - unit of measurement
      noiseStd - measurement noise standard deviation
      Returns:
      this estimator for chaining
    • setProcessNoise

      public EnKFParameterEstimator setProcessNoise(double processNoiseStd)
      Sets the process noise standard deviation.
      Parameters:
      processNoiseStd - process noise (parameter drift rate)
      Returns:
      this estimator for chaining
    • setMaxChangePerUpdate

      public EnKFParameterEstimator setMaxChangePerUpdate(double maxChange)
      Sets the maximum parameter change per update (rate limiting).
      Parameters:
      maxChange - maximum change per update
      Returns:
      this estimator for chaining
    • initialize

      public void initialize(int ensembleSize, long seed)
      Initializes the EnKF ensemble.
      Parameters:
      ensembleSize - number of ensemble members (typically 20-100)
      seed - random seed for reproducibility
    • clipToBounds

      private double clipToBounds(double value, EnKFParameterEstimator.TunableParameterSpec spec)
      Clips a value to parameter bounds.
      Parameters:
      value - the value to clip
      spec - the parameter specification with bounds
      Returns:
      the clipped value within bounds
    • simulate

      private double[] simulate(double[] parameters)
      Runs simulation with given parameters and returns measured outputs.
      Parameters:
      parameters - array of parameter values to use in simulation
      Returns:
      array of measured output values from the simulation
    • update

      public EnKFParameterEstimator.EnKFResult update(Map<String,Double> measurements)
      Performs one EnKF update step with new measurements.
      Parameters:
      measurements - map of variable path to measured value
      Returns:
      estimation result
    • invertMatrix

      private double[][] invertMatrix(double[][] matrix)
      Simple matrix inversion (for small matrices).
      Parameters:
      matrix - the matrix to invert
      Returns:
      the inverted matrix
    • getEstimates

      public double[] getEstimates()
      Gets current parameter estimates.
      Returns:
      array of parameter estimates
    • getUncertainties

      public double[] getUncertainties()
      Gets current parameter uncertainties.
      Returns:
      array of standard deviations
    • getHistory

      Gets estimation history.
      Returns:
      list of all EnKF results
    • getUpdateCount

      public int getUpdateCount()
      Gets number of updates performed.
      Returns:
      update count
    • getParameterNames

      public String[] getParameterNames()
      Gets parameter names.
      Returns:
      array of parameter paths
    • getMeasurementNames

      public String[] getMeasurementNames()
      Gets measurement variable names.
      Returns:
      array of measurement paths
    • reset

      public void reset()
      Resets the estimator to initial state.
    • toCalibrationResult

      public CalibrationResult toCalibrationResult()
      Converts current state to CalibrationResult for compatibility.
      Returns:
      CalibrationResult