LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous, Long Duration, Multi-channel Analog Output

I have an application where I am using two PCI-6036E boards for simultaneous AI/AO with LabView 7.0. I need to be able to continuously output predefined drive signals at 400 S/sec that are non-repeating and can last hours in duration. I've tried a number of different methods, but always seem to run into problems with either buffer sizes, memory, or timing. Has anyone done something similar and can lend some guidance??
0 Kudos
Message 1 of 2
(2,605 Views)
I can't give you any guarantees, but here's an outline of an idea. The basic summary is to set up medium-large AO buffers that you will have to feed regularly, though not very frequently. You'll feed them by reading the AO data from files, again regularly but not frequently.

1. Store your predefined drive signals to a file. Probably a binary file for speed. Probably simplest
to store 1 file per PCI-6036.
Assuming you use both AO channels, you're looking at 400 S/sec * 3600 sec/hr * 4 bytes/chan * 2 chan ~= 11.5 MB/hour. Big, but do-able.

2. For each board, allocate an output buffer sized for, say, 3 minutes of data. So at 400 S/sec * 60 sec/min * 2 chan * 3 min ~= 150000 samples (600 kB).

3. Open the 2 files outside the main loop and don't close them until after the main loop completes.

4. Before entering the main loop, read 3 minutes worth of data from your files and write it to your AO buffers. Start the AO generation & enter your main loop.

5. Once each minute, read 1 minute of data from the files and write it to the AO buffers. You're only asking the hard drive for 200 kB per file, once a minute -- shouldn't pose a problem.
I'd recommend that the very first wait period be 2 minutes, then your buffer is always (nominally) between 1/3 and 2/3 full, leaving you 1 minute leeway on either side.

6. If you're not careful, time errors could slowly creep up on you. For example, perhaps each time you try to wait for 1 minute, you actually wait for 1 minute + 0.2 seconds. You'll slowly fall behind the AO hardware, losing 2 seconds per 10 minutes. After 5 hours, you'll have lost your full 1 minute of "leeway." There's a couple ways to be careful.

7. Each time you end a wait period, check exactly how long you've waited since the last file read/AO buffer write. Then read that amount of data from your file and write it to the AO buffer.
Alternately (and probably preferably), query properties of your AO task to determine how many samples you can possibly write without overflowing the buffer, then write the smaller # that brings you to 2/3 full.

Good luck!

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 2
(2,605 Views)