Class ProcessModule
- All Implemented Interfaces:
Serializable, Runnable, SimulationInterface, NamedInterface
- Version:
- 1.0
- Author:
- [seros]
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<ProcessModule> private List<ProcessSystem> private static final org.apache.logging.log4j.LoggerTransient listener for simulation progress callbacks.private final List<ProcessEquipmentInterface> private static final longSerialization version UID.private booleanprivate intFields inherited from class SimulationBaseClass
calcIdentifier, calculateSteadyState, timeFields inherited from class NamedBaseClass
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ProcessModule module) Add a process module to the process module.voidadd(ProcessSystem processSystem) Add an unit operation to the process module.Builds a graph representation of this module and all its sub-systems.Check mass balance of all unit operations in all process systems using kg/sec.checkMassBalance(String unit) Check mass balance of all unit operations in all process systems within this module.voidAdds all recycle operations from addedUnitOperations to recycleModules list.copy()Create deep copy.Finds the process bottleneck with detailed constraint information across all systems.Get the list of added process modules.Get the list of added unit operations.Get all ProcessSystem instances from this module and all nested modules recursively.Gets the topologically-sorted calculation order for all equipment in this module.Gets a summary of capacity utilization for all constrained equipment in this module.Gets all capacity-constrained equipment in this module and all nested modules/systems.Gets equipment that is near its capacity limit (above warning threshold).Get unit operations that failed mass balance check using kg/sec and 0.1% threshold.getFailedMassBalance(double percentThreshold) Get unit operations that failed mass balance check using specified threshold.getFailedMassBalance(String unit, double percentThreshold) Get unit operations that failed mass balance check based on percentage error threshold.Gets a summary of the module's graph structure.getMeasurementDevice(String name) Returns the unit with the given name from the list of added unit operations and list of added modules.Get the list of module index.Get the list of operations index.Get the current progress listener.getReport.getReport_json.intGets the number of sub-systems in this module.Returns the unit with the given name from the list of added unit operations and list of added modules.booleanChecks if this module (or any sub-system) contains recycle loops.booleanChecks if any equipment in this module is overloaded (exceeds design capacity).booleanChecks if any equipment exceeds a HARD capacity limit.booleanChecks if all recycle operations in recycleModules are solved.voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.voidrun_stepFuture<?> Runs this module in a separate thread using the global NeqSim thread pool.Deprecated.voidrunWithCallback(Consumer<ProcessEquipmentInterface> callback) Run module with a simple callback for each completed unit operation.voidSet a listener to receive progress updates during simulation.booleansolved()Returns whether or not the module has been solved.Validates the structural integrity of this module.Methods inherited from class SimulationBaseClass
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTimeMethods inherited from class NamedBaseClass
getName, getTagName, setName, setTagNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagNameMethods inherited from interface SimulationInterface
run, run_step, runTransient, runTransient
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger logger -
unitIndex
private int unitIndex -
recycleModules
-
addedUnitOperations
-
operationsIndex
-
addedModules
-
modulesIndex
-
solved
private boolean solved -
progressListener
Transient listener for simulation progress callbacks. Propagated to all child ProcessSystems.
-
-
Constructor Details
-
ProcessModule
Constructor that takes a name as a parameter.- Parameters:
name- the name of the process module
-
-
Method Details
-
add
Add an unit operation to the process module.- Parameters:
processSystem- the process system that contains the unit operations to be added.
-
add
Add a process module to the process module.- Parameters:
module- the process module to be added
-
getAddedUnitOperations
Get the list of added unit operations.- Returns:
- the list of added unit operations
-
getOperationsIndex
-
getAddedModules
Get the list of added process modules.- Returns:
- the list of added process modules
-
getAllProcessSystems
Get all ProcessSystem instances from this module and all nested modules recursively.- Returns:
- list of all ProcessSystem instances in the module hierarchy
-
getModulesIndex
-
setProgressListener
Set a listener to receive progress updates during simulation. The listener is propagated to all contained ProcessSystem instances.- Parameters:
listener- the progress listener, or null to disable callbacks
-
getProgressListener
Get the current progress listener.- Returns:
- the current listener, or null if none is set
-
runWithCallback
Run module with a simple callback for each completed unit operation. This is a convenience method for Python/Jupyter integration.- Parameters:
callback- Consumer function called with each completed unit operation
-
run
In this method all thermodynamic and unit operations will be calculated in a steady state calculation.
- Parameters:
id- UUID
-
checkModulesRecycles
public void checkModulesRecycles()Adds all recycle operations from addedUnitOperations to recycleModules list. -
recyclesSolved
public boolean recyclesSolved()Checks if all recycle operations in recycleModules are solved.- Returns:
- true if all recycle operations are solved, false otherwise
-
solved
public boolean solved()Returns whether or not the module has been solved.
- Returns:
- a boolean
-
runAsTask
Runs this module in a separate thread using the global NeqSim thread pool.This method submits the module to the shared
NeqSimThreadPooland returns aFuturethat can be used to monitor completion, cancel the task, or retrieve any exceptions that occurred.- Returns:
- a
Futurerepresenting the pending completion of the task - See Also:
-
runAsThread
Deprecated.UserunAsTask()instead for better resource management. This method creates a new unmanaged thread directly.runAsThread.
- Returns:
- a
Threadobject
-
getUnit
-
getMeasurementDevice
-
copy
-
getReport
-
checkMassBalance
Check mass balance of all unit operations in all process systems within this module.- Parameters:
unit- unit for mass flow rate (e.g., "kg/sec", "kg/hr", "mole/sec")- Returns:
- a map with unit operation name as key and mass balance result as value
-
checkMassBalance
Check mass balance of all unit operations in all process systems using kg/sec.- Returns:
- a map with unit operation name as key and mass balance result as value in kg/sec
-
getFailedMassBalance
public Map<String, ProcessSystem.MassBalanceResult> getFailedMassBalance(String unit, double percentThreshold) Get unit operations that failed mass balance check based on percentage error threshold.- Parameters:
unit- unit for mass flow rate (e.g., "kg/sec", "kg/hr", "mole/sec")percentThreshold- percentage error threshold (default: 0.1%)- Returns:
- a map with failed unit operation names and their mass balance results
-
getFailedMassBalance
Get unit operations that failed mass balance check using kg/sec and 0.1% threshold.- Returns:
- a map with failed unit operation names and their mass balance results
-
getFailedMassBalance
Get unit operations that failed mass balance check using specified threshold.- Parameters:
percentThreshold- percentage error threshold- Returns:
- a map with failed unit operation names and their mass balance results in kg/sec
-
getReport_json
getReport_json.
Return results of simulation in json format- Returns:
- a String
-
run_step
run_step
In this method all thermodynamic and unit operations will be calculated in a steady state calculation. Sets calc identifier UUID. It does not solve recycles - only calculates one step- Parameters:
id- Calc identifier UUID to set.
-
buildModelGraph
Builds a graph representation of this module and all its sub-systems.The returned
ProcessModelGraphcontains:- Individual graphs for each ProcessSystem
- A unified flattened graph for the entire module
- Information about inter-system connections
- Returns:
- the graph representation of this module
-
getCalculationOrder
Gets the topologically-sorted calculation order for all equipment in this module.This order respects stream dependencies across all sub-systems.
- Returns:
- list of equipment in calculation order, or null if cycles prevent ordering
-
hasRecycleLoops
public boolean hasRecycleLoops()Checks if this module (or any sub-system) contains recycle loops.- Returns:
- true if cycles exist
-
getSubSystemCount
public int getSubSystemCount()Gets the number of sub-systems in this module.- Returns:
- number of ProcessSystems and nested ProcessModules
-
getGraphSummary
Gets a summary of the module's graph structure.- Returns:
- human-readable summary string
-
validateStructure
-
getConstrainedEquipment
Gets all capacity-constrained equipment in this module and all nested modules/systems.Returns equipment that implements the CapacityConstrainedEquipment interface, such as separators, compressors, pumps, pipelines, manifolds, etc.
- Returns:
- list of capacity-constrained equipment from all systems in this module
-
findBottleneck
Finds the process bottleneck with detailed constraint information across all systems.This method searches all ProcessSystems and nested ProcessModules to find the equipment with the highest capacity utilization.
- Returns:
- BottleneckResult containing the bottleneck equipment, limiting constraint, and utilization; returns empty result if no constrained equipment found
-
isAnyEquipmentOverloaded
public boolean isAnyEquipmentOverloaded()Checks if any equipment in this module is overloaded (exceeds design capacity).- Returns:
- true if any equipment has capacity utilization above 100%
-
isAnyHardLimitExceeded
public boolean isAnyHardLimitExceeded()Checks if any equipment exceeds a HARD capacity limit.HARD limits represent absolute equipment limits that cannot be exceeded without trip or damage, such as maximum compressor speed or surge limits.
- Returns:
- true if any HARD constraint is exceeded
-
getCapacityUtilizationSummary
Gets a summary of capacity utilization for all constrained equipment in this module.Returns a map of equipment names to their maximum constraint utilization. Useful for displaying overall module capacity status.
- Returns:
- map of equipment name to utilization percentage
-
getEquipmentNearCapacityLimit
Gets equipment that is near its capacity limit (above warning threshold).Returns equipment where at least one constraint is above its warning threshold (typically 90% of design). Useful for identifying potential future bottlenecks.
- Returns:
- list of equipment names that are near capacity limits
-
runAsTask()instead for better resource management.