LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to know when the voltage is over the X-axis

aeastet, I will upload the code as soon as I have some time here

 

Thanks for the help!

0 Kudos
Message 11 of 55
(1,067 Views)

Hey Ray, I tryed your example here

but when I use for loop with index enable it don't work because create a 3D array

and if I use with disable index, it aways give me the index of 0.

 

Thanks

0 Kudos
Message 12 of 55
(1,060 Views)

I didn't realize you were working with 8 channels.  That should be okay.  I would have done the code a little differently.

 

Can you post your code?

0 Kudos
Message 13 of 55
(1,056 Views)

Hey Ray.R, is something like that

 

VI.JPG

 I only did it comparing 0 and 4, the next will be the same if it works!

 

But my problem is, when I use enable indexing I receive an error because I'm trying to read a 3D array, and when I disable auto-indexing I always receive 0 at result!

 

Thanks

 

0 Kudos
Message 14 of 55
(1,051 Views)

I see the problem.

 

In your example, simply remove the For Loop. 

 

However, before I do that, do you mean to say that you have 8 channels, but you are only interested in two of them?

If so, then try removing the For Loop.. , especially since you only have 1 iteration.

 

From what I understand when reading your post and looking at the code, you are looking for a value going positive when it crosses the x-axis.  I had the sample data going the other way (going negative).  If that is the case, then you want to change the numeric constantfrom 2.5 to -2.5 and change all the minus to plus.  Otherwise, yes 0 is where they both meet the condition and it will say that they are equal.

 

If you are monitoring 8 channels, I can improve my example.

Message 15 of 55
(1,031 Views)

Ray R, I'm monitoring 8 channels but i'm using 2 channels to compare!

 

Like I will compare Vr with Ir, Vs with Is, Vt with It and Vtn with In

 

so if I only make more 3 cases using the correct index, don't work?

or if you can, improve to 8 channels so I will take a look!

 

I didn't understand why you use 2,5 and a minus in the beggining, could you explain me a little better this?

 

And, yes I need know when the value goes to positive, so please change your code, because I tryed here but it don't work x(

Message Edited by EduU on 03-17-2010 12:42 PM
0 Kudos
Message 16 of 55
(1,028 Views)

The -2.5 is to have negative values initially.

 

I will do the example for 8 channels during my next break.

0 Kudos
Message 17 of 55
(1,016 Views)

See the code snippet below:  The portion on the left represents the signals (8 ch) that you are acquiring.  Or have acquired or read from a file, etc.  

Since you are only interested in 2 of the 8 channels, I left the code to the right similar to the original example.  However, I included two controls to select the channels, one for Voltage and the other for current.  I wanted to have fun with various levels, so I placed a random number generator for this example.  Run it a few times, and you will see how it behaves under different circumstances, such as the signal never crossing the threshold.  Since you mentionned that it crosses the x-axis, which is amplitude = 0, then I left the comparison as GE 0.  Otherwise, you can change the logic to accommodate different threshold values.  You will/may have to include logic to deal with the situation when they both cross the x-axis at the same time.

 

Enjoy..

 

Message Edited by Ray.R on 03-17-2010 05:12 PM
Message 18 of 55
(1,012 Views)

Well Ray. R,

 

I connect the first multiply ( 1 x  random number ) at frequency, and the (5 x random number ) at amplitude, but why sometimes I'm geting index -1? In my opinion index 0 would be the first one, no?

 

Maybe I connect something wrong =x

 

And could you explain me why this "-2,5" ??

I didn't understand it yet!

 

Thanks

Message Edited by EduU on 03-18-2010 06:38 AM
0 Kudos
Message 19 of 55
(999 Views)

You're not doing anything wrong..

 

-1 means that it did not find any values crossing the x-axis.  I wanted the example to show what happens if:  as time goes to infinity, the values goes to zero, meaning it gets really close but never reaches it.  If your values do not exhibit this, then you will never see -1.  In the example, the "-1" case represents having signals (waveform, etc) that never have amplitude values above zero.

 

Why -2.5?  Simple.  You mentionned that the signals start off being negative, and increase to positive values, so I am forcing the starting values to be below zero (below x-axis), in other words the starting numbers are negative.

 

You can add a waveform graph to the example to see what the signals look like and what they are doing.  If you want to avoid the "-1" case from happening in the example, you  have 2 choices:  1) change the amplitude value to a constant instead of random, or.. 2) include a minimum range for the amplitude (ie > 2.5) so that the signal does cross the x-axis.

But remember, this is just an example, it is not the values that you will be dealing with.

0 Kudos
Message 20 of 55
(987 Views)