A shortest data window algorithm for detecting the power factor in presence of non-sinusoidal load current

Received Mar 3, 2019 Revised Apr 19, 2019 Accepted Apr 27, 2019 During recent years, nonlinear power electronic equipments introduce harmonic pollution on electric power systems. It makes the traditional power factor meter can not act accurately when it monitors unbalanced and harmonic loads. In this paper, a new algorithm for detecting the power factor in presence of non-sinusoidal load current is proposed. The proposed algorithm detects the true power factor exactly. By uses only two successive sampled data points of the voltage and the current for each displacement power factor value calculation and two sampled data points for each distortion power factor value calculation, the total/true power factor becomes easy to measure using these values directly. The proposed detector implemented using microcontroller as a main part and has been tested for single phase power system. The test results show that it can measure the true power factor of the loads quickly and accurately.


INTRODUCTION
Many schems were proposed to measure the power factor. Many of these schemes took a cycle of an input power line frequency for the measurement [1][2][3][4][5][6][7][8][9], while attempts in [10][11][12][13] took only a half a cycle to record the power factor. An attempt to reduce the elapsed time for measurement to about a quarter a cycle was illustrated in [14]. The big advance in speeding up the measurement was achieved in [15], which amounted to only 3 progressive samples of the voltage and current signals. A further great improvement was introduced in [16] where only two progressive samples of the voltage and current which were sampled simultaneously were adequate for the measurement.
All of the mentioned methods were suited for measuring the power factor for pure sinusoidal inputs of the voltage and the current. In practice the load current happens to be non-sinusoidal due to harmonic distortion. A monitoring scheme to measure the instantaneous power factor for a non-sinusoidal signal phase system was described using wavelet transform in [17] then discrete wavelet transformation window in [18].
A FPGA-based chip was implemented to improve the computation errors were described in [19], while a finite element method was reported in [20]. The last four methods involved complex mathematical procedures that were hard to be implemented. This might cause a delay which was not pointed out. Microcontrollers are single-chip computers which offer cost-efficient solutions. Using microcontrollers in the measurement of a power factor was demonstrated in [21,22]. This paper is meant to make a modification in the paper explained in [16] to promot the method to measure the power factor in the presence of a non-sinusoidal load current. The displacement power factor can be measured by using only two progressive samples of the voltage and current separated by a random short time. Two samples are taken from the output of the voltage controlled oscillator (VCO) of the phase-locked loop (PLL) circuit and the true r.m.s-to-dc converter to calculate the true power factor as will be described later. The transient time response of the proposed method is very fast and the measured value represents the instantaneous magnitude of the power factor.

THEORY OF CALCULATION 2.1. Displacement power factor calculation
Assuming that the source voltage stays undistorted (sinusoidal, without harmonics), then relating to Figure 1 the two voltage samples are.
The two current samples i 1 and i 2 can be written as follows: where G is the gain of the multiple feedback band pass filter, I 1 is the maximum value of the fundamental component of the load current and θ 1 is the phase angle between the source voltage and the fundamental component of the load current.
The displacement power factor [24] can be calculated depending only on samples (v 1 , v 2) and their corresponding current samples (i 1 , i 2 ). The value of (k 1 ) will be undefined if (v 1 or i 1 ) are taken at zero crossing and in this case, a) When Using the same procedure used previously in obtaining (9), we get that, It is obvious that in this case the p.f. can be calculated depending on the current samples only. b) When Using the same procedure used previously in obtaining equation (9) & (14), we get that, 2 3 (16) and the p.f. can be calculated in this case depending only on the voltage samples. sin and cos can be calculated from (5) and (6) as follows The output of VCO has [25] a peak value equal to the maximum expected value of GI 1 . Hence, where Vos(t) is the instantaneous value of the output from the voltage controlled oscillator while GI 1exp is the maximum expected value of GI 1 .
Hence, the actual value GI 1 can be calculated instantaneously by dividing any one of the two input current samples (i.e. i 1 or i 2 ) by the corresponding sample from the output of the voltage control oscillator (i.e. V os1 or V os2 ) and multiplying the result by the GI 1exp . exp G Vos GI

True power factor calculation
The distortion power factor (Pf dist ) describes how the harmonic distortion of a load current decreases the average power transferred to the load [26].

Irms I Irms
THDI is the total harmonic distortion of the load current. This definition assumes that the voltage stays undistorted. I 1,rms is the fundamental component of the current and I rms is the total current -both are square values. Knowing the gain of multiple feedback band pass filter (G) and the value of (GI 1 ) which achieved using (20) or (21)

3961
The result when multiplied with the displacement power factor (Pf disp ) is the overall, true power factor or just power factor (Pf true ):

HARDWARE IMPLEMENTATION
The system block diagram is shown in Figure 2.

General hardware parts description
The PIC18F452 microcontroller is used due to comprising a 10-bit 8-channel Analog-to-Digital converter (A/D) embedded module, 32KB flash code memory, 1,536 Bytes of RAM, its smaller size, and low cost. The output of the PLL voltage controlled oscillator is adjusted so that it's in phase with the output of the multiple feedback band-pass filters which represent fundamental component of the load current signal multiply by G gain. The AD536A is used as true rms-to-dc Converter it's directly computes the true rms value of any complex ac (or ac plus dc) input waveform of the load current and gives an equivalent dc output level. A common task is to convert a positive to negative signal into a range suitable for a single supply PIC ADC. The two Non-Inverting Op-Amp Level Shifter circuits shown in Figure 2 will convert a ± 5V signals which represent the voltage and current values into a 0 to 5V signal.

Microcontroller ADC module acquisition time
A full 10-bit conversion takes 12 A/D cycles to make a complete convertion. This is estimated to be 19.2μs. Adding to this a best acquisition time possible which amounts to 12.1μs. Thus to achieve one complete conversion of 31.3μs is needed. After the convertion is attained additional two convertion periods are required to resume any new convertion process which amounts to 3.2μs. Hence the total conversion time is 34.5μs. The reciprocal of this number gives a maximum sampling frequency of about 29 KHz.
As mentioned before the power factor calculation method needed voltage and current samples acquired at the same time and because of the conversion time of A/D module therefore a high speed sample and hold amplifiers (SHA) with same a control signal is used to prevent any error might be occurs [21] .

Lead-lag indicator
The lead-lag indicating signal is obtained by using the D flip-flop. The square current signal is used as data input to the D flip-flop, while the square voltage signal is differentiated and fed as a clock input to the flip-flop. The flip-flop output Q will go to the state that is present on the D input whenever a positive transition occurs at the clock input, therefore Q will indicate the lead status and Q indicate the lag status as shown in Figure 3.

SOFTWEAR IMPLEMENTATION
The flowchart for the firmware of the microcontroller is shown in Figure 4. The firmware program has been written in "C" language, using the mikroC compiler (mikroElektronika). The true_pf.C contains the functions, which initializes the microcontroller, acquires the two samples from the input voltage signal and the corresponding two current samples in addition to two samples from the VCO and true rms-to-dc converter. The values of each samples are rescaling to be in the range of (-2.5 to 2.5) V. Calculating the values of GI1 using (20), sinψ, cosψ using (18,19) and calculating the value of K1, K2 or K3 using one of the three cases according to (10, 13, and 15) .The final value of displacement power factor achieved using one of (9, 14, and 16). The output DC voltage from detector which equivalent to the true power factor is achieved by using (22,23) and forming it as 10 bit word before sending it to R2R DAC through port B and the least two bit of port C.

EXPERIMENTAL RESULTS
The proposed power factor detector method is developed as per the scheme mentioned above. The experimental tests is for non-sinusoidal load current situations and have been carried out using the proposed detector along with Fluke 43B power quality analyzer in order to evaluate the accuracy of the proposed detector. The measurements results for different seven common single-phase residential loads are given in Table 1, where it is seen that their current distortion levels tend to fall into the following three categories: low (THDI ≤ 20%), medium (20% < THDI ≤ 50%), high (THDI > 50%). Table 1. Test results for non-sinusoidal load current

PROPOSED DETECTOR EXPERIMENTAL RESULT CURVE
The theoretical calculated values of power factors and the measured with the help of proposed detector are matching with less than 0.1 % error. Figure 5 shows the detector experimental result and theoretical power factor curves for θ from 0° to 90°. The small deviation in the experimental curve is mainly due to the limitation of ADC module and R2R DAC resolution (10 bit).

CONCLUSION
A new short data window algorithm for detecting the power factor of a single-phase system in presence of non-sinusoidal load current is described. A novel algorithm has been developed for displacement power factor calculation, the proposed detector required two progressive samples of the voltage and current separated by random short time to calculate displacement power factor in addition to one sample taken from the outputs of voltage controlled oscillator of the phase-locked loop and the true rms-to-dc converter to accomplish the calculation of the true power factor. The proposed algorithm is implemented based on microcontroller with few support circuits. The maximum acquisition and calculation time limit is determined mainly by the maximum sampling frequency of the ADC and the overall speed of the microcontroller that used. Increasing the ADC and DAC numbers of bits will reduce the percentage errors that appeared in experimental test for the detector. The investigation reveals that the proposed power factor detector can successfully be used for online monitoring of the true power factor. It is also indicates leading or lagging nature of measured power factor. The developed detector is highly reliable and possesses enough flexibility to suit the requirement of electric power system with nonlinear power electronic equipments introduce harmonic distortion on load current.