Registration and processing of electrocardiosignals (ECS) is widely used in medical diagnostic systems. The active development of functional diagnostics systems based on electrocardiography methods and the improvement of methods for analyzing heart rate parameters necessitate accurate measurements of the amplitude-time parameters of the ECS of different morphology under the influence of various distorting factors [1, 2]. In the development, production and operation of measuring instruments (MI) for medical purposes (for example, electrocardiographs, Holter monitors, cardiomonitors, etc.), it is necessary to conduct monitoring and periodic metrological calibration using working standards. Such standards are special-form signal generators that mimic bioelectric activity signals of the heart [3, 4]. The currently existing systems of verification of electrocardiographic equipment form only standard form test signals, providing basic verification of metrological characteristics in accordance with the accepted standards.

In clinical conditions, the registration of ECS is influenced by multiple instrumental and methodological factors that not only lead to errors in determining the quantitative characteristics of biosignals, but also reduce the effectiveness of the diagnostics. Therefore, the creation of hardware and software systems for biosignal simulation is an important direction in the development of calibration systems for instrumental means of electrophysiological measurements. Such complexes must take into account both the natural and pathological variability of the waveform, certain physiological phenomena, and the existence of various noises and interferences.

Research methods. The simulation signal was developed based on the dynamic model of ECS described in [5]. The dynamic model forms a trajectory of a point with coordinates (x; y; z) in time in three-dimensional phase space. The method of describing a dynamic system is determined when constructing the three-dimensional phase space and the trajectories of a point in this space during each cardiac cycle taking into account the specified morphology of the ECS. Moreover, the duration of the cardiac cycle depends on the heart rate, as measured by the duration of the RR intervals of the ECG.

The mathematical model of the ECS is described by a system of differential equations for the dynamic motion of a point in the phase space:

$$ {\displaystyle \begin{array}{l} dx/ dt=\upalpha x-\upomega y;\\ {} dy/ dt=\upalpha y-\upomega x;\\ {} dz/ dt=-\sum \limits_{i\in \left\{P,Q,R,S,T\right\}}{a}_i{\Delta \uptheta}_i\exp \left[-{\Delta \uptheta}_i^2/\left(2{b}_i^2\right)\right]-\left(z-{z}_0\right),\end{array}}\Big\} $$
(1)

where α = 1 – √(x2 + y2); ω is the angular velocity of the point; P, Q, R, S, T are the characteristic waves of an ECG; ai, bi, θi are parameters that define EGS morphology; Δθi = θ – θi; θ = arctan(y; x); –π/2 < arctan(y; x) < π/2.

The angular velocity of a point in three-dimensional phase space is given as follows:

$$ \upomega (t)=2\uppi / RR(t), $$
(2)

where RR(t) the change in the duration of the RR intervals of the ECG in time.

The change in the duration of RR intervals in time is due to heart rate variability. Heart rate variability reflects cardiovascular system operation and regulation mechanisms of the entire human body. It manifests in all people due to the influences of the autonomic nervous system and the factors of central and neurohumoral regulation on the heart rate [6]. The time variation of the angular velocity ω of the dynamic model described in [5] allowed the author of this article to form a sample of model ECS taking into account the variability of the duration of RR intervals.

The trajectory of motion of a point in three-dimensional phase space, described by the system of differential equations (1), is shown in Fig. 1. The quasi-periodicity of the ECS due to heart rate variability can be traced along the trajectory of movement along a circle of unit radius. This circle is located in the xy plane and is described by the first two equations of system (1). Each turn of the trajectory of movement along the unit circle corresponds to one RR interval of the model ECG.

Fig. 1
figure 1

Trajectory of a point in phase space.

Morphological changes in the ECS occurring between two consecutive heartbeats are reproduced through the trajectory of movement in the direction of the z axis. The characteristic peaks P, Q, R, S, T of the ECS (see Fig. 1) correspond to the successive attractors of this trajectory, which creates a contour of the simulated ECS with realistic morphology. The location of the attractors along the unit circle is given by the angle θi. The parameter ai determines the amplitude of the corresponding ECS peak, and the parameter bi determines the steepness: taller narrower peaks with shorter durations correspond to large bi values, flatter and wider peaks correspond to decreasing bi values.

The influence of various physiological phenomena is modeled by amplitude and frequency modulations. In particular, fluctuations in the amplitude of the ECG R-wave caused by displacements of the electrical axis of a person’s heart during breathing are described by the distribution of the amplitudes aR according to a uniform random law with an expected mathematical mean mR and a standard deviation SDR [7]. Heart rate variability, manifesting in RR interval duration variability, was modeled by changing the angular velocity ω according to expression (2). The sequence of durations of RR intervals was distributed according to the normal law with the mathematical expectation RR0 and standard deviation SDRR. Consequently, by changing the value of z0, it is possible to create an ECG simulation taking into account the additive noise and interference of physical and biological nature present during the measurement.

To form ECS of various morphologies, taking into account, for example, ectopic QRS-complexes, splitting and displacement of the ST-segment, it is necessary to specify the corresponding parameters of the dynamic model. The optimal parameters ai, bi, θi of such a model can be chosen while minimizing the rms error function, defined as

$$ \upvarepsilon \left({a}_i,{b}_i,{\uptheta}_i\right)=\sqrt{\sum \limits_{k=0}^{N-1}{\left[s(k)-z(k)\right]}^2}, $$

where s(k), z(k) are the counts of the real and the model ECS, respectively; N is the total number of counts in the considered biosignal fragments.

Examples of real ECS are given in the database [7]. This database contains various forms of biosignals registered in people with verified diagnoses. Thus, by changing the basic parameters of the dynamic model, it is possible to simulate ECS with the desired morphology taking into account the effects of respiration and heart rate variability, and the distorting effects that occur during measurement in clinical conditions.

As a rule, the considered ECS model with interference and noise is assumed additive. Mathematical models of the distorting effects are based on a priori information about the nature of arising noise. The main types of distortion during ECG measurements are electrical interferences caused by the influence of electrical supply networks, noise of the analogue biosignal recording path, fluctuating polarization potentials of the electrodes. Distortions also include physiological artifacts caused by breathing, human movements, and spontaneous activity of peripheral muscles, which occurs in the projection of superimposed electrodes [1, 2, 8, 9].

A mathematical model describing the influence of external electromagnetic fields from power networks, taking into account the harmonic nature of the signal, can be represented by the following expression:

$$ L(k)={L}_{\mathrm{max}}\sin \left(2\uppi k{f}_P/{f}_S\right), $$

where Lmax is the amplitude of the interference caused by the electrical network; k is the sequence number of the signal; ƒP and ƒS are the frequencies of the electrical supply network and signal discretization of the interference, respectively.

Interference caused by human breathing and displacement of electrodes during involuntary movements leads to distortion of the isoline and the shape of the ECS. In this case, contour drift occurs, that is, a quasi-periodic signal of a stochastic nature, the main frequency band of which is located below the average heart rate [10].

An analysis by the author of the structure and factors affecting the appearance of the drift of the ECS-isoline showed that this type of interference can be described as a sum of deterministic and random components:

$$ W(k){W}_{\mathrm{max}}\left[\sum \limits_{i=1}^4\sin \left(2\uppi {f}_ik/{f}_S\right)+\uppsi (k)\right], $$

where Wmax is the amplitude of the simulated signal of the contour drift; ƒi is the array of frequencies of the additive set of harmonic signals, representing the deterministic component; ψ(k) is the random component obtained by filtering white Gaussian noise through a low pass filter with a cut-off frequency of 1 Hz.

When modeling the drift of the ECS-isoline, the following frequencies were used: ƒ1 = 0.1, ƒ2 = 0.2, ƒ3 = 0.4, ƒ4 = 0.8 Hz, respectively. Studies conducted using an accelerometer placed on a limb of the patient and the subsequent spectral analysis of the registered motion signals showed that the frequency range of these signals, depending on the type of their activity, is 0–5 Hz [11]. The low-frequency component (frequency less than 1 Hz) of motion artifacts partially forms the drift of the ECS isoline.

To describe the influence of high-frequency motor artifacts (frequencies above 1 Hz) on the shape of the ECS, the author used an additive set of four harmonic signals with frequencies of 1, 2, 4, 8 Hz, respectively, with exponential amplitude attenuation:

$$ D(k)={D}_{\mathrm{max}}\left[\sum \limits_{j=1}^4{\left({\mathrm{e}}^{j-1}\right)}^{-1}\sin \left(2\uppi {F}_jk/{f}_s\right)\right], $$

where Dmax is the amplitude of the simulated signal of the motion artifact, and Fj is the frequency array of the corresponding signal harmonics.

Peripheral muscle interference is a random signal of broadband nature. The mathematical description of myographic activity can be represented as a normal Gaussian process with zero mean value and the standard deviation σN [9]. The additive component of interference with a normal distribution also models the influence of the internal noise of the ECG detector and the random nature of the appearance of motion artifacts.

Research results. For the numerical solution of the system of equations (1), the fourth-order Runge–Kutta method was applied, all necessary calculations to obtain simulated ECS were performed in MATLAB R2013a computing environment. Figure 2 shows a fragment of the modeled ECS with a moderate level of distortion. The signal was formed within 10 s. The amplitude of the signal A is indicated in relative units. The simulation signal was obtained using the following values of dynamic model parameters: aP = 1.2, bP = 0.25, θP = –π/3, aQ = –5, bQ = 0.1, θQ = –π/12, aR = 30, bR = 0.1, θR = 0, aS = –7.5, bS = 0.1, θS = π/12, aT = 0.75, bT = 0.4, θT = π/2, mR = 30, SDR = 14, SDRR = 60 ms, RR0 = 900 ms, σN = 2, ƒS = 1000 Hz, ƒP = 50 Hz, Dmax = 0.1, Wmax = 0.3, Lmax = 0.1. Figure 2 proves that the investigated model makes it possible to generate realistic ECS with inherent heart rate variability, pronounced amplitude modulation with typical distorting effects: moderate contour drift and small high-frequency artifacts.

Fig. 2
figure 2

A fragment of the simulated electrocardiogram.

For software and hardware implementation of the proposed approach to the verification of electrocardiographic MI, a block diagram of the ECS simulator was developed (Fig. 3). It should be noted that the ECS simulation device can be easy to implement in practice. The ECS simulator should contain a personal computer PC, a USB interface chip (IC) with galvanic isolation, a microcontroller MC, read-only memory ROM, a digital-to-analog converter DAC, an active low pass filter LPF, software-controlled attenuator Att, analog multiplexer MP, and a calibration switch CS.

Fig. 3
figure 3

A block diagram of the electrocardiogram simulator: PC – personal computer; IC – USB interface chip with galvanic isolation; MC – microcontroller; ROM – read-only memory; DAC – digital to analog converter; LPF – active low pass filter; Att – software-controlled attenuator; MP – analog multiplexer; CS – calibration switch

The central element of the simulator is the microcontroller that exchanges data with the PC through the USB interface, reads simulation signals from ROM, transfers data to the output stage, controls the attenuator and the multiplexer. The simulator output stage includes: a 16-bit precision digital-to-analog converter; attenuator, which includes an 8-bit digital potentiometer for digital control of the transfer coefficient; multichannel analog multiplexer to provide calibration of the standard 12-channel clinical ECS recording systems. Also, the composition of the output stage includes an active second-order low-pass Bessel filter and a calibration switch. The specified filter is implemented using the Sallen–Kay topology and is intended for smoothing the quantization effects in the output signal of a digital-to-analog converter. The calibration switch is necessary to simulate transient resistances that occur at the interface between the electrode and the skin and is a parallel connection of resistive-capacitive passive elements.

The ECG simulator is performed as a programmable device with the ability to download computer generated model ECS in the form of digital files transferred via the USB interface. At the output of the simulator, files are reproduced with given amplitude and time characteristics in analog form. Software adjustment of the attenuation coefficient of the attenuator ensures the formation of test signals with high accuracy and in a wide dynamic range of amplitude change.

The ECS simulator should have an autonomous power source on a high-capacity lithium-ion battery chargeable from the PC. The simulator software will provide the formation of both simulation ECS and standard form test signals (harmonic signals, meanders, single rectangular pulses) at the output terminals of the device, stipulated by the relevant regulations on metrological calibration of electrocardiographic equipment [3, 4]. An ordinary PC operator or operator-metrologist would operate the simulator, select the test signal and set the parameters.

Conclusion. The concept of a new generation of ECS simulators proposed in this work significantly expands the possibilities of metrological verification of electrocardiographic MI. A key feature of this approach is the use of mathematical modeling to account for stochastic noise and noise arising in clinical settings, including motion artifacts and contour drift. The use of mathematical modeling makes it possible to determine the noise immunity of the MI with greater efficiency, to check the accuracy of operation of software filtering and detection algorithms, which is especially important for Holter monitors and electrocardiographic stress systems operating under intense movements (for example, on a treadmill or cycle ergometer) of the examined patient.

In addition to accounting for stochastic noise and noise arising during metrological verification, the concept described in the article provides for the possibility of simulating test biosignals with various types of physiological pathologies. This allows one to additionally check the accuracy of the algorithms of the most modern class of interpreting electrocardiographs able to diagnose the patient automatically. The proposed approach to the construction of the ECS-simulators additionally takes into account physiological phenomena observed in the clinical setting when examining patients, such as heart rate variability and amplitude modulation of the ECS caused by human respiration.

The practical application of such hardware and software systems for simulating biosignals will increase the efficiency of metrological measures, especially for the new generation of diagnostic systems that use non-trivial algorithms for analyzing and interpreting ECS. In addition to the traditional calibration for instrumental errors due to hardware components in electrocardiographic tools, it will be possible to simultaneously test the ECS-processing software and determine the sensitivity and specificity indicators of diagnostic classification algorithms.