Class ProcessFlowDiagramExporter

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

public class ProcessFlowDiagramExporter extends Object implements Serializable
Exports a ProcessSystem topology to Graphviz DOT format for PFD generation.

The exporter walks all unit operations, queries their inlet and outlet streams via ProcessEquipmentInterface.getInletStreams() and ProcessEquipmentInterface.getOutletStreams(), and infers edges wherever two equipment units share a stream object. Explicit ProcessConnection metadata is also rendered as edges.

Usage:

ProcessSystem process = ...;
ProcessFlowDiagramExporter exporter = new ProcessFlowDiagramExporter(process);
String dot = exporter.toDot();
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • processSystem

      private final ProcessSystem processSystem
      The process system to export.
    • title

      private String title
      Graph title.
  • Constructor Details

    • ProcessFlowDiagramExporter

      public ProcessFlowDiagramExporter(ProcessSystem processSystem)
      Creates an exporter for the given process system.
      Parameters:
      processSystem - the process system to export
  • Method Details

    • setTitle

      public void setTitle(String title)
      Sets the title shown in the DOT graph.
      Parameters:
      title - graph title string
    • toDot

      public String toDot()
      Generates the Graphviz DOT representation of the process topology.

      Equipment becomes graph nodes, streams become edges. The method first discovers topology from stream sharing, then adds explicit connections from ProcessSystem.getConnections().

      Returns:
      DOT-format string
    • getShapeForEquipment

      private String getShapeForEquipment(ProcessEquipmentInterface equip)
      Returns an appropriate Graphviz shape for the equipment class.
      Parameters:
      equip - the equipment
      Returns:
      Graphviz shape string
    • sanitizeId

      private String sanitizeId(String name)
      Sanitizes a name for use as a Graphviz node ID by replacing non-alphanumeric characters with underscores.
      Parameters:
      name - the equipment name
      Returns:
      sanitized node ID
    • escapeQuotes

      private String escapeQuotes(String s)
      Escapes double quotes in strings for DOT format.
      Parameters:
      s - input string
      Returns:
      escaped string