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: 

Daq assistant in While loop

Hello everyone

 

I'm working with at Daq-assistant, which measures pressure and i need the relative time and sampling data in an array with two columns (Time, Data).

 

I want the value of the sampling data in every second like the example below :

 

Time   Data

1        x

2        x

3        x

 

The problem occurs when i run the Vi. The array shows too much data even though i have set "number og samples" to 1. Is this because i need a timed while loop instead ?.

 

Thanks in advance

 

Oesen

Best regards

Oesen
0 Kudos
Message 1 of 10
(4,796 Views)

Why would you think using a timed loop would change your number of samples/sec. You have specified a rate of 10 samples/second and asked for a single sample. The basic arithmetic does not work out for 1 sample every second. You are actually getting a sample every .1 second. You need to understand the basics of data acquisition a bit better. Divide the number of samples by the samples/sec.

 

You can change the rate (i.e. to 1 Sample/sec), change the number of samples (i.e. to 10) and take the mean, change to N Samples and have a wait inside the loop. It is up to you.

Message 2 of 10
(4,779 Views)

Hi Oesen

 

Thank you for your post. Dennis is correct in what he is writing.

 

There are 3 things that should concern you in this setup:

 

1) Sample rate: This is something that tells you how many points you want to have from your data acquisition device. In your example you have a sample rate of 10 meaning that you want to acquire 10 points every second.

 

2) Samples per channel: This tells you how many sample the DAQ Assistant will return on each call. When you set a sample rate of 10 you put the 10 samples in a hardware buffer every second. The number of samples per channel then tells you how many samples you want to read from that buffer on each call of the DAQ Assistant.

 

3) Loop rate: This tells you how many times per second you while loop runs. You cannot set loop rate specifically but it is very closely related  to what you choose in sample rate and samples per channel. The loop rate is defined as:

Loop rate = Sample rate / number of samples.

 

In your example this gives:

 

Loop rate = 10Hz / 1 = 10 Hz, so your while loop runs 10 times every second. 

 

So you have two options either put sample rate to 1Hz So you have Loop rate = 1Hz / 1 = 1, then you will get 1 measurement every second and your while loop will run 1 time every second.

 

Another alternative is to put number of samples to 10, this will still make sure that you update 1 time every second: Loop rate = 10Hz / 10 = 1Hz. This will give you an update rate of 1 time every second but then it will update with 10 samples so your data will be in an array of size 10.

 

Hope this can help you understand what is going on.

 

 

Best Regards

Anders Rohde

Applications Engineer

National Instruments Denmark 

Message 3 of 10
(4,744 Views)

Thanks for the answers 🙂

 

I have set both values to 2000, and i get a measurement every second in the array now as a want, but the chart display updates every second now, and i need a continuously running chart display. Can i have continuously running chart display, but still get a measurement every second in the array ?

 

Untitled.png

Best regards

Oesen
0 Kudos
Message 4 of 10
(4,720 Views)

Hi Oesen,

 

To do that you need to sample fast but update the display slow.

 

So do the following:

1) Set the DAQ Assistant to the data that you want to be showing while you run your VI.

 

2) Build that data into an array and by using the iteration terminal [i] and the Quotient and Remainder function you make a boolean expression that is true 1 time every 100 iterations i.e.

Then take this boolean and wire it into a case structure. Inside of this case structure you display the value on the array. In this way you can still have running data on the chart and a slower update rate on the array control. 

 

I have attached an example of this in LabVIEW 2012 format.

 

 

Best Regards

Anders Rohde

Applications Engineer

National Instruments Denmark

0 Kudos
Message 5 of 10
(4,710 Views)

Thanks for the answer A.Rohde

 

Can you please upload it as a Labview 2010 format

 

Thanks in advance

 

Oesen

Best regards

Oesen
0 Kudos
Message 6 of 10
(4,707 Views)

Try the attached

 

Best Regards

Anders Rohde

Applications Engineer

National Instruments Denmark

0 Kudos
Message 7 of 10
(4,705 Views)

Hi A.Rohde

 

I have changed my VI like the one you uploadet, but i didn't get any solutions 😞

 

 

Best regards

Oesen
0 Kudos
Message 8 of 10
(4,680 Views)

Hi A.Rohde

 

I have changed my VI like the one you uploadet, but i didn't get any solutions 😞

 

 

Best regards

Oesen
Download All
0 Kudos
Message 9 of 10
(4,680 Views)

Hi Oesen,

 

Are you from Denmark? If you are you can try to call National Instruments Denmark on (+45) 45 76 26 00, and ask for me, then I will guide you trough setting this up on a remote desktop connection. I think you have been struggeling with this for long so maybe we should make a small training session together. 

 

I think this would be the easiest and then I can try to explain the concepts, so you know how to design the concepts next time.

 

 

Best Regards,

Anders Rohde

Applications Engineer

National Instruments Denmark

0 Kudos
Message 10 of 10
(4,665 Views)