06-18-2009
06:47 AM
- last edited on
07-07-2009
03:59 PM
by
Support
06-18-2009 11:05 AM
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.
06-18-2009 11:40 AM
06-18-2009 12:39 PM
06-22-2009
09:53 AM
- last edited on
07-07-2009
04:30 PM
by
Support
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
06-23-2009 04:26 PM
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.
06-24-2009
07:24 AM
- last edited on
07-07-2009
04:30 PM
by
Support
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
06-24-2009 02:57 PM - edited 06-24-2009 02:58 PM
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
06-24-2009 03:10 PM
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
06-24-2009
04:04 PM
- last edited on
07-07-2009
04:30 PM
by
Support
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