| Autofrequency theory |
Back to main page |
| This autofrequency method is designed
to perfom a tracking to the frequency input signal by digital control process.
It needs a sinetable sample buffer to compare to the collected signal. This pattern must be carefully generated in order to design an optimal system. Let's go through this theory describing the sinetable. Suppose we are sampling at 10kHz rate. If we're working with a 50Hz input signal , we will have 200 samples of output signal, so we will compare it with a 200 sine pattern. If the input frequency changes we will have an output distortion
. This distortion may appear in two ways. By one hand if present frequency
is lower than normalized frequency ( 50Hz), the output signal will
has zero_distortion:
This problems hangs over output signal. We've to prevent it by calculating frequency. Some previous considerations
|
Autofrequency function :
By every interrupt admission, a frequency counter is incremented. At the same time a Polarity_Input_Signal Detector checks signal polarity and sets a flag in case has changed. If in an interrupt ,after cheking this flag, is active ( a polarity inversion has perfomed) the frequency counter has reached the highest threshold. This highest threshold informs us about the present frequency. We know that working in normalized frequency a normalized number of interrupts are accepted. Comparing this normalized number of interrupts accepted with present frequency counter we will know the difference between both frequencies. We stablish Differential Value, that is defined as : Diff. Value = Normalized interrupts - Frequency counter This is the number of samples we should have to interpolate or delmate. Interpolate or Delmate ? It depends on the present frequency in input signal. If it's lower than normalized frequency then we'll have to interpolate because we don't have samples enough . Thereby we must generate new samples. If we've a double lenght sine pattern new samples will be there. Increasing the pointer one cell ,new sample will be generated only with this intruction. After we increases the pointer again to return to old position. If present frequency is higher than normalized frequency we must
delmate some samples 'cause there're more than we need.
Which degree of interpolation/ delmation ? We define Gap the number of samples between two interpolations/delmations. Gap = Normalized interrupts / Differencial ValueThis value give us the number of samples we should've to wait before perform an interpolation/delmation. |