Jump to content

Acquiring multiple, independent, asynchronous data channels


Recommended Posts

I have this application where I've already got a working solution in place, but I'd like to ask for critiques on the solution to see if I could have done it in a better / more efficient / more easily maintainable way.

This application allows the acquisition of transducer data from 8 separate channels at relatively low rates (no more than 60Hz) to a CSV file. Each channel can be started and stopped independently and can have different acquisition rates. These channels all reside on a single simultaneously-sampled SCXI module.

My solution

Data acquisition begins for all 8 channels when the program starts at a rate significantly faster than 60Hz (2kHz in this case) in a parallel loop to the main event and state machine loops. The data is put into a 2d circular waveform buffer that is configured for ~15 seconds of buffering time. This buffer (essentially a complicated FGV) has a function that allows each of the monitoring loops to request a specific time slice and number of samples and will return status as [OK, Sample not yet acquired, Sample has left buffer]. The monitoring loops run at ~200Hz and, based off of the start time and the data rate know the next time slice that it wants. It requests a 100 sample slice from the buffer until it returns OK (along with the relevant data) which it then averages, logs off to its CSV file, plots to its FP chart, then increments its internal variable for the next time slice that it wants. If the program lags enough that a requested slice has left the buffer already, an error is thrown (the most lag I've seen is a little over a second, so 15 seconds should be more than enough).

Another decent side-benefit of this architecture is that it makes it easy to have 2-3Hz digital displays for each of the 8 channels running continuously on the front panel regardless of whether data is being logged.

Originally, the design for this program simply requested the most recent data point from a simple 1D FGV (most recent values for all 8 channels), but this led to significant jitter whenever the computer would lag a bit here or there.

Anyway, just curious to see if anyone had a better way of doing this.

Regards,

Mike

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.