LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number of Data Samples

Solved!
Go to solution
Solution
Accepted by topic author SparkEE

I think the problem is that your program is "ill-defined", and you may be using the wrong model.  Do you know about the Producer/Consumer model?  You have two loops, a Producer (your While loop, which continuously "produces" samples at some data rate until you tell it to stop) and a Consumer (a loop that "receives" data from the Producer and does something with it).  The most common form of communication between the loops is a Queue.

 

So you create a Queue with perhaps a cluster of Frequency, Reference RMS, and DUT.  Each pass through the Producer While loop puts one triple of data on the Queue.

 

In a parallel loop, you dequeue these values and start building arrays with them.  When the Consumer loop gets 50 of these, it writes them to your Excel file.  If you are really clever, you can modify the Consumer loop to allow it to write multiple aliquots of 50 samples to either the same or to different Excel files (you'll need to change the Excel-writing logic slightly to accomodate this, for example, updating the file name if you are writing multiple files, or moving the opening and closing outside the Consumer loop and adjusting the starting locations as appropriate inside the loop).

 

To see how to create a Producer/Consumer pattern in LabVIEW 7.1, click File, New (not New VI), and in the Create New box, open Frameworks, then Design Patterns.

 

Bob Schor

Message 11 of 14
(902 Views)

Your right Dennis and thanks Bob I will look into this

0 Kudos
Message 12 of 14
(900 Views)

So I've been reading up on producer/consumer to make sure I understand how it works. Would the image below be allowed?

Since the data is FIFO(first in-first out) when I unpause the loop, will it see the newer data or dequeue from where it left off at?

producer and consumer.PNG

0 Kudos
Message 13 of 14
(878 Views)

You generally never stop the lower consumer loop. The queue is elastic: it will expand to hold multiple elements while you're trying to figure out what to do with them in the consumer loop. Once you have the element in the consumer loop, you can decide what to do with it: you can use it, you can throw it away, or you can do something else that I didn't think of.

 

What I would do in your situation is to accumulate the element from the queue in an array, which you can build up and hold inside the loop in a shift register. You can monitor the size of the array, and when it reaches 50, you can write it to your Excel spreadsheet. Details are left to the student.

 

BS

Message 14 of 14
(871 Views)