Heart model

Demonstration of the human heart model and how it can be used to HIL-test biomedical device performance in a heart with different medical conditions.


Biomedical devices must respect stringent criteria to make them safe, effective, and robust before they can be tested in the field by implanting them in a living being. In these contexts, real-time simulators combined with Hardware-in-the-loop methodologies permit us to validate and improve algorithms before the field-testing stage, greatly reducing the risk to test patients. Among the variety of devices, this application note focuses on those connected to the heart. A model of a human heart is implemented using the equations described originally in Ryzhii et al [1] and reorganized to be deployed in the HIL402 Hardware in the Loop simulator. By adjusting the parameters of the equations, it is possible to alter the output signal's characteristics, allowing simulation of different cardiac conditions, such as a heart affected by tachycardia, bradycardia, and/or atrial fibrillation.

This model's objective is to be a reference framework for the development and testing of biomedical devices that have to interact with the human heart (such as pacemakers, ECG analyzers, etc.). The result is a powerful simulator (the functional architecture is shown in Figure 1) which is easy to use and configure for several purposes, such as the one described in Di Mascio et al [2].

Figure 1. Functional architecture of the proposed framework

Model description

The heart is one of the most essential organs in the human body, and therefore is very well studied. Its behavior is the result of an intelligent combination of electrical phenomena. From the point of view of mathematical equations, it can be compared to an oscillator that by acting on the heart tissues allows blood to pump. Electrical signals stimulate the tissues starting from the sinoatrial node (SN), which is in the right atrium at the superior vena cava. When the signal propagates, a contraction occurs. The electrical impulse then reaches the atrioventricular (AV) node, which sends stimulation to the lower heart chambers (the ventricles), contracting them and pumping blood. Afterwards, the SN node sends another signal to the atria and the process begins again.

The equations describing the whole behavior are reported in [1] and [2] and describe the heart's conduction system as three natural pacemakers based on modified van der Pol's equations with a unidirectional time-delay velocity coupling.

Figure 2. Typhoon HIL schematic of the conduction dynamic in the Heart Signal Processing toolbox.

Figure 2 reports the dynamic conduction schematic, starting from the left with the SinoAtrial (SN) node connected to the atrioventricular node (AV). The equations are delayed differential equations (DDEs) with constant delays.

The second system of equations represents the ECG's waves, as shown in Figure 3. The terms constitute the link between the two parts of the mathematical model where IATDE, IATRE IVNDE, and IVNRE represent the ionic currents. Combining the AT and VN muscles' results as reported in Figure 4 shows it is possible to reconstruct the whole ECG.

Figure 3. Typhoon HIL Schematics for the generation of the ECG components.

The tentative parameters of the model are defined in [1]

  • Scaling coefficients: k 1 = 2 x 10 3 , k 2 = 4 x 10 2 , k 3 = 10 4 , k 4 = 2 x 10 3
  • Parameters defining the amplitude of a pulse: c 1 = 0.26 , c 2 = 0.26 , c 3 = 0.12 , c 4 = 0.1 ;
  • Parameters changing the rest state and dynamics: b 1 = 0.0 , b 2 = 0.0 , b 3 = 0.015 , b 4 = 0.0 ;
  • Parameters controlling the hyperpolarization of the excitation variable: d 1 = 0.4 , d 2 = 0.4 , d 3 = 0.09 , d 4 = 0.1 ;
  • Parameters representing excitability and controlling the abruptness of activation and the duration of the action potential: h 1 = 0.04 , h 2 = 0.02 , h 3 = 0.08 , h 4 = 0.08 ;
  • Parameters changing the rest state and dynamics: g 1 = 1.0 , g 2 = 1.0 , g 3 = 1.0 , g 4 = 1.0 ;
  • Parameters controlling excitation Threshold: w 11 = 0.13 , w 21 = 0.19 , w 31 = 0.12 , w 41 = 0.22 ;
  • Parameters controlling excited state: w 12 = 1.0 , w 22 = 1.0 , w 32 = 1.1 , w 42 = 0.8 ;
  • Coupling coefficient for P wave: K ATDe = 4 x 10 -5 ;
  • Coupling coefficient for Ta wave: K ATRe = 4 x 10 -5 ;
  • Coupling coefficient for QRS complex: K VNDe = 9 x 10 -5 ;
  • Coupling coefficient for T wave: K VNRe = 6 x 10 -5 .
    Figure 4. Typhoon HIL Schematics for generating the ECG signal
Table 1. HIL device resource utilization
No. of processing cores 1
Max. matrix memory utilization 0.02%
Max. time slot utilization 40%
Simulation step, electrical 0.5µs
Execution rate, signal processing 100µs


This application comes with a pre-built SCADA panel. It offers the most essential user interface elements (widgets) to monitor and interact with the simulation at runtime, allowing you to further customize it according to your needs.Figure 5 shows the SCADA used for the control of simulation and to check the results. There are three subpanels inside. On the left, the first one allows for changing the value of parameter f 1 (described in [2]). This parameter controls the SN node's pulse rate: the higher the parameter, the higher the heartbeat frequency. At simulation start, the SCADA panel will propose default physiological conditions. Changing the SCADA parameters will modify how the heart works. The colors and messages displayed say in which region the heart is working. In the lower panel, the scope shows the ECG waveform, reproducing the selected condition. The reconstructed ECGs are coherent with the main ECG features, but fine-tuning the model parameters is needed to fit the physiological data.
Figure 5. Heart SCADA panel.
Figure 6. Bradycardia. Setting the f 1 parameter lower than 18 causes the model to emulate Bradycardia.
On the right side, the panel allows for simulation of atrial defects. Atrial fibrillation (AF) is an abnormal and irregular heart rhythm in which electrical signals are generated chaotically throughout the upper atria (chambers) of the heart. In the presence of AF, the sinoatrial node in the right atrium produces disorganized impulses, causing irregular conduction of the ventricular impulses that generate heartbeats. To do this, we act on four parameters:
  • the P-wave is set to 0;
  • the f 3 , which controls the amplitude of pulsation in the HP fiber, is reduced ( f 3 = 1 );
  • a 3 , which is the pacemaker's damping coefficient, is also reduced ( a 3 = 45 ) to prolong the swing;
  • and k 4 = 100 is set to reduce the amplitude of the T wave in the ECG.

The generated wave, including the ECG, are also reproduced as a physical signal by the HIL hardware.

Figure 7. Heart Physical Experiment: The waveform reproduced as an external signal can be used to test biomedical devices.
Table 2. Minimum requirements
Typhoon HIL files examples\models\medical devices\heart model heart\ model .tse heart model .cus, etc.
Minimum hardware requirements
No. of HIL devices 1
HIL device model HIL402
Device configuration 1


[1] Ryzhii, E.; Ryzhii, M. A heterogeneous coupled oscillator model for simulation of ECG signals. Comput. Methods Programs Biomed. 2014, 117, 40–49.

[2] Di Mascio, C.; Gruosso, G. Hardware in the Loop Implementation of the Oscillator-based Heart Model: A Framework for Testing Medical Devices. Electronics, 2020, 9, 571. https://doi.org/10.3390/electronics9040571

Test Automation

We don’t have a test automation for this example yet. Let us know if you wish to contribute and we will gladly have you signed on the application note!


[1] Prof. Giambattista Gruosso, [email protected]