Use the Inputs Processor Function
You can use multiple inputs to create time-series functions and calculate Key Performance Indicators (KPIs). Multiple inputs are to be provided with the value type connection, and then the respective functions are calculated.
Use one of the following functions for your inputs:
- Inputs Average: Calculate the average of the inputs in the Flow.
- Inputs Maximum: Find the maximum value between the inputs in the Flow.
- Inputs Minimum: Find the minimum value between the inputs in the Flow.
- Inputs Sum: Add all the input values in the Flow.
Review the following scenario for the inputs processor function. Then, you will simulate PLC data and calculate KPIs using multiple inputs processor functions.
In a production facility, several PLCs use multiple sensors to monitor parameters such as temperature, pressure, and speed.
- You can calculate the average temperature of various sections of the production line using the Inputs Average function.
- You can track the highest pressure with the Inputs Maximum function.
- You can track machine downtime by using the Inputs Minimum function.
- You can aggregate total production output over a specified period using the Inputs Sum function.
Follow the steps to Connect a Device and configure the following parameters:
- Device Type: Simulator
- Driver Name: Generator
- Enable Alias Topics: Select the checkbox.
After connecting the device, add the following tags. See Add Tags to learn more. Each tag will be used for simulating the different Join processor outputs mentioned above.
- Name: Select S - Random value generator
- Value Type: Select int64
- Polling Interval: Enter 5
- Tag Name: Enter tag1
- Min_value: Enter 49.
- Max_value: Enter 49.
- Name: Select S - Random value generator
- Value Type: Select int64
- Polling Interval: Enter 5
- Tag Name: Enter tag2
- Min_value: Enter 50.
- Max_value: Enter 50.
- Name: Select S - Random value generator
- Value Type: Select int64
- Polling Interval: Enter 5
- Tag Name: Enter tag3
- Min_value: Enter 51.
- Max_value: Enter 51.
You can now create the analytics flows using data from the device and tags you previously created. Follow the appropriate step out of 3a, 3b, 3c, or 3d based on the Inputs Processor Function you want to use.
To create an analytics flow with the Inputs Processor function:
- Navigate to Analytics.
On the analytics canvas, click Add processor. The Create a processor dialog box displays.
- Select DataHub Subscribe.
In the Topic field, click the Search icon, select the device you previously created, and then select the alias topic for the tag1.
- Click Save.
- Repeat steps 2-5 to add another DataHub Subscribe node. Select the alias topic for the tag2 and tag3 respectively.
- Click Add processor again and select Inputs Average. The following information defines this function:
- Field Name: Select the field name for which you want to apply the function. The field name must be available in all the inputs. For example, value or downtime.
- Processing Type: Select unsigned from the drop-down list.
Click Save.
- Connect the DataHub Subscribe processor (tag: tag1) to the Inputs Average processor with a wire and enter the definition of Avg_tag1 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag2) to the Inputs Average processor with a wire and enter a definition of Avg_tag2 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag3) to the Inputs Average processor with a wire and enter a definition of Avg_tag3 for the values connection.
- On the analytics canvas, click Save.
The configured analytics flows should look like the following:
- Click Add processor again and select Inputs Maximum. The following information defines this function:
- Field Name: Select the field name for which you want to apply the function. The field name must be available in all the inputs. For example, value or downtime.
- Processing Type: Select unsigned from the drop-down list.
Click Save.
- Connect the DataHub Subscribe processor (tag: tag1) to the Inputs Maximum processor with a wire and enter the definition of Max_tag1 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag2) to the Inputs Maximum processor with a wire and enter a definition of Max_tag2 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag3) to the Inputs Maximum processor with a wire and enter a definition of Max_tag3 for the values connection.
- On the analytics canvas, click Save.
The configured analytics flows should look like the following:
- Click Add processor again and select Inputs Minimum. The following information defines this function:
- Field Name: Select the field name for which you want to apply the function. The field name must be available in all the inputs. For example, value or downtime.
- Processing Type: Select unsigned from the drop-down list.
Click Save.
- Connect the DataHub Subscribe processor (tag: tag1) to the Inputs Minimum processor with a wire and enter the definition of Min_tag1 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag2) to the Inputs Minimum processor with a wire and enter a definition of Min_tag2 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag3) to the Inputs Minimum processor with a wire and enter a definition of Min_tag3 for the values connection.
- On the analytics canvas, click Save.
The configured analytics flows should look like the following:
- Click Add processor again and select Inputs Sum. The following information defines this function:
- Field Name: Select the field name for which you want to apply the function. The field name must be available in all the inputs. For example, value or downtime.
- Processing Type: Select unsigned from the drop-down list.
Click Save.
- Connect the DataHub Subscribe processor (tag: tag1) to the Inputs Sum processor with a wire and enter the definition of Sum_tag1 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag2) to the Inputs Sum processor with a wire and enter a definition of Sum_tag2 for the values connection.
- Connect the DataHub Subscribe processor (tag: tag3) to the Inputs Sum processor with a wire and enter a definition of Sum_tag3 for the values connection.
- On the analytics canvas, click Save.
The configured analytics flows should look like the following:
Click the View icon in the Inputs processor to view the output values.
The average function calculates the average of three defined tag values.
The maximum function finds the largest of three defined tag values.
The minimum function finds the lowest of three defined tag values.
The summation function calculates the total of three defined tag values.