Class ProcessConstraintEvaluator
java.lang.Object
neqsim.process.util.optimizer.ProcessConstraintEvaluator
- All Implemented Interfaces:
Serializable
Composite constraint evaluator for process-wide constraint evaluation.
This class provides:
- Unified evaluation of all constraints across a process system
- Constraint normalization for comparable utilization metrics
- Caching of constraint values for performance
- Sensitivity analysis through finite-difference calculations
- Bottleneck identification across all equipment
Example Usage
ProcessConstraintEvaluator evaluator = new ProcessConstraintEvaluator(processSystem);
// Evaluate all constraints
ConstraintEvaluationResult result = evaluator.evaluate();
System.out.println("Bottleneck: " + result.getBottleneckEquipment());
System.out.println("Utilization: " + result.getOverallUtilization());
// Calculate sensitivities
Map<String, Double> sensitivities = evaluator.calculateFlowSensitivities(5000.0, "kg/hr");
// Estimate max flow
double maxFlow = evaluator.estimateMaxFlow(5000.0, "kg/hr");
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPublic cached constraints class for external use and testing.private static classInternal cached constraint data for an equipment.static classResult of constraint evaluation.static classSummary of constraints for a single equipment. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longCache TTL in milliseconds.private booleanWhether caching is enabled.Cache for constraint values.private static final org.apache.logging.log4j.LoggerLogger.private ProcessSystemThe process system to evaluate.private doubleStep size for finite difference sensitivity calculations.private static final longSerialization version UID.Strategy registry for equipment constraint evaluation. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ProcessConstraintEvaluator(ProcessSystem processSystem) Constructor with process system. -
Method Summary
Modifier and TypeMethodDescriptioncalculateFlowSensitivities(double flowRateKgPerHr, String flowUnit) Calculates sensitivity of constraints to flow rate changes.calculateFlowSensitivities(ProcessSystem processSystem, double flowRateKgPerHr) Calculates sensitivity of constraints to flow rate changes.voidClears the constraint cache.doubleestimateMaxFlow(double currentFlowKgPerHr, String flowUnit) Estimates the maximum flow rate before hitting the bottleneck constraint.doubleestimateMaxFlow(ProcessSystem processSystem, double currentFlowKgPerHr) Estimates the maximum flow rate before hitting the bottleneck constraint.evaluate()Evaluates all constraints using the stored process system.evaluate(ProcessSystem processSystem) Evaluates all constraints across the process system.longGets the cache TTL in milliseconds.private Map<String, CapacityConstraint> getConstraintsWithCaching(ProcessEquipmentInterface equipment, EquipmentCapacityStrategy strategy, int processRunCount) Gets constraints with caching support.private intgetProcessRunCount(ProcessSystem processSystem) Gets process run count (approximate) for cache invalidation.Gets the process system.doubleGets the sensitivity step size.booleanChecks if caching is enabled.voidsetCacheTTLMillis(long cacheTTLMillis) Sets the cache TTL in milliseconds.voidsetCachingEnabled(boolean cachingEnabled) Sets whether caching is enabled.private voidsetFeedFlowRate(ProcessSystem processSystem, double flowKgPerHr) Sets the feed flow rate on the process system.voidsetProcessSystem(ProcessSystem processSystem) Sets the process system.voidsetSensitivityStepSize(double sensitivityStepSize) Sets the sensitivity step size.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger. -
strategyRegistry
Strategy registry for equipment constraint evaluation. -
constraintCache
Cache for constraint values. -
processSystem
The process system to evaluate. -
cacheTTLMillis
private long cacheTTLMillisCache TTL in milliseconds. -
cachingEnabled
private boolean cachingEnabledWhether caching is enabled. -
sensitivityStepSize
private double sensitivityStepSizeStep size for finite difference sensitivity calculations.
-
-
Constructor Details
-
ProcessConstraintEvaluator
public ProcessConstraintEvaluator()Default constructor. -
ProcessConstraintEvaluator
Constructor with process system.- Parameters:
processSystem- the process system to evaluate
-
-
Method Details
-
evaluate
Evaluates all constraints using the stored process system.- Returns:
- constraint evaluation result
-
evaluate
Evaluates all constraints across the process system.- Parameters:
processSystem- the process system to evaluate- Returns:
- constraint evaluation result
-
calculateFlowSensitivities
Calculates sensitivity of constraints to flow rate changes.- Parameters:
flowRateKgPerHr- current flow rate in kg/hrflowUnit- flow unit (for documentation purposes)- Returns:
- map of constraint name to sensitivity (d_utilization / d_flow)
-
calculateFlowSensitivities
public Map<String,Double> calculateFlowSensitivities(ProcessSystem processSystem, double flowRateKgPerHr) Calculates sensitivity of constraints to flow rate changes.- Parameters:
processSystem- the process systemflowRateKgPerHr- current flow rate in kg/hr- Returns:
- map of constraint name to sensitivity (d_utilization / d_flow)
-
estimateMaxFlow
Estimates the maximum flow rate before hitting the bottleneck constraint.- Parameters:
currentFlowKgPerHr- current flow rateflowUnit- flow unit (for documentation purposes)- Returns:
- estimated maximum flow rate in kg/hr
-
estimateMaxFlow
Estimates the maximum flow rate before hitting the bottleneck constraint.- Parameters:
processSystem- the process systemcurrentFlowKgPerHr- current flow rate- Returns:
- estimated maximum flow rate in kg/hr
-
getConstraintsWithCaching
private Map<String, CapacityConstraint> getConstraintsWithCaching(ProcessEquipmentInterface equipment, EquipmentCapacityStrategy strategy, int processRunCount) Gets constraints with caching support. -
getProcessRunCount
Gets process run count (approximate) for cache invalidation. -
setFeedFlowRate
Sets the feed flow rate on the process system. -
clearCache
public void clearCache()Clears the constraint cache. -
getProcessSystem
-
setProcessSystem
Sets the process system.- Parameters:
processSystem- process system
-
getCacheTTLMillis
public long getCacheTTLMillis()Gets the cache TTL in milliseconds.- Returns:
- TTL in milliseconds
-
setCacheTTLMillis
public void setCacheTTLMillis(long cacheTTLMillis) Sets the cache TTL in milliseconds.- Parameters:
cacheTTLMillis- TTL in milliseconds
-
isCachingEnabled
public boolean isCachingEnabled()Checks if caching is enabled.- Returns:
- true if caching enabled
-
setCachingEnabled
public void setCachingEnabled(boolean cachingEnabled) Sets whether caching is enabled.- Parameters:
cachingEnabled- caching flag
-
getSensitivityStepSize
public double getSensitivityStepSize()Gets the sensitivity step size.- Returns:
- step size as fraction
-
setSensitivityStepSize
public void setSensitivityStepSize(double sensitivityStepSize) Sets the sensitivity step size.- Parameters:
sensitivityStepSize- step size as fraction
-