Class ProcessSimulationFunction
java.lang.Object
neqsim.statistics.parameterfitting.BaseFunction
neqsim.statistics.parameterfitting.nonlinearparameterfitting.LevenbergMarquardtFunction
neqsim.process.calibration.ProcessSimulationFunction
- All Implemented Interfaces:
Cloneable, FunctionInterface
Objective function that bridges process simulation with the Levenberg-Marquardt optimizer.
This class extends LevenbergMarquardtFunction to enable batch parameter estimation for
process simulations. It wraps a ProcessSystem and provides the objective function
interface expected by the L-M optimizer.
Key Features:
- Path-based access to process variables (equipment.property notation)
- Optional analytical Jacobian via
ProcessSensitivityAnalyzer - Automatic parameter bounds enforcement
- Support for multiple measured outputs per data point
Usage:
ProcessSimulationFunction function = new ProcessSimulationFunction(process);
function.addParameter("Pipe1.heatTransferCoefficient", 1.0, 100.0);
function.addMeasurement("Manifold.outletStream.temperature");
function.setInitialGuess(new double[] {15.0});
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SensitivityMatrixCached Jacobian from last computation.private intCurrent data point index being evaluated.private intCurrent measurement index being evaluated.Conditions to apply for each data point.(package private) static org.apache.logging.log4j.LoggerLogger object for class.Measurement paths in the process (e.g., "Manifold.outletStream.temperature").Parameter paths in the process (e.g., "Pipe1.heatTransferCoefficient").private ProcessSystemThe process system to simulate.private ProcessSensitivityAnalyzerCached sensitivity analyzer.private static final longprivate booleanWhether to use ProcessSensitivityAnalyzer for Jacobian.Fields inherited from class BaseFunction
bounds, params, system, thermoOps -
Constructor Summary
ConstructorsConstructorDescriptionProcessSimulationFunction(ProcessSystem processSystem) Creates a new process simulation function. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataPointConditions(Map<String, Double> conditions) Adds conditions for a data point (operating conditions to apply before simulation).addMeasurement(String path) Adds a measured variable.addParameter(String path, double lowerBound, double upperBound) Adds a tunable parameter.private voidapplyConditions(Map<String, Double> conditions) Applies operating conditions for a data point.private voidApplies current parameter values to the process system.doublecalcValue(double[] dependentValues) calcValue.Computes the Jacobian using ProcessSensitivityAnalyzer if enabled.intGets the number of measurements per data point.Gets the measurement paths.intGets the number of parameters.Gets the parameter paths.Gets the underlying process system.private doublegetPropertyValue(String path) Gets a property value from the process using path-based access.doublegetSensitivity(int measurementIndex, int parameterIndex) Gets the sensitivity for a specific output/input pair from cached Jacobian.private voidInitializes the sensitivity analyzer for Jacobian computation.private ObjectinvokeGetter(Object obj, String property) Invokes a getter method on an object.private voidinvokeSetter(Object obj, String property, double value) Invokes a setter method on an object.voidsetCurrentIndices(int dataPointIndex, int measurementIndex) Sets the current data point and measurement indices for evaluation.voidsetFittingParams(int i, double value) setFittingParams.private voidsetPropertyValue(String path, double value) Sets a property value in the process using path-based access.voidsetUseAnalyticalJacobian(boolean useAnalytical) Enables or disables analytical Jacobian computation.private String[]Splits a path like "Equipment.property" into parts.Methods inherited from class LevenbergMarquardtFunction
getFittingParams, getFittingParams, getNumberOfFittingParams, setFittingParam, setFittingParamsMethods inherited from class BaseFunction
calcTrueValue, clone, getBounds, getLowerBound, getSystem, getUpperBound, setBounds, setDatabaseParameters, setInitialGuess, setThermodynamicSystem
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
logger
static org.apache.logging.log4j.Logger loggerLogger object for class. -
processSystem
The process system to simulate. -
parameterPaths
-
measurementPaths
-
dataPointConditions
-
currentDataPointIndex
private int currentDataPointIndexCurrent data point index being evaluated. -
currentMeasurementIndex
private int currentMeasurementIndexCurrent measurement index being evaluated. -
useAnalyticalJacobian
private boolean useAnalyticalJacobianWhether to use ProcessSensitivityAnalyzer for Jacobian. -
sensitivityAnalyzer
Cached sensitivity analyzer. -
cachedJacobian
Cached Jacobian from last computation.
-
-
Constructor Details
-
ProcessSimulationFunction
Creates a new process simulation function.- Parameters:
processSystem- the process system to wrap
-
-
Method Details
-
addParameter
Adds a tunable parameter.- Parameters:
path- path to the parameter (e.g., "Pipe1.heatTransferCoefficient")lowerBound- minimum allowed valueupperBound- maximum allowed value- Returns:
- this function for chaining
-
addMeasurement
Adds a measured variable.- Parameters:
path- path to the measurement (e.g., "Manifold.outletStream.temperature")- Returns:
- this function for chaining
-
addDataPointConditions
-
setCurrentIndices
public void setCurrentIndices(int dataPointIndex, int measurementIndex) Sets the current data point and measurement indices for evaluation.- Parameters:
dataPointIndex- index of the data pointmeasurementIndex- index of the measurement within the data point
-
setUseAnalyticalJacobian
public void setUseAnalyticalJacobian(boolean useAnalytical) Enables or disables analytical Jacobian computation.When enabled, uses
ProcessSensitivityAnalyzerto compute the Jacobian more efficiently, potentially reusing Broyden Jacobians from recycle convergence.- Parameters:
useAnalytical- true to use analytical Jacobian
-
initSensitivityAnalyzer
private void initSensitivityAnalyzer()Initializes the sensitivity analyzer for Jacobian computation. -
splitPath
-
calcValue
public double calcValue(double[] dependentValues) calcValue.
Calculates the model prediction for the current data point and measurement. The dependentValues array encodes [dataPointIndex, measurementIndex] to identify which prediction is requested.
- Specified by:
calcValuein interfaceFunctionInterface- Overrides:
calcValuein classLevenbergMarquardtFunction- Parameters:
dependentValues- an array of type double- Returns:
- a double
-
applyParameters
private void applyParameters()Applies current parameter values to the process system. -
applyConditions
-
getPropertyValue
Gets a property value from the process using path-based access.- Parameters:
path- the property path (e.g., "Equipment.outletStream.temperature")- Returns:
- the property value
-
setPropertyValue
Sets a property value in the process using path-based access.- Parameters:
path- the property pathvalue- the value to set
-
invokeGetter
-
invokeSetter
-
setFittingParams
public void setFittingParams(int i, double value) setFittingParams.
- Specified by:
setFittingParamsin interfaceFunctionInterface- Overrides:
setFittingParamsin classLevenbergMarquardtFunction- Parameters:
i- a intvalue- a double
-
getParameterPaths
-
getMeasurementPaths
-
getParameterCount
public int getParameterCount()Gets the number of parameters.- Returns:
- number of tunable parameters
-
getMeasurementCount
public int getMeasurementCount()Gets the number of measurements per data point.- Returns:
- number of measurements
-
computeAnalyticalJacobian
Computes the Jacobian using ProcessSensitivityAnalyzer if enabled.This method is called by the L-M optimizer when analytical Jacobian is preferred over numerical differentiation.
- Returns:
- the sensitivity matrix, or null if analytical Jacobian is disabled
-
getSensitivity
public double getSensitivity(int measurementIndex, int parameterIndex) Gets the sensitivity for a specific output/input pair from cached Jacobian.- Parameters:
measurementIndex- index of the measurementparameterIndex- index of the parameter- Returns:
- the sensitivity value, or NaN if not available
-
getProcessSystem
Gets the underlying process system.- Returns:
- the process system
-