Class ProcessModule
java.lang.Object
neqsim.util.NamedBaseClass
neqsim.process.SimulationBaseClass
neqsim.process.processmodel.ProcessModule
- All Implemented Interfaces:
Serializable, Runnable, SimulationInterface, NamedInterface
A class representing a process module class that can contain unit operations and other modules.
Module will be runnning until all recycles in this module are solved. If no recycle in the module
then run only once.
- Version:
- 1.0
- Author:
- [seros]
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<ProcessModule> private List<ProcessSystem> private static final org.apache.logging.log4j.Loggerprivate 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.Get the list of added process modules.Get the list of added unit operations.Gets the topologically-sorted calculation order for all equipment in this module.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.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 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.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
-
-
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
-
getModulesIndex
-
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
-
runAsTask()instead for better resource management.