simulation of an artificial cardiac pacemaker* · which are all made with biocompatible...

15
Simulation of an Artificial Cardiac Pacemaker* BENG 122A: Biosystem and Controls Aaron Ong 12 , Michael Nacinopa 12 , Pourya Pourhosseini 12 , William Davis 12 , and Anthony Nguyen 12 Abstract— Control systems are largely prevalent across both mechanical and physiological systems. Looking at the intersection between the two, the present work aims to model and simulate the control system of a functioning pacemaker regulating heart rate. The model has been simplified to be a closed loop system that contains the cardiovascular system and a Proportional, Integral, and Derivative (PID) controller with unity negative gain feedback. Tuning was done using MATLAB’s PID controller tuning tool in order to obtain a transfer function that successfully modeled the system with low overshoot, low offset after one second, few oscillations, and a quick rise time. Additionally, an accelerometer was used to simulate a load on the heart that would increase the set point above 60 bpm, such as engaging in physical activity. It was found that the modeled pacemaker system was able to successfully adjust heart rate to these changes in set points. Finally, fuzzy logic based controllers were explored as an alternative to conventional PID controllers. Other literature has cited fuzzy controllers as able to provide better responses for pacemakers. I NTRODUCTION Continuous operation of the heart is essential for living organisms. Therefore, fail-safe systems are needed to be implemented in individuals sus- ceptible to abnormal heart rhythms. It is important to properly diagnose abnormal hearts in order to remedy the health issue. One of the most common medical devices used to address problems in the natural conduction system of the heart is an artifi- cial pacemaker, which continuously monitors heart rate. These generally have two functional units: the ”sensing circuit”, which monitors the heart’s natural electrical activity, and the ”pacing circuit”, which emits an electrical signal to the heart muscles *This work was not supported by any organization 1 These authors contributed equally to this work. 2 The order of authors was determined by the RNG Gods in case the heart’s own rhythm is interrupted or too slow. If a pacemaker senses a natural heartbeat, it will not stimulate the heart. When the HR drops too low (bradycardia) or goes too high (tachycardia), the pacemaker senses the abnormal HR and sends an electrical excitation signal to the heart muscles, which forces the heart to contract at a fast/slow enough rate to maintain a normal rhythm. The leads of a pacemaker can be positioned in the right atrium, right ventricle, or both, depending on the diagnosed heart condition. Figure 1 shows the heart location and pacemaker connection to the heart chambers. Previous work have modeled the control system of the heart to bring it back to normal conditions. For example, Biswas et al. used a transfer function method to mathematically model the cardiovascular system [2]. In another paper by Inbar et al., they used a proportional and integral controller to design a closed loop pacemaker for regulating the mixing venous oxygen saturation level [3]. Work by Shin et al. and Wojtasik et al. studied rate-adaptive artifical heart pacemakers using fuzzy logic controllers [4] Fig. 1. Electrical conduction system of the human heart [1].

Upload: doque

Post on 27-Jun-2019

268 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Simulation of an Artificial Cardiac Pacemaker*BENG 122A: Biosystem and Controls

Aaron Ong12, Michael Nacinopa12, Pourya Pourhosseini12,William Davis12, and Anthony Nguyen12

Abstract— Control systems are largely prevalentacross both mechanical and physiological systems.Looking at the intersection between the two, thepresent work aims to model and simulate the controlsystem of a functioning pacemaker regulating heartrate. The model has been simplified to be a closedloop system that contains the cardiovascular systemand a Proportional, Integral, and Derivative (PID)controller with unity negative gain feedback. Tuningwas done using MATLAB’s PID controller tuningtool in order to obtain a transfer function thatsuccessfully modeled the system with low overshoot,low offset after one second, few oscillations, and aquick rise time. Additionally, an accelerometer wasused to simulate a load on the heart that wouldincrease the set point above 60 bpm, such as engagingin physical activity. It was found that the modeledpacemaker system was able to successfully adjustheart rate to these changes in set points. Finally,fuzzy logic based controllers were explored as analternative to conventional PID controllers. Otherliterature has cited fuzzy controllers as able toprovide better responses for pacemakers.

INTRODUCTION

Continuous operation of the heart is essentialfor living organisms. Therefore, fail-safe systemsare needed to be implemented in individuals sus-ceptible to abnormal heart rhythms. It is importantto properly diagnose abnormal hearts in order toremedy the health issue. One of the most commonmedical devices used to address problems in thenatural conduction system of the heart is an artifi-cial pacemaker, which continuously monitors heartrate. These generally have two functional units:the ”sensing circuit”, which monitors the heart’snatural electrical activity, and the ”pacing circuit”,which emits an electrical signal to the heart muscles

*This work was not supported by any organization1These authors contributed equally to this work.2The order of authors was determined by the RNG Gods

in case the heart’s own rhythm is interrupted or tooslow. If a pacemaker senses a natural heartbeat, itwill not stimulate the heart. When the HR drops toolow (bradycardia) or goes too high (tachycardia),the pacemaker senses the abnormal HR and sendsan electrical excitation signal to the heart muscles,which forces the heart to contract at a fast/slowenough rate to maintain a normal rhythm. Theleads of a pacemaker can be positioned in the rightatrium, right ventricle, or both, depending on thediagnosed heart condition. Figure 1 shows the heartlocation and pacemaker connection to the heartchambers.

Previous work have modeled the control systemof the heart to bring it back to normal conditions.For example, Biswas et al. used a transfer functionmethod to mathematically model the cardiovascularsystem [2]. In another paper by Inbar et al., theyused a proportional and integral controller to designa closed loop pacemaker for regulating the mixingvenous oxygen saturation level [3]. Work by Shin etal. and Wojtasik et al. studied rate-adaptive artificalheart pacemakers using fuzzy logic controllers [4]

Fig. 1. Electrical conduction system of the human heart [1].

Page 2: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 2. Components inside a general artificial pacemaker [8].

[5].Sugiura et al. concluded a fuzzy approach was

the best to control heart rate using a pacemakerregulated by respiratory rate and temperature [6].Jyoti et al. compared a fuzzy controlled and aPID controller tuned with Ziegler-Nichols, Tyreus-Luyben, and Relay methods; the work simulatedand demonstrated that the fuzzy controller had amaximum overshoot less than all of the tuned PIDcontrollers and improved rise time and settling timethan at least two of the three tuning methods [7].However, because of the complications regardinglearning and implementing a fuzzy control sys-tem, we have chosen to use a PID controller andwill explore fuzzy controllers as a future goal asit showed significantly better responses from theprevious literature.

The general process of how a pacemaker worksis as follows: a heart rate input is continuouslymeasured by the electrodes, which is amplified bya low noise pre-amplifier; it is filtered by a secondorder low pass filter to obtain the appropriate ECG;the signal and a threshold detector is sent into acomparator; the comparator output is processed ina low power microcontroller where an electricaloutput is multiplied and sent to the heart via a pac-ing pulse generator and pacing electrodes. Lithiumiodine batteries are used for the power supply anda supply voltage supervisor (SVS) is incorporatedto monitor battery life. The pacemaker schematicis summarized in Figure 5.

In the work presented here, we briefly explainthe heart’s electrical system and the pacemaker-

heart interaction. Assumptions were made to isolatethe control system, as the entire cardiovascularsystem is too complex to model in a simplified,yet relevant, manner. We then present a modeledcontrol system of the pacemaker response to adiscrete impulse, unit step, and dynamic signal.Finally, fuzzy logic controller was explored forfuture work, as previous literature has shown ithas a better response than a PID controller. Lastly,the behavior of the system was analyzed with afrequency response and a stability analysis.

Fig. 3. Single-chamber pacemaker connected to a labeledhuman heart.

I. HEART AND PACEMAKER

A. The Heart’s Electrical System

The pumping of blood in the heart is controlledby the heart’s electrical system, also known as thecardiac conduction system. Mechanically, the heartis composed of four chambers: right atrium, rightventricle, left atrium and left ventricle. The heart’selectrical system begins at the sinoatrial (SA) node,which is located in the right atrium. Cardiac cellsat the SA node are capable of depolarizing bythemselves, a concept known as automaticity. As

2

Page 3: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 4. Block diagram of pacemaker functions [9]. The outputdriver was modeled.

the impulse affects neighboring cells, a chain re-action is activated, spreading to the Bachmann’sBundle in the left atrium within 0.2 seconds and theatrio-ventricular (AV) node shortly thereafter. Thesignal travels from the AV node to the ventriclewalls through the His bundle and spreads downto the Purkinjie fibers. Summarizing the chambersthat receive the electrical signal are right atrium,left atrium, right ventricle, and left ventricle. Theseelectrical conduction pathway is what controls therelaxing and contracting of the heart to pup blood.Completion of this step-by-step process produces afull cycle and is known as one heart beat. However,aging or heart diseases may cause damage to theSA node’s ability to properly pace the beat of aheart, resulting in slower, faster, or paused beats.Pacemakers are introduced to these types of heartproblems in order to sync the heart as close aspossible to its natural heart rate.

B. Pacemaker-Heart Control System ModelThe pacemaker is an electronic device that can

regulate the human cardiovascular activities in thecase of bradycardia and tachycardia or in generalwhen the heart natural regulating mechanisms col-lapses. The pacemaker is made of various parts, in-cluding the casing, microelectronics, and the leadswhich are all made with biocompatible materi-als. Modern pacemakers also use accelerometer,impedance and force detectors in order to adjustthe pacing pattern with the patients activity level.Pacemakers operate under two main modalities :

• Sensing Modality• Pacing ModalitySensing Modalities: Blended sensors: Combina-

tion of accelerometer, minute ventilation (breath-

Fig. 5. Conceptual block diagram of how an artificial cardiacpacemaker works [10].

Fig. 6. Heart rate behavior for different activities

ing patterns) and cardiac contractility sensor. Ac-celerometer provides immediate response at begin-ning of sudden fluctuation in physical activitieswhile minute ventilation offers a gradual responseto the disturbance, detects increased metabolic needand adapts pacing rate accordingly.In other words,this sensors predict whether the individual is sleep-ing , having normal activity or is working out andadjust the heart rhythm accordingly. The lead’selectrodes are also able to sense contraction forceof the ventricle’s chambers and predict how fastheart needs to contract in order to maintain thecardiac output Figure 6.

• Pacing Modality: Pacemakers electrodes canattach directly to the ventricles, or atria (Singlechamber) or both (Dual chambers) dependingon the patient’s medical situation. Pacemakers

3

Page 4: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

can also be used as a monitor to track andcontrol different abnormalities such as pausingor cardiac arrhythmia.

II. ASSUMPTIONS

In order to simplify the cardiovascular systemand the pacemaker-heart interaction, a few un-derlying assumptions were made. Our simulationand results presented later hold true based on thefollowing:

• Biocompatibility• Ideal Heart• Lead placement never disturbed• Accurate Sensors• Zero Latency• Pacemaker is always on• Isolated Single Chamber PacingWhen the body identifies something as a po-

tential hazard it will act accordingly to maintainhomeostasis. For example it might increase bloodpressure to induce clotting and white blood cellpresence, both of which could negatively impact thepacemaker system. Biocompatibility ensures thatthe artificial cardiac pacemaker is accepted by thebody without inducing abnormal side effects. Theheart is also assumed to have a constant resistancethroughout the tissues that the pacemaker acts uponso that the electrical signal propagates as intended.The hearts conductive component was simplified toa simple circuit because the heart transfer functionthat was acquired from literature did not take thatinto account [7] . Our model is unable to accountfor physiological complications, so anything thathinders electrical signal propagation is also nottaken into account.

Pacemakers are generally only used to treatbradycardia, as such the model only responds whenthe patient’s heart rate is lower than the desiredrange. Only the actual pacing itself is analyzed,therefore we are assuming that the sensor portionof the pacemaker works properly. The leads haveto have good connection to accurately relay signalsbetween the heart and the pacemaker. During a casein which the sensor detects an inaccurate heart rate,the pacemaker could either adjust the heart rate toohigh, too low, or have no response when pacing isnecessary. Atrioventricular synchrony is the naturalheart activation sequence in which the atria and

then after a normal delay, the ventricle contracts[11]. The disruption of this natural rhythm is aninherent side effect of single chamber pacemakersand can be fixed with an atrial lead to optimize AVsynchrony if found necessary. Adverse side effectsof AV dissynchrony have not been significantlystudied, and therefore the optimization to accountfor it is left out of the system.

The lag or latency inherent within the systemis ignored. Lag would result in a significant timedelay between the sensing of the current heart rateand the actual contraction of the heart after theartificial signal is transmitted to the AV node. Theheart rate transmitted from the pacemaker coulddiffer from what is actually needed, and could leadto complications within the heart.

The model is based on the assumption that thesensor is working properly and that the pacemakeris already turned on. The accelerometer detectsthe heart rate, and only signals the pacemaker toturn on when necessary. What is modeled is theresponse of the system after a disturbance hasbeen detected. The model focus is the pacemakerresponse and how the fuzzy logic controller makesfor an ideal method of controlling heart rate. There-fore the accelerometer or the sensing aspect of thesystem is absent for simplification.

In addition, the single chamber that we arepacing is isolated from the outside world. We arealso assuming that the pace of that chamber isrepresentative of the entire heart.

III. MODELING

A. General Overview

Using the assumptions previously made, a sim-plified version of a model for a Pacemaker-Heartsystem with an input signal from an accelerometer

Fig. 7. General block diagram of Pacemaker - Heart interac-tion control system [7].

4

Page 5: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 8. Block diagram for our single chamber pacemaker control system

can be built. The model includes a load whichacts on an accelerometer, a set heart rate at whichthe pacemaker will pace, a Pacemaker, a PIDController, and the Heart, which can be modeledin terms of its cardiovascular function and itselectrical conductive properties. Such a model isshown in Figure 8. A set point is chosen andfed into the Pacemaker-Heart closed loop system,which outputs the heart rate at which the heart isbeating. For this model, the set point was chosento be 60 beats per minute (bpm). In addition, adisturbance can be introduced into the system byacting on an accelerometer, which feeds its re-sponse into the Pacemaker-Heart system to increasethe heart rate set point with an increase in physicalactivity or movement. A lag was also introducedinto the system to model the time delay of theaccelerometer.

B. Pacemaker-Heart Model

A closed-loop system for the heart, pacemaker,and PID Controller is shown in Figure 7, whereGp(s) is the transfer function of the pacemaker,Gc(s) is the transfer function of the PID Controller,and GH(s) is the transfer function modeling thecardiovascular function of the heart[7]. The transferfunction for the pacemaker and the heart are shownin Equations (1) and (2), respectively. This modeldid not include the electrical conductive proper-ties of the heart, which we modeled after Ohm’sLaw and added to the system shown in Figure 8.The governing equation for the heart’s conductiveproperties is shown in Equation (4) , where R isthe electrical resistance of the heart’s conductivepathways, V is the voltage of the Pacemaker’s

battery, and I is the current running through theheart. For this system, the values for R and V weredetermined to be 100 Ω [12] and 2.8 V, respectively.The component H(s) in Figure 7 represents thefeedback gain, which was set to 1 to keep the outputsignal unaltered as it is fed back to the system. Ifthe feedback gain was a value other than 1, thehear rate at which the heart was pacing would bealtered, and the controller would fail to drive theheart rate at the pace set by the system’s inputR(S), which will be the heart rate at which wewant the Pacemaker to pace the heart. The outputY (s) will be the heart rate of the heart in beats perminute.

The transfer function of the pacemaker is that ofa first order system with τ = 1/8 and a steady-state gain of Kss = 1/8. From this, the cutofffrequency ωc of the pacemaker can be determinedto be 1

τ = 8. This is important, given that thePacemaker itself acts as a low-pass filter, preventinghigh frequencies signals from being transmitted tothe person’s heart. This is a safety feature that isdesirable in pacemakers.

Gp(s) =8

s+ 8(1)

GH(s) =169

s2 + 20.8s(2)

Gc(s) = Kc(1 + τDs+1

τIs) (3)

I(s) =V

R(4)

5

Page 6: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 9. Accelerometer Spring-Mass-Damper System Diagram[13].

C. PID ControlThe transfer function for a Proportional-Integral-

Derivative Controller is shown in Equation (3). Inthe expression, Kc is the proportional gain, τD isthe derivative time, and τI is the integral time.These parameters can be altered to obtain a de-sired controller response. The parameters affect theclosed loop system’s rise time, overshoot, settlingtime, and steady state error. The PID Controller inthe close-loop portion of the model should be ableto accomplish two goals:

1) It should be able to drive the pacemaker topace the heart at the desired rate in a shortamount of time after the system is initiated.

2) It should reach the set point without showinga strong oscillatory or overshot response.

The first goal of the model is desirable giventhat a pacemaker should start pacing a person assoon as their heart stops beating by itself. In otherwords, the pacemaker should not take as long asa minute or two to bring the heart rate to 60bpm. To achieve this, the rise time and settlingtime of the response have to be decreased. Thesecond goal is desirable given that the pacemakershould not cause the person’s heart to beat at ahigh pace, followed by a very low pace, or simplybeat at an excessive pace. If the system’s responseoscillates, the patient’s heart could be driven to beatat 100 beats per minute one second, and at a 40beats per minute pace the next. If the overshootof the system is large, the patient’s heart couldbe paced at 140 bpm for a short time before itsettles. We decided to implement a PID Controlin our system given that we want to decrease thesettling time of the system’s response, decreasethe oscillations of the system, and have a fast rise

time. A proportional and integral control can helpdecrease the rise time, and the integral controlwill help eliminate any offset from the set pointat steady state. The derivative control will helpdecrease the overshoot and the settling time of thesignal. The PID Controller’s parameters were tunedusing MATLAB’s PID Controller Tuning Tool toobtain a desired system response. The Controller’sparameters and further explanation on how theywere obtained can be found in the Heart RateController Section of this paper (Section IV).

D. AccelerometerAn accelerometer’s internal components can be

expressed as a spring-mass-damper seismic struc-ture with a strain gauge to convert a physicalmovement into a voltage [13]. Such a system isdepicted in Figure 9, where k is the spring constant,m is the mass, b is the damping coefficient, x is theposition of the mass, and V0 is the output voltageof the strain gauge. From Newton’s Laws, a dif-ferential equation can be derived, and transformedinto the s-domain to obtain the transfer functionof the accelerometer. Equations (5) and (6) showthe differential equation and its Laplace Transform,respectively, where ωn is the natural frequency ofthe system and ζ is the damping coefficient. Thetime constant τ could also be used to model thesystem, given the relationship τ = 1/ωn. When astrain gauge is used to determine the displacementof the mass inside the accelerometer, Equation (6)can be rewritten as Equation (7), where Vo is theoutput voltage of the strain gauge, and Sx is thesensitivity constant of the gauge in volts per unitsof displacement.

x+ 2ζωnx+ ω2nx = u (5)

X

U=

11ω2

ns2 + 2ζ

ωns+ 1

(6)

GAcc(s) =Vo

U=

Sx1ω2

ns2 + 2ζ

ωns+ 1

(7)

Equation (7) shows that an accelerometer actsas a second order system, with a system dampingcoefficient ζ = b/2

√km and a natural frequency

ωn =√k/m, which can be tuned by selecting

appropriate values for the mass, spring constant

6

Page 7: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 10. Simulink block diagram for our single chamber pacemaker control system

P I D Overshoot Rise Time Offset (at 1sec)

Fast Response 161.151 56.5611 102.0163 42% 0.03 0Some

Oscillations 22.1479 18.9973 2.8265 18.3% 0.35 5

No Oscillations(slow response) 20 1.5118 6.9463 N/A 2.25 6

TABLE ISYSTEM CHARACTERISTICS FOR VARIOUS PID CONTROLS

and damper damping coefficient. Ideally, the ac-celerometer should exhibit a behavior close to thatof a perfectly damped response so that it canaccurately measure changes in motion, and thelack thereof. For example, if a person stands upfrom a sitting position, the accelerometer shouldrecord a sudden change in movement, followed bya quick stabilization to show that the patient hasstopped moving. To accomplish this, the dampingcoefficient ζ should be slightly less than 1. If ζwas given a value much smaller than 1, the systemwould be under-damped, meaning it would oscil-late; oscillations would mean that the accelerometerwould be modeling motions that are not happening,given that it would display overshoot and oscil-latory behavior. If ζ was much greater than 1,the accelerometer would be over-damped, and itwould not register changes in motion fast enoughto readjust the patient’s heart rate. For example, if aperson stand up, the pacemaker should increase theheart rate immediately, not 10 seconds after theystand up. Although a value of 1 for ζ would meanthat the system was critically damped, we want our

system to respond faster than a critically dampedsystem, even if this results in some overshoot andoscillations. For this reason, out value of ζ waschosen to be smaller than 1, which resulted in asmaller rise time, at he cost of a small overshoot.We decided it would be better for a pacemakerto pace a heart at a slightly faster pace for a fewseconds than to have a delayed response in whichthe accelerometer’s signal would take too long tomodel a change in motion.

To determine the exact value of ζ, we first deter-mined the natural frequency of the system, whichdetermines the cutoff frequency of the accelerome-ter. Modern accelerometers can use computer al-gorithms to analyze the response of the deviceand make decision to determine any change to theset point at which to pace the heart. Our modelcannot use any of the algorithms, but we can usethe accelerometer’s cutoff frequency to prevent thedevice from sensing high frequencies, and pacingthe heart at those frequencies. For example, if aperson with an accelerometer goes on a run, thepacemaker should not increase and decrease their

7

Page 8: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

heart rate every time they change their motion.The accelerometer should take a dynamic signaland output a set increase in heart rate. To achievethis, we decided to set ωn equal to 1/2, whichwill attenuate any signals with frequencies higherthan 2 rad/sec. However, this also means that thesteady state gain of the system will be attenuatedby 40dB per decade for high frequencies. If thesensitivity Sx of the accelerometer was set to 60,the maximum heart rate at which the pacemakerwould drive the heart would be 120 bpm. However,because the accelerometer’s signal is attenuated, theresulting heart rate will be lower than 120 bpmwhen a dynamic signal acts on the system. Havingchosen ωn to equal 1/2, we can determine that if ζwas given the value of 1, the first order coefficientin the characteristic equation of the accelerometer’stransfer function would equal 4 ( 2

0.5 ). Given that wewant a value of ζ lower than one, we arbitrarilychose 3.4 as the first order coefficient in the char-acteristic equation of the accelerometer’s transferfunction, resulting in a ζ value of 0.85, keeping inmind the trade-offs between a faster rise time andsystem oscillations.

The sensitivity of the gauge Sx can be selectedto obtain a desired steady state gain of the systemwhen a step input is applied to it. In the caseof our system, we want to establish a maximumsteady-state heart rate of 120 bpm, so we will usea sensitivity Sx = 60 assuming a step input, giventhat the signal from the accelerometer will add tothe set point to result in a heart rate of 120 bpm.

G2Pade =

1− τ2s+ τ2

12s2

1 + τ2s+ τ2

12s2

(8)

To account for a time delay associated with theaccelerometer’s response, a time lag of 0.38 ms[14]was included into the system shown in Figure 8.To include the time delay in our system, a secondorder Pade approximation was used. The transferfunction for a second order Pade approximationof a time lag e−τs is shown in Equation (8).However, the second order Pade approximation hadto be removed from the final Simulink model ofthe system due to numerical solver complications.Simulink was unable to solve the system for timedelays smaller than .01 seconds, approximately.Therefore, the lag transfer function G2

Pade was set

to 1.Fortunately, the time delay of the accelerom-eter was much smaller than the time constants ofthe rest of our system, which were in the orderof magnitude of 100, compared to the order ofmagnitude of the delay of 10−5.

E. Simulink ModelWith all the above components taken into con-

sideration, a Simulink model of the system in thes-domain was built, which is shown in Figure 10.The model also includes a Time Scope that wasused to observe the system’s output, as well as theoutput of the accelerometer. The overall transferfunction of the system is shown in Equation (10),where the set point SP (s) is a constant heart rateat which the pacemaker will drive the heart, andU(s) is a load on the accelerometer.

IV. HEART RATE CONTROLLER

In this section three different PID controllerswith various characteristics are introduced to themodel. The PID controllers were tuned using thePID tuning tool in Simulink to obtain three dis-tinctly different responses. The tool allows the userto adjust the response time and how aggressive orrobust the transient behavior is. The tuning toolprovides parameters P, I , D and N for Equation (9),which is a standard PID with a filtered derivative.

P + I1

s+D

N

1 +N 1s

(9)

The parameters P, I, D, and N represent theProportional control, Integral control, Derivativecontrol, and Derivative Filter coefficient for the sys-tem, respectively. The response of PID controllersare characterized by three quantities: overshoot,rise time, and offset. The overshoot represents theinitial jump in heart rate relative to the set pointbefore the system starts to settle; the rise time tellsyou how long it takes for the system to converge;and the offset is the difference from the set point inbeats per minute once the system converges. Twomodels were tuned to either reach the set pointfast at the expense of a high oscillatory motionand overshoot or to minimize the overshoot, atthe cost of a longer convergence time plotted asresponses 2 and 3 respectively in 11. Our goalfrom the tuning was to find a safe balance betweenovershoot, oscillation, and rise time, which was

8

Page 9: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Y (s) =Gp(s)Gc(s)GH(s)I(s)

1 +Gp(s)Gc(s)GH(s)I(s)SP (s) +

Gp(s)Gc(s)GH(s)I(s)GAcc(s)G2Pade

1 +Gp(s)Gc(s)GH(s)I(s)U(s) (10)

achieved through the third model: response 1 in11.

In the case of regulating heart rate, finding abalance between overshoot, oscillation and risetime was important to ensure the health of thepatient and the proper function of the device. Highovershoot coupled with many oscillations could bedetrimental for the heart due to the unnecessarystrain on it. In addition, rapid higher amplitudeoscillations, drains the battery which could be apossible design flaw. Conversely, minimizing theovershoot and oscillations too far results in a largerise time. In situations in which the body needsto transport oxygen, like during exercise, the in-creased time it would take for the system to raisethe heart rate could have negative repercussions.

Fig. 11. System response for no controller and three PIDControllers calibrations.

V. SIMULATION RESULTS

To test the Simulink model of the Accelerometer-Pacemaker-Heart system, three different load sig-nals were used. For all simulations, the set pointof the system was set to 60 beats per minute, aspreviously mentioned. The load inputs used were adiscrete input with a pulse duration of 0.5 seconds,a unit step input, and a sinusoidal wave of varyingfrequencies. In addition, a time delay was added tothe accelerometer’s signal to depict the response of

the system when the Pacemaker is turned on, and aseparate response of the system when a disturbanceacts on the system.

A. Discrete Impulse Input

Fig. 12. System and accelerometer response to a discreteimpulse of 0.5s duration.

Fig. 13. System and accelerometer response to a discreteimpulse of 0.5s duration with a 6s delay.

The accelerometer and model’s responses to adiscrete impulse with a duration of 0.5 secondsare shown in Figure 12. This input load was usedto model a scenario in which a person stands up,and the heart rate must increase to account foran increase in pressure resulting from the motion

9

Page 10: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

of standing up. If a person’s heart rate does notincrease when they stand up from a sitting position,the increase in pressure can decrease the flow ofblood to the brain and make them faint. The systemresponse in Figure 12 shows that the heart rateat which the device drives the heart does increasewhen a discrete impulse acts on the system, as itshould. In addition, Figure 13 shows the responsesof a discrete step impulse of equal duration, butwith a time delay of 6 seconds. In this Figure, it isevident how the accelerometer’s response is addedto the overall system response. The magnitude ofthe accelerometer’s response is not 60 bpm,whichwas selected as the accelerometer’s sensitivity sothat the maximum heart rate at which a heart couldpace would be 120 bpm. The actual magnitude ofthe accelerometer is closer to 5 bpm. The reasonfor this was that the accelerometer’s response wasunable to fully respond to the signal in the 0.5second duration of the pulse. From this observation,it can be said that the change in heart rate resultingfrom a discrete impulse will be dependent on theduration of the impulse. Longer pulse durations willresult in higher output heart rates.

B. Unit Step Input

Fig. 14. System and accelerometer response to a unit step.

The response for the accelerometer and systemwhen a unit step load acts on the model is shownin Figure 14. A unit step input was used to modela scenario in which a person with a pacemaker isundergoing a constant physical exertion that resultsin constant changes in motion. For example, ifa person with a pacemaker goes on a run, the

Fig. 15. System and accelerometer response to a unit stepwith a 6s delay.

accelerometer would register constant changes inmotion. As a result, the pacemaker would drivethe heart at a higher rate, just as a healthy heartwould increase its beating frequency to increasethe cardiac output to deliver more blood to thebody. If the system did not show an increase inheart rate, the patient would not receive enoughoxygenated blood throughout their body, and wouldbe unable to withstand prolonged physical exer-tions. As was mentioned earlier, the sensitivity ofthe accelerometer Sx was chosen to be 60 so thatthe maximum heart rate during prolonged physicalexertion would be 120 bpm, which is the heartrate shown in Figure 15, which shows the system’sresponse to a step input with a time delay of 6seconds, showing the individual responses of thesystem when the pacemaker is turned on, and whenthe accelerometer senses a disturbance.

C. Sinusoidal Dynamic Wave Input

The unit step input showed that the accelerome-ter could register a constant change in motion, andoutput a corrected heart rate to provide the bodywith proper oxygenation. However, it would beunlikely for an accelerometer to register a constantchange in motion for a prolonged period of time.For this reason, a dynamic signal was used to drivethe model and test how it responded to sinusoidalinputs of different frequencies. The magnitude ofthe dynamic signal was used to drive the system,given that any motion registered by the accelerom-eter, either in the positive or negative direction,

10

Page 11: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 16. System and accelerometer response to a dynamicinput with frequency 1Hz.

Fig. 17. System and accelerometer response to a dynamicinput with frequency 0.02Hz.

should result in an increase in heart rate. Figure 16shows the response of the system to a sinusoidalwave input with frequency equal to 1Hz, whichattempt to model the movement of a person asthey run. The Figure shows that the accelerometer’scutoff frequency removed the dynamic componentof the signal, and drove the pacemaker to pacethe heart at a constant heart rate, which was whatthe accelerometer was designed to do. Figure 17shows the system’s response to a dynamic signalof frequency 0.02 Hz. A signal of this naturewould model a person sitting down and standingup several times. The accelerometer did not filterout the signal nor did it attenuate it, given that itwas below its cutoff frequency.

D. Physiological Complications and Device Mal-function

To further test the Simulink model, the resistanceof the heart was set to 1015 to model an Atri-oventricular (AV) Block, which is characterized bythe decrease in conduction of the heart’s electricalpathways. The increase in resistance was used tosimulate a decrease in conduction. Figure 18 showsthe results of the simulation, which show that forhigh resistances, the output heart rate goes to zero,even when the accelerometer registers a signal, asshown by the second trace on Figure 18. The exactsame results were observed when the voltage of thepacemaker’s battery was set to zero in an attempt tomodel a scenario in which the pacemaker’s batterywould run out of power. As expected, the outputheart rate was 0 bpm, given that the pacemaker wasunable to pace the heart without a power source.

E. Frequency Response

A frequency response analysis was performed onthe overall transfer function given in Equation 10.The Bode plot in Figure 19 shows an underdampedresponse with a -40 dB/decade slope and a peak inmagnitude at the cutoff frequency, as expected ofan underdamped system. For the phase plot, we cansee a very steep rise at the cutoff frequency, whichis also characteristic of an underdamped system. Atlow frequencies, a phase shift of -360 is seen, aswell as a phase shift of -270 at high frequencies.

Fig. 18. System and accelerometer response to physiologicalcomplication of resistance set very high to 1015.

11

Page 12: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Fig. 19. Bode plot for overall transfer function with load zero

F. Stability AnalysisStability analysis was also performed on the

overall transfer function Equation 10. Figure 20shows the Nyquist behavior of the system. Azoomed-in version on the real axis at -1 is shownin Figure 21. This shows the plot going around -1, rather than encircling it. Hence, the system isstable.

Fig. 20. Nyquist plot for overall transfer function with loadzero

VI. FUZZY CONTROLLER

An alternative controller to PID is a fuzzy controlsystem. Fuzzy control systems are very primitivecompared to PID control systems. What makes afuzzy controller unique is that it runs on Fuzzylogic rather than Boolean logic. That is to sayinstead of categorizing data based on truths (i.e.good/bad, 0/1), fuzzy logic categorizes on partialtruths (i.e. very good/good/bad/ very bad, [0,1]).

Fig. 21. Zoomed-in image of nyquist plot for overall transferfunction with load zero

Additionally, rather than being a computationaltype of model, the fuzzy model is based on em-pirical rules (almost like trial and error). Becauseof this the behavior and design of a fuzzy controlsystem is drastically different from that of a PID[15].

Fuzzy control systems function on three maininterfaces [16]:

1) Fuzzification2) Decision Making3) Defuzzification

Fuzzification refers to the idea of taking aninput, like temperature, and making the “crisp” rawtemperature value into a “fuzzy” value indicatesby more categories then simple “Hot” and “Cold”.Figure 22 is an example of such an input.

In Figure 22, the x-axis represents temperaturewhile the y-axis represents the membership func-tion (MF) value. Each color triangle is a MF and thecorresponding category title along the top (Cold,

Fig. 22. Input diagram of membership functions for temper-ature [15]

12

Page 13: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

Cool, Nominal, Warm, and Hot) represents theassociated fuzzy value. The strength in the fuzzysystem is seen by the fact that different categoriesintersect with each other. What this signifies is thatno temperatures do not belong exclusively to onecategory. Instead, they are in multiple categoriesbut to different degrees. A way to conceptualizethis is that at any temperature, some people canview the temperature one way while others another.The idea is that at no point does an input valueinstantaneously flip from one characterization toanother (unless it is something like a switch). Moreoften, as an input value transitions it becomesless like one category, and more like another. Thecategories used in Fuzzification comes from theoperators and human who understand the physical,mechanical, or physiological system to be modeled.In order to assign a final single value for an inputthat falls into two categories, the centroid methodis used in order to properly weight how much theinput value falls within one category or another.Other methods exists, but the baseline standard isthe centroid method [17].

Following fuzzification is the decision makingprocess. The decision process is where all fuzzifiedinput values are compared with each other to yielda final fuzzy decision. The rules that dictate thisdecision process are “If. . . Then. . . ” statements thatmodel the desired outputs for all scenarios ofpossible inputs. These rules are defined by humanexperiences and knowledge of how the processworks. A sample rule for multiple inputs wouldread “If temperature IS cool AND pressure ISstrong, THEN throttle is FuzzyValue”. Key wordssuch as AND, OR, and NOT dictate how fuzzyvalues relate to each other and thus influence theFuzzyValue [15].

The final step of the fuzzy control system is de-fuzzification. Through this process, the determinedfuzzy result is converted back to a usable “crisp”output value that can be used in the control system[16]. Figure 23 shows MF mapping for a systemwith 2 inputs and a single output and Figure 24shows the overall model of a fuzzy controller. Itis important to notice that the Fuzzy Controllerdiagram shows a knowledge base consisting ofof two categories ”Data Base” and ”Rule Base”.”Data Base” is the user knowledge that determines

Fig. 23. Three mappings for a single fuzzy controller. Top2 MF mappings are inputs and last MF mapping is for theoutput [15]

the categories when the fuzzy controller is beingdesigned and ”Rule Base” is the ”If... Then...” rulesthe controller designer implements.

Despite being far older than PID controllers,the fuzzy controller has a few major benefits thatmake it a good option for cardiac pacemakers.First, with regards to design, Fuzzy logic buildsoff of terms of the human operators and theirexperiences. This aids in mechanizing the tasks thathave already been done successfully by humans. Asecond benefit is that fuzzy control systems workwell for models that are either too computationallyheavy or do not exist. Third, fuzzy controllers arerelatively low cost compared to PID controllers asthe resolution does not need to be as high. Last,more rules and inputs can easily be added to fuzzycontrollers in order to improve the robustness ofthe systems. For these reasons, adding a fuzzy con-

13

Page 14: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

troller would be a strong next step for developingthe device [15] [7].

VII. LIMITATIONS

Limitations of the model designed are derivedfrom our simplifying assumptions of the heartand pacemaker. Limitations, likewise stem fromthe confines of our MATLAB model and can bereflected in simulations.

With regards to an actual pacemaker, the struc-ture has been heavily simplified. First, PID con-trollers are used in our system opposed to fuzzycontrollers. PID controllers work on discrete valueswhile Fuzzy uses partial truths, which better de-scribes the actual functionality of the heart. Second,there are a lot of different modalities that affectheart rate like contractility and ventilation patterns.We have only considered physical motions that canbe detected by accelerometer. Third, Modeling apacemaker solely from transfer functions makesthe system unable to perform heavy computationalanalysis of inputs. Current pacemakers are far morecomplex than a simple set of controllers and betterresembles the capabilities of a full scale computer.

Looking at the physiology, we have assumed theheart to be a simple circuit with a single constantresistance. This is inaccurate as resistance in theheart is actually dependent on ion movement andion channels. Extra-cellular and intra-cellular ionconcentrations are constantly changing which im-pacts ion flow, and thus the current and resistanceof the heart. Modeling the system with a constantresistance prevents the ability of the system to ac-count for physiological syndromes that impact ionflow. Additionally, we have only modeled the heartas single chamber. This means that the frequenciesof other chambers are being ignored. In some cases,

Fig. 24. General fuzzy control system [16].

AV dissynchrony, such a model can translate to thedisruption of the heart’s natural rhythm.

Last, the Simulink model and transfer functionfor our system were found to have inherit lim-itations. Within Simulink, the MATLAB solverwas unable to determine the second order padeapproximation of our time lag of 0.38 ms. Becauseof this it was excluded from or simulations. For ourtransfer function, a load of zero was assumed sothat a transfer function could be attained relatingour output to our input set point. However, thisis never the case in reality as the accelerometer,which measures our input load, will always have areading.

VIII. DISCUSSION

Our simulation of the pacemaker in response toa load in heart rate changes does not serve as astrong alternative to physiological experimentation.This is because our model oversimplifies both thephysiology of the heart as well as the intricaciesof a pacemaker as previously mentioned in thelimitations.

Our simplifications make the pacemaker we de-signed only valid if assuming all variables, asidefrom changes in motion measured by the ac-celerometer, to be constant. Physiological experi-mentation however will take into account all exist-ing factors.

IX. FUTURE WORK

Continuing forward with this project, it is nec-essary to explore the details of using a fuzzycontroller either as the single control system or inconjunction with a PID controller. PID controllersalone requires a lot of assumptions, sometimesoversimplifying the problem at hand. Fuzzy con-trollers are based around a foundation that becauseof such assumptions, we can not be 100 percentcertain of inputs, and thus define inputs as partialtruths rather than absolute truths as seen by theoverlap in their characterizations and use of mem-bership functions.

While a fuzzy control system cannot perfectlymap a full system because it is empirically basedrather than computational, more and more inputscan always be added to enhance robustness andcreate at times a more accurate model than onethat is purely computational.

14

Page 15: Simulation of an Artificial Cardiac Pacemaker* · which are all made with biocompatible materi-als. Modern pacemakers also use accelerometer, impedance and force detectors in order

ACKNOWLEDGEMENTS

We would like to thank Professor Christian Met-allo and Mehmet Badur for their instruction in ourBiosystems and Controls class and their guidancethroughout the development of this project.

REFERENCES

[1] Z. Jiang, M. Pajic, S. Moarref, R. Alur, and R. Mang-haram, “Modeling and verification of a dual chamberimplantable pacemaker,” in Tools and Algorithms forthe Construction and Analysis of Systems, pp. 188–203,Springer, 2012.

[2] S. Biswas, A. Das, and P. Guha, “Mathematical modelof cardiovascular system by transfer function method,”Calcutta Medical Journal, vol. 4, pp. 15–17, 2006.

[3] G. F. Inbar, R. Heinze, K. N. Hoekstein, H.-D. Liess,K. Stangl, and A. Wirtzfeld, “Development of a closed-loop pacemaker controller regulating mixed venous oxy-gen saturation level,” Biomedical Engineering, IEEETransactions on, vol. 35, no. 9, pp. 679–690, 1988.

[4] J. Shin, J. Yoon, and Y. Yoon, “A study on the rate-adaptive pacemaker by motion and respiration usingneuro-fuzzy,” in Engineering in Medicine and BiologySociety, 2000. Proceedings of the 22nd Annual Inter-national Conference of the IEEE, vol. 2, pp. 992–994,IEEE, 2000.

[5] A. Wojtasik, Z. Jaworski, W. Kuzmicz, A. Wielgus,A. Wałkanis, and D. Sarna, “Fuzzy logic controller forrate-adaptive heart pacemaker,” Applied Soft Computing,vol. 4, no. 3, pp. 259–270, 2004.

[6] T. Sugiura, S. Mizushina, M. Kimura, Y. Fukui, andY. Harada, “A fuzzy approach to the rate control inan artificial cardiac pacemaker regulated by respiratoryrate and temperature: A preliminary report,” Journalof medical engineering & technology, vol. 15, no. 3,pp. 107–110, 1991.

[7] Y. Jyoti, R. Asha, and G. Girisha, “Intelligent heart ratecontroller for cardiac pacemaker,” International Journalof Computer Applications, vol. 36, no. 7, pp. 22–29,2011.

[8] C. Technician, “Heart pacemaker - artificial,” Sept. 2015.[9] SUBHASHINI, “How a pacemaker works,” Feb. 2013.

[10] P. PITIGALAARACHCHI, “Cardiac pacemakers - engi-neering marvels,” Jan. 2011.

[11] S. J. Connolly, “Dual-chamber versus ventricular pac-ing,” Nov. 1996.

[12] E. J. Beattie Jr, J. M. Keshishian, N. B. Ames, andB. Blades, “The electrical resistance of the heart,” Annalsof surgery, vol. 137, no. 4, p. 504, 1953.

[13] R. Longoria, “Note on accelerometers,” Apr. 2000.[14] M. Looney, “Analyzing frequency response of inertial

mems in stabilization systems,” 2012.[15] Public, “Fuzzy control system,” Nov. 2015.[16] J. Godjevac, “Comparison between pid and

fuzzy control,” Source: http://citeseer. nj. nec.com/godjevac93comparison. html, 2000.

[17] E. J. Mastascusa, “An introduction to fuzzy controlsystems,” Feb. 2008.

15