How-To Guides
Analytics Guides

Use the Moving Window Processor Function

13min
you can use a single input to perform calculations over a sliding or moving window of data from your plc device single inputs are to be provided with the events type connection and then the respective functions are calculated as the names suggest understanding different moving window functions use one of the following functions for your inputs moving average calculates the average of the moving window of input values in the flow moving maximum returns the maximum value among the moving window of input values in the flow moving minimum returns the minimum value among the moving window of input values in the flow user scenario review the following scenario for the moving window processor function then, you will simulate plc data and calculate kpis using multiple moving processor functions in a production facility, several plcs use multiple sensors to monitor parameters such as temperature, pressure, and speed you can monitor temperature trends and detect anomalies in machines by using the moving average function over a specific time frame you can identify any sudden spikes by extracting the highest pressure readings from sensors using the moving maximum function over a specific time frame you can pinpoint periods when machine performance drops below acceptable levels by using the moving minimum function within a defined window 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 tags see add tags docid\ h5heqicxrcy3nch9kbg9i to learn more only one tag will be used for simulating the different moving processor outputs mentioned above tag 1 tag1 name select s random value generator value type select float64 polling interval enter 5 tag name enter tag1 min value enter 1 max value enter 99 step 3 create analytics flows you can now create the analytics flows using data from the device and tag you previously created follow the appropriate step out of 3a, 3b, or, 3c based on the moving window processor function you want to use to create an analytics flow with the moving window 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 step 3a configure moving average processor click add processor again and select moving average the following information defines this function field name select the field name for which you want to apply the function for example, value or downtime processing type select float from the drop down list window size enter the number of values you want the function to consider click save connect the datahub subscribe processor (tag tag1) to the moving average 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 3b configure moving maximum processor click add processor again and select moving maximum the following information defines this function field name select the field name for which you want to apply the function for example, value or downtime processing type select float from the drop down list window size enter the number of values you want the function to consider click save connect the datahub subscribe processor (tag tag1 ) to the moving maximum 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 3c configure moving minimum processor click add processor again and select moving minimum the following information defines this function field name select the field name for which you want to apply the function for example, value or downtime processing type select float from the drop down list window size enter the number of values you want the function to consider click save connect the datahub subscribe processor (tag tag1 ) to the moving minimum 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 moving processor to view the output values view moving average output the average function calculates the average of last 10 values from the defined tag1 values view moving maximum output the maximum function finds the largest of last 10 values from the defined tag1 values view moving minimum output the minimum function finds the smallest of last 10 values from the defined tag1 values