Class FlowRateOptimizationResult

java.lang.Object
neqsim.process.util.optimizer.FlowRateOptimizationResult
All Implemented Interfaces:
Serializable

public class FlowRateOptimizationResult extends Object implements 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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • status

    • flowRate

      private double flowRate
    • flowRateUnit

      private String flowRateUnit
    • inletPressure

      private double inletPressure
    • outletPressure

      private double outletPressure
    • targetInletPressure

      private double targetInletPressure
    • targetOutletPressure

      private double targetOutletPressure
    • pressureUnit

      private String pressureUnit
    • infeasibilityReason

      private String 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 rate
      flowRateUnit - unit of flow rate
      inletPressure - achieved inlet pressure
      outletPressure - achieved outlet pressure
      pressureUnit - unit of pressure
      Returns:
      the result
    • infeasiblePressure

      public static FlowRateOptimizationResult infeasiblePressure(String reason)
      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 violation
      violations - list of constraint violations
      Returns:
      the result
    • notConverged

      public static FlowRateOptimizationResult notConverged(int iterations, double lastError)
      Creates a not-converged result.
      Parameters:
      iterations - number of iterations performed
      lastError - last convergence error
      Returns:
      the result
    • error

      public static FlowRateOptimizationResult error(String errorMessage)
      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

      public void setStatus(FlowRateOptimizationResult.Status status)
      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

      public String getFlowRateUnit()
      Gets the flow rate unit.
      Returns:
      flow rate unit
    • setFlowRateUnit

      public void setFlowRateUnit(String flowRateUnit)
      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

      public String getPressureUnit()
      Gets the pressure unit.
      Returns:
      pressure unit
    • setPressureUnit

      public void setPressureUnit(String pressureUnit)
      Sets the pressure unit.
      Parameters:
      pressureUnit - the unit
    • getInfeasibilityReason

      public String getInfeasibilityReason()
      Gets the infeasibility reason message.
      Returns:
      reason message, or empty string if feasible
    • setInfeasibilityReason

      public void setInfeasibilityReason(String infeasibilityReason)
      Sets the infeasibility reason.
      Parameters:
      infeasibilityReason - the reason
    • getConstraintViolations

      public List<FlowRateOptimizationResult.ConstraintViolation> getConstraintViolations()
      Gets the list of constraint violations.
      Returns:
      constraint violations
    • addConstraintViolation

      public void addConstraintViolation(FlowRateOptimizationResult.ConstraintViolation violation)
      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

      public String toString()
      Overrides:
      toString in class Object