LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Double Accelerometer Measurement

Hi There,

 

I am trying to read measurement from two accelerometer.

Equipment is as follow:

 

cDAQ-9188

NI 9234

 

When I try reading 1 by 1, it manage to return a value.

However, when I string both the measurement together, I am not getting any output.

Is there something wrong with the array setting?

 

Thanks for the help

0 Kudos
Message 1 of 11
(4,334 Views)

You doesn't  check the error in the while loop.

Then you would see the error:


Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.

Property: AI.Min
Requested Value: -100,0
Possible Values: -50,0 to  50,0
Channel Name: Dev2/ai0

 

The NI 9234 has only one range -5 V ... +5 V. You have to calculate the max. values in g with the sensitivity.

Leave the min & max value terminals empty. Then the default values +/- 5 [units , now g] is used.

Test Double Acc.png

 

And check the sample rate. The minimal supported rate of the NI 9234 is 4000 Hz. It is used automaticly.

Message 2 of 11
(4,315 Views)

Hi Peter,

 

the NI9234 allows for 1652 S/s, see manual page 16f.

(With external timebase it allows for down to 391 S/s as specified on page 19!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 11
(4,308 Views)

Hi Gerd,

thank you for the correction. It is also documented in: What Are the Valid Sampling Rates for the NI 9233, NI 9234, and NI 9237?

 

I use normaly higher values and check always the real rate with the DAQmx Timing property SampClk.Rate.

 

Peter

 

 

0 Kudos
Message 4 of 11
(4,297 Views)

Thanks for pointing out the error. Gladly appreciate it.

However, as I run the code, it keep giving the error:

 

Error 200279

Possible reason(s):

Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.

Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.

 

I tried changing the sampling rate/samples per channel but to no avail. Any advice on how to solve it?

 

Also, Labview is generating a few backup data file whenever I am writing my data output. Is this something to do with the error?

0 Kudos
Message 5 of 11
(4,249 Views)

Hi Cla,

 

read the data more often! You were too late when requesting the next samples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(4,217 Views)

Hi Cla,

you read only one sample in the loop and the frontpanel has to updated 1000 times per second. And you wait 1ms in the loop.

It is better to read more samples at once, i.e. 10x per second. The wait is not necessary: the DAQmx Read wait until the requested samples are available.

Test Double Acc2.png

 

A probe watch at SampClk.Rate shows the actual rate: 1651.61

 

Peter

0 Kudos
Message 7 of 11
(4,192 Views)

Hi GerdW,

 

Thanks for pointing out on the sample reading too slow. I have changed it to N-samples.

 

Hi Peter,

 

Thanks for the tips.

I make use of the wait function to get hold of the experimental time.

If the sampling rate is more than 1000, it will be unfeasible to use the wait function?

Since the minimum wait is 1 miliseconds, and using that wait function will essentially produce only 1000 samples per seconds. Is my interpretation accurate?

 

If so, to keep track of time, best to use the elapsed time VI?

 

Also to strengthen my understanding:

In the case of 2k Sampling Rate, the DAQ will acquire 2k data every seconds. So when I set the read channel to 'N-channels N-Samples', with number of samples "-1", I will be reading every single one of the sample. Is that correct?

Also mind further explain on the "read samples for update interval 1/10s? 

The sampling rate/10 is connected to the time-out port of the read function, how does that work mathematically? 1000/10 = 100 seconds of wait?

 

Uploaded herewith is the updated VI.

I tried using the ExpressVI function: Spectral measurement to acquire the power spectrum of the measured acceleration.

When I use the VI function with DAQ assistant, it will give me an accurate result when I attached the accelerometer to a reference shaker.

However, when I implement that function in my current VI, it will not work.

 

Also I tried an alternative of performing FFT, and getting the real value as the magnitude. But the output isn't accurate? Any help with that?

 

Regards,

Clarence

 

0 Kudos
Message 8 of 11
(4,172 Views)

Hi Cla,

the real sample rate is 1651.61 Hz. The DAQmx driver use the next posssible rate of the DAQ card.

Wait 1ms after every sample need 1.65161 seconds to wait only => you are to slow.

I wired the number 'samplerate/10' to the input number of samples per channel.

Then you get always the same block size of the data. Adjust the block size for the spectral analysis.

 

See the help: 'If the task acquires samples continuously and you set this input to -1, this VI reads all the samples currently available in the buffer.'

Then the  block size depends of the timing of the loop.

 

The timeout input is not relevant for you: 'If the time elapses, the VI returns an error...'

 

I recommend to use and modify the ready examples for DAQmx and FFT / Spectral analysis.

The example 'Vibration Analysis (DAQmx).vi' îs a complete one channal vibration Analyzer in the the Sound & Vibration toolkit.

Or configure the measurement in SignalExpress. Later you can create Labview code from the SignalExpress project.

 

You write: When I use the VI function with DAQ assistant, it will give me an accurate result

 

You know, that you can convert a Express vi to a normal Sub vi? Right click -> "Open Front panel" or "Convert to Sub vi".

Then you can open the Sub vi and inspect the code.

 

Peter

 

 

0 Kudos
Message 9 of 11
(4,146 Views)

Dear Peter,

 

Thanks for the insight. Very much appreciated.

I managed to get the VI to work, period.

However, when I try to wire the FFT output to a write file, it gives me an error.

Power Spectrum Error.png

 

When I read around, it says that the dynamic data is limited to VI express output.

So I tried merging the data, but the results aren't in terms of frequency and amplitude.

Any guidance on this?

Data Merging.png

Also as a rule of thumb, do we need to merge the error msg for multiple task?

In my attached VI I have one task taking AI from accelerometer and another one taking Digital counter.

0 Kudos
Message 10 of 11
(4,125 Views)