Class AlarmState

java.lang.Object
neqsim.process.alarm.AlarmState
All Implemented Interfaces:
Serializable

public class AlarmState extends Object implements Serializable
Mutable alarm state tracking activation, acknowledgement and pending transitions.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • activeLevel

      private AlarmLevel activeLevel
    • acknowledged

      private boolean acknowledged
    • pendingLevel

      private AlarmLevel pendingLevel
    • pendingTimer

      private double pendingTimer
    • lastValue

      private double lastValue
    • lastUpdateTime

      private double lastUpdateTime
  • Constructor Details

    • AlarmState

      public AlarmState()
  • Method Details

    • evaluate

      public List<AlarmEvent> evaluate(AlarmConfig config, double value, double dt, double currentTime, String source)
      Evaluates the alarm state using the supplied configuration and measurement.
      Parameters:
      config - alarm configuration
      value - measured value
      dt - simulation time step
      currentTime - simulation time of the evaluation
      source - originating measurement name
      Returns:
      list of events produced during the evaluation
    • handlePending

      private void handlePending(AlarmConfig config, AlarmLevel candidate, double dt, double currentTime, String source, List<AlarmEvent> events)
    • determineCandidate

      private AlarmLevel determineCandidate(AlarmConfig config, double value)
    • isClearedByValue

      private boolean isClearedByValue(AlarmConfig config, double value, AlarmLevel level)
    • clearActiveInternal

      private void clearActiveInternal()
    • updateLast

      private void updateLast(double value, double time)
    • reset

      public void reset()
      Resets the alarm state to its initial normal condition.
    • getActiveLevel

      public AlarmLevel getActiveLevel()
      Returns the currently active alarm level, or null if no alarm is active.
      Returns:
      active alarm level
    • isActive

      public boolean isActive()
      Indicates whether an alarm is currently active.
      Returns:
      true if an alarm is active
    • isAcknowledged

      public boolean isAcknowledged()
      Indicates whether the active alarm has been acknowledged.
      Returns:
      true if the alarm is acknowledged
    • getLastValue

      public double getLastValue()
      Returns the last measured value supplied to evaluate(AlarmConfig, double, double, double, String).
      Returns:
      last measured value
    • getLastUpdateTime

      public double getLastUpdateTime()
      Returns the simulation time of the last evaluation.
      Returns:
      time of last update
    • acknowledge

      public AlarmEvent acknowledge(String source, double currentTime)
      Acknowledges the active alarm if one exists.
      Parameters:
      source - name of the originating measurement
      currentTime - simulation time
      Returns:
      acknowledgement event, or null if nothing was acknowledged
    • snapshot

      public AlarmStatusSnapshot snapshot(String source)
      Creates a snapshot description of the currently active alarm, or null if there is no active alarm.
      Parameters:
      source - name of originating measurement
      Returns:
      snapshot or null