PLCnext Edge Gateway Docs

Metrics
Metrics

Metrics Overview

All metrics created are managed by the "Logic" service, and can be found underneath the Logic service inside the broker directory.

Scaled metrics provide a simple utility to scale a data point which has been collected by the broker.

Computed metrics provide the ability to manipulate input data via logic or math.

Computed Metric

Computed metrics enable logic to be performed against any variable in the PLCnext Edge Gateway. As such, data can be processed locally before being sent to the cloud.

A computed metric must have a name and output units defined. After defining the output metric attributes, the logic can be added. The logic field accepts basic math and logic expressions. Unless otherwise declared, the output variable is assigned the output of the expression contained inside the logic field. For example, to assign a constant value 5 to the output metric, the constant can be written directly in the logic field.

5

To relate computed metrics to other data points on the PLCnext Edge Gateway, the references must be declared as variables. To integrate a variable, click on the '+' button under the "Variables" heading. Give the variable a name, such as x.

After declaring a variable name, the variable must reference a data point on the Edge Gateway. Click the source button to be provided the broker directory. Select the desired data point from this window.

Now that you have a variable defined, it can be used in the logic field. For a simple math expression, such as a linear scaling, the following syntax can be used.

2x + 10*

This will scale the output metric in real time to twice the data point x plus a static offset of 10. Additional variables can be added to this script by adding more data point sources and giving them an associated variable name.

2x + 0.5y - 10

For more complex logic, the logic service accepts Exprtk expressions which can be found here

Scaled

The first step in generating a scaled value is to select a source of the data. Click the "Source" button to open the data directory. Here, select the data point you would like to scale.

The first step in generating a scaled value is to select a source of the data. Click the "Source" button to open the data directory. Here, select the data point you would like to scale.

By leaving the "Scale" option unchecked, the dialog provides the ability to copy the data point value, while adjusting its name or units. This may be useful in scenarios where the data point provided by a driver or service has the value you'd like to use directly, but you wish to change the name or units provided.

If the "Scaled" option is checked, the dialog provides two scaling techniques "Range" and "Multiplier".

The range scaling is useful for scenarios where the source data has a known and precise input and output range. Enter the source specifications in the "Source Min" and "Source Max" input fields. Enter the desired metric output range in the "Metric Min" and "Metric Max" fields.

Multiplier

The multiplier scaling dialog is useful for generic scaling of data. Multiplier scaling should be used when the source data does not have a precise range and may require an offset "calibration." This requires calculating a multiplier based on the expected ranges of the input and output units. Then, using the expected output value, enter the offset between the expected value and the reported value into the offset field.