SBOA444 November 2020 TMCS1100
To calculate the fundamental and THD readings, the software generates a pure sinusoid waveform and locks it to the fundamental of the incoming voltage waveform. Since the generated waveform is locked to the fundamental of the incoming voltage, the correlation of this pure waveform with the waveform from the voltage ADC can be used to find the amplitude of the fundamental component of the waveform sensed by the voltage ADC. Similarly, the correlation of the current and the pure voltage waveform can be used to calculate the fundamental active power. For fundamental reactive power, the correlation of the 90° shifted pure waveform and the current can be used for calculating this parameter.
To generate a sine wave, information on the amplitude, phase, and frequency of the desired waveform is necessary. For the generated pure waveform, the amplitude is set to full scale to maximize the value of the fundamental dot products, the frequency is set to the measured frequency (in units of cycles/sample) that is used to calculate the mains frequency in final real-world units of Hertz, and the phase of the generated waveform is iteratively adjusted so that it is locked to the phase of the fundamental voltage. After the frequency is correctly calculated and the generated phase of the waveform is locked to the fundamental voltage, the fundamental readings can then be correctly calculated.