MIN/MAX
- Last UpdatedMar 03, 2025
- 1 minute read
The MIN() and MAX() functions produce a stream of results selecting the minimum or maximum value of a stream. The returned timestamps correspond to the minimum/maximum values retrieved, rather than the beginning of the time interval.
When using MIN() or MAX() in a query, if no resolution is specified then the behavior is the same as minimum or maximum retrieval modes with no resolution specified; the duration between the start and end times is divided into 100 equal cycles, and the minimum/maximum values are calculated for each cycle.
Syntax
|
Format |
Stream = MIN( Stream ) Stream = MAX( Stream ) |
|
Arguments |
Stream - A time-ordered vector of values |
|
Description |
Returns the minimum (or maximum) value of a stream. |
|
Format |
Stream = MIN( Stream, TimeInterval ) Stream = MAX( Stream, TimeInterval ) |
|
Arguments |
Stream - A time-ordered vector of values TimeInterval - The time interval over which minimum or maximum values are calculated |
|
Description |
Returns the minimum (or maximum) value of a stream over the specified time interval. |
Example 1
The following expressions return the minimum (or maximum) flow rate of a pump.
MIN(Pump101.Flow)
MAX(Pump101.Flow)
Result:
|
DateTime |
Value |
OPCQuality |
|
2022-03-30 23:43:53.2590000 |
590.4365234375 |
192 |
Example 2
The following expressions return the minimum (or maximum) flow rate of a pump over 30 minute time intervals.
MIN(Pump101.Flow, 30 minute)
MAX(Pump101.Flow, 30 minute)
Results:
|
DateTime |
Value |
OPCQuality |
|
2022-03-30 00:13:45.2590000 |
592.065856933594 |
192 |
|
2022-03-30 00:43:07.2590000 |
592.34765625 |
192 |
|
2022-03-30 01:01:07.2590000 |
593.351257324219 |
192 |
|
... |
... |
... |
|
2022-03-30 23:43:53.2590000 |
590.4365234375 |
192 |