Open source model for generating RR intervals in atrial fibrillation and beyond
© Lian et al; licensee BioMed Central Ltd. 2007
Received: 14 November 2006
Accepted: 02 March 2007
Published: 02 March 2007
Realistic modeling of cardiac inter-beat (RR) intervals is highly desirable for basic research in cardiac electrophysiology, clinical management of heart diseases, and developing signal processing tools for ECG analysis.
We present an open source computer model that is capable to generate realistic time series of RR intervals in both physiologic and pathologic conditions. Detailed model structure and the software implementation are described.
Examples are provided on how to use this model to generate RR intervals in atrial fibrillation with ventricular pacing, normal sinus rhythm with heart rate variability, and typical atrial flutter with atrioventricular block. The extensibility of the model is also discussed.
The present computer model provides a unified platform wherein various types of ventricular rhythm can be simulated. The availability of this open source model promises to support and stimulate future studies.
The variation of cardiac inter-beat (PP, RR or NN) intervals results from both rhythmic activity of the heart electrical source and the dynamic properties of the cardiac conduction pathway, both of which are under autonomic control. In normal sinus rhythm, the RR intervals are known to fluctuate at various time scales, a phenomenon known as heart rate variability, which has been extensively investigated to probe the autonomic nervous activity . On the other hand, the abnormal cardiac rhythm, for example during atrial fibrillation (AF), has been thought to mainly result from disturbance in autonomic modulations of the electrophysiological properties of the atria and the atrioventricular (AV) node . Hence, analysis of RR intervals may offer valuable insights into the mechanisms of arrhythmia genesis, maintenance, and termination.
From the therapeutic perspective, characterization of the RR intervals can guide the development of novel strategies for cardiac rhythm management. For instance, many antiarrhythmic drugs are known to affect ventricular rhythm by modifying various electrical properties of the heart, including the automaticity, the conduction velocity, and the refractory period . In another example, specially designed pacing protocols could be used for prevention, termination, or rate regularization of AF through implantation of artificial pacemakers .
Consequently, time series analysis of RR intervals has been a research thrust in the field of biomedical engineering. Numerous techniques based on RR interval analysis have been developed in the past decades to assess the autonomic control of the cardiovascular system, to assist clinical diagnosis of cardiac disorders, to facilitate arrhythmia predication and risk stratification, and so on . However, quantitative comparison of different analytic methods has been hindered by the heterogeneity of various data sources and the inherent noise and uncontrollability of real world recordings. Therefore, realistic modeling of RR intervals is highly desired to provide a unified platform wherein various algorithms can be evaluated.
Despite the apparent scientific merits and clinical significance, there is a stark paucity of computer models to generate realistic time series of RR intervals. Although several RR interval generators had been created in response to the PhysioNet/Computers in Cardiology Challenge 2002 , all these models are limited to synthesizing sinus rhythm with simulated heart rate variability, yet not applicable to abnormal rhythms.
It has been demonstrated that this AF-VP model could account for most known experimental observations in AF . Of particular note is the plasticity of the model, that is, this model can be easily extended beyond AF, to simulate various types of RR intervals in both normal physiologic and pathologic conditions. In order to facilitate the use and further improvement of the AF-VP model, its software (written in ANSI/ISO C [see Additional file 1]) has been made freely available on PhysioNet , an on-line forum for the dissemination and exchange of recorded and simulated biomedical signals and archives of open source software .
In this paper, we describe the software architecture of the AF-VP model. Examples are given on how to use this model to synthesize RR intervals for different rhythms, and the extensibility of the model is discussed.
The AF generator outputs random AF impulses bombarding the AVJ. However, retrograde conducted waves escaping the AVJ can collide with an imminent AF impulse or reset the timing cycle of the AF generator.
The AVJ fires when its membrane potential (Vm) reaches the depolarization threshold (VT). The activation of AVJ starts a refractory period, when the AVJ is refractory to any stimulation. At the end of refractory period, Vm returns to the resting potential (VR) and starts to rise in a linear manner. Each time an AF impulse hits the AVJ during Phase 4, Vm is increased by a discrete amount ΔV [10, 11]. However, if the AVJ is invaded by a VP-induced retrograde wave during Phase 4, Vm is brought to VT directly.
The firing of the AVJ generates an activation wave that starts an antegrade or retrograde AV delay (AVD), depending on the direction of activation. If the AVJ is retrograde activated while an antegrade wave has not finished its AVD or vice versa, a collision occurs, annihilating the activation waves in both directions. Both refractory period and conduction delay of the AVJ are dependent upon its recovery time, which is defined as the interval between the end of last AVJ refractory period and the current AVJ activation time. In addition, the electrotonic modulation of the AVJ refractory period by blocked impulses is also incorporated in the model .
After finishing the antegrade AVD, an activation wave is generated in the ventricle and starts the antegrade ventricular conduction. The delivery of VP also generates a retrograde activation wave in the ventricle toward the AVJ. When both antegrade and retrograde waves are present in the ventricle, a ventricular fusion beat manifests, causing the extinction of both waves.
The electrode for recording this activity is assumed to be implanted in the ventricle and connected to a pacing device operating in demand mode. If an activation wave propagates to the electrode after an antegrade ventricular conduction delay, a ventricular sense (VS) occurs that inhibits the scheduled VP, whereas the timeout of the pacing interval triggers the VP.
List of timers used in the AF-VP model
AF interval timer
Arrival of AF impulse
End of AF interval
RR interval timer
Any VS or VP event
Next VS or VP event
AVJ refractory timer
End of AVJ refractory period
VP clock timer
Any VS or VP event
End of VP interval
Antegrade AVJ timer
Antegrade AVJ activation
End of antegrade AVD
Retrograde AVJ timer
Retrograde AVJ activation
End of retrograde AVD
Antegrade ventricle timer
End of antegrade AVD
VS event or ventricle fusion
Retrograde ventricle timer
Delivery of VP
Retrograde invasion of AVJ or ventricle fusion
List of counters used in the AF-VP model
AF impulse counter
Arrival of AF impulse
Atrial invasion counter
Retrograde wave escapes the AVJ
AV block counter
Antegrade or retrograde AV block (w/o fusion)
AVJ fusion counter
Collision of antegrade & retrograde waves in AVJ
Ventricular fusion counter
Collision of antegrade & retrograde waves in ventricle
VS or VP event
ventricular fusion (VtrFusion),
AF bombardment of AVJ (AnteHitAvj),
retrograde invasion of AVJ (RetrHitAvj),
ventricular sense (VtrSense),
ventricular pace (VtrPace),
antegrade AVD timeout (AnteEscAvj), and
retrograde AVD timeout (RetrEscAvj).
The model then checks the status of the AVJ. If the AVJ is in Phase 4 and Vm ≥ VT, then services are called for AVJ activation (ActivateAvj) and the initiation of the refractory period (StartAvjRef). On the other hand, if the AVJ is in refractory period, then no action is taken until its timeout, when a service is called to start the Phase 4 (StartAvjPh4).
Of particular note is the fact that the above model framework allows different processes to generate the AF intervals, different protocols to generate the VP intervals, and different formulas to calculate the conduction time and refractory period (including the electrotonic modulation effect of the concealed conduction) of the AVJ.
Details on how to generate above examples using the present AF-VP model are given in Appendix B.
The present AF-VP model described above can be easily extended to generate various types of ventricular rhythms by modifying the parameters specified in the model configuration file (see Appendices A, B).
The AF generator can be modified to generate other random or deterministic processes, to simulate other types of atrial rhythms, including sinus rhythm with heart rate variability and atrial ectopic beats, paroxysmal or persistent atrial tachycardia, and programmed atrial pacing protocols .
The AVJ properties (conduction timer and refractory period) can be modified to simulate various degrees of AV block including the second-degree Mobitz type I AV block (Wenckebach phenomena)  and the Mobitz type II block (Figure 17), or the uni-directional AV block. Alternatively, AV junctional tachycardia can be simulated by increasing the spontaneous Phase 4 activity of the AVJ .
Various VP schemes can be tested by programming dynamic (instead of fixed) PCL. For example, different VP protocols can be implemented by continuously adjusting the PCL based on measured RR intervals, for the purpose of ventricular rate stabilization (VRS) in AF [15, 16]. Two such algorithms, adaptive-VRS  and dynamic overdrive pacing , were included in the software as built-in functions for users' reference. In another example, the ventricular conduction time can be adjusted to simulate ventricle apical pacing or His bundle pacing, and quantitatively compare their VRS effects . Moreover, the VP can be replaced by spontaneous ventricular activation to simulate the ventricular ectopic beats or episodes of ventricular tachycardia.
The simulation output of the present model actually includes three closely coupled time series: PP intervals, RR intervals, and PR intervals (AV delays). By simulating various cardiac rhythms with different model parameter settings, these generated time series can be used to build a standard test platform for quantitative evaluation or comparison of different signal processing techniques, for example, the assessment of heart rate variability, the quantification of rhythm complexity, the classification of ECG rhythm types, and so on.
We present the structure and implementation of a novel computer model, which is capable for synthesizing realistic time series of RR intervals under physiologic and pathologic conditions. The availability of this open source model promises to aid and stimulate future research in basic and applied cardiac electrophysiology involving RR interval analysis. Code to run this model, written in C, is available from PhysioNet .
The software reads the AF-VP model parameters from an external configuration file (default filename: config.txt), which can be modified by any text editor. Each model parameter is defined in a text line in the format of:
parameter name = parameter value
Any empty line is ignored. Besides, a line starting with '%', and the text following double slash '//' are considered as comments.
The model parameters are grouped into five parts, corresponding to the simulation environment and the four model components: the AF generator, the AVJ, the ventricle, and the right ventricular (RV) electrode (see  for detailed descriptions of the model parameters).
A sample configuration file, with suggested default model parameters and some comments, is listed below.
% [Simulation environment]
fnRR = outrr1.txt // output RR interval filename
fnAA = outaa1.txt // output AA interval filename
fnAV = outav1.txt // output AVJ status filename
fnLOG = outlog1.txt // output event log filename
MAX_RR = 500 // max RR cycles to run for one simulation
MAX_TIME(s) = 1000.0 // max time to run for one simulation
Ts(s) = 0.001 // sampling interval (1000 Hz)
RR0(s) = 1.000 // initial RR interval
% [Atrium model]
AA_MODEL = 0 // AA interval generator method
lambda(1/s) = 5 // mean rate of AF bombardment on AV junction
AAstd(s) = 0.0 // standard deviation of AA interval
dVmean(mV) = 15 // mean potential increment (dV) by AF bombardment
dVstd(mV) = 0 // standard deviation of dV
AtrDly(ms) = 0.03 // atrial conduction delay from AF source to AVJ
S1S2(s) = 0.2 // S1S2 interval of atrial pacing protocol (used in )
S2S3(s) = 0.5 // S2S3 interval of atrial pacing protocol (used in )
% AA model: 0-exponential, 1-inv poisson (n/a), 2-uniform, 3-Gaussion, % 4-S1S2 pacing, 5-S1S2/S2S3 pacing, 6-fixed
% [AVJ model]
Vt(mV) = -40 // AVJ depolarization threshold potential
Vr(mV) = -90 // AVJ resting potential
dVdt(mV/s) = 33 // phase 4 depolarization rate
MinAVDa(s) = 0.070 // minimum anterograde AV conduction delay
MinAVDr(s) = 0.070 // minimum retrograde AV conduction delay
alpha(s) = 0.130 // max extension of the AV conduction time
tau_c(s) = 0.100 // time constant for AV conduction curve
MinRef(s) = 0.050 // minimum AVJ refractory period
beta(s) = 0.250 // max extension of the AVJ refractory period
tau_r(s) = 0.500 // time constant for AVJ recovery curve
Ref_std(s) = 0.000 // standard deviation of AVJ refractory period
delta = 10 // electrotonic modulation control (strength)
theta = 10 // electrotonic modulation control (time)
% [Ventricle model]
AntDly(s) = 0.050 // antegrade conduction delay from AVJ to RV electrode
RetDly(s) = 0.150 // retrograde conduction delay from RV electrode to AVJ
ref(s) = 0.100 // ventricular refractory period
% [RV electrode model]
VP_MODEL = 0 // ventricular pacing method
BI(s) = 0.80 // standby ventricular pacing basic interval
% VP_MODEL: 0-VVI, 1-adaptive VRS, 2-wittkampf, >2(default): VVI
Various patterns of RR intervals can be generated using the present AF-VP model by modifying the configuration file described in Appendix A.
For example, Figure 15 (AF rhythm and VP) is produced by simply replacing the default values of the following two parameters as:
dVdt(mV/s) = 30
BI(s) = 10 // also 0.85, 0.75, 0.68, 0.60
Similarly, Figure 17 (atrial flutter rhythm) is generated by changing the default values of the following parameters to:
AA_MODEL = 3
lambda(1/s) = 2 // also 2.5, 3.333, 5, 10
AAstd(s) = 0.01
dVmean(mV) = 50
dVdt(mV/s) = 50
MinRef(s) = 0.250
BI(s) = 10
As laid out in Figs 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, the software architecture of the model is constructed in a modular manner, to facilitate code change for achieving a particular aim. For example, in Figure 16 (sinus rhythm with normal heart rate variability), the PP intervals were generated using another open source model described in , instead of using any built-in AF interval generators (AA_MODEL). To achieve this, only two minor modifications are needed: (1) the PP intervals are imported from an external file (generated by the other model) during the 'Model Initialization' step (Figure 3); (2) the imported PP intervals are indexed to 'obtain the next AF interval' (Figures 6, 11), regardless of the parameter AA_MODEL setting.
The authors are grateful to Dr. S. E. Greenhut for helpful discussions on the AF model, and to George. B. Moody for independent testing of the computer model.
- Malik M, Camm AJ: Heart Rate Variability. Armonk, NY: Futura; 1995.Google Scholar
- Toivonen L, Kadish A, Kou W, Morady F: Determinants of the ventricular rate during atrial fibrillation. J Am Coll Cardiol 1990, 16: 1194–1200.View ArticleGoogle Scholar
- Fogoros : Antiarrhythmic drugs: A practical guide. Malden: Blackwell Science; 1997.Google Scholar
- Lau CP: Pacing for atrial fibrillation. Heart 2003, 89: 106–112. 10.1136/heart.89.1.106View ArticleGoogle Scholar
- Clifford GD, Azuaje F, McSharry PE, (Eds): Advanced methods and tools for ECG analysis. Boston: Artech House Publishing; 2006.Google Scholar
- Moody GB: RR interval time series modeling: the PhysioNet/Computers in Cardiology Challenge 2002. Comp Cardiol 2002, 29: 125–128.View ArticleGoogle Scholar
- Lian J, Müssig D, Lang V: Computer modeling of ventricular rhythm during atrial fibrillation and ventricular pacing. IEEE Trans Biomed Eng 2006, 53: 1512–1520. 10.1109/TBME.2006.876627View ArticleGoogle Scholar
- AFVP – A Realistic Ventricular Rhythm Model During AF And VP [http://physionet.org/physiotools/afvp/]
- Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, Mietus JE, Moody GB, Peng CK, Stanley HE: PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals. Circulation 2000, 101: e215-e220.View ArticleGoogle Scholar
- Zipes DP, Mendez C, Moe GK: Evidence for summation and voltage dependency in rabbit atrioventricular nodal fibers. Circ Res 1973, 32: 170–177.View ArticleGoogle Scholar
- Cohen RJ, Berger RD, Dushane TE: A quantitative model for the ventricular response during atrial fibrillation. IEEE Trans Biomed Eng 1983, 30: 769–781.View ArticleGoogle Scholar
- Wittkampf FH, de Jongste MJ, Lie HI, Meijler FL: Effect of right ventricular pacing on ventricular rhythm during atrial fibrillation. J Am Coll Cardiol 1988, 11: 539–545.View ArticleGoogle Scholar
- McSharry PE, Clifford GD, Tarassenko L, Smith L: A dynamical model for generating synthetic electrocardiogram signals. IEEE Trans Biomed Eng 2003, 50: 289–294. 10.1109/TBME.2003.808805View ArticleGoogle Scholar
- Lian J, Müssig D, Lang V: Validation of a novel atrial fibrillation model through simulated atrial pacing protocols. Proceedings of the 28th Annual International Conference of the IEEE Engineering in Medicine and Biology Society: 30 August – 3 September 2006; New York City 2006, 4024–4027.View ArticleGoogle Scholar
- Lian J, Müssig D, Lang V: Quantitative comparison of ventricular rate smoothing algorithms for atrial fibrillation [abstract]. Heart Rhythm 2006,3(Suppl 1):S150-S151. 10.1016/j.hrthm.2006.02.450View ArticleGoogle Scholar
- Lian J, Müssig D, Lang V: Adaptive ventricular rate smoothing during atrial fibrillation: a pilot comparison study. Proceedings of the 27th Annual International Conference of the IEEE Engineering in Medicine and Biology Society: 1–4 September 2005; Shanghai 2005, 3881–3884.Google Scholar
- Wittkampf FH, De Jongste MJ: Rate stabilization by right ventricular pacing in patients with atrial fibrillation. Pacing Clin Electrophysiol 1985,9(Pt 2):1147–1153.Google Scholar
- Lian J, Müssig D, Lang V: On the role of ventricular conduction time in rate stabilization for atrial fibrillation. Europace, in press.Google Scholar
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.