Research on liquid level control method and active disturbance rejection of double tank Ying Lin ∗ School of Internet of Things Engineering, Jiangnan University, Wuxi 214122, China. Abstract Due to the non-linearity, large hysteresis and time variability of the liquid level of the dual tank, the traditional PID control is difficult to achieve the ideal control effect and the parameters are not self-adaptive in the absence of accurate mathematical model. To meet the requirement of multi-level rapid control and auto-disturbance rejection for two-capacity water tank system, a double-fuzzy cascade PID control method with adaptive factors is proposed based on the traditional single-loop cascade fuzzy control strategy. The double fuzzy cascade structure not only improves the performance of the controller, but also adds the self-adjusting factor to optimize the control rules of the fuzzy controller by modifying the quantization factor, and improves the dynamic performance and auto-immunity of the system. Finally, Matlab/Simulink simulation verifies the effectiveness and optimization of the proposed control strategy compared with the traditional method. Keywords dual tank control, self-adjusting factor, fuzzy PID, active disturbance rejection 1. Introduction 1.1. Research background The problem of liquid level and flow control occurs in various fields such as People's Daily life and industrial production, including the control of liquid storage tank involved in urban domestic water supply and other processing and production processes. The liquid level should be neither too full nor too low, which should be within a certain range [1]. Therefore, it is significantly vital to study the control method of the liquid level of the water tank, so that the liquid level can keep the expected value faster and more stable, eliminating the disturbance quickly. Double-capacity water tank is a typical nonlinear liquid level control system, which is easily affected by frequent fluctuations of external water pressure, and has the characteristics of large lag, nonlinear and time-varying [2]. The whole control process is complicated. ICCIC 2024: International Conference on Computer and Intelligent Control, June 29–30, 2024, Kuala Lumpur, Malaysia ∗ Corresponding author. yingl_2024@163.com (Y. Lin) 0009-0001-8080-453X (Y. Lin) © 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR ceur-ws.org Workshop ISSN 1613-0073 Proceedings 1.2. Literature review Traditional control methods of dual tank include single-loop PID, Smith predictor and cascade PID control method [3]. These methods having simple structure can solve most liquid level systems with low accuracy requirements. In view of the difficulty of PID parameter tuning, some scholars proposed an adaptive particle swarm optimization (APSO) algorithm to optimize PID parameters in the dual tank level control system [4]. With the further study, it is required that the PID parameters can be adjusted online, and the fuzzy controller is used to adjust the PID parameters [5]. Combining the fuzzy control and PID control, the fuzzy PID liquid level control system based on Larsen is proposed, which has obtained better optimization control effect than the traditional PID [6]. At present, the method of adding self-adjusting factor [7] to the fuzzy controller for adaptive control is proposed in existing studies, but it hasn’t applied to the liquid level control system yet and is just a single closed-loop structure, which has weak resistance to disturbance. The main contribution of this paper is that a strategy for the level control of dual tank based on fuzzy cascade PID with self-adjusting factor is proposed. By adding an adaptive factor A which is also generated by fuzzy inference, the performance of fuzzy controller will be improved. This paper is organized as follows: In Section 2, the model of water level for the double tank is constructed and mpirical model parameters are applied. Section 3 introduces PID controller parameters and fuzzy controller rule setting. Then an adaptive fuzzy cascade control model is proposed to improve the control effect. In Section 4, the Matlab simulation model is used to verify that the control strategy has better dynamic response characteristics than ordinary fuzzy control, and can restore the steady-state setting faster after adding interference. Section 5 gives the conclusions. 2. Establishment of liquid level system model of double tank 2.1. Choice of modeling method In the transfer function transformation of physical model, there are two methods: mechanism modeling and empirical modeling. Empirical modeling needs to select a model with the highest matching degree as the empirical model according to the experimental data of input and output and certain performance requirements. Since the empirical modeling only tests and describes the dynamic characteristics from the external characteristics, the mechanism modeling method is adopted here because of the lack of measured data. For the double tank, the material balance process of the upper and lower tank is selected to study. 2.2. Mathematical model building The system structure of the two-capacity water tank is shown in Figure 1. Qi Q1 H1 R1 A1 Water Tank A H2 Qo A2 R2 Water Tank B Figure 1: Structure diagram of double tank Suppose that the inflow 𝑄𝑄𝑖𝑖0 , outflow 𝑄𝑄10 of tank A and the outflow 𝑄𝑄𝑜𝑜0 of tank B under steady state conditions are 𝑄𝑄𝑖𝑖0 = 𝑄𝑄10 = 𝑄𝑄𝑜𝑜0 . The degree to which each variable deviates from the initial steady-state value can be expressed in incremental form: ∆𝐻𝐻 = 𝐻𝐻 − 𝐻𝐻0 � (1) ∆𝑄𝑄 = 𝑄𝑄 − 𝑄𝑄0 According to the material conservation formula into the incremental formula: 𝑑𝑑∆𝐻𝐻1 𝐴𝐴1 = ∆𝑄𝑄𝑖𝑖 − 𝑄𝑄1 � 𝑑𝑑𝑑𝑑 (2) 𝑑𝑑∆𝐻𝐻2 𝐴𝐴2 = ∆𝑄𝑄1 − 𝑄𝑄𝑜𝑜 𝑑𝑑𝑑𝑑 Due to the nonlinear and hysteresis characteristics of the double tank level control system, it is difficult to analyze and control the system. However, when the liquid level always changes within a small range of its stable value, we can linearize the nonlinear system. Linearize the nonlinear relationship 𝑄𝑄1 , 𝑄𝑄𝑜𝑜 and 𝐻𝐻1 , 𝐻𝐻2 at the steady-state operating point: 𝑑𝑑𝑄𝑄1 𝐾𝐾1 ⎧ 𝑄𝑄1 = 𝐾𝐾1 �𝐻𝐻1 ≈ 𝑄𝑄10 + (𝐻𝐻1 − 𝐻𝐻10 ) = 𝑄𝑄10 + ∆𝐻𝐻 ⎪ 𝑑𝑑𝑑𝑑 2�𝐻𝐻10 (3) ⎨𝑄𝑄 = 𝐾𝐾 𝐻𝐻 ≈ 𝑄𝑄 + 𝑑𝑑𝑄𝑄𝑜𝑜 (𝐻𝐻 − 𝐻𝐻 ) = 𝑄𝑄 + 𝐾𝐾2 ∆𝐻𝐻 ⎪ 𝑜𝑜 2� 2 𝑜𝑜0 ⎩ 𝑑𝑑𝑑𝑑 2 20 𝑜𝑜0 2�𝐻𝐻20 Omit the increment symbol and get: 𝑑𝑑𝐻𝐻1 1 ⎧ = (𝑄𝑄 − 𝑄𝑄1 ) 𝑑𝑑𝑑𝑑 𝐴𝐴1 𝑖𝑖 (4) ⎨𝑑𝑑𝐻𝐻2 = 1 (𝑄𝑄 − 𝑄𝑄 ) ⎩ 𝑑𝑑𝑑𝑑 𝐴𝐴2 1 𝑜𝑜 𝐻𝐻1(𝑠𝑠) 𝐻𝐻2 (𝑠𝑠) where 𝑄𝑄1 = 𝐾𝐾1 �𝐻𝐻1 , 𝑄𝑄𝑜𝑜 = 𝐾𝐾2 �𝐻𝐻2 , 𝑄𝑄1 (𝑠𝑠) = 𝑅𝑅1 , 𝑄𝑄𝑜𝑜 = 𝑅𝑅2 and 𝑅𝑅1 , 𝑅𝑅2 are the water resistance of the two valves. The transfer function is obtained by simplifying each link and performing equivalent transformation: 𝐻𝐻1(𝑠𝑠) 𝑅𝑅2 𝐾𝐾 = = (5) 2 2 𝑄𝑄1 (𝑠𝑠) (𝐴𝐴1 𝑅𝑅1 𝐴𝐴2 𝑅𝑅2 )𝑠𝑠 + (𝐴𝐴1 𝑅𝑅1 + 𝐴𝐴2 𝑅𝑅2 )𝑠𝑠 + 1 𝑇𝑇1 𝑇𝑇2 𝑠𝑠 + (𝑇𝑇1 + 𝑇𝑇2 )𝑠𝑠 + 1 where 𝑇𝑇1 = 𝐴𝐴1 𝑅𝑅1 , 𝑇𝑇2 = 𝐴𝐴2 𝑅𝑅2 , 𝐾𝐾 = 𝑅𝑅2 . Since the two-capacity water tank generally has hysteresis in the production process, the pure hysteresis link is added here, and the final result is: 𝐻𝐻1(𝑠𝑠) 𝐾𝐾 = · 𝑒𝑒 −𝜏𝜏𝑠𝑠 (6) 𝑄𝑄1 (𝑠𝑠) (𝑇𝑇1 𝑠𝑠 + 1)(𝑇𝑇2 𝑠𝑠 + 1) The transfer function of the two water tanks in the two-capacity water tank liquid level system is obtained by bringing in the value: 5.2 7.1 𝐺𝐺1 = , 𝐺𝐺2 = 𝑒𝑒 −80𝑠𝑠 (7) 160𝑠𝑠 + 1 227𝑠𝑠 + 1 3. Controller design and comparison 3.1. Cascade PID PID algorithm is widely used in industrial production, in which the conventional single-loop PID has been able to solve most simple continuous systems without large lag. However, in a more complex system, cascaded PID control system adds a secondary loop compared with single-loop PID. During control, the main loop (outer loop) is a fixed value control system, while the secondary loop (inner loop) is a follow-up control system. The adaptive ability of the inner loop to disturbance can effectively overcome the disturbance in the control process and realize advance control of the controlled object. Then the hysteresis problem is solved, and the adaptability and stability of the system are improved. Its structure block diagram is shown in the Figure 2. N1(s) N2(s) R(s) + E(s) + Secondary Secondary Y(s) Main Cotroller Main Object - Controller Object - Figure 2: Structure block diagram of Cascade PID According to the principle of the main and secondary loop design of the cascade control system, the sensitivity of the upper tank is better than that of the lower tank, so the upper tank is selected as the secondary object and the lower tank is the main object. 3.2. Design of fuzzy controller of double tank level In practical application, PID parameters are changeable, there is no definite mathematical model and rule to follow, which causes some obstacles to parameter identification, and fuzzy control can make full use of the operator's successful practical experience in real-time nonlinear adjustment. Therefore, using fuzzy controller to adjust PID parameters online can give full play to the excellent control function of PID controller and make the system achieve the best effect. 3.2.1. Fuzzy controller design Fuzzy control is composed of five parts: computer control variable, fuzzy quantification, fuzzy control rule, fuzzy decision and clarity. Fuzzy Controller Iuput + Calculating Output Fuzzy Control Fuzzy A/D Control Clarification D/A Quantization Rules Decision Variables Controlled Actuating Sensor Object Mechanism Figure 3: Structure of fuzzy controller The input of the fuzzy controller can be transmitted to the computer to solve the output of the controller through fuzzy, which is called fuzzy interface. It outputs a fuzzy vector through a fuzzy subset of the determined input. Here, the input and output variables are decomposed into 7 fuzzy subsets using the seven-stage fuzzy method: 𝑒𝑒 = {𝑁𝑁𝑁𝑁, 𝑁𝑁𝑁𝑁, 𝑁𝑁𝑁𝑁, 𝑍𝑍𝑍𝑍, 𝑃𝑃𝑃𝑃, 𝑃𝑃𝑃𝑃, 𝑃𝑃𝑃𝑃} (8) They represent Negative Big, Negative Middle, Negative Small, Zero, Positive Small, Positive Middle and Positive Big. Then, the appropriate membership function is selected from the knowledge base. Membership function is a good base for the application of fuzzy control with the key, common including Gaussmf Trimf, Trapmfand and etc. In the controller design, different membership functions are selected for effect comparison. Finally, Gaussmf is selected as the final membership function due to its high sensitivity and good stability, and appropriate discourse domain is set for input and output. Here, the discourse domain of e and ec is set to [-3, 3], and the domains of 𝐾𝐾𝑝𝑝 , 𝐾𝐾𝑖𝑖 and 𝐾𝐾𝑑𝑑 are set to [-3, 3]. Fuzzy rule is based on the long-term work experience of experts or operators, which uses a series of relative words to establish fuzzy control rules. Write a rule based on a logical relationship table that looks like the following: 𝐼𝐼𝐼𝐼 (𝑒𝑒 𝑖𝑖𝑖𝑖 𝑁𝑁𝑁𝑁) 𝑎𝑎𝑎𝑎𝑎𝑎 (𝑒𝑒𝑒𝑒 𝑖𝑖𝑖𝑖 𝑁𝑁𝑁𝑁) 𝑡𝑡ℎ𝑒𝑒𝑒𝑒 (∆𝐾𝐾𝑝𝑝 𝑖𝑖𝑖𝑖 𝑃𝑃𝑃𝑃)(∆𝐾𝐾𝑖𝑖 𝑖𝑖𝑖𝑖 𝑁𝑁𝑁𝑁)(∆𝐾𝐾𝑑𝑑 𝑖𝑖𝑖𝑖 𝑃𝑃𝑃𝑃) (9) A total of 49 articles. Finally, the fuzzy quantity obtained by fuzzy reasoning needs to be fuzzy, and the most common weighted average method is used here to deal with it. 3.1.2. Structure of Fuzzy Cascade PID The input value of fuzzy PID controller is deviation and deviation rate of change. After fuzzy processing, approximate reasoning is carried out by fuzzy reasoning system, and 𝐾𝐾𝑝𝑝 , 𝐾𝐾𝑖𝑖 , 𝐾𝐾𝑑𝑑 's correction value ∆𝐾𝐾𝑝𝑝 , ∆𝐾𝐾𝑖𝑖 and ∆𝐾𝐾𝑑𝑑 , under the condition of certain deviation and deviation rate of change, is superimposed with the initial PID parameters after clarification. The PID parameters can be adjusted in real time when the system deviation and the deviation change rate are constantly changing, so as to realize the self-tuning of PID parameters. The diagram is shown in Figure 4. ec ec' de/dt de/dt Fuzzy ControllerⅠ Fuzzy ControllerⅡ e e' △Kd △Ki △Kd △Kd △Ki △Kd N1(s) N2(s) R(s) + E(s) + E'(s) Secondary Y(s) PID ControllerⅠ PID ControllerⅡ Main Object Object - - Figure 4: Cascade fuzzy PID structure block diagram The mathematical principle of PID parameter tuning is as follows: 𝐾𝐾𝑝𝑝 = 𝐾𝐾𝑝𝑝0 + ∆𝐾𝐾𝑝𝑝 � 𝐾𝐾𝑖𝑖 = 𝐾𝐾𝑖𝑖0 + ∆𝐾𝐾𝑖𝑖 (10) 𝐾𝐾𝑑𝑑 = 𝐾𝐾𝑑𝑑0 + ∆𝐾𝐾𝑑𝑑 where 𝐾𝐾𝑝𝑝 , 𝐾𝐾𝑖𝑖 and 𝐾𝐾𝑑𝑑 are respectively the gain of fuzzy self-tuning PID output; ∆𝐾𝐾𝑝𝑝 , ∆𝐾𝐾𝑖𝑖 and ∆𝐾𝐾𝑑𝑑 are respectively the adjustment amounts of gain; 𝐾𝐾𝑝𝑝0 , 𝐾𝐾𝑖𝑖0 and 𝐾𝐾𝑑𝑑0 are respectively the initial gain values. 3.3. Double fuzzy cascade PID control strategy with self-adjusting factor The basic fuzzy controller can meet most control requirements. However, when the parameters drift, it cannot adapt to the control object. At the same time, there are subjective factors in the design process, and fuzzy rules cannot be modified once they are determined. The fuzzy controller with self-adjusting scaling factor ɑ is able to change the control rule by modifying the quantization factor according to the change of system error e and error change rate ec, and then use the optimized control rule to control the system, so that the system has the ability of self-optimizing. The combination of factor ɑ, fuzzy controller and cascade PID is a comprehensive control strategy with adaptive and active disturbance rejection ability. Since the outer ring is the main regulating function, factor ɑ is added in front of the first fuzzy controller, and its system block diagram is shown in the Figure 5. Optimization of α R(s) + Ke α Fuzzy Controlled Y(s) Ku Defuzzification Reasoning Object de/dt Kec 1-α Figure 5: Block diagram of fuzzy PID system with self-adjusting factor Factor ɑ is taken as the increased input of fuzzy controller, so the fuzzy control rules mentioned above need to be modified. The formula of its control rules is: 𝑈𝑈 = −[𝛼𝛼𝐸𝐸 + (1 − 𝛼𝛼)𝐸𝐸𝐸𝐸]𝐾𝐾𝑢𝑢 (11) where U is the output of the controller, E is the system deviation, EC is the deviation change rate, and 𝐾𝐾𝑢𝑢 is the scale factor. According to the above formula, the output U of the controller is determined by E and EC, and is used to determine the proportional relationship between the two. Because of the positive proportional relationship with E, when E increases, it also increases, then the role of E in the control signal is enhanced, and the controller is mainly used to eliminate E. When E decreases, the proportion of EC increases. In this case, the controller mainly eliminates EC. The optimization of the self-tuning factor is reflected in the scale factor. Since the value of the fuzzy controller directly affects the output of the controller, the importance is also reflected here. When the system is in a steady state, the increase of the error automatically increases, and the controller's role in suppressing the error is enhanced. Here, the theory domain of Alpha is taken as [0,1], the fuzzy subset is {VS (very small), S (small), M (medium), B (large), VB (very large)}, and the membership function is trapmf for the design of Alpha fuzzy rules. The tuning rules of the weighting factor are shown in Table 1. Table 1 Rules of 𝛼𝛼 α NB NM NS ZO PS PM PB NB B M S PM S M B NM B B M PS M B B NS VB B M PS M B VB ZO VB B B ZO B B VB PS VB B M NS M B VB PM B B M NM M B B PB B M S NM S M B 4. Experiments and result analysis 4.1. Simulation Construction This paper builds simulation models in Matlab/Simulink for verification. Figure 6: Fuzzy PID simulation diagram with self-tuning factor Among them, the structure for adding adaptive weights is shown in Figure 6. In the formulation of fuzzy rules, the membership function of fuzzy variable can be edited and the domain of variable, fuzzy set and the type of function are set. As shown in Figure 7. Figure 7: Membership function editor 4.2. Comparison of three control methods Figure 8 shows the comparison of control effects of single-loop PID control, cascade PID control and cascade fuzzy PID control with adjustment factors. When PID parameters are set the same (that is, control variables), compared with single-loop PID, the cascaded PID controller can improve the rapidity of the liquid level system and reduce the overshoot. The stepwise response curve of cascade PID with fuzzy controller is slower than that of the former, but its overshot attenuates greatly, and the time to stabilize at the given level is also greatly shortened. The figure 9 shows the system response curve before and after adding ɑ. It can be concluded by comparison that the control effect of the controller was further improved after adding the adjustment factor. Figure 8: Comparison of three control methods Figure 9: Comparison with and without ɑ Further, the dynamic performance indexes of the four curves were quantitatively calculated, as shown in the Table 2. Table 2 Three Scheme comparing Controller σ(%) 𝑡𝑡𝑡𝑡(s) 𝑡𝑡𝑡𝑡(s) 𝑡𝑡𝑡𝑡(s) Single-loop PID 18.3 826.34 391.22 241.27 Double-closed-loop PID 11.4 771.44 372.18 238.66 Fuzzy-cascade PID 5.1 467.25 406.27 291.54 Fuzzy-cascade PID with ɑ 3.2 418.35 427.14 314.56 where 𝜎𝜎 is the maximum overshoot,𝑡𝑡𝑡𝑡 represents setting time,𝑡𝑡𝑡𝑡 denotes peak time and 𝑡𝑡𝑡𝑡 represents rise time. As can be seen from the above table, tr of fuzzy cascade PID control is larger than the other two, which may be due to the fact that the fuzzy controller is connected to PID parameter tuning, which increases the delay and makes the system adjust slowly at the beginning. However, the performance is the best in both ts and tp, the response time is accelerated by nearly 400s, and the overshoot is greatly reduced. After adding ɑ modulation, the overshoot of the system is smaller and the adjustment time is faster, but the rise time and peak time are slightly increased. To sum up, the fuzzy cascade PID with adaptive factor proposed in this paper is feasible and has better stability and dynamic performance. 4.3. Anti-interference analysis In the 2000s, step signals with a value of 1 were added to the two controlled objects at the same time as disturbance to get the system's performance of fluctuations under three control strategies: basic cascade PID, fuzzy cascade control and self-adjusting scale factor fuzzy cascade control, as shown in Figure 10(a) and Figure 11(a). Then, when the system does not recover the given value, the sudden disturbance in the industrial process is simulated, the disturbance is given again, and the response is observed as shown in Figure 10(b) and Figure 11(b). (a) one disturbance (b) two disturbance Figure 10: Comparison of adding disturbance (a) one disturbance (b) two disturbance Figure 11: Anti-disturbance performance with and without ɑ It can be seen intuitively from the above Figure 8 and Figure 9 that the control structure of fuzzy cascade PID has better interference suppression effect than basic and cascade PID, and the time required to recover the given value is shorter and the fluctuation is smaller. The performance of the simplest single-loop PID decreases significantly after multiple disturbances, and even has the risk of failing to recover. As shown in the Figure 10 and Figure 11, after adding the self-adjusting scaling factor, the response to interference is basically no difference, but the response speed of the system is further improved. This has a greater effect on the control of water level in industrial production, and when the disturbance comes, the system can respond quickly with a small overshoot and return to the given control level. 5. Conclusion The model of dual tank is widely used in process industry, but its characteristics of large delay and nonlinear make the traditional PID control lack of accuracy in the identification of control parameters, and cannot meet the needs of some precision control occasions. Fuzzy control can be adapted to large nonlinear systems by converting human subjective control strategy into digital signal for given control. Therefore, in this paper, in the case of fuzzy PID controller based on cascade structure, the adaptive scale factor is added to adjust the quantization factor of the fuzzy controller in real time to make the control more accurate and faster. Finally, from the results of the simulation, it can be found that the scheme has a better control effect on the control of the liquid level of the dual tank, both in terms of the dynamic performance of the system and the auto-disturbance rejection ability of the system. References [1] Y. Jin, “Process Control,” Tsinghua University Press, 2006. [2] Q. Huang, Y. Cheng, S. Pan, “Research on model-free adaptive control method for double tank level system,” Machinery Design & Manufacture, pp. 205-207, 2015. [3] Y. Dou, “Research on control method of two-capacity liquid level system based on Matlab,” Electronic Manufacturing, pp. 18-19, 2002. [4] S. Song, K. Chen, Huawei, Zhang, “Optimization simulation of PID parameters of two- capacity water tank based on APSO Algorithm,” Computer Simulation, pp. 261-265, 2018. [5] Y. Ji, Z. Zhang, “Design of liquid level control system of double tank based on Fuzzy PID,” Journal of Shanxi Normal University (Natural Science Edition), pp. 37-40, 2019. [6] Y. Sun, Q. Heng, “Simulation of two-capacity water tank level control system based on DCS,” Computer Simulation, pp. 219-223, 2020. [7] Z. Li, “Research on fuzzy controller based on self-tuning factor optimization,” Journal of Shanxi Datong University (Natural Science Edition), pp. 15-16+35, 2021.