Class ProcessModelGraphBuilder
java.lang.Object
neqsim.process.processmodel.graph.ProcessModelGraphBuilder
Builder class for constructing a
ProcessModelGraph from a ProcessModule.
This builder handles the complexity of combining multiple ProcessSystem objects into a
unified graph representation, while maintaining information about the hierarchical structure and
cross-system connections.
Usage:
ProcessModule module = new ProcessModule("Plant");
module.add(processSystem1);
module.add(processSystem2);
ProcessModelGraph modelGraph = ProcessModelGraphBuilder.buildModelGraph(module);
// Get overall calculation order
List<ProcessEquipmentInterface> order = modelGraph.getCalculationOrder();
// Analyze inter-system connections
for (InterSystemConnection conn : modelGraph.getInterSystemConnections()) {
System.out.println(conn);
}
- Version:
- 1.0
- Author:
- NeqSim
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ProcessGraphbuildFlattenedGraph(List<ProcessModelGraph.SubSystemGraph> subSystemGraphs) Builds a flattened graph containing all nodes and edges from all sub-systems.static ProcessModelGraphbuildModelGraph(String modelName, ProcessSystem... systems) Builds a ProcessModelGraph from multiple ProcessSystems.static ProcessModelGraphbuildModelGraph(ProcessModule module) Builds a ProcessModelGraph from a ProcessModule.private static voidcheckMixerInputs(ProcessEquipmentInterface mixer, String targetSystemName, Map<Object, ProcessEquipmentInterface> streamProducers, Map<Object, String> streamToSystem, ProcessGraph flattenedGraph, List<ProcessModelGraph.InterSystemConnection> connections) Check Mixer inputs for cross-system connections.private static voidcollectEquipmentOutputs(ProcessEquipmentInterface equipment, String systemName, Map<Object, ProcessEquipmentInterface> streamProducers, Map<Object, String> streamToSystem) Collect output streams from specific equipment types.private static booleanconnectionExists(List<ProcessModelGraph.InterSystemConnection> connections, ProcessNode source, ProcessNode target) Check if a connection already exists.private static voiddetectInterSystemConnections(List<ProcessModelGraph.SubSystemGraph> subSystemGraphs, Map<ProcessNode, String> nodeToSystem, List<ProcessModelGraph.InterSystemConnection> connections, ProcessGraph flattenedGraph) Detects connections between different sub-systems by analyzing stream references.private static ProcessEdgefindEdge(ProcessNode source, ProcessNode target) Find an edge between two nodes.private static FieldFind a field in class hierarchy.private static FieldfindStreamField(Class<?> clazz) Find the 'stream' field in a Stream class hierarchy.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger
-
-
Constructor Details
-
ProcessModelGraphBuilder
private ProcessModelGraphBuilder()
-
-
Method Details
-
buildModelGraph
Builds a ProcessModelGraph from a ProcessModule.- Parameters:
module- the process module containing ProcessSystems and/or nested modules- Returns:
- the constructed ProcessModelGraph
-
buildModelGraph
Builds a ProcessModelGraph from multiple ProcessSystems.Convenience method for combining multiple systems without creating a ProcessModule.
- Parameters:
modelName- name for the combined modelsystems- the process systems to combine- Returns:
- the constructed ProcessModelGraph
-
buildFlattenedGraph
private static ProcessGraph buildFlattenedGraph(List<ProcessModelGraph.SubSystemGraph> subSystemGraphs) Builds a flattened graph containing all nodes and edges from all sub-systems. -
detectInterSystemConnections
private static void detectInterSystemConnections(List<ProcessModelGraph.SubSystemGraph> subSystemGraphs, Map<ProcessNode, String> nodeToSystem, List<ProcessModelGraph.InterSystemConnection> connections, ProcessGraph flattenedGraph) Detects connections between different sub-systems by analyzing stream references. This includes both explicit edges within sub-systems AND implicit dependencies where one system uses stream/fluid objects from another system's equipment. -
collectEquipmentOutputs
private static void collectEquipmentOutputs(ProcessEquipmentInterface equipment, String systemName, Map<Object, ProcessEquipmentInterface> streamProducers, Map<Object, String> streamToSystem) Collect output streams from specific equipment types. -
findEdge
Find an edge between two nodes. -
connectionExists
private static boolean connectionExists(List<ProcessModelGraph.InterSystemConnection> connections, ProcessNode source, ProcessNode target) Check if a connection already exists. -
findStreamField
-
checkMixerInputs
private static void checkMixerInputs(ProcessEquipmentInterface mixer, String targetSystemName, Map<Object, ProcessEquipmentInterface> streamProducers, Map<Object, String> streamToSystem, ProcessGraph flattenedGraph, List<ProcessModelGraph.InterSystemConnection> connections) Check Mixer inputs for cross-system connections. -
findField
-