{'fraction_non_alphanumeric': 0.02480703259005146, 'fraction_numerical': 0.009112349914236706, 'mean_word_length': 4.729148753224419, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Blood glucose regulation and control of insulin and glucagon infusion using single model predictive control for type 1 diabetes mellitus

This study elaborates on the design of artificial pancreas using model predictive control algorithm for a comprehensive physiological model such as the Sorensen model, which regulates the blood glucose and can have a longer control time in normal glycaemic region. The main objective of the proposed algorithm is to eliminate the risk of hyper and hypoglycaemia and have a precise infusion of hormones: insulin and glucagon. A single model predictive controller is developed to control the bihormones, insulin, and glucagon for such a development unmeasured disturbance is considered for a random time. The simulation result for the proposed algorithm performed good regulation lowering the hypoglycaemia risk and maintaining the glucose level within the normal glycaemic range. To validate the performance of the tracking of output and setpoint, average tracking error is used and 4.4 mg/dl results are obtained while compared with standard value (14.3 mg/dl).


Introduction
Diabetes mellitus (DM) is a metabolic disease that is incurable and requires regular monitoring and good control for a good quality of life. The blood glucose of such a patient is always abnormal and may lead to life-threatening risks. Diabetes can be categorised into type 1, type 2, and gestational diabetes. Among the three categories, type 1 is said to be quite risky because the pancreatic beta cells are destructed and such a patient is insulin dependent and external insulin need to be infused in regular regime [1]. The importance of monitoring and regulating the blood glucose level in a diabetic patient is required to avoid the risk of hyper and hypoglycaemia. Hyperglycaemia is the condition, where blood glucose rises above the normal range and requires insulin to regulate and hypoglycaemia is a condition, where blood glucose falls below the normal range and requires glucagon hormone to regulate it [2,3]. The normal blood glucose range is considered to be 70-110 mg/dl. Insulin and glucagon are the two pancreatic hormones that play a major role in the regulation of blood glucose [4]. Several types of research are being carried out to include the glucagon in therapies, which could be a challenge because it will be difficult to preserve glucagon for a long time under normal room temperature due to its chemical property [3,5]. Even though a type 1 diabetic patient fails to produce insulin from the pancreas, they still can produce glucagon, which makes the design complicated.
Hence, controlling and regulation of blood glucose in a diabetic patient is an open research challenge. The commonly used therapy is multiple dosages of injection, where a patient has to calculate the dosage intake manually each time before or after meal [6]. In the existing design of insulin pumps, which require sufficient information of meal intake, the amount of carbohydrates intake that makes the design semi-closed loop. For complete automatic or closed-loop control, an automatic controller needs to be designed in such a way that if the blood glucose deviates from the desired threshold, the controller needs to take action immediately to maintain in the state of normal glycaemic range for a long time [7]. Semi-closed-loop-type insulin pumps are those, which require manual interruption to set the amount of meal consumed along with the amount of carbohydrate and the bolus is manually calculated and fed into the system [7,8]. When such a system is used, the patient should have complete knowledge on how to calculate the bolus dose for each day, which makes the design complicated. In complete automatic closed-loop control, the disturbance is measured and the dose is calculated automatically for the infusion [9]. Unmeasured disturbance at random time should be considered if the controller can regulate the blood glucose varied by unmeasured disturbance. If this attains a good regulation, then an Artificial pancreas can be developed using model predictive control (MPC).
MPC is an efficient control strategy developed in recent technology for the control design. This control model predicts the future system outputs, taking into account the past as well as current values, and on the proposed control action of the future [10,11,12]. It has many unique features, which makes it more competitive for blood glucose regulation such as: • Prediction property that enables for anticipatory and measured insulin delivery. • This type of strategy can surpass the physiological delays associated with the subcutaneous flow. • The most important feature of the strategy is the compensation of the dead time, commonly seen in the glucose concentration problem. • Efficient Feed-forward control technique to compensate for the known disturbances such as meal intake or metabolic changes. • It can easily handle constraints on system inputs and outputs.
The control parameters in the model predictive controller are particularly tuned for a patient. The controller can perform well with no external information such as time and quantity of meal intake, providing this information the controller will reach the acceptable performance with feedback and feed-forward controller [13,14]. The control model collects the data from past inputs as well as outputs, and then combines it with the future inputs predicted and gives a predicted output for that particular time. This attained predicted output can be combined with the referral trajectory, then giving the predicted future errors possible by the system [15]. To eliminate the error, the attained error can be fed into an optimiser, which can implement the present constraints of the system on to the predicted outputs and then minimise the operating cost function [16]. This will give the predicted future inputs, which can be used as feedback of the main model and by IET Syst. Biol., 2020, Vol. 14 Iss. 3 restarting the process again [17,18,19]. Dual control of insulin and glucagon is easily designed with such an algorithm.
In this research, we have considered a comprehensive physiological model developed by Sorensen, a control algorithm MPC. We have developed a single MPC for dual model infusion of insulin and glucagon with an unmeasured disturbance at a random time. Such a method performs a good and better solution for the regulation of blood glucose. The performance of the proposed controller is measured using average tracking error (ATE), which gives the average blood glucose deviated from the threshold. The setpoint is considered as 90 mg/dl and the standard value for the limit, where the blood glucose can deviate for good performance is 14.4 mg/dl. This paper is structured into six Sections: In Section 2, background study of existing mathematical model and controller design is being explained. Section 3 contains problem formulation with a section of mathematical model and control objectives. In Section 4, the MPC design is formulated which is followed by the results obtained in Section 5 and the concluding remarks in Section 6.

Background study
Every year millions of diabetic patients enhance their eminence of life through a surgical trial that involves many medical devices. The insulin pump plays a role in the functioning of the normal human pancreas. Currently, the implantable device is used to extend the quality of life of a human by implanting it in different parts of the body [20,21]. The dual control insulin delivery system offers several advantages over conventional oral or syringe dosage forms. These devices allow siting specific delivery of insulin or glucagon required by continuous glucose monitoring [22]. This may also allow significantly lower doses of insulin, which can minimise potential side effects. The most important advantage is patient conformity, as the treatment routine associated with a prototype device is generally less arduous than pills or injections [23,24].
Numerous research works have been carried out for type 1 DM (T1DM) by the essential automated control of the level of blood glucose, which could diminish the load of manual therapy, and hence improve the risk factors associated with it. MPC is the emerging controller [25]. Although several research are carried on, the risk of hyperglycaemia and hypoglycaemia is a big threat. Enhancement of such a controller can make the prototype system much robust and achieve better performance. The model predictive controller predicts the future output variables using current measurements [26]. The predictions can be predicted for different time delays. Also, the calculations of the control are mainly based on both predictions done for future and present measurements and the measured disturbances are included in the control calculations [27,28].
Blood glucose monitoring is an imperative technique for people with diabetes to evaluate their physiological state and take the proper dose for medication. The good property of detection and quick action of the controller when the blood glucose level is not in the desired range could prevent acute brain damage or death [29]. A variety of technologies are available to assist patients with detecting hypoglycaemia and hyperglycaemia separately. To make the controller completely automatic and avoid the manual calculation of the daily dosage, there is a need to develop complete closed-loop control, which is an important research domain.
To obtain this the state-of-the-art artificial pancreas is shown in Fig. 1, it consists of a measuring unit for continuous monitoring, a patient model which is developed mathematically, a precise control algorithm for the infusion of hormones that need to be developed. The sensor used is the continuous glucose monitoring devices, the data is recorded for every 5 min and is fed to the controller [29,30]. Various plant models mathematically are available from the previous research. Over the years, the behaviour of the interaction of glucose-insulin in a diabetic patient is mathematically modelled either by an empirical or compartmental technique. In an empirical process, with the available input-output data without the physiological knowledge of the system, a model can be developed. Wherein for a compartmental modelling, mass balance differential equations are developed by the interaction of all the components involved in the physiology [31,32].
Bergman minimal model is a non-linear compartmental model that comprises of very small number of parameters that could describe the relationship of the glucose-insulin regulatory system with adequate accuracy [33,34]. Sorensen model (SoM) is the complete model, which is composed of 19 differential equations and describes the action of organs, having to lead to the change in glucose regulation. It also accounts for the glucagon effect, which is opposite to the insulin effect, where a dual control can be designed. SoM is a physiological model that involves all the changes in the tissues and organs [35]. This model has been developed with mass balance equations of the blood flow, the exchange between the compartmental models and the metabolic process. The Food and Drug Administration approved model such as Cobelli was a widely used patient model but failed due to the inability of varying model parameters during the simulation [36,37]. Hovorka model with the six states glucose-insulin dynamics is the simplest non-linear model, which can be used as patient model [38,39]. The state represents the glucose contained in plasma, glucose contained in peripheral tissues, the action of insulin on glucose rate of flow, glucose disposal, endogenous glucose production, and insulin concentration in plasma [40]. The comparison of a few compartmental models used for this paper and selection of the available model is shown in Table 1, these models are simulated and studied in the research work.
Few black boxes and grey box model techniques are introduced for the implantable development. Mathematical and clinical trials on the design of artificial pancreas are done using various control algorithms. Frequently used control algorithms are proportionalintegral-derivative (PID), fuzzy logic, MPC, advanced control theory etc. For a single control of hormone, insulin alone is easily designed and controlled but the limitation is the risk of hypoglycaemia that is not yet eliminated. PID control is said to be the standard control strategy that can be used for the regulation but dual control of insulin and glucagon is much efficient using the MPC eliminating the risk factors of the regulation of blood glucose [45,46,47]. Many prototype models can be developed by considering the physiological model with the relevant control algorithm. The various control algorithms have different advantages and disadvantages, to explain few: • Relative proportional control law: This algorithm is mainly based on the mode of conveyance of insulin in the weighted proportion by strictly limiting the absolute blood sugar level to the magnitude of the desired level. This is a semi-closed-loop control, where the simulation of glucose-insulin metabolism makes use of the base data, and hence detection and elimination of errors would be a challenge [48]. • Fully closed-loop controller (MPC): In this, the algorithm was mainly used to reduce the risk of hypoglycaemia, which uses an on-off controller with safety rules. In this, a unique model-based strategy to develop the controller is considered in an account for the uncertainty and to ensure safety for hypoglycaemia. Since the threat of hypoglycaemia could occur at any time corrective measures to detect hypoglycaemia was not considered [49,50]. • MPC dual hormone control: In such a control method, MPC is developed to take control of the infusion of insulin and glucagon. Numerous research is being carried out for dual administration, especially with the switching technique between the hormones. The switching is done by the measurement to the blood glucose, and if the blood glucose is elevated, the controller infuses insulin and switches to glucagon if the blood glucose is fallen below the threshold. Switching technique such as hysteresis switch was developed and added the flexibility to the control design [51,52]. Optimal switching technique used separate MPC's giving good performance concerning risks associated with diabetes [53]. Such procedure included known disturbances especially the exercise model, which was modelled. These disturbances were known at what time what amount is affected. However, the ultimate aim for a T1DM is any unknown disturbance at random time occurs, and the controller should take action and regulate the blood glucose. Such a controller is developed in our research. • Fading memory proportional derivative: This algorithm does not require human interaction to enter the venous blood sugar level into the system. It mainly uses an adaptive proportional derivative algorithm, which keeps an account on the absorption of the subcutaneous substance. It takes the patient's total daily requirement initially using first glucose reading by the patient and the patient's basal insulin rate at the beginning [42]. • PID controller: This is the most widely used controller used to detect the dynamics of the system. Modelling becomes much simpler and feasible. Few assumptions are considered such as the relationship between insulin and the blood glucose along with the disturbance that affects the blood glucose. The risk of hyperglycaemia and hypoglycaemia was not relatively detected [54,55]. • Higher-order sliding mode control: This black box model control technique, where it only takes into account the knowledge of the moderate degree of the system and the reasonable bounds of an expression. Owing to its non-linear characteristic, it spans of the target system. It is designed in such a way that it does not depend on the parametric or the uncertainties in the system model, which provides robustness [42]. • Fuzzy logic control (FLC): PID-FLC is an effective strategy that takes into account all the components that are necessary and reacts to the possible changes in glucose concentration in the human body. It helps to raise the patients' quality of life and reduces the occurrence of hypoglycaemia and hyperglycaemia by keeping the glucose level in the ideal range [42].
To address this issue, this research is being carried on for bihormonal control with insulin and glucagon infusion and maintain normal glycaemia for a longer time. Such a control algorithm is developed in our research using MPC control and SoM. In choosing an appropriate mathematical model various criteria are used to ensure the implementation: 'Complexity of the model', 'Related meal model', 'Validated by literature', 'Modifiability', and 'Accessibility'. In choosing a model, a decision matrix was used as shown in Table 2, where: • Complexity ( + ) means: Appropriate for realisation and (-) means: too complex. After the evaluation of the decision matrix, the SoM was considered to be the most appropriate model for the implementation in further work. Although the model is complex it has a meal model, it is validated in the literature and research, easy to modify to type 2 model, and the major advantage is it incorporates the glucagon model. Other models need extra development of glucagon model for the bihormonal development.
The selection of plant models from the above criteria helped in efficiently choosing the plant model for the further development of the artificial pancreas using MPC.

Problem formulation
In this section, a brief introduction and modelling of a comprehensive physiological SoM for T1DM are presented with ordinary differential (ODE). The next section describes the control algorithm and the main objectives are stated and formulated.

Mathematical model
We have considered a comprehensive model, which consists of a glucose, insulin, and glucagon model in ODE equation form. The entire model is simulated for few cases such as an empty stomach, with meal, with bolus, and the difference of each is observed and the steady-state analysis of the model is checked for the SoM. The model is linearised and the state-space model of it is considered for the control algorithm development [38,39,40]. We have considered a continuous time model where A is the state matrix, B is the input matrix, X are the states of the model, y is the output, C is the output matrix, and D is the feedforward matrix. The SoM (Sorensen, 1985) is an extensive nonlinear model consisting of 11 ODE to describe the glucose subsystem, ten ODE to describe the insulin subsystem, and one ODE to describe the glucagon subsystem. However, three ODE of the insulin subsystem describes endogenous insulin production and secretion, which are to be omitted for the T1DM condition. The number of equations and sub-equations make the model hard to comprehend. Therefore, the SoM was rewritten to state-space form while incorporating all sub-equations in their corresponding equation and grouping parameters as much as possible. The modified and linearised state-space equations are given below: The parameter description is briefed in the Appendix. The state vector considered is as given below: The control input where U I (t) is insulin and U G (t) is the glucagon input variable and U I (t) ≥ 0 is infused exogenously with rate (mU/min) and U G (t) ≥ 0 is also infused exogenously with rate (mg/min). The disturbance is considered to be unmeasured at a random time to develop the control algorithm but for the model check, the disturbance is considered to be the meal intake in terms of grams. The output, i.e. the amount of glucose in the body is measured at the state variable G PI glucose at the periphery region. The steady-state analysis of the model is checked when the inputs U I (t) = U G (t) = 0 and such a condition is called a basal condition for a diabetic patient. This condition is totally dependent on the model parameters and the glucose level can be observed with the initial conditions of each state.
• Case 1: Complete model simulation of Sorensen: Fig. 2 shows the complete simulation of the SoM includes the entire differential equation of each compartment for steady-state analysis. Simulation is done with MATLAB 2018 software. The x-axis represents the time in minutes and the y-axis represents the blood glucose, insulin, and glucagon compartment parameters. The blood glucose of different parts is measured with mg/dl, insulin is measured with mU/min, and the glucagon is measured with mg/min. It is observed that the entire system attains steady state within 800 min. A disturbance of meal and input of insulin is also included in the design to check the steady-state analysis. The individual parameter can be examined by plotting the graph to observe the changes with and without a meal as well as the input as insulin. • Case 2: Simulation of SoM for empty stomach: The model is simulated for an empty stomach condition, in a T1DM usually the blood glucose level will be high and they do not produce insulin to regulate the blood glucose level. Fig. 3 shows the glucose simulation of the model in an empty stomach, the x-axis represents the time in minutes and the y-axis represents the blood glucose in mg/dl. It is observed that the blood glucose is above the normal range and it remains high throughout, the measured blood glucose level is 145 mg/dl. When observed in Fig. 4, the insulin in body is zero, this is because the pancreas lacks the production of insulin in T1DM.The x-axis is time in minutes and the y-axis is milliunits/min. There is some amount of glucagon secreted in the body and is observed in Fig. 5. The x-axis is time in minutes and the y-axis is mg/min. To regulate this blood glucose level for a normal range infusion of insulin is necessary.
• Case 3: Simulation of SoM with meal intake: In this case, some amount of disturbance in terms of the meal has been given, the amount of meal intake is 50 mg, for the disturbance induced in Fig. 6 we observe the changes in the blood glucose level. The induced food requires some time to digest and the delay is seen in the beginning. The blood glucose level slowly increases as the effect of disturbance is being sensed. It is observed that blood glucose is raised for the meal intake to 160 mg/dl. This increase in blood glucose also keeps increasing at the high level due to the absence of insulin infusion, the next case is explained with the infusion of insulin. The insulin in body still remains the same as in Fig. 4 and the glucagon also remains the same as observed in Fig. 5. • Case 4: Simulation of SoM with insulin infusion: For a T1DM, external infusion of insulin is required for regulating the blood glucose level and maintaining it within the threshold range. In Fig. 7, we observe the decrease of blood glucose level when insulin is given as an external source. The blood glucose range is 140 mg/dl and decreases due to the effect of insulin, and once the effect on the body decreases the blood glucose level again increases above the normal range. In Fig. 8, we observe the infusion of insulin in mU/min, some amount of insulin is infused to bring down the elevated blood glucose. It is said that, 1 unit of insulin can decrease 50 mg/dl of blood glucose in body. In Fig. 9, it is observed that glucagon is decreased when compared with the previous cases. Glucagon is an counter hormone used for regulation, when insulin is conveyed the glucagon decreases. Hence, to continuously maintain the blood glucose within the threshold, a good controller needs to be developed. • Case 5: Comparison of individual cases together: All the three cases are compared together in Fig. 10 to observe the difference in the blood glucose level in an empty stomach, with only meal as a disturbance and with an infusion of insulin. From this comparison, we can conclude that it is very necessary to develop a good controller that can predict the blood glucose level and take immediate action in regulating blood glucose. The three conditions are in the basal condition with attained initial condition. This model physiology is and the working condition is mimicking the semi-closed-loop condition; hence, such a model is used further to develop the MPC algorithm.

Control algorithm developed
An MPC algorithm is formulated by considering two main goals: • The main aim is to regulate blood glucose and have control by eliminating the risk of hyperglycaemia and hypoglycaemia for a longer time, irrespective of random disturbance. • The infusion of insulin and glucagon should be precise and limited. • The proposed work uses a linear state-space plant model, under which a linear MPC algorithm is developed. An MPC uses a linear model to calculate glucose concentration predictions. The linear approximation in MPC is used when calculating the predictions because it is simpler and faster than using the nonlinear model. It is important that the calculation is fast since new computations are made within the short interval [17,18]. MPC has a standard technique to be followed, the MPC controller is developed for the model used, the model used is a linear model; hence, we went for a direct linear MPC approach. MPC technique is just not confined to one single technique rather it has a different range of methods to be controlled to a process model by the best minimisation of the objective function [56,57]. The summary of MPC is: • With the process model, the output can be predicted at future horizon. • With the help of control sequence, the objective function can be minimised. • A receding horizon strategy is used where only the first move is calculated and fed this strategy applies the primary control signal to form at each instance.
The implementation for the plant is by the linearised control, which is an added advantage. The advantage of using linear prediction is that a linear model can be more robust, where an optimisation problem based on a non-linear model. Few advantages of MPC is, even with the lesser knowledge of the process model the tuning of the parameters is easy. Variety of processes either simple or complex dynamics can be controlled with the strategy. Multivariable cases can be implemented easily. Compensation with the dead time is done in a natural way. By inducing the feed-forward technique, the disturbances that can be measured can be compensated. Constraints in the design can be easily added. The prediction property of the strategy makes the design very useful to eliminate the error [18,19]. In this section, the model used only to describe the dynamic relationship between insulin, glucose, and glucagon. Thus, this model treats meals as unmeasured, unmodelled disturbances [37]. Here, the state at a certain time t k + 1 is calculated from the state and the insulin infusion rate of the previous time t k . The glucose concentration y k can be calculated from the state. Consider the state-space models below: where A is 19×19 state matrix, B is 19×2 input matrix, C is 1×19 output matrix, and e k and is the difference between the actual glucose and the predicted glucose. The prediction is from x k k − 1 state at the time t k − 1 . Now, the glucose concentration for the next time measure can be predicted by using this error to calculate the next state. For the next j time measurements, the glucose concentration can be predicted by using the state-space model with no noise term. In the case of any model, if this term is not used, then the model can be predicted with a small noise term For the j measurements, where j = 1, 2, 3, …, N-1, N is the prediction horizon x^k + 1 + j k = Ax k + j k + Bû k + j k (27) y^k + 1 + j k = Cx k + 1 + j k (28) The optimal glucose concentration should be as close as possible to the threshold. That is the preferable level of glucose, called normoglycaemia, a person should have in a fasting state. The optimal insulin infusion rate is now estimated to minimise the least-squares difference between the predicted glucose trajectory and the set point [54]. This is the objective function in (29) that will be minimised for each time measure. To prevent too large changes in the insulin infusion rate, a damping parameter λ is introduced [18]. It is multiplied with the difference Δu k + j k between the insulin infusion rate at time t k + j − 1 so that Δu k + j k = u k + j k − u k + j − 1 k . The objective function is given as where r k + 1 + j k is the set point at time t k + 1 + j so r is the desired glucose level, which may or may not be time varying. The predicted glucose concentration in the objective function has to be constrained, since these are the model predictions. The glucose concentration predictions only depend on x k k − 1 , y k and the insulin infusion rates. The u which is the manipulated variable has two control variables U 1 and U 2 , which are infusions of insulin and glucagon. This means that every state prediction at time k can be calculated from the prediction made at time k − 1, the error term, and the predicted insulin infusion rate from time k to time k + N − 1. This will now be shown for N = 4. For the first step prediction, the output is given as By substituting (25) in (30) we get the output as For j = 1 For value of x^k + 1 k and x k + 2 k , the previous equation values can be substituted. For j = 2 For j = 3 For j = 4 and j = 3 From these calculations, it is seen that for an i step prediction at time k, where i ≤ N the prediction of the glucose concentration can be calculated directly from the prediction of the state at time k − 1, the error, and all the previously predicted insulin infusion rates as shown in the equation below: Expanding (40) while considering the infusion of the insulin and glucagon, the infusion rates should be within the physical limits and this type of implementation is constrained MPC with constraint added to the manipulated variables. Here, u for general form with constraints can be considered as By considering U with two manipulated variable and for N = 4 can be expressed as where By using these constraints, it can, for instance, be ensured that the insulin infusion rate and glucagon infusion are never negative. This is a necessary limit since insulin and glucagon cannot be extracted from the blood. There is also a limit to how much the insulin infusion rate should be changed between two consecutive time measures [56,57]. This means that there should be similar constraints on Δu k + j k . The constraints on the difference between the insulin infusion rate at two consecutive time measures can now be rewritten to linear constraints containing U k , so it can be inserted into the optimisation problem [19]. The two boundaries for ΔU k are called ΔU min and ΔU max , respectively. The constrains for the rate of flow for infusion are given in the equation below: The constraints are developed based on the manipulated variables, output of the system, and the rate of infusion of insulin and glucagon. The control strategy for automated insulin delivery is through enhancement of MPC. Such a controller can take action on a predicted hyperglycaemia or hypoglycaemia and even for the hard constraints on input and outputs. A cost function has to be defined for the controller to maintain the regulation of blood glucose [57]. Then an optimal control law is formulated subjected to the prediction model, control inputs, and output constraints. The main objective is to avoid and to reduce the occurrence of hyperglycaemia and hypoglycaemia. this minimises a relevant cost function, which is used to determine the manipulated variable. The controller output is implemented in real time for every sampling time with actual process data repetitively. The difference between the plant measurement and the model output is also fed to the controller to abolish the steady-state offset. This cost function usually depends on the quadratic error between the future reference variable and the future controlled variable within a limited time horizon. MPC strategy in loop algorithm is shown as flowchart in Step 7: Check the output measurement blood glucose and take action. • Step 8: Provide feedback by the output measurement to the next step and repeat the algorithm.
Mathematical model used in the research is a physiological model of Sorensen, which is derived and clinically tested. The decision of choosing a cost function, which is also called as the objective function, is very important because the variation in MPC can be clearly seen in the control algorithm. The major aim of developing a control is to ensure that the future output will reach the desired trajectory as close as possible. Finding the solution to the problem using MPC is optimisation. This technique minimises the cost function of the defined problem. The solution obtained from the minimisation is the input signal that would make the output of the system to follow the trajectory. The trajectory is set as the X ref reference, which is decided in prior and each state has a input reference, which is referred as U ref .Constraints are the control values or the limitations that are given to the system to execute. The constraints are used usually to maintain or to regulate the output of the system within the required range and for safety [18,19]. MPC depends on an iterative and finite horizon advancement of a plant model display. Whenever at time t, the present plant state is inspected and a cost minimisation calculation is done for a moderately brief time horizon in the future: [t, t + T]. Just the initial step of the control calculation is actualised and after that the plant state is inspected once more. The iterations are repeated from the start point that is the current state till a new predicted value is attained. The prediction horizon keeps being shifted forward and for this reason MPC is also called receding horizon control as shown in Fig. 12 [58].
Linear MPC with constraints is developed with the following specifications: • Output of the process: glucose at peripheral -we are observing the output at peripheral region, this is because usually a finger prick method is done at the peripheral region. In case, a minimal invasive or a continuous glucose monitoring is used; they are mounted at the peripheral region. • Manipulated/control variables: Insulin and Glucagon -these are our control variables, externally we infuse insulin to bring down the elevated glucose and glucagon is infused to rise the blood glucose to avoid hyperglycaemia. • Disturbance: random disturbance of meal (unannounced meal). • Set point: 90 mg/dl -this set point is considered as a safe zone, if the blood glucose is maintained at this value, the quality of life would be better and this is a normal glycaemic region. • Prediction horizon: 25 sampling time -prediction horizon is the number of future control intervals the MPC controller must evaluate by prediction while optimising manipulated variable.

Results
In this section, the simulation of the MPC algorithm implemented with constraint and parameter values is described in graphical form. The initial conditions are set for the plant and the blood glucose is starting at 110 mg/dl for the considered model, which corresponds to the target that is set by clinical trials. Considering from the data the initial condition, in which basal glucose is set to be 100 mg/dl for a type 1 patient [59]. This is observed in the steady-state analysis without meal intake. The output glucose constraints is considered to be 70 ≤ G(t) ≤ 110 mg/dl. The control horizon and prediction horizon are considered in sampling instant with 5 min. The inputs insulin and glucagon are constrained, which are associated with objective function. The hormones have the opposite effect in the regulation so that it can be controlled and balanced easily. In our research, we have considered the safe range for blood glucose as 70−180 mg/dl and the stages that of immense threat are: • Hyperglycaemia is a situation, where the excessive amount of blood glucose starts to circulate in the blood, and is identified in two categories: o Fasting hyperglycaemia is a condition, where the blood glucose rises above 130 mg/dl for 8 h of fasting. o Post-prandial hyperglycaemia is a condition, where the blood glucose rises above 180 mg/dl after 2 h of meal intake. • Hypoglycaemia is a state, where the blood glucose becomes lower than the acceptable range and is categorised into two terms: o Slight hypoglycaemia, where the blood glucose range is 55-70 mg/dl. o Severe hypoglycaemia, where the blood glucose range is below 55 mg/dl.
The performance of the controller is evaluated with the ATE [43] where N is the number of samples (2000 considered in the research), y^ is the glucose output, and y setpoint is the setpoint (90 mg/dl). The simulation is carried out for 2000 min nearly for one and a half days. The implementation of closed-loop is initiated from the first day, while the simulation is being performed unmeasured disturbance is given to the system and the control is observed in Figs. 13 and 14 concerning real cases. The simulation gives a good performance according to a few existing clinical studies when compared with existing literature. The statistical data for the performance evaluation are shown in Table 3 and also the risk ranges are being recorded along with ATE.
• Case 1: Disturbance 1: Fig. 13 is simulated for an unmeasured random disturbance, the effect of disturbance is observed within 200 min. The x-axis represents the time in minutes and the simulation is carried for 2000 m, in which is almost for one and a half days. The subplot represents the simulation of blood glucose level with the unit mg/dl; this is observed through the peripheral region of the system. The control units insulin and glucagon are plotted in the next subplots with the units mU/min and mg/min, respectively. It is observed that the disturbance applied is affecting the system but the control unit insulin is brought to zero and the glucagon is infused to regulate the blood glucose level to the threshold. The threshold is considered as 90 mg/dl, and if the blood glucose elevates from the threshold the insulin is infused and when it starts decreasing glucagon is infused and the blood glucose is maintained in the normal glycaemic range for a longer time. The performance of the controller is evaluated with ATE; the attained ATE for Case 1 is 4.31 mg/dl. This shows that the controller has taken immediate action and maintained the blood glucose in the normal range for a long time with a deviation of 4.31 mg/dl, wherein the standard value should be within the limit of 14.4 mg/dl. • Case 2: Disturbance 2: Retaining the same disturbance and including another disturbance at random time is shown in Fig. 14. The disturbance is given at 1600 min. The performance of the controller is evaluated with ATE; the attained ATE for Case 1 is 4.72 mg/dl. This shows that the controller has taken immediate action and maintained the blood glucose in the normal range for a long time with a deviation of 4.72 mg/dl, wherein the standard value should be within the limit of 14.4 mg/dl.
The statistical data for the performance evaluation with the comparison of two cases are shown in Table 3 and also the risk ranges are being recorded along with ATE. Table 3 explains the performance of controller using statistical data, the standard value for ATE is 14.4 mg/dl, whereas our proposed MPC algorithm tracking performance ATE is 4.3 mg/dl and no cases of hyperglycaemia and hypoglycaemia is observed throughout the simulation. Hence, the proposed single MPC for dual control improves the control performance and regulated the blood glucose for long time.

Conclusion
MPC has the advantage that it uses predictions of the glucose concentration, so it can react before changes occur. The proposed algorithm single MPC for dual control shows excellent performance and control from the simulation and statistical data. The simulation is designed in such a way that it imitates the clinical trials. To reject disturbances, insulin boluses can be administered simultaneously with the disturbance. MPC infuses the exact amount of bolus required for the correction of the error of blood glucose. Simulations have shown that the SoM with MPC can gives a good insulin and glucagon infusion rates with unannounced disturbances such as changes in insulin sensitivities. Simulation results confirm that the SoM handles changes in the insulin sensitivities well. Here, the controller returns the simulated patient to a normoglycaemic steady state after the changes. However, with a change in the endogenous glucose production at zero insulin, a parameter in the model, the controller gives few oscillations in glucose concentration. Owing to the subcutaneous delay, the glucagon and insulin infusion takes time to increase or decrease the flow. The MPC optimisation problem has two sets of constraints: minimum and maximum values for the calculated insulin infusion rate and minimum and maximum values for the change of insulin infusion rate between two consecutive time measures [60,61]. There is a natural minimum of the insulin infusion rate at zero because insulin cannot be extracted from the blood. The maximum insulin infusion rate should be high to ensure the possibility of giving large insulin boluses. The maximum insulin infusion rates and the constraints on change in the insulin infusion rate should be based on the actual mechanical limitations of the insulin pump.
Using linear predictions give larger irregularities due to the linear approximation, while a non-linear model if used directly would be more accurate. On the other hand, the linear predictions are computed much faster and do not require as much calculation capacity as a non-linear model. This is an advantage when calculations are made in a small computer controlling an insulin pump. The fast calculations are necessary to get a relatively small sample size of 5 s.
It can be seen from the simulations that MPC gives a better insulin infusion rate profile. MPC gives better results when it is used with a linear SoM. When a disturbance is applied, the absorption is dependent on the duration of the disturbance. Simulations show that the differences in the resulting glucose concentration trajectory are small. Therefore, disturbance can be regarded as impulses, which makes it easier for the user in the sense that it is not necessary to know the duration of the disturbance. Hence, it is concluded that a single MPC can be used for the dual infusion and controls of insulin and glucagon to regulate blood glucose. The ATE is used for performance tracking and shows a good performance by maintaining the normal range.

Acknowledgments
The first and the second author (C. Dias and S. Kamath) convey their gratitude to the Department of Instrumentation and Control, Manipal Institute of Technology, MAHE, Manipal for permitting the research to be conducted in their laboratory and providing the necessary facilities in carrying out this research. The third author (S. Vidyasagar) thank the Department of Medicine, Kasturba Medical College, MAHE, Manipal for their extensive support for this research. The authors significantly appreciate and thank the anonymous referees and the editor's positive and valuable comments that have improved the quality of this research paper. production. Removal and degradation of insulin occurs mostly in liver, kidney, and peripheral tissue, they degrade one-half, onethird, and one-sixth, respectively, of the insulin presented to them, regardless of the plasma concentration of insulin. The glucagon model is a little simplified as compared with the glucose and insulin model consisting of a single differential equation modelled as shown below. When the glucose, insulin, and glucagon model are converted into a subsystem, and the interconnections between them are made, then a complete SoM is obtained. Mass balance equations were written to account for blood flow, exchange between compartments, and metabolic processes causing addition or removal of glucose, insulin, and glucagon, yielding 19 differential equations. Mass balances for the glucose model result in a set of eight simultaneous ODE equations, which are non-linear as a result of metabolic source and sink rates. In addition, it is through these metabolic rates which depend on insulin and glucagon concentrations that the glucose model is coupled to the insulin and glucagon models, respectively. The mass balance equation of glucose model is given below (Tables 4-7): Brain Heart and lungs Gut Liver Kidney where the sources and sinks of glucose subsystem are characterised as: mass balances for the insulin formulation result in a set of seven simultaneous differential equations which are linear, except for the liver, where the rate of pancreatic insulin release (PIR) as an insulin source term is computed from an additional set of three ODE equations which constitute the model pancreas formulation brain (Tables 8 and 9) Heart and lungs where the glucagon model is described using a one compartment formulation that represents the whole body fluid distribution volume for glucagon (Tables 10-15). Glucagon is cleared from the body at a rate, which is a linear function of its plasma level, and glucagon is released from the pancreas as a non-linear function of arterial glucose and insulin concentrations (Tables 16). The glucagon mass balance equation is given by [6]: where these equations are linearised with an operating point and initial conditions are found and the linear equations are developed to get the state model.  Table 9 Sources and sinks of glucose subsystem Physiologic process Rate is a function of Process is sinks -red blood cell uptake constant brain uptake constant gut uptake constant peripheral uptake peripheral interstitial glucose linear peripheral plasma glucose non-linear urinary excretion kidney plasma glucose non-linear hepatic uptake liver glucose non-linear liver insulin non-linear sources -hepatic production liver glucose non-linear liver insulin non-linear plasma glucagon non-linear       Fig. 2 In Fig. 2, the legend consists of state variables, these 19 state variables are expanded in the table below and the differential equation from (2) to (20) contains the same state variables these are expanded in the same table (Tables 17-19). The detailed explanation of the parameters are available in the [29].