Class ProcessModelGraph
java.lang.Object
neqsim.process.processmodel.graph.ProcessModelGraph
- All Implemented Interfaces:
Serializable
Represents a hierarchical process model as a graph of graphs.
This class handles the case where multiple ProcessSystem objects are combined into a
ProcessModule. It maintains both:
- Individual graphs for each ProcessSystem (sub-graphs)
- A unified flattened graph for the entire model
- A module-level graph showing inter-system connections
Use cases:
- Analyzing complex process plants with multiple interacting subsystems
- Identifying cross-system stream connections
- Determining calculation order across subsystems
- AI/ML analysis of hierarchical process structures
- Version:
- 1.0
- Author:
- NeqSim
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a connection between two sub-systems.static classRepresents a partition of sub-systems into levels for parallel execution.static classRepresents a sub-system (ProcessSystem) within the model. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ProcessGraphprivate final List<ProcessModelGraph.InterSystemConnection> private static final org.apache.logging.log4j.Loggerprivate final Stringprivate static final longprivate final List<ProcessModelGraph.SubSystemGraph> -
Constructor Summary
ConstructorsConstructorDescriptionProcessModelGraph(String modelName, List<ProcessModelGraph.SubSystemGraph> subSystemGraphs, ProcessGraph flattenedGraph, List<ProcessModelGraph.InterSystemConnection> interSystemConnections) Private constructor - useProcessModelGraphBuilder.buildModelGraph(ProcessModule)instead. -
Method Summary
Modifier and TypeMethodDescriptionAnalyzes cycles across the entire model.Get the calculation order for the entire model.getConnectionsFrom(String systemName) Get connections from a specific sub-system.getConnectionsTo(String systemName) Get connections to a specific sub-system.int[][]Get edge index tensor for the entire model (GNN compatible).Get the list of sub-systems that have no dependencies (can start immediately).intdouble[][]Get node feature matrix for the entire model (GNN compatible).Get a map showing which sub-system each node belongs to.Get statistics about the model structure.getSubSystem(String systemName) Get sub-system graph by name.getSubSystemByIndex(int index) Get sub-system graph by index.Get sub-systems in topological order (respecting dependencies).intBuild a dependency graph between sub-systems based on inter-system connections.Generate a human-readable summary of the model graph.intintbooleanCheck if the model has any cycles.booleanCheck if parallel execution of sub-systems would be beneficial.Partition the entire model for parallel execution.Partition sub-systems into levels for parallel execution.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
logger
private static final org.apache.logging.log4j.Logger logger -
modelName
-
subSystemGraphs
-
flattenedGraph
-
interSystemConnections
-
-
Constructor Details
-
ProcessModelGraph
ProcessModelGraph(String modelName, List<ProcessModelGraph.SubSystemGraph> subSystemGraphs, ProcessGraph flattenedGraph, List<ProcessModelGraph.InterSystemConnection> interSystemConnections) Private constructor - useProcessModelGraphBuilder.buildModelGraph(ProcessModule)instead.
-
-
Method Details
-
getModelName
- Returns:
- the name of this process model
-
getSubSystemGraphs
- Returns:
- list of sub-system graphs
-
getFlattenedGraph
- Returns:
- the flattened graph containing all equipment from all sub-systems
-
getInterSystemConnections
- Returns:
- list of connections between sub-systems
-
getSubSystemCount
public int getSubSystemCount()- Returns:
- total number of sub-systems
-
getTotalNodeCount
public int getTotalNodeCount()- Returns:
- total number of nodes across all sub-systems
-
getTotalEdgeCount
public int getTotalEdgeCount()- Returns:
- total number of edges across all sub-systems
-
getInterSystemConnectionCount
public int getInterSystemConnectionCount()- Returns:
- number of cross-system connections
-
getSubSystem
Get sub-system graph by name.- Parameters:
systemName- the name of the sub-system- Returns:
- the sub-system graph, or null if not found
-
getSubSystemByIndex
Get sub-system graph by index.- Parameters:
index- the execution index- Returns:
- the sub-system graph, or null if not found
-
getConnectionsFrom
Get connections from a specific sub-system.- Parameters:
systemName- the name of the source sub-system- Returns:
- list of connections originating from this sub-system
-
getConnectionsTo
Get connections to a specific sub-system.- Parameters:
systemName- the name of the target sub-system- Returns:
- list of connections going to this sub-system
-
hasCycles
public boolean hasCycles()Check if the model has any cycles.- Returns:
- true if any sub-system or the overall model has cycles
-
analyzeCycles
Analyzes cycles across the entire model.- Returns:
- cycle analysis result for the flattened graph
-
getCalculationOrder
Get the calculation order for the entire model.- Returns:
- list of equipment in topological order, or null if cycles exist
-
partitionForParallelExecution
Partition the entire model for parallel execution.- Returns:
- parallel partition result
-
getNodeFeatureMatrix
public double[][] getNodeFeatureMatrix()Get node feature matrix for the entire model (GNN compatible).- Returns:
- 2D array [nodes][features]
-
getEdgeIndexTensor
public int[][] getEdgeIndexTensor()Get edge index tensor for the entire model (GNN compatible).- Returns:
- 2D array [2][edges] with [0]=source indices, [1]=target indices
-
getSummary
Generate a human-readable summary of the model graph.- Returns:
- summary string
-
getNodeToSubSystemMap
Get a map showing which sub-system each node belongs to.- Returns:
- map from node to sub-system name
-
getStatistics
-
getSubSystemDependencies
-
partitionSubSystemsForParallelExecution
Partition sub-systems into levels for parallel execution. Sub-systems at the same level have no dependencies between them and can execute concurrently.Uses topological sorting on the sub-system dependency graph to determine execution levels.
- Returns:
- partition of sub-systems into parallel execution levels
-
isParallelSubSystemExecutionBeneficial
public boolean isParallelSubSystemExecutionBeneficial()Check if parallel execution of sub-systems would be beneficial. Returns true if there are at least 2 sub-systems that can run in parallel at some level.- Returns:
- true if parallel execution would provide speedup
-
getIndependentSubSystems
Get the list of sub-systems that have no dependencies (can start immediately).- Returns:
- list of independent sub-systems
-
getSubSystemCalculationOrder
Get sub-systems in topological order (respecting dependencies).- Returns:
- list of sub-systems in execution order, or null if cycles exist
-
toString
-