Jump to content

Multiple VI's Reading From Same Hardware


Recommended Posts

I have a situation that requires multiple devices to read from a single DAQ and am in need of some architecture/implementation advice. I am reading 3 analog channels, from which multiple independent VI's must read at various times based upon the integer representation of a digital port.

For example:

VI "A" reads from all analog channels upon user event "view" button

VI "B" reads from all analog channels when the digital port = 2.

VI "C" reads from all analog channels when the digital port = 4

My idea was:

All 3 analog channels are ALWAYS being logged to a buffer of 10 minutes of data (200Hz)

Start/end times are logged to global timestamps upon rising/falling edge of the port value changing

Upon the falling edge, a global boolean turns on that triggers a user event on VI "A" for processing of the data

Example Situation:

1. The digital port changes from 0 to 2 which triggers a write to a global "start" timestamp

2. The digital port changes from 2 to 4 which triggers a write to global "end' timestamp, the global boolen to turn true, and then a global "start" timestamp is written to

3. VI "A" begins processing the data form the waveform between "start" and "end" time

4. During this, the user selects the "view" button in VI "A" which waits "n" seconds and then copies the last "n" seconds of data from the global waveform

I am not sure if my architecture is the best approach, but it is the only I could think of with multiple independent VI's simultaneously reading from the same DAQ.

According to: http://forums.lavag.org/Ideas-for-parallel...data-t5712.html this approach was used, but I am still looking for advice.

Thanks!

Link to comment

Your contemplated approach -- using a DAQ server to continuously buffer data and make it available to clients as needed -- is fairly conventional and reasonably straightforward to implement. There are two approaches that I have used successfully in this situation:

1. Use a functional global to implement a circular buffer. This is efficient and will limit the amount of memory that you're using. You might also need to maintain an array of read pointers so that you can keep straight which client has read what channels.

2. Use queues to transfer all of the data all of the time to the client VIs. The clients can just throw away the data when they don't need it, and process it as required when they need to. This can sometimes be a little bit simpler to implement, but it can also be slower and use more memory.

I've put together a few applications in the past with similar requirements, and it's mostly just common sense how you choose to architect the operational details.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.