Electrical Power and Energy Systems 32 (2010) 133–140 Contents lists available at ScienceDirect Electrical Power and Energy Systems journal homepage: www.elsevier.com/locate/ijepes A new approach to voltage sag detection based on wavelet transform Özgür Gencer, Semra Öztürk, Tarık Erfidan * Kocaeli University, Faculty of Engineering, Department of Electrical Engineering, Veziroğlu Kampüsü, Eski Gölcük Yolu, Kocaeli, Turkey a r t i c l e i n f o Article history: Received 9 September 2007 Received in revised form 30 March 2008 Accepted 8 June 2009 Keywords: Power systems Power quality Wavelet transform Voltage sag detection a b s t r a c t In this work, a new voltage sag detection method based on wavelet transform is developed. Voltage sag detection algorithms, so far have proved their efficiency and computational ability. Using several windowing techniques take long computational times for disturbance detection. Also researchers have been working on separating voltage sags from other voltage disturbances for the last decade. Due to increasing power quality standards new high performance disturbance detection algorithms are necessary to obtain high power quality standards. For this purpose, the wavelet technique is used for detecting voltage sag duration and magnitude. The developed voltage sag detection algorithm is implemented with high speed microcontroller. Test results show that, the new approach provides very accurate and satisfactory voltage sag detection. Ó 2009 Published by Elsevier Ltd. 1. Introduction The importance of power quality is increasing due to the fact that the equipments in power systems are much more sensitive to power quality problems. Processes are interrupted; productivity is halted as a result of these disturbances. To avoid this, the power quality problems, such as voltage sag, need to be identified first. Recent advances in signal analysis have led to the development of new methods for characterizing and identifying various power quality problems. Today one of the most common power quality problems is voltage sag [1]. Voltage sags are the main cause of more than 80% of the problems experienced in power systems. Voltage sag is a short time (10 ms to 1 min) event during which a reduction in RMS voltage magnitude occurs [2]. Despite of a short duration, a small deviation from the rated voltage can result in lots of cost effect disturbances. Because of the effect of voltage sag in many cases, the production process comes to a halt. The disturbance may be over within one second, but the restoration process may take several hours. For many power system equipments, the effect of voltage sag is the same as the effect of an interruption. The number of voltage sag is about 80–90 per year, where the number of interruptions is on average around one per year. So, the consequences due to voltage sags are more significant than due to interruptions [2]. Voltage sag often sets only by two parameters, magnitude and duration [3]. Wavelet decomposition techniques provide a powerful tool, which can be used to detect and localize voltage sags [4]. * Corresponding author. Tel.: +90 262 335 11 48. E-mail addresses: ogencer@kou.edu.tr (Ö. Gencer), semra@kou.edu.tr (S. Öztürk), tarik@kou.edu.tr (T. Erfidan). 0142-0615/$ - see front matter Ó 2009 Published by Elsevier Ltd. doi:10.1016/j.ijepes.2009.06.025 Wavelet analysis is becoming a common tool for analyzing localized variations of power within a time series. By decomposing a time series into time-frequency space, one is able to determine both the dominant modes of variability and how those modes vary in time [5]. In power system analysis, wavelet transform have received attention because its efficiency for the analysis of transients compared to other types transforms. The wavelet transform has been used for numerous studies in power system protection, power quality, power system transients, load forecast and power system measurement [6]. Several studies have been done to show the identification and classification of power quality problems using wavelet transform. Most of them use sampled voltage and current waveforms, based-on the Parseval’s theorem [7–10]. Ref. [10] is an excellent introduction to voltage sag detection techniques for dynamic voltage restorers, which are used to protect sensitive loads from the effects of voltage sags. But this paper did not provide all of the necessary essential details for wavelet analysis and avoided the issue of practical use with a microprocessor. Unfortunately, many studies using wavelet analysis have suffered from an apparent lack of quantitative results. The analyses are done via simulation and the theoretical results of the detection methods with wavelet analysis are not compared with practical results. This paper presents a new algorithm to detect the starting and ending points and the magnitude of the voltage sag. The discrete wavelet transform (DWT) is used to detect fast changes in the voltage signals, which allows time localization of differences frequency components of a signal with different frequency wavelets. A digital signal microprocessor-based hardware system is used to test 134 Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 proposed algorithm in real-time with dsPIC. The algorithm is demonstrated via case studies. 2. Wavelet transform In this section we review the necessary information on wavelet transforms (WT) for the decomposition and the detection of temporal structures such as the voltage Sag data that we analyze. Power quality problems are characterized by their maximum amplitudes, crest voltages, RMS, frequency, statistics of wavelet transform coefficients, instantaneous voltage drops, number of notches, duration of transients, etc. [11]. These characteristics are unique to identify features for different power quality problems, and introduced signal processing tools in power quality analysis. The WT has been applied to signal processing in various fields since 1980s. Time series with time-varying frequencies can be found in many power quality problems, i.e. voltage flicker, load and capacitor switching, inrush current, fault signals, etc. This technique is particularly suitable for non-stationary process and can yield localized time-frequency information that is not available from the traditional Fourier transform. The windowed Fourier transform achieves location in time by windowing the data at various times and then taking the Fourier transform. In this procedure however, precision in time and frequency are fixed in the chosen window function and therefore arrival time detection of transient components with different scales is not possible. On the other hand, WT are essentially applied to extract information and as a basis for signal representation to achieve both good time and frequency position. The choice of the basis function determines the information to be extracted from the process and allows the study of different signal structures, such as non-stationary short-time transient components, features at different scales. The process representation using wavelets is provided by a series expansion of dilated and translated versions of the basis function, also called the mother wavelet, multiplied by appropriate coefficients. So, the first step of the wavelet transform is to determine the mother wavelet. For a wavelet of order N, the basis function can be represented as wðnÞ ¼ N1 X ð1Þj cj ð2n þ j N þ 1Þ ð1Þ j¼0 where cj is coefficient. The basis function should satisfy some conditions [12,13]: The basic function integrates to zero, i.e. Z 1 wðtÞdt ¼ 0 ð2Þ 1 The basis function must be oscillators or have a wave shape. For processes with finite energy the wavelet series expansion gives an optimal approximation to the original series [14]. Many different wavelet bases can be used for the transformation attaining the properties above. The selection of a basic function is motivated by the data features to be extracted. Alternative functions move different characteristics of the raw data set between scales. In this paper, we adopt Daub4 mother wavelet, which is the most compact wavelet and it has a much simple implementation [14]. The multiresolution decomposition separates the signal into ‘‘details” at different scales, the remaining part, being a coarser representation of the signal, is called ‘‘approximation”. Each detail (Dj) and approximation signal (Aj) can be obtained from the previous approximation Aj-1 via a convolution with high-pass and lowpass filters, respectively (Fig 1). The wavelet transform can be done in three different ways, which are, discrete wavelet transform, continuous wavelet transform and wavelet series. Discrete wavelet transform (DWT) is sufficient to decompose and reconstruct most power quality Fig. 1. Basic level of wavelet transform filtering process. problems. It provides enough information, and offers high reduction in the computational time [14]. Discrete wavelet transforms are suitable for processing real data in which the signal f(t) is known only at sampling points with spacing dependent on the sampling rate. The WT in this case has discretized scale k and location u parameters. Using a logarithmic uniform spacing in the discretization of the scale and location domains provides an orthonormal wavelet basis which characterises completely N signal observations with N wavelet coefficients [15]. For any signal, f(t) 2 L2(R), the DWT analysis equations are given by: aj;k ¼ bj;k ¼ Z Z j f ðtÞ2j=2/ð2 tkÞ dt ð3Þ j xðtÞ2j=2wð2 tkÞ dt f ðtÞ ¼ 2N=2 X k aN;k /ð2N t kÞ þ M1 X j¼N 2j=2 X bN;k wð2N t kÞ ð4Þ k /(t) and w(t) are scalling and wavelet functions. ai, k and bi, k are the corresponding scalling and wavelet coefficients. The WT assumes that the full period of the signal is being analyzed. Discontinuity of high frequency components are occurring when the analyzed section is different value at the beginning and at the end of two consecutive windows, so the high frequency effects can be recognized [16]. There are some works on how to determine and appropriate it from other disturbances. Most of them use the multiresolutionanalysis technique of DWT and the Parseval’s theorem. These theorems are employed at different resolution levels to extract the energy distribution features of the sag signal. Then, some methods, such as the Artificial Neural Networks classify these extracted features to identify the disturbance type according to the transient duration and the energy features [17,18]. A fast algorithm is actually available to compute the wavelet transform of a signal. Even though the discretized wavelet transform can be computed on a computer or a microprocessor, this computation depends on the signal size and the resolution that is needed. The DWT provides sufficient information both for analysis and synthesis of the original signal, with a significant reduction in the computation time. 3. Wavelet based detection of voltage sags As mentioned in [19], high frequency resolution of transformed signal can detect transient disturbances better than low resolutions. The scaling (A5) and wavelet signals (D1-D5) of a voltage signal (S), when it is subjected to sag for 4 cycles are shown in Fig. 2. Daub4 wavelet is used in computation here. It can be seen that the Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 135 Fig. 2. Multiresolution voltage signal decomposition. first level of the transformed signal clearly shows a peak at the beginning and end of the voltage sag. The other wavelet levels have also experienced variations at this same instant. Therefore, it can be said that the disturbance can be detected with high frequency wavelet levels better. Because the microcontroller A/D channel is used bidirectional, it can read only the positive values of AC voltage signal. The negative alternances of the signal is converted to positive with a full bridge converter. So, the frequency of monitored signal becomes 100 Hz. Fig. 3a shows the pure sine wave and (c) its D1 wavelet. The horizontal axis presents sampling point and the vertical axis presents the magnitude of wavelet coefficient. The first 4 points and last 2 sample magnitudes are different from zero and the others are very close to zero. The pure sine wave will be used as a reference in comparison with sag cases. Fig. 3b shows a voltage signal distorted with sag and (d) shows its first decomposition level. It is clear from the figure that if there is a decrease in voltage signal, the wavelet coefficients around sag starting point differs from zero. A spike is seen at the initial point in wavelet. The sag can occur at any point of voltage signal. To determine the effects of voltage sag starting point on the magnitude of the spike in the wavelet, the same magnitude of sags were applied at different points on voltage wave. The magnitudes of the spikes are different and not symmetrical according to 900 as shown in Fig. 4. So only the occurrence of sag can be determined but it cannot give direct information about the magnitude of sag. Fig. 4 also shows that the first 4 points of the wavelets are the same. So an approximation can be defined to find how it changes according to sag magnitude. Fig. 5 shows the magnitude of spikes as a function of voltage sag magnitude. A function for sag magnitude according to D11 coefficients can be determined by regression analysis. In this work power regression model is used (solid line in Fig. 5). So, the magnitude of voltage sag can be calculated by determining only the D11 coefficient of decomposed voltage signal. The point of sag starting point is the location of peak occurrence. The peak will also occur at the end of the voltage sag. Hence, voltage sag classification parameters, magnitude and duration are identified and the voltage disturbance is classified with this method. The disadvantage of this method is discretization of the signal. The calculation of the voltage sag parameters can be done at the end of the cycle. It would be faster to determine and turn on the restorer system, if the calculations of the parameters are done at the half period of one cycle, For this purpose, the voltage signal is divided into two regions, called here as A and B shown in Fig. 6. Fig. 6 depicts the decomposition of voltage signal. A critical value of D11 must be calculated for each region first. For example if above 20% magnitude of voltage sag is critical and the voltage restorer must compensate above this level, the critical value is determined for 20% of voltage for each region. In Fig. 6 after sampling the voltage signal for Region A, the wavelet transform is done and the peak at D1 is observed. Then the magnitude of the voltage sag is calculated according to D11 coefficient. The sampling is continuing for Region B, and the same calculations are repeated. A peak at D1 coefficient is not observed, but D11 coefficient is below critical value of this region, so the restorer continue to work until next calculation. 136 Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 Fig. 3. (a) Pure sine voltage signal, (b) voltage signal distorted with sag, (c) decomposition of pure sine voltage signal, (d) decomposition of distorted voltage signal. 4. Implementation of sag detector Fig. 4. The magnitude of spikes according to sag starting point. The implemented system to detect voltage sag and compensate it is shown in Fig. 7. The voltage restorer components (shown in Fig. 7) are the VSC, the injection transformer, the energy storage and the bypass switch. The measured voltages and currents are the inputs to the wavelet based detector, which gives signals to the voltage restorer to function when the measured quantities differ from the settings. The wavelet based detector module triggers the start of the compensation when the supply voltage comes outside of a pre-defined range. The energy storage provides the required active power to compensate the identified voltage sag. The voltage is injected into the distribution system by the seriesinjecting transformer. The bypass switch is normally closed to short-circuit the voltage restorer. When the sag detector unit detects voltage sag, the bypass switch is opened and the voltage restorer starts the compensation process. Fig. 5. Values of first coefficients of D1 wavelet according to different voltage sags. Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 Developed sag detector using DWT consists of two parts. One of them is zero-crossing detection and the other is dsPIC microcontroller unit. Transformer and full bridge converter is used for sampling AC line voltage and feeding zero-crossing circuit. A zero- 137 crossing circuit generates pulse whenever AC line voltage reduces to zero. Then sampling starts. Flow chart of proposed Wavelet based sag detector is shown in Fig. 8. The number of sampling for a cycle is chosen as 64, which is enough to calculate the Fig. 6. Analyzing voltage signal into 2 region and the wavelet transform of these regions. Fig. 7. Single line diagram of wavelet based voltage restorer. 138 Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 DWT, so that the sampling time is set to 156 ls in dsPIC timer 0 module. At the beginning of each sampling interval, then timer sets an interrupt flag then A/D channel begins to acquire new analog value. After taking 64 samples, dsPIC calculates critical value using DWT. This calculating process is about 32 ls and it is less than sampling time. The less sampling time gives a more accurate solution. But it needs more calculation time. If critical value is less than the desired value, it can be observed that voltage sag occurred and all process restarts for a new period. So, developed detector system can identify and characterize voltage sags. 5. Test results Fig. 8. Flow chart of proposed wavelet based voltage sag detector. To recognize the distorted signal and test the proposed algorithm a voltage sag identifier system is developed. In order to allow the voltage beginning and recovery at different points during voltage sags, tests were performed with rectangular voltage sags by a fully programmable power source with an integrated arbitrary waveform generator. The programmable ac power source enables a flexible, variable amplitude and frequency voltage output. The output voltage can be transiently changed. This is useful for specifying exact sag magnitude and for transient state conditions [20]. A 200 MHz scopmeter is configured to measure the outputs of power source and dsPIC. dsPIC 30F4011 16-bit microcontroller, manufactured by Microchip was chosen to implement DWT. It has also three channels of 10 bit analog to digital (A/D) converter, five 16 bit timers, six motor control PWM channels with DSP engine. This device can be run at speeds of up to 120 MHz. Fig. 9. Behaviour of microcontroller at different voltage sag points for Region A (a) 15° (b) 30° (c) 45° (d) 60°. Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 139 Fig. 10. Behaviour of microcontroller at different voltage sag points for Region B (a) 105° (b) 120° (c) 135° (d) 150°. The interruption pin of the microcontroller detects the fundamental zero-crossing let A/D port to sample the voltage input waveform. For each sag duration that is tested, voltage data have been acquired with a sampling frequency of 6.4 kS/s. The microcontroller gets 32 samples per a region and 64 samples per a period. Then the wavelet transform is acquired if related region and if it is lower than threshold value, dsPIC turn on the voltage restorer. The computation time of the algorithm is approximately 50 ls. It is minimum 2 cycles for conventional methods. Wavelet based detection system can be faster with using higher clock signals. Higher computational times according to conventional methods results uninterrupted energy for critical loads which is the main purpose of these voltage restorer systems. The proposed sag detection algorithm is tested for different points of voltage signal for each region. Fig. 9 shows the results for region A. The sag starting points are (a) 15° (b) 30° (c) 45° (d) 60° of the voltage signal. The sag magnitude is 50% but the defined critical value for the sag is 20%. The microprocessor calculates the D11 value and compares it with critical value. If it is below the desired value, microprocessor trigs the voltage restorer until at the end of the sag. The tests are repeated for the Region B. The sag starting points are (a) 105° (b) 120° (c) 135° (d) 150° of voltage signal for Region B a shown in Fig. 10. If the critical value of this region is below threshold value the microprocessor trigs the voltage restorer after the sampling is finished. This proposed sag detection algorithm is working perfectly for any instant of the voltage sag. Computation and detection of voltage sag magnitudes and durations with using proposed method provides a great advantage to DVR systems on other conventional sag restorers. It can be implemented to such a system easily and decreases costs mostly. Existing detection methods cannot gives a satisfaction results like this for this purpose. 6. Conclusions Utilities record power quality data, especially voltage, to identify the origins of power quality problems in order to improve the reliability of electrical systems. This paper presents a practically efficient method for the voltage sag detection. The method uses discrete wavelet transforms to determine beginning and ending of the voltage sag with sag magnitude. A dsPIC-based hardware identification system for voltage sag is implemented. The proposed method is successfully tested for different voltage sag instants of voltage. It has the advantage of finding voltage sag magnitude and duration with real time operation and low cost implementation. References [1] Khan AK. Monitoring power for the future. Power Eng J 2001;15(2):81–5. [2] Bollen MHJ. Understanding power quality problems: voltage sags and interruptions. New York: IEEE Press; 1999. [3] Yalçınkaya G, Bollen MHJ, Crossley PA. Characterization of voltage sags in industrial distribution systems. IEEE Trans Ind Appl 1998;34(4):682–8. [4] Parsons AC, Grady WM, Powers EJ. A wavelet-based procedure for automatically determining the beginning and end of transmission system voltage sags. In: Proc. IEEE-PES Winter Meeting, vol. 2; 1999. p. 1310–5. [5] Gu IYH, Bollen MHJ. Time-frequency and time-scale domain analysis of voltage disturbances. IEEE Trans Power Delivery 2000;15(4):1279–84. [6] Fernandez RM, Rojas HND. An overview of wavelet transforms applications in power systems. 14th PSCC, Sevilla, 24–28 June 2002. [7] Gaouda M, Salama MA, Sultan MR, Chikhani AY. Power quality detection and classification using wavelet-multiresolution signal decomposition. IEEE Trans Power Delivery 1999;14(4):1469–76. 140 Ö. Gencer et al. / Electrical Power and Energy Systems 32 (2010) 133–140 [8] Gaouda AM, Salama MMA, Sultan MR, Chikhani AY. Application of multiresolution signal decomposition for monitoring short duration variations in distribution systems. IEEE Trans Power Delivery 2000;15(2):478–85. [9] Resende JW, Chaves MLR, Penna C. Identification of power quality disturbances using the MATLAB wavelet transform toolbox. In: IPST Conference, 2001. [10] Gaouda AM, Salama MMA, Sultan MR, Chikhani AY. Application of multiresolution signal decomposition for monitoring short-duration variations in distribution systems. IEEE Trans Power Delivery 2000;15(2). [11] Parsons AC, Grady WM, Powers EJ. A wavelet-based procedure for automatically determining the beginning and end of transmission system voltage sags. Power Engineering Society 1999 winter meeting, IEEE, vol. 2, 31 January–4 February 1999; p. 1310–5. vol. 2. [12] Arrillaga J, Watson NR, Chen S. Power system quality assessment. Chichester: Wiley; 2000. [13] Daubechies I. Ten lectures on wavelets. Philadelphia, PA: SIAM; 1992. [14] Chui CK. Wavelets. A mathematical tool for signal processing. Philadelphia, PA: SIAM; 1997. [15] Burrus CS, Gopinath RH, Guo H. Introduction to wavelets and wavelet transforms, a primer. Englewood Clis, NJ: Prentice-Hall Press; 1998. [16] A Wavelet-based Differential Transformer Protection. IEEE Trans Power Delivery 14(4) (1999). [17] Zhu TX, Tso SK, Lo KL. Wavelet-based fuzzy reasoning approach to powerquality disturbance recognition. IEEE Trans Power Delivery 2004;19(4): 1928–35. [18] Huang S, Yang T, Huang J. FPGA realization of power quality disturbance detection: an approach with wavelet, ANN and fuzzy logic Neural Networks”, 2005. In: Proceedings 2005 IEEE international joint conference on vol. 4, 31 July–4 August 2005; p. 2613–8 vol. 4. [19] Parameswariah C, Cox M. Frequency characteristics of wavelets. IEEE Trans Power Delivery 2002;17(3). [20] California Instruments, Operating Manual: LX Series AC Power Source, 2003.