Class ProcessGraphBuilder
java.lang.Object
neqsim.process.processmodel.graph.ProcessGraphBuilder
Builder class for constructing a
ProcessGraph from a ProcessSystem.
This class discovers stream connections between equipment units and produces an explicit graph structure that enables topology-based calculation order derivation.
Usage:
ProcessSystem system = ...; ProcessGraph graph = ProcessGraphBuilder.buildGraph(system); // Get calculation order derived from topology List<ProcessEquipmentInterface> order = graph.getCalculationOrder(); // Partition for parallel execution ProcessGraph.ParallelPartition partition = graph.partitionForParallelExecution();
- Version:
- 1.0
- Author:
- NeqSim
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProcessGraphbuildGraph(ProcessSystem system) Builds a process graph from a ProcessSystem.private static voidcollectConsumedStreamsAndCreateEdges(ProcessEquipmentInterface unit, ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects streams consumed by a unit and creates edges.private static voidcollectMixerInputStreamsAndCreateEdges(ProcessEquipmentInterface unit, ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects input streams from a Mixer and creates edges.private static voidcollectProducedStreams(ProcessEquipmentInterface unit, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects streams produced by a unit via common getter methods.private static voidcollectSplitStreams(ProcessEquipmentInterface unit, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects split streams from a Splitter via reflection.private static voidcreateEdgeFromProducer(ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer, Object stream, ProcessEquipmentInterface consumer) Creates an edge from the producer of a stream to the consumer.private static FieldFinds a field in the class hierarchy.private static ObjectinvokeMethod(ProcessEquipmentInterface unit, Method method) Safely invokes a method.private static voidscanFieldsForInletStreams(ProcessEquipmentInterface unit, ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer, Set<Object> visited) Scans fields for inlet streams.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger
-
-
Constructor Details
-
ProcessGraphBuilder
private ProcessGraphBuilder()
-
-
Method Details
-
buildGraph
Builds a process graph from a ProcessSystem.- Parameters:
system- the process system- Returns:
- the constructed graph
-
collectSplitStreams
private static void collectSplitStreams(ProcessEquipmentInterface unit, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects split streams from a Splitter via reflection. Uses the splitStream field or getSplitStream(int) method.- Parameters:
unit- the splitter unit to collect streams fromstreamToProducer- map to store stream to producer associations
-
collectMixerInputStreamsAndCreateEdges
private static void collectMixerInputStreamsAndCreateEdges(ProcessEquipmentInterface unit, ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects input streams from a Mixer and creates edges. Uses reflection since getStream(int) is not in MixerInterface.- Parameters:
unit- the mixer unit to collect streams fromgraph- the process graph to add edges tostreamToProducer- map of stream to producer associations
-
findField
-
collectProducedStreams
private static void collectProducedStreams(ProcessEquipmentInterface unit, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects streams produced by a unit via common getter methods.- Parameters:
unit- the process equipment unit to analyzestreamToProducer- map to store stream-to-producer relationships
-
collectConsumedStreamsAndCreateEdges
private static void collectConsumedStreamsAndCreateEdges(ProcessEquipmentInterface unit, ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer) Collects streams consumed by a unit and creates edges.- Parameters:
unit- the process equipment unit to analyzegraph- the process graph to add edges tostreamToProducer- map of stream-to-producer relationships
-
scanFieldsForInletStreams
private static void scanFieldsForInletStreams(ProcessEquipmentInterface unit, ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer, Set<Object> visited) Scans fields for inlet streams.- Parameters:
unit- the process equipment unit to scangraph- the process graph to add edges tostreamToProducer- map of stream-to-producer relationshipsvisited- set of already visited streams to avoid duplicates
-
createEdgeFromProducer
private static void createEdgeFromProducer(ProcessGraph graph, Map<Object, ProcessEquipmentInterface> streamToProducer, Object stream, ProcessEquipmentInterface consumer) Creates an edge from the producer of a stream to the consumer.- Parameters:
graph- the process graph to add the edge tostreamToProducer- map of stream-to-producer relationshipsstream- the stream object connecting producer to consumerconsumer- the consuming process equipment unit
-
invokeMethod
Safely invokes a method.
-