Class ESDLogic
java.lang.Object
neqsim.process.logic.esd.ESDLogic
- All Implemented Interfaces:
ProcessLogic
Simplified ESD (Emergency Shutdown) logic implementation.
This class manages a sequence of actions that should be executed when an ESD is triggered. The actions are executed in order with configurable delays between steps.
Example usage:
ESDLogic esdLogic = new ESDLogic("ESD Level 1");
esdLogic.addAction(new TripValveAction(esdValve), 0.0); // Immediate
esdLogic.addAction(new ActivateBlowdownAction(bdValve), 0.5); // After 0.5s
esdLogic.addAction(new SetSplitterAction(splitter, new double[] {0.0, 1.0}), 0.5);
// In simulation loop:
esdLogic.activate(); // Trigger ESD
while (!esdLogic.isComplete()) {
esdLogic.execute(timeStep);
// Run equipment transients...
}
- Version:
- 1.0
- Author:
- ESOL
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInternal class to store an action with its delay.private static interfaceMarker interface for actions that can be reset. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<ESDLogic.ActionWithDelay> private intprivate doubleprivate doubleprivate final Stringprivate LogicState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the logic sequence, starting execution.voidaddAction(LogicAction action, double delay) Adds an action to the ESD sequence.voidDeactivates the logic sequence, pausing or stopping execution.voidexecute(double timeStep) Executes one time step of the logic sequence.intGets the total number of actions in this ESD logic.intGets the current action index (0-based).doubleGets the total elapsed time since activation.getName()Gets the name of this logic sequence.getState()Gets the current state of the logic.Gets a description of the current status.Gets the list of equipment targeted by this logic.booleanisActive()Checks if the logic is currently active (running).booleanChecks if the logic sequence has completed successfully.booleanreset()Resets the logic sequence to its initial state.
-
Field Details
-
name
-
state
-
actions
-
currentActionIndex
private int currentActionIndex -
elapsedTime
private double elapsedTime -
currentDelay
private double currentDelay
-
-
Constructor Details
-
ESDLogic
Creates a new ESD logic instance.- Parameters:
name- name of the ESD logic
-
-
Method Details
-
addAction
Adds an action to the ESD sequence.- Parameters:
action- action to executedelay- delay in seconds before executing this action (relative to previous action)
-
getName
Description copied from interface:ProcessLogicGets the name of this logic sequence.- Specified by:
getNamein interfaceProcessLogic- Returns:
- logic name
-
getState
Description copied from interface:ProcessLogicGets the current state of the logic.- Specified by:
getStatein interfaceProcessLogic- Returns:
- current logic state
-
activate
public void activate()Description copied from interface:ProcessLogicActivates the logic sequence, starting execution.If the logic is already active, this may restart it or have no effect depending on implementation.
- Specified by:
activatein interfaceProcessLogic
-
deactivate
public void deactivate()Description copied from interface:ProcessLogicDeactivates the logic sequence, pausing or stopping execution.The logic remains in its current state and can be reactivated later.
- Specified by:
deactivatein interfaceProcessLogic
-
reset
public boolean reset()Description copied from interface:ProcessLogicResets the logic sequence to its initial state.This prepares the logic for a fresh execution. Reset may require certain permissive conditions to be met.
- Specified by:
resetin interfaceProcessLogic- Returns:
- true if reset was successful, false if permissives not met
-
execute
public void execute(double timeStep) Description copied from interface:ProcessLogicExecutes one time step of the logic sequence.This method should be called repeatedly in transient simulations to advance the logic through its steps.
- Specified by:
executein interfaceProcessLogic- Parameters:
timeStep- time increment in seconds
-
isActive
public boolean isActive()Description copied from interface:ProcessLogicChecks if the logic is currently active (running).- Specified by:
isActivein interfaceProcessLogic- Returns:
- true if logic is active
-
isComplete
public boolean isComplete()Description copied from interface:ProcessLogicChecks if the logic sequence has completed successfully.- Specified by:
isCompletein interfaceProcessLogic- Returns:
- true if logic has completed all steps
-
getTargetEquipment
Description copied from interface:ProcessLogicGets the list of equipment targeted by this logic.- Specified by:
getTargetEquipmentin interfaceProcessLogic- Returns:
- list of target equipment
-
getStatusDescription
Description copied from interface:ProcessLogicGets a description of the current status.- Specified by:
getStatusDescriptionin interfaceProcessLogic- Returns:
- status description
-
getActionCount
public int getActionCount()Gets the total number of actions in this ESD logic.- Returns:
- number of actions
-
getCurrentActionIndex
public int getCurrentActionIndex()Gets the current action index (0-based).- Returns:
- current action index, or -1 if not running
-
getElapsedTime
public double getElapsedTime()Gets the total elapsed time since activation.- Returns:
- elapsed time in seconds
-