Controlling a Heart Simulator with CompactRIO and LabVIEW

Dr. David Keeling, School of Mechanical Engineering, University of Leeds

"CompactRIO offered a rugged, reliable, stand-alone platform, enabling our team to conduct prolonged testing, which would not have been possible on a traditional computer."

- Dr. David Keeling, School of Mechanical Engineering, University of Leeds

The Challenge:

Developing a realistic, reliable, and reconfigurable testing environment to advance and improve a novel heart assist device without the need for animal testing.

The Solution:

Using NI CompactRIO to create a stand-alone hardware-in-the-loop (HIL) testing environment that combines a physical mechanical heart with a circulatory blood flow model to create an end solution that physically and hemodynamically replicates in-vivo models.


Dr. David Keeling - School of Mechanical Engineering, University of Leeds
Mr Ali Alazmani - School of Mechanical Engineering, University of Leeds.
Prof. M. Levesley - School of Mechanical Engineering, University of Leeds
Dr. P. Walker - School of Mechanical Engineering, University of Leeds
Dr. K. Watterson - Leeds General Infirmary
Dr. O. Jaber - Leeds General Infirmary



Heart disease accounts for nearly half of all deaths in the developed world. Heart transplants are still the most effective form of treatment against the disease, but the demand for donor organs far exceeds supply. To address this imbalance, we have explored using mechanical heart assist devices. One such novel device under development at the University of Leeds is the intelligent Ventricular Assist Device (iVAD). The device functions as an artificial muscle wrap that assists the failing heart by applying compressive force, synchronous to the native rhythm, around the external surface of the heart’s ventricles. This cyclic “squeezing” action augments heart muscle efforts, leading to an improved output for the diseased heart.


We needed to physically apply the iVAD to the heart simulator to measure its compressive efforts, so a realistic in-vitro testing environment was imperative for development. Traditional approaches used for other heart assist devices have involved bulky mechanical mock circulatory systems or using excised hearts that are metabolically supported by another animal’s blood flow. Because we preferred neither method, we created a unique HIL heart simulator that combines a real-time software blood flow model with a physical 3D mechanical heart. We used the NI LabVIEW graphical programming environment and CompactRIO to further enhance the testing environment so the heart simulator could operate as a stand-alone system and run reliably for prolonged time periods.


Heart Simulator Concept

We wanted the heart simulator to be reconfigurable so it could physically and hemodynamically replicate different patient groups, illnesses, and animal models. This adaptability could reduce the need for animal testing because the heart simulator could be used for prolonged trials of prototype iVADs and also provide information on the iVAD’s physiological effects.


With an assist device such as the iVAD, the interaction between the assist device and the heart surface is crucial. This interaction is likely to depend on physical features that are difficult to model, such as backlash and nonlinear friction; therefore, it was imperative that the heart simulator had a physical object onto which we could apply the iVAD and monitor its raw compressive operation.


Heart Simulator Design

We based the heart simulator design on HIL simulation, which is a testing technique commonly used in industry. HIL simulates components from a system with software and links these to specified physical hardware parts from the same system that require testing. To satisfy the heart simulator requirements, we used HIL simulation for a mechanical heart functioning as hardware within a simulated blood flow model loop. The continuous feedback loop between the two is used to assess how the device’s physical assistance affects the heart and blood flow if implanted inside the body.


The mechanical heart’s shape is defined by two modifiable semicircular patterns of buckled spring steel strips, which are attached at both ends with adjustable boundary conditions. We developed a custom-built NI vision program to help define the necessary boundary conditions to match the profile of each steel strip to a reference heart model. We use two linear actuators to cyclically flex the steel strips and realistically represent the dynamic movement of the heart’s right and left ventricles. We control the actuator’s motion within the blood flow model to mimic the simulated heart, so any volume change to the simulated heart is immediately reflected by the physical heart. In addition to matching the heart shape, the arrangement potentially varies local stiffness around the circumference of the mechanical heart by individually altering the mechanical properties of the strips, such as thickness. We use a thin elastic skin to surround the strips and apply the iVAD.


Two linear actuators (LinMOT PS01-23x1 60H) are used to cyclically flex the steel strips and generate realistic, dynamic movement of the heart’s right and left ventricles. The motion of the two actuators is controlled using proportional integral derivative (PID) control at 40 KHz by algorithms running on the FPGA inside the CompactRIO backplane. The positional demand for the PID is derived from the changing volume of the heart within the blood flow model, hence, this ensures the motion of the physical heart mimics the simulated heart.



Heart Simulator Implementation

As mentioned, we use a feedback loop to assess the iVAD assistance to the cardiovascular system. Four conformable pressure sensors are located at equal intervals around the mechanical heart to provide iVAD assistance (compression) data. Signals from the four sensors are acquired at 50 KHz and averaged on the FPGA to reduce noise. Using a direct memory access (DMA) first-in, first-out (FIFO) this mean information is then passed from the FPGA to the real-time model running on the CompactRIO controller and converted to an assistive pressure for each ventricle. The subsequent effect this has on blood flow is calculated and then responsive motion of the mechanical heart to the device’s assistance is defined, just as it would be exhibited by the heart if it were subjected to the same physical interaction. If the CompactRIO is connected to a Windows computer, the pressure data is sent via TCP to a LabVIEW user interface where it is mapped onto the surface of a 3D heart as a STL image. This provides us with crucial visual information about the device’s performance around the circumference of the mechanical heart.


The blood flow model operates as a closed-loop lumped parameter model based on an electrical network analogy; where a compartment’s pressure is defined in terms of resistance to blood flow, capacitance (vessel compliance), and inductance (flow inertia). . The numeric model created is composed of six blood storing compartments (Figure 2) with each region modelled separately. This allows local control over the cardiovascular system and thus, via fitting of the three model terms, the implementation of specific diseases and conditions. To help satisfy one of our main goals, we created a separate state within the Windows host LabVIEW VI that allows the blood flow model to automatically fit real physiological pressure waveforms through the use of a purpose-built parameter estimation algorithm that features a Levenberg-Marquardt nonlinear least-squares function. Once run, the best fit parameters can then be loaded instantly into the real-time model and the heart simulator has the ability to accurately reflect the heamodynamics of any patient group, cardiovascular disease, or in-vivo model.

We use CompactRIO to control the mechanical heart, run the simulation, and send data via TCP to the Windows host for display and saving. The real-time controller executes two parallel loops: a high-priority control loop for the blood-flow model and a low-priority communication loop that sends and receives queued TCP data to and from the Windows host. The high-priority blood flow model loop runs at 500 Hz and converts the two ventricular volumes to a calibrated positional voltage that is sent to the field-programmable gate array (FPGA) I/O for each of the linear actuators to follow. The FPGA is compiled to deal with all the I/O from the CompactRIO as well as provide proportional-integral (PI) control of a heater, which is used to keep the heart simulator enclosure at a constant 37 oC (body temperature).


Advantages of the NI Solution

CompactRIO provided a rugged and reliable stand-alone platform to build the heart simulator, enabling our team to conduct prolonged testing of a novel heart assist device, which would not have been possible on a traditional computer. The system’s compactness and variety of plug-in modules helped us successfully create a solution.


Author Information:

Dr. David Keeling
School of Mechanical Engineering, University of Leeds

Figure 2: An In-Vitro Reproduction of a Scanned Heart Model