Paper—Simulation of Abnormal Physiological Signals in a Phantom for Bioengineering Education Simulation of Abnormal Physiological Signals in a Phantom for Bioengineering Education

In clinical practice and in particular in the diagnostic process, the assessment of cardiac and respiratory functions is supported by electrocardiogram and auscultation. These exams are non-invasive, quick and inexpensive to perform and easy to interpret. For these reasons, this type of assessment is a constant in the daily life of a clinician and the information obtained is central to the decision-making process. Therefore, it is essential that during their training, students of health-related subjects acquire skills in the acquisition and evaluation of the referred physiological signals. Simulation, considering the technological possibilities of today, is an excellent preparation tool since it exposes trainees to near real contexts but without the associated risks. Hence, the simulation of physiological signals plays an important role in the education of healthcare professionals, bioengineering professionals and also in the development and calibration of medical devices. This paper describes a project to develop synchronized electrocardiogram (ECG), phonocardiogram (PCG) and breathing sounds simulators that aims to improve an existing phantom simulator. The developed system allows, in an integrated way, to generate normal and pathological signals, being contemplated several distinct pathologies. For engineering education, it is also possible to simulate the introduction of signal disturbances or hardware malfunctions. Keywords—Biomedical signals, ECG, PCG, breathing sounds, simulation, modeling, Bioengineering education


Pathologies and Diagnostic methods
Cardiovascular diseases (CVDs) are still the number one cause of death globally, taking approximately 17.9 million lives each year corresponding to an estimated 31.8% of all deaths worldwide, according to the World Health Organization (WHO) [1]. Respiratory diseases and lower respiratory infections, the third and fourth leading causes of death, represent 6.4 million deaths (11.6 %). All these, together, are responsible by 43.4 % of deaths worldwide, with increased expression in developed countries. Improving these numbers requires reducing exposure to disease-inducing factors but also working in the fields of prevention and monitoring. Early diagnosis and appropriate therapy are often effective in eliminating or delaying the disease progression. Frequent monitoring of cardiac and respiratory functions can be conveniently performed by simple, non-invasive and cost-effective procedures using electrocardiogram (ECG), phonocardiogram (PCG) and auscultation. In fact, these simple examinations, provide crucial information for the diagnosis of the above-mentioned diseases and thus solid education and training in these topics are paramount.
The assessment of heart sounds, PCG, is a simple procedure that can be performed by healthcare practitioners as a routine. It can be useful to identify abnormal sounds for further investigation or to detect pathologies [2]. In addition, PCG analysis, often performed with intelligent and automated equipment, allows monitoring of the effect of certain cardiac drugs on the condition of the heart [3].
According to WHO data, more than 5 % of the population suffers from respiratory problems, especially asthma. In addition to this evidence, over 14 % of deaths in 2002 were caused by respiratory system-related diseases [4].
The use of auscultation to detect respiratory diseases is recurrent in clinical practice. This procedure is also non-invasive and allows rapid detection of pathologies or pathological patterns. Therefore, as the most basic semiotic method, the detection and identification of lung sounds becomes one of the first tests by which physicians guide themselves in defining the current diagnosis and the resulting therapy [4].
The ECG is an essential tool in the evaluation of the cardiac function. The detailed study and methodological analysis of the ECG components (waves, intervals and segments) form the basis of its interpretation [5], [6]. It has many applications in the clinical diagnosis and prognosis of CVDs, as well as in health assessment, biomedical recognition, fatigue studies, and other areas [7]- [9].

Simulation in healthcare and engineering education
Simulation is a valuable tool in the education and training of professionals, exposing students to near real situations while using controlled conditions. For medical students it can be an alternative to real patients providing replicated clinical scenarios where the trainee can practice and learn with a controlled sequence of tasks, while preventing dangerous situations. For biomedical engineering students it helps on gaining insight on physiological signals, understand their acquisition and associated problems, learn how to tackle common disturbances on the process. Overall, simulation allows the acquisition of skills through deliberate practice rather than an apprentice style of learning and students can be exposed to situations that occur on a daily basis but also to others that rarely happen in the real world [10], [11]. Additionally, this tool is also used in the testing and evaluation of the performance of acquisition systems and medical equipment, such as electrocardiographs [12].
The main purpose of this work it to design and develop two digital low-cost simulators that can be used as educational tools mainly for the medical field but also for biomedical engineering: one for the ECG and the other for both the PCG and the breathing sounds. Both simulators can generate normal and pathological signals allowing the replication of multiple clinical scenarios.
Regarding ECG simulators, there are systems available designed to test medical equipment generally in the form of standalone hardware units that are capable of physically simulating ECG signals [13]. Besides such devices, there are software simulators designed to support the education of future health professionals without any physical output [14], [15]. The developed ECG simulator aims to combine the advantages of both systems. On one hand, a graphical user interface (GUI) allows the intuitive selection of signal parameters, control over the simulation and on-screen visualization of the simulated signal. On the other hand, the system is also capable of producing an electric signal that can be measured by acquisition equipment.
The Biomedical Simulation Center CHP-ICBAS in Portugal has currently a human simulator with some functionalities that brings it close to reality, such as movement of the chest, mouth, eyes and tongue, and SpO2 signal (oxygen saturation in the blood). However, it lacks some important aspects in addition to having no breathing or heart sounds, also has no ECG simulation and arterial blood pressure. Both simulators are meant to be incorporated in this existing phantom.

Methods
For both simulators, GUIs were developed with MATLAB®. The GUIs allow the user to adjust several signal parameters, control the simulation and to visualize the simulated signal graphically. Physical output can be produced allowing the user to measure/record the simulated signal. The block diagram of the general operation process of both simulators is represented in Fig 1. Real signals (directly acquired from the human body), taken from publicly available databases, were used as templates for the signal generation processes of both simulators, hence providing a realistic output.

ECG simulator
Through the GUI, the ECG simulator allows the selection of several signal parameters, including: • Beat type, having 6 possible selections, including normal and abnormal signals.
iJOE -Vol. 16, No. 14, 2020 • Heart rate (HR) in the interval from 30 to 200 beats per minute (bpm) with a resolution of 0.1 bpm. The resting cardiac activity can be classified regarding HR in bradycardia (when HR is below 60 bpm), tachycardia (HR higher than 100 bpm) and normal (HR value between 60 bpm and 100 bpm) [16]. • Signal amplitude from 0 to 5 mV with a resolution of 0.1 mV. • Artefacts, having 2 possible selections (power line interference and baseline wander) and the respective intensity, from 0 to 1 mV with a resolution of 0.1 mV.
A real ECG lead II normal signal with a sinus rhythm from a healthy person was obtained from the Physikalisch-Technische Bundesanstalt (PTB) diagnostic database available in the Physio Bank [17], [18]. The QRS complex, the P wave and the T wave were identified and separated.
The ECG Simulator generates lead II ECG signal with a heart rate (HR) dependent profile. Second order equations, determined in a previous work by Burke and Nasor [13], allow the calculation of the duration of each ECG component for a given HR value, generating an ECG signal profile that changes accordingly with HR, as can be seen in Fig 2. The components extracted from the patterns database are then resampled (interpolated) according to the duration calculated using the mentioned equations. ECG segments (isoelectric sections between waves) are synthetized as arrays of zeros with the calculated length. The abnormal types are simulated through the change of parts of the sinus rhythm beat achieving a morphology similar to the real pathological characteristic signals, as can be seen in  The user can control the simulation through the GUI that can be seen in Fig 4. After the signal parameters are selected and the user clicks in the 'Simulate' button the simulation begins. The physical output is achieved using a low-cost open-source microcontroller board, Arduino UNO R3 and an electronic circuit, schematically presented in Fig 5. If the user selects the checkbox relative to physical output ('Output with Arduino') and indicates the serial port that the Arduino is connected to, the signal is transmitted to the Arduino board using serial communication via an USB port.
The Arduino UNO board can't directly generate an analog output, but it can output a pulse width modulation (PWM) signal that combined with a low-pass filter can be used to produce an analog signal with an amplitude range from 0 to 5 V [19].
Taking into account that the ECG signal generally has negative voltage components and the amplitude has to be adjusted to the value chosen by the user. The designed solution consists in: 1. Adjusting the ECG voltage values proportionally so that the baseline (0 V) from the synthetized signal corresponds to 2.5 V output from the low-pass filter.
2. Amplifying, with a gain smaller than 1 (therefore attenuating), the difference between the signal from the filter and a DC signal of 2.5 V, so that the maximum voltage corresponds to the value selected by the user. The designed circuit, schematically represented in Fig 5, is essentially composed by two stages: (a) third-order active low pass filter (Sallen-Key topology) with a cutoff frequency of approximately 106 Hz (slightly higher than the typically clinical ECG maximum useful frequency of 100 Hz [20]) and (b) a differential amplifier that receives the filtered signal and 2.5 V DC signal from a voltage divider (resistors R5 and R6) producing the resulting attenuated signal with a gain of 0.002.
Signal artifacts are simulated using values from a sine function with the amplitude selected by the user and a frequency related to the chosen type: 50 Hz for the power line interference and 0.5 Hz for the baseline wander [21].
The low cost, low power consumption dual op-amp TL082 was used and the circuit was assembled in a breadboard.
The signal shown in the GUI is animated resembling an ECG signal being measured in real-time by a vital sign monitor with the traditional green tracing over a black background, providing an immersive educative experience to the student. A new simulation is possible clicking in the 'Stop' button in the GUI allowing the user to edit the signal parameters. Fig 6 presents the entire simulator system including the computer running the GUI, the Arduino board, the electronic circuit in a breadboard and a digital oscilloscope (GW Instek GDS-2062) for acquiring the output signal.   6. The complete ECG simulation system: computer running the simulation software (1). The Arduino board producing a PWM signal (2) that is then converted by an electronic circuit (3) and a digital oscilloscope measuring the output signal (4).

PCG and breathing sounds simulator
Through the GUI, PCG and Breathing Sounds simulator allows the selection of several signal parameters, including: • PCG signal type, which allows the user to choose between normal and pathological cardiac sounds such as premature atrial contraction sounds, 2nd degree type II sinoatrial block, mitral regurgitation and mitral stenosis. • Heart rate (HR), allowing the user to adjust this value similarly to the ECG simulator.
• Amplitude, in which it is possible to adjust the sound intensity to the desired level.
• Type of respiratory sound signal, in which the user can also simulate normal and pathological respiratory signals. The pathological signals implemented refer to apnea (absence of breathing activity), wheezing sounds and crackling sounds.
The Clini Surf database [22] allows the selection of the type of pathology desired and the place of auscultation. Regarding heart sounds, the apex of the heart was chosen as the place of auscultation for all extracted signals. The sampling frequency of the sounds available in this database is 44.1 kHz.
Initially, a cardiac sound recorded from a healthy subject was downloaded. Then the sound file was loaded and visualized graphically. Start and end positions of the first heart sound (S1) and the second heart sound (S2) were identified. The signals were isolated and stored in separated files.
Accordingly, Fig 7 shows the identification of the limits of the S1 (a) and S2 (b) heart sounds.
Breathing sounds were extracted from the Respiratory Sound Database created by two research teams in Portugal and Greece. This database was accessed through the Kaggle platform [23]. From this database, a normal record was extracted from which a segment corresponding to a complete respiratory cycle (inspiration and expiration) was identified and stored in a separate file. This sound's graphical representation is presented in Fig 8. Two complete breathing cycles containing abnormal respiratory noises (crackles and wheezes, respectively) were identified from records in this database and stored separately. Fig. 7. Identification of the regions corresponding to the S1(a) and S2 (b) heart sounds. Similarly, to the ECG simulation process, the PCG simulated signal is also influenced by the HR value. An HR dependent equation based on the work of Segaier et al. [24], is used allowing the calculation of the systolic period (Tsyst): In equation (1), Tsyst represents the systolic period in seconds and HR represents the heart rate value chosen by the user, in bpm.
The diastolic period is calculated through the difference between the total cardiac cycle duration (60/HR) and the Tsyst.
In the normal PCG type, the S1 and S2 are inserted in the beginning of the systolic and diastolic period, respectively. To the remaining samples of each cardiac phase is then attributed the value of zero (no sound) in order to achieve the calculated duration.
Abnormal PCG types available in the simulator can be divided in two major classes: • Murmur based signal types, in which every cardiac cycle contains a murmur segment indicative of heart pathology. • Probability based cardiac occurrences, in which a specific cardiac event can happen in some cardiac cycles and the occurrence decision is made randomly.
Murmur segments were extracted from the database, isolated and stored. Simulation of murmur based pathological signals consists of introducing the murmur in the proper position in the cardiac cycle. For example, in the case of the mitral stenosis type the isolated murmur can be seen in Fig 9. This murmur is placed in the diastolic phase right after the S2 sound, as shown in Fig 10. Regarding the probability based PCG types (premature atrial contraction and the 2nd degree type II sinoatrial block) in each cardiac cycle there is the possibility of event occurrence (in case of sinoatrial block there is no beat, in case of premature atrial contraction there is a premature beat making the diastole shorter).
This determination is made randomly using a function that generates an aleatory number in an interval (0 to 1) and the generated number is then compared to a preset.  value (0.1, for example). If the generated number is smaller than the pre-established value, the event occurs.

Paper-Simulation of Abnormal Physiological Signals in a Phantom for Bioengineering Education
In the graphical interface, one of the parameters allows the user to adjust the number of periods visible in each window.
Cardiac and respiratory signals are continuously displayed and outputted sonorously. To revalidate a new simulation, the user must change the input parameters and click the 'Simulate' button. When it reaches the end of the displayed graph, the current window is renewed, allowing a continuous simulation. Both sounds' amplitudes are adjustable and the simulated signals are physically generated simultaneously.

Results and Discussion
In order to evaluate the functionality of the developed simulators tests were performed for both the ECG and the PCG/Breathing sounds simulators.

ECG simulator
A digital oscilloscope (GW Instek GDS-2062) was used to record the electrical output produced by the Arduino and the electronic circuit. Fig 11 (a) shows the GUI output of a sinus rhythm ECG signal with a HR of 60 bpm and a amplitude of 5 mV and Fig 11(b) shows the signal output from the low-pass filter recorded in the oscilloscope. Both signals are very similar visually.
Several other tests were performed, changing all the signal parameters, producing generally satisfactory responses, corresponding to what was theoretically expected. Figure 12 exhibits both the graphical (a) and physical (b) outputs from a normal sinus rhythm 60 bpm 1 mV amplitude ECG signal with a 0.4 mV baseline wonder artifact. As can be seen, both outputs clearly show the presence of this artifact.
The differential amplifier output contained a substantial amount of noise most likely due to the fact that the circuit assembly was done in a breadboard the signal outputted from, the circuit implementation can be improved in the future by using a printed circuit board (PCB).  Fig 13 shows the results of a normal cardiac and respiratory sounds for an individual with a 60-bpm heart rate. The first and second heart sounds are well highlighted. Systole and diastole times are proportional, respecting the equation mentioned by Segaier et al. [18].

PCG and breathing sounds simulator
Regarding the graph of the respiratory sound signal, at the beginning of inspiration, high amplitude peaks stand out and, subsequently, a decrease in peak amplitude. It is further understood that the simulated cardiac and respiratory sounds are very identical to the sounds of individuals with no pathology. Thus, the results shown in Fig 13 are in accordance with what was theoretically expected.
Tests were performed for the other pathologies and the results obtained were generally satisfactory.

Conclusion
In this work, two simulators of physiological signals were developed with the purpose of enhancing the characteristics of an existing simulation dummy. All the development details have been thoroughly described, covering both hardware and software components. The main focus was to achieve maximum functionality with minimum costs. These simulators act as educational tools for health engineering and medical fields, allowing students of health-related subjects to acquire skills that are very difficult to acquire by other means. The advantages of using this type of simulators in education is well demonstrated by the number of commercial simulators available.
In future work, both simulators can be combined, synchronizing the respective signals while including interactions between pathologies or simulation contexts. Additionally, more pathologies can be added to increase the number of possible simulation scenarios and thus allowing to build more complex and diverse education/learning experiences.