From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple cards and 1 card/task with each card at different sampling rates

I need to acquire data from 5 ni pxi-e 6368 cards (ni pxie-1078 chassis), each set at different sampling rates and each card in one task. Is it best to acquire data  from each card in the same while loop, 1 while loop per card, or any other way?

 

is there any examples or info that talks directly about this? ( haven't found any. maybe not searching the correct keywords)

 

I'll appreciate any help.

0 Kudos
Message 1 of 8
(2,893 Views)

What all are you doing with the data?

 

My initial reaction would be to have them in separate loops.  But if you get the same time's worth of data from all of the tasks, it might be easier to keep it in a single loop.  But it really depends on what you are doing with the data.


GCentral
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 2 of 8
(2,862 Views)

I do something similar, except with only two cards (6281).  I tried a single loop, but it was a mess and inflexible (limited to cross card sample rate compatibility etc..).  So I went to a re-entrant generic acquisition loop vi that I call for each card from a JKI state machine (modified for use on labview RT).  The reentrant vi is its own logger.  Reads the card buffer when data is available and stores to separate tdms files (one for each card).

 

the design really cleaned things up for me.  I use a common notifier passed into the vi instances to control them (stop mostly) and a status notifier so I can see what they are doing.

 

For my needs, the card tasks are synchronized to a common pxi trigger to kick them off, a common refclk (the pxi backplane 10mhz), but they use their own sample clocks.  That way, if I want synchronous sampling (ex.. 1khz on card 1, 10khz on card 2) it's guaranteed to be locked at 1:10 exactly.

 

I generate a separate index tdms file which records channels, sample start and stop, data type, and tdms file names since my loop can span tdms files for essentially infinite record times (labview RT limits to 2Gb file sizes).  I don't use the built in daqmx spanning because I needed more control over the format and when to record or pause sampling.  I wanted to sample continuously to preview the data, but only record samples after a second trigger.  A pain to be sure, but it's working well now.  The index is a godsend for post processing since it allows me to quickly dive into the hundreds of files in a random access approach.

 

Hope that helps?

0 Kudos
Message 3 of 8
(2,852 Views)

To answer the first question:

the data will be saved is a TDMS File and viewed in DIAdem.

 

I have a feeling that the Reentrant VI will be the solution so I am going to look into that.

0 Kudos
Message 4 of 8
(2,822 Views)

@A.Ramirez wrote:

the data will be saved is a TDMS File and viewed in DIAdem.


I single TDMS file or one per task?

 

My recommendation here is you have a loop for each task and then another loop for the logging.  Then each task uses the same queue to send the data to the logging loop.  Part of the data type of the queue should be what group to put the data into.  So the final result will be a single TDMS file with as many groups as you do tasks.  DIAdem can do all kinds of analysis from there.


GCentral
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 8
(2,819 Views)

In a single file.

0 Kudos
Message 6 of 8
(2,815 Views)

To merge multiple sample rate data streams into a single TDMS file will require writing your own logging vi (Like crossrulz mentioned).  I avoided merging during data acquisition because I do not perform analysis on the data I collect.  I post-process the data into useable data (Apply functions and polynomial derivations based on a configuration file).  The post processed data (A single merged file) then goes to DiaDem or some exporter gizmo.

0 Kudos
Message 7 of 8
(2,811 Views)

I see. I will implement this advice and let you know if it works next week.

thanks for the advice.

0 Kudos
Message 8 of 8
(2,807 Views)