Determination of a Numerical Analysis Algorithm for the Regulation of Blood Sugar in Diabetics

Acceptable glycemic control when examining the 
effects of meals was achieved when combining basal insulin therapy and 
high concentration insulin injection before a meal, when using a PID controller 
(Proportionality, Integrity and Derivative actions) alone, when using a PID 
controller with basal insulin therapy and when combining the three methods of 
insulin delivery. Naturally, a type 1 diabetic must inject himself with insulin 
in well-measured doses. Thus, the management and control of diabetes become a 
complex task when one must be considered the disturbance due to nutrition and 
sports activity. This concern has been at the center of much research through 
different approaches through mathematical methods and Artificial Intelligence 
methods. This article simulates a physiological model of glycemic control in 
type 1 diabetics by a PID regulatory mechanism, in the context of disturbances 
caused by the patient’s meals and athletic activity.


Introduction
Diabetes is a condition that affects a person's ability to regulate their blood sugar [1]. There are several forms of diabetes such as type 1, type 2 and gestational diabetes [2]. In a healthy person, the pancreas is the main organ that controls blood sugar levels, with glucose being the body's main source of energy [3].
When blood sugar levels drop, alpha cells in the pancreas are signaled to release implies that the sporting activity has been anticipated. As in the case of several studies already, simulations are made to evaluate the effect of carbohydrate intake and physical effort on insulin sensitivity in type 1 diabetics. We want to deepen these studies. With a PID controller for a normal patient and for an obese patient to generate a multiple input, single output model to adjust the insulin doses to be delivered. The objective of this work is to determine adequate basal rates and bolus dose systems for the administration of insulin while considering fluctuations in glucose consumption and patient sports activities. Additionally, mathematical models that require a physiological understanding of blood sugar and insulin metabolism in the body are explored. They are useful for performing metabolism simulations as a behavioral model and for studying the physiological processes of blood sugar regulation.
The goal of our article is to: 1) Create a simulation of blood glucose and insulin concentrations in a type 1 diabetic while considering the disturbances due to meals and sports activity.
2) Model high-concentration injections and administration of basal doses of insulin and observe their effects on blood sugar and insulin concentrations under normal conditions and in the presence of disturbances such as meals and athletic activity.
3) Use the PID controller to regulate insulin delivery in response to blood glucose levels to maintain a target blood glucose concentration. 4) To determine the separate treatments and the combinations of treatments those provide acceptable glycemic control in the presence of disturbances in eating and sporting activity.
In the remainder of the article, Section 2 presents the theoretical model of the blood glucose control system. Section 3 presents the results of the simulation of the developed system as a function of the parameters. The article ends with a conclusion and appendices (programs in Python).

Bergman's Model for Type 1 Diabetes
One of the popular models, like the Dalla Man model [14] and the Hovorka model [15] to describe blood sugar control in diabetic patients is known as the Bergman minimal model. It is a system of three ordinary differential equations [16]. It is a nonlinear compartment model (CM) comprising a very small number of parameters that could describe the relationship of the glucose-insulin regulatory system with adequate precision [16] [17]. It was modified to be able to represent the carbohydrate metabolism of type 1 diabetes and used as a control model [18]. The main variables involved include: G, the deviation of the blood glucose concentration from the basal levels measured in d•L −1 , I, the deviation of the concentration of insulin in the blood from the basal levels measured in L −1 , and The parameters present in these equations represent the rates and conversions for the different processes that this model simulates. Some typical values and units for each of these parameters are included in Table 1 where V g is the volume of distribution of glucose which is based on the weight and height of an individual and F g is the rate of infusion of glucose as a function of the glucose contained in a meal and the weight and height of an individual. individual.
U is the insulin supply from an external source and into the bloodstream, measured in mU•min −1 . For the purposes of this study, a PID controller was used to provide a control mechanism to maintain G at a given set point G sp . The dominant equation for a PID controller is: Another input mechanism analyzed was a high concentration insulin injection, which was modeled similarly to the disturbance function of glucose. Current injections use high-strength, fast-acting insulin and are given a short time before meals. Our interpretation of the insulin absorbance rate is: In this equation, the decay rate of insulin is 10 instead of 0.05 (the decay rate of glucose after meals) because insulin is injected directly into the bloodstream. Normally, injections would instead be modeled by a delta function, but the limitations in insulin absorption into the blood and tissues throughout the body should result in injections being better represented by a net exponential function. inject U is an estimated parameter which determines the sharpness of the injection peak, which was estimated to scale with the glucose intake of the corresponding meals. The values for this parameter are displayed in the following table and have been approximated based on typical dosages for high concentration injections ( Table 2).

Model Studied
A variation of Bergman's minimal model includes variables typically used to describe actions in the respiratory system and uses them to estimate blood glucose concentrations resulting from physical activity. The main variables involved include all of the same variables and parameters of the Bergman minimal model PVO , the percentage of the rate of maximum oxygen uptake in mL•kg −1 •min −1 and A, the integral of the intensity of sports activity. Expressed in its entirety, the model is: The parameters P 1 , P 2 , P 3 , G b , I b , n and V 1 are the same as the Bergman minimal model. New parameters include W, the patient's weight, T 1 , the time constant describing the time it takes for glycogen levels to return to basal levels, k, the rate of glycogen depletion when glycogen stores are nearly depleted, and a 1 to a 6 , which relate to the percentage of the rate of maximum oxygen uptake relative to the rate of glucose release from the liver, the rate of insulin elimination due to athletic activity, and the rate of absorption glucose caused by sports activity. Their typical values are described below with units (Table 3). u ex is a variable that describes the amplitude of sports activity, ranges from 0 to 92, has the same units as

Assumptions of the Basic Model
The main assumptions made when using the Minimal Model and Bergman's Sport Activity Model to simulate blood glucose and insulin levels in patients with type 1 diabetes included: 1) The values of parameters 1 2 3 1 2 3 4 5 6 , , , , , , , , , P P P a a a a a a k and 1 T are valid for the different scenarios tested.
2) The recommended upper limit for blood glucose after a meal is 180 mg dL −1 , which should be reached after 60 minutes.
3) The recommended limits for blood glucose before a meal are 80 to 130 mg dL −1 .
4) The volume of blood and tissue of non-obese and obese patients is approximately 12 L, as specified in Table 1. 5) The ratio of glucose infusion rate to glucose delivery volumes for an average person was 6.0 mg•dL −1 •min −1 at breakfast, 9.0 mg•dL −1 •min −1 at lunch and 12.0 mg•dL −1 •min −1 at dinner. For obese patients, these values were increased by a factor of 1.124 due to a larger volume of glucose distribution and significantly higher mean weight.
6) The rate of decay of insulin from high concentration injections follows a strong exponential decay instead of a delta function.
7) The decay constants of the exponentials of the glucose disturbance function and of the exponential of insulin injection are respectively 0.05 min −1 and 10 min −1 .

Simulation 1: No Controller Input
This simulation models the evolution of blood glucose and insulin concentrations over time in diabetic patients for whom no controller is used. The expected result (Figure 1) is that glucose concentrations will rise well above acceptable levels. Open Journal of Applied Sciences Main observations: In the absence of insulin treatment, in normal and severe cases, blood glucose levels rose uncontrollably and insulin levels fell. Lack of blood sugar control gave worse results for the severe case. The glycemic response was worse for the obese scenario than for the normal scenario.

Simulation 2: Basal Dose
This simulation models the evolution of blood glucose and insulin concentrations over time in diabetic patients in whom the controller only delivers the basal dose of insulin necessary to maintain a steady state at the blood sugar set point. The expected result (Figure 2) is that the glucose concentrations will reach a steady state blood glucose concentration within acceptable levels. However, the expected timeframe for this to happen should be longer than what is acceptable.
Main observations: With a basal insulin dose, the insulin concentration was maintained but the blood glucose concentration reached high levels (especially after meals) and did not decrease quickly enough to be in the acceptable range. It was slightly worse for the severe case. Again, the glycemic response was better in the normal scenario than in the obese scenario.

Simulation 3: High Concentration Injection before the Meal
This simulation models the evolution of blood glucose and insulin concentrations over time in diabetic patients in which controller input is replaced with a single, high-concentration dose of rapid-acting insulin before a meal. The expected result (Figure 3) is that the injection will neutralize the effects of the rapid rise in blood sugar levels due to the disturbance caused by meals but will fail to maintain a state of equilibrium after long periods of time.
Main observations: High concentration injections counteracted high glucose consumption from meals, but failed to stabilize blood sugar levels in the long term.
This was especially worse in the severe case, where the injections only slightly counteracted the glucose uptake from meals. Insulin concentrations increased after injection but were not maintained at non-zero level over the long term. The glycemic response was more efficient in the normal scenario than in the obese scenario, but only slightly. Open Journal of Applied Sciences

Simulation 4: High Concentration Injection and Basal Dose
This simulation models the evolution of blood glucose and insulin concentra-

Simulation 5: PID Control
This simulation models the evolution of blood glucose and insulin concentrations over time in diabetic patients in which the controller input is regulated by a PID controller. The expected result is that the controller will neutralize the effects of the rapid rise in blood sugar due to the disturbance caused by meals and achieve a state of equilibrium for long periods of time. However, it is also expected to exceed the set point and eventually oscillate around the set point for blood glucose concentration for a considerable period before reaching steady state at the blood glucose setpoint.

Simulation 6: PID Control with Basal Dose
This simulation models the change in blood glucose and insulin concentrations over time in diabetic patients in which the controller input is regulated by a PID controller alongside the basal input for steady state. The expected result is that the controller will neutralize the effects of the rapid rise in blood sugar due to the disturbance caused by meals and achieve a state of equilibrium for long periods of time. Since the basal dose is included in the expression, it is expected to reach steady state without considerable oscillation around the set point. Main observations: The results for the PID control with a basal insulin dose ( Figure 6) were almost identical to the previous results for the PID control only.

Simulation 7: PID Control with Basal Dose and Injection
This simulation models the evolution of blood glucose and insulin concentrations over time in diabetic patients in which the controller input is regulated by a PID controller alongside the basal input for steady state and a dose of high concentration insulin before a meal. The expected result (Figure 7) is that the controller will neutralize the effects of the rapid rise in blood sugar due to the disturbance caused by meals much faster than the PID controller with the basal dose due to the injection of insulin before a meal. As a result, it should also reach steady state faster and without considerable oscillation around the setpoint. Open Journal of Applied Sciences  Main observations: The combination of injection, basal insulin therapy, and PID control provided the best blood sugar regulation, although slightly better than injection and basal therapy alone. There were still noticeable increases in blood sugar after meals, but blood sugar was kept below accepted limits. There was a slight overshoot and slight oscillation in blood glucose and insulin levels when they returned to stable values, but they were less severe than with PID control alone. Again, the glycemic response was more severe in the obese scenario than in the normal scenario. The results for normal and severe cases of diabetes were comparable.

Simulation 8: Meal without Control
This simulation models the evolution of blood glucose and insulin concentrations over time in diabetic patients in which the patient undergoes vigorous sports activity and then eats a small meal without any intervention from the controller. It is expected that ( Figure 8) the meal will cause a greater deviation from acceptable levels than athletic activity and that no input from the controller will cause blood sugar to rise beyond acceptable levels.
Main observations: The results were similar to those of the previous case of no insulin treatment. In normal and severe cases, blood glucose levels rose uncontrollably, and insulin levels fell. The severe case gave much worse blood sugar Figure 8. Results for a meal without any intervention from the controller. Open Journal of Applied Sciences control than the standard case of type 1 diabetes. The blood sugar response was better in the normal scenario than in the obese scenario.

Simulation 9: Meal with Only the Basal Dose
This simulation models the change in blood glucose and insulin concentrations over time in diabetic patients in which the patient undergoes vigorous athletic activity and then eats a small meal with the only input from the controller being a baseline dose. The meal is expected to result in a greater deviation from acceptable levels than athletic activity and the controller input will result in a steady state reached at the blood glucose set point (Figure 9).
Main observations: With treatment with basal dose insulin, vigorous sports activity led to a significant increase in blood sugar concentrations, but not as large as the meal. In addition, blood sugar was always kept within acceptable limits during sports activity. There was a greater increase in blood sugar after eating, but the values were within acceptable limits and a long-term steady state was achieved. The insulin concentration was mainly maintained at a stable level in the long term but showed a significant decrease during sports activity. The results ( Figure 8) were comparable for normal and severe cases. Better blood sugar control was obtained for the normal scenario than for the obese scenario.

Simulation 10: Meal with PID Controller
This simulation models the change in blood sugar and insulin concentration over time in diabetic patients in which the patient undergoes vigorous sports activity and then eats a small meal with the only controller input being a PID controller. The meal is expected to result in a greater deviation from acceptable levels than athletic activity and the controller input will result in a steady state reached at the blood glucose setpoint (Figure 10).
Main Observations: The PID controller kept blood sugar relatively stable during athletic activity. There was a slight increase in blood sugar with sports activity, which corresponds to a slight drop in insulin. However, the PID controller brought the blood sugar and insulin levels to stable levels with some oscillation. Again, the response was slightly worse for the obese scenario, while the results for normal and severe cases were very similar.

Simulation 11: Meal with PID Controller and Basal Dose
This simulation models the change in blood glucose and insulin concentrations over time in diabetic patients in which the patient undergoes vigorous athletic activity and then eats a small meal with the controller input being a baseline dosage and a PID controller. The meal is expected to result in a greater deviation from acceptable levels than athletic activity, and controller input will result in a steady state reached at the blood glucose set point with better performance than the PID controller alone (Figure 11).  Main observations: With PID control and a basal insulin dose, there was a slight improvement in blood sugar control. However, PID control with basal dose insulin therapy led to similar results to PID controller alone.

Conclusions
By themselves, a basal insulin delivery rate and a single high concentration injection before a meal have been shown to provide inadequate glycemic control. Treatment of basal insulin levels resulted in long-term stabilization of blood sugar but was unable to reduce blood sugar below the post-meal limit after 60 minutes. High-strength injections were found to significantly reduce the effects of short-term meals but could not provide long-term stability to meet post-meal or pre-meal limits. When they worked together (basal dose therapy and high strength injections), blood sugar levels were within acceptable limits in the short and long term. The rapidity and the long-term of stabilization of the blood sugar level in the healthy ranges remain a problem to be improved in this system. When considering only athletic activity, basal insulin therapy provided adequate glycemic control by keeping glucose levels within acceptable limits. We developed the differential equations of the model in Python (Jupyter).
PID-controlled insulin delivery has been shown to be an effective way to control blood sugar. On its own and in conjunction with a basal insulin dose, it was Open Journal of Applied Sciences able to provide acceptable glycemic control for meal disturbances. The only area for improvement was seen when using after meals with high glucose content, as the PID controller was able to barely reduce blood sugar levels below post-meal limits before a duration of 60 minutes have passed. This issue was resolved when both methods were combined with high concentration injection, although the resulting control was only slightly better than when operating with basal insulin therapy and high concentration injection without the controller PID.
For all treatments, the glycemic response pattern was similar for obese and normal body types, but overall control was better in the normal body type scenario. In addition, the severe case of type 1 diabetes showed similar response patterns to the normal cases, but the performance of the controller was slightly worse.
The only notable exceptions occurred without controller intervention, where the normal case seemed to stabilize at around 1000 mg•dL −1 , but the severe case did not stabilize at all. Therefore, the proposed modeling algorithm with an insulin pump equipped with PID, with a small number of parameters, could integrate the self-regulating systems of glucose to avoid hypoglycemia/hyperglycemia. A patient-specific glycemic control strategy is interesting to develop to continue this study. Open Journal of Applied Sciences

A2. Meal disturbance function
A function that considers the parameters corresponding to the glucose levels for different meals and produces the blood glucose infusion rate to be used to calculate the change in blood glucose concentration over time.