You are on page 1of 6

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 54, NO.

3, JUNE 2005 1019

Effective Simulation of Signals for Testing


ECG Analyzer
Adam Jóśko and Remigiusz J. Rak

Abstract—In this paper the solution of the specialized measuring


system for electrocardiography (ECG) signal recording and intro-
ductory recognition is presented. The project aims at designing
the complete PC-based Virtual Instrument as a “testing platform”
for acquisition, processing, presenting, and distributing ECG data.
A new design involving the latest technique in signal simulation
was developed to create a controllable model of the electrocardio-
graphy signal. Then it was implemented for testing of the devel-
oped QRS detection algorithm, based on the time-frequency anal-
ysis method. The processing stage involving discrete wavelet trans-
form was used to detect QRS complexes in the ECG signal. By
using the controlled signal model and the real ones, the algorithm
Fig. 1. Schematic anatomy of the human heart.
was shown to be advantageous in reducing ventilation artifacts and
motion noise, resulting in good accuracy.
tant is a precise detection of the QRS complex, and then the P
Index Terms—Biomedical engineering, data acquisition, discrete
wavelet transform (DWT), electrocardiography (ECG), LabWin- and T waves. It is well known that today, the wavelet transform
dows/CVI, signal simulation, virtual instrument. is a very effective tool for time-frequency analysis. Decompo-
sition of signals into elementary blocks that are well localized
in both time and frequency can be very helpful in determining
I. INTRODUCTION their local regularity. The multiresolution feature of wavelets
also makes them suitable for analysis of distinguishing ECG sig-
E LECTROCARDIOGRAPHY (ECG) is a very popular,
simple, and noninvasive medical examination. Its result,
the electrocardiogram, is a recording (printed on paper or dis-
nals corrupted by noise, artifacts, and baseline drifts. The local
maxima of the wavelet transform modulus at different scales can
played on the monitor screen) illustrating electrical activity of be effectively used to locate some characteristic points of ECG
a patient’s heart. The heart is a pump, periodically self-excited signals. Properly prepared controllable, simulated ECG signals
by tiny pulses of current, generated by specialized cells located can be very helpful to the design of an effective recognition
inside the organ. Periodic current pulses cause the heart muscle algorithm as a “testing sequence.”The authors’ intention was
to contract, but not the whole of it at the same time. Heart exci- not to build the device characterized by the high-level parame-
tation spreads from the top to the bottom, from the right atrium ters comparable to those describing the best currently available
(RA) to the left atrium (LA) and next to the ventricles (left electrocardiographs on the market but to design the high-level
ventricle (LV) and right ventricle (RV)) in standard conditions. PC-based virtual instrument as a “testing platform” enabling:
The basic anatomy of the heart is depicted in Fig. 1. “The flow” 1) recording of real ECG signals;
of a heart excitation and consequent contraction causes a pump 2) introductory identification of ECG (detection of QRS);
effect—the role of a heart. 3) transmission of the recorded and/or preprocessed data to
One can distinguish basic elements named: P Q R S T U a doctor, through a distributed computer network.
waves in the ECG signal (Fig. 3). The P wave reflects sequen- Such a platform will enable making an advanced test in the
tial activation (depolarization) of the right and left atria. It is fol- area of wavelet-based ECG identification algorithms, and at last
lowed by the QRS-complex that is an electrical representation designing a simplified version of the instrument (based on a pop-
of ventricular depolarization. There is a T wave at the end of the ular sound card) available for a common patient.
single-cycle ECG signal, and it represents ventricular repolar-
ization—return to its resting state. One more wave can appear II. ECG SIMULATION PROCESS
in the ECG recording. It is the U wave, but the origin for this
As it has been already mentioned, the very important goal
wave is not clear. It is only mentioned here for the sake of com-
of the described project was to build an artificial, controllable
pleteness of ECG components.
model of ECG signal supporting testing and design of an
The automatic recognition of ECG signals is a very important
effective algorithms enabling introductory identification of
part of the cardiac disease diagnosis process. The most impor-
ECG. Generated, synthetic signals can simulate a correct ECG
signal as well as a wide range of abnormalities. Some examples
Manuscript received September 1, 2003; revised March 3, 2005. are presented in Figs. 4–8. Different phenomena that appear
The authors are with the Warsaw University of Technology, 00-660 Warsaw,
Poland (e-mail: jada@iem.pw.edu.pl; rakrem@iem.pw.edu.pl). occasionally in the real signal can be reproduced repeatedly
Digital Object Identifier 10.1109/TIM.2005.847350 in the artificial one. In addition, signals with different noise
0018-9456/$20.00 © 2005 IEEE
1020 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 54, NO. 3, JUNE 2005

Fig. 2. Block diagram of ECG simulation process.

Fig. 5. Accelerated ECG signal (SIMULINK). Heart rate is above 100 beats
per minute. This illustrates phenomenon named tachycardia.
Fig. 3. Standard ECG signal from HP33120A.

Fig. 6. Moderated ECG signal (SIMULINK). Heart rate is below 60 beats per
Fig. 4. Simulated standard ECG signal (SIMULINK). minute. This illustrates phenomenon named bradycardia.

level and power line interference impacts can be achieved. It is changes. Hence, it is possible to simulate a standard (normal)
desired during noise sensitivity tests. These advantages make ECG signal as well as the abnormal ones. This gives an advan-
artificial signals helpful in a QRS detection algorithm testing tage over an HP33120A standard cardiac signal (Fig. 3) where
phase. On the other hand, they also bring an educational value. changes are limited to common frequency and amplitude values
The block diagram of a proposed simulation system built in the only.
SIMULINK environment is presented in Fig. 2. A proposed, simulated, standard ECG source signal is pre-
It includes multiplicated pairs: parameterized pulse generator sented in Fig. 4. It perfectly reproduces the one presented in [7]
followed by a low-pass filter (each pair for a different ECG and is controllable in a very wide range. It can be both acceler-
wave), a summation block, and a module introducing both low ated (Fig. 5) and moderated (Fig. 6). There is also a possibility
and high frequency interference. Modification of the pulse gen- of introducing into it typical, from the medical point of view,
erator parameters (amplitude, period, phase, duty cycle) enables interference approximating it into the real-world conditions. A
one to perform ECG signal simulation in a very wide range of simulated ECG modulated with a “chirp” signal is presented
JÓŚKO AND RAK: SIMULATION OF SIGNALS FOR TESTING ECG ANALYSER 1021

The proposed virtual instrument front panel is presented in


Fig. 10. The recorded and/or preprocessed ECG signals are
plotted in oscilloscope type subwindows. With build-in controls
the user can set important analysis parameters to get satisfactory
results. The system is user friendly as being programmed in
LabWindows/CVI environment. The measurement system can
also operate on a laptop PC equipped with PCMCIA DAQ Card
AI-16E-4. This makes the system reliable, small, and portable,
with no hardware limitations.
ECG signals acquired from the human body (skin surface)
are initially conditioned by isolation amplifier and antialiasing
filter. One of the most common causes of measurement prob-
lems and damaged DAQ boards is improper grounding of the
system. Signal conditioners with isolation and no galvanic con-
nection save both DAQ board and the patient body in our case
Fig. 7. “Chirp” modulated ECG signal (SIMULINK). This illustrates patient’s (by reducing shock hazard danger). Besides breaking ground
breathing or moving.
loops, they reject high common-mode voltage typically caused
by differences in ground potentials.
The acquired signals after conditioning are processed by
using simple mathematical operations (addition, subtraction,
and multiplication) in order to get inputs typical for electrocar-
diography: I, II, III, aVR, aVL, aVF, V1, , V6). Location of
this activity in the software block reduces the complexity of
input circuits (and lowers the building costs). The disadvantage
of such a solution is the potential error introduced by the
time shifting between the signal samples taken successively
from different input channels. A proper choice of sampling
parameters enables one to minimize an error value. It can be
rejected completely by the implementation of simultaneous
signal sampling for all channels. The digital bandpass filter
is used next. It rejects signal low frequency components that
are responsible for ECG baseline wandering. It also reduces
50 Hz interference (European power system frequency) and
Fig. 8. “R-negative” ECG signal (SIMULINK).
high frequency unwanted noise.
Designed measurement circuits do not include advanced con-
in Fig. 7. Fig. 8 shows a simulated ECG with a “negative R” nections realizing negative feedback, called “driven leg virtual
wave. There are 50 Hz interference and high frequency noise ground” [6], which establishes another reason for the system im-
present in the simulated signals. These components are present perfection. However, properly solved grounding, guarding, and
in real-life measurements so they must be taken into account in shielding circuits meaningfully decrease interference level. A
the simulations. simplification of the system has been caused by the compromise
The main role of performed simulations was to obtain dif- between the building costs and processing quality.
ferent, both normal and abnormal, ECG signals, which are used At the end of the procedure described above, selected ECG
together with real signals in testing phase. Controllable changes signals can be presented on a monitor screen, written into a disk
introduced into the source (standard) signal are extremely file, and/or transmitted to a doctor in the on-line or off-line mode
helpful in developing reliable QRS detection algorithms of a depending on the available throughput rate of a computer net-
minimum error rate achieved for the acquired real signals. work.

III. RECORDER OF REAL ECG SIGNALS


IV. QRS DETECTION PROCESS
The designed instrument destined to recording of real ECG
signals includes regular high-level measurement modules like The schematic block diagram of the QRS detection algorithm
a data acquisition (DAQ) board (PCI-MIO-16E-4, National In- is presented in Fig.11.
struments) and signal conditioning blocks (SCXI-1120 isolation The wavelet analysis, based on a quadratic spline wavelet
amplifier and SCXI-1141 elliptic filter, both from National In- [5], is applied for extracting a complete QRS complex. The al-
struments). The application computer program has been pre- gorithm itself is based on solutions presented in [3] and [4].
pared under the integrated National Instruments tool software Input data are partitioned into blocks (about 3 s long). Discrete
LabWindows/CVI. The functional block diagram of the system wavelet transform is calculated at four scales. They were se-
is shown in Fig.9. lected for the highest QRS wave energy concentrated at these
1022 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 54, NO. 3, JUNE 2005

Fig. 9. Measurement circuit and block diagram of the ECG recorder.

Fig. 10. ECG recorder front panel.

Fig. 11. Schematic block diagram of the entire QRS detection process.

scales. The frequency response of these characteristic scales


covers standard QRS complex frequency spectrum.
The DWT coefficients produce localized extrema at consec-
utive scales. They are associated with each transient present in
the input signal. This property is used in detection process. As
characteristic scales are analyzed, the QRS waves can be found.
Aligned positions of local extrema (pairs of a maximum and a
minimum) at characteristic scales determine the instant of QRS Fig. 12. Artificial ECG signal (HP33120A).
complex in the input signal. Misaligned peaks are rejected, as
well as those placed in refractory period following previous suc-
V. SIMULATION RESULTS
cessful QRS detection. Output of this stage includes final results
and can be visualized along with original ECG signal. Many ECG signal examples were performed, and three of
The algorithm for detecting characteristic ECG points based them together with QRS complex detection results are pre-
on DWT shows clearly the potential of the wavelet transform, sented in Figs. 12–14 (time axis in figures was truncated to
especially for processing time-varying biomedical signals. The make the ECG signal visible). Stars indicate the results of R
power of wavelet transform lies in its multiscale analysis, which wave detection.
implies a very precise description of a time-varying signal. Of An artificial ECG signal obtained from the HP33120A ar-
course, it is possible to investigate artificial, simulated signals bitrary function generator is presented in Fig. 12. A simulated
as well as standard ones taken from public databases and other ECG signal performed in the Matlab/Simulink environment is
real signals. presented in Fig. 13. It is noised by both low frequency noise
JÓŚKO AND RAK: SIMULATION OF SIGNALS FOR TESTING ECG ANALYSER 1023

TABLE I
QRS DETECTION RESULTS

QRS detection of the signals presented in Figs. 12 and 13 re-


sults in FP and FN both equal to zero. It means that all QRS
waves were detected correctly. QRS detection of a real signal
from Fig. 14 gives an error of 1.4%. Its FP and FN . Be-
sides the signals coming from the authors’ investigations, there
were recordings from a standard MIT-BIH arrhythmia database
[10], used in the QRS detection algorithm evaluation process.
Those illustrating the highest detection error level are shown in
Table I.
Results of 2.45% maximum error rate (real ECG) are very
promising. On the other hand, artificial signals presented in the
paper are easy to analyze. Therefore, many investigations based
on deeply modified simulated signals and the real ECG are cur-
rently being carried out. All of them are to develop reliable al-
gorithms detecting all waves of the ECG signal with the best
Fig. 13. Simulated ECG signal (SIMULINK). possible accuracy.

VI. CONCLUSION
A new ECG signal simulation technique has been developed
for the enhancement of the ECG identification algorithm design
and testing. The preprocessing algorithm and time-frequency
distribution, based on the wavelet transform, were used to detect
the QRS segment in the tests carried out. The results reported
have shown the capability of the algorithm to identify real ECG
data. It is clear that the wavelet transform analysis method will
lead to a new way of biomedical signal processing.

REFERENCES
[1] A. Jóśko and R. J. Rak, “Virtual instrument for recording and wavelet
based analysis of ECG signals,” in Proc. IEEE Instrumentation Mea-
surement Technology Conf., Anchorage, AK, May 21–23, 2002.
[2] , “Simulation and wavelet based analysis of ECG signals,” in Proc.
2nd Eur. Medical Biological Engineering Conf. (EMBEC’02), Vienna,
Austria, Dec. 4–8, 2002.
Fig. 14. An example of a real ECG signal recorded by authors. [3] C. Li, C. Zheng, and C. Tai, “Detection of ECG characteristic points
using wavelet transforms,” IEEE Trans. Biomed. Eng., vol. 42, Jan. 1995.
[4] S. Kadambe, R. Murray, and G. F. Boudreaux-Bartels, “Wavelet trans-
(chirp signal was used to simulate baseline drift, i.e., patient’s form-based QRS complex detector,” IEEE Trans. Biomed. Eng., vol. 46,
breathing or moving) and high frequency noise (representing no. 7, Jul. 1999.
[5] S. Mallat and S. Zhong, “Characterizations of signals from multiscale
any of the acquisition noise interference). Real ECG recording edges,” IEEE Trans. Pattern Anal. Machine Intell., vol. 14, no. 7, pp.
is presented in Fig. 14. 710–732, Jul. 1992.
For all QRS detection examples there were correctly counted [6] D. Buchla and W. McLachlan, Applied Electronic Instrumentation and
Measurement. New York: Macmillan, 1992.
false positive (FP) and false negative (FN) numbers. (The total [7] J. Enderle, S. Blanchard, and J. Bronzino, Introduction to Biomedical
number of FPs represents a detector error of QRS complex de- Engineering. New York: Academic, 2000.
tection that does not exist in the analyzed signal, while the total [8] Matlab User Manual, Mathworks Inc., 1999.
[9] LabWindows/CVI User Manual, National Instruments Corp., Austin,
number of FNs represents a detector error of missed QRS com- 1994.
plex detection that does exist in the analyzed signal.) [10] MIT-BIH Arrhythmia Database Third Edition, May 1997.
1024 IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 54, NO. 3, JUNE 2005

Adam Jóśko received the M.Sc. degree in automatics Remigiusz J. Rak received the M.Sc., Ph.D., and
and computer engineering from Warsaw University D.Sc. degrees from Warsaw University of Tech-
of Technology, Warsaw, Poland, in 1999, where he is nology, Warsaw, Poland, in 1974, 1982, and 1998,
currently pursuing the Ph.D. degree. respectively.
Since 2000 he has been an Assistant with the He is a Professor of electrical engineering,
Division of Measurement and Information Systems, Warsaw University of Technology. His current
Warsaw University of Technology. His dissertation research interests include time-frequency analysis,
concerns algorithms based on QRS detection wavelet signal compression, networked distributed measure-
transform. ment systems (virtual instruments and Internet-based
Virtual Laboratories), and distance learning models.
He is a Dean’s Delegate to the Center of Open and
Distance Education, Warsaw University of Technology.

You might also like