{'fraction_non_alphanumeric': 0.03292899589536237, 'fraction_numerical': 0.014335600073515899, 'mean_word_length': 5.06934374419037, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
ECG Patient Simulator Based on Mathematical Models

In this work, we propose a versatile, low-cost, and tunable electronic device to generate realistic electrocardiogram (ECG) waveforms, capable of simulating ECG of patients within a wide range of possibilities. A visual analysis of the clinical ECG register provides the cardiologist with vital physiological information to determine the patient’s heart condition. Because of its clinical significance, there is a strong interest in algorithms and medical ECG measuring devices that acquire, preserve, and process ECG recordings with high fidelity. Bearing this in mind, the proposed electronic device is based on four different mathematical models describing macroscopic heartbeat dynamics with ordinary differential equations. Firstly, we produce full 12-lead ECG profiles by implementing a model comprising a network of heterogeneous oscillators. Then, we implement a discretized reaction–diffusion model in our electronic device to reproduce ECG waveforms from various rhythm disorders. Finally, in order to show the versatility and capabilities of our system, we include two additional models, a ring of three coupled oscillators and a model based on a quasiperiodic motion, which can reproduce a wide range of pathological conditions. With this, the proposed device can reproduce around thirty-two cardiac rhythms with the possibility of exploring different parameter values to simulate new arrhythmias with the same hardware. Our system, which is a hybrid analog–digital circuit, generates realistic ECG signals through digital-to-analog converters whose amplitudes and waveforms are controlled through an interactive and friendly graphic interface. Our ECG patient simulator arises as a promising platform for assessing the performance of electrocardiograph equipment and ECG signal processing software in clinical trials. Additionally the produced 12-lead profiles can be tested in patient monitoring systems.


Introduction
In the cardiac cycle, the so-called systolic and diastolic phases refer to the state of contraction and relaxation in the heart, respectively. Electrical impulses arising from transmembrane ionic currents governs these phases [1][2][3]. As a consequence of this bioelectrical activity, variations in the skin's electrical potential are produced, which can be measured with highly sensitive instruments known as electrocardiographs and electrodes placed at predefined points on the skin surface [4][5][6]. The recording of these potential differences is known as an electrocardiogram (ECG) and represents a clinical tool widely used by cardiologists in routine medical evaluations to determine the pathophysiological conditions of the patient [7][8][9][10][11].
Because of the great significance of ECG waveforms in the diagnosis of cardiovascular diseases, there has been a significant amount of research effort for ensuring that medical electrocardiogram measuring devices [12,13] and biomedical signal processing algorithms [14][15][16] acquire, preserve, and process ECG recordings with high fidelity. In this context, the synthetic ECG patient simulators have emerged as useful tools to test, evaluate, and calibrate electrocardiograph equipment and ECG signal processing software [17][18][19][20][21][22][23][24][25]. In fact, ECG simulators have been proposed not only as a worthwhile tool for equipment and algorithm testing but also as a powerful instrument to assist in the teaching of ECG diagnosis. With its help, ECG interpretation skills of undergraduate medical students can be improved, mainly because a low performances of this medical skill has been reported between students, residents, and physicians [26,27]. Of course, ECG misinterpretations can expose the patient to improper prescription and delays in the right treatment [28,29].
Hitherto, unfortunately, ECG simulators do not fulfill all desirable features of a universal simulator because they show shortcomings in amplitudes, waveforms, and timeintervals of the produced signals. Additionally, most ECG simulators need an internal database of sampled healthy and pathological ECG waveforms. The main disadvantage of these implementations is that the variety of ECG waveforms they produce is limited by the device's storing capability, so they are not a useful tool for a dynamic interpretation of abnormalities in the heart.
In order to overcome these shortcomings, and in light of the importance of mathematical modeling on the understanding of complex biological processes involved in the cardiac conduction system [30][31][32][33][34][35][36], in this work, we propose an ECG patient simulator that implements four different mathematical models to generate realistic ECG waveforms within a broad range of possibilities. Our ECG patient simulator is an electronic device that comprises a hybrid analog-digital circuit formed by 32-bit microcontrollers, digital-toanalog converters (DACs), and general-purpose operational amplifiers (OPAMPs), with the possibility of controlling the amplitudes, waveforms, and parameters of the mathematical models through an interactive and friendly graphic interface. Additionally, the used mathematical models in our electronic device have the advantage of allowing us to explore different parameter conditions to simulate new arrhythmias with the same hardware.
To mimic clinical 12-lead ECG waveforms, we implement an extended heterogeneous oscillator model of the cardiac conduction system [37], whose heart rate can be driven via software. We also implement a discretized reaction-diffusion model [38], a ring of three coupled oscillators [39], and a model based on quasiperiodic motions [40] for reproducing ECG with a great variety of rhythm disorders. Given this, we consider that our electronic device is a useful tool for research, medical education, and clinical testing purposes. In particular, the proposed simulator can be used to assess the performance of electrocardiograph equipment and ECG signal processing software in clinical trials.

Materials and Methods
As already mentioned, most ECG patient simulators use, as a core generator, an internal database comprising sampled healthy and pathological ECG waveforms, which are then analogically played back by a digital-to-analog converter. To avoid this, we implement four different models describing macroscopic heartbeat dynamics with a set of ordinary differential equations, all of them capable of reproducing synthetic ECG waveforms under normal and pathological conditions. In what follows, we briefly review each of the models implemented in the proposed ECG patient simulator.

Heterogeneous Nonlinear Oscillators
A general and useful model to reproduce full 12-lead ECG waveforms is the extended heterogeneous oscillator model of the cardiac conduction system [37]. The first version of this model was proposed by [41], and later, it was applied to simulate the appearance of ventricular fibrillation as an instance of chaos [42]. The model consists of main natural pacemakers represented by modified Van der Pol oscillators [43][44][45], and electrical response of atrial and ventricular muscles (depolarization and repolarization processes) modeled by modified FitzHugh-Nagumo equations [46][47][48].
Natural pacemakers, namely, sinoatrial (SA) node, atrioventricular (AV) node, and His-Purkinje (HP) system, are given by the following sets of ordinary differential equations: where x i stand for action potentials, i = 1, 2, 3 corresponds to SA, AV and HP nodes, respectively. K node denotes the particular coupling constant for each pacemaker, y τ node i = y i (t − τ node ) are the time-delayed coupling components, and τ node is the corresponding coupling time delay. The terms a i , f i , u, d, and e i are the parameters of each oscillator.
The description of the electrical responses of AT and VN muscles are described by: with j = 1, . . . , 4, which refers to the P-wave, Ta-wave, QRS complex, and T-wave, respectively. The magnitude of the stimulation current that couples the SA and HP pacemaker to AT and VN muscles are, respectively, I j = C j Y j H(Y j ), where C j are the corresponding coupling coefficients, H(Y) is the step function, and Y 1 = y 1 , Y 2 = −y 1 , Y 3 = y 3 , and Y 4 = −y 3 from (1). The parameters k j , c j , w j1 , w j2 , b j , h j , and g j control the rest state, the excitability, the duration of the action potential, the excitation threshold, and the excited state of each oscillator.
The net ECG(t) waveform is calculated as a composition of muscle electrical responses in the following way: where z 0 is the baseline value of ECG(t), and α 1 . . . α 4 are the weighting coefficients for each lead, which are given in [37]. It is worth saying that this model can reproduce several well-known rhythm disorders, such as tachycardia, bradycardia, complete SA-AV block, and AV-HP block, by implementing the parameter values reported in [41].

Reaction-Diffusion Model Spatially Discretized
Recently, a model based on a discretized reaction-diffusion system to reproduce electrocardiograms from healthy hearts and various rhythm disorders was introduced [38]. Since the model presents chaotic behavior, it was associated with ventricular fibrillation, which arises from a normal rhythm through the so-called Ruelle-Takens-Newhouse scenario [49], as experimental studies suggest [50,51].
The model comprises a set of three nonlinear oscillators obtained from the spatial discretization of the BVAM model [52], whose variables simulate the main pacemakers in the heart. The model consists of the following ordinary differential equations: Here, H and C are parameters controlling the network's dynamical behavior, and β is the local interaction between oscillators. ECG waveforms can be generated by a linear mixing of the variables x i , as follows: Sinus rhythm, sinus/ventricular tachycardia, atrial/ventricular flutter, and ventricular fibrillation can be reproduced by varying the parameters H, C, and K i as described in [38].

Ring of Three-Coupled Oscillators
A relatively old idea was to consider the heart as a system of nonlinear coupled oscillators. One of the pioneering studies was developed by Van der Pol (VdP) and Van der Mark (VdM) [53]. In [39], a model is proposed consisting of three modified VdP oscillators [43][44][45] that represent the main pacemakers in the heart. This model consists of six ordinary differential equations coupled with time delays: The terms a node , w node i , d node , and e node are the parameters of each oscillator, where the index i = 1, 2 and node corresponds to SA, AV, and HP nodes. k SA−AV , k SA−HP , k AV−SA , k AV−HP , k HP−SA , and k HP−AV denote the particular coupling constant for each pacemaker. The transport delay terms are given by τ SA−AV , τ SA−HP , τ AV−SA , τ AV−HP , τ HP−SA , and τ HP−AV . The amplitudes and frequencies of the periodic driving terms are ρ SA , ρ AV , ρ HP and ω SA , ω AV , ω HP , respectively.
The ECG waveforms are obtained from a linear combination of the variables: where β G is a scaling factor The parameter values used as reference for reproducing sinus rhythm, ventricular flutter, bradycardia and ventricular fibrillation are suggested in [39].

Extended Dynamical Model Based On a Quasi-Periodic Motion
Sayadi et al. [40] developed a Gaussian wave-based state-space to reproduce the temporal dynamics of the ECG waveform, based on a modification of the model proposed in [54]. They showed that their model may be effectively used for generating synthetic ECG waveforms, as well as characteristic waves, such as the atrial and ventricular complexes, i.e., P, QRS, and T.
Assuming the presence of three distinct characteristic waves corresponding to the P wave, QRS complex, and T wave, the ECG waveform is divided into three coupled components, each related to a specific portion of the heart cycle. The proposed mathematical model is: where a i , b i and θ i are the parameters of the Gaussian kernels for each characteristic waveform. P, C, and T represent the P-wave, the QRS complex, and the T-wave, respectively, and the +/− superscripts in P and T denote the two Gaussian waves used to handle asymmetries. P 0 , C 0 , and T 0 are the baseline values, which are assumed to be coupled to the respiratory frequency f r , using: The model has seven events (P − , P + , Q, R, S, T − , T + ), that act as push-pulls in the z-direction as the corresponding trajectory passes around the unit limit cycle in the (x, y) plane. To simulate the quasi-periodicity of the cardiac cycle, the time dependent angular frequency of motion around the limit cycle is obtained by applying the same spectral estimation strategy as in [54], where, in that reference, a i were replaced by a i = α i b 2 i . Finally, the synthetic ECG is obtained as follows: Since the model (8) has a large number of free parameters, it is possible to control the morphological features of the synthetic ECG as described in [40]. This feature allows abnormal morphological changes and several pathological conditions.
In what follows, the main components of the proposed ECG patient simulator are described, that is, the electronic circuits (hardware) and the main algorithms used to solve the mathematical models and display results (software).

Hardware
The proposed electronic circuit of the ECG patient simulator is shown in Figure 1. The hardware comprises two 32-bit microcontrollers (MCU), manufactured by ST Electronics with series STM32F401CCU6 and STM32F103C8T6; digital-to-analog converters (DAC) MCP4921; general-purpose operational amplifiers (OPAMP) LF353; and a Wye resistor network.
The STM32F401CCU6 is a low-cost, high-performance microcontroller of the family ARM Cortex-M4 Cores, which operates at 84 MHz and includes standard communication peripherals, such as SPI, I2C, USB, USART, and CAN. It also incorporates a single-precision floating-point unit, useful for performing calculations in short timing, a set of digital signal processing instructions, and two analog-to-digital converters. This microcontroller is the central core of the proposed ECG patient simulator, responsible for numerically solving, in real-time, the mathematical models and for interfacing via SPI protocol with nine 12-bit DACs, as shown in Figure 1a. These DACS are used to produce a full 12-lead ECG profile, i.e., precordial leads and bipolar and augmented limb leads. We configure the DACs to operate with an external voltage reference and a clock frequency up to 20 MHz provided by the MCU. A stabilized DC power supply provides the required external voltage reference (+5 V) to the DACs. Our ECG patient simulator implements a 320 × 240-pixel color TFT LCD touch screen, which provides a friendly graphical user interface (GUI) to select mathematical models, cardiac rhythms, and parameters. By using a microcontroller STMF103C8T6 operating at 72 MHz and belonging to the ARM Cortex-M3 Core family, we can control the pixels on the LCD screen and scan messages from the touch screen through a parallel bus and two resistive terminals, respectively (see Figure 1b). Information scanned from the TFT touch screen by the slave MCU (STMF103C8T6) is sent to the master MCU (STM32F401CCU6) via SPI protocol. These data allow us to specify the mathematical model and cardiac rhythm that will be solved numerically in the master MCU. The output ECG waveforms are converted to a quasi-analog signal by using DACs. Since the DAC operates voltages on the order of millivolts, the internal noise may adversely affect its performance. To aleviate this, we first include a bypass capacitor to minimize the effect of noise sources on signal integrity, and second, we generate ECG waveforms with amplitudes ten times greater than real ECG amplitudes, including offset levels that simulate baselines. In addition, to simulate ECG waveforms with physiologically consistent amplitudes, the output signals of the converters are passed through a non-inverting amplifier stage, encompassing generalpurpose operational amplifiers and resistors (R 1 , R 2 , R g , and R f ) for producing a differential output signal, as described in Figure 1c. This amplifier provides low offset voltage and low noise. With this design, we can produce ECG waveforms within the range of 0.5 mV to 4 mV with low noise and minimum offset effects.
While the discretized reaction-diffusion model [38], the ring of three coupled oscillators [39], and the model based on a quasiperiodic motion [40] can reproduce only standard Einthoven lead II, the network of heterogeneous oscillators [37] can produce a realistic 12-lead ECG profile. Typically, cardiologists place six electrodes on the patient's chest and four on the limbs to obtain a 12-lead electrocardiogram, including three bipolar limb leads (Lead I, I I, and I I I), three augmented limb leads (aVL, aVF, and aVR), and six precordial leads (V1-V6) ( [3], Chapter 12).
The electrodes placed on the right arm (RA), left arm (LA), and left leg (LL) form an equilateral triangle known as Einthoven's triangle and give place to the bipolar limb leads. The three bipolar limb leads in Einthoven's triangle, denoted by I, I I and I I I, can be obtained by Equation (11) and satisfy the relationship I I = I + I I I: The augmented limb leads and precordial leads are the electrical potential differences between physical and virtual electrodes [55]. For the augmented limb leads aVF, aVL, and aVR, the physical electrodes correspond to RA, LA, and LL, and the virtual electrode is the so-called Goldberger's central terminal, whose potential is the mean voltage of two limb electrodes that remain when an electrode is selected. In this way, augmented limb leads can be written as functions of the physical electrodes RA, LA, and LL as follows: Typically, patient monitoring systems, such as electrocardiographs, derive the bipolar and augmented limb leads from the limb electrodes. In this regard, our ECG patient simulator solely generates these three ground-referenced electrical potentials to obtain the six first leads: I, I I, I I I, aVL, aVR, and aVF. As shown in Figure 1d, we implement a Wye resistor network to satisfy Equations (11) and (12). The voltages of each terminal in the Wye connection are supplied by three DACs with series MCP4921.
Precordial leads, labeled by V1, V2,. . .,V6, are unipolar potentials referenced to a common electrode known as the Wilson central terminal. This terminal is a theoretical point computed by the mean voltage of the limb electrodes. By Kirchhoff's laws, the sum of the electrical potentials in the limb electrodes is zero. So, the Wilson terminal works as the reference point for the six electrodes placed on the chest. In our electronic device, the Wilson center was set to zero, allowing us to directly reproduce the precordial leads by using ground-referenced DACs.
The described ECG patient simulator cannot only generate a full 12lLead profile by numerically integrating the extended heterogeneous oscillator model of the cardiac conduction system but it can also produce a single lead, specifically the standard Einthoven lead II. The user can select the mathematical model in order to specify the arrhythmia through the TFT touch LCD display.

Software
The algorithms embedded in the STM32F401CCU6 and STM32F103C8T6 microcontrollers are described in what follows. Figure 2i shows the flowchart for both microcontrollers. For an easy configuration of the STM32F401CCU6 and STM32F103C8T6 microcontrollers, we use STM32 Cube MX and STM32 Cube IDE as integrated development environments (IDE). Both of them include a graphical tool that allows setting peripherals, clock, and general-purpose inputs/outputs. The STM32F103C8T6 manages the user interface (shown in Figure 2ii) in the TFT LCD Screen via an 8-bit parallel protocol and reads the LCD's resistive touch panel using two analog-to-digital channels. This MCU generates a configuration word from the data introduced by users through the GUI shown in Figure 2ii, whose screens are related to: (a) model selection, (b) arrhythmia selection, and (e) parameter settings. It should be noted that we have preloaded the parameter values for each rhythm so that the user does not have to introduce parameters one by one. This allows them to easily choose a particular ECG waveform through the graphic interface (model selection and arrhythmia selection menus). However, the proposed system can be set by individually changing the parameter values to explore different conditions through the parameter settings menu. The graphical interface also includes some controls to play or pause the generation of ECG waveforms, as displayed in Figure 2ii(c,d). To interface with the LCD display, bits A8-A15 from port A and bits B3-B5 and B12-B15 from port B are configured as push-pull outputs at maximum speed. The STM32F401CCU6 and STM32F103C8T6 microcontrollers communicate with each other via the SPI peripheral. Here, the STM32F401CCU6 microcontroller is a slave transmitter, whose bits A7, A5, and B4 from port A and port B are reserved for MOSI, SCK, and MISO signals, respectively. While Channels IN0 and IN1 from analog-to-digital converter 1 are configured to read V x and V y from the touch interface, bit A6 from port A is set as a push-pull output at maximum speed for the play/pause instruction. The STM32F401CCU6 microcontroller receives and initializes the user-defined model parameters, which are encoded in the configuration bits provided by the STM32F103C8T6 microcontroller. From this information, STM32F401CCU6 solves the selected mathematical model through the fourth-order Runge-Kutta (RK4) method. We have included the numerical method within a looping function, which checks, in each iteration, the state of the play/pause bit coming from the STM32F103C8T6 microcontroller. The integration step used for solving each model is obtained by measuring the computing time of one iteration plus the time that the MCU takes to send data to the DAC via the SPI peripheral. It is important to say that two of the four models integrated into the ECG patient simulator include time delays in the coupling, which requires solving a set of delayed differential equations. To overcome this issue, we create an array that buffers a certain number of samples from the delayed signal. The amount of samples depends on the ratio of the transport delay terms and the integration step.
Finally, to individually control each MCP4921 DAC's, Bits A8-A15 from port A and bits B12-B15 from port B are configured as chip select and bit A6 as the latch. The STM32F401CCU6 microcontroller implements an SPI1 peripheral that works as a halfduplex master at 18 MBits/s. To do this, the APB2 Bus is set to 36 MHz, reserving bits A7, A5, and B4 from A and B ports for the MOSI, SCK, and MISO signals, respectively. Bit A8 from port A is configured as an input for the play/pause instruction.

Results
The microcontroller and passive electronic components were mounted on a twolayered printed circuit board (PCB) to avoid faulty contacts and poor stability. The whole PCB was designed in EasyEDA Software. The ECG patient simulator implemented in the PCB is presented in Figure 3i. The microcontrollers that manage the communication protocol with the TFT LCD touch screen (red square) and the generation of ECG waveforms are indicated with cyan and gray squares, respectively. The green and orange squares indicate the digital-to-analog conversion stage and the output amplifiers, respectively. In the same Figure, the synthetic ECG waveforms are provided through the connector marked with a purple square. Figure 3ii shows the whole electronic circuit, i.e., the core for the generation of ECG signals and the TFT LCD touch screen. Normal synthetic ECG signals generated by the proposed ECG patient simulator are presented in Figure 3iii. Table 1 shows the parameter values for reproduce these cardiac rhythms. We obtain a full 12-lead ECG profile by integrating the heterogeneous oscillator model of the cardiac conduction system as shown in Figure 3iii(a). An ECG waveform (standard Einthoven lead II) generated with the discretized BVAM model is shown in Figure 3iii(b). The normal ECG waveforms produced by the model based on a ring of three coupled oscillators and the model based on a quasiperiodic motion are shown in Figure  3iii(c,d), respectively. Notably, the ECG signals presented in Figure 3iii(b,d) exhibit the characteristic peaks and troughs of the ECG waveform, i.e., the P wave, QRS complex, and T wave. These events are associated with the successive atrial depolarization/repolarization and ventricular depolarization/repolarization, which occurs with every heartbeat. It should be said that the discretized reaction-diffusion model and the ring of three coupled oscillators can only reproduce general features of the normal ECG, though they are capable of generating different arrhythmias effectively. On the contrary, the network of heterogeneous oscillators and the model based on a quasiperiodic motion incorporate substantial details in the simulated signals that lead to realistic ECG waveforms, but the complexity of the models increases. Table 1. Parameter values for reproducing normal rhythms using different models. In the model based on a quasiperiodic motion, the parameters of the Gaussian kernels are expressed by the values of (a i , b i , θ i ) for each characteristic waveform.

Pathology Parameters
Network of heterogeneous oscillators Discretized reaction-diffusion model Ring of three coupled oscillators Since the network of heterogeneous oscillators is the sole model that reproduces a full 12-lead ECG profile, we assess it in a commercial electrocardiograph, which is a monitoring device consisting of an interpretive 12-channel electrocardiogram machine, with series CardioCare 2000. The monitoring equipment recognizes the synthetic ECG signals effectively, as shown in Figure 4.

Rhythm Disorders
In what follows, we show different arrhythmia that the proposed system can reproduce. We would like to emphasize that in most models, the parameter values for the arrhythmias are the same as for the normal state. So, in the subsequent sections, we will only specify those parameters that change.

Network of Heterogeneous Oscillators
To validate the proposed ECG simulator, we first reproduce two well-known rhythm disorders, complete SA-AV and AV-HP blocks, by integrating the heterogeneous oscillator model of the cardiac conduction system (3). The results are shown in Figure 5. A complete SA-AV block indicates the loss of communication between the SA node and the AV node. Here, the SA node cannot control the heart rate, leading to a lack of coordination of the depolarization/repolarization processes in the atria and ventricles. We reproduced the complete SA-AV block by setting the coupling constant K SA−AV = 0. In contrast, for the complete AV-HP block (K AV−HP = 0), the HP complex acts independently at its own rate and the SA and AV nodes operate coupled at a normal rhythm. Consequently, atria work normally, and ventricles take action at a slow rate.   Table 2. Sinus tachycardia is a cardiac rhythm characterized by a faster-than-usual heartbeat. Similarly, atrial flutter refers to a condition in which the upper chambers beat too quickly. However, the former condition is generally not dangerous, but the second one produces insufficient blood pumping, which can lead to heart failure [56,57]. Lethal cardiac arrhythmias frequently result from reentry mechanisms; specifically, ventricular tachycardia and ventricular flutter are re-entrant ventricular tachyarrhythmias that can progress to ventricular fibrillation. Ventricular tachycardia occurs when the lower chamber of the heart (ventricles) beats faster than 120 beats/min, whereas ventricular flutter is a rapid organized rhythm, between 250 and 300 beats/min, characterized by a sine wave pattern on the electrocardiogram without any identifiable QRS complexes or T waves [58,59].

Ring of Three-Coupled Oscillators
By integrating the model (6) in the proposed device, we reproduce three pathological rhythms: sinus bradycardia, atrial flutter, and ventricular fibrillation, which are shown in Figure 7. Sinus bradycardia is a common heart rhythm defined by a slow, regular heartbeat of fewer than 60 beats/min [56]. In contrast, ventricular fibrillation is a severe and totally disorganized rhythm that leads to death if no immediate medical attention is provided [59]. Interestingly, ventricular fibrillation has been associated with chaotic behavior; this fact has motivated the investigation and development of new devices to control it. In this context, ECG simulators have provided a significant tool to design and test these devices [60][61][62].
The parameter values corresponding to the three pathologies are shown in Table 3. In Figure 8, arrhythmias generated with the extended dynamical model based on a quasi-periodic motion are shown. These include sinus bradycardia, sinus tachycardia, ventricular flutter, atrial fibrillation, and ventricular tachycardia. The corresponding parameter values are presented in Table 4. As mentioned above, sinus bradycardia and sinus tachycardia are not serious arrhythmias, in fact, they often do not require treatment. However, there are abnormalities of cardiac rhythm that are potentially dangerous. For example, atrial fibrillation causes irregular heartbeats that begin in the upper chambers and can produce blood clots, limiting the ability to pump blood into the body. We would like to stress that the proposed ECG simulator can generate a wide range of pathological conditions, so it provides a promising platform not only to train arrhythmia classifiers and detectors [63,64] but also to assess ECG signal processing software. Signal denoising is a remarkable example where synthetic waveforms can help attenuate the noise of real ECG signals by providing a reference profile to wave detector [65].

Discussion
In the last years, synthetic ECG patient simulators have been developed to test, calibrate, and assess electrocardiograph equipment and ECG waveform processing software. Most of these simulators have shortcomings in the amplitudes, range, waveforms, and time-intervals of the produced signals. To overcome these shortcomings, and in light of the importance of mathematical modeling for the understanding of complex biological processes involved in the cardiac conduction system, we introduced a versatile, low-cost, and tunable electronic device implementing an ECG patient simulator based on four mathematical models to generate realistic ECG waveforms within a broad range of possibilities. It is worth mentioning that the ECG profiles generated by the models incorporated in our ECG patient simulator were already compared with clinical registers in the corresponding works where they were published. In particular, the network of heterogeneous oscillators and the model based on a quasiperiodic motion incorporate substantial details in the simulated ECG signals that lead to realistic waveforms. Furthermore, the discretized reaction-diffusion model and the ring of three coupled oscillators can generate different arrhythmias effectively by changing a few parameters. One of the most significant features of our ECG patient simulator is the possibility of controlling parameters of the mathematical models through an interactive and friendly graphic interface. In addition, the proposed ECG patient simulator is able to produce a full 12-lead ECG profile, which can be tested in patient monitoring systems. We are certain that our proposal constitutes a promising platform for testing medical equipment and biological signal processing algorithms, as well as a powerful tool for medical education and academic research. The proposed system can be considered as an alternative to calibrate, test, and certify ECG devices in order to confirm the level of confidence in the manufacturers' specifications. Future research directions could be the training and evaluation of automated diagnosis systems and the development of a cardiac defibrillator to control, in an efficient way, irregular and chaotic heartbeats associated with ventricular fibrillation. Data Availability Statement: Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: