Class PressureBoundaryOptimizer
- All Implemented Interfaces:
Serializable
This class provides a simplified interface for lift curve generation and flow rate optimization where pressures (inlet and outlet) are the boundary conditions. It is designed for generating lift curves for reservoir simulation integration (e.g., Eclipse VFP tables) and for capacity analysis of process systems with compressors, pipelines, and other equipment.
The optimizer leverages the ProductionOptimizer framework for the underlying search
algorithms (binary search, golden section) and constraint handling.
Key Features
- Pressure Boundary Optimization - Find maximum flow rate at given inlet/outlet pressure boundaries while respecting equipment constraints
- Lift Curve Table Generation - Generate 2D tables (VLP/IPR) compatible with Eclipse reservoir simulator format
- Automatic Compressor Configuration - Auto-generates compressor performance charts based on design conditions
- Power Tracking - Reports total compressor power consumption for each operating point
- Minimum Power Optimization - Find operating point that minimizes power while meeting flow requirements
- Utilization Constraints - Respects equipment capacity limits and surge margins
Typical Use Cases
- Generating VFP tables for Eclipse reservoir simulation coupling
- Capacity analysis for gas compression systems
- Export pipeline capacity studies
- Compressor power optimization
- Process debottlenecking studies
Example 1: Simple Pipeline Process
// Create a simple pipeline process
SystemInterface gas = new SystemSrkEos(288.15, 80.0);
gas.addComponent("methane", 0.9);
gas.addComponent("ethane", 0.1);
gas.setMixingRule("classic");
gas.setTotalFlowRate(50000.0, "kg/hr");
Stream feed = new Stream("Feed", gas);
ThrottlingValve valve = new ThrottlingValve("Valve", feed);
valve.setOutletPressure(70.0);
Stream outlet = new Stream("Outlet", valve.getOutletStream());
ProcessSystem process = new ProcessSystem();
process.add(feed);
process.add(valve);
process.add(outlet);
process.run();
// Create optimizer and find max flow
PressureBoundaryOptimizer optimizer = new PressureBoundaryOptimizer(process, "Feed", "Outlet");
optimizer.setMinFlowRate(1000.0);
optimizer.setMaxFlowRate(500000.0);
OptimizationResult result = optimizer.findMaxFlowRate(80.0, 70.0, "bara");
System.out.println("Max flow: " + result.getOptimalRate() + " kg/hr");
System.out.println("Feasible: " + result.isFeasible());
Example 2: Gas Compression System
// Create compression system
SystemInterface gas = new SystemSrkEos(288.15, 50.0);
gas.addComponent("methane", 0.90);
gas.addComponent("ethane", 0.07);
gas.addComponent("propane", 0.03);
gas.setMixingRule("classic");
gas.setTotalFlowRate(30000.0, "kg/hr");
Stream feed = new Stream("Feed", gas);
feed.run();
Compressor comp = new Compressor("Compressor", feed);
comp.setOutletPressure(100.0);
comp.setUsePolytropicCalc(true);
comp.setPolytropicEfficiency(0.75);
Cooler cooler = new Cooler("Aftercooler", comp.getOutletStream());
cooler.setOutTemperature(313.15);
Stream export = new Stream("Export", cooler.getOutletStream());
ProcessSystem process = new ProcessSystem();
process.add(feed);
process.add(comp);
process.add(cooler);
process.add(export);
process.run();
// Create optimizer with compressor constraints
PressureBoundaryOptimizer optimizer = new PressureBoundaryOptimizer(process, feed, export);
optimizer.setAutoConfigureCompressors(true); // Auto-generate compressor charts
optimizer.setMinSurgeMargin(0.15); // 15% surge margin
optimizer.setMaxPowerLimit(5000.0); // 5 MW power limit
optimizer.setPressureTolerance(0.05); // 5% pressure tolerance
// Find max flow at pressure boundaries
OptimizationResult result = optimizer.findMaxFlowRate(50.0, 95.0, "bara");
System.out.println("Max flow: " + result.getOptimalRate() + " kg/hr");
System.out.println("Total power: " + result.getDecisionVariables().get("totalPower_kW") + " kW");
Example 3: Generate Eclipse VFP Table
// Create optimizer (assuming process is already set up)
PressureBoundaryOptimizer optimizer = new PressureBoundaryOptimizer(process, "Feed", "Export");
optimizer.setMinFlowRate(5000.0);
optimizer.setMaxFlowRate(100000.0);
// Define pressure ranges for the lift curve table
double[] inletPressures = {50.0, 60.0, 70.0, 80.0}; // Reservoir/wellhead pressures
double[] outletPressures = {90.0, 100.0, 110.0, 120.0}; // Export/delivery pressures
// Generate the lift curve table
LiftCurveTable table = optimizer.generateLiftCurveTable(inletPressures, outletPressures, "bara");
// Output in Eclipse VFP format
System.out.println(table.toEclipseFormat());
// Or get JSON for other integrations
System.out.println(table.toJson());
// Check table statistics
System.out.println("Feasible points: " + table.countFeasiblePoints());
Example 4: Capacity Curve at Fixed Inlet Pressure
// Generate capacity curve showing max flow vs outlet pressure
double inletPressure = 70.0;
double[] outletPressures = {80.0, 90.0, 100.0, 110.0, 120.0};
double[] maxFlowRates = optimizer.generateCapacityCurve(inletPressure, outletPressures, "bara");
System.out.println("Capacity Curve at Pin=" + inletPressure + " bara:");
for (int i = 0; i < outletPressures.length; i++) {
System.out.println(" Pout=" + outletPressures[i] + " bara -> Max Flow="
+ (Double.isNaN(maxFlowRates[i]) ? "Infeasible" : maxFlowRates[i] + " kg/hr"));
}
Example 5: Minimum Power Optimization
// Find operating point that minimizes power while achieving target flow
double targetFlow = 50000.0; // kg/hr
OptimizationResult minPowerResult = optimizer.findMinimumPowerOperatingPoint(50.0, // inlet
// pressure
100.0, // outlet pressure
"bara", targetFlow);
System.out.println("Minimum power configuration:");
System.out.println(" Flow: " + minPowerResult.getOptimalRate() + " kg/hr");
System.out
.println(" Power: " + minPowerResult.getDecisionVariables().get("totalPower_kW") + " kW");
Configuration Options
| Parameter | Default | Description |
|---|---|---|
| minFlowRate | 0.001 | Minimum flow rate for search (kg/hr) |
| maxFlowRate | 1e9 | Maximum flow rate for search (kg/hr) |
| tolerance | 0.001 | Relative convergence tolerance |
| maxIterations | 50 | Maximum optimization iterations |
| maxUtilization | 1.0 | Maximum equipment utilization (1.0 = 100%) |
| pressureTolerance | 0.02 | Relative tolerance for outlet pressure matching (2%) |
| rateUnit | "kg/hr" | Flow rate unit for results |
| autoConfigureCompressors | true | Auto-generate compressor charts if not configured |
| minSurgeMargin | 0.10 | Minimum compressor surge margin (10%) |
| maxPowerLimit | MAX_VALUE | Maximum compressor power limit (kW) |
Integration with Eclipse Reservoir Simulator
The PressureBoundaryOptimizer.LiftCurveTable.toEclipseFormat() method generates output compatible with Eclipse
VFPPROD keyword format. The table can be directly included in Eclipse data files for
reservoir-to-surface coupling simulations.
Thread Safety
This class is not thread-safe. Each thread should use its own instance of PressureBoundaryOptimizer with its own ProcessSystem clone.
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLift curve table containing maximum flow rates for pressure combinations. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate List<Compressor> private booleanprivate final StreamInterfaceprivate static final org.apache.logging.log4j.LoggerLogger object for class.private doubleprivate intprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate final StreamInterfaceprivate doubleprivate final ProcessSystemprivate ProductionOptimizerprivate Stringprivate static final longSerialization version UID.private double -
Constructor Summary
ConstructorsConstructorDescriptionPressureBoundaryOptimizer(ProcessSystem process, String feedStreamName, String outletStreamName) Creates a pressure boundary optimizer for a process system.PressureBoundaryOptimizer(ProcessSystem process, StreamInterface feedStream, StreamInterface outletStream) Creates a pressure boundary optimizer for a process system.PressureBoundaryOptimizer(ProcessSystem process, ProductionOptimizer productionOptimizer, String feedStreamName, String outletStreamName) Creates a pressure boundary optimizer using an existing ProductionOptimizer.PressureBoundaryOptimizer(ProcessSystem process, ProductionOptimizer productionOptimizer, StreamInterface feedStream, StreamInterface outletStream) Creates a pressure boundary optimizer using an existing ProductionOptimizer. -
Method Summary
Modifier and TypeMethodDescriptiondoubleCalculates total compressor power.voidConfigures compressor charts for all compressors in the process.Creates compressor operating envelope constraints.createOutletPressureConstraint(double targetPressure, String pressureUnit, double tolerance) Creates an outlet pressure constraint.private List<Compressor> Finds all compressors in the process.findMaxFlowRate(double inletPressure, double targetOutletPressure, String pressureUnit) Finds the maximum flow rate at given pressure boundary conditions.findMinimumPowerOperatingPoint(double inletPressure, double targetOutletPressure, String pressureUnit, double targetFlowRate) Finds the operating point that minimizes total compressor power for given pressure boundaries.private StreamInterfacefindStream(ProcessSystem process, String streamName) Finds a stream by name in the process.double[]generateCapacityCurve(double inletPressure, double[] outletPressures, String pressureUnit) Generates a capacity curve at fixed inlet pressure.generateLiftCurveTable(double[] inletPressures, double[] outletPressures, String pressureUnit) Generates a lift curve table for Eclipse VFP format.Gets the list of compressors in the process.Gets the underlying production optimizer.voidsetAutoConfigureCompressors(boolean autoConfigureCompressors) Sets whether to automatically configure compressor charts.voidsetMaxFlowRate(double maxFlowRate) Sets the maximum flow rate for optimization.voidsetMaxIterations(int maxIterations) Sets the maximum number of iterations.voidsetMaxPowerLimit(double maxPowerLimit) Sets the maximum compressor power limit.voidsetMaxUtilization(double maxUtilization) Sets the maximum equipment utilization limit.voidsetMinFlowRate(double minFlowRate) Sets the minimum flow rate for optimization.voidsetMinSurgeMargin(double minSurgeMargin) Sets the minimum surge margin for compressors.voidsetPressureTolerance(double pressureTolerance) Sets the pressure tolerance for outlet pressure matching.voidsetProductionOptimizer(ProductionOptimizer productionOptimizer) Sets the underlying production optimizer.voidsetRateUnit(String rateUnit) Sets the rate unit for flow rates.voidsetSpeedLimits(double minSpeed, double maxSpeed) Sets the compressor speed limits.voidsetTolerance(double tolerance) Sets the optimization tolerance.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object for class. -
process
-
feedStream
-
outletStream
-
productionOptimizer
-
minFlowRate
private double minFlowRate -
maxFlowRate
private double maxFlowRate -
tolerance
private double tolerance -
maxIterations
private int maxIterations -
maxUtilization
private double maxUtilization -
pressureTolerance
private double pressureTolerance -
rateUnit
-
autoConfigureCompressors
private boolean autoConfigureCompressors -
minSurgeMargin
private double minSurgeMargin -
maxPowerLimit
private double maxPowerLimit -
maxSpeedLimit
private double maxSpeedLimit -
minSpeedLimit
private double minSpeedLimit -
compressors
-
compressorsConfigured
private boolean compressorsConfigured
-
-
Constructor Details
-
PressureBoundaryOptimizer
public PressureBoundaryOptimizer(ProcessSystem process, StreamInterface feedStream, StreamInterface outletStream) Creates a pressure boundary optimizer for a process system.- Parameters:
process- the process system to optimizefeedStream- the feed stream (inlet boundary)outletStream- the outlet stream (outlet boundary)
-
PressureBoundaryOptimizer
public PressureBoundaryOptimizer(ProcessSystem process, String feedStreamName, String outletStreamName) Creates a pressure boundary optimizer for a process system.- Parameters:
process- the process system to optimizefeedStreamName- the name of the feed streamoutletStreamName- the name of the outlet stream
-
PressureBoundaryOptimizer
public PressureBoundaryOptimizer(ProcessSystem process, ProductionOptimizer productionOptimizer, StreamInterface feedStream, StreamInterface outletStream) Creates a pressure boundary optimizer using an existing ProductionOptimizer.This constructor allows reusing a pre-configured ProductionOptimizer with custom objectives, constraints, and equipment utilization limits already defined.
Example
// Configure production optimizer with custom settings ProductionOptimizer prodOpt = new ProductionOptimizer(); prodOpt.setEquipmentUtilizationLimit("Compressor1", 0.85); prodOpt.setEquipmentUtilizationLimit("Separator", 0.90); // Create pressure boundary optimizer using the configured optimizer PressureBoundaryOptimizer pbo = new PressureBoundaryOptimizer(process, prodOpt, feed, outlet); pbo.setMinSurgeMargin(0.15); // Run optimization - uses settings from both optimizers OptimizationResult result = pbo.findMaxFlowRate(50.0, 100.0, "bara");- Parameters:
process- the process system to optimizeproductionOptimizer- the pre-configured production optimizer to usefeedStream- the feed stream (inlet boundary)outletStream- the outlet stream (outlet boundary)
-
PressureBoundaryOptimizer
public PressureBoundaryOptimizer(ProcessSystem process, ProductionOptimizer productionOptimizer, String feedStreamName, String outletStreamName) Creates a pressure boundary optimizer using an existing ProductionOptimizer.This constructor allows reusing a pre-configured ProductionOptimizer with custom objectives, constraints, and equipment utilization limits already defined.
- Parameters:
process- the process system to optimizeproductionOptimizer- the pre-configured production optimizer to usefeedStreamName- the name of the feed streamoutletStreamName- the name of the outlet stream
-
-
Method Details
-
findStream
Finds a stream by name in the process.- Parameters:
process- the process systemstreamName- the stream name- Returns:
- the stream interface
-
findCompressors
Finds all compressors in the process.- Returns:
- list of compressors
-
configureCompressorCharts
public void configureCompressorCharts()Configures compressor charts for all compressors in the process.For each compressor without a chart, this method generates a chart based on the current operating conditions using
CompressorChartGenerator. -
findMaxFlowRate
public ProductionOptimizer.OptimizationResult findMaxFlowRate(double inletPressure, double targetOutletPressure, String pressureUnit) Finds the maximum flow rate at given pressure boundary conditions.Uses bisection search to find the highest feasible flow rate where:
- Inlet pressure matches the specified value
- Outlet pressure matches the specified target (within tolerance)
- All equipment utilization is within limits
- All compressors are within operating envelope (surge, stonewall)
- Parameters:
inletPressure- the inlet pressure boundary conditiontargetOutletPressure- the target outlet pressure boundary conditionpressureUnit- the pressure unit (e.g., "bara", "barg")- Returns:
- optimization result with max flow rate and equipment utilization
-
createOutletPressureConstraint
private ProductionOptimizer.OptimizationConstraint createOutletPressureConstraint(double targetPressure, String pressureUnit, double tolerance) Creates an outlet pressure constraint.- Parameters:
targetPressure- the target outlet pressurepressureUnit- the pressure unittolerance- the relative tolerance- Returns:
- the optimization constraint
-
createCompressorConstraints
Creates compressor operating envelope constraints.- Returns:
- list of constraints for compressor operation
-
calculateTotalPower
public double calculateTotalPower()Calculates total compressor power.- Returns:
- total power in kW
-
generateLiftCurveTable
public PressureBoundaryOptimizer.LiftCurveTable generateLiftCurveTable(double[] inletPressures, double[] outletPressures, String pressureUnit) Generates a lift curve table for Eclipse VFP format.Creates a 2D table where each cell contains the maximum flow rate achievable for the given inlet pressure (row) and outlet pressure (column) combination.
- Parameters:
inletPressures- array of inlet pressures to evaluateoutletPressures- array of outlet pressures to evaluatepressureUnit- the pressure unit- Returns:
- lift curve table with flow rates and power data
-
generateCapacityCurve
public double[] generateCapacityCurve(double inletPressure, double[] outletPressures, String pressureUnit) Generates a capacity curve at fixed inlet pressure.- Parameters:
inletPressure- the inlet pressureoutletPressures- array of outlet pressures to evaluatepressureUnit- the pressure unit- Returns:
- array of max flow rates for each outlet pressure
-
findMinimumPowerOperatingPoint
public ProductionOptimizer.OptimizationResult findMinimumPowerOperatingPoint(double inletPressure, double targetOutletPressure, String pressureUnit, double targetFlowRate) Finds the operating point that minimizes total compressor power for given pressure boundaries.- Parameters:
inletPressure- the inlet pressuretargetOutletPressure- the target outlet pressurepressureUnit- the pressure unittargetFlowRate- the target flow rate to achieve- Returns:
- optimization result
-
setMinFlowRate
public void setMinFlowRate(double minFlowRate) Sets the minimum flow rate for optimization.- Parameters:
minFlowRate- the minimum flow rate in the configured unit
-
setMaxFlowRate
public void setMaxFlowRate(double maxFlowRate) Sets the maximum flow rate for optimization.- Parameters:
maxFlowRate- the maximum flow rate in the configured unit
-
setTolerance
public void setTolerance(double tolerance) Sets the optimization tolerance.- Parameters:
tolerance- the relative tolerance
-
setMaxIterations
public void setMaxIterations(int maxIterations) Sets the maximum number of iterations.- Parameters:
maxIterations- the maximum iterations
-
setMaxUtilization
public void setMaxUtilization(double maxUtilization) Sets the maximum equipment utilization limit.- Parameters:
maxUtilization- the maximum utilization (1.0 = 100%)
-
setRateUnit
Sets the rate unit for flow rates.- Parameters:
rateUnit- the rate unit (e.g., "kg/hr", "Sm3/day")
-
setAutoConfigureCompressors
public void setAutoConfigureCompressors(boolean autoConfigureCompressors) Sets whether to automatically configure compressor charts.- Parameters:
autoConfigureCompressors- true to auto-configure
-
setMinSurgeMargin
public void setMinSurgeMargin(double minSurgeMargin) Sets the minimum surge margin for compressors.- Parameters:
minSurgeMargin- the minimum surge margin (e.g., 0.10 for 10%)
-
setMaxPowerLimit
public void setMaxPowerLimit(double maxPowerLimit) Sets the maximum compressor power limit.- Parameters:
maxPowerLimit- the max power in kW
-
setSpeedLimits
public void setSpeedLimits(double minSpeed, double maxSpeed) Sets the compressor speed limits.- Parameters:
minSpeed- minimum speed in RPMmaxSpeed- maximum speed in RPM
-
setPressureTolerance
public void setPressureTolerance(double pressureTolerance) Sets the pressure tolerance for outlet pressure matching.- Parameters:
pressureTolerance- the relative tolerance (e.g., 0.02 for 2%)
-
getCompressors
Gets the list of compressors in the process.- Returns:
- list of compressors
-
getProductionOptimizer
Gets the underlying production optimizer.The production optimizer can be used to:
- Set custom equipment utilization limits
- Add additional optimization objectives
- Configure advanced search algorithms
- Returns:
- the production optimizer
-
setProductionOptimizer
Sets the underlying production optimizer.This allows replacing the production optimizer after construction, useful for:
- Reusing a pre-configured optimizer across multiple pressure boundary calculations
- Applying different optimization strategies for different scenarios
- Parameters:
productionOptimizer- the production optimizer to use
-