How-To Guides
Analytics Guides

Use the Feature Extractor Function

6min

You can use the Feature Extractor processor function to extract meaningful patterns and characteristics from raw PLC data, transforming complex data into features that machine learning models can easily understand and utilize.

User Scenario

Review the following scenario for the feature extraction processor function. Then, using an input processor, you will simulate PLC data and extract features from the window of generated values.

In a food processing plant, PLCs are placed strategically along the production line to monitor the moisture content of products as they pass through ovens and cooling stations. Using a window of N values, you can calculate the Average and Median moisture content at critical stages of the production process.

Additionally, to assess the consistency of moisture levels, you can use the Standard Deviation and Variance functions of the Feature Extractor processor to provide real-time data analysis and actionable insights. It helps to identify and address optimal features, preventing product spoilage and ensuring that each batch meets the company's strict standards.

Step 1: Add a Device

Follow the steps to Connect a Device and configure the following parameters:

  • Device Type: Simulator
  • Driver Name: Generator
  • Enable Alias Topics: Select the checkbox.

Step 2: Add Tags

After connecting the device, add the following tag. See Add Tags to learn more.

Tag 1: moisture

  • Name: Select S - Random value generator
  • Value Type: Select float64
  • Polling Interval: Enter 5
  • Tag Name: Enter moisture
  • Min_value: Enter 1
  • Max_value: Enter 199

Step 3: Create Analytics Flows

You can now create the analytics flows using data from the device and tag you previously created.

To create an analytics flow with the Feature Extraction Processor function:

  1. Navigate to Analytics.
  2. On the analytics canvas, click Add processor. The Create a processor dialog box displays.

    The Add processor option
    The Add processor option
    
  3. Select DataHub Subscribe.
  4. In the Topic field, click the Search icon, select the device you previously created, and then select the alias topic for the moisture.

    Create a Processor dialog box
    Create a Processor dialog box
    
  5. Click Save.
  6. Click Add processor again and select the Feature Extractor processor. The following information defines this function:
    • Window Size: Enter the number of values you want the function to consider.
    • Timeinterval: You can set a timer in milliseconds to push values. Set the timer to zero if you don't want to use it.
    • Feature Options: Select the Average, Median, Standard Deviation, and Variance checkboxes to view your output.
  7. Click Save.

    Feature Extractor processor dialog box
    Feature Extractor processor dialog box
    
  8. Connect the DataHub Subscribe processor (tag: moisture) to the Feature Extractor processor with a wire and use the events connection.
  9. On the analytics canvas, click Save.

The configured analytics flows should look like the following:

Completed analytics flow
Completed analytics flow


Step 4: View Output of Processor

Click the View icon in the Feature Extractor processor to view the output values.

Before you can see any output, the input window size needs to be filled. After that, the output will include the prediction along with its timestamp.

Feature Extractor output
Feature Extractor output