Introduction

A fuzzy control refers to a system that simulates the uncertainty concept of human brain judgment and thinking mode to solve the unknown or uncertainty problems (Arikan and Gungor 2007). A fuzzy control system refers to using fuzzy sets and fuzzy rules to deal with the controlled objects which have strong nonlinearity and time lag, to express the transitional boundary or qualitative knowledge, to carry out fuzzy comprehensive judgment, and to deduce the fuzzy information problems which is difficult to solve by conventional methods (Shi and Hao 2015).

According to the input and output relationship, a control system can be classified as a linear system (such as linear regression model and variance analysis model) or nonlinear system (such as Korteweg–de Vries model). Both linear and nonlinear systems are required to set up mathematical models which could reflect the characteristics of the system. Unfortunately, a control system is a very complex multivariate system that is difficult to express by using mathematical models.

The common sewage treatment control systems for removing total phosphates (TP) and suspended pollutants (SS) can be classified as simple feedback control system, neural network control system, fuzzy control and expert control system, etc. A simple feedback control system generally consists of turbidity detectors, water turbidity checking system and discharged turbidity target control devices. In order to achieve a predetermined feedback control objective, a control system must be defined and the feedback control should be carried out based on coagulation and filtration processes.

Compared with the traditional controller, a fuzzy control system does not need to establish an accurate mathematical model for the controlled system, but it only needs to accumulate the operation experience of the controlled system or the relevant data which can be solved by establishing the fuzzy model (Verbist et al. 2009). Fuzzy control method is an important part of a smart control system (Lee et al. 2010; Razmkhah et al. 2010).

A PLC (programmable logic controller) has the advantages of high reliability, flexible programming and low failure rate and is widely used in the current control industry (Nikoo et al. 2014; OMID et al. 2014). With the increasing complexity of controlled system, the traditional PLC control system cannot meet the complex control requirements (Rao 2016; APHA American Public Health Association 2005); hence, it is a very important research topic to introduce fuzzy control technology into the PLC control system.

A lot of scholars have studied fuzzy control in sewage treatment system (Simeonov et al. 2003; Tyagi et al. 2013). Huang Chao et al. studied dual fuzzy control system for dissolved oxygen in industrial sewage treatment. Based on the parameter of DO (dissolved oxygen), a dual fuzzy controller was proposed (Chao et al. 2019). Shengyi et al. studied fuzzy PID control in MATLAB for two-phase hybrid stepping motor (Shengyi and Wang 2013), in which the mathematical model of the two-phase hybrid stepping motor and the structure of fuzzy PID controller are established. Zhang et al. applied fuzzy control in sewage treatment system according to the features of the complexity of modern sewage treatment system and the difficulty of establishing an accurate mathematical model (Zhang and Song 2013). A fuzzy control method applied to the system with PLC is established and realized. Stefano and Marsili-Libelli studied fuzzy predictive control for nitrogen removal in biological wastewater treatment (Marsili-Libelli 2002). A fuzzy predictive controller was proposed in the paper, and its performance was tested through numerical simulations.

Considering the studied results mentioned above, most of the methods usually suffer from an important limitation and can only be used when the source sewage quality has little variation. It has high requirements for stable flow control, and the methods are limited within expert experience and data accumulation (Molden et al. 2020).

Therefore, facing complex and uncertainty problems and in order to overcome the disadvantages in the present findings, this paper firstly uses MATLAB (Mukate et al. 2019) to put forward fuzzy control rules and then transfer the data to a PLC. With the advantage of MATLAB simulation system in solving complex operation and the characteristics of PLC control system, a fuzzy control system using fuzzy control algorithm is designed for phosphate sewage water treatment.

The studied methods in this paper could compensate for certain disadvantages in the current control systems by using the super-adaptable ability. An additional computational model was proposed to realize precise input of flocculant (aluminum polychloride [Al2(OH)nCl6-n]m, PAC) and coagulant aid (polyacrylamide, PAM) dosage. The studied method in this paper can play its own advantages both in automatic control and in process selection. An important reason is that the fuzzy control system in this paper takes fuzzy mathematical knowledge as precondition, which uses language variables to express control experience and knowledge, and then applies these rules to complete system control. Such a fuzzy control system can also be applied in complex nonlinear systems. It is reasonable that a fuzzy control system integrates the advantages of neural network and expert system control, which is more suitable for the precise control of PAC and PAM input dosage in sewage treatment system.

Therefore, the main objectives of the paper are as follows: ① to realize precise input of PAC and PAM, ② to reach wastewater discharged standard, ③ to propose a new method combining fuzzy control technology with wastewater treatment control system, and ④ to realize high-efficient treatment for phosphate sewage. It is an innovation to use a fuzzy control model which does not need a precise mathematical model to realize the automatic control for sewage water treatment systems.

Materials and methods

Composition and function of the system

The purpose of the phosphate sewage water treatment control system is to realize automatic treatment for phosphate wastewater and domestic wastewater (Choi and Lee 2013; Eze et al. 2018), including intelligent control system and different treatment units. With such a treatment system, the phosphate in wastewater can be degraded by inputting PAC and PAM into wastewater to meet the discharged standard. The composition of phosphate wastewater treatment control system is shown in Fig. 1.

Fig. 1
figure 1

Composition of phosphate sewage treatment control system

The treatment system consists of a control cabinet, different kinds of pipes, solenoid valve, electric valve, total phosphates (TP) and suspended pollutants (SS) monitor, integrated filter, various pumps, etc. In the system, a centrifugal pump extracts wastewater into the treatment system with unchanged volume. Since the sewage water flow is constant, the dosage of PAC and PAM is mainly determined according to TP and SS in sewage water. The sewage treatment process is as follows.

There is a Barschel metering canal to monitor TP and SS value. Sewage water flows into the reactor pond and configures the solution according to a certain proportion in the PAC/PAM solution barrel. The solenoid valve is opened, and the frequency converter is controlled by the PLC according to the total phosphates and SS value in the sewage water, and the PAC/PAM solution is driven into the reaction tank. The PAC and PAM solution can be adjusted by fuzzy control, so that the phosphates in sewage water can be fully degraded. After the sewage water fully reacts with the reaction liquid, it enters the flocculation tank and then self-flows into the primary and secondary depositing tanks. In the secondary depositing tank, the sewage water is pumped into the filter by a lifting pump. The filtered water flows into the clean water tank. Then, the TP and SS values were measured again; if they meet the emission standard, it could be discharged outside.

Fuzzy control system for phosphate wastewater treatment

Because the content of phosphates in sewage water is related to the sewage quantity, season and weather, the phosphates removal process has the features of nonlinearity, time-varying and time lag (Ramsay and Pullammanappallil 2001); therefore, it is impossible to establish an accurate mathematical model. However, the PLC is sensitive to the variation of parameters and has great limitations on the improvement in the sewage water treatment control effect (Scherholz and Curtis 2013). Fuzzy control system is to simulate the actual experience of human beings, without the need of an accurate mathematical model, and the control performance is not sensitive to the variation of the parameters. Therefore, combining fuzzy control technology with PLC control system can improve the reliability and stability of phosphate wastewater treatment system and save the PAC/PAM usage in the phosphates removal process.

Fuzzy control principle

Fuzzy automatic control is a kind of computer digital control system based on fuzzy set theory, fuzzy language variables and fuzzy logic reasoning. It does not depend on the accurate mathematical model of the control system, but depends on the operator’s site experience and knowledge to be converted into “fuzzy rules.” Usually, a fuzzy controller consists of control rule database, fuzzy input, fuzzy inference algorithm and output clarity (Mai et al. 2018). Figure 2 shows the composition of the fuzzy control model.

Fig. 2
figure 2

Fuzzy control model

The quality of constructing a fuzzy control system mainly lies in the design of a fuzzy controller (Chao et al. 2019). The performance of a fuzzy controller is determined by fuzzy rules, fuzzy inference algorithm, fuzzy decision, etc.

Realization of fuzzy control

Usually, fuzzy controllers can be classified as simple single input and output, dual input–single output, multi-input and single output, multi-input and multi-output complex control systems. The control system in this paper was designed as a multi-input and multi-output fuzzy controller.

The main purpose of the phosphate wastewater treatment control system is to ensure the proper dosage of PAC and PAM in the phosphates removal process. First, the content of TP and SS in sewage is detected. Then, the frequency of the output converter is controlled by the fuzzy controller, and the metering pump is driven to realize the precise input of the two kinds of medicament (PAC, PAM) to ensure the best sewage water treatment. The TP and SS are detected by the total phosphates online monitor and SS detector, respectively. The system structure of the fuzzy controller for this system is shown in Fig. 3.

Fig. 3
figure 3

Fuzzy control system structure

According to the real-time TP and SS contents monitored in sewage water, the output frequency of the converter is compared with the initial setting values, so as to realize real-time control. In Fig. 3, e is the input deviation of total phosphates, ∆e is the variation rate of input deviation of the total phosphates, Ke is the input deviation quantization factor of the total phosphates, h is the input deviation of the SS, ∆h is the SS input deviation variation rate, and K∆h is the SS input deviation quantization factor. Through comparison and adjustment, the output frequency of PAC and PAM could be determined.

Quantification of inputs and outputs

According to the actual situation, the fuzzy domain of variables is determined. There are four input variables, i.e., TP input deviation rate e, TP input deviation variation ∆e, SS input deviation h and SS input deviation variation rate ∆h. There are two outputs, i.e., the PAC output inverter U1 and the PAM output inverter U2. The TP and SS input deviation could be classified by using seven fuzzy subsets, i.e., negative values high (NB), negative values medium (NM), negative values low (NS), moderate values (ZE), positive values small (PS), positive values medium (PM) and positive values high (PB). The discrete domain after corresponding quantization is {− 3, − 2, − 1, 0, 1, 2, 3}. The TP input deviation variation rate ∆e and the SS input deviation variation rate ∆h can also classified by using seven fuzzy subsets, that is, negative values large (NB), negative values medium (NM), negative values low (NS), moderate values (ZE), positive values small (PS), positive values medium (PM) and positive values large (PB). The discrete domain after corresponding quantization is {− 3, − 2, − 1, 0, 1, 2, 3}. The output frequency fuzzy subsets U1, U2 from two inverters can be classified as moderate (ZE), positive small (PS), positive medium (PM) and positive large (PB), which can be classified by using four fuzzy subsets. The discrete domain after corresponding quantization is {0, 1, 2, 3}.

According to the sewage treatment plant records in recent years and the experience analysis, it can be concluded that the range of total sewage phosphates is [0–10] mg/l, the initial given value is 5 mg/l, then the input deviation e of the total phosphates is [− 5, 5] mg/l, the basic domain of variation rate ∆e of the input deviation of total phosphates is [− 0.2, 0.2], the domain of SS is [0–1000] mg/l, the initial given value is 500 mg/l, and then the physical domain of the input deviation e of SS is [− 500, 500] mg/l. The basic domain of the variation rate ∆h of input deviation of SS is [− 1, 1]. The fuzzy domain of four input variables is [− 3, 3], the physical domain of two output inverters is [0,50]Hz, the fuzzy domain is [0, 3], and then the quantization factors are Ke = 3/5 = 0.6, K∆e = 3/0.2 = 15, Kh = 3/500 = 0.006 and K∆h = 3/1 = 3, respectively.

A proportional factor of output value U1 and U2 is \({K}_{\mathrm{U}1}=\frac{50}{3}\) \({K}_{\mathrm{U}2}=\frac{50}{3}\).

Determination of fuzzy rules

According to the requirement, a trigonometric function was selected for the membership function of the fuzzy subset. When e is positive large (PB), the relevant PAC solution output frequency U1 is moderate (ZE). When e is moderate (ZE), the total phosphates input value deviation variation rate ∆e is used to control the PAC solution output frequency. If ∆e is positive, there exists an increasing trend; therefore, PAC solution output frequency U1 takes a positive median (PM). When ∆e is negative, it shows that there is a decreasing trend, so the output frequency of the PAC solution U1 takes positive small (PS). Similarly, the fuzzy relationship among the input deviation h of SS, the deviation variation rate ∆h and the output frequency U2 of PAM solution can be obtained. When h is positive large (PB), the output frequency of the corresponding PAM solution U2 is moderate (ZE). When the h is moderate (ZE), the output frequency of PAM solution can be controlled by the deviation variation rate (∆e) of total phosphates input volume. When the ∆h is positive, it shows that there is an increasing trend, so that the output frequency (U2) of PAM solution takes a positive median (PM). When the ∆h is negative, it shows that there is a decreasing trend, so that the output frequency (U2) of the PAM solution takes positive small (PS).

Fuzzy control rules should be described using human experience. For example, if total phosphates input deviation is NB and total phosphates input deviation variation rate is NB, SS input deviation is NB and SS input deviation variation rate is NB, then PAC solution output frequency is NS and PAM solution output frequency is NS. The meaning of this fuzzy rule statement is that if the input deviation and the input deviation variation rate of the TP are minimal, and the SS input deviation and the input deviation variation rate are minimal, then PAC solution output frequency and PAM solution output frequency are moderate.

According to the characteristics of fuzzy control system and statement rules, the corresponding control rules can be obtained, as shown in Tables 1 and 2.

Table 1 PAC inverter output control rules
Table 2 PAM inverter output control rules

Design of fuzzy controller

Based on the FIS (fuzzy inference system) in MATLAB 2.0, the membership function rules can be compiled, as shown in Figs. 4 and 5. From the characteristic surface in the FIS, we can directly see the relation between input and output signal, as shown in Figs. 6 and 7.

Fig. 4
figure 4

Membership function of TP deviation, TP deviation variation rate, SS deviation, SS deviation variation rate

Fig. 5
figure 5

PAC inverter and PAM inverter membership function

Fig. 6
figure 6

PAC solution inverter’s output characteristic surface

Fig. 7
figure 7

Output characteristic surface of the PAM solution

TP and SS regulation process

PAC, chemical formula [Al2 (OH) nCl6-n], is an inorganic polymer coagulant. The purpose of phosphates removal is to remove PO43− ions from wastewater, in which Al3+ ions in PAC agents could react with PO43– to form AlPO4↓ and deposit down. The deposition materials could become sludge and then be treated. PAC chemical equation of phosphates removal is as follows:

$$ {\text{Al}}^{{3^{ + } }} + {\text{H}}_{n} {\text{PO}}_{4}^{{(3 - n)^{ - } }} = {\text{AlPO}}_{4} \downarrow + n{\text{H}}^{ + } $$
(1)

in which the molar mass ratio (K) of Al3+ ion (\({T}_{\mathrm{Al}}\)) to P5+ ion (\({T}_{\mathrm{p}}\)) in sewage water is

$$ K = T_{{{\text{Al}}}} /T_{{\text{P}}} \approx 0.87, $$
(2)

that is, 0.87 mol aluminum can consume 1 mol of phosphates. The PAC inputting process can be considered as a chemical reaction equation, in which the output total phosphates Pout should be controlled below 0.2 mg/l according to the operation rules. (The defined water discharged standard is 0.2 mg/l or less.) The total phosphates content discharged is equal to the total phosphates content of sewage influent minus the amount of reaction after inputting PAC medicament; the mathematical model is as follows:

$$ P_{{{\text{out}}}} q_{{\text{s}}} = P_{{{\text{in}}}} q_{{\text{c}}} - 0.87q_{{\text{j}}} N $$
(3)

where Pout is the total phosphates output value, mg/l; Pin is the input value of the total phosphates in sewage water, mg/l; qs is the instantaneous outflow, l/s; qc is the instantaneous inflow, l/s; qj is the instantaneous flow of PAC solution, l/s; and N is the concentration of PAC medicament, g/m3. During the process of regulation, the frequency of converter is regulated based on fuzzy control principle, and the output flow of PAC solution is adjusted to make the discharged sewage reach the prescribed standard; the relationship between frequency and output flow is as follows:

$$ n = 60f/p. $$
(4)

Formula (4) is the relation between the working frequency and the working speed of the motor, in which n is the motor speed, r/min; f is the working frequency of the motor, Hz; p is preferable to the extreme logarithm of the motor, which could be taken as 1.

$$ q_{{\text{j}}} = V \times n \times \eta v. $$
(5)

Formula (5) is the relationship between the actual speed and the actual flow rate of the pump, in which qj is the pump actual outflow, l/s; V is the pump discharge volume, l/r; n is the actual pump speed, r/min; and ηv is the pump capacity efficiency.

The combination of the above formulas provides the following TP regulation formula:

$$ p_{{{\text{out}}}} q_{{\text{s}}} = p_{{{\text{in}}}} q_{{\text{c}}} - 0.87V \times 60f/p \times \eta vN. $$
(6)

According to the actual pump, ηv is taken as 0.98.

There is no accurate mathematical model for the adjustment process of SS (suspended pollutants). When the SS value in the sewage inflow becomes larger, the output frequency value of PAM solution is adjusted accordingly.

Results analysis and discussion

Simulation analysis

In order to verify the performance and practicability of the designed fuzzy controller, the PAC solution output system is simulated and analyzed according to the mathematical model (6). For the fuzzy control system constructed in this paper, the concentration (N) of PAC is 5%; the total phosphates (TP) of sewage water inflow is 4.6 mg/l; the instantaneous inflow of sewage water is 45 l/s; and qs is the instantaneous outflow, 45 l/s. According to the discharge requirement, the total phosphates outflow (Pout) is 0.2 mg/l. The experiment was carried out in Zhengzhou Shiyuan wastewater treatment plant in July 2020. The reagents (PAC, PAM) used in the experiment are produced in Henan Chengjie Water Purification Plant.

According to the PAC inflow process, the transfer function is a higher-order transfer function with delay link. After simplification, the following can be obtained:

$$ G(S) = \frac{{ - 0.11e^{ - 3s} }}{{({13}{\text{.8}}s + 1)^{5} }} $$
(7)

Based on the MATLAB 2.0 and Simulink model (Shi and Hao 2015), the fuzzy control system in this paper can be modeled and simulated, as shown in Figs. 8 and 9.

Fig. 8
figure 8

Fuzzy control model

Fig. 9
figure 9

Unit step response curve of fuzzy control model

Experiment verification

A fuzzy control model designed in this paper is input into the PLC control system. According to operation and regulation, through experiments, the diagram of sewage water inflow and outflow can be constructed as Figs. 10 and 11.

Fig. 10
figure 10

Comparison of SS (suspended matter) value before and after

Fig. 11
figure 11

Comparison of TP value before and after

It can be seen from Figs. 10 and 11 that variation amplitude of inflow TP and SS is large, whereas the TP and SS in the outflow are below 0.2 mg/l, 50 mg/l, respectively, which reaches the discharged standard, and the TP and SS in the outflow are stable and all below the relevant standard. Compared with the condition of no fuzzy control model, the dosage of PAC and PAM is reduced by about 1/3.

It can be seen from the fuzzy simulation control models (Formula 3, Formula 7 and Figs. 8 and 9) that the unit step response regulation is small, the control process has no oscillation phenomenon, and the state of stability is maintained.

Compared with the relevant studies, it could be found that the studied methods in this paper could compensate for certain disadvantages for the control system by using the super-adaptable ability. An additional computational model was proposed to realize precise input of flocculant (PAC) and coagulant aid (PAM). The studied method in this paper can play its own advantages both in automatic control and in process selection. A fuzzy control system takes fuzzy mathematical knowledge as precondition, which uses language variables to express control experience and knowledge and then uses these rules to complete system control, which can also be applied in complex nonlinear systems. It is reasonable that a fuzzy control system can be integrated into neural network control and expert system control to realize the precise control of PAC and PAM input in sewage phosphorus removal.

Conclusions

The automatic control system for phosphate sewage treatment can degrade the phosphate content in sewage by adding chemicals, so that TP and SS value in the sewage can reach the discharge standard. Aiming at the nonlinear, time-varying and hysteresis characteristics of the phosphorus removal process of phosphate sewage, in this paper, an application research method combining fuzzy control technology with PLC control system was proposed and an automatic control system suitable for phosphorus removal of phosphate wastewater was established. Through analysis on past data and experience, the membership function and fuzzy rules were set up. The field test shows that the control system has good stability and efficient utilization of phosphorus removal agents. The studied results show that the application of fuzzy control technology into phosphorus removal control system can achieve stable, accurate and efficient wastewater treatment.

Compared with the traditional PLC control model, which is sensitive to parameter variation and unstable, the fuzzy control model designed in this paper can make the whole control system more stable, less regulation and faster time response.

Based on the combination of PLC and fuzzy control, it is concluded from site experiment that the stability of the control system could be improved by adding a fuzzy control method. It can meet the requirements of phosphates removal in phosphate wastewater treatment, save the sewage treatment agents and make the whole system more economical. The results show that it is feasible and effective to apply fuzzy control technology into phosphates removal control system to realize desirable phosphate wastewater treatment.