Artificial Pancreas Control Using Fuzzy Logic
Design an artificial pancreas nonlinear control system in Simulink® using fuzzy logic. Design a complex fuzzy logic controller by combining two smaller interconnected fuzzy systems in a fuzzy tree. Automatically tune the membership function parameters and rules of a fuzzy inference system. Use Simulink to model the fuzzy logic controller, insulin pump, glucose production from a meal, and blood glucose changes in the patient. Validate the fuzzy logic controller by simulating various meal scenarios. Deploy the fuzzy logic controller by automatically generating C/C++ code.
Hi, everyone. This video shows how to design a fuzzy inference system tree controller to regulate blood glucose of a type I diabetic patient using an artificial insulin infusion system. The artificial insulin infusion system is called Artificial Pancreas, which has three main components.
Glucose monitoring sensor takes blood glucose sample every five minutes. Controller produces a corrective insulin dose to regulate the blood glucose level in the normal range, which is 80 to 100 milligrams per deciliter. Insulin pump injects the corrective insulin doses to the patient's body.
The blue line in this plot shows that carbohydrate-based meals without corrective insulin doses may lead to hypoglycemic condition with very high blood glucose levels. The high glucose intake requires short acting high insulin doses, whereas the fasting level low glucose requires long acting, low insulin doses.
Moreover, when the blood glucose level is very low in hypoglycemic condition, the controller needs to stop the insulin doses. This natural context specific insulin dose control is more suitable for a rule-based non-linear control like fuzzy controller.
The fuzzy controller is enabled every five minutes with a new sample. It uses three inputs-- blood glucose level, exchange rate, and acceleration rate. The controller uses a tree of two connected fuzzy inference system to incrementally add the inputs. It also reduces the total number of rules.
Defining fuzzy rules without experience is a difficult task. An alternative option is to tune rules using cost minimization. Fuzzy Logic Toolbox provides tunefis function to tunable parameters with cost optimization. To optimize the rules, get the tunable settings from the fuzzy systems, and update the rule settings to optimize only the rule consequence.
Create an option set for the tuning process with genetic algorithm. Create a cost function to evaluate each candidate rule-based generated in the tuning process. First, the cost function calculates errors in the observed blood glucose from a nominal glucose level. Next, the negative errors below a minimum glucose levels are set to a high error value. Then the cost is calculated as the root mean square of the error values. Next run tunefis function to optimize the rules.
This blood shows the optimization results with the tuned rule bases. The glucose level is now regulated below 160 milligram per deciliter, and it settles close to 90 milligram per deciliter up to the third meal. The controller generates a short acting, high insulin dose at each meal time and the long acting reduced insulin dose during the fasting period.
You can further improve the controller performance by tuning the membership function parameters of the fuzzy inference system. Use a local optimization method, such as pattern search, and run tunefis again to optimize the membership function parameters.
This plot shows the optimization results with the tuned membership functions, which improve the controller performance and reduce the minimum cost of value. You can now simulate the model with different mealtime and carbohydrate intake values to validate the controller performance.
For example, change the second mealtime to 360 minute, which is the sixth hour of the day, and change the corresponding carbohydrate intake to 50 grams, then run the model. The final glucose level after the third meal is still below 100 milligrams per deciliter. Once the model is ready, you can generate code and deploy to a target device. This concludes the demo. Thank you for listening.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- United Kingdom (English)
- Australia (English)
- India (English)
- New Zealand (English)
- 日本Japanese (日本語)
- 한국Korean (한국어)