Firstly, this paper analyses the conventional digital PID controller. Aiming at the problem that the parameters of the conventional PID controller can’t take into account the dynamic, static and coordinative characteristics, we add a fuzzy controller, which fuzzifies the error and error rate of the control variables and makes logical decisions. Through the fuzzy reasoning algorithm and the fuzzification-gravity center method, we can solve the problem. Finally, on-line control of three input parameters (ki, kp, kd) is realized. It is concluded that the on-line parameter self-tuning ability of the fuzzy digital PID controller is strong, and it is effective to suppress disturbance and noise.
It can improve the static and dynamic performance of the control system and has strong adaptive ability. The principle of PID controller based on fuzzy control is discussed. The algorithm is applied to water level control in automatic control principle to achieve more accurate water level control. Through the simulation of SIMLINK in MATLAB and the application of fuzzy control digital PID control algorithm, the abstracted water level simulation control is realized. Generally, the relationship between output U (t) and input e (t) of the PID controller can be seen in formula (3), where kP is proportional gain, ki is integral gain and KP is differential gain. The relationship between error E and error rate EC and three parameters kp, Ki and KD of PID controller can be concluded through operator’s experience and theoretical analysis.
Based on the qualitative relationship between input error E and error change rate EC and three parameters ki, kp, kd, and combined with the technical knowledge and practical operation experience of Engineering designers, a suitable fuzzy rule table is established. By using (2) the corresponding fuzzy rule tables of three parameters kp, thermostatic element Ki and KD are obtained. Converting the table of fuzzy rules into a linguistic form of fuzzy rules is written as conditional sentences. As long as the table is described by language and coexisted with a single chip computer, the corresponding output can be obtained by calling the program when it is used. Real-time control can be realized without reasoning in the control process. Run the Fuzzy function in the command window of MATLAB to enter the fuzzy logic editor, and establish a new FIS file. Select the type of controller Mamdani.
According to the above analysis, input the membership functions and quantization intervals of E, EC, KP, KI, KD respectively, and get the membership function graph [5]. Open the Ruler Editor window to if… The form of the input fuzzy control rules is min; Or method is max; Implication is min; Aggregation is max; Defuzzification is centroid. This creates a FIS file named Fuzzypid.fis. In MATLAB’s M file editor, a file named fpid. m is created, which contains: martrix = readfis (‘Fuzzypid. fis’); thus the link between the fuzzy toolbox and SIMULINK is completed, which lays the foundation for the establishment of the whole system. Through the above method model, the common water level control problems in automatic control are simulated, and the water level of water tank is controlled by using fuzzy controller.
Assuming that the tank has an inlet and an outlet, the inflow amount (i.e. water level height) can be controlled by controlling a valve, but the outflow speed depends on the radius (fixed value) of the outlet and the pressure at the bottom of the tank (varying with the water level height in the tank). The system has many nonlinear characteristics.
The goal of our design is to design a suitable controller for the intake valve, which can control the intake valve according to the real-time measurement results of the water level of the tank, so that the water level can meet the specific requirements (i.e. the specific input signal). Generally, the controller takes the deviation of water level (the difference between ideal water level and actual water level) and the change rate of water level as input, and the output control result is the speed at which the intake valve opens or closes [4]. In the module browse area on the left of Simulink editing window, we can see that the water tank simulation system includes water tank model, valve model and PID control sub-model. Click on them directly in the browse area or right-click them, and select [look under mask] in the pop-up menu, you can see the details of the structure of these modules, directly using the fuzzy reasoning system set before, and modify it on the basis of it. Here we adopt the set membership function definition which is exactly the same as the fuzzy set of input and output variables in tank. Fis. We only make some changes to the fuzzy rules to learn the combination of the fuzzy toolbox and the simulation tool. This is equivalent to a new fuzzy reasoning system which reduces two fuzzy rules from the original fuzzy system model. After the modification is completed, the simulation is carried out and the oscilloscope module is observed. The water level change of the system can be obtained, as shown in Figure 1. As can be seen from the above figure, the dynamic characteristics of the system have been greatly improved after adding the fuzzy control rules, which not only has a short response time, but also has a small overshoot. According to the above-mentioned fuzzy control algorithm, the detailed structure of the final module implementation is determined in simlink, as shown in Figure 3.
Finally, in Matlab, an S function “animtank. m” is used to realize the simulation animation window of the water tank model. The program code is shown in Appendix 3. From the animation, we can observe the actual system water level changes with the required water level signal, and real-time change of the input signal has reached the effect of water level control.