## 3 Methodology
\[U_{out}=A_{2}\sqrt{2 gH_{2}} \tag{5}\]  
\[U_{in}=K_{1}a_{1} \tag{6}\]  
\[z_{1}=H_{2}\qquad c_{1}=\frac{A_{2}\sqrt{2g}}{A} \tag{7}\]  
\[z_{2}=H_{1}-H_{2}\qquad c_{2}=\frac{A_{12}\sqrt{2g}}{A} \tag{8}\]  
The derived system focuses on the dynamic behavior of \(Z_{1}\) and \(Z_{2}\). The rate of change of \(Z_{1}\) is determined by the differential Equations (2), (4), (5) and (7), leading to Equation (9). For \(Z_{2}\), by subtracting Equation (2) from Equation (1) and substituting Equations (4) through (6), we derive Equation (10). These nonlinear differential equations are subsequently linearized using Taylor Series expansion. The equilibrium positions of state variables \(Z_{1}^{*}\) and \(Z_{2}^{*}\) are determined by setting their derivatives to zero, resulting in Equation (11). The first derivative of the Taylor Series is used for linearization, as shown in Equation (12). Analyzing the differential equation for \(Z_{2}\), the linearized form is derived in Equation (13). Applying the Laplace transform yields Equation (14). Similarly, for \(Z_{1}\), the linearized form is given in Equation (15), and its Laplace transform is shown in Equation (16). These transformations enable a simplified analysis of the system dynamics. \[\frac{dZ_{1}}{dt}=-c_{1}\sqrt{Z_{1}}+c_{2}\sqrt{Z_{2}} \tag{9}\]  
\[\frac{dZ_{2}}{dt}=c_{1}\sqrt{Z_{1}}-2c_{2}\sqrt{Z_{2}}+\frac{K_{1}a_{1}}{A} \tag{10}\]  
\[Z_{1}^{*}=\left(\frac{c_{2}\sqrt{Z_{2}}}{c_{1}}\right)^{2}\quad Z_{2}^{*}= \left(\frac{c_{1}\sqrt{Z_{1}}}{2c_{2}}+\frac{K_{1}a_{1}}{2 Ac_{2}}\right)^{2} \tag{11}\]  
\[f(\mathbf{x})=f(\mathbf{x}^{*})+\
abla f(\mathbf{x}^{*})\Delta x \tag{12}\]  
Figure 2:0  
Figure 2:1  
Figure 2:2  
Figure 2:3  
Replacing Equation (17) into Equation (18) results in a transfer function that relates the height of the tank to the flow inlet. This transfer function is expressed as Equation (19), where \(\Delta Z_{1}(s)\) represents the change in the height of tank 1, and \(\Delta a_{1}(s)\) represents the change in inlet flow. Equation (19) provides the resulting transfer function. The transfer function describing the plant for subsequent control design is obtained by utilizing the equilibrium positions derived in Equation (20). This transfer function, incorporating system parameters and equilibrium variables, is shown in Equation (21). Figure 2:4  
Figure 2:5  
Figure 2:6  
Figure 2:7  
Figure 2:8  
The fractional PID controller tuning values are optimized using heuristic algorithms. These algorithms have distinct parameters, and an objective function is assigned to each test. The heuristic optimization process ensures that the fractional PID controller attains optimal performance in regulating the height of the interconnected tank system. The PID controller is formulated as Equation (22). The optimization process involves adjusting \(K_{p}\), \(K_{i}\), and \(K_{d}\) to minimize the control error and achieve the desired system performance. The optimization process consists of two stages: the first stage optimizes the proportional, integral, and derivative constants, while the second stage focuses on the integral and derivative orders. The algorithm continues to run until the specified number of iterations is completed. The results, including tuned values and performance indices for each test, are printed for further analysis and interpretation. The objective function for optimizing the fractional PID controller tuning values is designed to minimize control errors in regulating the height of the interconnected tank system, in Equation (23), and the explanation of the parameters on the Figure 2:9 This objective function, denoted as \(J\), is formulated based on the performance indices Integral Absolute Error (IAE), Integral Square Error (ISE), and Integral Time-weighted Absolute Error (ITAE). The controller's performance is then evaluated using Overshoot, Establishment Time, and Rise Time. The results are compared, and the best method is selected visually based on these criteria.