---
title: Use the Linear Prediction Function
slug: manufacturing-connect-edge/use-the-linear-prediction-function
docTags: 
createdAt: 2024-05-24T20:16:58.825Z
---

You can use the Linear Prediction function to forecast future data points by fitting a linear equation to collected data and using statistical techniques to identify the underlying trend.

# User Scenario

Review the following scenario for the linear prediction processor function. Then, using an input processor, you will simulate PLC data and predict future data from the window of generated values.

In a steel production facility, the temperature within the blast furnace is a critical parameter that determines the quality of the produced steel. Operators use the Linear Prediction function to forecast the temperature trends based on past readings. By fitting a linear model to the historical temperature data collected from sensors, the function helps predict potential overheating or cooling, which could lead to suboptimal steel quality.

# Step 1: Add a Device

Follow the steps to [Connect a Device](docId\:nm1lQfefyA-DSIfFitIty) and configure the following parameters:

- **Device Type**: Simulator
- **Driver Name**: Generator
- **Enable Alias Topics**: Select the checkbox.&#x20;

# Step 2: Add Tags

After connecting the device, add the following tags. See [Add a Tag](docId\:h5heqIcXrCY3NCH9KBg9I) to learn more.&#x20;

## Tag 1: input1

- **Name**: Select **S - Random value generator**
- **Value Type:** Select **float64**
- **Polling Interval**: Enter **1**
- **Tag Name**: Enter **input1**
- **Min\_value**: Enter **1**
- **Max\_value**: Enter **25**

# Step 3: Create Analytics Flows

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

**To create an analytics flow with the Linear Prediction Processor function:**

1. In Manufacturing Connect Edge, navigate to **Analytics**.&#x20;
2. On the analytics canvas, click **Add processor.**
   The *Create a processor* dialog box displays.
   ![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/3fMtXfn5aePCdwLVv-2e9_image.png "The Add processor option")
3. Select **DataHub Subscribe**.
4. In the *Topic&#x20;*&#x66;ield, click the **Search&#x20;**&#x69;con, select the device you previously created, and then select the alias topic for the **input1&#x20;**&#x74;ag.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/SwS9umXUm7nlT7L-0_EWT_image.png" size="80" width="1141" height="571" position="center" caption="Create a Processor dialog box" showCaption="true"}
5. Click **Save**.
6. Click **Add processor** again and select the **Linear Prediction&#x20;**&#x70;rocessor.
   The following information defines this function:
   - **Window Size:** Enter a value that represents the range to observe before making each prediction. For this example, we input a value of **60**.
   - **Number of Predictions**: Enter a value to determine how many predictions you want. For this example, we input a value of **2**.
   - **Polling Interval:** Enter the interval in seconds at which you want to publish the data from the input tag. For this example, we input a value of **1**.
   - **TimeInterval:&#x20;**&#x49;f you know your input is going to publish at the expected interval, it is better to disable this timer by entering **0** in the field.
   - Click **Save**.
     ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/aPy7xlRcjPGDcK7VXK4IZ_image.png" size="80" width="569" height="526" position="center" caption="Edit a Processor dialog box" showCaption="true"}
7. Connect the *DataHub Subscribe* processor (tag: *input1*) to the *Linear Prediction* processor with a wire and use the **events&#x20;**&#x63;onnection.
8. On the analytics canvas, click **Save**.
   The configured analytics flows should look like the following:
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/LN1YAvPggPSl8b0I1QI4Q_image.png" size="80" width="393" height="238" position="center" caption="Completed Flows Canvas" showCaption="true"}

# Step 4: View Output of Processor

Click the **View&#x20;**&#x69;con in the *Linear Prediction&#x20;*&#x70;rocessor to view the output values.

The prediction is made by extrapolating the number of predictions in the simple formula `y = m*X + b`.

The output indicates a linear prediction with an intercept of **9.89**, a slope of **0.0434**, and a prediction value of **12.68**.

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/CmLNe5bSliluepivVQMBL_image.png" size="80" width="698" height="609" position="center" caption="Output of Linear Prediction" showCaption="true"}

&#x20;
