Posted On: Sep 10, 2021
Amazon IoT SiteWise now supports three new enhancements to Amazon IoT SiteWise formula expressions to allow users greater flexibility in monitoring their IoT assets in near real-time.
Amazon IoT SiteWise transforms now support passing a variable to the timestamp function as an argument in addition to the already existing timestamp functionality which takes in no arguments and returns the current timestamp value. The timestamp(variable-name) function returns the timestamp for the specified variable.
Amazon IoT SiteWise transforms now also support a new temporal function called pretrigger. The preTrigger(variable-name) function returns a variable value prior to the update that triggered the calculation. Customers can identify durations of states and state transitions by using the preTrigger function. Consider an example where a manufacturer uses Amazon IoT SiteWise to monitor the status of a machine. The manufacturer tracks a measurement current_state that represents the manufacturing process, where 0 indicates that the machine is in a cleaning state and 1 indicates that the machine is in a manufacturing state. If the machine stays in the cleaning state longer than expected, the manufacturer might want to investigate the machine. A transform like cleaning_state_duration with a conditional logic expression of if(pretrigger(current_state) == 1, timestamp(current_state) - timestamp(pretrigger(current_state)), none) can help determine how long the machine has been in the cleaning state.
Additionally, Amazon IoT SiteWise now also supports nested expressions within aggregation functions. Prior to this feature, customers had to make modifications to variables by writing additional transforms before they could use these variables within aggregation functions. With the support for nested expressions within aggregation functions, they will be able to write a multi-level nested expression within the aggregation function itself. For example, formula expressions like avg(x*(x-1)), sum(x/2 )/avg(y^2 ), sum(avg(x^2 )/2) , sum(x/2, y*2) will now be supported within aggregation functions.