Conditional Labeling Filter

The flir-filter-conditional-labeling is a filter that has a set of labels that are applied to the data in a pipeline based on the evaluation of an expression.

Let’s take an example of plc values: If asset plc has a datapoint called speed, the label value expressions below will assign a label value of either Running or Stopped depending on which of the expressions evaluates to true.

{
 "Running" : "plc.speed > 0",
 "Stopped" : "plc.speed == 0"
}

If no expression is evaluated to true then the last applied label value will be used. If multiple expressions are being evaluated to true then first true expression will be used.

Symbols are created of the form <asset name>.<data point>.

The conditional labeling filter is added in the same way as any other filters.

  • Click on the Applications add icon for your service or task.

  • Select the conditional-labeling plugin from the list of available plugins.

  • Name your conditional-labeling filter.

  • Click Next and you will be presented with the following configuration page

conditional

  • Configure the conditional-labeling filter:

    • Label Name: The name of the new data point into which the label will be stored.

    • Label Default Value: The default label value. This will be used if none of the expressions defined have so far evaluated to true.

    • Label Value Expressions: A key value list of values and corresponding expression. Value will be set for label if expression is evaluated to true.

  • Enable the plugin and click Done to activate your filter

Note

Expressions should be written so that only one is true. If multiple expressions are true, a warning message will be written to the log.

Expressions

The flir-filter-conditional-labeling plugin makes use of the ExprTk library to do run time expression evaluation. This library provides a rich mathematical operator set, the most useful of these in the context of this plugin are;

  • Logical operators (and, nand, nor, not, or, xor, xnor, mand, mor)

  • Mathematical operators (+, -, *, /, %, ^)

  • Functions (min, max, avg, sum, abs, ceil, floor, round, roundn, exp, log, log10, logn, pow, root, sqrt, clamp, inrange, swap)

  • Trigonometry (sin, cos, tan, acos, asin, atan, atan2, cosh, cot, csc, sec, sinh, tanh, d2r, r2d, d2g, g2d, hyp)

  • string operators (==, !=, >, <, +, in, like)

Within the expression the data points of the asset become symbols that may be used. Symbols are created of the form <asset name>.<data point>. As an example if you have one asset called “electrical” that has data points of “voltage” and “current” then you can write an expression as follows;

(electrical.voltage * electrical.current) == 1200

Known Restrictions

If your asset name or datapoint name contains any characters that are mathematical symbols, i.e. +, -, *, /, %, ^, (, ), [ or ], then these can not be used in the expressions supported by this filter.

Likewise if your asset name or datapoint name is one of the reserved names of operators or function they can also not be used.

To resolve this problem it is recommended to use the asset filter to rename the offending assets or datapoint prior to passing the data through the conditional-labeling filter.

See Also

flir-filter-ednahint - A hint filter for controlling how data is written using the eDNA north plugin to AVEVA’s eDNA historian

flir-filter-enumeration - A filter to map between symbolic names and numeric values in a datapoint.

flir-filter-expression - A FLIR Bridge processing filter plugin that applies a user define formula to the data as it passes through the filter

flir-filter-fft - A FLIR Bridge processing filter plugin that calculates a Fast Fourier Transform across sensor data

flir-filter-metadata - A FLIR Bridge processing filter plugin that adds metadata to the readings in the data stream

flir-filter-omfhint - A filter plugin that allows data to be added to assets that will provide extra information to the OMF north plugin.

flir-filter-rms - A FLIR Bridge processing filter plugin that calculates RMS value for sensor data

flir-filter-scale-set - A FLIR Bridge processing filter plugin that applies a set of sale factors to the data

flir-filter-statistics - Generic statistics filter for FLIR Bridge data that supports the generation of mean, mode, median, minimum, maximum, standard deviation and variance.