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 TypeMethodDescriptionResolve 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
-
requireStream
-
requireFirstStream
-