👨🎓 Personal Homepage
💥💥💞💞 Welcome to this blog ❤️❤️💥💥
🏆 Blogger’s Advantages: 🌞🌞🌞 The blog content aims to be logically clear and coherent for the convenience of readers.
⛳️ Motto: A journey of a hundred miles begins with a single step.
💥1 Overview
Fuzzy logic control is an intelligent logic control method composed of fuzzy set theory, fuzzy linguistic variables, and fuzzy control reasoning. With the rapid development of modern science and technology and industrial systems, the increasing uncertainty factors caused by external environmental influences make it difficult to establish precise mathematical models for structural objects. Even if a mathematical model can be established, the complexity of system analysis and control makes implementation challenging. In response, fuzzy control theory has emerged and has achieved many research results in recent decades. For example, Wang Zhiwei and others proposed a fuzzy control algorithm for structural vibration modes based on a backpropagation neural network to more reasonably and conveniently control the seismic dynamic response of civil engineering structures [1]; Yang Chaoya introduced fuzzy control algorithms and decentralized control strategies to address the need for precise models in multi-layer building models and the drawbacks of centralized control [2]; Wang Yong proposed a vibration fuzzy control algorithm based on PID control, achieving the goal of regulating and optimizing structural damping effects [3];
With the rapid development of the economy and the improvement of people’s living standards, the public’s demand for green living is increasing. A low-cost, highly reliable plant cultivation system can meet the planting needs of most people, and this cultivation method plays a certain role in household humidity maintenance, air regulation, and environmental greening [1]. A control system that combines the Internet of Things and control technology can accurately regulate the plant growth environment [2]. The controller in the control system receives data collected from sensors and sends commands to actuators based on intelligent control algorithms to control greenhouse environmental parameters without manual intervention, thus greatly reducing human error. Currently, there are many research results on intelligent control algorithms that can be referenced both domestically and internationally. Bao Yidong and others [3] proposed a software design method for a temperature and humidity intelligent control system, using the PID algorithm to solve the temperature and humidity objective function, but this method has many nonlinear behaviors and involves all parameters and factors. Fu Yipan and others [4] developed a greenhouse control system that combines fuzzy PID control with temperature models, achieving results with low error compared to real values. This method outperforms traditional PID systems and traditional fuzzy control systems, but it has low timing accuracy and poor anti-interference capability. Hu Xiangling and others [5] proposed a neural network PID control method that combines neural network self-learning algorithms with PID algorithms, showing significant control effects. It has advantages such as strong learning ability, fuzzy logic, short computation time, and small computation volume, but the neural network structure is complex and may produce uncertain results. The fuzzy logic method has a simple structure and fast computation time, making fuzzy logic controllers a good choice for controlling plant growth environments [6]. Designing a fuzzy logic controller requires experts to generate control rules and express membership functions.
Abstract
Water level control is a core link in industrial production, municipal engineering, and environmental monitoring, and its accuracy and stability directly affect system efficiency and safety. Traditional PID control relies on precise mathematical models, making it difficult to cope with nonlinear, time-varying, and strong interference scenarios. Fuzzy control simulates human experience to achieve intelligent decision-making, demonstrating significant advantages in scenarios such as chemical reaction kettles, high-rise water tanks, and agricultural irrigation. This paper systematically elaborates on the principles of fuzzy control algorithms, designs a dual-input single-output fuzzy controller based on the characteristics of water level control, and verifies its performance advantages through MATLAB simulation, achieving overshoot <5% and a 60% reduction in disturbance recovery time, while also proposing future development directions for adaptive fuzzy control and digital twin technology.
1. Water Level Control Technology Background and Challenges
1.1 Limitations of Traditional Control Methods
Traditional water level control often uses PID algorithms, whose performance highly depends on the precise mathematical model of the controlled object. However, actual systems face three core challenges:
Nonlinear characteristics: The shape of the container (e.g., the rising rate of water level in a conical water tank can differ by up to 3 times), the viscosity of the medium (wastewater containing impurities leads to nonlinear flow), and valve characteristics (the flow-opening degree relationship of a throttle valve is nonlinear) significantly affect the dynamic characteristics of the system.
Time delay effects: There is a pure delay of 1-3 seconds in the transmission of water level detection signals and valve action responses, leading to traditional PID control overshoot of 20%-30%, which can easily cause overflow or dry pump accidents.
Random interference: In industrial scenarios, fluctuations in feed flow to reaction kettles (±15%), peak water usage in residential scenarios (8:00-9:00 AM, 6:00-10:00 PM), and rainfall evaporation in agricultural scenarios cause PID control to require repeated parameter tuning, resulting in poor dynamic adaptability.
1.2 Technical Advantages of Fuzzy Control
Fuzzy control is based on Zadeh’s fuzzy set theory, achieving control of nonlinear systems through three steps: “fuzzification – rule reasoning – defuzzification.” Its core advantages include:
No need for precise modeling: Control rules are constructed directly using human operational experience (e.g., “if the water level deviation is large, open the valve wide”), adaptable to complex scenarios such as chemical reaction kettles and agricultural reservoirs.
Strong robustness: Fuzzy rules quickly respond to disturbances. In high-rise water tank level control, fuzzy control can predict water usage peaks in advance (e.g., when the deviation change rate is suddenly negative, the inflow valve is opened wide in advance), reducing the water level drop to within 15mm.
Engineering practicality: An 8-bit microcontroller can meet computational needs, and the rule base can be quickly adjusted based on on-site experience, making it suitable for industrial promotion.
2. Principles and Design of Fuzzy Control Algorithms
2.1 Structure of the Fuzzy Controller
A dual-input single-output fuzzy controller is designed, with input variables being water level deviation (e) and its rate of change (ec), and the output variable being the change in valve opening (Δu). The system structure is shown in Figure 1:
Water Level Sensor → Fuzzification → Rule Reasoning → Defuzzification → Actuator
e, ec Fuzzy Rule Base Δu Valve/Pump
2.2 Key Design Steps
(1) Fuzzification Design
Input variable domain: Map the actual ranges of e and ec to the standard domain [-6, 6], dividing it into 7 fuzzy sets (NB, NM, NS, ZE, PS, PM, PB).
Membership functions: Use a combination of triangular and Gaussian functions. For example, the PB set of e uses a Gaussian function to describe high-level deviation, while the NS set uses a triangular function to describe small deviations.
Output variable domain: Δu is mapped to [-4, 4], corresponding to continuous adjustments of valve opening from 0% to 100%.
(2) Fuzzy Rule Base Construction
Based on expert experience, 49 rules (7×7 combinations) are formulated. Typical rule examples include:
Rule 1: IF e=PB AND ec=PB THEN Δu=NB (water level is extremely high and rising rapidly, significantly close the valve)
Rule 25: IF e=ZE AND ec=ZE THEN Δu=ZE (water level is normal and stable, maintain current opening)
Rule 49: IF e=NB AND ec=NB THEN Δu=PB (water level is extremely low and falling rapidly, significantly open the valve)
(3) Defuzzification Method
The centroid method is used to calculate the geometric centroid of the output fuzzy set, with the formula:


Where μ(Δu) is the membership function, and this method outputs smooth and high-precision results.
3. Typical Application Scenarios and Engineering Implementation
3.1 Liquid Level Control in Chemical Reaction Kettles
Scenario Pain Points: The liquid level in the reaction kettle must be strictly controlled between 40%-60%. Fluctuations can lead to unstable reaction temperature/pressure, affecting product quality; feed flow fluctuates greatly, and the system has significant delays.Fuzzy Control Effects:
Dynamic Response: Overshoot <5%, avoiding drastic changes in liquid level; fuzzy-PID composite control achieves precision <1mm in small error stages, meeting process requirements.
Anti-Interference Capability: When feed flow fluctuates suddenly, fuzzy control predicts in advance through ec, reducing recovery time to 40% of traditional PID.
Economic Benefits: Product qualification rate increased from 88% to 99.2%, and overflow accident rate reduced to 0.1 times/year.
3.2 Water Level Control in High-Rise Residential Water Tanks
Scenario Pain Points: Peak water usage leads to rapid water level drop in the tank, and traditional PID control causes frequent pump starts and stops (30 times a day), affecting water supply stability.Fuzzy Control Optimization:
Predictive Adjustment: By judging water usage trends through ec, when ec suddenly becomes negative, the inflow valve is opened wide in advance, reducing the water level drop to within 15mm.
Equipment Protection: Pump start-stop frequency reduced to 8 times a day, extending lifespan by 2 years; household water pressure fluctuations reduced from ±0.1MPa to ±0.03MPa.
3.3 Water Level Control in Agricultural Irrigation Reservoirs
Scenario Pain Points: The water level in the reservoir is affected by multiple interferences such as rainfall (sudden rise), evaporation (gradual drop), and irrigation pumping (sudden drop), and the tanks are often irregularly shaped (nonlinear).Fuzzy Control Strategy:
Multi-Mode Switching: During the rainy season, the upper water level limit is automatically lowered (from 80% to 60%) to avoid overflow; during the dry season, the lower limit is raised (from 20% to 30%) to ensure irrigation needs.
Anti-Interference Design: The rule base incorporates logic to determine “if ec changes suddenly but e remains unchanged, it is considered sensor noise,” and does not adjust the valve opening.
Resource Efficiency: Overflow losses reduced by 90%, irrigation water utilization increased by 25%, and no manual monitoring adjustments are required.
4. Performance Comparison and Optimization Directions
4.1 Comparison of Fuzzy Control and Traditional PID
Indicators
Fuzzy Control
Traditional PID
Overshoot <5% 20%-30%
Anti-Interference Recovery Time Reduced by 60% Longer
Stability in Nonlinear Conditions High Prone to Instability
Steady-State Error <1.5mm (composite control) Depends on parameter tuning
4.2 Future Optimization Directions
Adaptive Fuzzy Control: Introduce BP neural networks to optimize membership functions and rule bases, achieving “online self-learning” to adapt to scenarios with drastic parameter changes, such as water level control in wastewater treatment plants with high-viscosity media.
Cooperative Control of Multi-Container Water Tanks: For series/parallel water tanks, research MIMO fuzzy control, combined with Industrial Internet of Things (IIoT) to achieve distributed cooperation (e.g., coordinated water level control in multiple sedimentation tanks at a water plant).
Digital Twin Debugging: Construct a digital twin model of the water level system to simulate extreme disturbances (e.g., equipment failures, heavy rain) in a virtual environment, optimizing fuzzy rules and parameters in advance to reduce on-site debugging time and costs.
5. Conclusion
The water level control system based on fuzzy control algorithms achieves intelligent decision-making in nonlinear and strong interference scenarios by simulating human experience, demonstrating significant advantages in chemical, civil, and agricultural fields. In the future, combining adaptive learning and digital twin technology will further expand its application boundaries in complex industrial systems, providing key technical support for efficient water resource utilization and production safety.
📚2 Operating Results








🎉3 References
Some theories are sourced from the internet; please contact for removal if there is any infringement.
[1] Xu Yuanlu, Zhang Xun. Research on Micro Plant Growth System Based on Fuzzy Control Algorithm [J]. Software Guide, 2023, 22(05): 97-102.
[2] Wei Fen, Wang Suqing, Deng Haiqin, Hao Wenjuan. Research on First-Level Inverted Pendulum Control Based on Fuzzy Control Algorithm [J]. Computer Simulation, 2023, 40(03): 320-325.
[3] Huang Qi, Zeng Chunping, Ma Kun, Liu Yanjun. Research on Seismic Reduction Effects Based on Fuzzy Control Algorithm [J]. Modern Electronic Technology, 2023, 46(08): 149-153. DOI:10.16652/j.issn.1004-373x.2023.08.026.
🌈4 MATLAB Code and Explanation
Reply in the public account backend: Program Download