Class RunningCounterApplication.AverageCalculator
java.lang.Object
org.scictrl.csshell.epics.server.application.RunningCounterApplication.AverageCalculator
- Enclosing class:
RunningCounterApplication
Calculates average and other statistics on predefine time window.
- Author:
- igor@scictrl.com
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleCalculated average.Collected data.longAveraging interval.longLast data timestamp.doubleCalculated RMSintnumber of data points.longTime span of data.doubleCalculated STD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value, long timestamp) Adds new value to the data pool.voidAdds new value to the data pool.booleanAdds record data to the data pool if meets criteriabooleanaddValid(ValueLinks.ValueHolder vh, boolean strictAlarmFilter) Adds ValueHolder data to the data pool if meets criteriavoidclear()Clears the data pool.voidtrim()Trims data pool to the predefined time window.voidupdate()Updates the statistics from data pool.
-
Field Details
-
data
Collected data. -
size
public int sizenumber of data points. -
avg
public double avgCalculated average. -
rms
public double rmsCalculated RMS -
std
public double stdCalculated STD -
interval
public long intervalAveraging interval. -
span
public long spanTime span of data. -
last
public long lastLast data timestamp.
-
-
Constructor Details
-
AverageCalculator
public AverageCalculator()Constructor.
-
-
Method Details
-
add
Adds new value to the data pool.- Parameters:
vh- value to be added
-
add
public void add(double value, long timestamp) Adds new value to the data pool.- Parameters:
value- value to be addedtimestamp- the timestamp of the value
-
addValid
Adds ValueHolder data to the data pool if meets criteria- Parameters:
vh- the ValueHolder for which data is addedstrictAlarmFilter- iftrueit will accept only data if there is NO_ALARM status. Iffalsethen data is added unless it is INVALID alarm. This is useful, because for MINOR or MAJOR alarms the data is still valid.- Returns:
trueif data has been added, otherwisefalse
-
addValid
Adds record data to the data pool if meets criteria- Parameters:
r- the Record for which data is addedstrictAlarmFilter- iftrueit will accept only data if there is NO_ALARM status. Iffalsethen data is added unless it is INVALID alarm. This is useful, because for MINOR or MAJOR alarms the data is still valid.- Returns:
trueif data has been added, otherwisefalse
-
trim
public void trim()Trims data pool to the predefined time window. -
update
public void update()Updates the statistics from data pool. -
clear
public void clear()Clears the data pool.
-