LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

AI scanning order

I am using the enclosed AI input configuration and the Timing Source has been set to acquire 125 samples @ 2.5kHz rate. The DAQMX  AI read function is inside the Timed loop controlled by the Timing Source and for the given parameters will fire every 50ms.
 
I am acquiring totally 7 channels.
 
But I notice that the DAQMX read acquires 125 samples of Ch_0 in the first 50ms and 125 samples of Ch_1 in the next 50ms .....and so on.
 
This finally means that I get the samples for each channel spaced out at  50 x 7 = 350ms. This is not acceptable as I am missing out valid readings in this long time gap.
 
If I want samples from every channel at about 50ms interval, then one option I can think of is to increase the sampling rate to 2.5 kHz x 7 = 17.5 kHz. Other than this is there any other way ?
 
Thanks
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 12
(3,931 Views)
Hi,

can you tell us by 100% that the first 125 samples refer to channel 1??
In general, the scanlist is configured automatically for you using the order you chose the channels during creation of the task. So if you enter Dev1/ai0:5, you will get the scanorder ai0, ai1, ai2, ai3, ai4, ai5. Each channel will be sample once, the mux will proceed to the next channel within fastest time possible (intervall sampling, default: http://digital.ni.com/public.nsf/allkb/4F9D107D8B26233B86256F250057C9B3?OpenDocument) and sample the next channel...
So you have ch0-7, ch0-7, ch0-7 in an array. The readfunction of DAQmx lets you choose, how this array is presented in the software.
I have seen that you configured the acquisition to override buffered values without creating an error. So i asum that if you dont do that, you will get buffer overwrite errors all the time. Correct?

Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 12
(3,920 Views)
Hello Norbert,
 
>> can you tell us by 100% that the first 125 samples refer to channel 1??
 
I guess so. Just look at the enclosed data collected as a txt file. The CH_0 is a temperature channel so it will be steady around 2.2V. And I have 125 columns. And the Ch_0 values repeat after every 7th row.
 
The buffering is fine as long as I consume the data, but there are occassions when the DAQMX read function is disabled and it is then I used to get a overflow error. The error is suppressed to handle such cases.. 
 
Thanks


Message Edited by Raghunathan on 06-30-2008 03:48 AM
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 3 of 12
(3,916 Views)
You should transpose the 2D array before saving it using Write to Spreadsheed File....

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 12
(3,904 Views)
Hi Raghunathan,
 
I am a bit confused as to why you have used the Digital Edge Counter Task. Is there any particular reason why this task was created?
 
Also, I would like to point out that there are tons of great DAQmx shipping examples in LabVIEW that you could refer to. You can view these in your Example Finder by accessing it under Help » Find Examples.... The examples we are particularly interested in would be under Hardware Input and Output » DAQmx » Analog Measurement » Voltage » Acq&Graph Voltage - Int Clk.vi.
 
I hope this helps,
S_Hong
National Instruments
Applications Engineer
0 Kudos
Message 5 of 12
(3,857 Views)

>> I am a bit confused as to why you have used the Digital Edge Counter Task. Is there any particular reason why this task was created?

I need to fire a Timed loop precisely once 125 samples were collected.

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 12
(3,848 Views)

>>You should transpose the 2D array before saving it using Write to Spreadsheed File....

I understand. But transposing is just data re-ordering for analysis. I am keen to know HOW the data is actually acquired ?

Let me explain :

I switch on a solenoid valve and look for a pressure value. The dynamics of the valve + response of the hydraulics are such that there will be a time delay of about 150 to 200ms between both events. But I was actually getting a delay of 550ms which was ruining my whole sequence.

So just to cross check, I re-coded the timed loop for a fixed 50ms interval and the DAQMX read to acquire just one sample. I exactly got the delay  at 200ms repeatedly.

When I revert back to the 125samples @ 2.5kHz, the delay went back to 550ms.  Any guesses why this happening ??

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 7 of 12
(3,846 Views)
You (nearly) always interface with DAQmx per channel. So you enter the samplerate per channel as well as number of samples per channel.
What DAQmx does is to configure the hardware to meet the criterias you entered.

One small example:
4 channels (ai0:3), 2.5 kHz samplerate per channel, numbers of samples to read is set to 500 at DAQmx Read.
DAQmx configures a task for you, containing the four channels which will be samples one after another. So you get a sample ai0, then ai1, ai2, ai3, ai0, ai1, .....
Each channel will be sampled at 2.5 kHz (so a total samplerate for the device of 10 kHz!) with the minimum delay between the channels except when getting to the first again.
After 500 samples per channel (so 500 / 2.5 kHz = 0.2 s), the DAQmx Read will return the values. If chosen to be a 2D array, you will get an array with 500 columns and 4 rows. Writing this directly to a spreadsheetfile will return the file you are seeing. Transposing it will write a file of 500 rows and 4 columns, where col0 = ai0, col1 = ai1, .....

Since i haven't seen the code yet where you are working on the task, i asume that you shutdown and reinit the task in the timed loop. This takes several ms, so the delay is hard to tell.....

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 12
(3,831 Views)

Hi Norbert,

Thanks to your detailed explanation, I think I am now clear on the acquiring process. So in my case the hardware will be running at 2.5 x 7 = 17.5 kHz to satisfy my target rate of 7 channels with 125 samples/ch and at the rate of 2.5kHz ?

But still I am unable to explain the ensuing delay when I use the hardware timed loop. Just to clarify I am enclosing the relevant portion of my code for your study. The RawData array file was the one that I posted earlier ( without transposing ). And the InputArray values are passed to sub VIs for further process through a Functional Global.

Is the 350ms delay because of the "Mean" function inside the For loop ? Has it got to wait for all the 125 x 7 = 875 samples to arrive before it can output the mean values for all 7 channels ?  But then as per you, the hardware is now blazing at 17.5 kHz and that still means 875/117500 = 50ms, which is my orginal Timed loop target value..

I am still in the dark as to why there should be a 350ms delay when using the above scheme as compared to a 50ms software timed loop and with 1 sample per channel rate?

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 9 of 12
(3,822 Views)

- Another point I am not clear is the way the Digital Edge counter generates the Timing Source for the Timed Loop. It has been wired with a value of 125 counts for generating the trigger for the Timed Loop. And our hardware is running at 17.5 kHz to meet the 125 samples x 7 channels @ 2.5kHz rate. This means that the Timing Source will see 125 samples in 125/17500 = 7ms approx.  So how does the Timed Loop fire once every 50ms ? 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 10 of 12
(3,811 Views)