BACKGROUND - Penn Engineering



EKG Simulator

Group T2: Final Project

Friday, December 12, 1997

Nick Rose

Rupesh Patel

Vesal Dini

Armaghan Farooq

ABSTRACT

Our specific aims for this project were to (1) simulate a normal EKG quantitatively, (2) manipulate the normal EKG data to simulate abnormal EKG signals, and (3) create a LabView interface to view the signals and use signal processing functions. We were able to quantitatively simulate a normal EKG. This quantitative data was transferred into Excel, where it was manipulated to resemble an abnormal EKG. Then we created a LabView circuit that would read the data from the Excel file. Once in the LabView circuitry, the data was graphed and analyzed according to the features of the interface. The LabView interface allows the user to not only view the various signals but also to add and filter out noise. We were successful in creating simulated EKG’s that differed from real EKG’s by only 4% using the standard method of quantitative analysis. We were also able design a user-friendly interface, which is versatile enough to allow future upgrades to the circuitry.

BACKGROUND

Heart Physiology

Overview

In order to fully appreciate the significance and meaning of the diagnoses of heart ailments via the EKG, it is important to understand the manner in which the heart functions. The electrical activity of the heart causes a systematic beating and so propels proper blood circulation in the lungs and the rest of the body, which is essential to life. A brief description of these aspects of the cardiovascular cycle follows.

The Heart and Blood Circulation

The heart is composed of four chambers: two atria that receive venous blood and two ventricles that pump arterial blood. The pulmonary circulation cycle can be described as follows. Oxygen-depleted blood (as a result of tissue respiration) enters the right atrium via the superior and inferior vena cava. This blood enters the right ventricle and then is pumped into the pulmonary arteries, which lead to the lungs where the blood is oxygenated. This oxygen-rich blood then travels through the pulmonary veins into the left atrium. Subsequently, this blood enters the left ventricle and is pumped into the aorta, a very large and elastic artery. Many arterial branches from the aorta carry the oxygenated blood to all the organ systems.

Electrical Activity of the Heart and The Normal Electrocardiogram

There is one area in the heart that demonstrates spontaneous electrical activity. This pacemaker region is termed the sinoatrial node. Once the sinoatrial node fires, action potentials are propagated throughout the heart in a systematic manner, which can be described as follows (see Figure B1). Located at top of the right atrium, the sinoatrial node initiates an impulse (60-100 times per second) that begins the depolarization of the atria. Once depolarization is complete and the atria have completely contracted, the atrioventricular node at the base of the right atrium propagates the impulse to the bundle of His located at the top of the inter-ventricular septum. The bundle of His branches into the right and left bundle branches, which completely surround the ventricles. Purkinje fibers branch out of the right and left bundle branches allowing the impulse to be propagated simultaneously throughout both ventricles.

Figure B1.

Since the body is a good conductor of electricity (owing to the high concentration of salt ions), surface electrodes placed on the surface of the body detect these action potentials that cause the heart to beat. The recording that is obtained is called the electrocardiogram (EKG or ECG).

There are two types of EKG recording electrodes, unipolar and bipolar. Bipolar leads are used on the limbs and measure the potential relative to each other, while unipolar leads measure against zero potential (built into the EKG). There are nine unipolar leads that are placed on the body, six on the chest and three on the limbs. When evaluating patient health, cardiologists use twelve leads to evaluate the condition of the heart. This is done in order to view the electrical activity from different perspectives. This is important because certain abnormalities can be detected when viewed from only certain perspectives (see Figure B2).

Figure B2.

The standard EKG (the one commonly observed in textbooks) is representative of three distinct waves (see Figure B3). These are not action potentials, rather they represent relative potentials in regions of the heart that are depolarizing. For example, the P wave in the EKG is a maximum when half the atria are depolarized because it is at this point when the potential difference between the depolarized and unstimulated portions of the atria is highest. Similarly, the depolarization wave conducted through the ventricles corresponds to the QRS complex. Although the atria are re-polarizing at this time, the event is hidden by the greater magnitude of depolarization of the ventricles. Finally, re-polarization of the ventricles is represented in the EKG by the T wave.

Figure B3.

Abnormalities

Overview

The following section gives some relevant background on the four heart abnormalities whose EKG’s we simulated. Only the physiology of each abnormality is presented here, and the Results section will describe how these physiological changes are seen in an EKG. The four abnormalities are: first degree A-V block, right bundle branch block, myocardial infarction, and Wolfe-Parkinson-White syndrome.

First Degree AV Block

First degree A-V block, or first degree heart block, is a term used to describe an event on the EKG. It is not an indication of an illness, but it can be seen as a condition for many heart-related illnesses. First degree A-V block occurs when the impulses travelling from the sinoatrial node are not able to traverse to the atrioventricular node due to a block in the passage. The delay in the transfer of this signal is the condition referred to as first degree A-V block.

This does not necessarily mean that anything is wrong with the heart, and it does not mean that blood vessels are blocked. Also, certain heart medicines such as digitalis can slow conduction of the impulse from the atria to the ventricles and cause first degree A-V block.

Right bundle branch block

Usually, bundle branch block shows up as an abnormality on an EKG taken on a person without symptoms. It is due to a slowing or complete blockage of the electrical signal associated with each heartbeat at some point along the pathways in the heart called the conduction system. If the signal is completely blocked, it must take a detour to reach its destination. When that happens, the rate and rhythm of the heartbeat are not affected, but the abnormal pathway that the electrical impulse takes results in characteristic changes in the EKG pattern.

The underlying cause of a bundle branch block is usually hard to determine unless it appears in the course of a heart attack, in which case it can be reasonably ascribed to damage as a result of the attack. Bundle branch block rarely warrants or is responsive to treatment. It does not require a pacemaker, which is used to treat other forms of heart block.

Myocardial Infarction

Although the heart’s main function is to pump blood to and from the tissues of the body, the heart itself is a muscle and must be vascularized also. The coronary arteries carry oxygenated blood to the heart. When a plaque obstructs the flow of blood through the coronary arteries, then atherosclerosis results. When this occurs and the blood flow to the heart muscle drops below the point where it does not get an adequate supply of oxygen, then the heart tissue is said to be ischemic. In general, a tissue is ischemic when it does not receive enough oxygen to maintain aerobic respiration. If this anaerobic respiration continues for more than a few minutes, then cell death occurs in the tissue. Such an injury is irreversible and is termed infarction. Specific to the heart, when the coronary arteries do not provide enough oxygen to the heart muscle tissue, the injury is called myocardial infarction (MI). This event is more popularly known as a “heart attack.”

Wolfe-Parkinson-White Syndrome

The bundle of Kent is an anomalous, electrically conductive tissue bridging the atrium and ventricle (see Figure B4). It runs parallel to the bundle of His and the bundle branches. The bundle of Kent bypasses the atrioventricular node, and thus allows the impulse to avoid the normal time-delay between complete atrial depolarization and ventricular depolarization. This condition is commonly known as Wolfe-Parkinson-White syndrome (also called pre-excitation syndrome). Individuals who have WPW syndrome are very susceptible to supraventricular tachycardia, a condition where an impulse is conducted through the bundle of Kent back to the atria. Also, atrial tachycardias that are blocked in the slowly conducting atrioventricular node may be transmitted to the ventricle through the bundle of Kent. Rapid stimulation of the ventricles may develop into life-threatening ventricular fibrillation. Because of the anomalous pathway, the EKG of someone who has WPW syndrome may be suggestive of other abnormalities such as right or left bundle branch block, right or left ventricular hypertrophy, or inferior or anterior myocardial infarction (Johnson and Swartz 80).

Figure B4.

The EKG Simulator

Overview: What is the simulator?

The EKG simulator is a training tool for medical students as well as upcoming Bioengineering students who are interested in the operations of the heart and waveforms defining the EKG signal. This simulator is particularly useful as it provides the user with an easy to use interface in LabView. The specific features of the interface and the properties of the simulator will be discussed later as part of the Results section.

The EKG simulator is a tool that allows the user to input any useful EKG signal for analysis. Importing a file from Excel containing the particular EKG was the method employed. Once the EKG is in LabView, the user can begin breaking the signal down or manipulating it in various ways with the aid of the interface. For instance, most EKG signals tend to contain a great deal of noise that is intrinsic to the process of obtaining the signal. This noise needs to be removed from the signal in order to analyze the signal better. This is usually done in real life with the aid of filters attached to the data collection device. With the use of this Labview interface, however, the data can be passed through a host of virtual filters that the user can choose. Moreover, the user can set the parameters of the filter, such as the order (dictated by the task the user may need to perform). Hence, the user is able to filter out the noise from the signal in LabView and work with the pure signal.

The simulator is also helpful if the user needs to carry out a detailed quantitative analysis of the signal. The user can carry out Fourier transforms and power spectra analyses of the data. Therefore, by utilizing the simulator’s features, the user is able to study the EKG signal in great detail.

METHODS AND MATERIALS

Materials

1. Digital Human EKG Simulator

2. LabView: Student Edition 3.1

3. Microsoft Excel 97

4. clinical EKG texts (as cited in References)

Methods

EKG Simulator

The EKG simulator was constructed in five major steps: signal acquisition, signal manipulation, LabView circuitry development, user interface development, and simulator testing. Initially, a clean EKG signal was obtained in LabView using the digital Human EKG simulator. Then a data file from this pure signal was transported to Excel so that it could be numerically manipulated (procedures for this process is outlined in the BE309 Lab Manual, Experiment 1).

Common heart abnormalities were then researched and their respective EKG’s analyzed to figure out the specifics in the EKG’s that were indicative of the particular disorder. Once this had been done, the pure EKG signal in Excel was manipulated so as to match the EKG’s pertaining to the specific abnormalities. This was done repeatedly for the four different abnormalities.

These data files containing the abnormal EKG’s were then transported back into LabView for further work. This was accomplished by first converting the Excel files into text files. These files were than read by a virtual instrument in the LabView program. In LabView a circuit was designed to display the EKG signal. Furthermore, this circuit was equipped with a virtual instrument to allow noise to be added to the signals so that the virtual signal could be used for teaching signal processing techniques. Once the virtual noise was added, the EKG’s were ready to be processed further. Then the signal was passed through a filter to remove the noise. The circuit was designed such that the user has the option of using any of the four availble filters as well as adjust other variables (outlined in the results section). The filtered data was then graphed to observe how much of the noise had been removed. These signals were tested to ensure that the noise was indeed filtered out by comparing the filtered EKG’s with the original clean EKG’s .

Next an interface was designed that would enable the user to quickly and easily interchange the filters and their orders from the desktop console. Once this had been done, features such as the FFT were added to the interface. All the graphs that are relevant to the user’s particular analysis (such as the original signal, the signal with noise, the filtered signal, and FFT) are conveniently displayed in LabView.

Once all the features had been added and tested, it was ensured that the simulator was in working order by importing other data files and carrying out similar processes on them. This ended in the creation of a workable EKG simulator for the purposes of training and analysis.

RESULTS

First Degree AV Block

The P wave represents the passage of the impulse through the heart’s upper chambers, the atria. The QRS wave is the passage of the impulse through the lower chambers, the ventricles. The time it takes for the impulse to get from the atria to the ventricles (the P-R interval) should be less than about 0.2 seconds. If it takes longer than this, it is called first degree A-V block. Also as can be seen above the inverted R wave is also characteristic of First Degree A-V Block (see Figure R1).

Figure R1.

Right Bundle Branch Block

A delay in the activation of the right Bundle Branch results in the characteristic EKG illustrated in Figure R2. The delay usually results in a completed activation of the left ventricle before the right one is activated.

Initially, the left bundle branch activates the septum. This proceeds to a normal left septal depolarization since the left bundle is unaffected by the right. However since the two ventricles do not depolarize simultaneously because of the block in the right bundle, an initial R wave is observed corresponding to the left ventricle depolarization. After this has been completed. The waves move through the muscle in the left ventricle to the right ventricle bypassing the bundle branch. This causes a delay resulting in the right bundle depolarizing after the left. This RSR complex produces the characteristic M pattern of the Right Bundle branch block.

Another important feature of right bundle block is the inverted T wave as can be seen above. This is caused by the abnormal depolarization and activation of the right ventricle. This feature on its own is not a cause for alarm, but can be vital in diagnosing other heart disorders if considered in conjunction with other features in the EKG.

Figure R2.

Myocardial Infarction

There are three key changes that occur in an EKG as a result of myocardial infarction. First, the myocardium is completely depolarized. This is seen in an EKG as an elevation of the ST segment. Second, it causes the Q wave to be large. The Q wave is normally very small since it normally reflects the depolarization of the unopposed healthy tissue. But if myocardial infarction occurs, then the dead muscle tissue causes a loss of electrical activity since it doesn’t conduct electricity, and the tissue cannot be adequately depolarized. Finally, myocardial infarction also causes the T wave to be inverted since it is repolarized in the opposite electrical direction (see Figure R3).

Wolfe-Parkinson-White Syndrome

The effects of this syndrome as seen in the EKG are clear in that the P-R interval is shortened and a deflection of the QRS interval, called the delta wave, is produced (see Figure R4). This deflection is a slowing down of the depolarization wave through the ventricles caused by the bundle of Kent bypassing the myocardium, which is a more effective medium for the propagation of the impulse. A wider QRS interval will also result from the slowing down of the impulse.

Figure R4.

LabView Interface

Once we had created the Excel files with the graphs of the abnormalities (shown above), we created a LabView interface using LabView’s virtual circuitry board. The interface allows us to (1) view the graphs, as well as (2) use the signal processing functions available in the LabView program (see figure R5 on the next page). We accomplished the first task by using a virtual instrument in LabView, which read text files of each of the abnormalities and passed the data to another virtual instrument, which displays a graph of the signal. This signal is shown on the second graph of the interface. We also created a graph that simultaneously showed a graph of a normal EKG. The user is able to alter the heart beat rate on the graph of the normal EKG by simply clicking on the desired rate. These features were developed mainly for the clinician-in-training who could compare the abnormal EKG with a normal EKG.

Figure R5: The above figure shows the menus and resultant graphs from the LabView 3.1 interface. The first graph is a normal EKG signal, the second graph is the clean abnormal EKG signal (Right Bundle Branch Block), the third graph is the abnormal signal with the added noise, and the last graph is the filtered abnormal signal. Each of the graphs also has the corresponding FFT results graphed.

An engineering student is able to utilize the signal processing analysis tools in the program. In our LabView interface we developed virtual instruments that run Fast Fourier Transforms (FFT) and display the graphs of each of the signals. The FFT takes data in the time domain and transfers it to the frequency domain. This allows the engineering student to use the frequency domain data in signal processing calculations. Furthermore, a virtual instrument was developed to add noise to the pure abnormal signal, again at the user’s command. Once the noise is added, the resulting signal is displayed on a graph. A virtual filter was also developed to take the signal with the noise and the pure signal and filter out the noise. The results of this filtering process are displayed on the last graph with its corresponding FFT results. The virtual filter was developed so that the user has total control of the variables involved in filtering signals. The user is given the choice of four different filters that can be used (Butterworth, Chebychev, Inverse Chebychev, and Bessel). The user may also use either a low-pass, high-pass, band-pass, or band-stop filter. The user also determines the filter order. Furthermore, the user also sets the optimal low-pass and high-pass frequencies (see figure R5 on previous page). Since all the variables for running a filter are controlled by the user, this program can be used as a teaching tool for an engineering student who is studying signal processing.

Error Analysis

Overview

Once we created EKG files, our first question was, “How good are they?” To accomplish this, we analyzed our simulated EKG’s in two ways: quantitatively by measuring PR intervals and qualitatively by having cardiologists diagnose them. Since we had little background in cardiology and more specifically in EKG signal comparison, we consulted two local practicing cardiologists who were kind enough to offer their time and expertise.

Quantitative Error Analysis

In order to devise a way to quantitatively compare our EKG’s with real human EKG’s, we met with Dr. Eric Grubman, a cardiologist at HUP’s Cardiology Cath Lab, to discuss this issue. He provided us with a LabView interface that measures different time intervals along an EKG signal. It allows the user to measure the time lapse between any two points (as set by the user) on an EKG, and the computer measures this specific interval over as many different heart beats as the user wishes. So, because an EKG signal is periodic, the output is a list of many interval measurements—one for each heartbeat.

In our particular case, Dr. Grubman informed us that the standard criterion for comparing any two EKG’s is the PR interval. So, we used his LabView interface to measure the PR interval of both a real human EKG (that Dr. Grubman provided) and our simulated EKG. We took the average PR interval over 30 hearbeats and found the human EKG’s PR interval to be 0.0938 seconds. We then similarly measured our simulated EKG and found it’s PR interval to be 0.09 seconds. So, using the standard criterion of the PR interval, our simulated EKG varies from a real EKG by 4%.

Qualitative Clinical Analysis

Then for the true test of whether or not our EKG’s could be used for teaching clinicians, we asked Dr. Grubman and Dr. Dusan Kocovic (also of the Cath Lab) to diagnose the EKG’s of our four heart abnormalities. The result was that our EKG’s fooled both doctors, and they both independently confirmed that our EKG’s did, in fact, represent the abnormalities that we set out to simulate. Their only criticism was that the P interval of the Wolfe-Parkinson-White EKG was, to use Dr. Grubman’s words, “a bit long.”

DISCUSSION

EKG Simulator: Interface and Circuitry

We were able to develop an EKG signal simulator using the Student Version of the LabView program. The interface of the signal was designed so that it would allow the user to operate the simulator without having to make alterations in the circuitry. We were able to do this by allowing the user to make all the necessary variable changes in the interface itself. At the same time, the circuitry has been ordered and labeled so that future upgrades can be made to the circuitry to add more analysis tools. One of the possible future upgrades is the addition of more abnormal signals. The circuitry is set up such that someone with minimal LabView programming experience can easily add more abnormal EKG signals or any other types of signal. This leaves the door open to upgrade the simulator, so that it can have a database of signals available to the clinician or student.

The option is also available to easily upgrade the program so that a continuous EKG signal can be observed on the graph. This would simulate a real time EKG signal that a doctor would observe in an emergency room, an operating room, or an ICU. This upgrade would also become useful for the engineering student, who would be able to observe any phase shifts in the signals.

One of the difficulties faced in developing the interface in the Student Version of LabView was the efficiency of the virtual filter. Ideally, the filter should remove enough of the noise so that the filtered signal bears resemblance to the original signal. In all our attempts to filter the abnormal signal after the noise was added, we were not able to successfully filter out enough noise for the filtered signal to have a significant resemblance to the original abnormal signal. Even after repeated alterations of the filter variables, we were only able to obtain filtered signals, which had significant amount of the noise still present in the signal. We experimented with the virtual filters in the upgraded version of the program (LabView 4.1), and found that they were significantly more efficient than the virtual filters in the Student Version of the LabView. Since we want to design an interface to be used by clinicians and engineering students, we used the Student Version of LabView, which is more readily available for use. If in the future LabView 4.1 becomes available for use at more computer terminals, the simulator program could be transferred to LabView 4.1. In the meanwhile, we left the option available for use of an external filter. Quality filters can be purchased or built in the laboratory. Simulator program has been made versatile enough to install an external filter with just a few connections. If such a filter is used, the student will still have the option of using either the virtual filter or the real filter.

The simulator interface at this point can be used as a teaching tool for both clinicians and engineering students. In order for it to be used to its maximum capacity for the clinician, the addition of more abnormal signals would increase its utilization. It’s greatest potential, however, is in the engineering classroom. The program already has enough features to allow it to be used in a signal processing classroom/laboratory. Furthermore, the program has been designed to be versatile enough to allow the upgrades described above, as well as any others that may be needed in the future. One of the advantages of using this program in the classroom is the possibility of its ubiquitous utilization. The LabView program has a feature which allows a LabView program to be run as a standalone program. This means that a student can download the program on a disk and run it any computer terminal. This feature has a few bugs in the student version of the program, but the standalone feature runs much more successfully in the LabView4.1 version. Thus, a student is able to run experiments outside of the classroom or laboratory.

Accuracy of Simulated EKG’s

By measuring the PR intervals, it was found that our EKG’s differ from a real EKG by 4%. This means that our EKG’s are useful for any quantitative analyses that might be desired, including the analysis tools that were implemented into our LabView interface. Furthermore, when our EKG files were created, we took the simulated EKG of one heartbeat and copied/pasted this one right after another in order to make the EKG periodic. This best simulated a real human heartbeat since a human heart beats at an almost constant frequency during the time under which an EKG is taken.

Also, two board-certified cardiologists at HUP independently diagnosed our EKG’s to be the four abnormalities that we wished to simulate. Their evaluations show that our EKG’s are useful for teaching clinicians since two professionals who finished their clinical education have validated our EKG’s.

Towards the Development of Diagnostic Expert System

In addition to being used as an educational tool for clinicians, this EKG simulator and interface is the first step towards making an expert system that allows a computer to read an EKG. The ultimate goal is to have a computer scan the EKG and diagnose the patient. This would serve three purposes. First, it would delay the entrance of the physician, allowing more patients to be diagnosed since their initial diagnoses would not require the services of a physician. Second, it would provide the physician with more information on the patient when the physician sees and diagnoses the patient. The results of the computerized EKG would sit right alongside the patient’s blood test, urine analysis, and blood pressure reading in the patient’s chart. Third, it would reduce the reading error involved in diagnosing the patient since the computer will use fixed quantitative criteria for reading the EKG as opposed to qualitatively “eyeballing” the EKG. All three of these aspects would allow the physician to diagnose the patient more accurately while using fewer resources. This would increase productivity, minimize costs, and maximize profits.

REFERENCES





Cohn, Elizabeth Gross. Flip and See ECG. W.B. Saunders Company: Philadelphia, PA:, 1996.

Johnson, Richard and Mark H. Swarz. Simplified Approach to Electrocardiography. W.B. Saunders Company: Philadelphia, PA, 1986.

Blowers, Margaret G. and Roberta Smith Sims. How to Read an ECG. Medical Economics Books: Oradell, New Jersey, 1984.

LabView Interface Library located in G:/T2/PROJECT/

-----------------------

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

Figure R3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download