V2/Concepts/Expression

From Senfi Docs
Revision as of 17:44, 30 June 2021 by Huiyan (talk | contribs)
Jump to: navigation, search

Expression

User can make use of Senfi's flexible autonomous intelligence engine to be alerted of abnormality in the system they are monitoring.

As introduced, an Expression is a tool that you can use to monitor your assets and be notified of abnormal situations or events. You can configure an expression to trigger an event to send email or notify your operators in the Digital Twin. Examples of use cases include: a fire is detected in a building, a lift has broken down, or when a machine is overdue for maintenance. Expression editor is the tool you can use to configure these conditions.

An Expression in Senfi comprises of:

  • Inputs - Assets, Metric & Tag values
  • Conditions - Data transformation and/or logic
  • Result - False to True / True to False
  • Event - Trigger Event when Result changes. e.g. fire detected
  • Expression execution type - Configures when a Expression is evaluated

Inputs are evaluated by Conditions to generate a single Result. When value of Result changes (from False to True or True to False), an Event can be triggered. Actions defined in the Event such as email and Digital Twin alerts, are executed when the Event is triggered. Expression execution type allows you to configure how the Expression is executed. e.g: how often the Expression is evaluated, whether it's immediate or on poll.

Inputs --> Conditions --> Result

Result Changed --> Event --> Actions

Example

Using our Smart Weighing Scale measurement from earlier, we can form one simple Expression as follows:

  • Input: iot_weighingscale_v1.battery_level
  • Condition: < 20
  • Event: Battery level low
  • Event action: Send email notification to remind changing of battery
  • Expression execution type: Immediate (means evaluate this rule whenever there is any incoming measurement)

Inputs, Conditions and Result

Before adding an Expression, you should already have an Event or situation that you wish to be notified about. The Event or situation should be one that can be detected by monitoring data received by Senfi.

Concepts Automation Expression.png


Select Assets as Inputs, from which the Measurements, Metrics, Location and Attribute can be used to detect an Event or situation. Then, construct the set of Conditions from data transformation or logic functions. The set of Conditions will evaluate from false to true or true to false when Event or situation occurs. The result of said Conditions is the Result of the Expression. Whenever Result changes (from true to false and vice versa), Events may be triggered.

Expression Execution Options

By setting Type to Immediate or Polling, you can choose to execute an Expression when new values are received for any Input Measurements, or periodically, regardless of whether any Input Measurements have changed.

If Expression is set to run periodically (Polling), you must specify how often the Expression is executed by setting Intervals in seconds.

Expression Editor

Expressions are defined using the Expression Editor. The Expression Editor is a graph-based Drag & Drop editor.

Expression Editor

Arrows coming in from the left of a node indicate its input and those going out from its right indicate its output.

Input & Output of a Node

Each Node falls into one of the following categories:

  • Asset Identifier
  • Input
  • Data Transformation
  • Logic
  • Result
  • Event

Data originates from Metric nodes, is transformed by Data Transformation and/or Logic nodes, and eventually consumed by Result & Event nodes.

Input nodes
Metric - outputs the value/s of a metric. can be set to output the last known value, or a range of historical values
Logic Nodes
Compare - comparison operators. e.g. <, >=, ==, !=
Logic - perform "AND" or "OR" between 2 or more boolean values
Data Transformation nodes
Filter - used to filter a range of values and output a subset number of values. Can only be used after a Metric node in "Range of Value" mode and before an Aggregate
Aggregate - used to aggregates a range of values into a single value. E.g. sum, average, median. Can only be used after a Metric node in "Range of Value" mode
Function - value-wise transformation. Transform each value, e.g ABS, Floor, Round etc. Can be used after a Metric node and before a Compare node. Outputs the same number of values as its input.
Result node
Result - Result node. Specifies the Result of an Expression. Result can be False to True or True to False.
Event nodes
Event - Event node. Input must always be from the "Result" node. Can have 0 or more "Event" nodes. Instructs Senfi to do something when Result changes. Event Input Data is passed on to the related Event.

See Node Type for more information about each Node Type.

Example

Example 1

Example 1: A simple Expression detecting when a Lift has tripped (safetyTrip == 1).

Example 2

Example 2: Detects when a Lift tripped (safetyTrip == 1), AND passengers are trapped in the Lift (load > 0)

What's Next