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:
 


By the other hand a worse distortion will appear if present frequency is higher than normalized one.
 

This problems hangs over output signal. We've to prevent it by calculating frequency.

Some  previous considerations

  • It's recommended to create an oversampled sine pattern to avail interpolations and delmations in signal process without wasting processor time. Typical double sinetable lenght. Thereby pointer to the table should increase more quickly (Typ. Pointer=Pointer + 2)
  • We've to know how many times we've a new sample while during input period. If sampling rate is 10KHz we'll have 200 interrupts in our autofrequency function.
  • After some implementations, is more easy to work with half period, so we will have to design a Polarity_Input_Signal Detector that the only function is detecting polarity inversions. This allows that number of pattern samples goes to half_lenght.
  • We must perform a pointer to sinetable and a control lenght in order to prevent overruns and underruns.

 

 

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.
We perform it just by a double pointer increment (Pointer=Pointer + 4). 

Which degree of interpolation/ delmation ?

We define Gap the number of samples between two interpolations/delmations. 

Gap = Normalized interrupts / Differencial Value
This value give us the number of samples we should've to wait before perform an interpolation/delmation.
 



 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Hosted by www.Geocities.ws

1