DURATION (Time in State)
- Last UpdatedAug 27, 2025
- 2 minute read
The DURATION() function returns a stream representing the duration of each "true" state in an expression.
Syntax
|
Format |
Stream = DURATION( StreamLogicalExpression, Interval ) |
|
Arguments |
StreamLogicalExpression - A logical expression to be evaluated Interval - The time interval over which to calculate durations |
|
Description |
The logical expression represented by StreamLogicalExpression is evaluated, and a stream is returned representing the duration of each TRUE state in the results, with durations being split across the specified time period. For example, if StreamLogicalExpression evaluates to a TRUE value for a time period of 07:55-08:10, and the specified Interval is hourly, the output contains one "5 minute" and one "10 minute" result. Without specifying an Interval, the output would instead contain one "15 minute" result. |
Example 1
The following expression returns the amount of time in seconds over the specified where the city temperature is below 60 °F.
DURATION([PLPWeather.SydneyTemperature] <60)
Example 2
The following chart based on multiple expressions returns the duration in various temperatures.
DURATION([PLPWeather.SydneyTemperature] <60
DURATION([PLPWeather.SydneyTemperature] >= 60) - DURATION([PLPWeather.SydneyTemperature] >70)
etc.

Example 3
The following expression returns the amount of time in seconds that that a tank level is at 5000l of greater, over 10 minute intervals.
DURATION([PLPWIN2019.PR1_Storage.ProdLevel] > 5000, 10 minute)

Example 4
The following expression returns the amount of time inseconds that a tank level is at 5000L (or greater) over 10 minute intervals, and the results are converted to minutes.
UOM([PLPWIN2019.PR1_Storage.ProdLevel] > 5000, 10 minute) , Minute )