It is essential to guarantee the safety and efficacy of the device software
The final product: The safety and efficacy of the device itself
The development process: Rigorous design process which provides traceability of requirements
During the past decades, pacemakers implanted into patients have recorded episodes of closed-loop interactions (Senario 1 ~ Senario N) between the heart in different conditions (Heart 1 ~ Heart N) and the pacemaker . The recordings are either appropriate pacemaker behavior in response to heart condition which all new pacemakers should also have, or inappropriate pacemaker behavior so that the new pacemakers should avoid. In order to evaluate the performance of a new pacemaker design (Pacemaker X), the inputs from the hearts in those recordings, representing different heart conditions, are fed into the new pacemaker and the outputs of the new pacemaker are compared to the recorded outputs in those senarios.
The problem of open-loop testing is that the input signals from heart do not capture the heart physiology and will not change to different pacemaker outputs. Given a closed-loop interaction between Heart i and Pacemaker i and feed its heart input signals to Pacemaker X will not capture the closed-loop behavior of Pacemaker X under heart condition i. In order to evaluate pacemaker executions under different heart conditions, especially the executions with adquate depth, there has to be a model of the heart which can capture the physiological conditions of the heart and respond to pacemaker outputs.
We developed a model-based design framework for pacemaker software. A heart model structure was designed based on the electrophysiology of the heart. At each development stage a version of the heart model is available to interact with the pacemaker model/implementation.
The coordinated contraction of the heart muscles are governed by the electrical conduction system. The Sinoatrial (SA) node, which is the natual pacemaker, periodically generates electrical impulses that conduct along the electrical conduction system, triggering muscle contractions. Anormalies in the generation and/or conduction of the electrical signals will result in irregular heart rhythms, which are referred to as arrthymia.
When a heart tissue encounters a voltage change, it discharges the ions inside, causing voltage change outside the tissue. The behavior is referred to as depolarization. The figure on the left illustrates the voltage changes over time (Action Potential) outside a heart tissue (solid line) and its nearby tissue (dashed line). After the outside voltage reaches a certain threshold after some time, the tissue nearby is also depolarized. This domino effect continues so the initial depolarization from the SA node can travel through the whole heart. After the depolarization the tissue needs time to recharge, as we can see the voltage gradually drop back to its resting value. This recharging period is referred to as the Refractory period during which new depolarization will be inhibited or triggering deformed action potential. The colored bar below shows the corresponding timing periods. More information can be found in this quick tutorial.
We chose Timed Automata as the formalism for the heart model for several reasons:
Nondeterminism which enables model abstraction which increase coverage.
In order to be used in different stages during the development process, the structure and parameters of our heart model need to be adjusted to balance between Coverage vs. Expressiveness.
Intuitively, the more complex the model is, there is more constraints on its behaviors, thus limiting its coverage. On the other hand, the added complexity allows us to capture more detailed mechanisms of the heart, allowing us to precisely model a specific heart condition. So instead of developing a single heart model, we developed a series of heart models at different abstraction levels. With Counter-Example-Guided Abstraction & Refinement (CEGAR) framework, we are able to choose the proper level of heart model abstraction during verification thus balancing coverage and expressiveness.
For evaluating pacemaker which has only two leads and do simple thresholding for signal processing, we developed heart models at different abstraction levels, where each abstraction covers all possible states of the model in the previous abstraction level. Each abstraction step reduces the complexity of the timed automata component and/or the structure of the whole model. This establishes a timed simulation relationship between abstraction levels with where n=[1,4]. More details on heart model abstraction can be found in our STTT paper.
We first start with modeling the electrical behaviors of a heart tissue. A whole model of the heart consists of node automata (N0) which models the timed transitions among different time periods with different behaviors after the tissue is depolarized. The heart can then be modeled as: where N can be arbitarily large.
Proposed use:
In this abstraction we replace the cond state of N0 with path automata. The heart model H0 can be replaced by . A more general abstraction abstracts 3 nodes and 2 paths into 2 nodes and 1 path:. With this property we can further abstract the structure of the model. The heart model H0.5 can be further abstracted into where m=9 in the structure shown on the right.
Proposed use:
At this abstraction level, we merge the RRP state with the Rest state in the node automata and Double with the Idle state in the path automata due to the same behavior. We also further abstract the structure of the heart model so H1 can be abstracted with . The AV node has very large ERP period thus cannot be abstracted away.
Proposed use:
Verify pacemaker algorithms in which the blocking property of the AV node cannot be ignored
The node automata do not trigger path conduction in response to external activation during its ERP state. In this abstraction level, this function is replaced by a non-determnistic transition in the path automata, as shown in the figure on the right. As a result of the abstraction, the AV node can be abstracted away and the heart model H2 can be abstracted by .
Proposed use:
Verify pacemaker algorithms in which A-V conduction cannot be ignored
Since the pacemaker only has two leads, the structure of the heart model can be further reduced to two node automata which can generate inputs to the pacemaker without timing constraints. The heart model H3 can be further abstracted to . This heart model covers all possible inputs to the pacemaker and is our most abstracted model.
Proposed use:
Verify pacemaker algorithms with unconditional properties.
For simulation the heart model has to be deterministic. We resolve the non-determinism in our heart models with linear interpolation. The ERP period of the node automata and the conduction delay of the path automata are determined by the state of the node automata when it was activated. In this way we are able to simulate progressive heart behaviors like the Wenckebach A-V block which is shown on the right. More details on the linear interpolation can be found in our VHM proceeding paper.
Pacemaker has two leads placed against the inner heart wall. Each lead has two electodes which can sense the electrical voltage changes near the heart tissue. The depolarizations of the heart tissue travel across the heart like a wave. Clinical studies shows that the depolarization wave move toward and away from the electrode, the voltage sensed by the electrode increases and decreases correspondingly.
We model this behavior by calculating the distance between the location of the depolarization wave within the path automata, and the location of the electrode. The animation on the right shows the simulated voltage sensed by two electrodes (Uni1,Uni2). The left column shows the analog signal sensed by the two electrodes and their difference. The right column shows the logical pulses that the pacemaker gets after simple thersholding.
With the model of the electrodes we are able to put imaginary electrodes at different places of our heart model. This also allows us to simulate behaviors like pacemaker lead dislodge and crosstalk. More information on these subjects can be found in our EMBC'11 paper
We created an user interface in Matlab so the user can create a heart model, interact with it and visualize the simulation.
The heart models created in the user interface can be automatically generated into executable files and run on a hardware platform. The first version of the Heart On a Chip platform uses a FPGA board to run the heart model. Through an analog interface circuit the heart model can interact with a real pacemaker. This platform enables us to do closed-loop testing on a pacemaker implementation with different heart conditions. More details on the platform can be found on this website and our technical report.
The second generation Heart On a Chip will be on a microcontroller with easier configuration and richer interface. The platform will be provided to the research community with low cost. Information on how to get access to the platform is coming soon.