Most of the analysis and statistics that I need to observe is not time based but based on product positioning. I need to perform statistics based on some equally distributed samples throughout the length of a product.

An example is:

Say you have a long bar of material and a counter that can be used to determine where in the strip we are at for a given point. Let's say we are interested in tension on the bar and wish to provide statistic based on a footage value (equally distributed samples through the bar).

In PI, I have a tension value being collected on change and I have a counter collected on change that I use to determine how much of the long bar has moved through time. The line will speed up and slowdown and might even stop while the bar is running so time is not an option for doing weighted averages. I envision the best way to do this is to use the raw tension values and find the interpolated counter values at the time of the raw values. I can then use a weighted average method to produce the statistics. The tension values will be the raw values which is the best samples and the interpolated count value can be used to add weights to each value.

I believe the best way is programmatically using PI OLEDB Enterprise and have an AF sql statement to do this. I would have the tension and counter as attributes in a templated element and use SQL. I would then write the results back to PI and/or a database for comparison from product to product. I prefer C# or Java if someone has a sample or example.

Is the method I mention above the best way to do this? Any alternatives to this that might be better?

Thank you in advance for your considerations

Why not do this calc continuously (like a Totalizer) using PE or ACE?