LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

different log and sample frequency

Hello,
 
I want to measure and log the tension on two wires using Labview6 and my PCI-1200 DAQ card. So far so good, but I want to do this with a different log and sample frequency and that's my problem.
I want to measure with a sample rate off 10 samples/s and log every second the average of the last 10 samples. I've found some similar questions on this forum, but the attached VI's are written in a more recent version of Labview so I can't open them.
I have builded an VI, using a while loop with 10 shift registers and a Wait until (100ms), but this one logs the average of the latest 10 samples every 100ms so my log file gets too big very fast. I've tried using a while loop in a while loop (one to measure and one to log) with each an other 'wait until time' but this doesn't seem to work properly.
Maybe this is a stupid question, but I'm still learning to work with Labview. Hopefully someone can help me.
 
With kind regards,
 
Kevin VdG
0 Kudos
Message 1 of 4
(2,690 Views)

Have you looked at the "Producer/Consumer" structure?

In LabVIEW, select from the top menu "File > New"  (NOT New VI!!  simply "New"). You'll have quite a few templates to choose from.  Have a look at "Producer/Consumer Design Pattern (Data)".

The top loop can be used to acquire data (at one rate).  The data can go into a buffer to be processed by the second loop (at a different rate).  You must make sure that you do not get a buffer overflow..

 

0 Kudos
Message 2 of 4
(2,683 Views)
Hi Kevin,

You can download pr0001.vi at
http://www.morechemistry.com/labview/contributions/pr0001.vi

This uses an array of 10 elements which is maintained in a single shift
register.
Every cycle a new measurement will replace an old measurement.
Every tenth cycle the mean will be calculated.

Bart Boshuizen

"Kevin VdG" <x@no.email> wrote in message
news:1188825006240-574329@exchange.ni.com...
> Hello,
> &nbsp;
> I want to measure and log&nbsp;the tension on two wires using Labview6 and
my PCI-1200 DAQ card. So far so good, but&nbsp;I want to do this with a
different log and sample frequency and that's my problem.
> I want to measure with a sample rate off 10 samples/s&nbsp;and&nbsp;log
every second the average of the last 10 samples. I've found some similar
questions on this forum, but the attached VI's are written in a more recent
version of Labview so I can't open them.
> I have builded an VI, using a while loop with 10 shift registers and a
Wait until (100ms), but this one logs the average of the latest 10 samples
every 100ms so my log file gets too big very fast. I've tried using&nbsp;a
while loop in a while loop&nbsp;(one to measure and one to log) with each an
other 'wait until time' but this doesn't seem to work properly.
> Maybe this is a stupid question, but I'm still learning to work with
Labview. Hopefully someone can help me.
> &nbsp;
> With kind regards,
> &nbsp;
> Kevin VdG


0 Kudos
Message 3 of 4
(2,671 Views)

Hi Bart,

thank's for the reaction. I adjusted my VI to your model and now it works fine.

However, I have some problems with writing the measurements to an Excel file. The attached VI writes every second all the values nicely to an Excel file but that's not the way I want it. Every second, I want to write down the first 7 values (Time, mean, maximum and minimum of the last 10 measurements; like the VI does right now) and when the program stops, I want to write the last 6 values (summary at the end of the total mean, maximum and minimum) in the same file. Is this possible? And how can I add a header to each column?

with kind regards,

Kevin

0 Kudos
Message 4 of 4
(2,622 Views)