LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition with time stamp

Hi I'm using NI DAQ 6211 to acquire acceration, strain and temperature from a VI. I have made several modifications and my last two vis are attached. I need to get 1000 data points from a encoder and sampling the period is by far the best way to get acceleration considering my hardware. 

 

Is there a way to ensure that all three variables are synchronised within a timestamp without the vi slowing down?

 

Sincerely

Ahmad

Download All
0 Kudos
Message 1 of 9
(5,725 Views)

Hello Qadri

 

Thank you for getting in touch. I am an Applications Engineer at National Instruments and I will be supporting you with your query.

 

As I understand you are hoping to acquire from 3 devices at the same time with a timestamp attached. One thing that is key to achieve this is acquiring a waveform with the DAQmx function.

 

I have attached an example which you will be able to edit for your own system, I also found this example from our DevZone which you may also find useful.

Timestamp on DAQmx Data Acquisition

If you have any further questions regarding your acquisition please reply to this post and I will be back in touch.

 

Regards

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 2 of 9
(5,696 Views)

The problem lies in synchronising the acceleration with the load and temperature. For acceleration I'm getting a period from a counter with Implicit values (i.e. without specifying timing). I have set the number of samples to acquire to 1000 points and this task does not require sample timing. Post processing the period data in matlab gives me the acceleration.

 

Now my vi uses a Sample Clock with set number of samples being acquired for the load and temperature. This means that a set number of samples for load and temperature can be acquired and this time may not be enough to acquire the acceleration points; hence they cannot be mapped in time.

 

The period is implicit and I can't find a way to synchronise with the load and temperature that are acquired at a fixed sample rate. The bottle neck in this problem is to get the acceleration (period recorded) in sync with the load and temperature. If this can be done without any compromise to the speed of the vi then this problem is resolved.

 

I have attached the vis which will show the development to overcome this problem.

 

Sincerely

Ahmad

Download All
0 Kudos
Message 3 of 9
(5,677 Views)

Hello Ahmed

 

Thank you for posting a reply.

 

Synchronisation of DAQ devices is achieved by linking each acquisition task to the same clock, choose one clock to share, and acquiring data at the same rate, if you need differing rates for each acquisition task then you will need to resample after the initial acquisition.

 

Looking at your test 7 vi I found that you are not acquiring data from the three devices simultaneously, you acquire the acceleration 10 times, the temperature once and then the strain twice in each loop iteration. This is due to the flat sequence structure having control over the execution of your code, is this expected or did you wish to acquire from the three sensors simultaneously?

 

You also open and close references within loops, this is something we don't really recommend as it means that each iteration of the loop opens and closes the reference which takes time and processor power, if you open the reference before the loop and close after then resources are saved and the execution time will decrease. In your code I recommend creating the task and closing the task outside of your while loop.

 

I hope this information proves useful in your development, please get in touch with any further queries.

 

Regards

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 4 of 9
(5,646 Views)

Firstly since a counter is being used to get the acceleration and the timing set as implicit, this means that the synchronisation of DAQ devices cannot be achieved by linking each acquisition task to the same clock.

 

Could you explain what you mean by resampling after the initial acquisition?

 

Yes, It is expected to acquire from the three sensors simultaneously. In my test 7 vi the only reason for acquiring the acceleration 10 times, the temperature once and then the strain twice in each loop iteration; using a flat sequence structure was to speed up the vi data acquisition capabilities.

 

Earlier I did try creating the task and closing the task outside of your while loop but it gave me an error.

0 Kudos
Message 5 of 9
(5,632 Views)

This is probably the best so far but I'm still not sure if all three are in sync. Also as per your recommendation I'm creating the task and closing the task outside of your while loop in the vi.

 

Please advise on how I could improve on the vi attached.

 

Ahmad

0 Kudos
Message 6 of 9
(5,631 Views)

Hello Ahmed

 

Thank you for your quick response. I have had a look at your code and overall it is good and uses some good practices.

The sequence structure does not have any effect on the execution of the code other than making each task wait for the other tasks to finish their acquisition or analysis before moving on, and this isn't neccesary, but it won't have a major effect on the data you acquire.

 

The other thing you were wanting to implement is synchronising the tasks. The only way to synchronise is using a common clock base between the tasks, I have found an example which illustrates this for you, it shows how the acquisition tasks are controlled by the clock task. This is the method you will need to implement to achieve synchronisation.

 

The references are definitely configured better now and other then adding in the synchronisation and thinking about the sequence structure your code looks ready to implement.

 

I would also recommend visiting this page on DAQmx setup as it provides resources and tutorials for DAQmx applications.

 

Regards

 

 

 

 

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 7 of 9
(5,620 Views)

I could'nt access the example as it gave me an error saying that the item does not exist or may have been deleted. Can you please send as an attachment instead?

 

 

0 Kudos
Message 8 of 9
(5,596 Views)

Hello Ahmed

 

I am sorrythat the link didnt work for you, the example is attached

Synch AI-AO to an External Sample Clock Generate by Onboard Counter https://decibel.ni.com/content/docs/DOC-8023

If you want to look at the description you should be able to access it by searching the title or copy and pasting the link.

 

Regards

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 9 of 9
(5,580 Views)