An electronic heart model
The following content follows a chapter in Hans U. Fuchs, Dynamics of Heat, 2nd Edition.
In this weekend project, I made a model of the heart using analog electrical components and an Arduino. I’ll walk you through the modelling process, as well as the code for the Arduino and a quick Simulink simulation with more parameters.
The Heart
The model in this post concerns the human circulatory system. If you’ve ever had your blood pressure taken, you’ll have seen a pair of numbers: the systolic and diastolic blood pressures. Systolic (from the greek for contraction) refers to the pressures in the circulatory system while the heart contracts; Diastolic (from dilation) refers to the pressures observed while the heart relaxes. These pressures will be something like 130 mmHg systolic, 80 mmHg diastolic.
Consider the pumping of the heart. When the heart relaxes, the gauge pressure inside goes to 0, roughly. (Most of your insides are at atmospheric pressure most of the time.) So what causes the high diastolic pressures? The answer is capacitances within the system. The capacitor in this case is the aorta, which has elastic walls. These elastic walls expand when blood is pumped in from the heart, storing some of the energy from the contraction and releasing it over time as the heart relaxer. The rest of the circulatory system acts as a flow constriction or resistor,
Blood, like any fluid, flows from regions of high pressure to regions of low pressure. When the heart pumps, the pressure in the heart increases and drives blood into the aorta and through the rest of the circulatory system. The flow of blood created during the systole causes the aorta to expand. When the heart stops beating, blood is prevented from flowing backwards by the aortic valve. The aorta, which expanded during the systole, now contracts, pushing its stored blood through the rest of the body. The effect of the aorta is the same as a water tower supplying a town: the intermittent pumping of the heart is smoothed out. The systolic pressure measured in your arms is less than the systolic pressure measured in the heart, and the diastolic pressure measured in your arms is higher than the diastolic pressure measured in the heart.
Let’s build a dynamic model of this system!
Electrical Equivalent
To model the body’s hydraulic system with an electrical equivalent circuit, we need to draw some parallels between the flow of blood in the body and the flow of electricity in wires.
Pressure and Flow
Pressure in a fluid has the units of force over area. Since it involves force, pressure is related to fluid flows. In particular, fluids are accelerated from regions of high pressure into regions of low pressure. Pressure and flow have a direct electrical analogy in voltage and current: charged particles are accelerated from high-voltage regions into low-voltage regions. Current is a measure of the flow of charged particles; voltage differences thus induce current the same way that pressure differences induce fluid flows.
Kirchoff’s “law” suggests a linear relationship between the voltage difference between two regions and the current flow between those regions. In symbols,
$$ I = V / R $$says that the current is a simple multiple of the potential difference. This is true enough for simple electrical components like resistors and simple hydraulic components like pipes, which both present a certain resistance $R$ to their respective flows.
We’ll have two resistances in our simple model of the circulatory system: one resistance between the heart and the aorta, and one resistance between the aorta and the rest of the body.
Capacitance
The dynamic effect of the aorta in the circulatory system is to store pressure differences, smoothing them out over time. It acts like a tank which fills during the systolic phase and depletes during the diastolic phase. The electrical equivalent, which stores and releases charge, is called a capacitor. When electricity flows into a capacitor, it causes the voltage level to rise. The rate at which the voltage level rises is equal to some constant times the amount of flow into the capacitor:
$$ C{\mathrm d V_C \over \mathrm d t} = I_C $$This is easy to remember if you recall what a capacitor does (store charge), and consider the effect of making the capacitor larger (increasing \(C\)). With a larger capacitor, the same current \(I_C\) will cause the voltage across the capacitor \(\mathrm d V_C / \mathrm d t\) to increase more slowly; thus it makes sense that the rate of voltage increase is equal to \(I / C\).
Electrical Equivalent
Taking the analogy between pressure and voltage and between blood flow and current, we can draw a circuit diagram.
The heart is modelled as a voltage source \(V_S\), which we can choose. (A simple but effective choice would be a square pulse, or you could take measurements of a real circulatory system.) The diode acts like the aortic valve, preventing current from flowing back into the heart. Then \(R_1\) is the resistance between the heart and the aorta, \(C\) models blood storage in the aorta, and \(R_2\) is the resistance between the aorta and the rest of the circulatory system.
This is enough to make an analog model of the system, but if we want to get some insight into the behavior, we can make a model in Simulink first. To make the Simulink model, we’ll need to write down a couple of equations for the system, using Kirchoff’s Voltage Law (sum of voltages around a loop is zero) and Kirchoff’s Current Law (the sum of currents into and out of a node is zero).
KVL:
$$ \begin{aligned} U_S &= U_D + U_{R_1} + U_C \\ U_C &= U_{R_2} \end{aligned} $$KCL:
$$ I_{R_1} = I_C + I_{R_2} $$We also have constitutive relations for the diode, the capacitor, and both resistors:
$$ \begin{aligned} I_{R_1} &> 0 \hspace{2em} &\text{(Diode)} \\ C {\mathrm d U_C \over \mathrm d t} &= I_C \hspace{2em} &\text{(Capacitor)} \\ I_{R_1} &= {V_{R_1} \over R_1} \hspace{2em} &\text{(Resistor)} \\ I_{R_2} &= {V_{R_2} \over R_2} \hspace{2em} &\text{(Resistor)} \\ \end{aligned} $$Putting these all together, we can make a Simulink model. Labelling the signal wires helps to keep things organized.