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
    • shelved

      private boolean shelved
      Whether this alarm point is shelved (suppressed).
    • shelveExpiry

      private double shelveExpiry
      Simulation time when shelving expires (Double.NaN if indefinite).
    • shelveReason

      private String shelveReason
      Reason recorded when alarm was shelved.
  • 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
    • shelve

      public void shelve(String reason)
      Shelves (suppresses) this alarm point indefinitely. While shelved, no alarm events are generated during evaluation. The underlying measurement continues to be tracked.
      Parameters:
      reason - operator-provided reason for shelving
    • shelve

      public void shelve(String reason, double expiryTime)
      Shelves this alarm point until the specified simulation time. After expiry, normal alarm evaluation resumes automatically.
      Parameters:
      reason - operator-provided reason for shelving
      expiryTime - simulation time when shelving expires
    • unshelve

      public void unshelve()
      Removes the alarm shelve, resuming normal alarm evaluation.
    • isShelved

      public boolean isShelved()
      Returns whether this alarm point is currently shelved.
      Returns:
      true if shelved
    • getShelveReason

      public String getShelveReason()
      Returns the reason given when the alarm was shelved.
      Returns:
      shelve reason or empty string
    • getShelveExpiry

      public double getShelveExpiry()
      Returns the simulation time when the shelve expires, or Double.NaN if indefinite.
      Returns:
      shelve expiry time