How-To Guides
Analytics Guides

Use the Anomaly Detection Function

6min
the anomaly detection function applies the three sigma rule to identify outliers by comparing data points against a dynamic threshold of standard deviations from the mean, allowing for real time adjustment to emerging patterns this function operates by maintaining a rolling window of data, calculating the average and standard deviation within this window, and flagging values that deviate beyond the user defined standard deviation range as anomalies user scenario review the following scenario for the anomaly detection processor function then, using an input processor, you will simulate plc data and detect anomalies from the window of generated values in a large scale manufacturing factory, the anomaly detection function is used to monitor the machine's temperatures it calculates a moving average and standard deviation of temperature readings, flagging any readings that significantly deviate as potential cooling system failures by defining the number of standard deviations from the average as the threshold for normal operation, factory engineers can quickly identify and respond to overheating risks, ensuring site reliability and uptime 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 step 2 add tags after connecting the device, add the following tag see add tags docid\ h5heqicxrcy3nch9kbg9i 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 50 step 3 create analytics flow you can now create the analytics flows using data from the device and tag you previously created to create an analytics flow with the anomaly detection processor function in manufacturing connect 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 anomaly detection 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 100 deviations enter the number of standard deviations that would be considered normal, making everything outside that definition anomalous data for this example, we input a value of 3 topic reset enable this option to reset the function on topic change control chart mode if this option is enabled, there will be no modifications done to the moving window before calculation click save connect the datahub subscribe processor (tag input1 ) to the anomaly detection 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 anomaly detection processor to view the output values the output describes a situation where the current value of 1 86 is well above the lower limit of 0 13 and below the upper limit of approximately 2 33 , suggesting no anomaly is detected at this timestamp within the moving average of 1 23 and a standard deviation of 0 36