PLC-based fuzzy control system for oilfield wastewater treatment
2026-04-06 05:31:47··#1
[Abstract] Addressing the complexity and difficulty in establishing accurate mathematical models for oilfield wastewater treatment systems, a method and implementation of fuzzy control using a PLC are proposed. Results show that the system based on this method has strong anti-interference capability, is simple to implement, and achieves good regulation quality. [Keywords] Fuzzy control; PLC; wastewater treatment 1 Introduction In industrial process control, PID control is suitable for deterministic control systems where mathematical models can be established. However, many nonlinear or time-varying uncertain systems exist in actual industrial process control systems, making parameter tuning of the PID controller cumbersome and the control effect unsatisfactory. In recent years, with the development of intelligent control technology, many new control methods have emerged, among which fuzzy control is one. Fuzzy control does not require a precise mathematical model of the controlled object, but rather determines the magnitude of the control quantity based on control rules. This control method has good control effects for systems with lag or random disturbances. PLCs have high reliability, strong anti-interference capability, and can easily implement fuzzy controllers in software. Therefore, using a PLC to construct a fuzzy controller for oilfield wastewater treatment is a new attempt, which not only makes the control system more reliable but also achieves better control results. 2. Introduction to Wastewater Treatment Process Currently, many oilfields in China are in the secondary oil recovery period, i.e., the water injection production period, and the extracted oil contains a large amount of wastewater. The purpose of oilfield wastewater treatment is to reinject the treated water into the formation to replenish and balance the formation pressure, prevent corrosion of the injection pipes and oil pipes by the injected water and returned water, and avoid scaling of the injection pipes, oil pipes, and formation by the injected water. The treatment method uses three agents: A, B, and C. Agent A is a pH adjuster, agent B is a flocculant, and agent C is a scale inhibitor. The process flow is shown in Figure 2-1. According to the process requirements, the key is to add agent A to the wastewater in the mixing tank to increase the pH value of the wastewater (i.e., control the pH to 2) to reduce corrosion. Adding agent B can accelerate the sedimentation of flocculent matter in the wastewater. Adding agent C can slow down scaling of the wastewater in the injection pipes and oil pipes. This system is a nonlinear system with a large time lag, and it is difficult to obtain an accurate mathematical model of the object. The effect of using PID feedback control is not ideal, and the oilfield joint stations are located in remote areas with harsh environments. Therefore, the sewage treatment system adopts PLC-based fuzzy control to improve the control accuracy and reliability of the system, thereby meeting the process requirements. 3 Fuzzy Control Principle The control system adopts a "dual-input single-output" fuzzy controller [1]. The input is the deviation e between the given pH value and the measured value and the deviation change rate ec, and the output is the input control voltage u of the frequency converter that supplies power to the dosing pump. Figure 3-1 is a block diagram of the fuzzy control system [2]. The control process is that the controller samples the pH value and the pH change rate at regular intervals and compares them with the given value to obtain the pH value deviation e and the deviation change rate ec, and uses this as the input variable of the PLC controller. The output of the fuzzy controller controls the output frequency n of the frequency converter, thereby changing the dosing amount to keep the pH value stable. The fuzzy controller includes three parts: input fuzzification, fuzzy inference and defuzzification. E and Ec are the fuzzy quantities after e and ec are fuzzified, respectively, U is the fuzzy control quantity, and u is the precise quantity after U is defuzzified. 3.1 Input Fuzzification In the design of the fuzzy controller, let the vocabulary of E be [NB, NM, NS, N0, P0, PS, PM, PB] [3], and the universe of discourse be [-6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6]; the vocabulary of Ec and U are [NB, NS, NM, 0, PS, PM, PB], and the universe of discourse is [-6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6]. Let -1), pH0 represent the desired value. Then, e, ec, and u are fuzzified, and the fuzzification quantization table of variables E, Ec, and U can be obtained based on the experience of pH value control. Table 3-1 is the assignment table of variable E. 3.2 Fuzzy Decision and Fuzzy Control Rules Summarize the experience of pH value control in the sewage treatment process and obtain the control rules, as shown in Table 3-2. The principle for selecting control variable changes is: when the error is large or relatively large, the control variable should be selected primarily to eliminate the error. When the error is small, the control variable should be selected with caution to prevent overshoot, prioritizing system stability. For example, when the pH value is much lower and there is a further rapid downward trend, the dosage of the reagent should be increased. This rule can be implemented using fuzzy statements (IFE = NB AND Ec = NB THEN U = PB). When the error is large and the error change is large or moderate, the control variable should not be increased further; the change in the control variable should be set to 0 to avoid overshoot. There are a total of 56 rules. The relationship Rk of each rule can be expressed as: 7) Based on the fuzzy relationship Rk (k = 1, 2, ..., 56) determined by each fuzzy statement, the total fuzzy relationship R of the entire system control rules can be obtained. 3.3 Output Defuzzification For each fuzzy condition statement determined by the fuzzy rule table, the corresponding fuzzy control quantity U is calculated. Based on the fuzzy inference synthesis rule, the following relationship can be obtained: The fuzzy control quantity is thus obtained, as shown in Table 3-3. Then, based on the maximum membership method, the actual control quantity u can be obtained. It is then converted to analog voltage via D/A converter to change the output frequency n of the frequency converter. The pH value is adjusted by controlling the dosage through the dosing pump, thereby completing the control task. 4. PLC Implementation of Fuzzy Control Algorithm The OMRON CQM1 PLC was selected in the control system. First, the quantization factor of the fuzzification process is placed into the holding relay of the PLC. Then, the input quantity is acquired by the A/D module to the DM area of the PLC. After amplitude limiting quantization processing, the fuzzy output quantity is obtained by looking up the fuzzy control quantity table according to the corresponding element in the corresponding input fuzzy domain. Multiplying this by the output quantization factor yields the actual output value, which is then output by the D/A module to control the pH value. 4.1 Fuzzy Control Algorithm Flow (1) Place the input deviation quantization factor Ke, the deviation change rate quantization factor Kec, and the output quantization factor Ku into HR10~HR12. (2) Sample and calculate e and ec, and place them into DM0000 and DM0001. (3) Determine whether e and ec exceed the limit. If they do, set them to the upper or lower limit values. Otherwise, quantize the input quantities into the corresponding elements E and Ec in the fuzzy domain of the input variables and place them into DM0002 and DM0003. (4) Look up the fuzzy control quantity table to obtain U. (5) Multiply U by the quantization factor Ku to obtain the actual control quantity u. (6) Output the control quantity u. (7) End. 4.2 Ladder Diagram Program Design for Table Lookup In the fuzzy control algorithm, the lookup of the fuzzy control quantity table is the key to the program design. To simplify the program design, the elements of the input fuzzy universe of discourse [-6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6] are transformed into [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]. The control results of U in the fuzzy control table are then sequentially placed into DM0100 to DM0268 in order from top to bottom and from left to right. The base address of the control quantity is 100, and its offset address is Ec × 13 + E. Therefore, the address of the control quantity can be obtained from E and Ec as 100 + Ec × 13 + E. The ladder diagram program is shown in Figure 4-1. DM0002 and DM0003 are the elements corresponding to E and Ec in the fuzzy universe of discourse, respectively, and MOV * DM0031DM1000 is an indirect addressing instruction. It uses the content of DM0031 (i.e., the control address 100 + Ec × 13 + E) as the address of the unit to be transmitted, and passes the content of the unit specified by this address (i.e., the control quantity U) to the intermediate unit DM1000. Then, it obtains u through defuzzification operation, and then transmits it to the D/A converter through the analog output channel. 5 Conclusion Combining fuzzy control with PLC and using PLC to realize fuzzy control not only retains the characteristics of PLC control system such as reliability, flexibility and strong adaptability, but also improves the intelligence level of control system. The results show that for control systems with large time delay, nonlinearity, difficulty in establishing mathematical models and low requirements for control accuracy and speed, the fuzzy control method based on PLC is a relatively ideal solution. As long as the appropriate sampling period and quantization factor are selected, the system can obtain better performance indicators, thereby meeting the control performance requirements. [References] [1] Feng Dongqing, Xie Songhe. Fuzzy Intelligent Control [M]. Beijing: Chemical Industry Press, 1998. [2] Cui Wei, Zhang Xiuwen. A Fuzzy Control Method Based on PLC [J]. Mechatronics, 2001(3): 22-24. [3] Wang Xianlu, Xie Yuan, et al. Application of fuzzy control in wastewater treatment [J]. Automation and Instrumentation, 2002(1): 29-31.