Class ESDLogic

java.lang.Object
neqsim.process.logic.esd.ESDLogic
All Implemented Interfaces:
ProcessLogic

public class ESDLogic extends Object implements 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
  • Field Details

    • name

      private final String name
    • state

      private LogicState state
    • actions

      private final List<ESDLogic.ActionWithDelay> actions
    • currentActionIndex

      private int currentActionIndex
    • elapsedTime

      private double elapsedTime
    • currentDelay

      private double currentDelay
  • Constructor Details

    • ESDLogic

      public ESDLogic(String name)
      Creates a new ESD logic instance.
      Parameters:
      name - name of the ESD logic
  • Method Details

    • addAction

      public void addAction(LogicAction action, double delay)
      Adds an action to the ESD sequence.
      Parameters:
      action - action to execute
      delay - delay in seconds before executing this action (relative to previous action)
    • getName

      public String getName()
      Description copied from interface: ProcessLogic
      Gets the name of this logic sequence.
      Specified by:
      getName in interface ProcessLogic
      Returns:
      logic name
    • getState

      public LogicState getState()
      Description copied from interface: ProcessLogic
      Gets the current state of the logic.
      Specified by:
      getState in interface ProcessLogic
      Returns:
      current logic state
    • activate

      public void activate()
      Description copied from interface: ProcessLogic
      Activates the logic sequence, starting execution.

      If the logic is already active, this may restart it or have no effect depending on implementation.

      Specified by:
      activate in interface ProcessLogic
    • deactivate

      public void deactivate()
      Description copied from interface: ProcessLogic
      Deactivates the logic sequence, pausing or stopping execution.

      The logic remains in its current state and can be reactivated later.

      Specified by:
      deactivate in interface ProcessLogic
    • reset

      public boolean reset()
      Description copied from interface: ProcessLogic
      Resets 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:
      reset in interface ProcessLogic
      Returns:
      true if reset was successful, false if permissives not met
    • execute

      public void execute(double timeStep)
      Description copied from interface: ProcessLogic
      Executes 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:
      execute in interface ProcessLogic
      Parameters:
      timeStep - time increment in seconds
    • isActive

      public boolean isActive()
      Description copied from interface: ProcessLogic
      Checks if the logic is currently active (running).
      Specified by:
      isActive in interface ProcessLogic
      Returns:
      true if logic is active
    • isComplete

      public boolean isComplete()
      Description copied from interface: ProcessLogic
      Checks if the logic sequence has completed successfully.
      Specified by:
      isComplete in interface ProcessLogic
      Returns:
      true if logic has completed all steps
    • getTargetEquipment

      public List<ProcessEquipmentInterface> getTargetEquipment()
      Description copied from interface: ProcessLogic
      Gets the list of equipment targeted by this logic.
      Specified by:
      getTargetEquipment in interface ProcessLogic
      Returns:
      list of target equipment
    • getStatusDescription

      public String getStatusDescription()
      Description copied from interface: ProcessLogic
      Gets a description of the current status.
      Specified by:
      getStatusDescription in interface ProcessLogic
      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