06-26-2014 03:36 PM
Hi there,
I am working on a system which will communicate with 1-32 DUT at a time. I am trying to extract data from these units as quick as possible so that I can move on to the next task. My initial thoughts was using an array of COM ports and feeding into a for loop to write/read one unit at a time but it seems like that would take too long. All 32 units are the same so they all use the same write/read VI. Making this write/read VI reentrant seems like a hassle because I believe I would need 32 instances of this VI on my block diagram? And it doesn't seem like a good design if I need to increase/decrease the number of units/com port in the future. But would this significantly increase my speed?
Please advise on the fastest way to accomplish a simultaneous write/read on 32 com ports.
Thank you!
Serge
06-26-2014 03:45 PM
I don't know if any of the underlying VISA functions would (Read and Write) would prevent you from using them simultaneously on different Com ports.
But I would certainly make the subVI re-entrant. Without it, then you definitely can't run the subVI simulataneously.
You can use a For Loop with parallelism turned on. (Feature added to one of the more reason LabVIEW versions. Open the ports in a For Loop operating on an array of VISA references. Send that array of references after opening them in a For Loop, to a while loop that let's you do repetitive reads and writes. Inside that have your parallell For Loop that constains the subVI. After the while loop, after you are done all your testing, have a For Loop that operates on the array of references to close the Com ports.
06-26-2014 03:51 PM - edited 06-26-2014 03:51 PM
@SergeB wrote:
Hi there,
I am working on a system which will communicate with 1-32 DUT at a time. I am trying to extract data from these units as quick as possible so that I can move on to the next task. My initial thoughts was using an array of COM ports and feeding into a for loop to write/read one unit at a time but it seems like that would take too long. All 32 units are the same so they all use the same write/read VI. Making this write/read VI reentrant seems like a hassle because I believe I would need 32 instances of this VI on my block diagram? And it doesn't seem like a good design if I need to increase/decrease the number of units/com port in the future. But would this significantly increase my speed?
Please advise on the fastest way to accomplish a simultaneous write/read on 32 com ports.
Thank you!
Serge
Hi there.
Making the VIs re-entrant is obviously a good step. Without this you are blocking on each call and lose your intended purpose of parallel tasks. If you use re-entrant VIs and then a sequential FOR loop you are *still* blocking on the parallel tasks, just in a different way. If you are looking for the "fastest" way to accomplish your goal, I think you have already stated it - 32 re-entrant VIs on a block diagram with the error clusters merged together.
You *could* run a parallel FOR loop, wiring in an array of COM Ports and an output array of result data. You lose the error cluster dependency so you should add an array of errors out and then merge those to determine if you have any issues.
Do you plan on performing this activity in a loop though rather than performing a one-shot communciation to all devices and then finishing?
EDIT: Whoops, post collision.
06-26-2014 03:53 PM
I don't know of any way you can simultaneously send the same characters to multiple COM ports, and even if you could, you would still need independent reads.
Are you using a port server to get access to so many COM ports? I hope you're not using an enormous chain of USB hubs and USB-to-serial adapters, although I suppose that could work.
How fast do you need to go? What are the target devices? Are you testing these devices (confirming that the send back the expected response to a given command and that they all respond identically), or you're sending different commands to different devices and expecting different responses?
You could use one of the NI FPGAs with a lot of digital IO and implement your own serial driver, which would give you a lot of flexibility to address multiple connections simultaneously, but it wouldn't be cheap and you might need some additional electronics to do level-shifting.
I can also picture a solution where you put a bunch of cheap microprocessors on some multi-drop bus (for example CAN), and each one controls several serial connections. You could send a broadcast out on the bus that would be relayed to each individual serial port, and let the microprocessor check for the expected response. I can't recommend a specific board that would work for this purpose, you'd have to search for or build one, and you'd need to be able to program that microprocessor as well.
06-26-2014 04:49 PM
Thank you to all for the quick reponses. You all have great tips and questions which will help me minimize any COM issues I might encounter.
RavensFan and Tyk007, thanks for pointing out the for loop Parallelism feature. I was unaware of it so that will be my first test.
I only have 2 units to work with right now so the real testing will have to wait a bit.
Nathand, thanks for pointing out the timing, thats something I need to analyze and check with my requiremnts. I am sending the same command set to all units and getting slightly different reponses but the data packet length is the same.
Unfortunately, this is a system that was already built before I started working on it so all the hardware is there. My job is to automate and integrate every component in the system 🙂 There's 2 Digi board boxes that have 16 dsub connections each which are bundled up and fed into the computer.
Serge
06-26-2014 05:23 PM
How will you know which COM ports will have UUTs and which won't? This could be a potential bottleneck because, even though the UUTs will be tested in parallel, the total test time will still equal the longest time it took to complete a test, and if that longest time was a VISA timeout... Make sure to eliminate the unused ports from your array before you test.
06-26-2014 05:38 PM
Well I can say that I have an ESS test station that I talk to 32 UUT via RS232.
I am using 2 NI PCI-8430 16 port cards to get my 32 comports.
I would not say that speed was important to us (72 hours test), but on average we ping each UUT once a second for a quick status. But normally we run between 16 to 24 UUTs. It is now rare to have a full house. (Marketing over estimated)
I have a reenterant VI that I launch multiple copies with the VI server. I only launch for the number of units that are loaded. This VI only has to know about and test only one unit and log results for single unit. Simple to code.
The top level VI uses notifiers to tell the sub VI what to do. The sub VI feed the UUT status and results into a Queue to up date the top level VI.
There is a little more to it in that in that we can run different UUTs at the same time. A different sub VI is launched depending on the UUT type.
06-26-2014 05:45 PM
Serge,
Try the launching of independent VIs to handle each port. These can run at whatever speed you have CPUs and the underlying driver for the serial ports. This can work fine and there really isn't a VISA limit to the number of serial ports. You can then stream data from each of these VIs through queues to the master to collect and correlate. Any time you try to loop through the ports you will end up delaying things a bit.
This is the strategy Omar has proposed.
-Scott
06-26-2014 05:53 PM
06-26-2014 05:54 PM