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 long -
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).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) voidreset()Resets the alarm state to its initial normal condition.Creates a snapshot description of the currently active alarm, ornullif there is no active alarm.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
-
-
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
-