Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Average multiple short-interval measurements around a given time


Conatser Aug 27, 2015 10:03 PM

Hi,

I'm maintaining a CR1000 program with a variety of sensors, including a weather station, pressure transducers for water depth and soil moisture probes. We're finding that the measurement error on the pressure transducers is unacceptably large, and we would like to try averaging short bursts of measurements (say 20 measurements, 5 seconds apart) centered around the same time that the main scan is run (every 15 minutes). We have two types of transducers, for redundancy: Stevens SDX (analog, VoltSE) and Decagon CTD (SDI12).

As this is my first programming adventure, I'm muddling my way through and would appreciate help/clarification on several points:

-Should I use a slow sequence or a subscan to obtain the sample data for averaging?

-How can I offset the start time of the averaging scan from that of the main scan so that they are centered at the same time?

-Is it possible to keep all the outputs in a single data table, or will I end up having two separate data tables--one for the single-sampled data, and one for the averaged measurements?

I can post the code I'm working with if that might help, but it is several hundred lines--very long and inefficiently written.

Thanks,
Chris


JDavis Sep 2, 2015 02:57 PM

Your data would have to be in separate tables, because your average centered around a time wouldn't be available when your 15 minute table is written.

The easiest way to average the values would be to use AvgRun, to calculate a running average.
Another option would be to offset the DataInterval in a data table. The data will be time stamped with when the value was written, not the center time.

Log in or register to post/reply in the forum.