Class SafetyInstrumentedFunction

java.lang.Object
neqsim.process.logic.sis.SafetyInstrumentedFunction
All Implemented Interfaces:
ProcessLogic

public class SafetyInstrumentedFunction extends Object implements ProcessLogic
Safety Instrumented Function (SIF) implementing fire and gas detection with voting logic.

A SIF is a safety function designed to prevent or mitigate hazardous events. It consists of:

  • Sensors/detectors (input elements)
  • Logic solver (voting and logic)
  • Final elements (valves, alarms, etc.)

This implementation follows IEC 61511 principles:

  • Voting logic (1oo1, 1oo2, 2oo3, etc.)
  • Bypass management (max 1 bypassed detector)
  • Fault detection and alarming
  • Manual override capability
  • Reset permissives

Example usage:

// Create fire detection SIF with 2oo3 voting
SafetyInstrumentedFunction fireSIF =
    new SafetyInstrumentedFunction("Fire Detection SIF", VotingLogic.TWO_OUT_OF_THREE);

// Add detectors
fireSIF.addDetector(new Detector("FD-101", DetectorType.FIRE, AlarmLevel.HIGH, 60.0, "°C"));
fireSIF.addDetector(new Detector("FD-102", DetectorType.FIRE, AlarmLevel.HIGH, 60.0, "°C"));
fireSIF.addDetector(new Detector("FD-103", DetectorType.FIRE, AlarmLevel.HIGH, 60.0, "°C"));

// Link to ESD logic
fireSIF.linkToLogic(esdLogic);

// In simulation loop:
fireSIF.update(temp1, temp2, temp3); // Update detector values
if (fireSIF.isTripped()) {
  // SIF has activated
}
Version:
1.0
Author:
ESOL
  • Field Details

    • name

      private final String name
    • votingLogic

      private final VotingLogic votingLogic
    • detectors

      private final List<Detector> detectors
    • linkedLogics

      private final List<ProcessLogic> linkedLogics
    • state

      private LogicState state
    • isTripped

      private boolean isTripped
    • isOverridden

      private boolean isOverridden
    • tripTime

      private long tripTime
    • maxBypassedDetectors

      private int maxBypassedDetectors
  • Constructor Details

    • SafetyInstrumentedFunction

      public SafetyInstrumentedFunction(String name, VotingLogic votingLogic)
      Creates a Safety Instrumented Function.
      Parameters:
      name - SIF name/tag
      votingLogic - voting pattern for detectors
  • Method Details

    • addDetector

      public void addDetector(Detector detector)
      Adds a detector to this SIF.

      The number of detectors added must match the voting logic total sensors requirement.

      Parameters:
      detector - detector to add
      Throws:
      IllegalStateException - if too many detectors are added
    • linkToLogic

      public void linkToLogic(ProcessLogic logic)
      Links this SIF to a process logic sequence that will be activated when SIF trips.
      Parameters:
      logic - process logic to activate
    • update

      public void update(double... measuredValues)
      Updates all detectors with new measured values and evaluates voting logic.
      Parameters:
      measuredValues - array of values corresponding to each detector
      Throws:
      IllegalArgumentException - if array size doesn't match detector count
    • evaluateVoting

      private void evaluateVoting()
      Evaluates the voting logic and determines if SIF should trip.
    • setOverride

      public void setOverride(boolean override)
      Manually overrides the SIF (for testing or bypass).

      Override should be used with extreme caution and typically requires management approval.

      Parameters:
      override - true to override (inhibit), false to restore
    • reset

      public boolean reset()
      Resets the SIF after trip conditions have cleared.

      Reset requires all detectors to be in non-trip condition.

      Specified by:
      reset in interface ProcessLogic
      Returns:
      true if reset successful, false if conditions not met
    • getDetector

      public Detector getDetector(int index)
      Gets a specific detector by index.
      Parameters:
      index - detector index (0-based)
      Returns:
      detector at index
    • getDetectors

      public List<Detector> getDetectors()
      Gets all detectors.
      Returns:
      list of detectors (unmodifiable)
    • isTripped

      public boolean isTripped()
      Checks if SIF is tripped.
      Returns:
      true if tripped
    • isOverridden

      public boolean isOverridden()
      Checks if SIF is overridden.
      Returns:
      true if overridden
    • getVotingLogic

      public VotingLogic getVotingLogic()
      Gets the voting logic pattern.
      Returns:
      voting logic
    • setMaxBypassedDetectors

      public void setMaxBypassedDetectors(int max)
      Sets the maximum number of detectors that can be bypassed simultaneously.
      Parameters:
      max - maximum bypass count (typically 1)
    • 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
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object