LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reducing noise of incoming data

Solved!
Go to solution
It looks like the only function that I will be able to use is in fact the median.vi in this version of 5.1.  Here is a screenshot of the diagram and front end I am currently working with.  As far as using the median.vi I am a bit miffed as to at what stage I should use it.  Should it be plugged in right before outputting to the waveform chart once it has gone through the error testing, etc, or should it be implimented sooner.  I'm guessing it does matter.  Thanks
Message Edited by Support on 07-07-2009 03:59 PM
0 Kudos
Message 21 of 36
(2,391 Views)

It depends on your philosophy of error testing.  I would put the filter in before you error test, to avoid false alarms on spikes in the data.  But if the cost of missing a real alarm is a lot worse than a false alarm, then you would use the raw data for the error detection, and expect false alarms if the data has noise spikes.  Your decision.

 

Screen shots are attached of a VI that computes running median and running average, using only VIs from the base package (Median.vi, Mean.vi).  It use shift registers to access the previous nine values of the signal and computes the median and average of those values.  Front panel shows that the median is less sensitive to spikes than is the average.  I have drawn a block around the "spiky signal generator" part of the VI.  You have your own signal to se instead.  Sorry I have having trouble understanding your VI, so I won't try to comment on it specifically. 

 

Bill R.

0 Kudos
Message 22 of 36
(2,382 Views)
Here with LED "alarms" for median and average, and an alarm threshold that user can adjust on the fly.
0 Kudos
Message 23 of 36
(2,376 Views)
Thanks for all the help Bill.  I have trouble understanding the VI that I inherited as well so I am starting with a clean slate.  Will post once I get something up and running.  Appreciate all the effort.
0 Kudos
Message 24 of 36
(2,372 Views)

Hi All,

  I am working on this "project" actively now and am a bit miffed on a few things.  First off I guess I should explain what I am trying to accomplish.  For every 1334 readings coming in from a Ultrasonic piece of equipment at a Baud Rate of 9600 I want to create a median point and have it graphed.  Keep in mind that I am trying to read up on my own, but am essentially a complete newbie to this program.  The way that I figured I should go about this is to perhaps have a For loop set to 1334 and an array in it so that the array fills up to 1334 entries and then the outputted array goes into the median.vi and then one number comes out and gets sent to the graphs.  Does this make sense, or am I going about this all wrong?  The rest of the program has been grandfathered to me and works fine so I am really just concerned with comments regarding this problem which is the for loop in the attached .png.  The catch of course is that I am using LabView 5.1 since that is what all the machines are running.  I am running 5.1 and 7.1 on my computer however so I can view up to 7.1.   I will include the unaltered .vi saved in 7.1 and then also a screenshot of the alteration I have made with the for loop in 5.1.  thanks for any help, Sam

Message Edited by Support on 07-07-2009 04:30 PM
0 Kudos
Message 25 of 36
(2,331 Views)

Hi Sam,

 

You have the right idea.  The problem is with the build array function that you are using.  The way you have implemented it, you are just building a 1x1 array over and over.  You need to initialize the array(outside of the loop) and then append to the array (insert into array VI)using the iteration counter on the loop as an input to the index input.  This will let you continuously add points to the array and not overwrite what you have already written.  Please let me know if this doesn't make sense.  I have attached a screen shot of how to do this.

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 26 of 36
(2,302 Views)

Hi NAKeel,

  Thank you very much for the help. A question I am having is how do you "insert into array" in version 5.1 when there is no VI for it?  I see I have a "Replace Array Element", and a "Build Array" VI, but neither seems fitting being that I want do precisely what the name of "Insert into Array" does.  Was this some sort of blunder on their part, or do I have to use some weird workaround?  Here is a screenshot of the 5.1  Array menu.  I can do this in 7.1, but it won't do me alot of good since all the machines on the floor are running 5.1.  Thanks again, Sam

Message Edited by Support on 07-07-2009 04:30 PM
0 Kudos
Message 27 of 36
(2,279 Views)

Hi,

  Here is my current configuration with the raw data coming in from the wire on the left.  There is a piece of the puzzle missing that I hope you can clue me in on.  I have the array initialized as 1-dimensional, and then the data gets fed into a loop that I am trying to have index up each time it loops for the specified time.  So basically for 140 ms the array needs to fill up and then at that point the array needs to have a median point found and sent on down the line.  What I can't figure out is how to put the stuff in the array.  I have all the 5.1 functions which oddly does not contain an "insert array.vi" type of deal.  Any idea?  Me thinks this is all harder than it has to be since I am using an archaic version.  Thanks, Sam

Message Edited by sayndesyn on 06-24-2009 02:58 PM
0 Kudos
Message 28 of 36
(2,252 Views)

I am not sure I fully understand what you are doing.  The image below shows how to add a datapoint to an array (using things available in LV 5.1).

 

Also you should stop your loop with a control or some logical condition.  Wiring a constant to the conditional terminal means that you must use the Abort button (red octagon) on the tool bar to stop the program.  That is bad practice because it leaves things in an indeterminate state.

 

Lynn

 

Append to array.png 

0 Kudos
Message 29 of 36
(2,241 Views)
Solution
Accepted by topic author sayndesyn

Attached is a version of your VI that may be closer to what you want.  This code gives a sliding window median, similar to what the median filter will produce.  For every measurement a median value of the last N points will be produced, where N is limited to be no more than 1334 values in this case.  The VI starts with an empty array, and as each measurement is produced appends the measurement to the array (using the 'build array' primitive), until the array grows to 1334 elements.  After this point the array is treated as a circular buffer where the oldest measurement is replaced with the newest (using the 'replace array element' primitive).  The array is passed to the median.vi and then graphed. 

 

-Jim

Message Edited by Support on 07-07-2009 04:30 PM
Message 30 of 36
(2,232 Views)