How-To Guides
Analytics Guides
Use the Linear Prediction Function
6min
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\ ish7bqhzxswtdx8vbnszb 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 docid\ xgwokqbtpevii7or82ll0 to learn more 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 to create an analytics flow with the linear prediction processor function in litmus edge, 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 input1 tag click save click add processor again and select the linear prediction processor 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 if 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 connect the datahub subscribe processor (tag input1 ) to the linear prediction processor with a wire and use the events connection on the analytics canvas, click save the configured analytics flows should look like the following step 4 view output of processor click the view icon in the linear prediction processor 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