LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in NI's 'Threshold 1-D array'?

I was using this VI to find zero crossings and when I use one in my VI it seems to work fine. If I add a second only one of them works. It switches between which one actually works. I looked at the old version of the program that I am rewriting, it was written in LabVIEW 6i, and found a VI someone created that said it fixxed an error in teh Threshold 1-D array. My question is if this was known in 6i why wouldnt it be fixxed by now? Maybe other people havent came across this or I am just wrong. Just curious either way. I will attach the VI that claims to fix this problem
0 Kudos
Message 1 of 5
(2,910 Views)
Your VI diagram is password protected, thus rather useless.

Can you elaborate what you get when "it does not work" (e.g. wrong result, no result, error message, etc.).

I've never had a problem with the plain vanilla "threshold array" included with LabVIEW. Of course it only finds the first zero crossing that goes from negative to positive so you need some extra coding to make it find all the others, e.g. in a loop increment the start index to the rounded up fractional index output to find the next zero with positive slope. Repeat until the end of the input array is reached. etc. Then repeat with the array multiplied by (-1) to get all the zeroes with negative original slope.
0 Kudos
Message 2 of 5
(2,910 Views)
The error is this... Lets say I send to arrays in. One of them the threshold array always finds the correct zero crossing. The other one on the other hand just returns the index 0 which is not the correct point for the zero crossing of the second array.

Here is the non password protection of working version..and also here is how I found it wasnt working..
Download All
0 Kudos
Message 3 of 5
(2,910 Views)
OK, the only known problem for "threshold array" is documented in the online help: "... and it might return incorrect data if threshold y is less than the value at start index". Does this apply to your data?

I don't think it has anything to do with the number of calls on the diagram, but is an inherent limitation. The array must start with values below the desired threshold.

Your "fixed" VI basically searches the array until the data goes from negative to positive, then starts the "threshold array" at the index of the last found negative value, ensuring that the limitation does not apply. For some reason it jumps through quite a few uneccessary hoops doing so. All the stuff with bundling is not needed, it does not make sense. I have included
a cleaned-up version below. See if this works for you. (llb contains both VIs, I also did a few minor changes to the main vi for simplicity).

As a more general comment, I think there might be better ways to determine a phase shift. How does your data typically look like? (e.g. amount of noise, presence of other frequencies, DC offsets, etc. all will cause serious problems with this simplistic approach).
Message 4 of 5
(2,910 Views)
The signal is a simple 60hz sine wave. It is connected to a machine that can be hooked up to induction motors and transformers and allows us to look at how those effect the input signals. This is for a power labratory at a university. The signals can get noisey but I would not know how characterize the noise for you. There is not DC offset.

Thank you for your time..
0 Kudos
Message 5 of 5
(2,910 Views)