Automatic feedback control algorithm for canal for a quick upstream water supply interruption in the case of an emergency

For the sudden upstream water interruption in the canal of an emergency, the existing research method guiding gate control is mainly feed-forward compensation algorithm, under which algorithm the interruption of water diversions is the upstream first and then the downstream. In order to achieve a more flexible water demand for different water diversions purpose, this study used PI water level difference feedback control algorithm to control the gate under this condition. The research results showed that the PI water level difference feedback control algorithm can make the change trend of water level of multi-pool close and reduce the rate of water level decline, and thus prolong the continuous delivery time of pools with offtake delivery demand under sudden upstream water interruption. Moreover, the PI water level difference method has good robustness and can be applied to more complex combinations of inflow and delivery changes. This study provides another way of thinking for the regulation of the gate in the case of sudden upstream water interruption.


Introduction
In recent decades, in order to solve the problem of uneven spatial and temporal distribution of water resources, many large-scale water transfer projects have been built and are being built at home and abroad. Engineering practice shows that small changes in the water level of the main canal will cause large changes in the water distribution flow, directly affecting the fairness and efficiency of water distribution. Therefore, the actual canal is to ensure the efficient and safe operation of the entire canal system by controlling the water level at a limited point. These points are often referred to as operation control points. Maintaining the water level stability at the control point is the primary condition for safe operation of the canal [1]. For open canal, water level control is mainly controlled by the control gates at both sides of a pool. Normally, the safety height of the canal bank at the downstream end of a pool is the smallest, so it mainly controls the water level at the downstream end of a pool. In order to achieve the goal of unattended operation based on the change of water level, the domestic and foreign scholars have made great progress in the research of automatic control algorithm of the canal. At present, the regulation method of water level in a canal is mainly divided into two parts: feedforward control and feedback control. Among them, the feedforward control algorithm is an active regulation, which formulates the control algorithm of the flow control plan in advance according to the water and water supply conditions and does not rely on the real-time water level feedback information. The principle is mainly based on the current state and the target state. Then the volume difference is used to calculate the gate flow process. The feedforward control algorithm mainly refers to the volume compensation algorithm [2]. The feedback regulation is a kind of passive regulation. According to the error of the water level, which is defined to be the difference between real time water level and target water level at the control point, the discharge that needs to be regulated is calculated. The principle is according to the real-time water level error and the change rate of error, conduct proportional amplification and integral processing and then calculate the regulation traffic. The feedback control algorithm currently mainly has local PI feedback control algorithm and centralized predictive control algorithm [3].
However, as the principle of automatic feedback control algorithm is based on the linearization hypothesis, it is mainly for the feedback automatic control of the pool under the condition of small water distribution or water distribution fluctuation. At present, for the emergency control of canal pools, where there is a sudden significant flow change, researchers mainly implement the gate control according to the feedforward control algorithm, especially for the emergency control in the case of upstream water supply interruption. Soler (2012) [4] tried to use the feed-forward volume compensation algorithm to rationally utilize the reservoir capacity of the series-adjusted reservoir to reduce the reservoir capacity of the Xerta-Sénia canal. Disturbance caused by small upstream water supply changes. However, there are many restrictions on feedforward regulation. For example, in the emergency situation of sudden water interruption, the change of the water distribution flow of the watershed obtained by the feedforward algorithm is gradually closed from upstream pool to downstream pool. In actual circumstances, it should be as much water supply as possible for some important offtakes. In contrast, the feedback control algorithm uses the real-time water level information to complete the gate regulation and can realize the gate regulation for various types of delivery changes. In particular, the PI feedback control algorithm can achieve good robustness by adjusting the control parameters. Therefore, here we try to use a PI water level difference feedback algorithm to carry out joint regulation of downstream gate groups in case of sudden water interruption.

PI feedback control algorithm
For the conventional downstream water level control, the PI control algorithm is that the upstream control gate is regulated according to the water level downstream of the pool, and the control objective is to ensure the water level stability. The real-time water level at the downstream end of the pool is ( 1, ) c i t + , and the deviation ( 1, ) e i t + from the target value ( 1, ) r i t + is used as the input of the PI controller, and the output is the flow change value ( , ) u i t of the local control gate.
In the formula, P K is the proportional gain and i T is the integral time constant. After that, the calculation of gate opening change is performed through the discharge formula.
Obviously, this algorithm can adjust the upstream inflow according to the water level change caused by the change of water delivery, and then achieve the purpose of adjusting the water level. However, if it is the water inflow that changes, this PI control method is not applicable.

PI water level difference feedback control algorithm
The PI water level difference control algorithm is a control algorithm proposed by Clemmens (2012) [5] for the regulation of the canal in the case of unbalanced inflow and outflow. The PI water level difference control algorithm is to control the gate according to the error difference of the water level error at the downstream end of the canal and water level error at the downstream end of the adjacent downstream canal. The control objective is to ensure that the water level error at the downstream end of the canal is as consistent as possible with the water level error of the adjacent canal.
The deviation ( , ) D i t , the difference between water level error ( , ) e i t of the canal and the ( 1, ) e i t + of the adjacent downstream canal, is the input of PI controller.
In a multi-pool canal with PI water level difference control, the headgate and control gate downstream most are not involved in regulation. Through the adjustment of opening of the other control gate, the water level error of all pools is close to be same. For example, when the water delivery in pool i is reduced, the water level at the downstream end of pool i, which is the control point, will rise. According to the regulation method, the outflow of pool i will increase, and the inflow of pool i will decrease, and finally the water level of all pools will increase with the same water level error. In this way, the volume capacity of all [pools can be utilized as much as possible to "digest" the imbalance of the canal headgate inflow and offtake flow. If the regulation method is not adopted, the water level of the pond pool i will rise rapidly, while the water level of other ponds will rise less, and the pond pool i may overflow quickly.

Scenario setting
The last 8 pools of the open canal part of the South to North Water Diversion Project North, which begins from Tanghe Gate (defined as Gate 0 here) and ends up with Beijumahe Gate(defined as Gate 8 here), was used as the study case here. There are 9 control gates in the study canal, and the canal is divided into 8 pools, and there is all water diversion near the downstream end of each pool. The initial operating conditions are 45m 3 /s for the control gate downstream most and 79m 3 Table 1.
Assume that at the time 600 s, due to an emergency event in the upstream of the study section, the water supply flow of Gate 0 to decrease from 79 m 3 /s to 0 m 3 /s within 30min. And each offtakes in the study section are supplying water to the major cities along the route. The goal of regulation and control is to use the pool volume to ensure that the offtakes (Gate 8 can also be treated as a offtake) can delivery water as long as possible. Each pool has the water delivery level, below which the offtake delivery will stop and defined as low water level here. And the minimum water supply level of each pool is 0.35 m below the designed water level. The initial water level is the design water level, and the volume capacity can be used as the volume between the design water level and the low water level. When the water level is lower than the low water level, the control gates and offtakes are all closed to indicate the termination of water delivery.
In addition, it can be assumed that the flow rate of Gate 8 is also reduced from 45 m 3 /s to 20 m 3 /s when the inflow water supply suddenly breaks in the upstream, but the reduction time is 40 min. This assumption is reasonable, as the Gate 8 is to supply water to Beijing and the Miyun Reservoir in Beijing can used as a regulation reservoir for Beijing City, it is realistic to extend the water supply duration of other water outlets by reducing the water supply to Beijing. And also this assumption is that the last delivery flow is reduced the time the inflow interrupted. This is the condition that the feedforward method cannot deal with. And the robustness of this algorithm is verified by setting the most downstream water delivery and the upmost inflow change the same time.
Then a simulation model of the studied canal was built to shown the control effect of this control method. And the results are shown below.

Parameter tuning of the control method
For the conventional PI feedback control algorithm, its parameter selection research is relatively mature. The common tuning process is mainly divided into three steps, the identification of the characteristic parameters of the canal pool, the feedback regulation limit cycle parameter of the canal pool and PI parameter selection. The characteristic parameter identification of the canal is mainly to identify the characteristics of the canal by observing the change of the water level caused by a flow pulse by applying the flow pulse change of the canal, which can be obtained through the physical model or mathematical model test of the canal. Then the pool feature parameter backwater area d A and delay time d τ .
Then calculate the limit cycle parameters of the feedback control of the canal by the characteristic parameters.
The PI control parameter is adjusted by a certain ratio to adjust the feedback control limit cycle parameters.
where, a and b are scale factors, respectively. For the PI water level difference feedback control algorithm, the parameter setting is difficult, and there is no theoretical parameter selection analysis at present. Therefore, reference can be made here to the selection of the PI feedback control algorithm, and the feedback control limit cycle parameters are multiplied by a certain ratio to perform parameter selection. In order to ensure the stability of the algorithm, the value of a should be small, initially determined to be 0.3, and the value of b should be large, which can be set to 1.5 here.

Control results and analysis
The PI water level difference control algorithm is used to control the control gate, and when the water level deviation before the gate of the control gate is less than -0.35m, that is, when the water level is lower than the low water level, the offtake flow of the current canal is set to zero immediately. For the downstream most Gate 8, the control gate is also closed when the water level before the gate is lower than the low water level. Therefore, the time water level error is equal to -0.35 m is the time the delivery terminated. Finally, the change process of the water level at the end of each pool (also the water level immediately upstream the downstream control gate of the pool) and the flow rate of each control gate are shown in Fig. 1 and Fig. 2.
It can be seen from Fig. 1 that the water level error immediately upstream Gate 1, 2, 3 and 4 is stable at around -0.35m around 10h, indicating that the offtake delivery in the pool 1, 2, 3 and 4 continues for 10 hours. From Fig. 2, it can be seen that the control gates 1, 2, 3, and 4 are completely closed before 10 hours, which indicates that the offtake delivery is continued by using the available pool volume although the inflow of the pool is interrupted. The Gate 3 is closed later than the Gate 4 and continues to supply water downstream to pool 4. This is because the flow rate of offtake before the control gate 4 is 17 m 3 /s, the imbalance of inflow and outflow of pool 4 results in a relatively larger water level deviation at the downstream end of pool 4 than that water level error of pool 3, so that the Gate 3 continues to supply water to the pool 4 until the water level deviation is close according to the PI water level difference control. But if there is no PI water level difference feedback control algorithm and Gate 3 and 4 are to closed completely synchronously, the decrease of the water level at the downstream end of pool 4 is faster than in pool 3. And the water level of pool 4 low water level than the lower limit of the throttle gate 3, so that the water division of the throttle gate 4 is quickly interrupted. This shows that the PI water level difference feedback control algorithm plays a role in rationally distributing the pool capacity.
The water level before the gates of the gates 5, 6, 7, and 8 was reduced to -0.35 m around 25 h. It indicates that the water outlets of the tanks 5, 6, 7, and 8 are continuously supplied to the water for 20 hours. The reason why the water level of the control gates 8 rises again after 25 hours is the sudden closing of the control gate 8. The opening degree of the control gate 8 here is immediately closed when the water level reaches -0.35 m, so the sudden closing causes the water level fluctuation of the gate of the control gate 8 and the increase of the water level.
Comparing the water level before the gate of the gates 1, 2, 3, and 4 and the water level before the gates of the gates 5, 6, 7, and 8 in Figure 1, it can be seen that the gates 1, 2, 3, and 4 are mainly subjected to upstream precipitation waves. The impact of the overall water level of the control gate is a downward trend. The control gates 5, 6, 7, and 8 are affected by the downstream rising water wave, and the overall trend is upward. Moreover, the PI water level difference control algorithm can play the role of transmitting this trend, so that the increase and decrease of the control gate are as equal as possible. Comparing the water delivery time of the upstream four canal pools with that of the downstream four canal pools, it can be seen that as the delivery flow of Gate 8 is reduced, the water supply and the duration of water distribution in the downstream four canal pools at the downstream can be prolonged. But the impact is limited, because the water level near the upper reaches of several canal pools is interrupted rapidly due to the interruption of water supply.
In summary, it can be seen that the PI water level difference control algorithm has the function of reasonably allocating the pool storage capacity and transmitting the water level change trend. It is possible to make the water level change of the canal as close as possible, so as to maintain the continuous water supply of all the water offtakes. If a offtake is suddenly interrupted during the regulation process, this interruption will also cause the water level to rise. The PI water level difference feedback control will also transfer this increase to other pools, thus prolonging the water distribution time of other water offtakes.

Conclusions
By applying the PI water level difference feedback control algorithm to the situation of a sudden interruption of the water inflow and analyzing its application effect, the following conclusions can be drawn: 1) The PI water level difference control algorithm has the function of reasonably allocating the pool storage capacity and transmitting the water level change trend, which can satisfy the situation that the water level decline trend of each canal pool is close when the water supply is interrupted. Therefore, the change trend of water level of the multi-pool is slowed down, and the purpose of continuous water delivery is achieved.
2) Using the PI water level difference control algorithm, the water supply reduction or interruption of the downstream control gate can extend the water diversion time of some pools, but due to the upstream inflow interruption, the water diversion time of several upstream pools cannot be extended.
3) PI water level difference feedback control algorithm is mainly based on real-time water level deviation to control the gate, can deal with various watershed changes, and has good robustness. However, it cannot be guaranteed whether the water level variation under sudden large flow changes satisfies the actual constraints. Therefore, when performing the control gate or the large flow rate change of the water outlet, it is necessary to extend the change time as much as possible or to opening the escape gate.