Automatic Drug Dispensing

Click on the image to start the demo

Open the demo in a new window


The Automatic Drug Dispensing System demonstrates the application of a KEEL based solution in a medical application.

The concept being demonstrated suggests that a drug dispensing module could be worn by patients that measured blood pressure and heart rate. The person wearing the module is being treated for high blood pressure with two different drugs. The first drug is gradually applied as the blood pressure rises up to a certain point. Then as the blood pressure continues to rise, the first drug is gradually decreased in dosage and a second drug (intended for more critical needs) is administered.

The system compensates for increased heart rate that would normally occur during exercise. In this way the heart rate shifts the application of both drugs.

Two controls are provided for the Dual Drug Dispensing System. They allow the physician to adjust the relative points to begin dispensing the two drugs.

Because the module would be constantly monitoring heart rate and blood pressure the system would react to the demands of the patient with a controlled release of drugs.

This is a very simple application of KEEL technology and is intended only to demonstrate the feedback concepts of this type of a control system. It is not a real product and is not validated as an appropriate design for such a system by any medical team. A productized version of this concept could take into account any number of sensed symptoms and could treat the patient with any number of drugs driven by different conditions.

The demonstration software on Compsim's web site is a Macromedia Flash application. The code to position the scroll bars and the drug dispensing indicators would be developed by the programmer using standard Macromedia Flash tools. The remainder of the code (not shown) is created by the KEEL toolkit. It is in the KEEL toolkit, where the relationships between heart rate, blood pressure, and the set points for the two drugs are defined. The KEEL toolkit has a menu option to document the design in Flash, as well as C, C++, C++ .NET, C#, Java, Python, Visual Basic, Visual Basic .NET and PLC Structured Text code. The resulting solution is a very small footprint engine. Flash is usefull for web based demonstrations. Other languages may be more appropriate for embedded applications, while others may be more appropriate for mainframe or personal computer applications.

This system is based on Compsim's patented and patent pending KEEL technology that covers the development environment, Compsim's decision-making algorithms, and the resulting KEEL engine architecture.


The scroll bars at the left side of the window represent configuration parameters that might be available to a physician. These allow the physician to configure curves that will define how the two drugs are dispensed as the patient's blood pressure increases. This model shows that two drugs with different characteristics are being dispensed. The first drug (Drug 1) is weaker and to be used gradually as the blood pressure increases. The second drug (Drug 2) is applied in more serious situations. There is a time when Drug 1 is being reduced at the same time when Drug 2 is being increased. The assumption in this demonstration is that no drugs are being dispensed when heart rate and blood pressure are normal.

The setup sliders allow the physician to define the curve to indicate when Drug 1 begins to be dispensed and when it will be stopped. The amount of Drug 1 can also be controlled. The sliders also allow the physician to control when Drug 2 starts dispensing as well as the maximum rate it will be dispensed.

When the setup sliders are adjusted the system redraws the graphs showing the curves.

The sliders at the right of the window allow the user to simulate sensors for blood pressure and heart rate. When the sliders are at the left, this is an indication of normal readings. Sliding them to the right indicates an increase in heart rate and / or blood pressure. In this demonstration, there is recognition that it is normal for blood pressure to rise with heart rate. An effective blood pressure increase is calculated by combining the heart rate and blood pressure readings. It is this effective blood pressure that is treated with the two drugs.

In this demonstration, only the start and stop points and maximum amount of drug 1 and the start point and maximum amount of drug 2 are configurable. A more complete system might allow complete control of the shape of the curves. There may also be other inputs that contribute to the real-time dispensing.