Class AlarmState
java.lang.Object
neqsim.process.alarm.AlarmState
- All Implemented Interfaces:
Serializable
Mutable alarm state tracking activation, acknowledgement and pending transitions.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate AlarmLevelprivate doubleprivate doubleprivate AlarmLevelprivate doubleprivate static final longprivate booleanWhether this alarm point is shelved (suppressed).private doubleSimulation time when shelving expires (Double.NaN if indefinite).private StringReason recorded when alarm was shelved. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacknowledge(String source, double currentTime) Acknowledges the active alarm if one exists.private voidprivate AlarmLeveldetermineCandidate(AlarmConfig config, double value) evaluate(AlarmConfig config, double value, double dt, double currentTime, String source) Evaluates the alarm state using the supplied configuration and measurement.Returns the currently active alarm level, ornullif no alarm is active.doubleReturns the simulation time of the last evaluation.doubleReturns the last measured value supplied toevaluate(AlarmConfig, double, double, double, String).doubleReturns the simulation time when the shelve expires, orDouble.NaNif indefinite.Returns the reason given when the alarm was shelved.private voidhandlePending(AlarmConfig config, AlarmLevel candidate, double dt, double currentTime, String source, List<AlarmEvent> events) booleanIndicates whether the active alarm has been acknowledged.booleanisActive()Indicates whether an alarm is currently active.private booleanisClearedByValue(AlarmConfig config, double value, AlarmLevel level) booleanReturns whether this alarm point is currently shelved.voidreset()Resets the alarm state to its initial normal condition.voidShelves (suppresses) this alarm point indefinitely.voidShelves this alarm point until the specified simulation time.Creates a snapshot description of the currently active alarm, ornullif there is no active alarm.voidunshelve()Removes the alarm shelve, resuming normal alarm evaluation.private voidupdateLast(double value, double time)
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
activeLevel
-
acknowledged
private boolean acknowledged -
pendingLevel
-
pendingTimer
private double pendingTimer -
lastValue
private double lastValue -
lastUpdateTime
private double lastUpdateTime -
shelved
private boolean shelvedWhether this alarm point is shelved (suppressed). -
shelveExpiry
private double shelveExpirySimulation time when shelving expires (Double.NaN if indefinite). -
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 configurationvalue- measured valuedt- simulation time stepcurrentTime- simulation time of the evaluationsource- 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
-
isClearedByValue
-
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
Returns the currently active alarm level, ornullif no alarm is active.- Returns:
- active alarm level
-
isActive
public boolean isActive()Indicates whether an alarm is currently active.- Returns:
trueif an alarm is active
-
isAcknowledged
public boolean isAcknowledged()Indicates whether the active alarm has been acknowledged.- Returns:
trueif the alarm is acknowledged
-
getLastValue
public double getLastValue()Returns the last measured value supplied toevaluate(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
Acknowledges the active alarm if one exists.- Parameters:
source- name of the originating measurementcurrentTime- simulation time- Returns:
- acknowledgement event, or
nullif nothing was acknowledged
-
snapshot
Creates a snapshot description of the currently active alarm, ornullif there is no active alarm.- Parameters:
source- name of originating measurement- Returns:
- snapshot or
null
-
shelve
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
Shelves this alarm point until the specified simulation time. After expiry, normal alarm evaluation resumes automatically.- Parameters:
reason- operator-provided reason for shelvingexpiryTime- 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:
trueif shelved
-
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, orDouble.NaNif indefinite.- Returns:
- shelve expiry time
-