Class CalculatorLibrary
java.lang.Object
neqsim.process.equipment.util.CalculatorLibrary
Catalog of reusable
Calculator presets. These presets provide declarative building blocks
that can be paired with Calculator.setCalculationMethod(BiConsumer) to encourage
consistent AI- or rule-generated logic across simulations.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPreset identifiers that can be resolved throughbyName(String). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate an anti-surge recycle calculator with no surge margin.antiSurge(double surgeMarginFactor) Create an anti-surge recycle calculator with a configurable surge margin factor.Resolve a preset calculation by name (case-insensitive).Create a dew-point targeting calculator with zero temperature margin.dewPointTargeting(double marginKelvin) Create a dew-point targeting calculator.Create an energy-balance calculator.preset(CalculatorLibrary.Preset preset) Resolve a preset calculation.private static StreamrequireFirstStream(ArrayList<ProcessEquipmentInterface> inputs, String role) private static StreamrequireStream(ProcessEquipmentInterface equipment, String role)
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger
-
-
Constructor Details
-
CalculatorLibrary
private CalculatorLibrary()
-
-
Method Details
-
byName
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> byName(String presetName) Resolve a preset calculation by name (case-insensitive). This is useful when wiring calculators declaratively from metadata or AI-generated instructions.- Parameters:
presetName- the preset identifier (e.g., "energyBalance" or "dewPointTargeting")- Returns:
- a
BiConsumerready forCalculator.setCalculationMethod(BiConsumer)
-
preset
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> preset(CalculatorLibrary.Preset preset) Resolve a preset calculation.- Parameters:
preset- the preset identifier- Returns:
- a
BiConsumerready forCalculator.setCalculationMethod(BiConsumer)
-
energyBalance
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> energyBalance()Create an energy-balance calculator. The output stream is flashed at its current pressure so that its enthalpy equals the sum of the input stream enthalpies.- Returns:
- a calculator function that performs energy balance
-
dewPointTargeting
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> dewPointTargeting(double marginKelvin) Create a dew-point targeting calculator. It sets the output stream temperature to the hydrocarbon dew point of the first input stream at the output stream's current pressure. A small positive margin can be applied to stay above dew point.- Parameters:
marginKelvin- temperature margin to add to the dew point (K)- Returns:
- a calculator function that performs dew point targeting
-
dewPointTargeting
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> dewPointTargeting()Create a dew-point targeting calculator with zero temperature margin.- Returns:
- a calculator function that performs dew point targeting
-
antiSurge
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> antiSurge()Create an anti-surge recycle calculator with no surge margin. The recycle flow through the splitter's second outlet is adjusted so the compressor inlet actual volumetric flow equals the surge flow from the compressor chart.Input variable 0 must be a
Compressorwith a loaded compressor chart. The output variable must be aSplitterwhose split stream index 1 is the recycle line.- Returns:
- a calculator function that performs anti-surge recycle adjustment
-
antiSurge
public static BiConsumer<ArrayList<ProcessEquipmentInterface>, ProcessEquipmentInterface> antiSurge(double surgeMarginFactor) Create an anti-surge recycle calculator with a configurable surge margin factor. The target flow issurgeFlow * surgeMarginFactor. A factor of 1.1 targets 10 % above surge.All flow comparisons use actual volumetric flow (m3/hr) to match the coordinate system of the compressor chart's surge curve.
- Parameters:
surgeMarginFactor- multiplicative margin applied to the surge flow (1.0 = no margin)- Returns:
- a calculator function that performs anti-surge recycle adjustment
-
requireStream
-
requireFirstStream
-