Class FlowRateOptimizationResult
java.lang.Object
neqsim.process.util.optimizer.FlowRateOptimizationResult
- All Implemented Interfaces:
Serializable
Result of a flow rate optimization for pressure-constrained process simulation.
This class encapsulates the results of finding the flow rate required to achieve a specified pressure drop across process equipment. It includes:
- The optimal flow rate found (or NaN if infeasible)
- Achieved inlet and outlet pressures
- Feasibility status with detailed reason if infeasible
- Constraint violation details
- Convergence information
Example usage:
FlowRateOptimizer optimizer = new FlowRateOptimizer(pipeline);
FlowRateOptimizationResult result = optimizer.findFlowRate(100.0, 80.0, "bara");
if (result.isFeasible()) {
System.out.println("Optimal flow rate: " + result.getFlowRate() + " kg/hr");
} else {
System.out.println("Infeasible: " + result.getInfeasibilityReason());
}
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDetails of a constraint violation.static enumStatus of the optimization result. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a constraint violation.static FlowRateOptimizationResultCreates an error result.longGets the computation time in milliseconds.Gets the list of constraint violations.doubleGets the final convergence error.doubleGets the optimal flow rate.Gets the flow rate unit.Gets the infeasibility reason message.doubleGets the achieved inlet pressure.intGets the number of iterations performed.doubleGets the achieved outlet pressure.Gets the pressure unit.Gets the optimization status.doubleGets the target inlet pressure.doubleGets the target outlet pressure.booleanChecks if there are any hard constraint violations.static FlowRateOptimizationResultinfeasibleConstraint(String reason, List<FlowRateOptimizationResult.ConstraintViolation> violations) Creates an infeasible result due to constraint violations.static FlowRateOptimizationResultinfeasiblePressure(String reason) Creates an infeasible result due to pressure constraints.booleanChecks if the optimization found a feasible solution.static FlowRateOptimizationResultnotConverged(int iterations, double lastError) Creates a not-converged result.voidsetComputationTimeMs(long computationTimeMs) Sets the computation time.voidsetConvergenceError(double convergenceError) Sets the convergence error.voidsetFlowRate(double flowRate) Sets the flow rate.voidsetFlowRateUnit(String flowRateUnit) Sets the flow rate unit.voidsetInfeasibilityReason(String infeasibilityReason) Sets the infeasibility reason.voidsetInletPressure(double inletPressure) Sets the inlet pressure.voidsetIterationCount(int iterationCount) Sets the iteration count.voidsetOutletPressure(double outletPressure) Sets the outlet pressure.voidsetPressureUnit(String pressureUnit) Sets the pressure unit.voidSets the optimization status.voidsetTargetInletPressure(double targetInletPressure) Sets the target inlet pressure.voidsetTargetOutletPressure(double targetOutletPressure) Sets the target outlet pressure.static FlowRateOptimizationResultsuccess(double flowRate, String flowRateUnit, double inletPressure, double outletPressure, String pressureUnit) Creates a successful optimization result.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
status
-
flowRate
private double flowRate -
flowRateUnit
-
inletPressure
private double inletPressure -
outletPressure
private double outletPressure -
targetInletPressure
private double targetInletPressure -
targetOutletPressure
private double targetOutletPressure -
pressureUnit
-
infeasibilityReason
-
constraintViolations
-
iterationCount
private int iterationCount -
convergenceError
private double convergenceError -
computationTimeMs
private long computationTimeMs
-
-
Constructor Details
-
FlowRateOptimizationResult
public FlowRateOptimizationResult()Creates an empty optimization result.
-
-
Method Details
-
success
public static FlowRateOptimizationResult success(double flowRate, String flowRateUnit, double inletPressure, double outletPressure, String pressureUnit) Creates a successful optimization result.- Parameters:
flowRate- optimal flow rateflowRateUnit- unit of flow rateinletPressure- achieved inlet pressureoutletPressure- achieved outlet pressurepressureUnit- unit of pressure- Returns:
- the result
-
infeasiblePressure
Creates an infeasible result due to pressure constraints.- Parameters:
reason- description of why pressure target cannot be achieved- Returns:
- the result
-
infeasibleConstraint
public static FlowRateOptimizationResult infeasibleConstraint(String reason, List<FlowRateOptimizationResult.ConstraintViolation> violations) Creates an infeasible result due to constraint violations.- Parameters:
reason- description of constraint violationviolations- list of constraint violations- Returns:
- the result
-
notConverged
Creates a not-converged result.- Parameters:
iterations- number of iterations performedlastError- last convergence error- Returns:
- the result
-
error
Creates an error result.- Parameters:
errorMessage- error message- Returns:
- the result
-
isFeasible
public boolean isFeasible()Checks if the optimization found a feasible solution.- Returns:
- true if status is OPTIMAL
-
getStatus
Gets the optimization status.- Returns:
- the status
-
setStatus
Sets the optimization status.- Parameters:
status- the status
-
getFlowRate
public double getFlowRate()Gets the optimal flow rate.- Returns:
- flow rate, or NaN if infeasible
-
setFlowRate
public void setFlowRate(double flowRate) Sets the flow rate.- Parameters:
flowRate- the flow rate
-
getFlowRateUnit
-
setFlowRateUnit
Sets the flow rate unit.- Parameters:
flowRateUnit- the unit
-
getInletPressure
public double getInletPressure()Gets the achieved inlet pressure.- Returns:
- inlet pressure
-
setInletPressure
public void setInletPressure(double inletPressure) Sets the inlet pressure.- Parameters:
inletPressure- the pressure
-
getOutletPressure
public double getOutletPressure()Gets the achieved outlet pressure.- Returns:
- outlet pressure
-
setOutletPressure
public void setOutletPressure(double outletPressure) Sets the outlet pressure.- Parameters:
outletPressure- the pressure
-
getTargetInletPressure
public double getTargetInletPressure()Gets the target inlet pressure.- Returns:
- target inlet pressure
-
setTargetInletPressure
public void setTargetInletPressure(double targetInletPressure) Sets the target inlet pressure.- Parameters:
targetInletPressure- the target
-
getTargetOutletPressure
public double getTargetOutletPressure()Gets the target outlet pressure.- Returns:
- target outlet pressure
-
setTargetOutletPressure
public void setTargetOutletPressure(double targetOutletPressure) Sets the target outlet pressure.- Parameters:
targetOutletPressure- the target
-
getPressureUnit
-
setPressureUnit
Sets the pressure unit.- Parameters:
pressureUnit- the unit
-
getInfeasibilityReason
Gets the infeasibility reason message.- Returns:
- reason message, or empty string if feasible
-
setInfeasibilityReason
Sets the infeasibility reason.- Parameters:
infeasibilityReason- the reason
-
getConstraintViolations
Gets the list of constraint violations.- Returns:
- constraint violations
-
addConstraintViolation
Adds a constraint violation.- Parameters:
violation- the violation to add
-
hasHardViolations
public boolean hasHardViolations()Checks if there are any hard constraint violations.- Returns:
- true if any hard constraint is violated
-
getIterationCount
public int getIterationCount()Gets the number of iterations performed.- Returns:
- iteration count
-
setIterationCount
public void setIterationCount(int iterationCount) Sets the iteration count.- Parameters:
iterationCount- the count
-
getConvergenceError
public double getConvergenceError()Gets the final convergence error.- Returns:
- convergence error
-
setConvergenceError
public void setConvergenceError(double convergenceError) Sets the convergence error.- Parameters:
convergenceError- the error
-
getComputationTimeMs
public long getComputationTimeMs()Gets the computation time in milliseconds.- Returns:
- computation time
-
setComputationTimeMs
public void setComputationTimeMs(long computationTimeMs) Sets the computation time.- Parameters:
computationTimeMs- time in milliseconds
-
toString
-