08-01-2007 05:30 PM
08-01-2007 06:00 PM
08-02-2007 12:24 AM - edited 08-02-2007 12:24 AM
Message Edited by Bill@NGC on 08-01-2007 10:26 PM
08-03-2007 07:50 AM
08-03-2007 11:39 AM
Here is a vi that will count cycles. The last data point must end completely equal to or above the first data point or it won't be counted. Incomplete cycles will not be counted.
08-13-2007 03:29 PM
08-14-2007 12:38 PM
I used the Simulate Signal express vi in this one. It will count the number of cycles generated until you press the stop button.
08-17-2007 10:16 AM
03-11-2008 05:14 AM - edited 03-11-2008 05:15 AM
Thats code looks very useful. I could use it too, I just have one question... What if you don't know the offset? I want to:
1) Verify the waveform exists - I can use this code to do that,
2) Capture a sequence of n cycles after verification, - (again use count to do this)
3) Get the RMS current for the whole cycle. - should be simple
Problem: Signal can be simulated in code, but in real life it's coming from a DAQ capture on a 6229 card. The rest of the circuit is hardware and I don't know what the offset might be from 0V.
Thanks in advance for any help - James
03-11-2008 10:49 AM
To find the offset (which in this case is the Y value midpoint around which the sine wave is symetrical):
Capture more than one cycle. Find the min and max values. Subtract Min from Max and divide by 2. Then subtract this result from the Max value (or add the result to the Min value). This is the offset.
To count the number of cycles where the offset is unknown, just use the first data point value as a reference. If the next data point is more positive, then count the number of times that the first data point is repeated and the next data point is more positive. Of course with DBL data type, you probably would not get the exact same value as the first data point, so you need to use In Range with a very tiny limit. It all depends on your signal amplitude, frequency, and sampling rate.
Example: Lets say your first data point value is 0.5 and the 2nd point is 0.55. You need to look for another value that is between 0.48 and 0.52. Then read the very next data point value. If it is greater than the previous value, add one to the cycle count. If it is less than, you are at half a cycle, do not add to the count.