A method for constructing COD soft-sensing model based on UV-visible absorption spectroscopy

By combining the absorbance test of the spectral probe and the CARS and LSSVR models, the parameters are optimized to solve the accuracy and generalization capabilities of the COD soft measurement model, and high-precision COD concentration prediction and online water quality monitoring are achieved.

CN117074333BActive Publication Date: 2024-11-15CHONGQING UNIV +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310628547.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2024-11-15
Estimated Expiration
2043-05-30

AI Technical Summary

Technical Problem

The existing COD soft measurement model is difficult to replace the traditional on-site sampling-chemical reagent analysis method due to noise and nonlinear problems, poor accuracy and generalization capabilities.

Method used

By inspecting the absorbance repeatability and stability of the spectral probe, a COD soft measurement model based on ultraviolet-visible light absorption spectrum was constructed. The variable combination and LSSVR model were screened using the CARS algorithm, and the parameters were optimized with the DBO algorithm, so the formation accuracy was high and the generalization ability was strong. predictive model.

Benefits of technology

It improves the fitting accuracy of COD concentration values ​​and the generalization ability of the model, can replace the traditional COD detection method and be used for online monitoring of water quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117074333B_ABST
    Figure CN117074333B_ABST
Patent Text Reader

Abstract

The invention discloses a method for constructing a COD soft measurement model based on ultraviolet-visible absorption spectroscopy, and relates to the technical field of water quality monitoring. The technical scheme comprises: performing repeatability and stability tests on the absorbance of a full-band spectrum probe to obtain a spectrum probe that has passed the test; collecting absorption spectra of different water samples in the full band as spectrum data of the water samples through the spectrum probe that has passed the test, constructing water sample samples through the spectrum data of the water samples and the concentration values ​​of the corresponding water samples to form a database; performing variable screening on the spectrum data of the water samples through a CARS algorithm, selecting a variable combination with the lowest root mean square error of interactive verification to form a training sample set of a prediction model; constructing an LSSVR prediction model based on the training sample set, optimizing the parameters of the LSSVR prediction model based on a DBO algorithm, forming a COD soft measurement model based on ultraviolet-visible absorption spectroscopy, and providing a COD soft measurement model with excellent accuracy and generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of water quality monitoring, and more specifically to a method for constructing a COD soft-sensing model based on ultraviolet-visible light absorption spectrum. Background Art

[0002] COD (Chemical Oxygen Demand) is one of the important indicators of water pollution and is of great significance to water quality monitoring and treatment. Soft measurement is a real-time monitoring technology based on mathematical models and data analysis, which has the advantages of reagent-free, real-time, accuracy and economy. However, due to the existence of noise and nonlinearity in COD detection data, the accuracy and generalization ability of COD soft measurement model are poor. At present, the traditional COD detection method of on-site sampling-chemical reagent analysis is still widely used.

[0003] In view of this, the inventor provides a method for constructing a COD soft sensor model based on UV-visible absorption spectroscopy to improve the accuracy and generalization ability of the COD soft sensor model, replacing the traditional on-site sampling-chemical reagent analysis of COD detection. Summary of the invention

[0004] The purpose of this application is to provide a method for constructing a COD soft-sensing model based on ultraviolet-visible light absorption spectroscopy to solve the problems existing in the background technology.

[0005] The above technical objectives of the present application are achieved through the following technical solutions:

[0006] S1. Test the repeatability and stability of the absorbance of the full-band spectrum probe to obtain a spectrum probe that passes the test;

[0007] S2. Collect the absorption spectra of different water samples in the full band as the spectral data of the water samples through the qualified spectral probe, construct water sample samples through the spectral data of the water samples and the concentration values ​​corresponding to the water samples, and construct a database through multiple groups of water sample samples;

[0008] S3, using the CARS algorithm to perform variable screening on the water sample spectral data in the database, and selecting the variable combination with the lowest root mean square error of the interactive verification to form a training sample set of the prediction model;

[0009] S4. Constructing a LSSVR prediction model based on the training sample set, optimizing the parameters of the LSSVR prediction model based on a DBO algorithm, and forming a COD soft measurement model based on ultraviolet-visible light absorption spectrum.

[0010] By adopting the above technical scheme, the availability of data collected by the spectral probe is ensured through the Pearson coefficient, and the spectral data and concentration values ​​of water samples with different components are collected to build a database; the CARS algorithm is used to extract the absorbance corresponding to the characteristic wavelength in the band of interest in the spectral data as the input of the prediction model; the LSSVR algorithm is selected as the main modeling method, and the DBO algorithm is used to adaptively optimize the hyperparameters in the LSSVR algorithm to enhance the accuracy of the model; the COD soft measurement model constructed by this method has excellent accuracy and generalization ability, and can replace the traditional COD detection method of on-site sampling-chemical reagent analysis. At the same time, the COD soft measurement model obtained by this method can also be used for online monitoring of water quality.

[0011] Furthermore, the step S1 includes:

[0012] The spectrum probe is used to collect multiple full-band spectrum data of the same sample at the same time, and the Pearson coefficient of the multiple full-band spectrum data is calculated. When the Pearson coefficient meets the correlation requirement, the spectrum probe is considered to have passed the absorbance repeatability test;

[0013] The spectrum probe is used to collect multiple full-band spectrum data of the same sample within a period of time, and the Pearson coefficient of the multiple full-band spectrum data is calculated. When the Pearson coefficient meets the correlation requirement, the spectrum probe is considered to have passed the absorbance stability test;

[0014] The spectrum probe that passes both the absorbance repeatability test and the absorbance stability test is regarded as a qualified spectrum probe.

[0015] Further, the Pearson coefficient r is expressed as:

[0016]

[0017] Among them, x i With y i Represents two different sets of full-band spectral data, and Respectively represent x i With y i The average value of , r represents the Pearson coefficient. When the r value is greater than 0.99, it is considered that the Pearson coefficients of the two sets of full-band spectral data meet the correlation requirements.

[0018] Furthermore, the step S2 comprises:

[0019] Spectral data of water samples with different components are collected through qualified spectral probes. Spectral data of water samples with the same component are collected multiple times and the average value is taken as the spectral data of the water sample. The spectral data is the absorption spectral data of the water sample in the full band. The spectral data is denoised and combined with the concentration value corresponding to the water sample to form a water sample sample. A database is constructed through multiple groups of water samples.

[0020] Furthermore, the step S3 includes:

[0021] S31, randomly selecting a certain number of spectral data from the database as a calibration set to establish a PLS model each time, and taking the percentage of the absolute value of the regression coefficient in the PLS model of each sampling process as an importance index of the variable, wherein the variable refers to the data of the absorbance of a certain characteristic wavelength in the spectral data;

[0022] S32, using an exponential decay function to remove variables with relatively small percentages of absolute values ​​of regression coefficients, to obtain a proportion of retained variables;

[0023] S33, determining the number of sampling variables according to the proportion of retained variables, performing resampling PLS modeling, and calculating the cross-validation root mean square error;

[0024] S34, performing cyclic calculation according to the set number of cyclic iterations to obtain multiple variable combinations and multiple cross-validation root mean square errors, and selecting the variable combination with the smallest cross-validation root mean square error as the training sample set of the prediction model.

[0025] Furthermore, it is characterized in that: when the PLS model is established for the i-th sampling, the variable ratio r is retained i for:

[0026] r i =ae -ki

[0027] a=(P / 2) 1 / (N-1)

[0028] k=ln(P / 2) / (N-1)

[0029] Among them, r i is the ratio of retained variables at the i-th sampling, i∈(0,N) is the number of loop iterations, N is the maximum number of loop iterations, a and k are constants, and P is all variables.

[0030] Further, the step S4 includes:

[0031] S41, constructing a prediction model function according to the training sample set of the prediction model, constructing a kernel function and a bias term to obtain an LSSVR prediction model;

[0032] S42. The gamma and sigma parameters in the kernel function of the LSSVR prediction model are optimized by the DBO algorithm to obtain a COD soft measurement model based on UV-visible absorption spectroscopy.

[0033] Furthermore, the prediction model function is:

[0034]

[0035] Among them, f(x) is the predicted value of COD concentration, x is the input variable, is a nonlinear approximation function, ω and b are weight and bias terms.

[0036] Furthermore, the LSSVR prediction model is:

[0037]

[0038] Among them, Y is the predicted value of COD concentration, k(x,x i ) is the kernel function, α i is the Lagrange multiplier and b is the bias term.

[0039] Furthermore, the step S42 includes:

[0040] S421, determining the search range of gamma and sigma parameters in the kernel function;

[0041] S422, initializing a certain number of dung beetles, each dung beetle represents a combination of gamma and sigma, and the initial values ​​of gamma and sigma are randomly generated within a determined parameter range;

[0042] S423, updating the position of the initially generated dung beetle population according to the formulas of rolling behavior, dancing behavior, breeding behavior, foraging behavior and stealing behavior;

[0043] S424, for dung beetle individuals, the LSSVR model is used to fit the sample data, and the mean square error is calculated as the fitness of the individual;

[0044] S425, updating the dung beetle proxy identity and position: according to the current individual position information of the dung beetle, using the DBO proxy identity update rule, updating each individual position of the dung beetle;

[0045] S426, repeating steps S423 to S425 until a preset number of iterations is reached or a preset accuracy requirement is met;

[0046] S427. Finally, the particle with the minimum fitness value is selected as the optimal solution, and its corresponding gamma and sigma are the gamma and sigma parameters in the kernel function of the final LSSVR prediction model.

[0047] Compared with the prior art, the present application has the following beneficial effects: the method for constructing a COD soft-sensing model based on ultraviolet-visible absorption spectroscopy provided by the present invention tests the repeatability and stability of the absorbance of the full-band spectrum probe through the Pearson coefficient to ensure the availability of the collected data; the absorbance data of multiple specific wavelengths are screened by the CARS algorithm as the input of the LSSVR model to improve the fitting accuracy of the COD concentration value and reflect the COD concentration value with more informative interpretation; the LSSVR prediction model is optimized by combining the global exploratory and fast convergence advantages of the DBO algorithm to form a COD soft-sensing model with excellent accuracy and generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of this application, and do not constitute a limitation of the embodiments of the present invention. In the drawings:

[0049] Figure 1 A schematic diagram of a flow chart of a method provided by an embodiment of the present invention;

[0050] Figure 2 The Pearson coefficient result of the absorbance repeatability analysis provided by one embodiment of the present invention;

[0051] Figure 3 The Pearson coefficient result of the absorbance stability analysis provided by one embodiment of the present invention;

[0052] Figure 4 The position of the characteristic wavelength screened by the CARS algorithm provided in one embodiment of the present invention;

[0053] Figure 5 The fitting effect between the real value and the predicted value in the model training provided by one embodiment of the present invention;

[0054] Figure 6 A fitting equation for the real value and the predicted value of the model provided by an embodiment of the present invention;

[0055] Figure 7 An algorithm flow chart of a method implemented in one embodiment of the present invention. DETAILED DESCRIPTION

[0056] Hereinafter, the term "include" or "may include" used in various embodiments of the present application indicates the presence of the function, operation or element applied for, and does not limit the increase of one or more functions, operations or elements. In addition, as used in various embodiments of the present application, the terms "include", "have" and their cognates are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the presence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or the possibility of increasing one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items.

[0057] In various embodiments of the present application, the expression "or" or "at least one of B or / and C" includes any combination or all combinations of the words listed at the same time. For example, the expression "B or C" or "at least one of B or / and C" may include B, may include C, or may include both B and C.

[0058] The expressions (such as "first", "second", etc.) used in the various embodiments of the present application may modify the various constituent elements in the various embodiments, but may not limit the corresponding constituent elements. For example, the above expressions do not limit the order and / or importance of the elements. The above expressions are only used for the purpose of distinguishing one element from other elements. For example, the first user device and the second user device indicate different user devices, although both are user devices. For example, without departing from the scope of the various embodiments of the present application, the first element may be referred to as the second element, and similarly, the second element may also be referred to as the first element.

[0059] It should be noted that if it is described that one component element is “connected” to another component element or is “connected to” another component element, the first component element may be directly connected to the second component element, and a third component element may be “connected” between the first component element and the second component element. Conversely, when one component element is “directly connected” to another component element or is “directly connected to” another component element, it can be understood that there is no third component element between the first component element and the second component element.

[0060] The terms used in the various embodiments of the application are only used to describe the purpose of specific embodiments and are not intended to limit the various embodiments of the application. As used herein, the singular form is intended to also include the plural form, unless the context clearly indicates otherwise. Unless otherwise limited, all terms used here (including technical terms and scientific terms) have the same meaning as the meanings commonly understood by ordinary technicians in the field of the various embodiments of the application. The terms (such as the terms defined in the dictionary generally used) will be interpreted as having the same meaning as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning, unless clearly defined in the various embodiments of the application.

[0061] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with examples and drawings. The illustrative implementation scheme of the present application and its description are only used to explain the present application and are not intended to limit the present application.

[0062] COD soft measurement based on UV-visible absorption spectroscopy refers to the use of mathematical models to predict COD concentration values ​​through UV-visible absorption spectroscopy. Due to the noise and nonlinearity of the input spectral data, the current COD soft measurement model has poor accuracy and generalization ability.

[0063] In view of this, the inventor proposes a method for constructing a COD soft sensor model based on ultraviolet-visible absorption spectrum. A reasonable feature extraction algorithm should be used in the input stage to reduce the dimension of the model input and filter the noise data at the same time. A mathematical model with good prediction accuracy and interpretability, strong robustness to outliers and wide practical application in spectral modeling analysis is used in the prediction stage; at the same time, an intelligent algorithm with fast convergence speed, strong global search ability and suitable for optimization of various types of functions is used to solve the problems of nonlinearity, multi-peak and multi-dimensional in model construction, and a prediction model with high precision and strong generalization ability is constructed through the above considerations. The method for constructing a COD soft sensor model based on ultraviolet-visible absorption spectrum is described below in conjunction with the embodiments and accompanying drawings.

[0064] Example 1

[0065] The present embodiment provides a method for constructing a COD soft measurement model based on ultraviolet-visible absorption spectroscopy, aiming to establish a least squares support vector regression model that ensures the relationship between available ultraviolet spectral data and COD values. Through model training and error calculation, a mathematical model with an error within the allowable range of national standards and industry standards is obtained to perform COD soft measurement and improve the extrapolation ability of the model. At the same time, the DBO algorithm is combined to optimize the model parameters, improve convergence, and enhance the generalization ability of the model. A database is established from water samples of different components and concentrations in different regions to train the prediction model and complete the inversion of COD from the absorption spectrum.

[0066] To achieve the above purpose, the COD soft sensor model construction method based on UV-visible absorption spectroscopy is described in detail in this paper. Figure 1 As shown, it mainly includes four parts:

[0067] S1. Test the repeatability and stability of the absorbance of the full-band spectrum probe to obtain a spectrum probe that passes the test;

[0068] S2. Collect the absorption spectra of different water samples in the full band as the spectral data of the water samples through the qualified spectral probe, construct water sample samples through the spectral data of the water samples and the concentration values ​​corresponding to the water samples, and construct a database through multiple groups of water sample samples;

[0069] S3, using the CARS algorithm to perform variable screening on the water sample spectral data in the database, and selecting the variable combination with the lowest root mean square error of the interactive verification to form a training sample set of the prediction model;

[0070] S4. Constructing a LSSVR prediction model based on the training sample set, optimizing the parameters of the LSSVR prediction model based on the DBO algorithm, and forming a COD soft measurement model based on ultraviolet-visible light absorption spectrum.

[0071] Step S1 is described below. Step S1 is to test the repeatability and stability of the absorbance of the full band of the spectrum probe to obtain a spectrum probe that has passed the test. Its purpose is to collect spectral data of various COD contributors through the spectrum probe, obtain spectral data in different states by controlling variables such as temperature, concentration, and collection time, and perform Pearson coefficient analysis on the repeatability and stability of the spectrum probe to ensure the availability of the spectral data collected by the spectrum probe.

[0072] Specifically in this example, step S1 includes:

[0073] The spectrum probe is used to collect multiple full-band spectrum data of the same sample at the same time, and the Pearson coefficient of the multiple full-band spectrum data is calculated. When the Pearson coefficient meets the correlation requirement, the spectrum probe is considered to have passed the absorbance repeatability test;

[0074] The spectrum probe is used to collect multiple full-band spectrum data of the same sample within a period of time, and the Pearson coefficient of the multiple full-band spectrum data is calculated. When the Pearson coefficient meets the correlation requirement, the spectrum probe is considered to have passed the absorbance stability test;

[0075] The spectrum probe that passes both the absorbance repeatability test and the absorbance stability test is regarded as a qualified spectrum probe. The above Pearson coefficient r is expressed as:

[0076]

[0077] Among them, x i With y i Represents two different sets of full-band spectral data, and Respectively represent x i With y i The average value of , r represents the Pearson coefficient. When the r value is greater than 0.99, it is considered that the Pearson coefficients of the two sets of full-band spectral data meet the correlation requirements.

[0078] For details about this example, see Figure 2-3 As shown, absorbance repeatability test: the sample is 15 mg potassium hydrogen phthalate. At the same time, such as 10:46 on September 22, 2022, 10 times of spectrum data were measured and compared with each other to analyze the Pearson coefficient. The results are shown in Figure 2 ; Absorbance stability test: The sample is 0.3g aminoacetic acid, and within a certain period of time, such as September 22, 2022, 9:00, 10:00, 11:00, 13:00, 14:00, 15:00, 16:00, 17:00, and 18:00. The 9 measured spectral data are compared and analyzed in pairs by Pearson coefficient. The results are detailed in Figure 3 .

[0079] Step S2 is explained below. Step S2 is to collect the absorption spectra of different water samples in the full band as the spectral data of the water samples through the qualified spectral probe, construct the water sample through the spectral data of the water sample and the concentration value corresponding to the water sample, and construct the database through multiple groups of water sample. Its purpose is to use the spectral probe to collect the spectral data of water samples with different components according to its operation process, and each collection adopts the method of taking the average of multiple measurements, and the above spectral data is denoised and pre-processed as the data source of the database to construct the database, and at the same time, the data in the database is divided into a model training set and a model test set according to a certain ratio, so as to standardize the data source of model training.

[0080] Specifically in this example, step S2 includes:

[0081] Spectral data of water samples with different components are collected through qualified spectral probes. Spectral data of water samples with the same component are collected multiple times and the average value is taken as the spectral data of the water sample. The spectral data is the absorption spectral data of the water sample in the full band. The spectral data is denoised and combined with the concentration value corresponding to the water sample to form a water sample sample. A database is constructed through multiple groups of water samples.

[0082] Specifically, in the implementation of this example, a qualified spectral probe is used to collect spectral data of water samples of different components in multiple different regions in accordance with its usage specifications. The spectral data is the absorption spectral data of the water sample in the full band of 194nm to 1054nm. For example, 10 groups of spectral data are collected for the water sample of the same component, and the average value of the 10 groups of spectral data is taken as the spectral data of the water sample of the component, and the concentration value of the water sample of the component is obtained accordingly. The spectral data and concentration value of the water sample of the component are combined as water sample samples and stored in the spectral data of the corresponding region to construct a spectral database. The water sample samples in the spectral database are (x i ,y i )∈R n ×R m , x i is the absorption spectrum data (absorbance data) of all water samples, y i It is the COD concentration value of the water sample.

[0083] Step S3 is described below. Step S3 is to screen the water sample spectrum data in the database by the CARS algorithm, and select the variable combination with the lowest root mean square error of the interactive verification to form a training sample set of the prediction model. Its purpose is to use the CARS algorithm to reduce the dimension of the spectrum data with strong nonlinear relationship, adopt an adaptive reweighting strategy in the process of dimensionality reduction, adaptively perform weighted processing according to the competition of the variables, select the optimal characteristic variable combination for dimensionality reduction, and reduce the interference of noise while retaining important information in the input information. In addition, the CARS algorithm returns the collection of the original data of the spectral characteristic wavelength in the implementation process of the computer program, which can be used as a subsequent interference factor elimination analysis, etc., to reduce the phenomenon of "black box".

[0084] Specifically in this example, step S3 includes:

[0085] S31, randomly selecting a certain number of spectral data from the database as a calibration set to establish a PLS model each time, and taking the percentage of the absolute value of the regression coefficient in the PLS model of each sampling process as an importance index of the variable, wherein the variable refers to the data of the absorbance of a certain characteristic wavelength in the spectral data;

[0086] S32, using an exponential decay function to remove variables with relatively small percentages of absolute values ​​of regression coefficients, to obtain a proportion of retained variables;

[0087] S33, determining the number of sampling variables according to the proportion of retained variables, performing resampling PLS modeling, and calculating the cross-validation root mean square error;

[0088] S34, performing cyclic calculation according to the set number of cyclic iterations to obtain multiple variable combinations and multiple cross-validation root mean square errors, and selecting the variable combination with the smallest cross-validation root mean square error as the training sample set of the prediction model.

[0089] Among them, in step S32, when the PLS model is established for the i-th sampling, the variable ratio r is retained i for:

[0090] r i =ae -ki

[0091] a=(P / 2) 1 / (N-1)

[0092] k=ln(P / 2) / (N-1)

[0093] Among them, r i is the ratio of retained variables at the i-th sampling, i∈(0,N) is the number of loop iterations, N is the maximum number of loop iterations, a and k are constants, and P is all variables.

[0094] When implementing this example, perform the following steps:

[0095] A. Monte Carlo model sampling: Randomly divide the data set from the spectral data in the database for modeling analysis, with a division ratio of 70% to 90%. PLS is selected for modeling analysis, and the percentage of the absolute value of the regression coefficient is used as the importance of the variable or the explanatory power of the target variable.

[0096] B. Exponential decay wavelength selection: All variables P are used for modeling for the first time. The variables determined in the N iterations are gradually reduced. The number of variables determined in the i-th sampling is proportional to r. i , determined according to the following formula:

[0097] r i =ae -ki

[0098] Since the first sampling r1 uses all variables P for modeling, the Nth sampling r N Two variables are used for modeling, so the constraint condition of the above formula is r1=P,r N =2 / P, the exponential decreasing function constants a and k can be obtained as:

[0099] a=(P / 2) 1 / (N-1)

[0100] k=ln(p / 2) / (N-1)

[0101] C. Adaptive reweighted sampling: The iterative sampling variables determined by process B are eliminated, i.e., resampled. The weights represent the frequency of occurrence of the variables. Then, an analytical prediction model based on the screened variables is established. To verify the effectiveness of the model, RMSECV is used.

[0102] D. Loop iteration: loop calculation is performed according to the set number of loop iterations, and the desired characteristic variable is locked according to the minimum RMSECV. The position of the characteristic wavelength is as follows Figure 4 shown.

[0103] Step S4 is described below. Step S4 constructs an LSSVR prediction model based on the training sample set, optimizes the parameters of the LSSVR prediction model based on the DBO algorithm, and forms a COD soft measurement model based on ultraviolet-visible light absorption spectrum. The purpose is to use the widely used and popularized LSSVR as a prediction model, analyze the corresponding relationship between ultraviolet spectrum data and COD concentration values, and use the DBO algorithm to simulate the behavior of dung beetles when rolling dung balls to find the optimal solution of the LSSVR prediction model parameters, so that the LSSVR prediction model has stronger global search capabilities, faster convergence speed, and better robustness.

[0104] Specifically in this example, step S4 includes:

[0105] S41, constructing a prediction model function according to the training sample set of the prediction model, constructing a kernel function and a bias term to obtain an LSSVR prediction model;

[0106] S42. The gamma and sigma parameters of the kernel function in the LSSVR prediction model are optimized by the DBO algorithm to obtain a COD soft measurement model based on UV-visible absorption spectroscopy.

[0107] The following is an explanation of step S41 to describe the generation process of the LSSVR prediction model:

[0108] The training sample set after screening by the CARS algorithm is: Where N is the total sample size, x i is the sample data with serial number i, The basis is the n-dimensional real number space, y i The sample label with serial number i is constructed based on the regression support vector machine to form a prediction model function in the following form:

[0109]

[0110] Among them, f(x) is the COD concentration value; x is the input variable; is a nonlinear approximation function; ω and b are weight terms and bias terms. Then perform the following operations:

[0111] A. Construct the objective function of the LSSVR optimization problem:

[0112]

[0113] Among them, r, are the regularization coefficient and the square of the error term.

[0114] B. Change the inequality constraint of SVM to an equality constraint:

[0115]

[0116] C. Construct Lagrangian function:

[0117]

[0118] where α i is the Lagrange multiplier.

[0119] D. According to the KKT condition, the optimal value should satisfy the constraint that the partial derivative of each variable is 0:

[0120]

[0121] Eliminating ω and ξ yields the linear system:

[0122]

[0123] In the formula, ZZ T and I denote the kernel matrix and the identity matrix.

[0124] E. In the above linear equation system:

[0125]

[0126] F. Let A = ZZ T +r -1 I, the solution of the above linear equations can be obtained, and then the LSSVR prediction model can be obtained.

[0127]

[0128]

[0129] Among them, Y is the predicted value of COD concentration, k(x,x i ) is the kernel function. In this example, the radial basis function (RBF) is selected as the kernel function.

[0130] The following is an explanation of step S41, which illustrates the specific process of finding the optimal solution of the LSSVR prediction model parameters through the DBO algorithm. Step S42 includes:

[0131] S421, determining the search range of gamma and sigma parameters in the kernel function;

[0132] S422, initializing a certain number of dung beetles, each dung beetle represents a combination of gamma and sigma, and the initial values ​​of gamma and sigma are randomly generated within a determined parameter range;

[0133] S423, updating the position of the initially generated dung beetle population according to the formulas of rolling behavior, dancing behavior, breeding behavior, foraging behavior and stealing behavior;

[0134] S424, for dung beetle individuals, the LSSVR model is used to fit the sample data, and the mean square error is calculated as the fitness of the individual;

[0135] S425, updating the dung beetle proxy identity and position: according to the current individual position information of the dung beetle, using the DBO proxy identity update rule, updating each individual position of the dung beetle;

[0136] S426, repeating steps S423 to S425 until a preset number of iterations is reached or a preset accuracy requirement is met;

[0137] S427. Finally, the particle with the minimum fitness value is selected as the optimal solution, and its corresponding gamma and sigma are the gamma and sigma parameters in the kernel function of the final LSSVR prediction model.

[0138] The comprehensive process of the method can be found in Figure 7 As shown, based on the COD soft-sensing model based on ultraviolet-visible absorption spectrum constructed in the above steps S1-S4, new spectral data is obtained to calculate the COD concentration. Figure 5 , 6 The prediction effect of the COD soft sensor model constructed by the method of this example has no significant difference compared with the detection data of traditional on-site sampling-chemical reagent analysis, indicating that the detection method of the present invention has high accuracy and can replace the traditional COD detection method. At the same time, the COD soft sensor model obtained by this method can also be used for online monitoring of water quality.

[0139] This example is based on the principle of Lambert-Beer quantitative analysis. The absorption spectrum obtained by the ultraviolet-visible absorption spectrum in the full spectrum has a law that the absorbance of some wavelengths is related to the COD concentration value, and the national standard method of water sample detection is used as the target COD value. First, the repeatability and stability of the absorbance of the full band of the spectrum probe are tested by the Pearson coefficient to ensure the availability of its collected data; the CARS algorithm is used to screen the absorbance data of multiple specific wavelengths as the input of the LSSVR model, which improves the fitting accuracy of the COD concentration value and reflects the COD concentration value more informatively; combined with the global exploratory and fast convergence advantages of the DBO algorithm, the LSSVR prediction model is optimized, and the error of the established model after model training is calculated. By setting the number of iterations of the DBO algorithm, the model reaches the target accuracy and precision or error index. For the monitoring of different water qualities, the data model of the basin in the region is selected for spectral absorption COD calculation.

[0140] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for constructing a COD soft-sensing model based on UV-visible absorption spectroscopy, characterized by: include: S1. Test the repeatability and stability of the absorbance of the full-band spectrum probe to obtain a spectrum probe that passes the test; S2. Collect the absorption spectra of different water samples in the full band as the spectral data of the water samples through the qualified spectral probe, construct water sample samples through the spectral data of the water samples and the concentration values ​​corresponding to the water samples, and construct a database through multiple groups of water sample samples; S3, using the CARS algorithm to perform variable screening on the water sample spectral data in the database, and selecting the variable combination with the lowest root mean square error of the interactive verification to form a training sample set of the prediction model; S4, constructing a LSSVR prediction model based on the training sample set, optimizing the parameters of the LSSVR prediction model based on the DBO algorithm, and forming a COD soft measurement model based on ultraviolet-visible absorption spectrum; Wherein, the step S4 comprises: S41, constructing a prediction model function according to a training sample set of a prediction model, constructing a kernel function and a bias term to obtain an LSSVR prediction model; S42, optimizing the gamma and sigma parameters of the kernel function in the LSSVR prediction model by a DBO algorithm, and obtaining a COD soft measurement model based on ultraviolet-visible absorption spectroscopy; The prediction model function is: Among them, f(x) is the predicted value of COD concentration, x is the input variable, is a nonlinear approximation function, ω and b are weight terms and bias terms; The LSSVR prediction model is: Among them, Y is the predicted value of COD concentration, k(x,x i ) is the kernel function, and the radial basis function is selected as the kernel function, α i is the Lagrange multiplier, b is the bias term; The step S42 comprises: S421, determining the search range of gamma and sigma parameters in the kernel function; S422, initializing a certain number of dung beetles, each dung beetle represents a combination of gamma and sigma, and the initial values ​​of gamma and sigma are randomly generated within the determined parameter range; S423, updating the position of the initially generated dung beetle population according to the formulas of rolling behavior, dancing behavior, breeding behavior, foraging behavior and stealing behavior; S424, for individual dung beetles, using the LSSVR model to fit the sample data, and calculating Calculate the mean square error as the individual fitness; S425, update the dung beetle proxy identity and position: according to the current dung beetle individual position information, adopt the DBO proxy identity update rule to update each dung beetle individual position; S426, repeat steps S423 to S425 until the preset number of iterations is reached or the preset accuracy requirement is met; S427, finally select the particle with the minimum fitness value as the optimal solution, and its corresponding gamma and sigma are the gamma and sigma parameters in the final LSSVR prediction model kernel function.

2. The method for constructing a COD soft sensor model based on ultraviolet-visible absorption spectroscopy according to claim 1, characterized in that: The step S1 comprises: The spectrum probe is used to collect multiple full-band spectrum data of the same sample at the same time, and the Pearson coefficient of the multiple full-band spectrum data is calculated. When the Pearson coefficient meets the correlation requirement, the spectrum probe is considered to have passed the absorbance repeatability test; The spectrum probe is used to collect multiple full-band spectrum data of the same sample within a period of time, and the Pearson coefficient of the multiple full-band spectrum data is calculated. When the Pearson coefficient meets the correlation requirement, the spectrum probe is considered to have passed the absorbance stability test; The spectrum probe that passes both the absorbance repeatability test and the absorbance stability test is regarded as a qualified spectrum probe.

3. The method for constructing a COD soft-sensing model based on ultraviolet-visible absorption spectroscopy according to claim 2, characterized in that: The Pearson coefficient r is expressed as: Among them, x i With y i Represents two different sets of full-band spectral data, and Respectively represent x i With y i The average value of , r represents the Pearson coefficient. When the r value is greater than 0.99, it is considered that the Pearson coefficients of the two sets of full-band spectral data meet the correlation requirements.

4. The method for constructing a COD soft-sensing model based on ultraviolet-visible absorption spectroscopy according to claim 1, characterized in that: The step S2 comprises: Spectral data of water samples with different components are collected through qualified spectral probes. Spectral data of water samples with the same component are collected multiple times and the average value is taken as the spectral data of the water sample. The spectral data is the absorption spectral data of the water sample in the full band. The spectral data is denoised and combined with the concentration value corresponding to the water sample to form a water sample sample. A database is constructed through multiple groups of water samples.

5. The method for constructing a COD soft-sensing model based on ultraviolet-visible absorption spectroscopy according to claim 1, characterized in that: The step S3 comprises: S31, randomly selecting a certain number of spectral data from the database as a calibration set to establish a PLS model each time, and taking the percentage of the absolute value of the regression coefficient in the PLS model of each sampling process as an importance index of the variable, wherein the variable refers to the data of the absorbance of a certain characteristic wavelength in the spectral data; S32, using an exponential decay function to remove variables with relatively small percentages of absolute values ​​of regression coefficients, to obtain a proportion of retained variables; S33, determining the number of sampling variables according to the proportion of retained variables, performing resampling PLS modeling, and calculating the cross-validation root mean square error; S34, performing cyclic calculation according to the set number of cyclic iterations to obtain multiple variable combinations and multiple cross-validation root mean square errors, and selecting the variable combination with the smallest cross-validation root mean square error as the training sample set of the prediction model.

6. The method for constructing a COD soft-sensing model based on ultraviolet-visible light absorption spectrum according to claim 5 is characterized in that: When the PLS model is established for the i-th sampling, the proportion of retained variables r i for: r i =ae -ki a=(P / 2) 1 / (N-1) k=ln(P / 2) / (N-1) Among them, r i is the ratio of retained variables at the i-th sampling, i∈(0,N) is the number of loop iterations, N is the maximum number of loop iterations, a and k are constants, and P is all variables.

Citation Information

Cited By

  • Chemical oxygen demand (COD) sensor based on six-wavelength light-emitting diode (LED) and suspended matter interference dynamic correction method thereof

    CN120232830A

  • COD sensor based on six-wavelength LED and its suspended matter interference dynamic correction method

    CN120232830B