Min
- Last UpdatedJan 11, 2023
- 2 minute read
- PI System
- PI Server 2018
- PI Server
Return the time-weighted or event-weighted minimum from a set of values.
Syntax
Min(x1, ... xn)
Min(array [, calculationBasis])
Arguments
-
x1, ... xn
Arguments or a single array of same value type (integers and real numbers, enumeration values, time expressions, or time intervals)
-
calculationBasis
Optional. The type of calculation to be performed enclosed in double quotes. Choose between "EventWeighted" or "TimeWeighted." If omitted, the default is event-weighted. If you select "TimeWeighted," the earliest timestamp of the value marks the start time and the latest timestamp the end of a time range
Returns
The minimum from a set of arguments. The result is of the same data type as arguments
Exceptions
Arguments whose run-time values are digital states are ignored. If all values are digital states, Min returns an error. Returns an error if the array does not consist of same value type
Notes
-
Unit of Measure (UOM) of the arguments is carried over to the result when at least one argument has a defined UOM while others don't. The returned value lacks a UOM if arguments have different UOMs
Example
-
Min(14, 'att1', 14.5, TagVal('att2','14-Dec-16'))
-
[Find the minimum from these values: 14, value of 'att1' at trigger time, 14.5, and the value for 'att2' at start of day (12:00am) on Dec 14, 2016]
-
Min('enum_att1', 'enum_att2', 'enum_att3')
-
[At trigger time, find the lowest value from an enumeration set and return its name]
-
Min('*', 'y', 'Saturday')
[Find the oldest timestamp from a set]
-
Min('*'-'*-1h', 't+8h'-'y+4h', 'y'-'20', '*'-'t')
[Find the shortest interval from these time periods: from 1 hour ago to now, from 4:00am yesterday to today at 8am, from 12:00am yesterday to 12:00am on 20th of this month, and from the beginning of day today (12:00am) till now]
-
Min(Variable1)
Name
Expression
Value at Evaluation
Variable1
RecordedValues('att1', '*-10m', '*')
[1, 3, 5, 7, 9]
Variable 2
Min(Variable1)
1
[Find the minimum of values in an array Variable1]
-
Min(Data)
[Return the event-weighted minimum of values from an array named Data]
-
Min(Data, "EventWeighted")
[Return the event-weighted minimum of values from an array named Data]
-
Min(Data, "TimeWeighted")
[Return the time-weighted minimum of values from an array named Data using the timestamps of the earliest and latest values of the array as the start time and end time respectively]