---------------------- PACEMAKER SIMULATION ---------------------- This model is a basic implementation of the Pacemaker System Specification of Boston Scientific (c)2007. It was originally adapted to AADL by Brian Larson (University of Kansas) and then re-designed to make an exclusive use of the AADL Behavior Annex. The "s" port connects to an analog front-end which filters signals from leads inside the heart. When the signal exceeds a threshold (~3 mV) the front-end sends a "sense" event. The "p" port sends an event to the front end to issue a "pace" of a half-millisecond long (~2 V) to the heart to induce contraction. The "n" port sends an event when the signal from the front end was not during the ventricular refractory period (vrp), so is regarded as a true heart beat. The software only simulates the VV mode of a pacemaker, i.e. both the sense "s" and the pace "p" signals are connected to the heart ventricular. The desired behavior is as follows: - When the heart is beating fast enough, do nothing. - When the heart has not had a beat for 1000 ms (lrl), cause a pace. - If the sense comes too soon after a beat, <300 ms (vrp), ignore it. Implementation with the Behavior Annex shows the use of timers to generate the lrl and vrp timeouts. Note that all the time values have been divided by 10 for an easier observation of the simulation traces. Tests cases have been implemented by a simulation scenario - Test 1) No sensing. The thread will put out an event on the "p" port every 1000 ms. - Test 2) Normal rhythm. Put an event on the "s" port every 900 ms. The thread will put an event out the "n" port each dispatch. - Test 3) Ignore sense in VRP. Wait 1000 ms for the first pace; 200 ms later put an event on the "s" port. The next pace will occur at 2000 ms. - Test 4) Pace after sense. Wait 1000 ms for the first pace; 200 ms later put an event on the "s" port, which will be ignored. At 1400 ms put out another event on the "s" port. Expect the next pace at 2400 ms.