Skip to the content.

For the complete published fluid and flowsheet plus the multi-case equipment, piping, valve, instrument, safety, materials, mechanical, DEXPI and readiness study, use the complete offshore process engineering study and its executable notebook. The abbreviated Java fragment below remains only a translation pattern.

This guide shows how to reproduce the comparesimulations.ipynb Colab notebook using only the Java API. It walks through building the feed, assembling the flowsheet, running the model, and exporting a JSON report so you can align the results with HYSYS/DWSIM or other tools.

Prerequisites

Step-by-step Java example

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.process.equipment.compressor.Compressor;
import neqsim.process.equipment.separator.ThreePhaseSeparator;
import neqsim.process.equipment.stream.Stream;
import neqsim.process.equipment.stream.StreamInterface;
import neqsim.process.processmodel.ProcessModel;
import neqsim.process.processmodel.ProcessSystem;
import neqsim.process.util.report.Report;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;

public final class ProcessComparisonQuickStart {
  private static final Logger logger =
      LogManager.getLogger(ProcessComparisonQuickStart.class);

  private ProcessComparisonQuickStart() {}

  public static void main(String[] args) {
    // 1) Build the synthetic feed used by this comparison pattern.
    SystemInterface wellFluid = new SystemSrkEos(310.0, 50.0);
    wellFluid.addComponent("methane", 0.8);
    wellFluid.addComponent("ethane", 0.1);
    wellFluid.addComponent("propane", 0.05);
    wellFluid.addComponent("n-butane", 0.05);
    wellFluid.initProperties();

    // 2) Create the inlet process section.
    Stream wellStreamHP = new Stream("HP well stream", wellFluid);
    wellStreamHP.setFlowRate(10.0, "MSm3/day");
    ThreePhaseSeparator firstStageSeparator =
        new ThreePhaseSeparator("1st stage separator", wellStreamHP);

    ProcessSystem inletSection = new ProcessSystem();
    inletSection.add(wellStreamHP);
    inletSection.add(firstStageSeparator);

    // 3) Create the compressor section from the separator gas outlet.
    StreamInterface compressorFeed = firstStageSeparator.getGasOutStream();
    Compressor compressor1 = new Compressor("Compressor1", compressorFeed);
    compressor1.setPolytropicEfficiency(0.56);
    compressor1.setUsePolytropicCalc(true);
    compressor1.setOutletPressure(100.0, "bara");

    ProcessSystem compressorSection = new ProcessSystem();
    compressorSection.add(compressorFeed);
    compressorSection.add(compressor1);

    // 4) Combine the sections and run them sequentially.
    ProcessModel combinedProcess = new ProcessModel();
    combinedProcess.add("feed process", inletSection);
    combinedProcess.add("compressor process", compressorSection);
    combinedProcess.setRunStep(true);
    combinedProcess.run();

    // 5) Read bounded diagnostics and export the comparison report.
    double gasFlow =
        firstStageSeparator.getGasOutStream().getFlowRate("MSm3/day");
    double outletTemperature =
        compressor1.getOutletStream().getTemperature("C");
    logger.info("Gas flow after separator: {} MSm3/day", gasFlow);
    logger.info("Compressor outlet temperature: {} C", outletTemperature);

    Report reporter = new Report(combinedProcess);
    String jsonReport = reporter.generateJsonReport();
    logger.info("{}", jsonReport);
  }
}

Tips when translating the notebook to Java:

Both calls are exercised by CombinedModelsTest.