Power quality analysis using spectrogram and gabor transformation.

Power Quality Analysis Using Spectrogram and Gabor Transformation
Abdul Rahim Abdullah1, Ahmad Zuri Sha’ameri2 and Norhashimah Mohd Saad3
1

Faculty of Electrical Engineering, Universiti Teknikal Malaysia Melaka, Malaysia.
2
Faculty of Electrical Engineering, Universiti Teknologi Malaysia, Malaysia.
Faculty of Electronics and Computer Engineering, Universiti Teknikal Malaysia Melaka, Malaysia.
abdulr@utem.edu.my, ahmadzs@yahoo.com, norhashimah@utem.edu.my.

3

Abstract - This paper discusses the implementation of
time-frequency analysis techniques to analyze power
quality disturbances. The approached methods are
spectrogram and Gabor transform algorithms. Signal
parameters such as time marginal and frequency
marginal are extracted from the time-frequency
distributions. The parameters are analyzed in terms of
correctness measurement of root mean square (RMS),
total harmonic distortion (THD), total waveform

distortion (TWD) and total interharmonic distortion
(TnHD) values. Power quality events that are analyzed
are swell, sag, interruption, harmonic, interharmonic,
transient, notching and normal voltage. The results
show that Gabor transform provides better
performance in terms of correctness of parameters
measurement, window length, frequency resolution
and memory size.
Keywords: Power Quality Disturbances; Spectrogram;
Gabor; Time-Frequency Analysis

1. Introduction
Power Quality is the availability of pure
sinusoidal voltage and current waveforms at 50 Hz
(frequency power-line in Malaysia) without any
disturbances at the incoming point of the supply
system. Power quality problem is any problem
manifested in voltage, current or frequency deviations
with results in the failure or disoperation of end-use
equipment [1], [2]. With the rapid advance in

industrial applications that rely on sophisticated
electronic devices, a demand for power quality and
reliability has become a great concern. Power quality
problems can cost business billions of dollars each
year in lost revenue, process improvement and
scrapped product. Major causes of power quality
related revenue losses are interrupted manufacturing
processes and computer network downtime [3].
Conventional techniques that are currently used
for power quality monitoring are based on visual
inspection of voltage and current waveforms [4]. The
available equipment in the market for the inspection
can capture and print the power quality data only at the
current time. Therefore, a computerized and automated
technique for monitoring and analysis of power quality

1-4244-1435-0/07/$25.00©2007 IEEE

waveforms are very important to provide improvement
in power system’s infrastructure.

Many techniques were presented by various
researchers for analyzing or classifying power quality
problems [5]-[7]. However, this paper looks at the use
of time-frequency analysis techniques to analyze
power quality problems. Spectrogram and Gabor
transform algorithms are proposed and signal
parameters are extracted based on their time-frequency
characteristics. The performance of both algorithms
are analyzed and compared to perform power quality
classifications.

2. Power Quality Events
Power quality events refer to a wide variety of
electromagnetic phenomena that characterize the
voltage and current at a given time and at a given
location on the power system. According to the
International Electrotechnical Commission (IEC),
electromagnetic phenomena are classified into several
groups as shown in Table 1 [10], [11]. This paper
focused on seven types of power quality problems:

voltage swell, voltage sag, interruption, harmonic,
interharmonic, transient and notching.
Table 1: Categories and typical characteristics of power
system electromagnetic phenomena.
Categories
1.0 Transients
1.1 Impulsive
1.2 Nanosecond
1.3 Millsecond
1.2 Oscillatory
1.2.1 Low frequency
1.2.2 Medium frequency
1.2.3 High frequency
2.0 Short duration variations
2.1 Instantaneous
2.1.1 Sag
2.1.2 Swell
2.2 Momentary
2.2.1 Interruption
2.2.2 Sag

2.2.3 Swell
2.3 Temporary
2.3.1 Interruption
2.3.2 Sag
2.3.3 Swell

Typical
spectral
content

Typical
duration

5 ns rise
1 ms rise
0.1 ms rise

< 50 ns
50 ns-1 ms
> 1 ms


< 5 kHz
5-500 kHz
0.5-5 MHz

0.3-50 ms
20 ms
5 ms

Typical
voltage
magnitude

0-4 pu
0-8 pu
0-4 pu

0.5-30 cycles
0.5-30 cycles


0.1-0.9 pu
1.1-1.8 pu

0.5 cycles-3s
30 cycles-3 s
30 cycles-3 s

< 0.1 pu
0.1-0.9 pu
1.1-1.4 pu

3 s-1 min
3 s-1 min
3 s-1 min

< 0.1 pu
0.1-0.9 pu
1.1-1.2 pu

3.0 Long duration variations

3.1 Interruption, sustained
3.2 Undervoltages
3.3 Overvoltages
4.0 Voltage imbalance
5.0 Waveform distortion
5.1 DC offset
5.2 Harmonics
5.3 Interharmonics
5.4 Notching
5.5 Noise
6.0 Voltage fluctuations
7.0 Power frequency variations

0-100th H
0-6 kHz
broad-band
< 25 Hz

> 1 min
> 1 min

> 1 min
steady state

0.0 pu
0.8-0.9 pu
1.1-1.2 pu
0.5-2%

steady state
steady state
steady state
steady state
steady state
Intermittent
< 10 s

0-0.1%
0-20%
0-2%
0-1%

0.1-7%

4. Parameter Estimation
4.1 Time and Frequency Marginal
Integration of the time frequency distribution over
frequency gives the instantaneous power and power
spectrum. The instantaneous power known as time
marginal and the power spectrum known as frequency
marginal are calculated in (4) and (5) respectively:
M −1

Z [n] = ∑ TF [n, k ]
3. Time-Frequency Analysis Techniques
Time-frequency analysis techniques present a
three-dimensional plot of a signal in terms of the signal
energy or magnitude with respect to time and
frequency [8]. This study focused on spectrogram and
Gabor transform to perform time-frequency of power
quality events.


3.1 Spectrogram
The spectrogram is the result of calculating the
frequency spectrum of windowed frames of a
compound signal [9], [10]. The spectrogram timefrequency representation is calculated as follows:

Px [n, k ] =

1
M

M −1

∑ x[m] w[m − n] e

−j

2πkm
M

Z [k ] = ∑ TF [n, k ]

(5)

n =0

4.3 Root Mean Square (RMS)
From the time marginal in (4), RMS value in time
can be defined as below:

X (n) rms = Z [n]

(6)

N is the number of samples and M is the window
length.

4.4 Total Harmonic Distortion (THD)

2

m=0

(4)

k =0
N −1

(1)

0 ≤ n ≤ N − 1 and 0 ≤ k ≤ M − 1

x(n) is the input signal, w(n) is the window function, N
is the number of samples and M is the window length.

THD is a commonly used power quality index to
quantify the distortion of a waveform. The THD is
defined as the relative signal energy present at
nonfundamental frequencies, written as:

THD =



H
V2
h=2 h

V1

(7)

3.2 Gabor Transform
Let a signal s[k ] and an analysis window function

γ [k ] is all periodic with same period L [8]. Then,
L −1

C m,n =

∑ s[k ]γ

*
m,n [k ]

(2)

k =0

γ m,n [k ] = γ [k − m∆M ]e

j

2πn∆Nk
L

(3)

Where ∆M and ∆N are the time and the frequency
sampling interval lengths while M and N are the
numbers of sampling points in the time and frequency
domains,
respectively,
M ⋅ ∆M = N ⋅ ∆N = L,
MN ≥ L (or ∆M∆N ≤ L) . The coefficients C m,n are
called the discrete Gabor transform (DGT) of the
signal s[k ] .

4.5 Total Waveform Distortion (TWD)
Waveform distortion includes all deviations of the
voltage waveform from the ideal sine wave. The
distortion consists of harmonic and interharmonic
distortion. The TWD is calculated as:
TWD =

2
Vrms
− V12

V1

(8)

4.6 Total nonharmonic Distortion (TnHD)
TnHD is also referred to as total interharmonic
distortion due to difficulty in distinguishing between
interharmonic and noise. Interharmonics are signal
components frequencies that are not integer multiples
of the power system frequency. The TnHD can be
defined as:
2
Vrms
− ∑h=0 Vh2
H

TnHD =

V1

(10)

Time Marginal

5. Results

1.5
1.4
1.3
Power

Analysis results were obtained from the timefrequency distributions of power quality signals using
both spectrogram and Gabor transform algorithms.
Time marginal and frequency marginal are extracted
from the time-frequency distributions. The parameters
that are analyzed are RMS, THD, TWD and TnHD
values.

1.2
1.1
1
0.9

0

0.02

0.04

0.06

0.12

0.14

0.16

0.18

Figure 1c: Time Marginal from Spectrogram.

5.1 Spectrogram Results

Frequency Marginal
900
800
700

Pow
er

600
500
400
300
200
100
0

0

50

100

150

200
250
300
Frequency (Hz)

350

400

450

500

Figure 1d: Frequency Marginal from Spectrogram.
Voltage
1.25
1.2
Voltage (Vrms pu)

Figure 1a-d illustrates the results for voltage swell
using spectrogram technique. Voltage swell can be
characterized by the increase of amplitude level in
voltage per unit (Vpu). Figure 1a shows the
momentary increase of magnitude in the voltage
signal. The spectrogram representation of the voltage
swell is shown in Figure 1b. The highest power is
represented in red colour, while the lowest is
represented by blue colour. The figure shows that the
voltage swell occurs in the time-frequency distribution
during 40 to 120 milliseconds.
Figure 1c shows the time marginal of voltage
swell, extracted from the spectrogram. It shows that
the voltage magnitude increases up to 1.45 Vpu from
0.01 to 0.15 milliseconds. Figure 1d observes that the
frequency marginal of the voltage swell lies at 50 Hz,
while Figure 1e detects that the RMS magnitude from
the spectrogram increases up to 1.2 Vrmspu compared
to unit value .

1.15
1.1
1.05
1
0.95

0

0.02

0.04

0.06

0.08
0.1
Time (ms)

0.12

0.14

0.16

0.18

Figure 1e: Voltage (Vrms pu) from Spectrogram.

Power Quality Signal
1

5.2 Gabor Transform Results

0.5
Amplitude

0.08
0.1
Time (msec)

0
-0.5
-1
0.05

0.1

0.15
Time (msec)

0.2

Figure 1a: Voltage swell.

Figure 1b: Time-frequency representation using
Spectrogram.

0.25

The power quality disturbances were also tested
using Gabor transform. The example of harmonic
event and its results can be seen in Figure 2a-d.
Harmonic signal is defined by sinusoidal voltages or
currents having frequencies that are multiples of its
fundamental frequency.
Figure 2a shows that the voltage signal is having
some waveform distortions. Figure 2b detects a
nonfundamental frequency at 300 Hz in the timefrequency axis by using Gabor transform.
Figure 2c shows the time marginal, which points
out that the magnitude of powers per unit signal is
higher than unit value. The frequency marginal in
Figure 2d points out the sixth harmonic event occurred
at 300 Hz. Figure 2e shows that the magnitude of
Vrmspu is higher than unit value on the time observed.

Power Quality Signal

5.3 Comparison between Spectrogram and
Gabor transform analysis

1

Comparison between spectrogram and Gabor
transform analysis has been made to measure their
correctness. Each technique was compared with an
actual or theoretical value as a guideline to verify their
accuracy.
Figure 3-5 demonstrate the correctness of duration
measurements between spectrogram, Gabor and the
actual values for voltage swell, voltage sag and
interruption. The results clearly show that Gabor
transform provides more accurate measurement
compared to the spectrogram.

Amplitude

0.5
0
-0.5
-1
0.05

0.1

0.15
Time (msec)

0.2

0.25

Figure 2a: Harmonic signal.

250
Actual Value
Using Spectrogram
Using Gabor

Time (ms)

200

Actual value
Gabor

150

100

Spectrogram
50

Figure 2b: Time-frequency representation using Gabor.

0

Time Marginal

0

20

40

60

80

100
120
Time (ms)

1.2

140

160

180

200

Figure 3: Duration measurements of voltage swell.

1

Power

0.8
200

0.6

Actual Value
Using Spectrogram
Using Gabor

180

0.4
0.2

0.02

0.04

0.06

0.08

0.1
0.12
Time (msec)

0.14

0.16

0.18

Time (ms)

140

0

0.2

Figure 2c: Time Marginal from Gabor.

Gabor

120
100
80

Spectrogram

60
40

Frequency Marginal
8

20

7

0

0

20

40

60

80

6

100
120
Time (ms)

140

160

180

200

Figure 4: Duration measurements of voltage sag.

5
P
ow
er

Actual value

160

4
3

200

2
1

180

0

160
0

50

100

150

200
250
300
Frequency (Hz)

350

400

450

500

140
Time (ms)

Figure 2d: Frequency Marginal from Gabor.
Voltage

Gabor

120
100
80

Spectrogram

60

1
Voltage (Vrms pu)

Actual value

Actual Value
Using Spectrogram
Using Gabor

40

0.8

20
0

0.6

0

20

40

60

80

100
120
Time (ms)

140

160

180

200

Figure 5: Duration measurements of interruption.

0.4
0.2
0

0

0.02

0.04

0.06

0.08

0.1
0.12
Time (ms)

0.14

0.16

0.18

Figure 2e: Voltage (Vrms pu) from Gabor.

0.2

Comparison of total THD, TWD and TnHD were
also performed to measure the accuracy of both
techniques. Figure 6-8 concludes that both techniques
can achieve almost accurate measurements to their
actual values for all measurements.

20

16

frequency resolution. Spectrogram needs bigger bigger
memory size compared to Gabor transform. All in all,
it can be considered that Gabor transform provides the
best technique to perform the power quality
classifications.

Actual value

Actual Value
Using Spectrogram
Using Gabor

18

Gabor

Percentage (%)

14
12

Spectrogram

10
8

6. Conclusion

6
4
2

2

4

6

8

10
12
Percentage (%)

14

16

18

20

Figure 6: Total harmonic distortion (THD)
measurements.
25
Actual Value
Using Spectrogram
Using Gabor

20

Actual value

Percentage (%)

Gabor
15

Spectrogram
10

5

0

2

4

6

8

10
12
Percentage (%)

14

16

18

20

Figure 6: Total waveform distortion (TWD)
measurements.

The analysis of power quality disturbances have
been performed using both spectrogram and Gabor
transformation time-frequency analysis techniques.
The signal parameters are extracted from timefrequency distribution in terms of the root mean square
(RMS), total harmonic distortion (THD),total
waveform distortion (TWD) and total nonharmonic
distortion (TnHD). The correctness of signal
parameters measurements for both techniques are
demonstrated and compared. The results show that
Gabor transform is the best technique in terms of
correctness of parameters measurements, window
length, frequency resolution and memory size for
power quality analysis and classification. The analysis
provides a powerful means of studying power quality
disturbances especially to construct an automated
expert system that can overcome the power quality
problems.

25
Actual Value
Using Spectrogram
Using Gabor

20

Actual value

References

Percentage (%)

Gabor
15

[1]

Spectrogram

10

5

0

2

4

6

8

10
12
Percentage (%)

14

16

18

20

Figure 6: Total nonharmonic distortion (TnHD)
measurements.
Table 2: Parameters of Spectrogram and Gabor.

Time-frequency
technique
Number of samples
(signal)
Window length
Frequency Resolution
(Hz)
Memory Size
(data)

Spectrogram

Gabor

3120

3120

1024

480

11.7188

10

3194880

39000

Table 2 presents evaluation of parameter values
between spectrogram and Gabor transform used to
perform this research. For equal number of sample
sizes, spectrogram uses higher number of window
length compared to Gabor transform to get similar

Sallehhudin Y., Abu H. A., et al., A Guide Book on Power
Quality, Tenaga Nasional Berhad, Malaysia, 1995.
[2] Dugan R.C., McGranaghan M. F., Beaty H. W., Electric
Power Systems Quality, New York: McGraw-Hill, 2002.
[3] Khan, A.K., “Monitoring Power for the Future”, Power
Engineering Journal, Vol 15, Issue 2, April 2001, pp 81-85.
[4] A. Kusko, T. Thompson, Power Quality in Electrical Systems.
McGraw Hill, 2007.
[5] Ribeiro, M.V., Romano, J.M, et al., “An improved method for
signal processing and compression in power quality
evaluation”, IEEE Trans. On Power Delivery, Vol 19, Issue 2,
April 2004, pp 464-471.
[6] Ghafour A.M., Azah M., “Classifying Short Duration Voltage
Disturbances Using Fuzzy Expert System”, IEEE Trans on 4th
Student Conference on Research and Development (SCOReD
2006), 27-28 June 2006, pp 215 – 219.
[7] Hasniaty, Azah M., et al., “Automating Power Quality
Disturbance Analysis Using the IPQDA Software Tool”, IEEE
Trans on 4th Student Conference on Research and
Development (SCOReD 2006), 27-28 June 2006, pp 211– 214.
[8] B. Boashah, Time-Frequency Signal Analysis and ProcessingA Comprehensive Reference, Elsevier, London, 2003.
[9] A.R. Abdullah, A.Z. Sha’ameri, “Real time Power Quality
Monitoring System Based On TMS320CV5416 DSP
Processor,” in Proc. 2005 IEEE Power Electronics and Drives
Systems Conf., pp. 1668-1672.
[10] A.R. Abdullah, N.M. Saad, A.Z. Sha’ameri, “Power Quality
Monitoring System Utilizing Periodogram and Spectrogram
Analysis Techniques,” in Proc. 2007 IEEE International
Conference on Control, Instrumentation and Mechatronics
Engineering., pp. 770-774.
[11] IEEE Recommended Practice for Monitoring Electrical Power
Quality. IEEE Std 1159-1995 Approved Jun. 14, 1995.