LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from two equipment at the same time

I need to take readings from two instruments via GPIB Bus, one is a multimeter the other is the power supply. I need to have the reading from the multimeter, while at the same time, i need the corresponding current value from the power supply. I intend to put a read-visa session of each instrument in the same "while" loop parallelly. I am afraid when the two vis send the read-write command at the same time, it might cause problems on the bus. Will VISA coordinate the order of the command sending to the instruments that the GPIB bus connects. The code is attached. Thank you!
0 Kudos
Message 1 of 11
(4,767 Views)
Can you place your SubVIs on the different frames of the sequence? This will allow you to work with two instruments separatly.
I just mean that if you want to make readings of different devices in different moments you can separate them by using of the Sequence structure.
This works of cause in the case when your devices really don't have to work in parallel. But if you can read one device first and another one later you can use sequences.

Good luck.

Oleg Chutko.
0 Kudos
Message 2 of 11
(4,767 Views)
CPU:

Since each instrument has a different GPIB address, VISA takes care of addressing each instrument at the proper time. So this will work correctly regardless of whether you serialize the queries or let them run in parallel. Obviously when they run in parallel they will not really both be doing GPIB reads at the same time, as this is not technically possible in GPIB. In this case, LabVIEW will just make it as parallel as possible and optimize where it can.

One change that I highly recommend is that you should not open and close the VISA sessions each time you want to access your devices. You should just open them once in the main VI, and then pass them in to the sub-VI's. Close them only when you are done, or optionally, let LabVIEW control wh
en they are closed. But doing this each time adds overhead - Open and Close are expensive operations in general.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
Message 3 of 11
(4,767 Views)
Dan,
When you say 'VISA takes care of...', does it take care of the following scenario?

Labview loop A writes to Device A on GPIB address 1 and reads the answer back (using VISA Write and VISA Read).
On a parallel loop B Labview writes to Device B on GPIB address2 and reads the answer back.
Is it possible that loop B writes right after loop A writes (before loop A can read)? If this is possible, what would happen if loop B command takes a long time to complete and ties up the GPIB bus beyond the time out of Device A?
Thanks.
Zuolan Wang
0 Kudos
Message 10 of 11
(4,767 Views)
Zuolan:

The scenario you describe should work fine. Each of the 4 operations (2 writes and 2 reads) is atomic. Since they are in parallel loops, it does not matter whether the read from A occurs before or after the write to B, for example. Each of the 4 operations readdresses the appropriate device to either talk or listen, followed by the data transfer stage.

If the write/read to B takes a long time, this has no effect on any transfers to/from device A because it is not the device that knows about your timeouts, it is a software setting in NI-VISA (and NI-488). The final read from A will not even start if an operation to device B is in progress because LabVIEW and NI-VISA know that they are both using GPIB0, for example. The timeou
t is calculated only from the moment when each I/O operation actually begins.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 11 of 11
(4,422 Views)
,

Your solution depends on your exact need. With two seperate instruments, it is rather difficult to get "simultaneous measurements". If you would explain exactly your requirements for 'simultaneous', we can probably offer an appropriate solution.

As Dan mentioned, there is no possibility of doing simultaneous GPIB (although you may be able to get away with this using seperate GPIB cards, although I don't know if this is possible.)

Depending upon your requirements, the solution could range from, as suggested, a serialized reading of the two instruments (dataflow=parallel, but process is serial) for a measurements within a second or so (my best guess) of each other, to using a single instrument, for both measurements.

If you would explain a li
ttle more about what you are trying to do, and how precise your measurement is, as well as perhaps your limitations (budget, etc) someone may be able to offer a more appropriate solution to your problem.

Good luck
Message 4 of 11
(4,767 Views)
Thanks for your help. my experiment is that, the power supply will sweep from let's say -3A to 3A automatically with some sweep rate let's say 0.1A/s. When I request the value of the current, I want the value of voltage taken from a sample (not really the output voltage of the power supply) by reading from a multimeter for that current. I want the reading process to be fast, because the current just sweep on its own without stopping. So reading values fast from the multimeter is crucial. If the current value I takes is 1A, I need to have the volatge value at almost exact time. If some delay, let's say 1s over here ( in practice it is only about less than 5ooms), the voltage value will correspond to 1.1A. So the result will not accurate. That can be improved by u
sing a slow sweep rate, like 0.01A/s. Because I am thinking of reducing the time wasted here, so I have that idea. It is not possible for me to get another GPIB controller.
0 Kudos
Message 5 of 11
(4,767 Views)
,

I would suggest a few alternatives to your setup. I strongly recommend using a DAQ board to acquire both your current and voltage measurements. I would look in the NI catalog to figure out what single card can do this. If you try to do a sweep, and don't simultaneously acquire Voltage and Current, you will get unreliable results, unless you somehow, through software, also get an accurate time for each measurement (not possible through GPIB?) and then interpolate the actual measurement (somewhat difficult.)

Another way to do it is to measure the current with your multimeter using a shunt type setup. This will allow you to read only voltages. However, you will still not be able to synchronize your measurements too accurately, but i
f you were to get an inexpensive DAQ board, you could do both measurements simultaneously (wihin a few microseconds anyway.)

Good luck, and please keep us up to date on your progress.
0 Kudos
Message 7 of 11
(4,767 Views)
Hi CPU,

After reading your description of what you are trying to do, I am of the opinion that using the built in sweep function method is not workable.

Let's ignore for the time being that the meter will take some time to make the measurement and assume that it will return a value instantaneously when queried. Because the GPIB can only talk to one device at a time, there will be some time delta between the two readings.

I would recomend you abandon the sweep operation. Instead, set the value for the power supply explicitly from within your code, and then take your readings. Increment the power supply setting and then repeat this process until done.

Let me know if you have any questions,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 11
(4,767 Views)
Hi, Ben, I'm using Lakeshore CS-4 Power supply. This current source can only output sweeping current (from 0 to uplimit current, or from maximum current to minimum current with some sweep rate). It is not possible for me to set the output current. So the only thing I do is that reduce the sweep rate to say 0.001A/s, if I did so, the corresponding voltage value will be with less accuracy.
0 Kudos
Message 8 of 11
(4,767 Views)