From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

synchronization

Hello!
I'm trying to compare displacements from a LVDT acquired via a NI 9203 module with the ones obtained by double integration of one accelerometer acquired via a NI 9234 module. Initially i used for the aquisition a simple VI using daq assistant (see first attachment). However after processing the data the two displacement series were out of sync since the displacement series from the acclerometer were delayed compared with the one from LVDT (see second attachment). In order to solve this i tried to develop a more thorough VI that made the NI 9203 module use the clock of the NI 9234 module (see third attachment), however the problem continued despite the fact that in this case it was the lvdt series that were delayed.

Can anyone tell me how to solve this, please. If more information is needed please ask.

 

Thank you

0 Kudos
Message 1 of 10
(2,776 Views)

Hi antoniobarrias,

 

I'm gonna have a look on your .vi

 

There are several ways to synchronize a DSA module (NI 9234) and a non DSA module, for example, you can :

- put the 2 channels in the same DAQmx Task and then use it in your vi

- share the clock of the DSA module (master/slave) as you have done in your vi. I'm gonna have a look on it.

 

Also, a DSA module has an initial delay due to its filters. Here is some documentation : 

Why Is My Data Delayed When Using DSA Devices?

AE KB 2UI8PGX4: Why Is My Data Delayed When Using DSA Devices?

Maybe this is the part that is missing in your code.

 

Regards,

 

 

0 Kudos
Message 2 of 10
(2,733 Views)

Hi,

 

I made some modifications on your vi. It seems synchronized for me.

 

In order to be able to test it, I also made the following changes :

- turned channels into Tension AI

- I used NI 9215 (non DSA) and NI 9234

- removed the logging section of the code

- removed case structures ( I don't understand  what is the purpose of it , as the boolean "start acquisition is outside the while loop )

 

Can you have a look at it and let me know  ?

 

Best Regards,

 

 

 

 

0 Kudos
Message 3 of 10
(2,708 Views)

Hi,

 

I made some modifications on your vi. It seems synchronized for me.

 

In order to be able to test it, I also made the following changes :

- turned channels into Tension AI

- I used NI 9215 (non DSA) and NI 9234

- removed the logging section of the code

- removed case structures ( I don't understand  what is the purpose of it , as the boolean "start acquisition is outside the while loop )

 

Can you have a look at it and let me know  ?

 

Best Regards,

 

 

 

 

0 Kudos
Message 4 of 10
(2,708 Views)

Hi Isabelle,

 

First of all, thank you very much for your help.

My LabView version is 12.0.1 so i can't open your file.
I also would like to remain the logging  section, since i need to post process the data in order to integrate the acelerations to displacements.

The start acquisition was indeed outside of the while loop, but i corrected that in a newer version of the vi (see attachment).

 

Best regards,
António Barrias

0 Kudos
Message 5 of 10
(2,687 Views)

Here is the converted version. 

 

 

Best,

 

 

 

 

0 Kudos
Message 6 of 10
(2,681 Views)

Hi Isabelle,

 

I tried the same experience using my VI with modifications based on the VI that you sent me. Although the number of samples for each channel is the same, the time for the first acquisition in each module/channel is different and I can't understand why.

Attached to this post i send you the VI that i used and the excell files that i obtained from the acquisition.

 

Best regards,

António Barrias

 

Book1: https://feupload.fe.up.pt/get/cWOW0QFMMcgQEw5

Book2: https://feupload.fe.up.pt/get/pcWjW6He60aSql9

 

PS: Book1.xlsx results from the VI using 39 number of samples per channel (in the first "Analog 1D DBL 1Chan NSamp" of the VI) as you used in yours. In Book2.xlsx i didn't used a constant at all.

0 Kudos
Message 7 of 10
(2,659 Views)

Hi,

 

If you don't use any constants, the reading vi gets all the available samples in the buffer (so it will not be synchronized).

The number of sample that you have to remove depends on the frequency you are working with, so you should do the calculation and verify what is the number of samples you have to remove (39 is the best for me, but maybe no for you).

 

The logging and the stop/clearing taks should not be in your acquisition loop because it can slow it down.

Also I have some questions :

- what is the purpose of the "start acquisition" button ?

- why do you ask for 2560 samples ( why is it the same as the frequency you ask for ?)

 

I think you should proceed step by step and remove the looging part  and the case structures, add a timout to the reading vis and plot your 2 measurements in the same graph, so that it is easier to see if it is synchronized.

 

Could you please send me a screenshot of the user interface where I can see how the indicators that I added are populated ?

 

Tip for the logging part :  producer/consumer architecture

 

Regards,

 

0 Kudos
Message 8 of 10
(2,646 Views)

When I used 39 the time difference for the first acquisition in each channel was bigger than the one obtained not using 39. Could you please tell me wich calculation shoul i do using a sampling rate of 2560? 
As I told you before I need to log the data in order to postprocess the data. Since I'm acquiring accelerations and displacements I can only see if I'm obtaining synchronized data after I double integrate the accelerations into displacements.

In fact, the start acquisition button is not doing anything. I put it in the beguinning as an effort to start both acquisitions at the same time and left it there. I only started to use LabVIEW three months ago, so maybe some of my doubts result from my lack of experience. I ask for 2560 samples because I'm using a sampling rate of 2560 Hz. Should I put something different?

Best regards,
António Barrias

0 Kudos
Message 9 of 10
(2,637 Views)

Hi Antonio,

 

Don't worry you are doing well !

 

Here is the answers :

 

1/ The calculation is explained in this document. According to the formula in the document you can calculate the delay (it depends of the module you have and your sampling frequency). Knowing this delay you can "convert" that time into the number of sample that you have to remove.

I don't know if I am clear.

 

2/ When you don't use a constant before your reading vi. You get the available number of samples in the buffer. That number as to be fixed if you want to have a synchronized acquisition each time you launch your vi.

 

3/ About the "start acquisition" button.

The acquisition is actually hardware timed and the reading vi just get the acquired samples from the buffer in your computer. The acquisition begins before the reading vi depending on the trigger. Here is a very interesting paper about data acquisition : DAQmx Timing and Sample Rates.

 

4/ If you don't have any workaround about the logging and processing, you probably should implement a producer/consumer architecture ( you can find examples in the example browser in Labview ).  Also the stopping/cleaning vi should be outside the acquisition while loop.

 

5/ The sampling frequency is the number of points you acquire per second. It should be at least 10 times the frequency of your measured signal if you want to have the shape of your acquired signal. The number of samples is the number of sample you ask per reading (ie the packet of data you get at each time you call the reading vi). He is some documentation about data acquisition that will helps you :

Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications

Getting Started with NI-DAQmx

 

Hope it will help you,

Best,

 

 

 

0 Kudos
Message 10 of 10
(2,613 Views)