High-Speed Digitizers

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining a collection of EXACT full wave cycles of AC voltage

Here is m question. I am using NI 5922 to measure AC current and voltage. I want to make power calculations on a set of samples which pertain to 10 FULL WAVE SINUSOIDAL cycles of AC Current and Voltage. How do I make sure that the collection of samples ARE from 10 FULL wave cycles? Is that even possible?

0 Kudos
Message 1 of 16
(6,497 Views)

Do you mean to say that you want to capture from 0 degrees to 3600 degrees (10cycles x 360 degrees/cycle) and not 3601 or 3599 degrees?

 

Why do you need to do that?  

 

I have a few ideas:

  • If you know exactly the frequency you are acquiring, and exaclty the frequency of the sample clock of your digitizer (this is related to the resolution for the 5922), then you can adjust the record length of your digitizer acquisition to get exactly 10 cycles.  This is probably the easiest option.
  • Can you not make an acquisition of >10 cycles, and then trim it down in software? This is also probably fairly easy.
  • If you are concerned about spectral leakage for acquiring a non-integer number of waveforms, why not use a window function in software?  Again, this is common and easy.
  • Finally, the most complicated route, if you have a lot of control signals/manipulation capability over your input waveform, you could do something complicated in hardware using start/reference triggers, etc.
National Instruments
0 Kudos
Message 2 of 16
(6,486 Views)

@TimmTheEnchanter wrote:

Do you mean to say that you want to capture from 0 degrees to 3600 degrees (10cycles x 360 degrees/cycle) and not 3601 or 3599 degrees?

 

Why do you need to do that?  

 

I have a few ideas:

  • If you know exactly the frequency you are acquiring, and exaclty the frequency of the sample clock of your digitizer (this is related to the resolution for the 5922), then you can adjust the record length of your digitizer acquisition to get exactly 10 cycles.  This is probably the easiest option.
  • Can you not make an acquisition of >10 cycles, and then trim it down in software? This is also probably fairly easy.
  • If you are concerned about spectral leakage for acquiring a non-integer number of waveforms, why not use a window function in software?  Again, this is common and easy.
  • Finally, the most complicated route, if you have a lot of control signals/manipulation capability over your input waveform, you could do something complicated in hardware using start/reference triggers, etc.

Timm, Thank you for responding.

 

We have a time varying frequency signal. There is a dominant drive frequency, but the drive frequency changes when the device is used (not by much but it does change). And to add to that, there are other frequencies around that, harmonics if you will. I need to find the power from AC current and voltage signal we are measuring and for that, I need to make sure every CHUNK we are using (i.e. sampled), that it be FULL waves. No partial waves.

 

It seems like for such a signal, if we have a constant sample rate, our consistent window of samples may include partial waves.

 



  • If you know exactly the frequency you are acquiring, and exaclty the frequency of the sample clock of your digitizer (this is related to the resolution for the 5922), then you can adjust the record length of your digitizer acquisition to get exactly 10 cycles.  This is probably the easiest option.
  • We know the dominant frequency and if it stays consistent, a sample rate of 10Mhz and then decimation by a factor of 5 will give me 2MHz samples. This works for our signal of 25Khz. Problem is if it changes to 25.4 or 23.8 KHz. Problem is if that happens, our number of samples don't represent 'FULL' waves.
  • Can you not make an acquisition of >10 cycles, and then trim it down in software? This is also probably fairly easy.
  • How would I do that? Do I have to use 'zero crossings' and create arrays to determine 10 cycles? Or use absolute of the sine function, so we invert negative cycles to positive and count to 20?
  • If you are concerned about spectral leakage for acquiring a non-integer number of waveforms, why not use a window function in software?  Again, this is common and easy.
  • I am not sure what spectral leakage is? Is it the same as what I was concerned about in (i)?
  • Finally, the most complicated route, if you have a lot of control signals/manipulation capability over your input waveform, you could do something complicated in hardware using start/reference triggers, etc.
  • My thoughts were using triggers, but it is a continuous acquistion.. And we don't want to miss samples in between triggers. How would I accomplish that?

I appreciate your assistance and hope to learn as I implement this. Thansk!

0 Kudos
Message 3 of 16
(6,468 Views)

The point of my first recommendation was to simply change the record length.  Yes, you're right, if the sample rate doesn't change, and the number of samples doesn't change, your "window" doesn't change and you can get fractions of a cycle of the waveform you are capturing.  That is why you can change the record length (the number of samples) - to change the size of the "window" given a constant sample rate.  I'd recommend giving that a short first before you start doing other things.

 

If you have one sample every 1/(2e6) or 500ns, then for a 25kHz signal you can adjust the error of how many cycles you capture down to (500ns * 25kHz) = 0.0125 cycles or 4.5 degrees.  In other words, you may have an error of not capturing exactly an integer number of a 2.5 kHz tone by +/-4.5 degrees. 

 

If that error is unacceptable, then you can increase your sample rate to 10MS/s, and the numbers become:
1/(10e6) = 100ns

100ns * 25kHz = +/-0.0025 cycles or +/-0.9 degrees

 

Let me know how that goes, and then we could go ahead and talk about some of the other options if we need to.

National Instruments
0 Kudos
Message 4 of 16
(6,456 Views)

Here is one way to trim the data once it has been fetched.  See attached example VI.  It will run in LabVIEW 2009 or later.

 

Regards,

Nathan

Systems Engineer
SISU
0 Kudos
Message 5 of 16
(6,451 Views)

@TimmTheEnchanter wrote:

The point of my first recommendation was to simply change the record length.  Yes, you're right, if the sample rate doesn't change, and the number of samples doesn't change, your "window" doesn't change and you can get fractions of a cycle of the waveform you are capturing.  That is why you can change the record length (the number of samples) - to change the size of the "window" given a constant sample rate.  I'd recommend giving that a short first before you start doing other things.

 

If you have one sample every 1/(2e6) or 500ns, then for a 25kHz signal you can adjust the error of how many cycles you capture down to (500ns * 25kHz) = 0.0125 cycles or 4.5 degrees.  In other words, you may have an error of not capturing exactly an integer number of a 2.5 kHz tone by +/-4.5 degrees. 

 

If that error is unacceptable, then you can increase your sample rate to 10MS/s, and the numbers become:
1/(10e6) = 100ns

100ns * 25kHz = +/-0.0025 cycles or +/-0.9 degrees

 

Let me know how that goes, and then we could go ahead and talk about some of the other options if we need to.


I like the approach, but the problem is the signal is not always 25KHz. It varies around 25KHz. So, not only am I dealing with a time varying drive frequency, my number of samples will not always be able to capture integer number of signal tones.

 

@I have to determine a max number of samples that would be the upper bound to capture more than 10 cycles or something and then use @Nathan's approach of trimming it. This means my sample rate cannot be decimated from 10MHz to 2MHz, I would probably have to sample at 15MHz and decimate by 5 to get an effective number of samples to 3 MS/s. From there, I would probably be able to have ONE window that would capture 10 or more FULL CYCLES.

0 Kudos
Message 6 of 16
(6,438 Views)

Just as an extra note, my trimming code is not very tolerant of noise, and only works perfectly on perfect signals.  You will need to add thresholding to remove extra detected zero crossings caused by noise jumping around zero.

Systems Engineer
SISU
0 Kudos
Message 7 of 16
(6,435 Views)

I believe there is some noise in our signals which I have to look for. Thanks for that!

 

BTW, I have attached a screenshot of your code's front panel.

1. It doesn't show 10 complete waves. It does 5

2. It doesn't trim the wave to Amplitude '0' at the end.

 

 

I have noted the point I would like trimmed up to. I will have to decide what to do with the partial wave. Toss it out of queue it for the next processing.

 

0 Kudos
Message 8 of 16
(6,430 Views)

Never mind. You are displaying only 400 samples. I assumed 400 points on a 10 cycle wave was supposed to have been displayed. That's what I want. ANyway, I will use that code to start from and go from there.

0 Kudos
Message 9 of 16
(6,427 Views)

Notice that the original data graph and the Trimmed Complete Waves graphs are the same.  Also notice how the indicator "Found Full Waves?" indicates FALSE?  If you were to set the Number of Complete Waves to anything less than 5, it will work properly.  I had the boolean indicator showing when it worked correctly.

 

 

Systems Engineer
SISU
0 Kudos
Message 10 of 16
(6,422 Views)