Expressions (wwexpression)
- Last UpdatedMar 19, 2025
- 3 minute read
Expressions allow you to perform mathematical and logical operations on tag data.
This option is relevant in the following retrieval modes:
-
Note: Using expressions requires the "advanced" license feature to be enabled. If the advanced license is not available when an expression is used, no data is retrieved and an error message is displayed.
What is an expression?
An expression is made up of a combination of the following elements:
-
Values
-
A typical value is made up of three components:
-
A value with a base type of Boolean, integer, or double
-
A date and time in UTC format
-
A 16-bit integer representing the OPC quality of the value
-
-
Literal values are also supported, which have no date and time associated with them, and are always assumed to be "good" quality.
-
-
Streams
-
A stream is a time-ordered collection of values. A stream has either a stair-step or linear interpolation model, and an associated engineering unit.
-
In the context of an expression, one tag is the initial stream, but the expression can produce additional streams derived from a tag. For example, the expression TI101.PV + 4.0 produces a result stream, but the initial stream is the stream associated with TI101.PV.
-
-
Arithmetic and logical operators
-
Standard arithmetic operators such as addition, subtraction, multiplication and division are supported, along with logical operators for comparison, such as greater than (>) and less than (<). For a full list of supported operators, see Supported arithmetic operators.
-
-
Scalar functions
-
A variety of scalar functions are supported for manipulating data, such as calculating the absolute value, rounding values to the nearest integer, or unit of measure conversion. For a full list of supported scalar functions, see Supported scalar functions.
-
-
Time-series functions
-
A variety of time-series functions are supported for comparing data, such as calculating minimum/maximum values, or time in state. For a full list of supported functions, see Supported time-series functions.
-
Time intervals can be expressed in either of two ways:
-
As a number of days. For example, a value of 1 represents a daily period, while a value of .125 represents a period of three hours.
Note: Daily time periods support Daylight Saving Time. This means the "1 day" period is 24 hours, except on days when the Daylight Saving Time change is made; on those days, it will be either 23 or 25 hours.
-
As a named period. The following named periods are supported: minute, hour, day, week, month, fixedday, fixedweek, fixedmonth. These periods are anchored to a rounded time period. For example, "hour" produces hourly intervals where the minutes, seconds and milliseconds are all 0 in local time, while "minute" produces intervals where the seconds and milliseconds are all 0 in local time.
Note: The day, week and month named periods support Daylight Saving Time, while the fixedday, fixedweek and fixedmonth named periods do not. For example, the length of a day period can be 23, 24, or 25 hours, depending on whether a Daylight Saving Time transition takes place. The length of a fixedday period is always 24 hours, fixedweek is always 7 days times 24 hours, and fixedmonth is always the number of calendar days in the month times 24 hours.
-
-