Class DexpiDiagramBridge

java.lang.Object
neqsim.process.processmodel.diagram.DexpiDiagramBridge
All Implemented Interfaces:
Serializable

public final class DexpiDiagramBridge extends Object implements Serializable
Bridge between DEXPI XML data exchange and PFD visualization.

This class provides integration utilities for:

  • Creating diagram exporters optimized for DEXPI-imported processes
  • Importing DEXPI XML files and generating PFD diagrams
  • Exporting ProcessSystem to DEXPI XML with embedded layout coordinates
  • Round-trip: DEXPI → NeqSim simulation → PFD → DEXPI with preserved context

Example usage:

// Import DEXPI and create diagram
ProcessDiagramExporter exporter =
    DexpiDiagramBridge.importAndCreateExporter(Paths.get("plant.xml"), templateStream);
exporter.exportAsDOT(Paths.get("diagram.dot"));

// Create exporter optimized for DEXPI content
ProcessDiagramExporter exporter = DexpiDiagramBridge.createExporter(system);
Version:
1.0
Author:
NeqSim
See Also:
  • Field Details

  • Constructor Details

    • DexpiDiagramBridge

      private DexpiDiagramBridge()
  • Method Details

    • createExporter

      public static ProcessDiagramExporter createExporter(ProcessSystem processSystem)
      Creates a diagram exporter optimized for DEXPI-imported processes.

      The exporter is configured with:

      • DEXPI metadata display enabled (line numbers, fluid codes)
      • Detailed labels for P&ID cross-referencing
      • Legend enabled for phase identification
      Parameters:
      processSystem - the process system (typically imported from DEXPI)
      Returns:
      configured diagram exporter
    • createDetailedExporter

      public static ProcessDiagramExporter createDetailedExporter(ProcessSystem processSystem)
      Creates a diagram exporter with full detail for DEXPI-imported processes.

      Includes all available information: operating conditions, flow rates, and DEXPI metadata.

      Parameters:
      processSystem - the process system
      Returns:
      configured diagram exporter with detailed labels
    • importAndCreateExporter

      public static ProcessDiagramExporter importAndCreateExporter(Path dexpiXmlFile) throws IOException, DexpiXmlReaderException
      Imports a DEXPI XML file and creates a diagram exporter.

      Uses a default methane/ethane fluid template for stream thermodynamics.

      Parameters:
      dexpiXmlFile - path to the DEXPI XML file
      Returns:
      diagram exporter for the imported process
      Throws:
      IOException - if the file cannot be read
      DexpiXmlReaderException - if the XML is invalid
    • importAndCreateExporter

      public static ProcessDiagramExporter importAndCreateExporter(Path dexpiXmlFile, Stream templateStream) throws IOException, DexpiXmlReaderException
      Imports a DEXPI XML file with a custom template stream and creates a diagram exporter.
      Parameters:
      dexpiXmlFile - path to the DEXPI XML file
      templateStream - stream template for thermodynamic properties
      Returns:
      diagram exporter for the imported process
      Throws:
      IOException - if the file cannot be read
      DexpiXmlReaderException - if the XML is invalid
    • importDexpi

      public static ProcessSystem importDexpi(Path dexpiXmlFile) throws IOException, DexpiXmlReaderException
      Imports a DEXPI XML file into a ProcessSystem.

      Convenience wrapper around DexpiXmlReader.read(File, Stream) with a default template.

      Parameters:
      dexpiXmlFile - path to the DEXPI XML file
      Returns:
      the imported process system
      Throws:
      IOException - if the file cannot be read
      DexpiXmlReaderException - if the XML is invalid
    • importDexpi

      public static ProcessSystem importDexpi(Path dexpiXmlFile, Stream templateStream) throws IOException, DexpiXmlReaderException
      Imports a DEXPI XML file into a ProcessSystem with a custom template.
      Parameters:
      dexpiXmlFile - path to the DEXPI XML file
      templateStream - stream template for thermodynamic properties
      Returns:
      the imported process system
      Throws:
      IOException - if the file cannot be read
      DexpiXmlReaderException - if the XML is invalid
    • exportToDexpi

      public static void exportToDexpi(ProcessSystem processSystem, Path outputFile) throws IOException
      Exports a ProcessSystem to DEXPI XML format.

      The exported XML preserves DEXPI metadata (tag names, line numbers, fluid codes) and includes operating conditions (pressure, temperature, flow) as generic attributes.

      Parameters:
      processSystem - the process system to export
      outputFile - the output file path
      Throws:
      IOException - if the file cannot be written
    • roundTrip

      public static ProcessSystem roundTrip(Path inputDexpi, Path outputDot, Path outputDexpi) throws IOException, DexpiXmlReaderException
      Performs a complete round-trip: import DEXPI, generate diagram, export back to DEXPI.

      This is useful for:

      • Validating DEXPI import/export fidelity
      • Generating diagrams from existing P&ID data
      • Enriching DEXPI files with simulation results
      Parameters:
      inputDexpi - path to input DEXPI XML file
      outputDot - path for output DOT diagram file
      outputDexpi - path for re-exported DEXPI XML file
      Returns:
      the processed system
      Throws:
      IOException - if file operations fail
      DexpiXmlReaderException - if the input XML is invalid
    • createDefaultTemplate

      private static Stream createDefaultTemplate()
      Creates a default template stream with methane/ethane composition.
      Returns:
      default stream template