# Temporary Pacing Simulator: A Training Tool for Clinicians
## 2 Materials and Methods
### Generation of Pacing Failures Using Algorithms  
In addition to simulating various pacing modes, the developed TCPS is capable of reproducing four different types of pacing failures: oversensing, undersensing, atrial loss of capture (ALOC), and ventricular loss of capture (VLOC). TP undersensing occurs when the device fails to accurately detect the intrinsic electrical activity of the heart, leading to inappropriate pacing. This can manifest in different ways depending on the pacing mode. In VVI mode, the TP is designed to sense ventricular activity and inhibit pacing if it detects an intrinsic QRS complex. However, in the case of undersensing, the device fails to recognize the heart's natural ventricular activity, leading to inappropriate pacing. This can result in pacing stimuli being delivered during periods when the heart's natural rhythm is adequate, such as during the T-wave, which can be particularly dangerous. The simulation of undersensing in VVI mode involves deliberately introducing pacing spikes at inappropriate moments within the ECG signal, specifically during the T-wave. The T-wave represents the repolarization of the ventricles, and pacing during this phase could potentially lead to arrhythmias or other dangerous outcomes. By inserting pacing spikes during these periods, the TCPS mimics the TP's failure to recognize the natural rhythm, demonstrating how it might incorrectly deliver pacing stimuli. In AAI mode, the TP is responsible for sensing atrial activity, specifically the P-wave, and inhibiting pacing if it detects an intrinsic P-wave. Undersensing in AAI mode occurs when the TP fails to detect these P-waves, leading to inappropriate pacing. This could result in pacing spikes being delivered during the intrinsic P-wave, when the atrium has already initiated its contraction. The simulation of undersensing in AAI mode involves introducing pacing spikes directly at the P-wave, simulating a failure to recognize atrial activity. Pacing during this period can disrupt the natural atrial contraction and lead to atrioventricular dyssynchrony. In DDI mode, the TP senses both atrial and ventricular activity and inhibits pacing in either chamber depending on the detected signals. Undersensing in DDI mode can lead to inappropriate pacing in the atrium or ventricle, depending on where the undersensing occurs. The TCPS is able to localize the undersensing, either in the atria or the ventricles. If undersensing occurs in the atria, pacing spikes are introduced during the intrinsic P-wave, similar to AAI mode. If undersensing occurs in the ventricles, pacing spikes are introduced during the T-wave, similar to VVI mode. By selectively inserting pacing spikes during these periods, the simulation demonstrates how the TP might fail to detect natural atrial or ventricular activity, leading to inappropriate pacing in the affected chamber. This could disrupt the natural atrioventricular sequence, increasing the risk of arrhythmias and other complications. Oversensing occurs when the TP mistakenly interprets non-cardiac signals, such as muscle contractions or external electromagnetic interference, as intrinsic heart activity, leading to the inappropriate inhibition of pacing. This can result in pauses or even asystole, as the TP incorrectly withholds necessary pacing impulses. In the simulation, oversensing is handled differently depending on the location and pacing mode. When oversensing is detected in both the atria and ventricles in DDI mode, the simulation stops all pacing activity, reverting the ECG signal to its baseline state without any pacing spikes. This simulates a situation where the TP fails to deliver any pacing due to excessive sensitivity to non-cardiac signals, leading to a significant risk of pauses in the heart's rhythm. In the case of atrial oversensing, the simulator continues to deliver normal pacing spikes in the ventricles but fails to deliver pacing spikes in the atria due to inappropriate inhibition.