Class EnKFParameterEstimator
java.lang.Object
neqsim.process.calibration.EnKFParameterEstimator
- All Implemented Interfaces:
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:
- Uses
ProcessVariableAccessorfor reading/writing process variables - Uses
ProcessDerivativeCalculatorfor sensitivity analysis - Uses
ManipulatedVariablepatterns for parameter bounds - Returns
CalibrationResultcompatible results
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult of an EnKF update step.static classSpecification for a measured variable.static classSpecification for a tunable parameter. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[][]private double[]private intprivate double[]private List<EnKFParameterEstimator.EnKFResult> private booleanprivate double[]private doubleMeasured variables to match.private double[]private doubleprivate ProcessSystemThe process system to calibrate.private Randomprivate static final longTunable parameters to estimate.private intprivate ProcessVariableAccessorVariable accessor for reading/writing process variables. -
Constructor Summary
ConstructorsConstructorDescriptionEnKFParameterEstimator(ProcessSystem processSystem) Creates an EnKF estimator for a process system. -
Method Summary
Modifier and TypeMethodDescriptionaddMeasuredVariable(String path, String unit, double noiseStd) Adds a measured variable to match.addTunableParameter(String path, String unit, double minValue, double maxValue, double initialValue) Adds a tunable parameter to estimate.addTunableParameter(String path, String unit, double minValue, double maxValue, double initialValue, double initialUncertainty) Adds a tunable parameter with explicit uncertainty.private doubleclipToBounds(double value, EnKFParameterEstimator.TunableParameterSpec spec) Clips a value to parameter bounds.double[]Gets current parameter estimates.Gets estimation history.String[]Gets measurement variable names.String[]Gets parameter names.double[]Gets current parameter uncertainties.intGets number of updates performed.voidinitialize(int ensembleSize, long seed) Initializes the EnKF ensemble.private double[][]invertMatrix(double[][] matrix) Simple matrix inversion (for small matrices).voidreset()Resets the estimator to initial state.setMaxChangePerUpdate(double maxChange) Sets the maximum parameter change per update (rate limiting).setProcessNoise(double processNoiseStd) Sets the process noise standard deviation.private double[]simulate(double[] parameters) Runs simulation with given parameters and returns measured outputs.Converts current state to CalibrationResult for compatibility.Performs one EnKF update step with new measurements.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
processSystem
The process system to calibrate. -
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
-
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
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 measurementminValue- minimum boundmaxValue- maximum boundinitialValue- 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 pathunit- unit of measurementminValue- minimum boundmaxValue- maximum boundinitialValue- initial valueinitialUncertainty- initial standard deviation- Returns:
- this estimator for chaining
-
addMeasuredVariable
Adds a measured variable to match.- Parameters:
path- variable path (e.g., "Separator.temperature")unit- unit of measurementnoiseStd- measurement noise standard deviation- Returns:
- this estimator for chaining
-
setProcessNoise
Sets the process noise standard deviation.- Parameters:
processNoiseStd- process noise (parameter drift rate)- Returns:
- this estimator for chaining
-
setMaxChangePerUpdate
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
Clips a value to parameter bounds.- Parameters:
value- the value to clipspec- 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
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
-
getMeasurementNames
Gets measurement variable names.- Returns:
- array of measurement paths
-
reset
public void reset()Resets the estimator to initial state. -
toCalibrationResult
Converts current state to CalibrationResult for compatibility.- Returns:
- CalibrationResult
-