Use the Simple Window Function
You can use the Simple Window function to output a simple moving window. In the FIFO (first in, first out) algorithm, the first data point that enters the window is the first to be processed and removed as new data points come in. This function takes a single value as inputs.
Review the following scenario for the Simple Window function. Then, you will simulate PLC data and calculate the trend in the data.
In a manufacturing setting, the Simple Window function is used to analyze the real-time performance of a specific machine component. As new data points representing the component's performance are generated, the Simple Window function processes the data in a FIFO (first in, first out) manner, allowing the engineers to monitor the immediate impact of any changes or adjustments made to the component. This helps in quick identification of any anomalies or deviations from expected performance, facilitating timely maintenance or intervention.
Follow the steps to Connect a Device and configure the following parameters:
- Device Type: Simulator
- Driver Name: Generator
- Enable Alias Topics: Select the checkbox.
After connecting the device, add the following tag. See Add Tags to learn more.
- Name: Select S - Random value generator
- Value Type: Select float64
- Polling Interval: Enter 1
- Tag Name: Enter input1
You can now create the analytics flows using data from the device and tag you previously created.
To create an analytics flow with the Simple Window 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 Simple Window processor. The Edit a Processor dialog box appears.
- Value Type: This parameter specifies the type of incoming value. For example, if our input1 tag generates float64 values and we want int values for our window, we can select int from the drop-down menu.
- Order: This parameter specifies the desired order of output window.
- Oldest -> Newest
- Newest -> Oldest
- Window Size: This parameter specifies the window in which the values will be observed.
Click Save.
- Connect the DataHub Subscribe processor (tag: input1) to the Simple Window processor with a wire and use the events connection.
- On the analytics canvas, click Save. The configured analytics flows should look like the following:
Click the View icon in the Simple Window processor to view the output values.
The output shows a window of size 10 holding the incoming values from our input1 tag.