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
Modifier and TypeFieldDescriptiondouble
Calculated average.Collected data.long
Averaging interval.long
Last data timestamp.double
Calculated RMSint
number of data points.long
Time span of data.double
Calculated STD -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double value, long timestamp) Adds new value to the data pool.void
Adds new value to the data pool.boolean
Adds record data to the data pool if meets criteriaboolean
addValid
(ValueLinks.ValueHolder vh, boolean strictAlarmFilter) Adds ValueHolder data to the data pool if meets criteriavoid
clear()
Clears the data pool.void
trim()
Trims data pool to the predefined time window.void
update()
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
- iftrue
it will accept only data if there is NO_ALARM status. Iffalse
then data is added unless it is INVALID alarm. This is useful, because for MINOR or MAJOR alarms the data is still valid.- Returns:
true
if 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
- iftrue
it will accept only data if there is NO_ALARM status. Iffalse
then data is added unless it is INVALID alarm. This is useful, because for MINOR or MAJOR alarms the data is still valid.- Returns:
true
if 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.
-