From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Continuous acquisition of two LVDT sensors

Solved!
Go to solution

I am trying to construct a program to monitor two LVDT sensors inside a machining table to measure vibrations. I would like to be able to acquire as close to continous as possible. I am looking for small delays because the plan is to have some feedback mechanism later on and this would require very quick reaction. 

 

I have some experience with labview but am quite new to using queue structures. I am having difficulty dequeueing the data in a type that I can work with. How could I dequeue my waveform data and use it to perform calculations on its frequency and amplitude? 

 

And as an aside, am I implementing the queue correctly? or does anyone have recommendations to my vi layout and architecture?

 

Thank you very much for your help.

I am using labview 8, but I have access on other computers to labview 9.

 

-Arthur J.

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

Arthur,

 

You are not using the queue quite correctly.  You need to tell the queue what kind of data it will contain.  You do this by wiring the 'Element Data Type' node on the Obtain Queue block with the type of data you wish to enqueue; if you don't do this, then the queue uses a Variant, and you will have to use the Variant to Data function to properly decode the data (and To Variant to get the data into the queue in the right format).  

 

On another note, since you are relatively new to this - consider using a state machine in your upper loop instead of that flat sequence structure - this will reduce that code bloat that you have going on.  Other than that, looks great!

 

Peace, Matt

Message 2 of 5
(2,768 Views)

Thank you for the input. That was definitely the problem in the wiring. 

 

I had one other question maybe you could offer some insight to. 
Even though the acquisition rate is set, when I dequeue, it does not remove in the same increment chunks as I acquire. I believe it dequeues only one data point per channel at a time. How could I dequeue data in the same or similar increments that I am acquiring? 

 

I looked around the forum and saw that people have suggested a for loop and setting the iterations to how many elements you want at a time, but is that really the best way to do it? I feel that advanced users using a similar architecture to write quick adapting programs at high acquisition rates need to do a similar thing, and maybe have a more efficient way.

 

Thank you for your help

 

Arthur J.

0 Kudos
Message 3 of 5
(2,745 Views)

Sorry there is one other thing I have been trying to trouble shoot.

 

When I dequeue the data I'm trying for the meantime to just display it. For the first time it dequeues the data is accurate and the program seems work fine. But then the data doesnt change, it just displays the same data. To me it seems that the program is dequeuing the same data over and over instead of moving to the next set of data.

 

Is there something that I neglected to add to tell the program to get rid of the data already dequeued and move to the next set? I used the probe there and it just shows the same data points for both waveforms even though the program continues to run. 

 

Thanks.

0 Kudos
Message 4 of 5
(2,737 Views)
Solution
Accepted by BlissDismissed

In the original VI you posted you do not do anything with the enqueued data.  You preview the queue and then connect nothing to the wire.

 

1. Use Dequeue.  This removes the oldest element from the queue and makes it available.  Preview looks at the data without removing it from the queue.

2. Do something with the data.  I looks like you may want to split the four LVDT channels and put the data into the shift registers.  Do you need to initialize the shift registers or do you want the data from the previous run retained and used in the next run?  It is usually better to initialize the arrays to the maximum size you expect and then to use Replace Array Element inside the loop.  This avoids reallocation of memory.

3. Consider the appropriate data structure.  You start by acquiring an array of waveforms.  After the filter you have dynamic data.  In the other loop you are using 1D arrays of doubles.  If you do not need the timing information from the waveforms, try getting the data from the DAQ Read as an array of doubles and staying with that datatype throughout.

4. Consider putting the filtering in the lower loop.  Typically a producer/consumer architecture like this does only the data acquisition in the producer loop and all the analysis in the consumer loop.

5. As someone previously pointed out you do not need the sequence structure.  Dataflow will take care of this.  You need to connect the error out terminals of the Visible property nodes to the loops below to enforce the sequencing you want.  Using a control with a blank label is OK, but if you have two of them how will you know which is being set Visible?  It is better to give each control and indicator a unique label.  If you do not want the user to see that label, make the label invisible or use a caption or both.

 

Lynn

Message 5 of 5
(2,726 Views)