LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to set up multiple data inputs from analog and serial devices, each have different data rates

What is the best practice for setting up a data read across multiple input devices? I have the following devices i am trying to read from and their update times

 

1. Analog input - 50 samples/second

2. Analog input - 1 sample/second

3. Analog Input - 1 sample/second

4. Serial input -  1 sample/2 seconds

5. Serial input - can read at any rate but need to write a command first to get response (planning on once a second though)

 

I have an NI usb daq and two serial to usb cables. I need to sync all of this into a single VI since I need to perform some data processing and then plot a lot of this data before saving. I also need to display the serial inputs in real time as well. What the best way to do this? and how do I set up the VI timing wise so everything is synced in the data file? My assumption is that the 50samples/second is the driver and everything else just updates the same number during that time.

0 Kudos
Message 1 of 33
(4,699 Views)

What is the best practice for setting up a data read across multiple input devices? I have the following devices i am trying to read from and their update times

 

1. Analog input - 50 samples/second

2. Analog input - 1 sample/second

3. Analog Input - 1 sample/second

4. Serial input -  1 sample/2 seconds

5. Serial input - can read at any rate but need to write a command first to get response (planning on once a second though)

 

I have an NI usb daq and two serial to usb cables. I need to sync all of this into a single VI since I need to perform some data processing and then plot a lot of this data before saving. I also need to display the serial inputs in real time as well. What the best way to do this? and how do I set up the VI timing wise so everything is synced in the data file? My assumption is that the 50samples/second is the driver and everything else just updates the same number during that time.

 

Message 2 of 33
(4,699 Views)

First of all, if all of your Analog Inputs are on the same DAQ board, then they all have to run at the same rate.  So you will actually have 3 analog inputs at 50S/sec.

 

I would have 3 loops that run completely independent of each other: Analog Input, Serial 1, Serial 2.  Then they can run at whatever rate they need to.  Then use another loop to gather the data.  You can use a queue to have the acquisition loops send the data to the processing loop.  From there, there are many ways to process the data including duplicating values or interpolation.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 33
(4,674 Views)

@crossrulz wrote:

First of all, if all of your Analog Inputs are on the same DAQ board, then they all have to run at the same rate.  So you will actually have 3 analog inputs at 50S/sec.

 

I would have 3 loops that run completely independent of each other: Analog Input, Serial 1, Serial 2.  Then they can run at whatever rate they need to.  Then use another loop to gather the data.  You can use a queue to have the acquisition loops send the data to the processing loop.  From there, there are many ways to process the data including duplicating values or interpolat


When you say have 3 loops, do you mean 3 separate queues running in each loop or to have 1 queue and two loops (data input and data processing), where I have multiple enqueue element blocks for each data input? How does timing get set up with multiple while loops, do they just run simultaneously, but at what rate if each needs to run at a different rate? What happens during the "wait" times for example with the read every 2 seconds streaming input?

0 Kudos
Message 4 of 33
(4,657 Views)

I mean 3 loops with 1 queue to send data to the central processing loop.  You include information in the queue like who is sending the data and the data as a waveform (which includes the time the samples were taken).  Then it is just a matter of how you want to fill in the gaps.  Last time I did one of these, I just kept reusing the last given values of the slower acquisitions whenever I received the faster data.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 33
(4,647 Views)

@crossrulz wrote:

I mean 3 loops with 1 queue to send data to the central processing loop.  You include information in the queue like who is sending the data and the data as a waveform (which includes the time the samples were taken).  Then it is just a matter of how you want to fill in the gaps.  Last time I did one of these, I just kept reusing the last given values of the slower acquisitions whenever I received the faster data.


 

 

I tried to set up 3 loops but I am not getting them to run at the same time. I tried it with 1 queue but did not know how to set what the queue input is with such different inputs to the enqueue blocks so I made 3 queus in the attached VI. It stalls at the DAQ loop and never runs the others it seems. Is there an example for what this should look like somewhere?

 

0 Kudos
Message 6 of 33
(4,608 Views)

the 3 loops must have no dependency from other loop, so it can run simultanously. As for the queue, you can queue cluster with its element like the data source and its value. Then you can group the queue element according to the source and process it.

 

I suggest you try to look into Queue Message Handler.

Kudos and Marked as Solution == Thanks
0 Kudos
Message 7 of 33
(4,591 Views)

You have a dataflow error.  Three of your loops (dequeue, the two serial loops) are dependent on the Stop Value coming from your DAQ loop.  Those loops will only begin to run once you've stopped the DAQ loop.

 

You will also have some major problems with your Dequeue loop.  That loop will only iterate once it has received values on all 3 of the queues.  If the queues are receiving data t different rates, two of those queues are going to fill up because it will only take 1 piece of data out of each queue on an iterations.

 

Crossrulz's suggest is to use a single queue that the other 3 loops put data into.  The Dequeue loop will remove that data as it receives it and will sort out what to do with it.

0 Kudos
Message 8 of 33
(4,586 Views)

@RavensFan wrote:

You have a dataflow error.  Three of your loops (dequeue, the two serial loops) are dependent on the Stop Value coming from your DAQ loop.  Those loops will only begin to run once you've stopped the DAQ loop.

 

You will also have some major problems with your Dequeue loop.  That loop will only iterate once it has received values on all 3 of the queues.  If the queues are receiving data t different rates, two of those queues are going to fill up because it will only take 1 piece of data out of each queue on an iterations.

 

Crossrulz's suggest is to use a single queue that the other 3 loops put data into.  The Dequeue loop will remove that data as it receives it and will sort out what to do with it.


I tried to use a single queue but did not know how to wire different inputs (strings, numerics, etc.) to the same queue without getting an error. Also I was not sure how to turn my data into waveform data like he suggested. How do I set up a single queue to have multiple, different type, elements that queue at different rates?

0 Kudos
Message 9 of 33
(4,577 Views)

I am trying to use the variants examples to do this, but where/how in labview do I program it to have cluster elements that are named? Like in this example it has Group and data, how did he get that in there?

Example_VI.png

 

0 Kudos
Message 10 of 33
(4,559 Views)