Class StartupLogic

java.lang.Object
neqsim.process.logic.startup.StartupLogic
All Implemented Interfaces:
ProcessLogic

public class StartupLogic extends Object implements ProcessLogic
Startup logic with permissive checks and sequential action execution.

Startup sequences verify that required conditions (permissives) are met before proceeding with equipment startup. This follows industry best practices for safe process startup.

Key features:

  • Permissive checks (temperature, pressure, level, etc.)
  • Sequential action execution with timing
  • Automatic abort if permissives lost during startup
  • Configurable timeout for permissive waiting
  • Detailed status reporting

Example usage:

StartupLogic startup = new StartupLogic("Compressor Startup");

// Add permissives (must all be true before starting)
startup.addPermissive(new TemperatureCondition(cooler, 50.0, "<")); // Cooled
startup.addPermissive(new PressureCondition(suction, 3.0, ">")); // Min pressure
startup.addPermissive(new TimerCondition(60.0)); // Min 60s warm-up

// Add startup actions
startup.addAction(new OpenValveAction(suctionValve), 0.0); // Immediate
startup.addAction(new StartPumpAction(lubePump), 2.0); // After 2s
startup.addAction(new StartCompressorAction(compressor), 10.0); // After 10s

// In control loop
startup.activate();
while (!startup.isComplete()) {
  startup.execute(timeStep);
}
Version:
1.0
Author:
ESOL
  • Field Details

    • name

      private final String name
    • permissives

      private final List<LogicCondition> permissives
    • actions

      private final List<StartupLogic.ActionWithDelay> actions
    • state

      private LogicState state
    • currentActionIndex

      private int currentActionIndex
    • elapsedTime

      private double elapsedTime
    • currentDelay

      private double currentDelay
    • permissiveWaitTime

      private double permissiveWaitTime
    • maxPermissiveWaitTime

      private double maxPermissiveWaitTime
    • aborted

      private boolean aborted
    • abortReason

      private String abortReason
  • Constructor Details

    • StartupLogic

      public StartupLogic(String name)
      Creates a startup logic sequence.
      Parameters:
      name - name of the startup sequence
  • Method Details

    • addPermissive

      public void addPermissive(LogicCondition permissive)
      Adds a permissive condition that must be met before startup can proceed.

      All permissives must be true simultaneously before the first action executes.

      Parameters:
      permissive - condition to check
    • addAction

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

      public void setPermissiveTimeout(double timeout)
      Sets the maximum time to wait for permissives to be met.
      Parameters:
      timeout - timeout in seconds (default 300s)
    • 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
    • executePermissiveWait

      private void executePermissiveWait(double timeStep)
    • executeActions

      private void executeActions(double timeStep)
    • isAborted

      public boolean isAborted()
      Checks if startup was aborted.
      Returns:
      true if aborted
    • getAbortReason

      public String getAbortReason()
      Gets the reason for abort.
      Returns:
      abort reason, or empty string if not aborted
    • getPermissiveWaitTime

      public double getPermissiveWaitTime()
      Gets the time spent waiting for permissives.
      Returns:
      wait time in seconds
    • 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
    • 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
    • getPermissives

      public List<LogicCondition> getPermissives()
      Gets all permissive conditions.
      Returns:
      list of permissives
    • getActionCount

      public int getActionCount()
      Gets the number of actions in the sequence.
      Returns:
      action count