# Blood glucose regulation in patients with type 1 diabetes by robust optimal-safety-critical control

and#### Abstract

**Introduction:** Diabetes disease is a group of metabolic diseases in which a person has high blood sugar, either because the pancreas does not produce enough insulin, or because cells do not respond to the insulin that is produced. Designing an automated system for regulating blood glucose in patients with diabetes is a solution that researchers have been paying close attention to in recent years. Therefore, safety is the minimum requirement for safety-critical systems such as the artificial pancreas. The present study introduces a safe, robust, performance-guaranteed optimal controller that can safely regulate blood glucose in the disturbance.

**Material and Methods:** In this section, first, regulate blood glucose levels in simulation studies is evaluated. For this purpose, a dynamic model is used. The model includes a virtual patient, an insulin pump, and a continuous blood glucose level sensor. The virtual patient model represents the dynamics of insulin-glucose, carbohydrate-glucose, and exercise-glucose.

**Results:** The need to not reset the controller parameters for patients in each category is one of the suggested controller's benefits. However, the PID controller needs to reset the parameters for each group of patients, the predictive control method requires the estimated model of the patient, and its performance is different on different days because the insulin-glucose dynamics for an individual changes day by day.

**Conclusion:** Taking into account different sensitivities of body tissue to insulin, the results of evaluating the controller for two different groups of patients have shown that the controller is resistant to day-to-day changes in patients who may experience changes in insulin sensitivity, even with stress or medication and will not lose its optimal function. Based on the simulation results, the proposed controller can reduce the external disturbances' effect, whose amplitude is to a good extent within the body's physiological range.

#### INTRODUCTION

Diabetes mellitus (DM), or simply diabetes, is a group of metabolic diseases in which a person has high blood sugar, either because the pancreas does not produce enough insulin, or because cells do not respond to the insulin that is produced. This high blood sugar produces the classical symptoms of polyuria (frequent urination), polydipsia (increased thirst) and polyphagia (increased hunger) [1]. There are three main types of diabetes mellitus. Type 1 DM results from the body's failure to produce insulin, and presently requires the person to inject insulin or wear an insulin pump. This form was previously referred to as insulin-dependent diabetes mellitus (IDDM) or juvenile diabetes. Type 2 DM results from insulin resistance, a condition in which cells fail to use insulin properly, sometimes combined with an absolute insulin deficiency. This form was previously referred to as non-insulin-dependent diabetes mellitus (NIDDM) or adult-onset diabetes. The third main form, gestational diabetes occurs when pregnant women without a previous diagnosis of diabetes develop a high blood glucose level. It may precede development of type 2 DM. Other forms of diabetes mellitus include congenital diabetes, which is due to genetic defects of insulin secretion, cystic fibrosis-related diabetes, steroid diabetes induced by high doses of glucocorticoids, and several forms of monogenic diabetes. All forms of diabetes have been treatable since insulin became available in 1921, and type 2 diabetes may be controlled with medications. Both types 1 and 2 are chronic conditions that cannot be cured. Pancreas transplants have been tried with limited success in type 1 DM; gastric bypass surgery has been successful in many with morbid obesity and type 2 DM. Gestational diabetes usually resolves after delivery. Diabetes without proper treatments can cause many complications. Acute complications include hypoglycemia, diabetic ketoacidosis, or non-ketotic hyperosmolar coma. Serious long-term complications include cardiovascular disease, chronic renal failure, and diabetic retinopathy (retinal damage). Adequate treatment of diabetes is thus important, as well as blood pressure control and lifestyle factors such as smoking cessation and maintaining a healthy body weight. Globally, as of 2019, an estimated 346 million people have type 2 diabetes [2]. The classic symptoms of untreated diabetes are loss of weight, polyuria (frequent urination), polydipsia (increased thirst) and polyphagia (increased hunger). Symptoms may develop rapidly (weeks or months) in type 1 diabetes, while they usually develop much more slowly and may be subtle or absent in type 2 diabetes [3]. Prolonged high blood glucose can cause glucose absorption in the lens of the eye, which leads to changes in its shape, resulting in vision changes. Blurred vision is a common complaint leading to a diabetes diagnosis; type 1 should always be suspected in cases of rapid vision change, whereas with type 2 change is generally more gradual, but should still be suspected. A number of skin rashes that can occur in diabetes are collectively known as diabetic dermadromes (Table 1) [4].

#### Table 1

Comparison of type 1 and 2 diabetes [5]

Diabetes mellitus is classified into four broad categories: type 1, type 2, gestational diabetes and other specific types. The other specific types are a collection of a few dozen individual causes. The term diabetes, without qualification, usually refers to diabetes mellitus [6]. The rare disease diabetes insipidus has similar symptoms as diabetes mellitus, but without disturbances in the sugar metabolism (insipidus means without taste in Latin).The term type 1 diabetes has replaced several former terms, including childhood-onset diabetes, juvenile diabetes, and insulin-dependent diabetes mellitus (IDDM). Likewise, the term type 2 diabetes has replaced several former terms, including adult-onset diabetes, obesity-related diabetes, and noninsulin-dependent diabetes mellitus (NIDDM). Beyond these two types, there is no agreed-upon standard nomenclature. Type 1 diabetes mellitus is characterized by loss of the insulin-producing beta cells of the islets of Langerhans in the pancreas, leading to insulin deficiency. This type can be further classified as immune-mediated or idiopathic. The majority of type 1 diabetes is of the immune-mediated nature, in which beta cell loss is a T-cell-mediated autoimmune attack. There is no known preventive measure against type 1 diabetes, which causes approximately 10% of diabetes mellitus cases in North America and Europe [7]. Most affected people are otherwise healthy and of a healthy weight when onset occurs. Sensitivity and responsiveness to insulin are usually normal, especially in the early stages. Type 1 diabetes can affect children or adults, but was traditionally termed "juvenile diabetes" because a majority of these diabetes cases were in children. "Brittle" diabetes, also known as unstable diabetes or labile diabetes, is a term that was traditionally used to describe to dramatic and recurrent swings in glucose levels, often occurring for no apparent reason in insulin-dependent diabetes. This term, however, has no biologic basis and should not be used. There are many reasons for type 1 diabetes to be accompanied by irregular and unpredictable hyperglycemias, frequently with ketosis, and sometimes serious hypoglycemias, including an impaired counter regulatory response to hypoglycemia, occult infection, gastroparesis (which leads to erratic absorption of dietary carbohydrates), and endocrinopathies (e.g., Addison's disease) [3]. These phenomena are believed to occur no more frequently than in 1% to 2% of persons with type 1 diabetes [8]. People (usually with type 1 diabetes) may also present with diabetic ketoacidosis, a state of metabolic dysregulation characterized by the smell of acetone, a rapid, deep breathing known as Kussmaul breathing, nausea, vomiting and abdominal pain, and altered states of consciousness. A rare but equally severe possibility is hyperosmolar non-ketotic state, which is more common in type 2 diabetes and is mainly the result of dehydration.

In traditional diabetes management, the patient measures glucose concentration after a meal or physical activity, determines the appropriate amount of insulin to inject, and injects insulin intravenously [9]. Nevertheless, the patient cannot do this process in sleep, and the patient's glucose concentration may be out of the normal range in this case. Designing an automated system for regulating blood glucose in patients with diabetes is a solution that researchers have been paying close attention to in recent years. Researchers in this field seek to present solutions to maintain blood glucose levels in the normal range (70-120 mg/dl) [10]. Blood glucose levels below this range lead to hypoglycemia and more to hyperglycemia. If the blood glucose concentration surpasses 120 mg/dl for a long time, it can induce kidney problems, blindness, or even loss of body organs. There is also concern that blood glucose levels may drop below 70 mg/dl, leading to dizziness, coma, or even death [11]. An automated closed-loop glucose control system stands out as a target that has been pursued by researchers for the past five decades [12]. Such devices, known as artificial pancreas [13, 14], consist of a glucose sensor, from which data are collected and entered into an algorithm, which in turn compute the amount of insulin to be delivered through a pump. Fig 1 depicts how such a device could be [15]

In several articles [16-18] authors believe a bi hormonal closed-loop algorithm could provide a safe blood glucose regulation and reduce significantly the risk and time spent in hypo-glycemic episodes [19] compared to usual insulin therapy. The designed controller must be so reliable that the patient can use the artificial pancreas in daily life without worry. Therefore, the controller must be resistant to the system's external disturbances, including meals and physical activity's effect on blood glucose concentration level and stress and mood's effect on the patient's tissue sensitivity to insulin. Further, the controller must be useful in the face of day-to-day and person-to-person variations [20, 21].

The most common way to assess a controller is to utilize mathematical models that express insulin-glucose dynamics. Since the 1960s, many mathematical models have been proposed to explain the human body's insulin-glucose dynamics. Models based on diagnostic tests such as Bergman minimal model, Palumbo model, Panunzi, and De Gaetano model are also presented [22]. While the Dalla Man and Hovorka models are among the most widely used models [23].

Mathematical models in artificial pancreas design are so widespread that mathematical models or virtual patients are used instead of preclinical research or experiments on animal models. Bergman's model is one model that researchers have acknowledged in previous studies to assess the artificial pancreas [24, 25].Various models have been promoted based on the Bergman minimal model. However, none of them has addressed the simultaneous effect of digestion dynamics and exercise-glucose dynamics. So far, different control algorithms have been designed and tested to regulate blood glucose concentrations, including Proportional-Integral-Derivative Controllers (PID) [20, 26], Predictive Controllers (MPC) [27, 28], and neural network (NN) [29], Fuzzy Controllers (FC) [30, 31] and Adaptive Controllers [21, 32] that have reported success in this field.

PID control can be an efficient way to regulate blood glucose. However, PID control parameters must be adjusted individually for each patient, which is not an easy task. Furthermore, the PID controller tends to inject too much insulin after meals, which leads to the induction of hypoglycemia in the patient [33]. Another method that has received much attention is the MPC method. The predictor controller is highly sensitive to day-to-day and person-to-person changes. Proposed methods' performance quality is evaluated with different parameters. The first parameter for evaluating control algorithms is the length of time the controller can keep blood glucose levels within the normal range. Based on this parameter, the PID controller has displayed better results than MPC. In previous studies done from 2016 to 2019, which used PID and MPC controllers, this time was, on average, about 71% of the time tested. The next parameter used to compare the proposed methods' performance is the hypoglycemia frequency. Predictive control compared to PID had better results in decreasing the hypoglycemia frequency [9]. One of the weaknesses of previous studies that have used the virtual patient to assess the proposed method is that none of them has studied the disturbances' effect on the blood glucose regulation system. Additionally, the dynamic effect of the insulin pump, glucose sensor, and its calibration error on the closed-loop system's operation at the same time has not been discussed. According to the researchers, the time lag between subcutaneous insulin injection and observation of its response in the subcutaneous glucose sensor is at least 15 minutes, which can affect the controller's performance and cause the closed-loop system's unstable [23]. In order to design PID and MPC controllers, an estimated patient model is needed. One of the problems in estimating biological systems' models is the lack of significant uncertainty in the estimated model. Another problem is the existence of various internal and external disturbances that maintain their performance well in the presence of model uncertainty and disturbances. Heidarnejad et al [25] used adaptive fractional-order sliding mode control (AFOSMC) to regulate blood glucose concentration in patients with type 1 diabetes. In this study, the Bergman model is used to assess the proposed method. However, the hydrocarbon digestion dynamics and the dynamic relationship between the patient's physical activity level and blood glucose concentration level are ignored. Furthermore, it is assumed that the sensor does not have blood glucose concentration, dynamic behavior, and measurement error.

In this paper, a safe feedback-mode controller with guaranteed performance for state-restricted systems is proposed to regulate the blood concentration level of patients with type 1 diabetes, taking into account the disorder. The proposed controller has not been presented in any other study and is used for nonlinear Lipschitz systems. In order to assess the proposed method, a mathematical model is used as a virtual patient. One of the unique advantages of this model is expressing the dynamic behavior of regulating the blood glucose concentration of a patient with type 1 diabetes both at rest and during exercise and food intake. The controller performance is evaluated during 48 hours in the presence of two concurrent disturbances (effect of hydrocarbon consumption and patient physical mobility) and person-to-person changes in the virtual patient model. Dynamic models have been considered for the glucose sensor and subcutaneous insulin pump, and the delays in them have been taken into account. Moreover, the non-calibrated glucose sensor's effect in the model is investigated.

#### MATERIAL AND METHODS

SIMULATION MODEL

In this paper, how to regulate blood glucose levels in simulation studies is evaluated. For this purpose, a dynamic model is used. The model includes a virtual patient, an insulin pump, and a continuous blood glucose level sensor. The virtual patient model represents the dynamics of insulin-glucose, carbohydrate-glucose, and exercise-glucose.

Virtual Patient Model

The Bergman model has been developed to evaluate the controller, provide changes due to carbohydrate consumption with the help of [10], and provide changes due to physical activity and exercise in [11]. In this model, $I\left(\mathit{\mu U}/\mathit{ml}\right)$ represents the blood insulin concentration, $X\left(\mathit{\mu U}/\mathit{ml}\right)$ represents the transferable insulin concentration, and $G\left(\mathit{mg}/\mathit{dl}\right)$ represents the blood glucose concentration. Additionally, base values ${G}_{b}$ and ${I}_{b}$ are blood glucose base concentration and base blood insulin, respectively. ${u}_{1b}X\left(\mathit{mU}/\mathit{min}\right)$ is the injectable insulin rate to maintain ${I}_{b}$, and constant *n* is the blood insulin clearance rate. In this model, $X\left(t\right)G\left(t\right)$ represents the absorption of glucose affected by insulin. ${\mathit{Vol}}_{G}\left(\mathit{dl}\right)$ indicates the glucose distribution space, and $w\left(\mathit{kg}\right)$ is the mass of an individual [11]. Equations (1) to (13) present the completed model for the virtual patient. The last four equations are added to the model to apply the exercise dynamics' effect, and $D\left(t\right)$ in equation (3) is the amount of carbohydrate absorption in the body that shows the digestion dynamics.

$\frac{\mathit{dI}}{\mathit{dt}}=-\mathit{nI}\left(t\right)+{P}_{4}{u}_{1}\left(t\right)-{I}_{e}\left(t\right).I\left(0\right)={I}_{b}=\frac{{P}_{4}}{n}{u}_{1b}$ (1)

$\frac{\mathit{dX}}{\mathit{dt}}=-{P}_{2}X\left(t\right)+{P}_{3}\left[I\left(t\right)-{I}_{b}\right]\mathit{.\; X}\left(0\right)=0$ (2)

$\frac{\mathit{dG}}{\mathit{dt}}=-{P}_{1}\left[G\left(t\right)-{G}_{b}\right].X\left(t\right)G\left(t\right)+\frac{w}{{\mathit{Vol}}_{G}}\left[{G}_{\mathit{prod}}\left(t\right)-{G}_{\mathit{gly}\left(t\right)}\right]-\frac{w}{{\mathit{Vol}}_{G}}{G}_{\mathit{up}}+D\left(t\right).G\left(0\right)={G}_{b}$ (3)

$\frac{d{G}_{\mathit{prod}}}{\mathit{dt}}=-{a}_{1}\mathit{PV}{O}_{2}^{\mathit{max}}\left(t\right)-{a}_{2}{G}_{\mathit{prod}}\left(t\right)\mathit{.}{G}_{\mathit{prod}}\left(0\right)=0$ (4)

$\frac{d{G}_{\mathit{up}}}{\mathit{dt}}={a}_{3}\mathit{PV}{O}_{2}^{\mathit{max}}\left(t\right)-{a}_{4}{G}_{\mathit{up}}\left(t\right)\mathit{.}{G}_{\mathit{up}}\left(0\right)=0$ (5)

$\frac{d{I}_{e}}{\mathit{dt}}={a}_{5}\mathit{PV}{O}_{2}^{\mathit{max}}\left(t\right)-{a}_{6}{I}_{e}\left(t\right),{I}_{e}\left(0\right)=0$ (6)

$\frac{\mathit{dPV}{O}_{2}^{\mathit{max}}}{\mathit{dt}}=-0.8\mathit{PV}{O}_{2}^{\mathit{max}}\left(t\right)+0.8{u}_{3}\left(t\right)\mathit{.\; PV}{O}_{2}^{\mathit{max}}\left(0\right)=0$ (7)

In these equations ${G}_{\mathit{gly}}\left(t\right)\left(\mathit{mg}/\mathit{kg}/\mathit{min}\right)$ indicates a decrease in glycogenolysis during prolonged exercise due to a reduction in liver glycogen stores. The variables ${G}_{\mathit{prod}}\left(t\right)\left(\mathit{mg}/\mathit{kg}/\mathit{min}\right)$ and ${G}_{\mathit{up}}\left(t\right)\left(\mathit{mg}/\mathit{kg}/\mathit{min}\right)$show the amount of hepatic glucose production and the amount of glucose absorption during exercise. The variable ${I}_{e}\left(t\right)\left(\mathit{\mu U}/\mathit{ml}/\mathit{min}\right)$ is the amount of insulin removed from the circulatory system during exercise and due to physiological changes [11]. Parameter ${p}_{1}$ is the glucose removal rate from the blood space without dependence on the insulin's effect, ${p}_{2}$ is the remote insulin removal rate, ${p}_{3}$ is the internal insulin release rate, and ${p}_{4}$ is the base insulin adequacy ratio. ${a}_{1}$ to ${a}_{6}$are the exercise irreducible model parameters and are estimated using nonlinear least squares [11].

Digestion Dynamics

In order to model the digestion dynamics and express the relationship between $r\left(t\right)$ (carbohydrates entering the body in the meal) in grams and $D\left(t\right)$ (amount of carbohydrates absorbed in the body), the model presented in [10] is used. The proposed model is a second-order linear model that can be seen in (8).

$\left[\begin{array}{c}\stackrel{\text{\u0307}}{D}\left(t\right)\\ \stackrel{\text{\u0308}}{D}\left(t\right)\end{array}\right]=\left[\begin{array}{cc}0& 1\\ \frac{-1}{{T}_{r}^{2}}& \frac{-2}{{T}_{r}}\end{array}\right].\left[\begin{array}{c}D\left(t\right)\\ \stackrel{\text{\u0307}}{D}\left(t\right)\end{array}\right]+\left[\begin{array}{c}0\\ \frac{{k}_{r}}{{V}_{B}{T}_{r}^{2}}\end{array}\right]r\left(t\right)$ (8)

${T}_{r}$ is the digestion time constant, ${V}_{B}$ is the blood volume, and static gain ${k}_{r}/{V}_{B}$ is adjusted to reflect the food composition's glycemic index.

Exercise Dynamics

Lowered hepatic glucose output due to long-term exercise is modeled utilizing an exercise-dependent equation [11]. The maximum oxygen consumption for a person during exercise is taken by $V{O}_{2}^{\mathit{max}}\left(\mathit{ml}/\mathit{kg}/\mathit{min}\right)$. Oxygen consumption is almost linearly proportional to energy consumption. Physical activity is expressed as a percentage of$\left(\mathit{PV}{O}_{2}^{\mathit{max}}\right)V{O}_{2}^{\mathit{max}}$. The average $\mathit{PV}{O}_{2}^{\mathit{max}}$ for a person in the baseline is 8%. Roy et al. [11] revealed that $\mathit{PV}{O}_{2}^{\mathit{max}}$ grows rapidly at the beginning of the exercise, reaches its final value within 5-6 minutes, and remains constant throughout the exercise. Equation (7) has been added to the model to measure exercise intensity. In this equation, $\mathit{PV}{O}_{2}^{\mathit{max}}$ is the level of exercise that has been tested for the individual, and ${u}_{3}\left(t\right)$ indicates the final exercise's intensity above the baseline level.

Glycogen Dynamics

Glycogen of ${G}_{\mathit{gly}}\left(t\right)$ decreases when energy consumption exceeds a critical threshold $\left({A}_{\mathit{TH}}\right)$. ${A}_{\mathit{TH}}$ is a function of exercise intensity and exercise duration and is indicated by (9) in [11].

${A}_{\mathit{TH}}={u}_{3}\left(t\right){t}_{\mathit{gly}}\left({u}_{3}\left(t\right)\right)$ (9)

In which ${t}_{\mathit{gly}}\left({u}_{3}\left(t\right)\right)$ is the exercise duration in minutes and a function of exercise intensity.

${t}_{\mathit{gly}}\left({u}_{3}\left(t\right)\right)=-1.1521{u}_{3}\left(t\right)+87.471$ (10)

And subsequently:

${A}_{\mathit{TH}}=-1.1521{\left[{u}_{3}\left(t\right)\right]}^{2}+87.471{u}_{3}\left(t\right)$ (11)

Therefore, the glycogen dynamics during prolonged exercise can be as shown in Fig 12. $A\left(t\right)$ is the integrated exercise intensity and a function of ${u}_{3}\left(t\right)$. $k$ is the change rate of glycogen rate, which has a decreasing trend. The constant-time ${\tau}_{1}$ denotes the time required for ${G}_{\mathit{gly}}\left(t\right)$ to return to its base value.

$\frac{d{G}_{\mathit{gly}}\left(t\right)}{\mathit{dt}}=\left\{\begin{array}{c}0\mathit{.A}\left(t\right)<{A}_{\mathit{TH}}\\ \mathit{k\; .A}\left(t\right)\ge {A}_{\mathit{TH}}\\ \frac{{-G}_{\mathit{gly}}\left(t\right)}{{\tau}_{1}}.{u}_{3}\left(t\right)=0\end{array}\right.$ (12)

The values of $k$ and ${\tau}_{1}$ are given in [11]. $A\left(t\right)$ is calculated by the system of equations (13).

$\frac{\mathit{dA}}{\mathit{dt}}=\left\{\begin{array}{c}{u}_{3}\left(t\right)\mathit{.}{u}_{3}\left(t\right)>0\\ \frac{-A\left(t\right)}{0.001}\mathit{.}{u}_{3}\left(t\right)=0\end{array}\right.$ (13)

Insulin Pump Dynamics

In this paper, in order to improve the model's accuracy, develop designed controller evaluation quality, and apply the amount of delay caused by the pumps used for insulin injection, the insulin subcutaneous pump dynamic model presented in [34] is used. The diagram in Fig (2) shows the insulin pump's closed-loop system. The system comprises a proportional-integral controller and an electromechanical part that includes a DC motor with a gearbox. In the operating mode, the controller the amount of injected insulin by measuring the engine speed.

Continuous Glucose Sensor Dynamics

In order to measure patients' blood glucose levels, a continuous glucose monitor (CGM) is used, which measures the level of interstitial glucose (IG) concentration with a delay relative to the blood glucose level. Most previous studies typically assume that blood glucose (BG) concentration level and interstitial glucose level are the same; however, the time delay of interstitial glucose response is significant and influential and may cause instability in the closed-loop system. Facchinetti et al. have defined the relationship between BG and IG as (14) in [35].

$\mathit{IG}\left(t\right)=\frac{1}{{\tau}_{\mathit{IG}}}\left(-\mathit{IG}\left(t\right)+\mathit{BG}\left(t\right)\right)$ (14)

In which ${\tau}_{\mathit{IG}}$ is time constant and is about 20 minutes. They also introduced a time series of CGM error to model the time-varying grading error with the sensor measurement error, which is as (15).

$\mathit{SCGM}\left(t\right)=\left(1+\zeta \left(t\right)\right)\mathit{IG}\left(t\right)+v\left(t\right)$ (15)

In which $\mathit{SCGM}\left(t\right)$ shows the SGM output at time t, $\zeta \left(t\right)$ is the time-varying random grading error, and $v\left(t\right)$ is white Gaussian noise with a mean of zero. Ideally, $\zeta \left(t\right)$ should be zero; but it is defined as (16) using a third-order integral of white noise with a mean of zero.

$\zeta \left(t+1\right)=3\zeta \left(t\right)-3\zeta \left(t-1\right)+\zeta \left(t-2\right)+w\left(t\right)$ (16)

In which $w\left(t\right)$ is the white Gaussian noise with a mean of zero. Equations (14) to (16) are used to describe the blood glucose level's sensor model (BG-IG model).

PROPOSED CONTROLLER

Consider the following nonlinear system in the presence of an exogenous interrupt:

$\stackrel{\text{\u0307}}{x}=f\left(x\right)+g\left(x\right)u+n\left(x\right)d$ (17)

Where $\mathit{x\u03f5}$ the system is states vector, $\mathit{u\u03f5}$ is the control input vectors, $d\left(t\right)\mathit{\u03f5D}$ is an external interrupt and $y\left(t\right)\u03f5{R}^{P}$ is the output. Both and, ${n:\mathrm{R}}^{n}\to {\mathrm{R}}^{n}$ are locally Lipschitz with $f\left(0\right)=0$. $d\left(t\right)$ is necessarily limited in time and is defined. The system is assumed to be capable of stabilizing and observable in the zero-state. The usual goal of ${H}_{\infty}$ control design is to find a control policy which stabilizes the system at $d\left(t\right)=0$ and minimize the predefined performance parameter in the system paths (17) as defined below:

$J\left({x}_{0}\mathit{.u.\lambda}\right)={\int}_{0}^{\infty}r\left(x\left(t\right)u\left(t\right)\mathit{.\lambda}\right)\mathit{dt}$ (18)

Where $r\left(\mathit{x.u.\lambda}\right)={\Vert x\Vert}^{2}+{u}^{T}\mathit{Ru}-{\lambda}^{2}{\Vert d\Vert}^{2}$ is the reward function, $R\left(x\right)$ is a determined positive symmetrical matrix and $\lambda $ is the positive constant for the reward function $r\left(x,\mathit{u},\mathit{\lambda}\right)$ defined such that the optimization (18) guarantees minimization of control efforts in order to achieve the proper transient response as well as system stability. Optimal control is in pursuit of the least possible value for ${\lambda}^{*}$ and its respective controller, such that the above problem remains solvable.

Theroem 1

Consider system (17) with the operational function (18). With $\lambda $ constant, there must exist a positive semi-definite function ${V}^{*}\left(x\right)\u03f5{C}^{1}$ which satisfies the HJI inequality such that: ${H}_{\infty}\left({V}^{*}\right)=0$ Where

${H}_{\infty}\left({V}^{*}\right)={\Vert z\Vert}^{2}+{L}_{f}{V}^{*}\left(x\right)-\frac{1}{4}{L}_{g}{V}^{*}\left(x\right){R}^{-1}\left(x\right){\left({L}_{g}{V}^{*}\left(x\right)\right)}^{T}+{L}_{n}{V}^{*}\left(x\right)d-{\lambda}^{2}{\Vert d\Vert}^{2}{V}^{*}\left(0\right)=0$ (19)

Thus, the feedback control

${u}^{*}\left(x\right)=\frac{1}{2}{R}^{-1}\left(x\right){\left({L}_{g}{V}^{*}\right)}^{T}\left(x\right)$ (20)

${H}_{\infty}$ is a controller with ${L}_{2-\mathit{gain}}\le \lambda $ [36]. Note that equation (19) is a nonlinear partial differential equation also optimizes the system (17) is input-to-state safe on a set $L\subset {R}^{n}$ taking into account the interrupts d, on condition that $\mathit{\eta \u03f5}{K}_{\infty}$ and $\stackrel{\text{\u0305}}{d}>0$ exist such that the set $L\subset {L}_{d}$ is defined as below:

${L}_{d}=\left\{\mathit{x\u03f5}{R}^{n}:b\left(x\right)+\eta \left({d}_{\mathrm{\infty}}\right)\ge 0\right\}$ (21)

Which is forward invariant for all d satisfying$\Vert {d}_{\mathrm{\infty}}\Vert \le \stackrel{\text{\u0305}}{d}$. L is defined as a safe input-to-state set on condition that the ${L}_{d}$ set exists.

As can be seen from [37], the existence of an ISSf-BF for (17) is indication that is a set of ISSf. Similar to non-turbulent subjects, the control barrier function concept is defined for a compound of controllers which guarantee input-to-state safety:

With $b\left(x\right)$ the acceptable state space $\mathit{SI}\left(x\right)$ becomes:

$\mathit{SI}\left(x\right)=\left\{\mathit{u\u03f5}{R}^{m}|\mathit{AI}+{K}_{b}\left(b\left(x\right)\right)+i\Vert d\Vert \ge 0\mathit{x\u03f5X}\right\}$ (22)

Where $\mathit{AI}={L}_{f}b\left(x\right)+{L}_{g}b\left(x\right)u+{L}_{n}b\left(x\right)d$

Presentation Safe robust optimal control

While an optimal ${H}_{\infty}$ controller based on the HJI solution of (19) guarantees performance, it cannot provide safety in a reliable manner. On the other hand, a controller based on satisfying CBF (22) guarantees safety but might compromise performance. In order to maintain performance and safety simultaneously and in the presence of interrupts, in this section we will attempt to design stabilizing robust safe controllers which can guarantee performance in the valid safe region. The solution to the HJI (19) notwithstanding the constraints is an arduous task requiring an approximation of the optimal solution. Repetitive algorithms with an iterative policy to solve HJI inequalities can be employed without constraints. However, considering that the repetitive algorithms for the presented policies could not guarantee safety, thus by taking into account the safety constraints these algorithms will be invalidated. In this paper, in order to find a safe control policy with guaranteed performance in the presence of interrupts, we will first simplify the solution to the optimal control problem by solving the HJI inequality $\left({-H}_{\infty}\left(V\right)\ge 0\right)$ instead of the HJI equation (19). This paves the way for achieving suboptimal solutions with the aim of minimizing problem (18) under (17). Formulation allows for the satisfaction of the safety constraints while considering CBP as another inequality which must be satisfied. The simplified optimal control problem for system (17) with the performance of (18) must first be revised as below:

$\mathit{st.}\begin{array}{c}\underset{V}{\mathrm{min}}{\int}_{\mathrm{\Omega}}^{V}\left(x\right)\mathit{dx}\\ -{H}_{\infty}\left(V\right)\ge 0\\ V\in \end{array}$ (23)

Where ${H}_{\infty}\left(V\right)$ is defined by (19) and $\mathrm{\Omega}\subset $ is an arbitrary compressed set which includes the origin. These demonstrates a region where more interrupt damping is expected. The improved system after the safe policy assessment stage in (23) allows for smaller damping coefficients in order to achieve L2-gain performance.

The above problem in essence solves a simplified version of the HJI (19) where the HJI equation is simplified using the HJI inequality. It has been demonstrated that the solution to problem 1 is singular and if V* is a solution for (23), then:

${u}^{\infty}\left(x\right)=\frac{1}{2}{R}^{-1}\left(x\right){\left({L}_{g}{V}^{*}\right)}^{T}\left(x\right)$ (24)

Guarantees stability and ${V}^{*}$ can be considered as a top limit or a top approximate for actual cost. The $\infty $ superscript used here signifies that ${u}^{\infty}$ is a performance-oriented controller. However, this control policy does not reassure system safety. Using this simplified optimal control formulation, we will now present the following optimization framework wherein performance and safety have been considered. Safety is guaranteed by adding a CBF inequality to the optimal control problem formulation. The proposed safe optimization in the presence of interrupts is presented as follows:

Problem 1: (Optimal robust safe control)

Find a controller that solves the following equation:

$\mathit{st.}\begin{array}{c}{\int}_{\mathrm{\Omega}}^{V}\mathit{dx}+{k}_{\xi}{\xi}^{2}\\ {-H}_{\infty}\left(V\right)\ge \xi \\ \mathit{AI}+{K}_{b}\left(b\left(x\right)\right)+i\Vert d\Vert \ge 0\end{array}$ (25)

Where $\mathrm{\Omega}$ the level that system improvement is expected is, ${k}_{\xi}>0$ is the design parameter which established the trade-off between aggressiveness and safety, and $\xi $ is the stability relaxation factor. Note that $\xi $ can be the taken as the aspiration level for performance to show how much the performance has been compromised in a state where both safety and performance cannot be simultaneously achieved. However, this parameter is minimized in order to achieve the best possible performance.

#### Results

**Simulation**

In this section, a virtual patient model is used to evaluate the proposed controller's performance. Assuming the effect of hydrocarbon-glucose and exercise-glucose dynamics as disturbance inputs to the system, the insulin-glucose dynamics are modeled according to Equation (1). In the hypothetical model, the variable *x* (model output) is equivalent to parameter *G* in the virtual patient dynamic equations, i.e., the blood glucose concentration level, and the variable *u* (model input) is equivalent to parameter ${u}_{1}$ in the virtual patient dynamic equations, i.e., the amount of insulin injection. The effect of exercise and hydrocarbon consumption is considered in the model (1) with variable$\mathit{d}\left(x\right)$. In order to evaluate the proposed method, ten virtual patients have been considered using changing model parameters. All five patients have similar disease characteristics that make up two groups of patients. The first group is patients with diabetes who have recently developed diabetes, and their body sensitivity to insulin has not changed yet. Blood glucose levels are higher than average in this group of patients. The second group of patients has lower blood insulin levels than healthy individuals [38]. Virtual patient model parameters are different. The values of these parameters are shown in Table (1). Patient model parameters are extracted from reference [11].

Every day, there are three meals of 72 grams of carbohydrates and two snacks of 30 grams of carbohydrates for patients. Additionally, two rounds of exercises during the 48 hours are considered for patients. In the first round, the patient exercises for one hour at the end of the first day (between 10 and 10:30). Then, in the second round, the patient exercises for two hours at the beginning of the second day's night (between 7 and 7.30). To observe the effect of food consumption and exercise separately, the intervals of these two disturbances are considered more. Further, at first, the patient's food consumption period is completed during the day; the exercise period is then evaluated. Moreover, the optimal blood glucose level for all virtual patients is set at $100\raisebox{1ex}{$\mathit{mg}$}\!\left/ \!\raisebox{-1ex}{$\mathit{dl}$}\right.$.

The proposed method's simulation results are compared with the PID controller, linear MPC [39], and AFOSMC. The optimal PID controller coefficients for all two groups of patients are given in Table (2). In order to implement predictive control, the linear predictive control method [40] and the linearized virtual patient model are used, though the performance of the predictive controller on the virtual patient is evaluated with a nonlinear model. It is important to note that in the implementation of all three control methods, the control signal's value cannot be negative because being negative means that the insulin injected into the body can be removed by a practically impossible mechanism.

Simulation Results of First Group Patients

Patients with first-group diabetes have higher than normal blood glucose levels, resulting from the lower-than-normal insulin injection [38]. Accordingly, for this group, ${G}_{b}=250\raisebox{1ex}{$\mathit{mg}$}\!\left/ \!\raisebox{-1ex}{$\mathit{dl}$}\right.$, and because the tissue sensitivity of patients in this group has not changed, *n=0/133* and ${I}_{b}=10\raisebox{1ex}{$\mathit{\mu U}$}\!\left/ \!\raisebox{-1ex}{$\mathit{ml}$}\right.$.

The initial condition for blood glucose concentration in all patients is $270\raisebox{1ex}{$\mathit{mg}$}\!\left/ \!\raisebox{-1ex}{$\mathit{dl}$}\right.$. Due to a large number of results in each category, the proposed method's simulation results are only shown for the 75 kg patient in both categories. The figure 3 indicate the amount and timing of meals, and exercise time, respectively.

Comparing maximum and minimum blood glucose levels during the simulation period with the results of PID, MPC, and AFOSMC controllers reveals that the proposed controller has a lower maximum level than all three other methods. The minimum blood glucose level is sufficient. This suggests that our proposed controller is resistant to Hypoglycemia and Hyperglycemia. Furthermore, the duration of keeping blood glucose levels in the normal range was longer than the other controller**.**

#### Table 1

Values of patient model parameters

#### Table 2

optimal PID controller coefficients

Category 2 | Category 1 | |
---|---|---|

1 | 1/1 | ${K}_{P}$ |

0/01 | 0/05 | ${K}_{I}$ |

0/01 | 0/1 | ${K}_{D}$ |

#### Table 3

Comparison of control results of both groups of patients

**Simulation Results of the Second Group of Patients**

In the second group, patients' blood insulin levels are critically lower than normal, which may be due to untreated type 1 diabetes for a long time. Additionally, the blood glucose level of these patients is critically higher than normal [38]. So the parameters *n=0/133, *${G}_{b}=270\mathit{mg}/\mathit{dl}$ and ${I}_{b}=2\mathit{\mu U}/\mathit{ml}$ are selected. The results for the 75 kg patient in this category are also shown in Fig 6.

The results of the proposed controller simulations in both groups of patients in Table 3 are compared with the results of the PID controller, MPC, and AFOSMC. The results indicate that the controller has been able to deal well with the disturbances. Comparing the proposed controller's results with the PID controller, MPC, and AFOSMC shows the proposed controller's ability to deal with hypoglycemia. The duration of normal blood glucose concentration has been longer than the other three methods. The proposed controller detects glucose drop due to physical activity well and prevents hypoglycemia by injecting less insulin.

#### Conclusion

Maintenance time of blood glucose level in the appropriate range has been a measure of the success of controllers designed for people with diabetes. The controller proposed in this paper has provided reasonable optimal and stable control in 48 hours for ten patients with different physiological parameters in two separate categories. The proposed controller presents a secure control mechanism to maintain blood glucose levels within the normal range. Another strength of the proposed controller is the concurrent disturbances control of food and physical and exercise activities, revealing the controller's resistance to patients' individual changes. The results show that in the presence of food and exercise disturbances, it can keep blood glucose level in the desired range and prevent hypoglycemia and hyperglycemia.

#### AUTHOR’S CONTRIBUTION

All authors contributed to the literature review, design, data collection and analysis, drafting the manuscript, read and approved the final manuscript.

#### CONFLICTS OF INTEREST

The authors declare no conflicts of interest regarding the publication of this study.

#### FINANCIAL DISCLOSURE

No financial interests related to the material of this manuscript have been declared.

#### References

*MMW Munch Med Wochenschr.*1977;119(19):671–4.

*Available from: http://www.npr.org/blogs/health/2019/06/21/155505445/how.*

*Lancet.*2010;375(9733):2215–22. PMID: 20609967 DOI: 10.1016/S0140.

*Global Journal of Science, Engineering and Technology.*2012;3:23–31.

*In: Gardner DG, Shoback D (eds). Greenspan's basic & clinical endocrinology. 9th ed. New York: McGraw-Hill Medical*2011;

*12th ed. Philadelphia: Elsevier/Saunders.*:2011.

*Pediatr Rev.*2008;29(11) 374–84. PMID: 18977856 DOI: 10.1542/pir.29.

*Diabetes Care.*2008;31(5) 899–904. PMID: 18223030 DOI: 10.2337/dc07.

*Diabetes Care.*2014;37(5):1191–7.

*IEEE Trans Biomed Eng.*2015;62(6):1546–52.

*J Diabetes Sci Technol.*2007;1(3):338–47.

*Am J Med Electron.*1964;3:82–6.

*Annu Rev Control.*2012;36(2):255–66.

*Diabetes.*2011;60(11) 2672–82. PMID: 22025773 DOI: 10.2337/db11.

*Control Applications for Biomedical Engineering Systems.*2020;2020:25–54.

*American Control Conference*2015;

*European Control Conference. IEEE*2016;

*Medical XPress, Douglas, Isle of Man*2018;

*IEEE Control System Magezine.*2018;38(1)

*J Diabetes Sci Technol.*2012;6(6):1401–12.

*J Diabetes Sci Technol.*2011;5(6):1312–26.

*Theoretical Biology and Medical Modelling.*2009;6(1):1–10.

*Biomedical Signal Processing and Control.*2013;8(2):107–19.

*IEEE Bioengineering Conference Proceedings. IEEE*2001;

*In: Babiarz A, Czornik A, Klamka J, Niezabitowski M (eds). Theory and applications of non-integer order systems. Springer*2017;

*J Diabetes Sci Technol.*2013;7(3):699–707.

*J Diabetes Sci Technol.*2013;7(6):1446–60.

*Application of zone model predictive control artificial pancreas during extended use of infusion set and sensor: A randomized crossover-controlled home-use trial. Diabetes Care.*2017;40(11)

*Journal of the Franklin Institute.*2012;349(5):1851–70.

*Front Health Inform.*2019;8(1):e24.

*Front Health Inform.*2017;6(1):11–22.

*Biomedical Signal Processing and Control.*2019;:47: 49–56.

*J Diabetes Sci Technol.*2009;3(1)

*International Joint Conference on Neural Networks. IEEE*2013;

*J Diabetes Sci Technol.*2010;4(1):4–14.

*IEEE Transactions on Automatic Control.*1992;37(9):1283–93.

*IEEE Control Systems Letters.*2018;3(1):108–13.