Applying Simpson's Rule to Data Historian Sampling

  • Thread starter Thread starter ppamco
  • Start date Start date
  • Tags Tags
    Data Sampling
Click For Summary
SUMMARY

This discussion focuses on applying Simpson's Rule for calculating total flow from flow meter samples stored in a data historian. The user samples flow every 10 seconds and seeks to integrate these samples over a day. While Simpson's Rule is suggested, an alternative approach using the rectangular rule is recommended as a simpler initial method. The conversation also touches on the trapezoidal rule and the importance of data shape, noting that Simpson's Rule is most effective for curved data, particularly quadratic or cubic functions.

PREREQUISITES
  • Understanding of basic numerical integration techniques, including Simpson's Rule and the rectangular rule.
  • Familiarity with data historians and how they store time-series data.
  • Basic knowledge of flow measurement and sampling intervals.
  • Proficiency in scripting languages such as VBScript or CalcScript for implementing calculations.
NEXT STEPS
  • Research the implementation of the rectangular rule for numerical integration in flow calculations.
  • Explore the trapezoidal rule and its application in improving accuracy over the rectangular rule.
  • Study the characteristics of polynomial functions to understand when to apply Simpson's Rule effectively.
  • Learn about least squares analysis for fitting polynomials to sampled data for enhanced accuracy.
USEFUL FOR

This discussion is beneficial for data analysts, engineers working with flow measurement systems, and anyone involved in numerical integration and data analysis in time-series contexts.

ppamco
Messages
1
Reaction score
0
Hi All
I am hoping someone can help me out with my problem.
I am sampling data from a flow meter every 10 seconds and storing it into a data historian. The readings are the instantaneous flow rate at the moment the data is sampled.
My problem is that I need to work out (based on the stored samples) the total flow over a given period (say 1 day). I have been advised that simpson's rule may offer a reasonable solution for integrating the area under the curve represented by the samples over the given time span.
Let me be frank, I am no good at math! I can find plenty of reference to simpson's rule on the web but I don't understand much of what I am reading.
The calculation engine supplied with the data historian supports vb script, external .exe's and its own scripting language (CalcScript).
I am hoping that some kind soul will take pity on me and help me out in understanding how to apply simpson's rule to my set of circumstances.
Any help is greatly appreciated.

ppamco
 
Computer science news on Phys.org
I suppose this is too late to answer, wish i had seen this before. You don't need to use Simpson's rule to begin with. Just use rectangular rule. So if one measurement is say 9.3 gal/sec and you measure between 10 sec; 9.3gal/sec x 10sec=93 gallons, then move to next step. Next up approx is trapizoidal rule and simpson's and 3/8 simpson's then gaussian integration but rectangular rule will get there to start and maybe good enuff.
 
I'd be curious to see how the data looks when plotted (as accurately as possible). If it's linear in most places, Simpson's rule will likely give the least accuracy compared to the improved trapezoidal or midpoint rule, however, if the data is curved (specifically quadratic or cubic) then Simpson's rule will give you an ideal result. I'm unsure about how Simpson's compares to the other Newton-Cotes approximation forumulas when it comes to nth-degree polynomials. I'd still be willing to bet that Simpson's would perform decently on polynomials greater than degree 4. We can take a look at the error bound formula for Simpson's rule and notice that the 4th derivative of any cubic polynomial will be zero, therefore, the error bound on any cubic using Simpson's rule (with no respect to iterations, only restriction they are even) will be zero, also.

Once you get some nice data samples, you could always do some least squares analysis, and figure out which polynomial looks the best. From there, you should be able to determine which Newton-Cotes formula gives the most accuracy with respect to your data.

Edit: Actually, I stand corrected. I don't know what I was thinking about Simpson's rule not being the most accurate for linear equations (fourth derivative is of course zero). I'll rephrase my above statements and say that other "easier and more efficient" methods may exists for your data set compared to Simpson's rule.
 
Last edited:

Similar threads

  • · Replies 23 ·
Replies
23
Views
3K
Replies
5
Views
798
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 23 ·
Replies
23
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K