Class CompressorOptimizationHelper

java.lang.Object
neqsim.process.util.optimizer.CompressorOptimizationHelper

public class CompressorOptimizationHelper extends Object
Helper class for compressor-specific production optimization.

This class provides utilities for extracting optimization bounds from compressor charts, creating compressor-specific objectives and constraints, and performing two-stage optimization for multi-train compressor systems.

Key Features:

  • Extract adaptive bounds from compressor performance charts (speed, flow ranges)
  • Create standard compressor objectives (minimize power, maximize efficiency, maximize surge margin)
  • Two-stage optimization: first balance loads across parallel trains, then maximize total throughput
  • Support for VFD (variable frequency drive) and multi-speed compressors

Two-Stage Optimization Pattern:

For facilities with multiple parallel compressor trains:

  1. Stage 1 - Load Balancing: At fixed total flow, optimize train split fractions to balance loads (minimize max utilization across trains)
  2. Stage 2 - Throughput Maximization: With optimal splits, maximize total flow subject to constraints

Usage Example (Java):

// Extract bounds from compressor chart
CompressorBounds bounds = CompressorOptimizationHelper.extractBounds(compressor);

// Create speed variable with chart-derived bounds
ManipulatedVariable speedVar = CompressorOptimizationHelper.createSpeedVariable(compressor,
    bounds.getMinSpeed(), bounds.getMaxSpeed());

// Two-stage optimization
TwoStageResult result = CompressorOptimizationHelper.optimizeTwoStage(process, feedStream,
    Arrays.asList(comp1, comp2, comp3), flowBounds, config);

Usage Example (Python via JPype):

from neqsim.neqsimpython import jneqsim

Helper = jneqsim.process.util.optimizer.CompressorOptimizationHelper

# Extract bounds from compressor chart
bounds = Helper.extractBounds(compressor)
print(f"Speed range: {bounds.getMinSpeed():.0f} - {bounds.getMaxSpeed():.0f} RPM")

# Run two-stage optimization
result = Helper.optimizeTwoStage(process, feed, [comp1, comp2], flow_bounds, config)
print(f"Optimal flow: {result.getTotalFlow():.0f} kg/hr")
Version:
1.0
Author:
NeqSim Development Team
See Also:
  • Constructor Details

    • CompressorOptimizationHelper

      public CompressorOptimizationHelper()
  • Method Details

    • extractBounds

      public static CompressorOptimizationHelper.CompressorBounds extractBounds(Compressor compressor)
      Extract operating bounds from a compressor's performance chart.

      This method analyzes the compressor chart to determine:

      • Speed range (min/max RPM from chart curves)
      • Flow range at each speed curve
      • Surge and stone wall lines
      Parameters:
      compressor - the compressor to analyze
      Returns:
      bounds extracted from chart, or default bounds if no chart available
    • createSpeedVariable

      public static ProductionOptimizer.ManipulatedVariable createSpeedVariable(Compressor compressor, double minSpeed, double maxSpeed)
      Create a manipulated variable for compressor speed.
      Parameters:
      compressor - the compressor to control
      minSpeed - minimum speed in RPM
      maxSpeed - maximum speed in RPM
      Returns:
      manipulated variable for speed optimization
    • createOutletPressureVariable

      public static ProductionOptimizer.ManipulatedVariable createOutletPressureVariable(Compressor compressor, double minPressure, double maxPressure)
      Create a manipulated variable for compressor outlet pressure.
      Parameters:
      compressor - the compressor to control
      minPressure - minimum outlet pressure in bara
      maxPressure - maximum outlet pressure in bara
      Returns:
      manipulated variable for pressure optimization
    • createPowerObjective

      public static ProductionOptimizer.OptimizationObjective createPowerObjective(List<Compressor> compressors, double weight)
      Create an objective to minimize total compressor power.
      Parameters:
      compressors - list of compressors to include
      weight - objective weight (typically 1.0)
      Returns:
      optimization objective for power minimization
    • createSurgeMarginObjective

      public static ProductionOptimizer.OptimizationObjective createSurgeMarginObjective(List<Compressor> compressors, double weight)
      Create an objective to maximize minimum surge margin across compressors.
      Parameters:
      compressors - list of compressors to include
      weight - objective weight (typically 1.0)
      Returns:
      optimization objective for surge margin maximization
    • createEfficiencyObjective

      public static ProductionOptimizer.OptimizationObjective createEfficiencyObjective(List<Compressor> compressors, double weight)
      Create an objective to maximize average polytropic efficiency.
      Parameters:
      compressors - list of compressors to include
      weight - objective weight (typically 1.0)
      Returns:
      optimization objective for efficiency maximization
    • createSurgeMarginConstraint

      public static ProductionOptimizer.OptimizationConstraint createSurgeMarginConstraint(List<Compressor> compressors, double minMargin, ProductionOptimizer.ConstraintSeverity severity)
      Create a constraint requiring minimum surge margin on all compressors.
      Parameters:
      compressors - list of compressors to constrain
      minMargin - minimum required surge margin (e.g., 0.10 for 10%)
      severity - constraint severity (HARD or SOFT)
      Returns:
      optimization constraint for surge margin
    • createValidityConstraint

      public static ProductionOptimizer.OptimizationConstraint createValidityConstraint(List<Compressor> compressors)
      Create a constraint requiring all compressor simulations to be valid.
      Parameters:
      compressors - list of compressors to validate
      Returns:
      optimization constraint for simulation validity
    • optimizeTwoStage

      public static CompressorOptimizationHelper.TwoStageResult optimizeTwoStage(ProcessSystem process, StreamInterface feedStream, List<Compressor> compressors, List<BiConsumer<ProcessSystem, Double>> trainStreamSetters, double flowLowerBound, double flowUpperBound, ProductionOptimizer.OptimizationConfig config)
      Perform two-stage optimization for multi-train compressor systems.

      Stage 1: At fixed total flow, optimize split fractions to balance loads across trains. Stage 2: With optimal splits, maximize total flow subject to constraints.

      Parameters:
      process - the process system
      feedStream - the main feed stream
      compressors - list of parallel compressors (one per train)
      trainStreamSetters - functions to set each train's flow fraction
      flowLowerBound - minimum total flow
      flowUpperBound - maximum total flow
      config - optimization configuration
      Returns:
      two-stage optimization result
    • createSpeedVariables

      public static List<ProductionOptimizer.ManipulatedVariable> createSpeedVariables(List<Compressor> compressors)
      Create a list of compressor speed variables with chart-derived bounds.
      Parameters:
      compressors - list of compressors
      Returns:
      list of speed manipulated variables
    • createStandardObjectives

      public static List<ProductionOptimizer.OptimizationObjective> createStandardObjectives(List<Compressor> compressors)
      Create standard objectives for compressor optimization.

      Returns a list with three objectives:

      • Minimize total power (weight 0.4)
      • Maximize minimum surge margin (weight 0.3)
      • Maximize average efficiency (weight 0.3)
      Parameters:
      compressors - list of compressors
      Returns:
      list of standard objectives
    • createStandardConstraints

      public static List<ProductionOptimizer.OptimizationConstraint> createStandardConstraints(List<Compressor> compressors)
      Create standard constraints for compressor optimization.

      Returns constraints for:

      • Simulation validity (HARD)
      • Minimum 10% surge margin (HARD)
      Parameters:
      compressors - list of compressors
      Returns:
      list of standard constraints