Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to acquire data from 8 com ports (via USB hub) simultaneously?

Hi,

 

I need to measure the flow of water using balances. I am using a shift register to have up to 4 values of weight and time and the divide the weight over the time. I need to do this on 8 scales via com-usb simultaneously and write to a single file. I don't need a very high rate, about 1 each channel every 0.5 seconds.

 

I am not very experienced with labview and would really appreciate some direction on how to set this up.

 

Thank you,

 

Matteo

 

0 Kudos
Message 1 of 6
(3,564 Views)

To add to that, this is the vi I modified.

 

Matteo

0 Kudos
Message 2 of 6
(3,555 Views)

Hi MatteoNI,

 

A few questions to get things started off:

First, what sort of instrument are you using to get this information? That can give us a base of where to work when knowing the type of instrument and how that information is generated, gathered and then read.

 

Next would be what your program is currently doing vs what you want it to do. I am not sure I quite understand how the VI's you posted interact or what the general flow of your code is going to be.

 

To get you started I also have a couple of links you can use to start gathering examples and getting more of a foundation with LabVIEW and instrument control

 

This first article is a discussion of instrument control, how to set up and configure your instruments. You can select "getting started with USB" and then select your environment to see a tutorial on how that all works.

http://www.ni.com/white-paper/9860/en

Also, you may be interested in checking out www.ni.com/idnet to see if you can find the instrument you are using and get the drivers needed. It may even have some examples of use and configuration.

 

Hopefully that can get you started and we can proceed from there!

 

Regards,

 

James W.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 6
(3,536 Views)

Hi James,

 

Thank you.

 

I am creating a vi that will run 3 tests, and I am using a state machine for the sequence.

 

One of the tests requires to acquire the flow of liquid flowing through a filter, and I am measuring it with a scale, adam equipment,

http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=16553. I acquire 2 samples per second on each balance.

 

I have never acquired data from 8 com/usb port simultaneously and I am not sure what is the best way. I am concerned about the I/O rate and the encapsulated while loops. Should I create a consumer/producer design pattern for data? I am not very experienced with labview, and if that's not necessary I would prefer to avoid it.

 

This is the code I wrote yesterday for 2 balances, to scale up to 8 later on, and would like to use as sub-vi. I have 2 problems, and I would appreciate any suggestion about them:

1) sometimes the "string to data" subvi gives me an error where the balance sends unrecognized characters to the string and if i ignore it a couple of times it goes  away.

2) the data logging is still not working well.

3) will it be a problem to scale up?

 

Thank you very much for your help.

 

Kind regards,

 

Matteo

Download All
0 Kudos
Message 4 of 6
(3,531 Views)

Matteo,

when I was in a similar situation I choosed this approach:

I wrote one vi for the gage (scale) (as a state mc) that can run independely and handle all the stuff (grap comport, init, timing, reading, error checking) 

then i run multiple instances ( or multiple copies) of that vi .

2 values per second is very slow , you should be able to run 8  (depending on the baudrate and amount of data) of them without much thinking about bottlenecks....

In the main vi I used vi server and functional globals to control the indedendedly running vis and to exchange data, but would go with named queues now.

Since the com port is async you should think about your timing needs. (In my case I record the gage data and a timestamp and +- 1s wasn't a problem, and depending on your scale setup you get a filtered data anyway 😉 )

 

One major point in my app was that it shouldn't hang if one gage doesn't respond ...

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 6
(3,520 Views)

Hi Henrik,

 

I only have 2 scales for now and simply using their driver and putting them in a state machine loops is doing the work. As soon as I have the other scales I will try as you suggest.

 

Thanks!

 

Matteo

0 Kudos
Message 6 of 6
(3,464 Views)