A single phase micro grid composed of some synchronized diesel generators and some loads undergoes wide changes in operational frequency due to the dynamic interaction between its load and its generation. The situation gets worse when a considerable portion of the load is rectifiers which draw harmonic currents. Now we get a voltage that have both high harmonic distortion and unknown fundamental frequency. The harmonic mitigation needs in the first place a careful analysis of the waveform to separate the fundamental component and the component representing the sum of the harmonic voltage. Is there an efficient algorithm to deal with this problem? (Please consider the fact that the frequency is at the best case band limited within +/- 5 Hz of the nominal value of 50 Hz but the exact instantaneous value is unknown.)