Hi @jjansen,
I would recommend that you use a macro to calculate this average, here is an example that may be suitable for this application:
-
Within the “Project” tab click “Macro”:
-
Within the following menu, click “New”:
-
Follow the instructions within this post to implement a GetData() command and pull the sampled data into the macro:
Note: In this example I’m retrieving data from LW-59. You may need a variable to hold the total sum and average and a variable to count the number of samples. The data type I am reading this example is a short, but please configure the data type of the variable used within GetData() such that it matches the type sampled.
-
Store the total count within HMI memory, in this example I am storing the count within LW-1000:
Note: Information related to the SetData() command can be found within the post mentioned above as well.
-
Add the current data to a running total and save this data within HMI memory as well:
-
Calculate the average and set this within HMI memory:
-
Enable periodical execution and run this macro every one minute:
-
Click “Save & Compile” when finished:
Here is a link to a demo project: Link