Time Spent Function

Calculates the time spent in a particular value.

Syntax

timespent(TimeSeries, Period, Value, Operator, TimeUnit)

Parameter

Description

TimeSeries

This can be a node with time series data or another function.

Period

Number of data intervals considered in the function.

Value

Sensor value

Operator

=, >, <, <=, >=

Note: These must be inserted inside single quotes: '=', '>', etc.

TimeUnit

Minute, hour, or day. This defines the time unit the results are returned in.
Note: These must be inserted inside single quotes: 'minute', etc.

Example expressions

TimeSpent(@input_node, 7, 0, ‘>’, ‘hour’) finds the time spent, in hours, in 'ON' position (value greater than 0) for the last 7 intervals.

TimeSpent(@input_node, 100, 0, ‘=’, ‘minute’) finds the time, in minutes, the sensor is out of comms (value equal to 0) for the last 100 intervals.

Example chart

This chart shows a level sensor (FA_level), and a calculation of the amount of time (in hours) the level sensor has been below 15 feet (TimeSpent).

It also shows how the TimeSpent function can be replicated using the CountValue function set on an hourly interval (FA_level_below_15).