ELEKTRYKA 2016 Zeszyt 2 (238) Rok LXII Sebastian BARWINEK Silesian University of Technology VIRTUAL PHASE SHIFT METER Summary: The paper presents the possibility of using virtual instrument for the phase shift measurement. The hardware is built on the basis of National Instrument data acquisition card and PC. The software is based on LabVIEW. The measurement results were compared with results obtained from simulation. Keywords: virtual instruments, measurement of the phase shift, discrete Fourier transform, LabVIEW PRZYRZĄD WIRTUALNY DO POMIARU KĄTA PRZESUNIĘCIA FAZOWEGO Streszczenie. W artykule przedstawiono możliwość zastosowania przyrządu wirtualnego do pomiaru kąta przesunięcia fazowego. Część sprzętowa zbudowanego przyrządu to karta pomiarowa firmy National Instruments oraz komputer PC. Część programowa powstała w oparciu o środowisko LabVIEW. Otrzymane wyniki pomiarów porównano z wynikami otrzymanymi z symulacji. Słowa kluczowe: przyrządy wirtualne, pomiar kąta przesunięcia fazowego, dyskretna transformata Fouriera, LabVIEW 1. INTRODUCTION Measurements of phase angle (phase shift angle) are commonly used in many engineering fields [8]. They are applied for instance in quasi-balanced systems with phase detection. These are ac circuits for measuring the immittance components, they may also be used for measuring dielectric loss factor tg δ and Q-factor of a coil [2], [5], [6]. A single phase angle is distinguished in phase detection, usually this is π/2 [4]. Detection of quasi-balanced state is one test component, which has a direct bearing on the final immittance measurement result. The use of virtual instruments (i.e. devices with software processing) has become universal due to increasing computational power of computers and microprocessors [2]. Such devices contain hardware and software parts. The hardware part is limited to an indispensable
70 S. Barwinek minimum, usually this is a data acquisition card. The principal part of the device is the software executing digital data processing. On the basis of available reference data [1], [7], [8] and conducted simulations [3], a discrete Fourier transform has been chosen as an algorithm for measuring phase shift angle. Fourier transform converts signals from time domain into frequency domain. It is universally used in digital data processing, among others for assessment of higher harmonics content [9]. It is also possible to calculate phase angle of measured signal. The investigated device uses a short-period Fourier transform; this is a transform computed on the basis of samples currently contained within the time window. The value of phase shift angle is calculated for time instant corresponding to middle of the window. Then the window is shifted by one sample. In this way phase shifts for successive time instants are obtained [8]. The application of this method for measuring real signals originating from two-channel generator (instead of simulation signals used before [3], [8], [9]) is presented in the paper. 2. MEASUREMENT SYSTEM The measurement system was composed of two basic parts: two-channel generator and virtual instrument (Fig.1, Fig.2). Function generator RIGOL DG1022 was used as sine wave generator. The resolution of phase angle setting advertised by the manufacturer is 0.1 ; however, during measurements it transpired that it only attained 1. This error in generator performance is probably due to error in internal software of the device (software version used 00.03.00.08.00.02.08). The manufacturer does not disclose precise parameters of phase angle settings or their stability in the device manual [12]. Fig. 1. Block diagram of the measuring system Rys. 1. Schemat blokowy układu pomiarowego The virtual instrument consists of two basic elements: - the hardware, - the software (Fig. 1). The hardware of virtual instrument utilizes a DAQ module USB-6251 of National Instruments. The module samples the investigated signals. This device is characterized by 16- bit sampling resolution, maximum speed 1.25 MS/s (1 MS/s when two channels are used simultaneously). A single A/D converter uses acquisition multiplexed between eight channels. This multiplexing introduces some delay in sample acquisition of different signals, which influences the phase angle measurement error [10], [11]. The algorithm of short-time discrete Fourier transform requires that investigated signals should be sampled at identical time
Virtual phase shift... 71 instants. Therefore in order to obtain more precise results synchronous sampling should be applied [7] [8]. To check the impact of time window shape on measurement results, a low pass filter was not used, since it would limit the signal spectrum (elimination of aliasing effect). During measurements the DAQ card was set for measurement range equal to ±1 V. Fig. 2. Measurement stand Rys. 2. Stanowisko pomiarowe LabVIEW environment was used for the software of virtual instrument. It is characterized by its easy management and possibility of introducing fast corrections into the program. The program code may be divided into three parts (Fig.3): - data acquisition block and communication with measurement card, - block using MATLAB software for estimation of phase shift angle, - block for visualising and archiving the results. Fig.3. Program code Rys.3. Kod programu
72 S. Barwinek Fig.4. Control panel Rys.4. Panel użytkownika User control panel (Fig.4) makes it possible to change parameters of measurement algorithm, to visualize investigated signals and measurement results. It is possible to record the obtained results on a disk, and this facilitates the subsequent analysis. 3. MEASUREMENT RESULTS Sine signals with amplitude of 1 V and phase shift of 90 (π/2) were used in measurements. This value of phase shift was chosen, since it is widely used in quasi-balanced systems with phase detection. During the tests impact of difference parameters on angle estimation was checked. When number of acquired samples is increased, the error of phase shift angle measurement decreases (averaging of a greater number of test data points) and difference in results for different time windows decreases also (Fig.6, Fig.7). By increasing amount of data, time spent in calculating measurement results rises, this is caused by increase in the number of mathematical operations.
Virtual phase shift... 73 Fig.5. Absolute error of phase shift measurement vs. number of signal samples Rys.5. Błąd bezwzględny pomiaru kąta przesunięcia fazowego w zależności od ilości próbek sygnału Fig.6. Absolute error of phase shift measurement vs. number of signal samples Rys.6. Błąd bezwzględny pomiaru kąta przesunięcia fazowego w zależności od ilości próbek sygnału In case when number of samples used is large and width of time window is badly (inappropriately) selected, results burdened with high errors are obtained (Fig.8). It is necessary to select proper width of the time window and sampling frequency for a given number of samples. A wide window does not necessarily yield lesser errors (Fig.7, Fig.9). Narrowing the window lengthens measurement time, since a greater number of iterations in angle measurement algorithm is needed.
74 S. Barwinek Fig. 7. Absolute error of phase shift measurement vs. width of the time window Rys. 7. Błąd bezwzględny pomiaru kąta przesunięcia fazowego w zależności od szerokości okna czasowego Fig. 8. Absolute error of phase shift measurement vs. width of the time window Rys. 8. Błąd bezwzględny pomiaru kąta przesunięcia fazowego w zależności od szerokości okna czasowego
Virtual phase shift... 75 Fig. 9. Absolute error of phase shift measurement vs. width of the time window Rys. 9. Błąd bezwzględny pomiaru kąta przesunięcia fazowego w zależności od szerokości okna czasowego Signal sampling frequency must be high enough in order to attain the smallest possible measurement error. When sampling frequency rises and number of data acquired remains constant, the measurement time is decreased. In some cases decreasing sampling frequency several times does not lead to significant error decrease; however, difference in error between diverse time windows decreases. In case of some time windows and lower sampling frequency, smaller errors were obtained (Fig.10). Fig. 10. Absolute error of phase shift measurement vs. sampling frequency Rys. 10. Błąd bezwzględny pomiaru kąta przesunięcia fazowego w zależności od częstotliwości próbkowania
76 S. Barwinek To eliminate spectral leakage, time windows of definite shapes are used in measurements [9]. Slight impact of time window type on measurement results may be due to the fact, that spectral leakage is not a significant error component and quality of signal generated by the device is more important (setting resolution of signal s phase angle). In order to compare results obtained with the help of virtual instrument signals were measured also with PFL-28A device. The result is 0.5274. In comparison to results obtained by simulation (Table 1), PFL-28A device and virtual instrument with time windows other than rectangular yield worse results. Results for rectangular time window are better than those obtained in simulation. The error values in simulation depend largely on type of time window. Type of time window Signals without interference Constant component in two signals Constant component in one signal Random disturbance Simulation results [3] Maximum absolute error Bartlett Blackman Chebyshev Hamming Hanning (1.1 10 ) 0.15 0.07 (1.1 10 ) -14 (5.0 10 ) (1.1 10 ) -3 (1.0 10 ) -3 (2.0 10 ) -3 (2.0 10 ) -2 (3.3 10 ) -2 (8.8 10 ) -2 (6.0 10 ) -4 (1.7 10 ) -3 (1.4 10 ) -4 (8.0 10 ) Kaiser β=100 Table 1 Rectangular (1.7 10 ) 0.2 (1.2 10 ) 0.6 (2.0 10 ) 0.4 3.1 4.1 4.2 3.8 3.0 7.7 2.7 4. CONCLUSIONS The applied algorithm should make it possible to conduct measurements with error not greater than (1 10 ). Still, during real measurements the obtained results were much worse (by several orders of magnitude). The smallest error was equal to 0.041, it was obtained for following parameters: sampling frequency 100 khz, number of samples 10000, window width 1000, Bartlett type window. In case of remaining windows the resultant errors were greater (with maximum difference equal to 0.02 ). The result burdened with greatest error (equal to 9.474 ) was obtained for sampling frequency 100 khz, number of samples 5000, width of window 250, Kaiser type window. For other window types and identical parameters, the results were similar. To achieve results encumbered with small errors, a proper number of samples should be selected as well as width of window (apart from high sampling frequency).
Virtual phase shift... 77 During future research aimed at achieving smaller errors, a better generator should be used (one characterized by greater resolution) and measurement system with synchronous sampling. The results obtained so far may be satisfactory in some applications. However, in case of precise measurements it is necessary to obtain errors smaller by several orders of magnitude. Practical application of the described virtual instrument may be found in quasi-balanced systems with phase detection. The use of virtual instrument makes it possible to replace easily the part responsible for signal processing. All corrections may therefore be introduced quickly and without additional device exchange. REFERENCES 1. Dusza D., Bartoszewski J.: Algorytmy estymacji kąta fazowego. Prace Naukowe Instytutu Maszyn, Napędów i Pomiarów Elektrycznych Politechniki Wrocławskiej nr 64. Studia i Materiały nr 30. Wrocław 2010. 2. Cichy A., Skórkowski A., Barwinek S.: Automated quasi-balancing in virtual quasibalanced circuit designed to capacitance measurements. 19th Symposium IMEKO TC-4 Symposium and 17th TC-4 IWADC. Workshop Advances in Instrumentation and Sensors Interoperability, Barcelona. Universidad Politecnica de Catalunya, Barcelona, Spain 2013. 3. Barwinek S.: Implementacja i właściwości wybranego algorytmu pomiaru kąta przesunięcia fazowego w środowiskach MATLAB i LabVIEW, Dokonania Młodych Naukowców 1/2014 Nr 2 ISSN 2300-4436 Creativetime, Kraków 2014. 4. Cichy A.: Analiza właściwości układów quasi-zrównoważonych z detekcją fazową przeznaczonych do pomiaru składowych immitancji. Monografia 479. Wydawnictwo Politechniki Śląskiej, Gliwice 2013. 5. Cichy A.: Non-bridge circuit with double quasi-balancing for measurement of dielectric loss factor. IET Sci. Meas. Technol. 2013 vol. 7 iss. 5, s. 274-279 6. Cichy A., Skórkowski A., Barwinek S.: Double quasi-balanced meter for measurement of inductor quality factor. 19th Symposium IMEKO TC-4 Symposium and 17th TC-4 IWADC. Workshop Advances in Instrumentation and Sensors Interoperability, Barcelona. Universidad Politecnica de Catalunya, Barcelona, Spain 2013. 7. Krajewski M.: Analiza właściwości wybranych algorytmów cyfrowego przetwarzania sygnałów w pomiarze zespolonego stosunku napięć. Oficyna Wydawnicza Uniwersytetu Zielonogórskiego, Zielona Góra 2010. 8. Gajda J., Sroka R.: Pomiary kąta fazowego: metody, układy, algorytmy. Wydawnictwo Akademii Górniczo-Hutniczej im. Stanisława Staszica, Kraków 2000. 9. Zieliński Tomasz P.: Cyfrowe przetwarzanie sygnałów. Od teorii do zastosowań. Wydawnictwa Komunikacji i Łączności, Warszawa 2007. 10. National Instruments USB-6251 NI 625xSpecifications. Dostępny w WWW: www.ni.com/pdf/manuals/371291h.pdf [Dostęp: 26, czerwiec, 2014].
78 S. Barwinek 11. National Instruments DAQ M Series User Manual NI 622x, NI 625x, and NI 628x Devices. Dostępny w WWW: www.ni.com/pdf/manuals/371022k.pdf [Dostęp: 26, czerwiec, 2014]. 12. RIGOL Data Sheet DG1000 Series Dual-Channel Function/ArbitraryWaveform Generator. Dostępny w WWW: www.rigol.com/download/oversea/dg/datasheet/dg1000_datasheet_en.pdf [Dostęp: 26, czerwiec, 2014]. Mgr inż. Sebastian BARWINEK Silesian University of Technology Faculty of Electrical Engineering, Institute of Measurement Science, Electronics and Control ul. Akademicka 10, 44-100 Gliwice Tel. 032 2371241; e-mail: sebastian.barwinek@polsl.pl