Automated blood glucose regulation for nonlinear model of type-1 diabetic patient under uncertainties: GWOCS type-2 fuzzy approach

Regulating blood glucose level (BGL) for type-1 diabetic patient (T1DP) accurately is very important issue, an uncontrolled BGL outside the standard safe range between 70 and 180 mg/dl results in dire consequences for health and can significantly increase the chance of death. So the purpose of this study is to design an optimized controller that infuses appropriate amounts of exogenous insulin into the blood stream of T1DP proportional to the amount of obtained glucose from food. The nonlinear extended Bergman minimal model is used to present glucose-insulin physiological system, an interval type-2 fuzzy logic controller (IT2FLC) is utilized to infuse the proper amount of exogenous insulin. Superiority of IT2FLC in minimizing the effect of uncertainties in the system depends primarily on the best choice of footprint of uncertainty (FOU) of IT2FLC. So a comparison includes four different optimization methods for tuning FOU including hybrid grey wolf optimizer-cuckoo search (GWOCS) and fuzzy logic controller (FLC) method is constructed to select the best controller approach. The effectiveness of the proposed controller was evaluated under six different scenarios of T1DP using Matlab/Simulink platform. A 24-h scenario close to real for 100 virtual T1DPs subjected to parametric uncertainty, uncertain meal disturbance and random initial condition showed that IT2FLC accurately regulate BGL for all T1DPs within the standard safe range. The results indicated that IT2FLC using GWOCS can prevent side effect of treatment with blood-sugar-lowering medication. Also stability analysis for the system indicated that the system operates within the stability region of nonlinear system.


Introduction
The number of the people suffering from diabetes mellitus (DM) is increasing yearly.In 2014 the number of patients with DM reached 422 million compared to 108 million in 1980 according to the most recent global report on diabetes by world health organization (WHO) [1], also this number is increased to 537 million in 2021 according to latest atlas edition by international diabetes federation (IDF) [2].When this disease is left uncontrolled it has dire consequences for health and quality of life, in 2012 diabetes caused 1.5 million deaths, also the higher BGL than the optimal value caused an additional 2.2 million deaths by increasing the risk of cardiovascular and other diseases [1].Uncontrolled DM leads to different complications include cardiovascular disease, heart attack, instant coma, kidney failure, leg amputation, and others [1,2].DM is generally categorized into two types: type-1 and type-2, type-1 DM is a metabolic disease occurs due to autoimmune destruction of β cells of pancreas, as a result the pancreas becomes unable to produce enough or any amount of insulin to lower BGL in blood stream, this type is also known as insulin-dependent as patients of this type always need infusing exogenous insulin to survive [3].While in type-2 DM insulin production by β cells is unaffected but patients of this type suffer from insulin deficiency and insulin resistance that the cells of the body can't utilize insulin to regulate BGL [3].
Early detection and future prediction of diabetes can save the patients from many complications and greatly reduces the chance of death thanks to machine learning techniques, because the patient will be able to receive appropriate treatment at an early stage of the disease.In this regard many efforts have been made, in [4][5][6] different machine learning algorithms were applied to predict and improve the medical diagnosis of DM.
For a healthy person the standard-safe range of BGL is between 70 and 180 mg/dl [7], consequently the main target for patients with DM is to regulate their BGL within the standard-safe range.There are actually many vital organs that contribute to the regulation of BGL such as liver, brain, intestine, pancreas, etc., however the pancreas is the organ that plays a major and influential role in regulating BGL [8].Pancreas produces and secretes a two very important things, pancreatic hormones and digestive enzymes [8].These pancreatic hormones are primarily responsible for regulating BGL, it is produced from endocrine cells that called islets of Langerhans [8].There are different types of pancreatic hormones that are produced and secreted by five types of cells, β, α, γ, δ, and ε cells that make up the islet of Langerhans.Insulin, amylin, and C-peptide hormones are produced by β cells, glucagon hormone is produced by α cells, polypeptide hormone is produced by γ cells, somatostatin hormone is produced by δ cells, and ghrelin hormone is produced by ε cells [8].Among all these hormones which are responsible for regulating BGL insulin and glucagon play an essential role in this regard, where after a meal is digested a proper amount of insulin is secreted into blood by β cell of pancreas proportionally to the amount of glucose appears into blood, this amount of insulin stimulates different cells of the body to absorb glucose and use it to produce energy thus insulin lowers BGL.While glucagon is secreted into blood by α cell of pancreas when the BGL is at its lowest.Glucagon when is secreted stimulates the liver to produce stored hepatic glucose thus glucagon increases BGL.Based on the above maintaining BGL within the standard-safe range depends essentially on the interplays between insulin and Glucagon [8].
If type-1 DM when is left uncontrolled it leads to a situation called hyperglycemia in which BGL reaches more than 180 mg/dl, this is in turn leads to long term complications like cardiovascular disease, heart attack, blindness, kidney failure, leg amputation, and others [9].While infusing excessive amount of exogenous insulin leads to a situation called hypoglycemia in which BGL reaches less than 50 mg/dl, this in turn leads to instant coma and death [9].
Since the discovery of insulin T1DPs have been receiving exogenous insulin manually based on measuring BGL many times during the day and after meals, regardless of the fact that this method is time consuming, unreliable, and painful, it is not suitable at night during sleep hours [10].Artificial pancreas (AP) has been developed to overcome the defects of the manual method [11].It is a closed loop control system shown in Fig. 1 in which insulin is infused automatically by infusion pump according to both the readings of a continuous glucose sensor (CGS) and the control algorithm that calculates the optimal rate of exogenous insulin infusion [10].
There is required a secure and reliable communication technology, recently several methods have been developed to improve medical equipment, whale optimized weighted fuzzy-based cluster head selection algorithm was used in [12] to improve communication performance for IoMTbased systems on the 5G network.
Closed loop AP is primarily depends on the mathematical model of T1DP, unfortunately it faces a great challenges when it is applied in practice to a real T1DP because of two reasons: the first reason from the patient side like parametric uncertainty (the parameters of the model vary from patient to other as well as the parameters vary within the same patient), uncertain meal disturbance, and physical exercise that can burn glucose, thus the dose of insulin needs to be Fig. 1 Closed loop control system of AP continually changed [13].And the second reason is related to uncertainties that affect the whole control system in general.
Since designing a robust controller depends primarily on a mathematical model, over time many mathematical models have been developed to describe glucose-insulin physiological system for T1DP [14].It is classified into two types intravenous and subcutaneous based on the way of the measurements of insulin and glucose [14].Because it is less complex than the others and keeps the minimal state variables necessary to describe the relationship between glucose and insulin for diabetic patient, an intravenous glucose tolerance test (IVGTT) of the Bergman minimal (BM) model [15] is regarded as the most popular in research on artificial pancreas.The three differential equations with its states will model the complete behavior of glucose and insulin kinetics for patients.The first one indicates BGL, where the other one reveals the remote insulin, and the last equation indicates plasma insulin level.By doing so, the BM model helps academics overcome one of their biggest challenges when working with several nonlinear differential equations.
For reasons of high cost and reliability measuring all state variables practically is not possible, so the control algorithm of AP should rely only on the readings of the CGS [14].
So the motivation behind conducting this study is to provide simple-accurate and robust closed loop controller to regulate BGL for T1DP within the standard safe range between 70 and 180 mg/dl which utilizes only the readings of the CGS since the measurement of remote insulin and plasma insulin level is practically not possible, it is also should take into account the aforementioned challenges that T1DP always faces during the infusion of exogenous insulin.After food has been digested as the BGL for T1DP rises above the basal glucose level, the output of the controller must infuse an appropriate amount of exogenous insulin into the bloodstream of T1DP to avoid hyperglycemia situation.The insulin infusion rate must also be closely proportional to the amount of glucose obtained from food because an excessive infusion of exogenous insulin leads to a hypoglycemia situation.Moreover, the output signal of the controller must restrict to be positive or non-negative since insulin infusion rate practically is always non-negative, consequently no excessive controller or algorithm are needed to infuse glucagon or glucose to avoid hypoglycemia and this also enhances the simplicity of the design and reduces complexity and cost.

Related work
Recently, the control algorithm of AP has been proposed in the literature based on linear control approach and nonlinear control approach.In [16][17][18] PID Controller was designed to regulate BGL of T1DP based on continuous glucose measurements but the integral action may increase the insulin overdose and hence increasing the chance of hypoglycemia, an improved PID algorithm based on switching off PID controller prior to meal bolus and then restarting it according to switching strategy was proposed in [19], PID controller with insulin feedback algorithm to prevent excessive intake of exogenous insulin was proposed in [14,20], optimal H ∞ switching controller based on a group of basic insulin infusion rates and a rule that switches the insulin infusion rate from one value to another was proposed in [21], in [22] linear parameters varying model was utilized to consider a time-varying characteristics of the problem dynamics at the control law.Since the physiological system of glucoseinsulin is nonlinear and its parameters are uncertain vary from patient to other, it is preferable to use with nonlinear systems a nonlinear control approach rather than a linear control approach to increase stability and performance of the system.In [23,24] sliding mode controller is designed to regulate BGL of T1DP, also in [25] terminal synergetic and state feedback linearization based controllers were proposed, a backstepping controller was designed in [13], adaptive backstepping controller was designed in [26].For mentioned control approaches in [13,[23][24][25][26] it provides satisfactory performance in regulating BGL of T1DPs against parametric uncertainty and meal disturbance however it considered in the design the possibility of measuring all state variables which practically is not true for reasons of high cost and reliability.In [27][28][29] model predictive control (MPC) was utilized to regulate BGL of T1DP, it has the ability to deal with parametric uncertainty of glucose-insulin physiological system however the computational of iterative online optimization process is complex and its efficiency depends on how the accuracy of the predicted output is, in [30] nonlinear explicit MPC (NEMPC) was used to avoid the computational complexity of iterative online optimization, in [31] the output error state observer was used with MPC to correct the output variable prediction and hence improve the performance of the MPC, also in [32] extended kalman filter was used with NEMPC to estimate unavailable states for T1DP to improve the accuracy of the predicted BGL.To deal with unmeasured state variables, observer was used in conjunction with nonlinear adaptive controller in [33], with backstepping controller in [9], and with predictor feedback controller in [34] to estimate unmeasured state variables.For mentioned control approaches in [9,[31][32][33][34] better regulation of BGL was achieved based only on BGL measurements without the need to measure other status variables of remote insulin and plasma insulin level, however the desired performance of the system depends on the accuracy of the estimated state variables which the observer model must be close to the real system.Accordingly, there is a research gap in the literature, is there a control approach that can effectively regulate the BGL of T1DPs to counteract the uncertainties introduced into the system based only on BGL measurements without having to use the system model, nor does it need to measure or estimate other state variables of remote insulin and plasma level.In this regard FLC was applied in [35,36].
FLC have gained popularity in the last two decades where it doesn't depend on the mathematical model of the controlled system, it depends on the designer's previous experiences and his knowledge about the controlled system, this knowledge and experiences about the system are expressed in the form of (IF-THEN) rules, then this rules are incorporated into FLC on how to best control the system, thereby FLC emulate the decision making process of the human that enable us to utilize our previous experience and knowledge about the controlled system [37].
However when the controlled system is exposed to uncertainties, FLC can't deal with it, can't reduce its impact on the controlled system and thus it reduces the desired performance of the system.Due to its internal structure, type-2 fuzzy logic controller (T2FLC) is very appropriate in such situation as it have the capability to model the uncertainties in the system and minimize its impact, thus it improves the performance of the systems that are exposed to uncertainties [38].There are many sources of uncertainties that affect the system: (1) External disruptions that have an impact on the system's stability because they directly disrupt data transfer from sensors to controllers and from controllers to actuators [39].(2) The sensors utilized to provide the system with the necessary measurements lack reliability, and as a result, the data based on these measurements is noisy.[40].(3) Due to the relationships and dependencies among their components, complex nonlinear systems are challenging to represent, which causes modeling uncertainty [41,42].(4) We describe variables with words rather than numbers in the antecedent and consequent parts of the rule base of a fuzzy logic system (FLS) based controller, which can be a rich source of uncertainties since words can have various meanings to different people [43].Moreover, as we mentioned before uncertainties related to the patient like parametric uncertainty (the parameters of the model vary from patient to other as well as the parameters vary within the same patient), uncertain meal disturbance, and physical exercise that can burn glucose, thereby the dose of insulin needs to be continually changed [13].
Over time T2FLC has shown superiority in different applications in dealing with uncertainties and minimizing its impact on the system, therefor in this study an IT2FLC (a special case of T2FLC) is designed to obtaining accuratesafe regulation of BGL for T1DPs during their daily life.The uncertain nonlinear EBMM is used to present glucoseinsulin physiological system of T1DP, the parameters of IT2FLC are tuned using GWOCS [44] to infuse the proper amount of exogenous insulin.Then a comparison includes four different optimization methods for IT2FLC such as GWOCS, ALO [45], PSO [46], WOA [47] and FLC method is constructed to show the superiority of IT2FLC using GWOCS over the other methods.
Superiority of IT2FLC in minimizing the effect of uncertainties in the system depends primarily on the best choice of FOU of interval type-2 fuzzy set (T2FS) for each of inputs and output of IT2FLC.FOU enable us to incorporate uncertainties in the membership function of T2FS thereby varying FOU saves a more degree of freedom in designing IT2FLC.FOU can be chosen using an appropriate optimization method, the selection of a good optimization method will improve the performance of IT2FLC.GWOCS is found to be the best optimization method after comparing with other optimization methods as will be shown at rest of this paper.So FOU for each of inputs and output of IT2FLC are tuned using GWOCS where the objective function (OF) of GWOCS is minimized during the optimization process in order to decrease the effect of both parametric uncertainty and uncertain meal disturbance and stabilize BGL within the standard-safe range.Thereby IT2FLC using GWOCS contributes essentially in regulation of BGL for T1DP.
The performance and the effectiveness of the proposed controller are evaluated under six different scenarios of T1DP using Matlab/Simulink platform.Scenario in which nominal parameters of EBMM are used under difficult conditions that T1DP is already in the state of hyperglycemia (BGL > 180 mg/dl) at the start of simulation along with a large meal containing high amount of glucose is provided to T1DP.Other scenario in which a 100 simulation rounds are run to study the behavior of 100 virtual-different T1DPs (parametric uncertainty of EBMM) along with a large meal.Other scenario in which a 100 simulation rounds are run with a 100 virtual-different T1DPs to study the behavior of varying both amount of meal and its time randomly.Also in order to perform a simulation that is very close to the reality, a simulation scenario with 24 h simulation period is performed for nominal parameters of the model in addition to model under the presence of both parametric uncertainty and uncertain meal disturbance for 200 virtual T1DPs with the following configuration: three variable different meals for breakfast, lunch, and dinner are randomly chosen from the range 4 mg/dl/min to 9 mg/dl/min Moreover, other critical scenario with the configuration of three different meals 5 mg/dl/min for breakfast, 8 mg/dl/min for lunch and dinner are provided at 8 am, 12 am, and 8 am respectively along with random initial condition of all the state variables of EBMM.Also, a graphical tool called control variability grid analysis (CVGA) is used to assessment the quality of the proposed controller [48].
Simulation results show that the proposed controller can avoid both severe hypoglycemia and hyperglycemia for nominal parameters of the model, in addition to model under the presence of both parametric uncertainty and uncertain meal disturbance and random initial condition of the state variables of EBMM.Control signal of the proposed controller is smooth, not aggressive and always non-negative, it doesn't need any excessive method or algorithm to inject glucagon or glucose to avoid hypoglycemia [49].Consequently the proposed controller is less complex, low cost and easy to implement.Also stability analysis for the system is performed using Lyapunov function to determine the stability region of nonlinear system and simulation results of scenario1 and scenario 2 of Sect. 3 prove that the system operates within this stability region that its constraints are deduced in Sect. 2.
The main contributions of this work are as follows: • Here, an efficient method for regulation of BGL for T1DP is presented using IT2FLC with the conjunction of different optimization methods such as GWOCS, ALO, PSO, and WOA, then a comparison includes these optimization methods and FLC method is constructed to select the best controller that achieves the best results to infuse the proper amount of exogenous insulin.Importantly, the combination of IT2FLC and multiple optimization methods is a novel approach for regulation BGL that has not been explored in previous works.These contributions demonstrate the potential of the proposed method to significantly improve glucose control in type 1 diabetic patients.• The tuning of parameters was done for range of FOU of each of inputs and output of IT2FLC but the scaling factors of IT2FLC are held constant and equal to 1.This will increase the robustness of the controller against of the uncertainties.• Although the nonlinearities are considered in the model, the controller is easy to implement and the performance of the controller is investigated under different scenarios and conditions of T1DPs to prove the effectiveness of the proposed technique.Also CVGA plot is used to assessment the quality of the proposed controller for these scenarios.
The rest of this paper is categorized as follow: Section 2 presents and details the following points, the mathematical model of EBMM and the meaning of its variables and parameters, the concept of type-2 fuzzy logic system (T2FLS) and T2FS with a detailed explanation of how to proceed into each stage of interval type-2 fuzzy logic system, design of IT2FLC for regulation of BGL for T1DP with a detailed explanation of GWOCS, and Stability analysis for the system using Lyapunov function to determine the stability region of nonlinear system.In Sect. 3 results and discussion are presented.Finally conclusion is presented in Sect. 4.

EBMM of T1DP
Because it is less complex than the others and keeps the minimal state variables necessary to describe the relationship between glucose and insulin for diabetic patient, an intravenous glucose tolerance test (IVGTT) of the Bergman minimal (BM) model [15] is regarded as the most popular in research on artificial pancreas.The three differential equations with its states will model the complete behavior of glucose and insulin kinetics for patients.The first one indicates BGL, where the other one reveals the remote insulin, and the last equation indicates plasma insulin level.
To model the behavior of meal disturbance in BM model, a new equation with a new state variable has been added in the extended Bergman minimal model (EBMM) to constitute the dynamics of meal [33].
Thereby the mathematical equations of the EBMM are as follow and also the meaning of variables and parameters of EBMM are explained in Table 1:

Type-2 fuzzy logic system
T2FLC is a T2FLS based controller, the superiority of T2FLS over FLS comes through its ability to model uncertainties about any variable in the system and minimize its impact, that's why the benefits of T2FLS appear strongly in applications that are exposed to uncertainties.Modeling uncertainties needs a method to measure dispersion about the variable (how the points that constitute the uncertainties about the variable are distributed and spanned) [50].So a set of numbers is needed rather than a single specific number in FLS to capture more information about uncertainties about any variable in the system.T2FLS saves this method to model uncertainties and can effectively minimize its impact while the ordinary FLS has limited capabilities in this regard [50].
Figure 2 shows fuzzy set (FS) denotes "A" of an ordinary FLS, the membership grade of any given point x � ∈ X on the universe of discourse X equal to u′ which is a single specific number. (1) The FS "A" can be expressed mathematically as: ∫ Denotes union over all admissible x, μ A (x) is the member- ship grade of x ∈ X in A and it takes just one value from the constraint 0 ≤ A (x) ≤ 1.
A T2FS denotes " Ã " of T2FLS is depicted in Fig. 3.It is resulted from blurring the membership function (MF) of FS of Fig. 2 [51], the membership grade of x′ on T2FS is a set of numbers takes their values from the intersection of the vertical line at x′ in the U axis.It can be assigned at each point resulted from the intersection of the vertical line at x′ an amplitudes distribution that can construct a three dimension type-2 membership function (T2MF) as shown in Fig. 4, its axis are x, u, Ã(x, u) which character- izes a T2FS.Those amplitudes distribution in Ã(x, u) axis is not necessary that all of them be equal.
" Ã " can be expressed mathematically as [51]: ∬ Denotes union over all admissible x and u, and Ã(x, u) is a T2MF that characterizes a T2FS, it takes their values from the constraint 0 ≤ Ã(x, u) ≤ 1.  J x Is the primary membership of x in Ã , also called the domain of a secondary membership of x in Ã.
The membership grades of the primary membership of x in Ã are called the secondary membership of x in Ã and also called the vertical slices in Ã(x, u) axis.
When all of the vertical slices in Ã(x, u) axis equal 1, then the resulting T2MF is an interval type-2 membership function (IT2MF) as shown in Fig. 5 that characterizes an interval type-2fuzzy set (IT2FS) [52].
Ã Can be expressed mathematically as [52]: The shaded region on the x − u plane in Fig. 5 is the FOU, the FOU is a complete description of an IT2FS, this is because the secondary grades of IT2FS equal to 1, and thereby it conveys no new information [52] The FOU in the primary memberships of Ã is the union of all primary memberships that is: The FOU for an IT2FS is shown in Fig. 6, it is bounded from the above and below by a two ordinary MFs that are called lower MF and upper MF, and are denoted Ã(x), Ã(x), ∀x ∈ X respectively.

Interval type-2 fuzzy logic system
Over the years a lot of efforts have been made to facilitate the complex mathematical operations accompanying T2FLS so that researchers and engineers can utilize it in solving problems of many different applications in various areas [53].The mathematical operations accompanying T2FSs are very complex and time consuming while it is simple to IT2FSs (IT2FSs is considered a special case of general T2FSs) [52], since it needs to can use IT2FSs that we are just familiar with the mathematical operations of ordinary FSs such as union, intersection, and complement.That is why IT2FLS that is characterized by its IT2FSs have gained popularity among many practitioners and engineers.Consequently IT2FLS have been contributed in different applications: in [54] it controls restricted crossing U-turn traffic, in [55] it simulates the driver's operating habits of intelligent vehicles control, in [56] its application in handling map matching uncertainties for airport ground movements, and In [57] regulate the mean arterial blood pressure for hypertensive patients with different health status conditions.The structure of IT2FLS is shown in Fig. 7 [38].It is almost the same as for ordinary FLS, its rule-base is composed of (IF-THEN) rules as for FLS but now some or all of its antecedent and consequent parts are of IT2FS.It differs from FLS in that the output of the fuzzifier block is IT2FSs, consequently the fuzzy output sets of inference engine block is IT2FSs.Since most applications like in a control system require a single crisp number from the output of the controller rather than a set of numbers in order to can take a control action, the defuzzifier block in FLS is replaced by output processing block which internally consists of two blocks the first which converts IT2FS to FS that is called type-reducer and the second is just a defuzzifier as in FLS to convert FS to a single crisp number.
There are many algorithms one can use to perform typereduction, Karnik-Mendel (KM) algorithm [58] is the popular one it is simple and converges to the exact solution but it is iterative and computationally intensive.So in this paper we will utilize enhanced iterative algorithm with stop condition (EIASC) to perform type-reduction as EIASC can save more 50% computational cost over KM algorithm particularly when number of rules N ≤ 100 [59].Now in the following subsections we will explain in details how to proceed in each stage of IT2FLS that will be incorporated into IT2FLC to obtain accurate-safe regulation of BGL for T1DPs.

Rule-base of ITFLS
Zadeh rule-base is considered in this paper, the structure of rule-base for IT2FLS remains the same as for FLS.The only difference is some or all of its antecedent and consequent parts are of IT2FS, the structure of the general Zadeh rule for IT2FLS which has p inputs x 1 ∈ X 1 , … ., x p ∈ X p , and one output y ∈ Y is as follow [52]: where N is number of rules, l is the rank of rule, Fl 1 … … .. Fl p are IT2FSs, and Gl is IT2FS which is an interval set is expressed in the form of endpoints centroid of a consequent of IT2FS [34], where Gl = G l , G l .Suppose we have an IT2FLS with four rules N = 4, two inputs x 1 , x 2 and one output y.The domain of input x 1 consists of two triangular IT2MFs Ã and B as shown in Fig. 8.The domain of input x 2 consists of two triangular IT2MFs C and D as shown in Fig. 9.And the domain of output y consists of four triangular IT2MFs G1 , G2 , G3 , and G4 as shown in Fig. 10, then the four rules are: Thereby the interval values that deduced from the fuzzification process of the inputs are:

Inference engine of IT2FLS
It deduces the clipped IT2FS consequent for the output variable of each rule in the rule-base for a given crisp value of the input variables (those values that we get from the fuzzifier of ITFLS stage) and this process also called rule firing.Consequently we have for each rule of IT2FLS two interval firing level, lower firing level f l and upper firing level f l [38,50].Then it combines all the clipped IT2FSs consequents of the fired rules into one overall IT2FS that constitutes the output of the inference engine which is the input to the output processing block.Interval type-2 mamdani fuzzy system and minimum t-norm operator are considered, so the two firing interval for the four rules are: Now we have got the firing interval of each rule, then f l for each rule is t-normed with lower membership function of Gl and f l for each rule is t-normed with upper membership function of Gl to get a clipped IT2FS consequent from each rule.After that the clipped IT2FS consequent of each rule are combined together (using union operator) into one overall clipped IT2FS as shown in Fig. 11.

Type-reduction and defuzzification of IT2FSs
It was supposed just as for FLS after we got the resulted clipped IT2FS that we can as usual run one of the defuzzification methods to get the crisp output.But for the IT2FLS the union of the clipped IT2FSs of each rule becomes a big issue with regarding to the computational complexity as it requires additional computational time and memory storage particularly with real time applications such as a control system [38,50].
So instead of that type-reducer + defuzzification method is used to combine the firing interval of each rule with the corresponding rule consequent and get the crisp output.There are many methods to do that: Centroid, Height, and Center-of-sets.In this paper we will use center-of-sets (COS) method for an interval type-2 mamdani fuzzy system in which the firing interval of each rule is combined with the corresponding endpoints centroids of its consequent [38,58].
By using this method we get the COS type-reduced-set denoted Y cos (x′) for an interval type-2 mamdani fuzzy system Where: (9) Y cos x � = 1∕ y l , y r , (10)  N is number of rules, L and R are the switch points that.Satisfy: y l and y r can be computed using EIASC algorithm [59], after that we can easily get the crisp output of interval type-2 mamdani fuzzy system from the following formula But before we go through EIASC algorithm we have to first calculate for each rule the endpoints centroids of its consequent by using the KM algorithm which is calculated only once [58] as follow: where G l , G l are the two endpoints centroids of the consequent Gl and l = 1, … … , N.
EIASC algorithm for computing y l [59]: (a) Sort G l (l = 1, … … , N) in increasing order and call the sorted G l by the same name, but now Match the weights F l (x′) with their respective G l and renumber them so that their index corresponds to the renumbered G l .(b) Initialize ( 11) The defuzzified crisp output of interval type-2 Mamdani fuzzy system is:

Design of IT2FLC for regulation of BGL for T1DP
Figure 12 shows the block diagram of IT2FLC for regulation of BGL for T1DP, the inputs to controller are the error signal e and the change of error signal Δe, u is the output of controller, R refers to the desired BGL, and G refers to the measured BGL for T1DP.
Seven IT2MFs of type Triangular are used for the error signal, change of the error signal and for the output signal as shown in Fig. 13 which are: Negative Big (NB), Negative Medium (NM), Negative Small (NS), Zero (ZR), Positive Small (PS), Positive Medium (PM), and Positive Big (PB).Table 2 represents the knowledge base defining the rules for the desired relationship between the inputs and output.
Each of the signals e, Δe, u has its own FOU where wi, wi1, wi2 in Fig. 12 refer to FOU of IT2MF for e, Δe, u respectively.We can tune FOU of each signal using GWOCS [44] to obtain wi, wi1, wi2.where N is sampling time.

Hyprid Grey wolf and Cuckoo search optimizer
In nature, the herd of grey wolves is divided into four main types, alpha, beta, delta, and omega [44].The herd's alpha is regarded as the one in charge of making decisions.The beta is most likely the best choice to take over as alpha in the event that one of the other wolves passes away or gets too old.Beta supports alpha making its decisions, improves the order of alphas throughout the herd and provide alpha with feedback.Delta is a subordinate to alpha and beta, it supports alpha and beta during the hunting process, it governs and gives orders to omega wolves.Omega is the grey wolf with the lowest ranking in the herd.The omega serves as the scapegoat.They are the final wolves that are permitted to feed.The omega may not seem like a significant member of the herd, however it helps keep the dominance structure of the herd.The hunting process of grey wolf in nature is divided into three main phases: • Exploring the position of prey, tracking it, and getting close to the prey.• Encircling the prey, and harassing it until it stops moving.
• Attacking the prey.
In this study wi, wi1, wi2, the parameters of IT2FLC are tuned using GWOCS algorithm [44], it simulates the hunting process of grey wolf in nature for searching the prey with the conjunction of Cuckoo Search algorithm which is considered one of the meta-heuristic algorithms that draws its inspiration from nature.The population-based stochastic optimization technique known as CS is very effective at searching.The CS has memory automation that can assist in helping to record the neighborhood minimum and contribute in choosing the best.As a result, CS algorithm can more effectively than other techniques search through the designated search space for the most ideal value.Due to its varied lifestyles and encroachment on reproductivity, the cuckoo bird is a type of bird that CS algorithm draws inspiration.
So, the powerful ability of CS is used to improve the performance of GWO as CS updates the position of current search agent where after the calculation of ⃗ X 1 , ⃗ X 2 , ⃗ X 3 (the three best candidate solution) instead of directly using the mean value of the three parameters to update the position of current search agent, the values of ⃗ X 1 , ⃗ X 2 , ⃗ X 3 are first updated using Cuckoo search algorithm and then the position of the grey wolves is modified by . The pseudo code for the GWOCS is shown in Fig. 14.
In the optimization process, the fitness value of each search agent is determined by an objective function.This function is considered to be the most important factor in acquiring the required controller parameters.The objective function can be minimized or maximized to obtain the controller's intended response.

Stability analysis
In this section stability analysis of IT2FLC for regulation of BGL for T1DP using Lyapunov function [60] is performed to determine the stability region of nonlinear system.
Our target is to design the control signal U such that the BGL of T1DP x 1 follows the set BGL R, that is the error signal e → 0 as t → ∞ where: So our lyapunov function candidate is chosen as

end while return
According to lyapunov stability theory for the system to be asymptotic stable, V(e, ̇e) must be negative definite [60].
By taking time derivative of Eq. ( 17), it yields: By taking the time derivative of Eq. ( 16), it yields: By substitution for ̇x1 from Eq. ( 1) in Eq. ( 19), it yields: By taking the second time derivative of Eq. ( 20), it yields: By substitution for ̇x2 , ̇x4 from Eqs. ( 2), ( 4) respectively in Eq. ( 21), it yields: By taking the third time derivative of Eq. ( 22), it yields: By substitution for ̇x3 from Eq. (3) in Eq. ( 23), it yields: where: Hence, we want to verify that V(e, ̇e) < 0 , then from Eq. ( 18): When we analyze Eq. ( 26), it can be achieved within the following four cases: Case 1: If e and ̇e are both positive sign, it requires that:ë < −e.By taking the third time derivative of Eq. ( 26), it yields: By substitution the value of ̇e, e … from Eqs. ( 19), (25) respectively in Eq. ( 27), it yields: By Solving for u(t) from Eq. ( 28), it yields: Case 2: If e and ̇e are both negative sign, it requires that: By taking the third time derivative of Eq. ( 30), it yields: By substitution the value of ̇e, e … from Eqs. ( 19), ( 25) respectively in Eq. ( 31), it yields: By Solving for u(t) from Eq. ( 32), it yields: Case 3: If e is positive sign and ̇e is a negative sign, it requires that: By taking the third time derivative of Eq. ( 34), it yields: By substitution the value of ̇e, e … from Eqs. ( 19), (25) respectively in Eq. (35), it yields: By Solving for u(t) from Eq. ( 36), it yields: Case 4: If e is negative sign and ̇e is a positive sign, it requires that: By taking the third time derivative of Eq. (38), it yields: By substitution the value of ̇e, e … from Eqs. ( 19), (25) respectively in Eq. ( 39), it yields: By Solving for u(t) from Eq. ( 40), it yields: Consequently, the constraints in Eqs. ( 29), ( 33), (37), and (41) for the control signal U ensure the asymptotic stability of the system and determine the stability region.

Results and discussion
The main objective of the proposed controller IT2FLC is to maintain BGL for a T1DP within standard-safe range between 70 and 180 mg/dl even the presence of parametric uncertainty of the model (the parameters alters from one patient to other), uncertain meal disturbance, and physical exercise that can burn glucose.That is mean bringing BGL less than 180 mg/dl within almost 120 to 150 min after meals are provided with avoiding hypoglycemia situation (BGL < 50 mg/dl) at any instance.Consequently in this section, simulation results of IT2FLC using GWOCS for regulation of BGL for EBMM are proposed in six different scenarios using matlab functions for IT2FLS in Matlab/ simulink platform [61,62].
The nominal values and range of parameters for the EEBM model used in simulation are shown in Table 3 [33].
Scenario 1: The main objective of this scenario is to investigate the behavior of IT2FLC for nominal parameters of EBMM under difficult conditions that at the start of simulation: T1DP is in the state of hyperglycemia (BGL > 180 mg/dl) ( 40) moreover a large meal containing high amount of glucose is provided to T1DP.Configuration of this scenario is: simulation period is set to 800 min, the initial conditions at t = 0 min of the state variables for EBMM are x 1 = 250 mg/ dl reflects that T1DP is already in the state of hyperglycemia at the start of simulation, x 2 = 0 min −1 , x 3 = 7 mU/l ensuring that there is no insulin infusion before the starting of simulation, x 4 = 10 mg/dl/min means that a large meal disturbance with a very high glucose content is provided at the start of the simulation.The basal values for glucose and insulin level are G b = 80 mg/dl, I b = 7 mU/l respectively.And the nominal values for parameters p 1 , p 2 , p 3 , p 4 , and p 5 for EBMM model are chosen from Table 3. Figure 15 showed that the proposed controller lowered BGL more than 180 mg/dl from the state of hyperglycemia within 120 min in spite of a meal disturbance with a very high glucose content was provided at the start of the simulation, in addition BGL stabilized at basal glucose level of 80 mg/dl without any hypoglycemia at any instance as desired.The shape of the meal disturbance is shown in Fig. 16.As shown in Fig. 17a response of insulin infusion rate is always positive and smooth during the all simulation period it reflects that the proposed controller is simple, not Fig. 15 The difference between nominal BGL and the actual glucose value complicated doesn't need any excessive method or algorithm to inject glucagon or glucose to avoid hypoglycemia.For investigating the asymptotic stability of the system Fig. 17a shows that the control signal follows the constraints of Eqs. ( 33), (41) proved in Sect. 2 that guarantee the stability of the system.Within the time interval in which error and change of error signal are both negative sign as shown in Fig. 17b, d respectively, the control signal follows Eq. ( 33) that insulin infusion rate is larger than the right hand side of Eq. ( 33) as shown in Fig. 17c.Whereas within the time interval that error signal is negative sign and change of error signal is a positive sign, the control signal follows Eq. ( 41) that insulin infusion rate is less than the right hand side of Eq. ( 41).
Scenario 2: In this scenario simulation period is set to 1440 min to investigate the behavior of the proposed controller during 24 h of one T1DP's daily life.Three different meals 5 mg/dl/min for breakfast, 8 mg/dl/min for lunch, and 8 mg/ dl/min dinner are provided to a T1DP at 480 min (8 am), 720 min (12 am), and 1200 min (8 am) respectively.Nominal values of parameters p 1 , p 2 , p 3 , p 4 , and p 5 for EBMM model are chosen from Table 3 and the initial conditions of the state variables for EBMM at the start of simulation are x 1 = G b = 80 mg/dl, x 2 = 0 min −1 , x 3 = I b = 7 mU/l, and x 4 = 0 mg/dl/min (T1DP is in fasting condition before starting of simulation).
Initially at the start of simulation when the BGL is at basal glucose level as shown in Fig. 18a there is no insulin infusion as shown in Fig. 18b, after each of the three meals are provided to T1DP separately at its time BGL increases proportionally according to the amount of glucose content in each of the three meals.And dependency on the above insulin infusion rate is increased proportionally to any changes in BGL forcing it to stabilize around the basal glucose level avoiding both hyperglycemia and hypoglycemia situation as shown in Fig. 18a.
Also in this scenario in order to investigating the asymptotic stability of the system Fig. 19a shows that the control signal follows the constraints of Eqs. ( 33), ( 41) that guarantee the stability of the system.Within the time interval in which error and change of error signal are both negative sign as shown in Fig. 19b, d respectively, the control signal follows Eq. ( 33) that insulin infusion rate is larger than the   33) as shown in Fig. 19c.Whereas within the time interval that error signal is negative sign and change of error signal is a positive sign, the control signal follows Eq. ( 41) that insulin infusion rate is less than the right hand side of Eq. ( 41).
Scenario 3: In this scenario 100 simulation rounds are run to study the behavior 100 virtual-different T1DPs (parametric uncertainty of EBMM) along with a large meal disturbance.At the start of each simulation round the parameters p 1 , p 1 , p 3 , p 4 , and p 5 are randomly chosen from Table 3 with variations ± 20% to constitute a 100 virtual T1DPs.Configuration of this scenario is: simulation period is set to 800 min, the initial conditions of the state variables for EBMM at the start of each simulation round are Figure 20a shows that despite the presence of parametric uncertainty of EBMM along with a large meal disturbance, the BGL has stabilized near the basal glucose level for all 100 virtual T1DPs within standard-safe range avoiding the situation of hyperglycemia moreover avoiding hypoglycemia situation at any instance.Also insulin infusion rate is still positive and smooth as shown in Fig. 20b.
Scenario 4: In this scenario 100 simulation rounds are run to study the behavior of varying both meal disturbance and its time randomly on a 100 virtual-different T1DPs.So a random amount of meal disturbance is set to vary from 5 to 8 mg/dl/ min along with a random meal time varies from 0 to 60 min.
Configuration of this scenario is: simulation period is set to 800 min, the initial conditions of the state variables for EBMM at the start of each simulation round are x 1 = G b = 80 mg/dl, x 2 = 0 min −1 , x 3 = I b = 7 mU/l, and x 4 = 0 mg/dl/min (all 100 virtual T1DPs are in fasting  3 with variations ± 20% to constitute a 100 virtual T1DPs.
Figure 21a shows that despite the parametric uncertainty of EBMM along with uncertain both meal disturbance and meal time, the proposed controller forces BGL to stabilize around the basal glucose level avoiding hyperglycemia situation and avoiding hypoglycemia situation at any instance.Figure 21b shows the insulin infusion rate for this scenario.
Also the result of CVGA for scenario 4 of 100 T1DPs is shown in Fig. 22. CVGA is a graphical tool used to measure the quality of the closed loop control system in regulating the BGL for the population of T1DPs by expressing the Where each of T1DP in CVGA plot is expressed by a white dot, X-axis and Y-axis refers to minimum and maximum BGL within the simulation period respectively.
Figure 22 displays that all 100 white dots are confined to the green safe regions; grid B and grid lower B. It reflects that the time period spent by 100 T1DPs in hyperglycemia is minimized in spite of uncertain both meal disturbance and meal time, and also the minimum glucose values for all the 100 T1DPs are within safe range 70-90 mg/dl ensuring that hypoglycemia is avoided.
Scenario 5: In this scenario a 200 virtual T1DPs are used with 1440 min simulation period to simulate a more realistic situation for T1DPs.Consequently the objective of this scenario is to investigate the behavior of the proposed controller within 24 h of T1DP's daily life, so a three variable different meals for breakfast, lunch, and dinner are randomly chosen from the interval {4, 9)} mg/dl/min are provided to each of the 200 virtual T1DPs at 480 min (8 am), 720 min (12 am), and 1200 min (8 am) respectively.At start of each simulation period the parameters p 1 , p 2 , p 3 , p 4 , and p 5 are randomly chosen from Table 3  Initially at the start of simulation when the BGL of all T1DPs is at basal glucose level as shown in Fig. 23a there is no insulin infusion as shown in Fig. 23b, after each of the three meals are provided to each of all T1DPs separately at its time, BGL increases proportionally according to the amount of glucose content in each of the three meals.And dependency on the above, insulin infusion rate is increased proportionally to any changes in BGL forcing it to stabilize around the basal glucose level avoiding both hyperglycemia and hypoglycemia situation as shown in Fig. 23a.
Despite the parametric uncertainty of EBMM, and the different three meal disturbances, the proposed controller forces BGL to stabilize around the basal glucose level, and both hyperglycemia and hypoglycemia situations were still avoided.
The result of CVGA for scenario 5 is shown in Fig. 24.
For the sake of comparison to other work Fig. 25 displays the results of CVGA plot for scenario 3 of work presented in [33] (the black circles) and CVGA plot of the proposed scenario 5 (the white circles).For a fair comparison, all parameters and configuration of scenario 5 were selected to be identical to scenario 3 of work presented in [33].
From Fig. 25, the lowest glucose levels for the proposed controller are between 70 and 90 mg/dl, matching those of CVGA plot in [33].The maximum glucose values for the proposed controller are between 141.374 and 227.58 mg/ dl, whereas maximum glucose values are almost between 228 and 240 mg/dl of [33].89.5% of the 200 T1DPs for the proposed technique in Fig. 25 are almost centered at the basal glucose level 80 mg/dl and the rest are between 72.3 Fig. 22 CVGA plot for scenario 4 and 80 mg/d.whereas 100% of the T1DPs are distributed horizontally between 73.6 and 90 mg/dl in [33]as shown in Fig. 25.
Stabilizing the blood glucose level close to the basal glucose level without the occurrence of hyperglycemia or hypoglycemia circumstances is regarded as an important improvement.
Scenario 6: Other critical scenario is presented here with the same configuration as scenario 5 moreover a random initial conditions of the state variables for EBMM is considered.At start of each simulation round x 1 varies randomly form 80 to 350 mg/dl, x 2 varies randomly form 0 to 0.01 min −1 , and x 3 varies randomly form 0 to 20 mU/l, also the parameters p 1 , p 2 , p 3 , p 4 , and p 5 are still randomly chosen from Table 3 with variations ± 20% to constitute a 100 virtual T1DPs.Initially at the start of simulation when the BGL is above the basal glucose level as shown in Fig. 26a, insulin infusion rate is increased proportionally to the value of BGL as shown in Fig. 26b forcing it to stabilize near the basal glucose level.BGL lowered below180 mg/dl within approximately at most 112 min for all T1DPs.Also after each of the three meals are provided to each of all T1DPs separately at its time BGL increases proportionally according to the amount of glucose content in each of the three meals.And dependency on the above insulin infusion rate is increased again forcing BGL again to stabilize around the basal glucose level.Despite all of the following: random initial conditions of the state variables for EBMM, parametric uncertainty, and different three meal disturbances the proposed controller forces BGL to stabilize around the basal glucose level.And both hyperglycemia and hypoglycemia situations were still avoided.
Also the result of CVGA for scenario 6 is shown in Fig. 27.Due to the elevated values of BGL because of random initial conditions of the state variables at the start of simulation there are 9% of T1DPs are in the Lower D region and Lower C region, 2% are in upper D region, 1% are in upper B region.While 88% of T1DPs are confined to the green safe regions; grid B and grid lower B reflecting that the time period in hyperglycemia is minimized.In spite of the minimum glucose values for 9% of T1DPs are less than 70 mg/dl, hypoglycemia situation (BGL < 50 mg/dl) is still avoided.
Figure 28 displays BGL response for scenario 4 of work presented in [33], all parameters and configuration of scenario 6 were selected to be identical to scenario 4 of work presented in [33].By examining the two figures it is noted that despite the random initial conditions of states variable at the start of simulation, the proposed technique in Fig. 26a stabilized BGL within range from 50 to 89.5 mg/dl, whereas in Fig. 28 it is stabilized within range 50 to 150 mg/dl.After the breakfast meal is provided BGL increased in the two figures and then stabilized within range 80 to 112 mg/dl in Fig. 26a whereas in Fig. 28 BGL stabilized within range 100 to 140 mg/dl.Also after the lunch meal is provided BGL increased in the two figures and then stabilized within range 71 to 91 mg/dl in Fig. 26a Whereas in Fig. 28 stabilized within range 70 to 100 mg/dl.Finally after the dinner From above results, it is noted that the proposed technique will stabilize and regulate the BGL at a standard-safe level.The IT2FLC with the conjunction of GWOCS significantly decreases the effect of uncertainty and disturbances as shown in different scenarios in which T1DP can faces during his daily life.
Figure 29 shows a comparison includes IT2FLC using different optimization methods such as ALO, GWOCS, PSO, WOA and FLC method to infuse the proper amount of exogenous insulin.A difficult condition of EBMM is considered in this comparison, which is at the start of simulation: T1DP is in the state of hyperglycemia (BGL > 180 mg/dl) moreover a large meal containing high amount of glucose is provided to T1DP.simulation period is set to 800 min, the initial conditions at t = 0 min of the state variables for EBMM are x 1 = 250 mg/dl reflects that T1DP is already in the state of hyperglycemia at the start of simulation, x 2 = 0 min −1 , x 3 = 7 mU/l ensuring that there is no insulin infusion before the starting of simulation, x 4 = 10 mg/dl/min means that a large meal disturbance with a very high glucose content is provided at the start of the simulation.The     3.
In order to make a clear comparison some performance criteria such: Rise Time, Settling Time, Percentage Overshoot, and MAE are used.Table 4 shows the values of the parameters, wi, wi1, wi2 and numerical results of performance criteria for the different optimization methods of IT2FLC and also for FLC method.
We can infer from Figs. 29, 30 and Table 4 that IT2FLC using GWOCS appeared superior to others.It is the least in the MAE, Rise Time, Settling Time, and Percentage Overshoot.So IT2FLC using GWOCS was chosen to be appropriate for a more realistic and different scenarios of T1DPs.

Conclusion
In this study an effective control approach utilizes IT2FLC with the conjunction of hybrid grey wolf optimizer-cuckoo search (GWOCS) to regulate BGL for T1DP was proposed, the nonlinear EBMM was used to describe the behavior of glucose-insulin physiological system for T1DP.Superiority of IT2FLC in minimizing the effect of uncertainties in the system depends primarily on the best choice of FOU parameters of IT2FLC, so GWOCS was used to optimally tune and select the best FOU that improves the performance of the system.The proposed control approach infused an appropriate amount of exogenous insulin into the bloodstream of T1DP based only on BGL measurements without the need to measure other status variables of remote insulin and plasma insulin level.The controller output of the proposed control method was always non-negative, no excessive controller or algorithm were needed to infuse glucagon or glucose to avoid hypoglycemia and this significantly enhances the simplicity of the design and can reduce complexity and cost.
The effectiveness and the performance of the proposed method were evaluated under six difficult and different simulation scenarios that a T1DP is likely to face in his daily life.
Simulation results indicated that the proposed control approach effectively regulated and stabilized BGL within the standard safe range between 70 and 180 mg/dl even the presence of parametric uncertainty of the model, different meals disturbance and random initial condition of state variables of EBMM.That is in the critical and different scenarios that a T1DP is likely to face in his daily life, the risks of hyperglycemia and hypoglycemia have been avoided.
Stability analysis for the system was performed using lyapunov function and simulation scenarios also proved that the system operates within the stability region of nonlinear system.Consequently the proposed control approach can significantly save life and reduce the chance of death for T1DPs.
One limitations of the proposed control approach is that it takes a fairly long time to obtain an optimal solution due to type-reduction process associated with IT2FLC which is iterative and computationally intensive, however in this work EIASC was utilized to perform type-reduction which can save more 50% computational cost over ordinary KM algorithm.
Implementation of the proposed control approach practically and linked it to a network of medical devices to share real time measurements of BGL may be considered the focus of research in the future.

Fig. 2 Fig. 4
Fig. 2 FS of an ordinary FLS Fig. 3 Blurred MF of FS of an ordinary FLS

1 ≤ G 2 ≤
If y l ≤ G L+1 , stop; otherwise go to step (c).EIASC algorithm for computing y r[59]:(a) Sort G l (l = 1, … … , N) inincreasing order and call the sorted G l by the same name, but now G ⋯ ≤ G N .Match the weights F l (x′) with their respective G l and renumber them so that their index corresponds to the renumbered G l .(b) Initialize (c) Compute (d) If y r ≥ G R , stop; otherwise go to step (c).
(13) u = f (e, Δe) (14) e = R − G During the optimization process the OF is minimized to meet the standard-safe response of BGL, The OF of GWOCS is chosen to be equal to mean absolute of error (MAE) signal.

Fig. 18 aFig. 19
Fig. 18 a BGL response for scenario 2 b insulin infusion rate for scenario 2

Fig. 20 aFig. 21 a
Fig. 20 a BGL response for Scenario 3 b insulin infusion rate for Scenario 3 with variations ± 20% to constitute a 200 virtual T1DPs.The initial conditions of the state variables are x 1 = G b = 80 mg/dl, x 2 = 0 min −1 , x 3 = I b = 7 mU/l, x 4 = 0 mg/dl/min (all 200 virtual T1DPs are in fasting condition before starting of simulation), and the basal values for glucose and insulin level are G b = 80 mg/dl, I b = 7 mU/l respectively.

Fig. 23 aFig. 24
Fig. 23 a BGL response for scenario 5 b insulin infusion rate for scenario 5

Fig. 25 Fig. 26 a 3
Fig.25 Comparison between CVGA plot of the proposed scenario 5 (the white circles) and CVGA plot for scenario 3 of work presented in[33] (the black circles)

Table 1
Meaning of variables and parameters of EBMM

Table 2
Rule base of error and

Table 3
Nominal value and range of parameters for EBMM

Table 4
Numerical results for the different optimization methods of IT2FLC and FLC