A method and system for distributing chemicals in a sewage treatment pool

By combining the recycle neural network and empirical formulas, the hysteresis and nonlinearity of carbon source replenishment and flocculant addition in sewage treatment are solved, precise control of sewage treatment is achieved, and treatment efficiency and cost-effectiveness are improved.

CN118420063BActive Publication Date: 2024-11-05CHENGDU TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311262196.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2024-11-05
Estimated Expiration
2043-09-27

AI Technical Summary

Technical Problem

In the existing sewage treatment process, carbon source replenishment and flocculant addition have hysteresis, nonlinearity, and uncertain dosage, resulting in low efficiency and high cost, the inability to accurately control the dosage, and the inability to ensure that nitrogen removal and phosphorus removal meet the emission standards are met.

Method used

Using a dosing distribution method combined with recurrent neural network (RNN) and empirical formulas, the water quality index data, water volume and liquid level data of the SBR reaction pool are obtained, and the RNN neural network and empirical formulas are input to calculate the carbon source replenishment amount and flocculant required amount. , judge the dosage amount based on the difference value, and achieve accurate control of dosage.

Benefits of technology

It significantly improves the robustness of operation control, reduces waste of medicine, reduces operating costs, and ensures that sewage meets the standards after treatment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118420063B_ABST
    Figure CN118420063B_ABST
Patent Text Reader

Abstract

The present invention provides a dosing distribution method and system for a sewage treatment pool, belonging to the technical field of sewage treatment, comprising: obtaining water quality index data, water volume, water temperature and liquid level data of an SBR reaction pool; inputting the water quality index data, water volume, water temperature and liquid level data into a trained recurrent neural network RNN, and using the RNN neural network to output a carbon source supply amount and a flocculant requirement; at the same time, inputting the water quality index data, water volume, water temperature and liquid level data into an empirical formula, and using the empirical formula to calculate the carbon source supply amount and the flocculant requirement; if the C output by the RNN neural network is RNN and X RNN C calculated with the empirical formula JY and X JY If the difference between C and C is less than the threshold, flocculant and carbon source are added according to the average value of the two (C'+C) / 2; if C RNN and X RNN With C JY and X JY If the difference is greater than the threshold, add flocculant C according to the amount calculated by the empirical formula JY and carbon source X RNN This method can accurately and conveniently control the dosage and improve the robustness of the dosing system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of sewage treatment, and in particular relates to a drug dosing distribution method and system for a sewage treatment pool. Background Art

[0002] Sequencing batch activated sludge process (SBR) is widely used in sewage treatment plants. In the process of sewage treatment, the carbon source is often supplemented due to insufficient carbon source in the sewage and low efficiency of biochemical reaction treatment. At present, the carbon source is mostly replenished manually after the problem of insufficient carbon source is found, or the carbon source is replenished regularly and quantitatively by PLC. Both cannot accurately control the dosage and time of dosing, and often cause waste due to excessive dosage, increasing operating costs. On the other hand, the phosphorus content in domestic sewage or urban sewage is often relatively high. Relying solely on polyphosphate bacteria for phosphorus removal usually cannot meet the discharge standards. Flocculants need to be added to enhance the phosphorus removal efficiency. The flocculant replenishment process is also an important process to ensure that the sewage can meet the discharge standards after treatment. Chemical phosphorus removal is usually achieved by adding flocculants (generally prepared with a mass concentration of 0.1% to 0.5%) in the clarification sedimentation tank. The general flocculant is polyaluminum chloride (PAC) or polyacrylamide (PAM) to form phosphate precipitation, and then remove phosphorus in the water through mud and water separation. Therefore, how to accurately control the dosage to achieve efficient phosphorus removal efficiency while reducing operating costs is a problem that needs to be solved urgently.

[0003] In the current sewage treatment process, the carbon source replenishment and flocculant addition processes have the characteristics of hysteresis, nonlinearity, and dosage uncertainty. There is often a situation where too much or too little replenishment of the agent results in low efficiency and high cost, and it is impossible to always ensure that the discharge meets the standards after nitrogen and phosphorus removal.

[0004] Neural network computing control systems can effectively deal with problems such as hysteresis, nonlinearity, and uncertainty. In particular, the recurrent neural network (RNN) is a type of recurrent neural network that takes time series data as input, recursively in the direction of the evolution of the time series, and all nodes (recurrent units) are connected in a chain. The RNN neural network not only takes into account the changes in the temporal and spatial factors of the time series, but also can well adapt to the problems of hysteresis, nonlinearity, and dosage uncertainty in the sewage treatment process.

[0005] Through literature review and research, it was found that patent CN201911324558.4 discloses an intelligent dosing control system based on neural network; patent CN202210671221.6 discloses an intelligent dosing system, method and process based on artificial neural network.

[0006] However, existing methods are not robust enough. Summary of the invention

[0007] In order to overcome the above-mentioned deficiencies in the prior art, the present invention provides a method and system for dosing and distributing chemicals in a sewage treatment tank.

[0008] In order to achieve the above object, the present invention provides the following technical solutions:

[0009] A method and system for dispensing chemicals in a sewage treatment pool, comprising:

[0010] Obtain water quality index data, water volume, water temperature and liquid level data of the sequencing batch activated sludge process SBR reaction tank;

[0011] The water quality index data, water volume, water temperature and liquid level data are input into the trained RNN neural network, and the RNN neural network is used to output the carbon source supply amount C RNN And flocculant required amount X RNN ;

[0012] Input water quality index data, water volume, water temperature and liquid level data into the empirical formula, and use the empirical formula to calculate the carbon source supply C JY And flocculant required amount X JY ;

[0013] If the carbon source supply C output by the RNN neural network RNN And flocculant required amount X RNN Carbon source supply C calculated by empirical formula JY And flocculant required amount X JY If the difference is less than the threshold, the drug is added to the SBR reaction tank according to the value of (C'+C) / 2, where C' is the carbon source supply output by the RNN neural network C RNN Or flocculant requirement X RNN ; C is the carbon source supply calculated by the empirical formula C JY Or flocculant requirement X JY ;

[0014] If C RNN and X RNN With C JY and X JY If the difference is greater than the threshold, then the X calculated according to the empirical formula JY and C JY Add chemicals to the SBR reaction tank.

[0015] Further, the carbon source supply amount is calculated using an empirical formula, including:

[0016] Calculate whether carbon source needs to be replenished:

[0017] 0.8×COD / NH=n

[0018] Wherein, COD is the measured COD amount; NH is the measured ammonia nitrogen concentration; when n≥3, no carbon source replenishment is required; when n<3, the carbon source replenishment amount is calculated;

[0019] Carbon source supply = ρ × C = (3-n) × NH / 0.8 × COD

[0020] Wherein, ρ is the COD equivalent per unit volume of the carbon source stock solution, and C is the added volume of the carbon source.

[0021] Further, the flocculant replenishment amount is calculated using an empirical formula, including:

[0022] X=(V*S*C 0 ) / (c)

[0023] Where X is the amount of flocculant, in L; V is the volume of water, in L; S is the concentration of suspended solids or colloids, in mg / L; C 0 is the amount of flocculant required per unit mass of suspended solids, in mg / mg; c is the concentration of flocculant stock solution, in mg / L.

[0024] Furthermore, it also includes:

[0025] When the amount of added flocculant reaches the flocculant replenishment amount, stop adding flocculant;

[0026] When the flocculant reacts with the substances in the water and the precipitation is completed, test the turbidity value three times. If the turbidity value exceeds the discharge standard, continue to add flocculant, continue stirring for 10 to 30 minutes, and precipitate again until the turbidity value meets the discharge standard requirements.

[0027] Furthermore, it also includes:

[0028] When the amount of added carbon source reaches the carbon source replenishment amount, stop adding carbon source;

[0029] Detect and calculate the n value. If n≥3, the SBR reactor of the sequential batch activated sludge process starts aeration. If n<3, the carbon source is repeatedly supplied.

[0030] Furthermore, the water quality index data includes:

[0031] Sewage inlet turbidity, COD, ammonia nitrogen concentration, effluent COD, ammonia nitrogen NH concentration, turbidity.

[0032] Furthermore, it also includes:

[0033] After each dosing, the process parameters, water quality index data, water volume, water temperature and liquid level data after the water quality reaches the discharge standard will be used as database data;

[0034] When the water quality index, water volume, water temperature and liquid level of the next influent are the same as the corresponding data in the database, the saved process parameters are directly retrieved to add drugs to the SBR reaction tank.

[0035] A dosing and dispensing system for a sewage treatment pool, characterized by comprising:

[0036] Sensor module, used to obtain water quality index data, water volume, water temperature and liquid level data of SBR reaction tank;

[0037] The calculation unit module is used to input water quality index data, water volume, water temperature and liquid level data into the trained RNN neural network, and use the RNN neural network to output the carbon source supply C RNN And flocculant required amount X RNN ; Input water quality index data, water volume, water temperature and liquid level data into the empirical formula, and use the empirical formula to calculate the carbon source supply C JY And flocculant required amount X JY ;

[0038] The first dosing module is used to calculate the carbon source supply amount C output by the RNN neural network. RNN And flocculant required amount X RNN Carbon source supply C calculated by empirical formula JY And flocculant required amount X JY If the difference is less than the threshold, the drug is added to the SBR reaction tank according to the value of (C'+C) / 2, where C' is the carbon source supply output by the RNN neural network C RNN Or flocculant requirement X RNN ; C is the carbon source supply calculated by the empirical formula C JY Or flocculant requirement X JY ;

[0039] The second dosing module is used if C RNN and X RNN With C JY and X JY If the difference is greater than the threshold, then the X calculated according to the empirical formula JY and C JY Add chemicals to the SBR reaction tank.

[0040] Furthermore, the sensor module comprises:

[0041] Ammonia nitrogen sensor, used to detect the ammonia nitrogen content in sewage;

[0042] COD sensor, used to detect sewage COD data;

[0043] Activated sludge sensor, used to detect the sludge concentration in the SBR reaction tank;

[0044] Turbidity sensor, used to detect turbidity value;

[0045] Temperature sensor, used to detect the water temperature of the SBR reaction tank;

[0046] Liquid metering pump, used to measure the water volume in SBR reaction tank.

[0047] The invention provides a method and system for distributing chemicals in a sewage treatment pool, which has the following beneficial effects:

[0048] The present invention inputs the data obtained from the SBR reaction tank into the RNN neural network and the empirical formula, and obtains the dosage by comprehensively comparing the data output by the RNN neural network and the data calculated by the empirical formula. The two sets of calculation methods are used to perform comprehensive data analysis and judgment, which significantly improves the robustness of operation control compared with the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiment of the present invention and its design scheme, the following briefly introduces the drawings required for this embodiment. The drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0050] Figure 1 A schematic diagram of a dosing and dispensing system for a sewage treatment pool according to the present invention;

[0051] Figure 2 This is a structural diagram of the RNN neural network and fuzzy computing intelligent dosing system of the present invention;

[0052] Figure 3 This is the RNN recurrent neural network structure diagram of the present invention;

[0053] Figure 4 This is a schematic diagram of the fuzzy control program for carbon source replenishment and flocculant addition according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to enable those skilled in the art to better understand the technical solution of the present invention and implement it, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the scope of protection of the present invention.

[0055] Example:

[0056] The present invention provides a method and system for dispensing chemicals in a sewage treatment pool, specifically Figure 1As shown, it includes: obtaining water quality index data, water volume, water temperature and liquid level data of the SBR reaction tank; inputting the water quality index data, water volume, water temperature and liquid level data into the trained RNN neural network, and using the RNN neural network to output the carbon source supply amount C RNN And flocculant required amount X RNN ; Input water quality index data, water volume, water temperature and liquid level data into the empirical formula, and use the empirical formula fuzzy to calculate the carbon source supply C JY And flocculant required amount X JY ; If the carbon source supply C output by the RNN neural network RNN And flocculant required amount X RNN Carbon source supply C calculated by fuzzy calculation with empirical formula JY And flocculant required amount X JY If the difference between the first carbon source supply amount C and the second carbon source supply amount C is less than the threshold, then the drug is added to the SBR reaction tank according to the value of (C'+C) / 2, where C' and C are the NN network model dosage and the fuzzy fuzzy calculation dosage respectively; if the first carbon source supply amount C RNN And flocculant required amount X RNN and the second carbon source supply C JY And flocculant required amount X JY If the difference is greater than the threshold, flocculant and carbon source are added according to the amount calculated by the empirical formula fuzzy.

[0057] The recurrent neural network RNN ​​has the following characteristics:

[0058] Structural features: The structure of RNN is roughly similar to that of traditional neural networks, consisting of an input layer, a hidden layer, and an output layer. The difference is that the neurons in the hidden layer are connected to the neurons in the previous hidden layer in addition to the current input. This structure allows RNN to memorize previous information, thus having memory characteristics when processing sequence data.

[0059] Weight sharing: RNN weights are shared, that is, the weights of the connections between neural networks in the same layer are the same, and the weights of the connections between different layers are also the same. This feature enables RNN to share and utilize information more effectively, improving the efficiency of the network.

[0060] Input representation: For the output layer of RNN, its input relationship can be expressed by a simple mathematical formula. For the input of the hidden layer, it is related to the output of the hidden layer at the previous moment and the input at the current moment, which is also the basis for the realization of the memory characteristics of RNN.

[0061] Processing sequence data: RNN is particularly suitable for processing sequence data, such as text data in natural language processing (NLP). In text processing, RNN can learn the temporal dependencies and contextual information in the text, thus achieving good results in text classification, language model and other fields.

[0062] As a kind of time series data, water treatment data is very consistent with the characteristics of RNN network. Therefore, using RNN network in the field of water treatment has excellent technical effects.

[0063] The following are implementation details of the present invention:

[0064] 1. Dosing system:

[0065] The dosing system consists of four units: sensor unit, calculation and control unit (including RNN neural network module, fuzzy fuzzy calculation module and signal interaction and control module), dosing unit and bioreactor unit. Figure 1 shown.

[0066] (1) Sensor unit: including ammonia nitrogen sensor, COD sensor and turbidity sensor, activated sludge sensor, water temperature sensor, liquid level sensor, etc. Figure 1 The main sensor.

[0067] (2) Dosing unit: includes a liquid storage tank, a stirrer for mixing liquid, a liquid adding port, an air hole, etc. The dosing unit includes metering pump 1 (metering injection of carbon source Cx) and metering pump 2 (metering injection of flocculant Xx). The metering pump is connected to the control chip and works according to the start and end time sent by the chip, replenishing the carbon source and adding flocculant as needed.

[0068] (3) Computing and control unit: including information processing module, RNN neural network module, fuzzy fuzzy computing module and signal interaction and control module.

[0069] a) Information processing module, which processes the input signals of three sensors, ammonia nitrogen, COD and turbidity, through filtering and normalization. Ammonia nitrogen, COD and turbidity are NH, COD and SS respectively, see program 1.

[0070] b) The RNN neural network calculation module inputs the processed signal into the artificial neural network model for calculation, obtains the dosage of carbon source and flocculant to be replenished, calculates the start and end time of the dosage, and controls the dosage by the start and end time. When the calculated value of the neural network model is greater than a certain value, the specific value: carbon source 0.8×COD / ammonia nitrogen>5, or the amount of flocculant added is greater than 10×SS, the fuzzy calculation module is used, see program 2.

[0071] c) Carbon source fuzzy calculation module. The amount of carbon source to be replenished is calculated using the empirical formula 0.8×COD / NH=n. When n≥3, no carbon source needs to be replenished; when n<3, calculate the amount of carbon source to be replenished. The carbon source replenishment amount ρ×L=(3 - n)×NH / 0.8×COD, where ρ is the COD equivalent per unit volume. Calculate the working time of the metering pump based on L to control the dosing amount V, V=rate s×δt. When the dosing amount reaches the calculated amount, the dosing stops. At this time, the system detects and calculates the n value again through the sensor. If n≥3, the bioreactor starts continuous aeration; if not, repeat the carbon source replenishment, see Program 3.

[0072] d) Calculate the dosage of flocculant using the empirical formula X=(V×S×C 0 ) / (c):

[0073] Where X is the dosage of flocculant, in liters;

[0074] V is the volume of the water body, calculated as the product of the data read by the liquid level sensor and the large area of the SBR reaction tank, in liters;

[0075] S is the concentration of suspended solids or colloidal substances, which is the data read by the turbidity sensor, in mg / L;

[0076] C 0 is the amount of flocculant required per unit mass of suspended solids, in mg / mg;

[0077] c is the concentration of the flocculant stock solution, in mg / L, generally 0.1 - 0.5 mg / L.

[0078] 1) When the dosage of flocculant C’ calculated by the neural network model is close to C, that is, 丨C’ - C丨 / C≤0.2, add the medicine to the SBR reaction tank according to the value of (C’ + C) / 2.

[0079] 2) When the dosage of flocculant C’ calculated by the neural network model is quite different from C, that is, 丨C’ - C丨 / C>0.2, add the medicine to the SBR reaction tank according to the value of C. Add the flocculant at the beginning of precipitation. Control the dosing amount V according to the calculated working time of the metering pump, V=rate s×(t2 - t1). When the dosing amount reaches the calculated amount, the dosing stops.

[0080] 3) When the precipitation ends, detect the SS value 3 times again and calculate. If the turbidity SS value is still large and exceeds the discharge standard, continue to calculate the amount of flocculant to be added. After continuous stirring for 10 - 30 minutes, precipitate again until the turbidity SS value meets the discharge standard requirements. See Program 4 for the flocculant fuzzy calculation module.

[0081] e) Signal output and control module: output the start and end time (δt1) of the carbon source metering pump and flocculant metering pump, the start and end time (δt2) of the agitator and the start and end time (δt3) of the aeration device, see procedure 4.

[0082] (4) The bioreactor unit consists of five parts: stirring device, aeration device, activated sludge system, water inlet pump, water outlet pump and other equipment.

[0083] 2. Program logic diagram:

[0084] (1) Schematic diagram of the operation logic of RNN and fuzzy model

[0085] Through the sensor unit, water quality index data, water volume and liquid level data, etc. are obtained in real time. The data is transmitted to the calculation and control unit, and through information processing, it enters the RNN neural network model and the Fuzzy fuzzy calculation module for calculation to obtain the calculation results. Through the RNN network and fuzzy calculation signal interaction interface, identification and judgment are performed to obtain the carbon source supply and flocculant requirements respectively, and then through the linkage control of the dosing unit, intelligent on-demand dosing is realized.

[0086] The RNN network model works by first receiving data information, implementing task scheduling, and training the RNN trainer. The trained data establishes the RNN network model and predicts the amount of medicine added to the SBR reaction tank.

[0087] When the fuzzy calculation module works, after the module obtains the data, it first performs data screening and averaging, and then checks whether there is already stored operation process data in the database. If there is, the data is directly called. If not, the data is included in the empirical formula for calculation. After the calculation, reasoning, size comparison, and logical judgment are performed.

[0088] When the RNN network model and Fuzzy fuzzy calculation are completed, the calculation data are interacted and the optimal solution is selected. In the first case, if the two values ​​are close and the difference is within 20%, the drug is added to the SBR reaction tank according to the value of (C'+C) / 2, where C' and C are the NN network model dosage and Fuzzy fuzzy calculation dosage respectively. In the second case, if the difference between the two values ​​is large and the difference is greater than 20%, the drug is added to the SBR reaction tank according to the Fuzzy fuzzy calculation dosage C value.

[0089] (2) Schematic diagram of RNN neural network model calculation

[0090] RNN neural network calculation process: by reading the water volume Q (SBR tank level sensor calculates Q), reaction tank temperature T, sewage effluent concentration COD and ammonia nitrogen, read the sludge concentration MLSS, and calculate it through the deep recurrent neural network at a cycle interval of t minutes (read data once every t minutes and calculate once), continuously replenish carbon source Q3 according to actual needs, and finally add flocculant Q5 according to the SS concentration after precipitation. The command is sent only after the effluent COD, ammonia nitrogen and turbidity meet the standards, and the effluent pump is turned on to drain water.

[0091] (3) Fuzzy control program logic for carbon source replenishment and flocculant addition:

[0092] Control Flow:

[0093] The first step is water intake: start the water intake pump to let water into the SBR reaction tank. When the SBR liquid level reaches the high water level h1, stop water intake.

[0094] The second step is to read and calculate: the turbidity sensor reads the sludge concentration, the COD sensor reads the COD value, and the formula is the time required for aerobic aeration Taeration = (COD-50) / 0.34×MLSS / 1000min. At the same time, the ammonia nitrogen sensor reads the NH value and calculates the C / N ratio, COD / NH=n.

[0095] The third step is to replenish carbon source and aerate: when n≥3, start the aeration pump to aerate the reaction tank; if n<3, calculate the carbon source replenishment, the calculation formula is: carbon source replenishment ρ×L=(3-n)×(NH) / 0.8COD, where ρ is the COD equivalent per unit volume. After the replenishment is completed, measure the COD and NH values ​​again. When it is determined that n≥3, start the aeration pump to aerate the reaction tank. If n is still<3, calculate the carbon source replenishment and replenish again until n≥3 is satisfied. Start the aeration pump to aerate the reaction tank. The aeration time reaches T 曝气 Stop aeration.

[0096] The fourth step is to stir the anaerobic reaction: anaerobic reaction t3.

[0097] Step 5: Let it stand to determine whether CODNH meets the standard: After the anaerobic reaction is over, let it stand for a while (about 10 minutes), read the sensor value, and determine whether COD≤45 and NH≤14. If both are true, it meets the standard, stop stirring, and start sedimentation.

[0098] Step 6: Replenish carbon source and cycle treatment: If one of them is no, cycle to determine and calculate the C / N ratio, and replenish carbon source and aeration reaction and anaerobic reaction again until the standard is met.

[0099] Step 7: Let the mixture stand and settle. Stop stirring and start settling. The settling time reaches t4.

[0100] Step 8. Determine whether SS meets the standard: read the SS sensor data. If the turbidity ss≤9mg / L, start the drainage pump to drain water to the MBR pool until the liquid level in the SBR reaction pool reaches the minimum level h2, then stop draining.

[0101] Step 9: Add flocculant to remove phosphorus: If the turbidity ss>9mg / L, calculate the flocculant dosage. The calculation formula is: empirical formula X=(V*S*C 0 ) / (c) Calculate the amount of flocculant. After calculation, start the flocculant metering pump, add flocculant, and turn on the stirring pump to stir and coagulate. After the flocculant addition is completed, continue stirring for 20 minutes, end stirring, and let the sedimentation time reach t4. Read the SS sensor turbidity value again until ss≤9mg / L.

[0102] Step 10: After the turbidity reaches the standard, drain: start the drainage pump until the liquid level in the SBR reaction tank reaches the minimum level

[0103] h2, stop draining. After draining, read whether the liquid level in the regulating tank has reached the minimum level h3 (at least enough to fill the SBR reaction tank). If yes, start the water inlet pump and enter the first step. If not, idle the equipment until the liquid level in the regulating tank reaches the minimum level h3, and then proceed to the next cycle.

[0104] This method can not only reduce the cost of chemicals, but also reduce the amount of sludge and carbon emissions. It is an economical, environmentally friendly and low-carbon sewage treatment control method.

[0105] Procedure 1:

[0106] Wavelet denoising procedure:

[0107] importpywt

[0108] import numpy as np

[0109] #Define wavelet denoising function

[0110] defwavelet_denoise(data):

[0111] #Select wavelet function

[0112] wavelet = 'db4'

[0113] #Set threshold selection rules

[0114] mode='soft'

[0115] #Number of decomposition layers

[0116] level=2

[0117] # Decompose the data by wavelet

[0118] coeffs=pywt.wavedec(data,wavelet,level=level)

[0119] #Denoise coefficients according to threshold rules

[0120] threshold=np.sqrt(2*np.log(len(data)))

[0121] denoised_coeffs = []

[0122] for coefficients:

[0123] denoised_coeffs.append(pywt.threshold(coeff,threshold,mode=mode))#Reconstruct the denoised coefficients to obtain the denoised data

[0124] denoised_data=pywt.waverec(denoised_coeffs,wavelet)

[0125] return denoised_data

[0126] #Original data

[0127] data=[[124,228,16.6],

[0128] [96,177,24.3],

[0129] [107,231,20.4]]

[0130] # Perform wavelet denoising on each column of data

[0131] denoised_data=np.zeros((3,3))

[0132] for i in range(3):

[0133] denoised_data[:,i]=wavelet_denoise(data[:,i])

[0134] print("Data after denoising:")

[0135] print(denoised_data)

[0136] Data normalization procedure:

[0137] import numpy as np#define the maximum and minimum normalization functions

[0138] defmin_max_normalize(data):

[0139] # Calculate the maximum and minimum values ​​of each column

[0140] min_values=np.min(data,axis=0)

[0141] max_values=np.max(data,axis=0)

[0142] #Normalization

[0143] normalized_data=(data-min_values) / (max_values-min_values)returnnormalized_data

[0144] #Original data

[0145] data=[[124,228,16.6],

[0146] [96,177,24.3],

[0147] [107,231,20.4]]

[0148] #Normalization

[0149] normalized_data=min_max_normalize(data)

[0150] print("Normalized data:")

[0151] print(normalized_data)

[0152] Procedure 2:

[0153] #RNN neural network calculation module

[0154] import numpy as np

[0155] import tensorflow as tf

[0156] #Define the cyclic RNN neural network calculation model

[0157] class RNNModel:

[0158] def__init__(self,input_size,output_size,hidden_size):

[0159] self.input_size = input_size

[0160] self.output_size=output_size

[0161] self.hidden_size=hidden_size

[0162] #Define placeholders for input and output

[0163] self.inputs=tf.placeholder(tf.float32,[None,None,input_size],

[0164] name='inputs')

[0165] self.targets=tf.placeholder(tf.float32,[None,output_size],

[0166] name = 'targets')

[0167] #Define RNN network structure

[0168] cell=tf.contrib.rnn.BasicLSTMCell(hidden_size)

[0169] outputs,states=tf.nn.dynamic_rnn(cell,self.inputs,dtype=tf.float32)#Get the output of the last time step as the prediction result self.prediction=

[0170] tf.layers.dense(outputs[:,-1,:],output_size)

[0171] #Define loss function and optimizer

[0172] self.loss=tf.reduce_mean(tf.square(self.prediction-self.targets))self.optimizer=tf.train.AdamOptimizer().minimize(self.loss)

[0173] #Define fuzzy calculation module

[0174] deffuzzy_module(carbon_source,coagulant):

[0175] #Judgment conditions

[0176] condition1=carbon_source*0.8*data[:,1] / data[:,2]>5condition2=coagulant>10*data[:,0]

[0177] #If the conditions are met, perform fuzzy calculation

[0178] ifnp.any(condition1)ornp.any(condition2):

[0179] #Perform fuzzy calculation operations

[0180] #...

[0181] fuzzy_result=0#Fuzzy calculation result, need to set specific value according to actual situation else:

[0182] fuzzy_result = None

[0183] return fuzzy_result

[0184] #data

[0185] data=[[124,228,16.6],

[0186] [96,177,24.3],

[0187] [107,231,20.4],

[0188] [208,304,18.3],

[0189] [168,300,22.0],

[0190] [122,204,20.8],

[0191] [286,268,17.3],

[0192] [385,220,17.4],

[0193] [759,316,24.7],

[0194] [1180,420,27.2],

[0195] [138,212,27.3],

[0196] [246,436,19.3],

[0197] [241,228,19.7],

[0198] [51,440,21.1],

[0199] [93,480,23.4],

[0200] [86,430,22.7],

[0201] [79,752,21.3],

[0202] [83,443,11.2],

[0203] [71,385,16.4],

[0204] [69,395,17.4],[85,435,20.9],

[0205] [153,216,3.5],

[0206] [210,608,3.5],

[0207] [210,608,3.5],

[0208] [110,515,16.7],

[0209] [93,438,20.5],

[0210] [95,495,21.0],

[0211] [135,405,19.6],

[0212] [87,396,13.6]]

[0213] #Normalize data

[0214] normalized_data=(np.array(data)-np.min(data,axis=0)) / (np.max(data,axis=0)-np.min(data,axis=0))

[0215] #Circular RNN neural network parameters

[0216] input_size=3

[0217] output_size=2

[0218] hidden_size=64

[0219] #Create a neural network calculation model

[0220] model=RNNModel(input_size,output_size,hidden_size)

[0221] #Create a session

[0222] with tf.Session() as sess:

[0223] # Initialize variables

[0224] sess.run(tf.global_variables_initializer())

[0225] #Traverse the data for training

[0226] for epoch inrange(100):

[0227] # Input data

[0228] inputs=np.expand_dims(normalized_data[:-1,:],axis=0)

[0229] targets=normalized_data[1:,:2]

[0230] #Train model

[0231] _,loss=sess.run([model.optimizer,model.loss],

[0232] feed_dict={model.inputs:inputs,model.targets:targets})

[0233] #Print training results

[0234] print("Epoch:{},Loss:{:.4f}".format(epoch+1,loss))

[0235] #Prediction results

[0236] inputs=np.expand_dims(normalized_data[-1:,:],axis=0)

[0237] prediction = sess.run (model.prediction, feed_dict = {model.inputs:inputs}) # Normalization and restoration

[0238] prediction=prediction*(np.max(data,axis=0)[:2]-np.min(data,axis=0)[:2])

[0239] +np.min(data,axis=0)[:2]

[0240] #Get the amount of carbon source and flocculant required

[0241] carbon_source=prediction[0,0]

[0242] coagulant = prediction[0,1]

[0243] print("Amount of carbon source required: {:.4f}".format(carbon_source))

[0244] print("Amount of flocculant added: {:.4f}".format(coagulant))

[0245] #Calculate the time from t1 to t2 when adding medicine

[0246] t1=5#The exact value is set according to the actual situation

[0247] t2=10#The exact value is set according to the actual situation

[0248] #Control the dosage

[0249] ifcarbon_source*0.8*data[:,1] / data[:,2]>5or coagulant>10*data[:,0]:

[0250] #Use fuzzy calculation module

[0251] fuzzy_result=fuzzy_module(carbon_source,coagulant)

[0252] if fuzzy_result is notNone:

[0253] #Control the dosage according to the fuzzy calculation results

[0254] #...

[0255] print("Time from dosing start t1 to end t2, dosage: {:.4f}".format(fuzzy_result))

[0256] else:

[0257] #No need to use fuzzy calculation module

[0258] print("Dosing time from t1 to t2, dosage: {:.4f}".format(carbon_source+

[0259] coagulant)

[0260] Procedure 3:

[0261] #Python code for a simple carbon source fuzzy calculation module:

[0262] ```Python

[0263] deffuzzy_carbon_source_calculation(cod_sensor,ammonia_sensor):

[0264] # Calculate the n value according to the empirical formula

[0265] n=0.8*cod_sensor / ammonia_sensor

[0266] ifn>=3:

[0267] #No need to replenish carbon source

[0268] carbon_source_supply=0

[0269] pump_working_time=0

[0270] else:

[0271] #Calculate the amount of carbon source needed to be supplied carbon_source_supply=(3-n)*ammonia_sensor / 0.8#Assume the rate s is 1, calculate the working time of the metering pump

[0272] pump_working_time=carbon_source_supply

[0273] return carbon_source_supply,pump_working_time

[0274] #Test example

[0275] cod_sensor = 228 #COD sensor reads data

[0276] ammonia_sensor = 16.6# ammonia nitrogen sensor data

[0277] carbon_source_supply,pump_working_time=

[0278] fuzzy_carbon_source_calculation(cod_sensor,ammonia_sensor)

[0279] print("Amount of carbon source supplied: {:.4f}".format(carbon_source_supply))

[0280] print("Metering pump working time: {:.4f}".format(pump_working_time))

[0281] ```

[0282] Procedure 4:

[0283] #Flocculating agent fuzzy calculation module

[0284] ``Python

[0285] deffuzzy_coagulant_calculation(volume,turbidity,coagulant_concentration,

[0286] flow_rate):

[0287] #Calculate the amount of flocculant according to the empirical formula Ccoagulant_quantity = (volume*turbidity*coagulant_concentration) / flow_rate

[0288] return coagulant_quantity

[0289] deffuzzy_coagulant_dosing(coagulant_quantity,desired_turbidity):

[0290] #Judge the difference between C' and C

[0291] ifabs(coagulant_quantity-desired_turbidity) / coagulant_quantity<=0.2:dosing_quantity=(coagulant_quantity+desired_turbidity) / 2

[0292] else:

[0293] dosing_quantity=coagulant_quantity

[0294] return dosing_quantity

[0295] #Test example

[0296] volume=1000#water volume, unit is L

[0297] turbidity=50#The turbidity sensor reads data in mg / L

[0298] coagulant_concentration = 20 #coagulant concentration, mg / L flow_rate = 10 #water flow, L / s desired_turbidity = 40 #desired turbidity, mg / L coagulant_quantity = fuzzy_coagulant_calculation (volume, turbidity,

[0299] coagulant_concentration,flow_rate)

[0300] dosing_quantity=fuzzy_coagulant_dosing(coagulant_quantity,desired_turbidity)print("Flocculant dosage: {:.4f}mg / L".format(coagulant_quantity))

[0301] print("Actual dosage: {:.4f}mg / L".format(dosing_quantity))

[0302] ```

[0303] This code is a simple example and can be adjusted and optimized according to actual situations.

[0304] Procedure 5:

[0305] #Signal output and control module code:

[0306] ```Python

[0307] importtime defpump_control(pump_name,start_time,stop_time):

[0308] #Simulate the working time of the carbon source metering pump and flocculant metering pump

[0309] print("{} metering pump start time: {}".format(pump_name,start_time))

[0310] time.sleep(start_time) #Assume the start time is start_time seconds

[0311] print("{} metering pump stop time: {}".format(pump_name,stop_time))

[0312] time.sleep(stop_time)#Assume the working time is stop_time seconds

[0313] defstirrer_control(start_time,stop_time):

[0314] #Simulate the working time of the mixer

[0315] print("Blender start time: {}".format(start_time))

[0316] time.sleep(start_time) #Assume the start time is start_time seconds

[0317] print("Blender stop time: {}".format(stop_time))

[0318] time.sleep(stop_time)#Assume the working time is stop_time seconds

[0319] defaerator_control(start_time,stop_time):

[0320] #Simulate the working time of the aeration device

[0321] print("Aeration device start time: {}".format(start_time))

[0322] time.sleep(start_time) #Assume the start time is start_time seconds

[0323] print("Aeration device stop time: {}".format(stop_time))

[0324] time.sleep(stop_time)#Assume the working time is stop_time seconds

[0325] #Test example

[0326] pump1_start_time = 10#Carbon source metering pump start time, in seconds

[0327] pump1_stop_time = 15# Carbon source metering pump stop time, in seconds

[0328] pump2_start_time = 20# flocculant metering pump start time, in seconds

[0329] pump2_stop_time = 25# Stop time of flocculant metering pump, in seconds

[0330] stirrer_start_time = 5# Stirrer start time, in seconds

[0331] stirrer_stop_time=10# Stirrer stop time, in seconds

[0332] aerator_start_time=30# aerator start time, in seconds aerator_stop_time=35# aerator stop time, in seconds

[0333] pump_control("Carbon source",pump1_start_time,pump1_stop_time)

[0334] pump_control("flocculant",pump2_start_time,pump2_stop_time)

[0335] stirrer_control(stirrer_start_time,stirrer_stop_time)

[0336] aerator_control(aerator_start_time,aerator_stop_time) ...

[0338] The embodiments described above are only preferred specific implementation modes of the present invention, and the protection scope of the present invention is not limited thereto. Any simple changes or equivalent replacements of the technical solutions that can be obviously obtained by any technician familiar with the field within the technical scope disclosed in the present invention belong to the protection scope of the present invention.

Claims

1. A method for dispensing chemicals in a sewage treatment pool, characterized in that: include: Obtain water quality index data, water volume, water temperature and liquid level data of the sequencing batch activated sludge process SBR reaction tank; The water quality index data, water volume, water temperature and liquid level data are input into the trained RNN neural network, and the RNN neural network is used to output the carbon source supply amount C RNN And flocculant required amount X RNN ; Input water quality index data, water volume, water temperature and liquid level data into the empirical formula, and use the empirical formula to calculate the carbon source supply C JY And flocculant required amount X JY ; If the carbon source supply C output by the RNN neural network RNN And flocculant required amount X RNN Carbon source supply C calculated by empirical formula JY And flocculant required amount X JY If the difference is less than the threshold, the drug is added to the SBR reaction tank according to the value of (C'+C) / 2, where C' is the carbon source supply output by the RNN neural network C RNN Or flocculant requirement X RNN ; C is the carbon source supply calculated by the empirical formula C JY Or flocculant requirement X JY ; If C RNN and X RNN With C JY and X JY If the difference is greater than the threshold, then the X calculated according to the empirical formula JY and C JY Adding chemicals to the SBR reaction tank; The method of calculating the carbon source supply using an empirical formula includes: Calculate whether carbon source needs to be replenished: 0.8×COD / NH=n Wherein, COD is the measured COD amount; NH is the measured ammonia nitrogen concentration; when n≥3, no carbon source replenishment is required; when n<3, the carbon source replenishment amount is calculated; Carbon source supply = ρ × C = (3-n) × NH / 0.8 × COD Wherein, ρ is the COD equivalent per unit volume of the carbon source stock solution, and C is the volume of carbon source added; The method of calculating the flocculant replenishment amount by using an empirical formula includes: X=(V*S*C0) / (c) Wherein, X is the amount of flocculant used, in L; V is the volume of water, in L; S is the concentration of suspended solids or colloids, in mg / L; C0 is the amount of flocculant required per unit mass of suspended solids, in mg / mg; c is the concentration of flocculant stock solution, in mg / L.

2. A method for distributing chemicals in a sewage treatment pool according to claim 1, characterized in that: Also includes: When the amount of added flocculant reaches the flocculant replenishment amount, stop adding flocculant; When the flocculant reacts with the substances in the water and the precipitation is finished, test the turbidity value three times. If the turbidity value exceeds the discharge standard, continue to add flocculant, continue stirring for 10 to 30 minutes, and precipitate again until the turbidity value meets the discharge standard requirements.

3. A method for distributing chemicals in a sewage treatment pool according to claim 1, characterized in that: Also includes: When the amount of added carbon source reaches the carbon source replenishment amount, stop adding carbon source; Detect and calculate the n value. If n≥3, the SBR reactor of the sequential batch activated sludge process starts aeration. If n<3, the carbon source is repeatedly supplied.

4. A method for distributing chemicals in a sewage treatment pool according to claim 1, characterized in that: The water quality index data include: Sewage inlet turbidity, COD, ammonia nitrogen concentration, effluent COD, ammonia nitrogen NH concentration, turbidity.

5. The method for dosing and distributing chemicals in a sewage treatment pool according to claim 1, characterized in that: Also includes: After each dosing, the water quality index data, water volume, water temperature and liquid level data after the water reaches the discharge standard will be used as database data; When the water quality index, water volume, water temperature and liquid level of the next influent are the same as the corresponding data in the database, the saved process parameters are directly retrieved to add drugs to the SBR reaction tank.

6. A dosing and dispensing system for a sewage treatment tank, characterized in that: include: The sensor module is used to obtain the water quality index data, water volume, water temperature and liquid level data of the SBR reaction tank; The calculation unit module is used to input water quality index data, water volume, water temperature and liquid level data into the trained RNN neural network, and use the RNN neural network to output the carbon source supply C RNN And flocculant required amount X RNN ; Input water quality index data, water volume, water temperature and liquid level data into the empirical formula, and use the empirical formula to calculate the carbon source supply C JY And flocculant required amount X JY ; The first dosing module is used to calculate the carbon source supply amount C output by the RNN neural network. RNN And flocculant required amount X RNN Carbon source supply C calculated by empirical formula JY And flocculant required amount X JY If the difference is less than the threshold, the drug is added to the SBR reaction tank according to the value of (C'+C) / 2, where C' is the carbon source supply output by the RNN neural network C RNN Or flocculant requirement X RNN ; C is the carbon source supply calculated by the empirical formula C JY Or flocculant requirement X JY ; The second dosing module is used if C RNN and X RNN With C JY and X JY If the difference is greater than the threshold, then the X calculated according to the empirical formula JY and C JY Adding chemicals to the SBR reaction tank; The method of calculating the carbon source supply using an empirical formula includes: Calculate whether carbon source needs to be replenished: 0.8×COD / NH=n Wherein, COD is the measured COD amount; NH is the measured ammonia nitrogen concentration; when n≥3, no carbon source replenishment is required; when n<3, the carbon source replenishment amount is calculated; Carbon source supply = ρ × C = (3-n) × NH / 0.8 × COD Among them, ρ is the COD equivalent per unit volume of the carbon source stock solution, and C is the volume of carbon source added; The method of calculating the flocculant replenishment amount by using an empirical formula includes: X=(V*S*C0) / (c) Wherein, X is the amount of flocculant used, in L; V is the volume of water, in L; S is the concentration of suspended solids or colloids, in mg / L; C0 is the amount of flocculant required per unit mass of suspended solids, in mg / mg; c is the concentration of flocculant stock solution, in mg / L.

7. A dosing and dispensing system for a sewage treatment pool according to claim 6, characterized in that: The sensor module comprises: Ammonia nitrogen sensor, used to detect the ammonia nitrogen content in sewage; COD sensor, used to detect sewage COD data; Activated sludge sensor, used to detect the sludge concentration in the SBR reaction tank; Turbidity sensor, used to detect turbidity value; Temperature sensor, used to detect the water temperature of the SBR reaction tank; Liquid metering pump, used to measure the water volume in SBR reaction tank.