Statistics

Description

The Statistics component creates ab array of statistics (Min, Max, Mean/Average, Median, Standard Deviation, Sum, Mode) of incoming multiple incoming values which will be available in the next component as cv.Statistics. The cvPayload is passed through as is.

If an incoming value is not a number, that value will be excluded from the statistics. The number of values that enter the statistics without being excluded will be output to the component variables as Count.

Example:

cv.Payload [100 100 80 80 80 70 70 30 10 0] cv.Statistics {"Average":62 "Count":10 "Max":100 "Mean":62 "Median":75 "Min":0 "Mode":[80] "StandardDeviation":34 "Sum":620}

actioncomponent-statistics-example-01-01 actioncomponent-statistics-example-01-02 actioncomponent-statistics-example-01-03 actioncomponent-statistics-example-01-04

To get statistics on sensor values in the SensorDataDB component, you can create statistics based on sensor data values by specifying the value expression property "cv.Payload.Data".

The Capacity Component Property

The cp.Capacity property allows you to "chunk" the incoming values into junks. If the value is set to 0, all data will be considered as one set. But if you set capacity to 2 for example, your input items will be "chunked" into values of 2.

actioncomponent-statistics-split-statistics-filewrite

Output Payload and VariableDescription
cv.PayloadThe output Payload of the component is the same as the input Payload
cv.StatisticsThe component following the Statistics component will have a cv.Statistics component variable with the statistics information as below
cv.Statistics.AverageAverage
cv.Statistics.CountThe number of values that entered the statistics without being excluded
cv.Statistics.MaxMax value
cv.Statistics.MeanMean
cv.Statistics.MedianMedian
cv.Statistics.MinMinimum value
cv.Statistics.ModeMost Frequent value
cv.Statistics.StandardDeviationStandard deviation
cv.Statistics.SumTotal