Class SequentialFunctionChart
java.lang.Object
neqsim.process.controllerdevice.SequentialFunctionChart
- All Implemented Interfaces:
Serializable
Sequential Function Chart (SFC) implementation following the IEC 61131-3 standard concept. An SFC
models a sequence of discrete steps connected by transitions with guard conditions. Each step can
have entry, active, and exit actions. The chart advances when the active step's outgoing
transition guard evaluates to true.
Typical usage in NeqSim dynamic simulation:
- Model startup/shutdown sequences for compressors, separators, columns
- Implement emergency shutdown (ESD) logic
- Control batch operations with defined phases
- Version:
- 1.0
- Author:
- NeqSim
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA step in the Sequential Function Chart.static classA transition between two steps in the SFC. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate doubleprivate Stringprivate static final org.apache.logging.log4j.LoggerLogger instance.private final Stringprivate booleanprivate static final longSerialization version UID.private final Map<String, SequentialFunctionChart.SfcStep> private doubleprivate final List<SequentialFunctionChart.SfcTransition> -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new SFC with the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a step to the SFC.voidaddTimedTransition(String fromStep, String toStep, double delaySeconds) Adds a timed transition that fires after the specified duration in the source step.voidaddTransition(String fromStep, String toStep, BooleanSupplier guard) Adds a transition between two steps.private voidAdvances from the current step to the target step.Gets the name of the currently active step.doubleGets the time elapsed in the current step.Gets the event history log.getName()Gets the SFC name.Gets all step names.doubleGets the total elapsed time since start.booleanReturns whether the SFC is currently running.private voidvoidrunStep(double dt) Advances the SFC by one timestep.voidsetInitialStep(String stepName) Sets the initial step by name.voidstart()Starts or restarts the SFC from the initial step.voidstop()Stops the SFC.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger instance. -
name
-
steps
-
transitions
-
activeStepName
-
initialStepName
-
running
private boolean running -
elapsedTimeInStep
private double elapsedTimeInStep -
totalElapsedTime
private double totalElapsedTime -
eventHistory
-
-
Constructor Details
-
SequentialFunctionChart
Constructs a new SFC with the given name.- Parameters:
name- the chart name
-
-
Method Details
-
addStep
Adds a step to the SFC.- Parameters:
step- the step to add
-
addTransition
Adds a transition between two steps.- Parameters:
fromStep- source step nametoStep- target step nameguard- the boolean condition that must be true to advance
-
addTimedTransition
Adds a timed transition that fires after the specified duration in the source step.- Parameters:
fromStep- source step nametoStep- target step namedelaySeconds- time in seconds the step must be active before transition fires
-
setInitialStep
Sets the initial step by name.- Parameters:
stepName- the initial step name (must have been added via addStep)
-
start
public void start()Starts or restarts the SFC from the initial step. -
stop
public void stop()Stops the SFC. -
runStep
public void runStep(double dt) Advances the SFC by one timestep. Evaluates transitions and executes actions.- Parameters:
dt- timestep in seconds
-
advanceTo
Advances from the current step to the target step.- Parameters:
targetStepName- target step name
-
getActiveStepName
Gets the name of the currently active step.- Returns:
- the active step name, or null if not running
-
isRunning
public boolean isRunning()Returns whether the SFC is currently running.- Returns:
- true if running
-
getElapsedTimeInStep
public double getElapsedTimeInStep()Gets the time elapsed in the current step.- Returns:
- elapsed time in seconds
-
getTotalElapsedTime
public double getTotalElapsedTime()Gets the total elapsed time since start.- Returns:
- total elapsed time in seconds
-
getName
-
getEventHistory
-
getStepNames
-
logEvent
-