# Design of a NARX-ANN-Based SP Controller for Control of an Irrigation Main Canal Pool
## 3 Design of the NARX-ANN-Based SP Controller  
Model (11) shows that the dynamics of the water distribution in our canal pool is characterized by a dominant time delay [28]. Since the time delay reduces the gain crossover frequency, the phase margin, and the speed of response of the control systems, and even can cause the loss of the stability of the closed-loop system [78], the design of a modified SP controller founded on the NARX-ANN-based models previously obtained is proposed for the effective control of water distribution in our canal pool. The main advantage of the SP is that it removes the real process from the control loop, and it allows then to design the controller from a mathematical model that does not include the process time delay [29]. Therefore, if the mathematical model accurately describes the dynamics of the process to be controlled, the SP eliminates the time delay from the characteristic equation of the closed-loop control system [28]. One of the main problems of the SP controller is the degradation of its performance and robustness when the processes are subjected to the effect of external load disturbances [28; 30]. Figure 8 illustrates a diagram of the conventional SP structure, made up of the controller \(C(s)\), the real process \(P(s)\), and the complete linear mathematical model of the process (integrated by the model without time delay \(G_{p}(s)\) and the time delay \(e^{-Ls}\), which is connected in parallel with the real process. Usually, \(C(s)\) is a standard PI or PID controller [21]. If the mathematical model accurately describes the dynamic behavior of the real process, that is \(P(s)=G_{p}(s)e^{-Ls}\), the output signal \(Y_{m2}(s)\) has no time delay and constitutes a prediction of the output signal \(Y(s)\) of the real process without time delay [31]. Therefore, based on the mathematical model, it is possible to obtain a prediction of the real process output signal ahead of the time delay. The real process output signal \(Y(s)\) is fed back to the controller to remove the negative effect of the load disturbance \(D(s)\). The transfer function of the load disturbance \(D(s)\) is the following:  
\[G_{D}(s)=\frac{K_{D}}{s+1} \tag{12}\]  
where \(K_{D}\) is a time varying parameter in the following range: \(K_{D\text{min}}<K_{D}(t)<K_{D\text{max}}\). Figure 8: Conventional structure of the SP. If the complete mathematical model \(G_{p}(s)e^{-Ls}\) accurately describes the dynamic behavior of the real process \(P(s)\) and there is no load disturbance, the error signal \(e(s)\) is zero and the transfer function of the closed-loop control system is represented as:  
\[G_{LC}(s)=\frac{C(s)P(s)}{1+C(s)G_{p}(s)}=\frac{C(s)G_{p}(s)e^{-Ls}}{1+C(s)G_{p} (s)} \tag{13}\]  
If \(C(s)\) is a PI controller, the control algorithm is defined by the expression [79]:  
\[C(s)=\frac{u(s)}{e_{2}(s)}=K_{C}(1+\frac{1}{T_{I}s}) \tag{14}\]  
where \(K_{C}\) is the proportional gain, \(T_{I}\) is the integral time constant, \(e_{2}(s)\) is the error signal and \(u(s)\) is the control signal. Consequently, the controller \(C(s)\) is designed for the real process without time delay and the response of the closed-loop control system is time delayed. The right performance of the SP depends on the exact knowledge of the process model \(G_{p}(s)\) and the time delay \(e^{-Ls}\)[28]. Any model uncertainty and/or load disturbance can lead to imprecise time responses of the control system, which can even cause its instability [32]. Our contribution consists of: (1) replacing the linear mathematical model of the conventional SP structure by the non-linear NARX-ANN (3) and the TD-NARX-ANN (4) based models obtained in the previous Section; and (2) adding to the controller output signal \(u(t)\) a signal equivalent to the estimate \(\hat{D}(t)\) of the load disturbance \(D(t)\) (for example, an increase in the lateral discharge \(q_{1}(t)\)) in order to reject its negative effect on the control system and, thus, increase the controller performance.