## 3 Proposed Approach
### Methodology  
In Figure 2, we can see a general illustration of our proposal. For the development of the proposal, as mentioned above, the role of the meta-heuristic bee colony algorithm is to explore the search space in order to find the optimal values for the constants (\(K_{p}\), \(T_{i}\)) of the PI controller. Each value found by the meta-heuristic is assigned to the variables of the controller and is modeled in the LEGO robot, and the fitness value is obtained for that model. The connection with the brick LEGO is performed by wireless mode using a block model in Simulink and a Wi-Fi router to obtain the values and calculate the error of the motors (see Figure 2). Before starting with the dynamic adaptation of variables of the (PI controller), we decided to use a reference method to use it as a guide in this work, there are many open loop tuning methods for self-regulating process (reaches a steady-state value after a step change in the manipulated variable) that use a first-order plus dead time model of the process (FODT) [29; 30; 31]. The transfer function of a general first-order plus dead time model is  
\[G_{FODT}(s)=\frac{Ke^{-s\theta_{D}}}{\tau s+1} \tag{5}\]  
where  
\(K=\) Gain Process  
\(\theta_{D}=\) Dead time  
\(\tau=\) Time constant  
The graphical procedure for determining the model is based on Ziegler-Nichols, according to [PERSON] in his book _Programmable Logic Controllers_[31]. The method consists of obtaining the features of the response in a step input of magnitude such as demonstrated by Figure 3. The response to this input is obtained experimentally. It is important to analyze the response obtained, since it must have an S shape; this type of response has two parameters: the dead time \(\theta_{D}\) and the time constant \(\tau\). After the process reaches the steady state, the parameters could be determined by drawing a straight-line tangent to the inflection point of the response obtained, as shown in Figure 4.  
Figure 3: Unit step input and response. The term \(T_{1}\) is the time at which the step change in the manipulated variable was imposed. \(T_{2}\) is the time at which the tangent drawn in the previous step intersects the time axis. To obtain the dead time, \(\theta_{D}=T_{2}-T_{1}\). The term \(T_{3}\) is the time at which the process variable response has made 63% of its total change. To obtain the time constant, \(\tau=T_{3}-T_{2}\). The process gain is the change in the process variable divided by the change in the control variable; see Equation (6). \[K=\frac{\Delta PV}{\Delta CV}=\frac{PV_{2}-PV_{1}}{CV_{2}-CV_{1}} \tag{6}\]  
The values obtained are shown below:  
\[\theta_{D}=T_{2}-T_{1}=0.15298\]  
\[(1)\tau=T_{3}-T_{2}{=1.02462}\]  
\[(2)K=\frac{\Delta PV}{\Delta CV}=\frac{PV_{2}-PV_{1}}{CV_{2}-CV_{1}}=1\]  
The first-order plus dead time model of the process (FODT) is presented in Equation (7). \[G_{FODT}(s)=\frac{e^{-s0.15298}}{1.02462s+1} \tag{7}\]  
According to the Ziegler and Nichols open loop tuning method, values of \(K_{p}\), \(T_{i}\), and \(T_{d}\) are established and calculated from the parameters \(\theta_{D}\), \(\tau\), and \(K\). In Table 1, we can see the tuning rule. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Controller Type** & \(K_{p}\) & \(T_{i}\) & \(T_{d}\) \\ \hline \(p\) & \(\frac{\tau}{K\theta_{D}}\) & \(\infty\) & \(0\) \\ PI & \(0.9\frac{\tau}{K\theta_{D}}\) & \(\frac{\theta_{D}}{0.3}\) & \(0\) \\ PID & \(1.2\frac{\tau}{K\theta_{D}}\) & \(2\theta_{D}\) & \(0.5\theta_{D}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Ziegler and Nichols’ tuning rules. Figure 4: Response to step input. The proposed controller for this test was PI, and the values obtained are shown below:  
\[K_{p}=0.9\frac{\tau}{K\theta_{D}}=0.9\times\frac{1.02462}{0.15298}=6.02796\]  
\[(3)T_{i}=\frac{\theta_{D}}{0.3}=\frac{0.15298}{0.3}=0.50993\]  
The values for the variables of the PI were implemented in the Simulink model. In Figure 5, the three signals are shown: Yellow signal is the pulse input to the system (reference).