## 4 Controller Design  
First, [PERSON] [18], [PERSON] [24], and [PERSON] [21] glucose-insulin models were implemented in MATLAB-Simulink. Additionally, for each of these three models, a PID controller was designed. Additionally, the optimum controller gains, calculated by using Ackerman model, were implemented on all these models. It is known that daily insulin delivery and human glucose levels should be in the desired range [3] of 70-130 mg/dl. The three models used in this study have parameters for different patients. It is easy to observe that [PERSON]'s model can be used as a state-feedback controller design. [PERSON]'s minimal model is easier to adopt, and using this simpler non-linear model can be less time-consuming than a more complicated non-linear model. The [PERSON] model is comprehensive and detailed, so insulin and glucose levels all-around the body can be simulated with it. It is also very complex and contains several parameters.  
After the glucose-insulin models are established, control of glucose level is the next step. For those controllers, there are two types of control reference methods: target tracking (e.g., 90 mg/dl) and reference tracking (e.g., 80-110 mg/dl) [19]. For this article, PID with bang-bang coupling, and optimal controllers were selected from control algorithms, and the target tracking method was used [6].  
To design the optimal controller, state-space forms had to be established. Since [PERSON] and [PERSON]'s models are nonlinear, the optimal controller was designed regarding [PERSON]'s linear model. Ackerman equations are formed in the state-space form as shown using Equations (5) and (6).  
\[\left[\begin{array}{c}\dot{x_{1}}\\ \dot{x_{2}}\end{array}\right]=\left[\begin{array}{cc}-m_{1}&-m_{2}\\ m_{4}&-m_{3}\end{array}\right]\left[\begin{array}{c}x_{1}\\ x_{2}\end{array}\right]+\left[\begin{array}{c}0\\ 1\end{array}\right]u. \tag{15}\]  
After the state-space model is defined, a performance criterion is defined considering the deviation from the target of blood glucose level and delivered insulin; also, \(\delta\) is taken as the balance between them. \(\delta\) defines the coefficiency of the effect of input, which typically describes the delivered insulin.  
\[P.I.=\int_{\cdot}^{\infty}\left(x_{1}-x_{ref}\right)^{2}+\delta\;u^{2}\;, \tag{16}\]  
While \(Q\) is defined as 1, and \(P\) is as \(\delta\), [PERSON]'s equation is applied for \(A\) and \(B\) from (15) as follows:  
\[A^{T}\;R+RA-RBP^{-1}\;B^{T}R+Q=0\;\text{where}\;R=\left[\begin{array}{cc}r_ {11}&r_{12}\\ r_{12}&r_{22}\end{array}\right]. \tag{17}\]  
For calculated \(R\), \(m_{1}\) = 0.005, \(m_{2}\)  
the pump as well, so \(\delta=0.25\) represents a less power efficient pump, and \(\delta=1\) represents a more power-efficient pump.  
\[u_{0}=-K^{T}x\text{ where }K=RBP^{-1}, \tag{18}\]  
Finally, the PID algorithm is established, and the reference glucose and actual glucose measurement information is transmitted to the PID controller and delivered to the bang-bang controller and ROM of the piezoelectric actuated pump at the input of the plant model. The flowing insulin is transmitted to the insulin/glucose model. PID controller parameters _Kp_, _Ki_, _Kd_, is optimized for the best performance for overshoot _Me_ = 40% rising time _tr_ = 5 mins and settling time _ts_ = 15 mins for all glucose-insulin models [38].