From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, 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: 

How to fix the strange behavior of ToneMeasurements.vi?

Solved!
Go to solution

Hello dear LabVIEW community.

 

My problem.

 

I have 3 pressure transducers and 1 turbine flow meter (Omega 303). Using NI USB-6009, I read voltages from the pressure transducers and frequency from the flow meter.

 

To get the frequency from the voltages output by the flow meter, I'm using ToneMeasurements.vi.

 

Once I've started the program, I get enormous frequencies that (I know for sure) do not correspond to reality. Over the course of 5 to 10 minutes, the frequency settles down from enormous mean value and enormous fluctuations to the correct frequency with an acceptable fluctuation.

 

I get the frequency from the numeric indicator. The indicator is, obviously, wired after the ToneMeasurements.vi.

 

Before the ToneMeasurements.vi, I have wired the waveform chart. It shows me the expected perfect signal all the time, including those initial 5 to 10 minutes when I get unrealistic frequencies from the frequency indicator.

 

Moreover, the voltages from the pressure transducers come out perfectly fine as expected.

 

Thus, I conclude there is something the ToneMeasurements.vi does to the signal that leads to the wrong frequency computation during the initial 5 to 10 minutes.

 

I'm wondering what it can be and how to fix it.

 

My specifications.

 

1) Windows 10

2) LabVIEW 2021

3) NI USB-6009 DAQ board

4) Have tried:

   a) changed number of samples and sampling rate in various combinations (making sure the sampling theorem requirement is met) - no luck

   b) added ToDDT.vi before the ToneMeasurements.vi - no luck

   c) plugged the flow meter to the circuit where no additional powerful equipment was plugged to - helped initially, then it stopped helping

   d) plugged the computer to another circuit without additional powerful equipment - no luck

   e) unplugged Arduino from the computer (I'm reading one more sensor with Arduino) - no luck

 

Thank you in advance.

Ivan

0 Kudos
Message 1 of 9
(1,295 Views)

Can you post a sample set of data that you are wiring into the "Signals" input on ToneMeasurements?

 

I can think of a couple things...

 

1st, it could be that your samples are too short.  If there isn't enough data going in, it's hard to get accurate measurements.   Your chart shows the complete history but the Tone Measurement VI is only evaluating the most recent data capture.

 

2nd, have you tried using the configuration of the Tone Measurements to specify a "sane" range?

 

Kyle97330_0-1675297664581.png

 

0 Kudos
Message 2 of 9
(1,279 Views)

I recommend that you try "Extract Single Tone Information", one of the "regular" VIs on the Waveform Measurement Palette.  I don't know what the Express VI is doing (or trying to do), but "regular VIs" are generally easier to use and often more robust.

 

One thing you can do with LabVIEW is to use LabVIEW Signal Generation VIs (which let you mix in noise with your signal, or have two or three signals added together) and feed the output into the Signal Analysis VIs.

 

Something else you might think about is the relationship between "sampling frequency" and the ability to analyze the signal.  The "rule of thumb" many engineers follow is to sample 10 times faster than the highest-frequency component you expect in the signal you are analyzing.

 

Bob Schor

Message 3 of 9
(1,263 Views)

Thank you @Kyle97330 (by they way, are you from Corvallis, Oregon?).

 

Since I'm not allowed to edit my post anymore, I've attached the sample set of my data to the current reply. The red periodic signal is the signal from my flow rate meter.

 

With regards to your first suggestion, like I mentioned I had tried a variety of different combinations of the number of samples and sampling rates. But nonetheless, I went ahead and tried to increase the time between the samples. I went as low as 40Hz sampling frequency and 4 samples to acquire. No luck.

 

With regards to your second suggestion: I hadn't tried that before. I went ahead and tried it. I tried a variety of different combinations. I estimated my frequency as 4Hz by visually observing the turbine in the flow meter (I couldn't estimate it from the waveform chart because I don't know the units on the horizontal axis). I did try to specify 4Hz as the frequency to look for. No luck there as well.

 

Example of the signals.png

0 Kudos
Message 4 of 9
(1,232 Views)

Thank you @Bob_Schor.

 

With regards to your first suggestion.

I did try the "Extract single tone information" and, to my surprise, it was giving me exactly the same values as my "Tone measurements". Thus - analyzing the same signal simultaneously with the two .vi - I got 6.2346Hz from the "Tone measurements" and 6.23Hz from the "Extract single tone information" at a random moment during the signal acquisition. Now I conclude, it's me who is doing something wrong, not the .vi. Since, I'm out of troubleshooting ideas, I'm wondering if you can suggest any, please, if you agree with my conclusion.

 

With regards to your third suggestion. Thank you very much for sharing this rule of thumb. I understand that comes from the experience and I do appreciate you sharing it with me.

 

With regards to your second suggestion. Do you think, I should, still, proceed with that, or I should better troubleshoot what I specified above? If you think I should proceed with that, can you elaborate more on that, please?

 

0 Kudos
Message 5 of 9
(1,229 Views)

 

Thank you @Kyle97330 (by they way, are you from Corvallis, Oregon?).


I did attend college there at the time I created the email address that later became my username here, yes.

 

As for the sample data, that's a picture of the data.  What would be most useful would be that data in a VI so we can try it ourselves.  Do this:

1. On the wire leading from the "Index array" output that goes to the "Signals" input, create an indicator.

2. Run your program with the hardware hooked up until you get a reading.

3. Stop the program.

4. Find the indicator on the front panel, which should now have some numbers on it that are not zeros.

5. Copy that indicator to the clipboard.

6. Make a new VI

7. Paste that indicator into the new VI.

8. Right-click on the indicator and choose "Data Operations ► Make current value default".

9. Save that new VI

10. Add that VI to a post here.

 

However, before you do that I have a guess, based on the results I see.  Your frequency indicator shows about 60, which is about the AC frequency of wall power.  There's a good chance you're picking up interference, either electrical from a power supply or optical, if the sensors you are measuring are light-based and you're in a room with florescent lighting.

 

Something else you should do is to put down a "Waveform Graph" on your front panel (NOT a "chart") and wire the the wire leading from the "Index array" output that goes to the "Signals" input to it.  A graph shows exactly what is on the wire in one instant, while a chart has internal memory that persists, but the "Tone measurements" VI only uses what is on the wire, so you might be looking at your whole chart while the tone measurement VI is only looking at a small part of it.

0 Kudos
Message 6 of 9
(1,215 Views)

Thank you @Kyle97330,

 

I'm doing Ph.D. at OSU. I was thinking it would be funny if you were responding to me from a neighboring lab.

 

I did all the steps as you suggested. The resultant .vi is called Test.vi and is attached to this post.

 

With regards to your second suggestion. That's exactly what I had thought the problem was. You see, the first time I connected this sensor (which is just a turbine type water flow rate meter) I've got a crazy signal like the one I'm getting currently. Back then I figured out that was due to the fact that my sensor was plugged to the electrical circuit which a pump was plugged to. Pump is a powerful equipment and can send noise back to the circuit. So, I plugged the sensor to another circuit and the problem went away. That was around a year ago. Last month my sensor started giving the crazy signal again. After some time, I figured out it was plugged to the circuit which lab power supplies were plugged to. I didn't know lab power supplies could send noise to the circuit. But they could. I went ahead and replugged my sensor to another circuit. And the problem went away. I didn't touch the system for a week. And when I turned it on after a week, I got the crazy signal again. And I don't know why.

 

With regards to your third suggestion, I added waveform graph. Indeed, it shows me a crazy signal. A screenshot is added. Also, I saved the data from the Waveform graph to a .txt file. The file is attached as well.

0 Kudos
Message 7 of 9
(1,184 Views)
Solution
Accepted by topic author nepomnyi

"Test.vi" didn't save a good sample of data... I think you copied the wrong indicator or made it in the wrong place.  I was referring to here:

Kyle97330_0-1675704114773.png

At any rate, I think the root of the problem is made pretty evident by the sample data .txt file and the picture.  Your data collection VI is gathering a very small amount of signal at once (80ms in the example .txt, and 32 ms in the graph picture), but that's all that you're processing.  So it's no wonder that you're getting nonsensical readings.

 

What's probably happening is that the gathering is not time-limited by anything so you get it super fast at the start, but over time it gets slower and slower so you eventually gather long enough samples that the "real" tone you expect to see starts to show up.

 

As the simplest possible solution (but not the best) I would suggest you just put a "Wait Until Next ms Multiple Function" on the block diagram inside the loop, set to a reasonable amount of time (1000 ms maybe?)

 

If you need to leave this running for a long time (hours or days) you might need to get more complicated (multiple loops, saving data as you go along, etc).

Message 8 of 9
(1,135 Views)

Thank you very much @Kyle97330!

Your solution worked. The resultant working .vi is attached to this post.

Thank you, I owe you a lot, I do appreciate your help.

Ivan

0 Kudos
Message 9 of 9
(1,117 Views)