03-18-2010 08:19 AM
So in my case I don't need this "-2.5" right?
And I don't need to change the -1 situation, because in my program always the waveform will pass the X-axis
Now, I understand better! Thanks mate
03-18-2010 09:06 AM
Ray. R,
I need to know which waveform goes positive first, so in that case
the first will be the smaller index, right??
03-18-2010 09:29 AM
Correct...
You got it.
The lower index means that it is the first.
Oh boy.. What was I thinking???? I reversed the logic of the compare index in the example, didn't I?
Sorry about that. Working on 14 projects all at once is making my brain go kaka... 😮
The compare in front of Voltage First should be "Less Than", not "Greater Than". 😞
My bad...
03-18-2010 09:32 AM
Don't worry Ray. R
You helped me a lot on that, and what you did in the example is correct, as I said, is my job take it and adapt to my project!
If you can help me a little more, how can I took off this index -1?
because using less than, when it read -1 the compare use it as the lower value. So I need do something to, when it is -1 in bouth cases I don't do nothing, and when is -1 in only one case, I don't do nothing in this case, and do the normal in the other case!
Something like that
Thanks
03-18-2010 11:41 AM
Oh... I get it..
Okay, I will fix the example..
03-18-2010 11:59 AM - edited 03-18-2010 12:01 PM
See the example below, which has a combination of the original code and:
1) a loop instead of having twice the same algorithm
2) replaces -1 with NaN (not a number) (note:NaN as an I32 gives 2147483647)
I placed the code that replaces the -1 with NaN in the square decoration on the block diagram.
You can simpy add that to the original code, or switch to the loop. I prefer linear to using a loop for something this simple. It's a matter of taste. In a text-based language, I'd have the loop.
You do understand that the bottom part was intact and I placed the top code to illustrate how to implement with a loop and the code that swaps the -1 with NaN, right? So you don't need both. Just make sure you have the swap code and pick either the loop or linear code.
03-19-2010 06:32 AM
Ray. R,
Yes I understand I only need one code... Thanks for the example
I was trying to do something near that.. but I didn't think in a T or F select, nice move that!
Only one more question, in my original VI I will have 7200 samples in each second, so I need to compare sample to sample and know when it's positive (inductive) or negative (capacitive), Because depends on the situation sometimes in the same second it can be negative at the beggining and positive at the end...
So how can I implement a code to measure it N times? because if I'm right, with this code I will find the first situation the both channels become positive, and the others?
03-19-2010 07:35 AM
First, if you're looking at the example code, you need to eliminate the portion that generates the 2D array of sample data.
You could look at the first measurements and determine the sign. Do you need to determine this for both the channels that you need to monitor? I'm not sure what your circuit does, but if it is a sinusoidal waveform, then it can be either. If it is the waveform after a filter, then you can look if the starting values are positive or negative and use the select to change the compare between LE to GE.
My question would be: How do you know if it will or will not cross the x-axis? Does it always cross? What do you do if it does not cross?
03-19-2010 07:57 AM
Well, maybe at the beggining don't cross.. because sometimes we start to monitore it with all voltages and current off.
When it happens, I think we don't need to do nothing. But when voltages and current are connect for sure it always pass. We work with sinusoidal waveform but let me try explain better, we have 4 voltages and 4 current
and I need to compare it in par, like Vr with Ir something like that... but doing this code, if i'm right, I'm looking for the first time those channels will pass X-axis, but I need monitore all times it cross the X-axis to know, which one will pass first so I could know the signal of power factor!
Thanks
03-19-2010 12:19 PM
More one question Ray,
I need now know the angle lag that voltage have to current when both goes positive at X-axis, I need that to calculate the cosine of that angle to know if power factor is positive and negative.
And I also need to read the spectrum of the waveform... I also tryed it but it never work right!
I already took a look at some VI's but could you help me on that? making an example or something like that?
Thanks