A method and system for detecting heavy metals in groundwater
By combining differential pulse stripping voltammetry, penalized least squares method and support vector machine model, the detection error problem caused by environmental factor differences in existing technologies is solved, and high-precision in-situ quantitative detection of heavy metals in groundwater is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI RES INST OF CHEM IND CO LTD
- Filing Date
- 2022-09-27
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies lack portable, high-precision in-situ equipment and methods for detecting heavy metals in groundwater, and the standard comparison method cannot effectively overcome detection errors caused by differences in environmental factors, thus affecting detection accuracy.
Differential pulse stripping voltammetry was used for analysis, and data denoising was performed by combining penalized least squares method and window moving polynomial fitting method. Support vector machine model was used to correct for the influence of environmental factors, and model parameters were optimized by reptile search algorithm to achieve high-precision detection.
It achieves high-precision in-situ quantitative detection, simplifies operation procedures, eliminates the influence of environmental factors on detection results, and improves the accuracy of detection equipment.
Smart Images

Figure CN115561282B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of heavy metal detection technology in groundwater, and in particular to a method and system for detecting heavy metals in groundwater. Background Technology
[0002] The situation of heavy metal pollution in groundwater in my country is becoming increasingly serious. Currently, there is a lack of portable, high-precision in-situ detection technology and equipment for heavy metals in groundwater in both domestic and international markets. This technological shortcoming seriously restricts the development of groundwater pollution prevention and control work in my country.
[0003] Anodic stripping voltametry (ASV) is one of the most promising technical methods to solve the above problems. However, most of the existing ASV groundwater heavy metal detection equipment uses the standard comparison method for analysis, that is, firstly, blank samples and standard samples of specific concentrations are analyzed for calibration; then, the calibrated ASV detection equipment is used to directly analyze multiple groundwater samples collected from the ground. However, the above method can only achieve preliminary detection of heavy metals in groundwater. The main reasons are: (1) The substrates of the standard samples used are different from those of the actual groundwater samples, especially the groundwater environmental factors are too different. The dissolution peak current intensity of typical heavy metal ions is affected not only by ion strength but also by environmental factors. Among the many environmental factors, pH, conductivity, redox potential, temperature and turbidity have the greatest impact; (2) According to the results of Earth water culture research, the form of typical heavy metal ions in groundwater will change under different environmental factors, thus affecting the true detection results.
[0004] Therefore, it is necessary to combine intelligent algorithms to correct and compensate for environmental factors, thereby improving the accuracy of ASV in detecting typical heavy metal ions. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the existing technology and provide a method and system for detecting heavy metals in groundwater. The invention performs noise reduction and basis subtraction on the data to obtain pure current leaching peak data. Furthermore, it corrects the influence of environmental factors on the detection results of typical heavy metals by using a support vector machine model. This ensures that the detection results of typical heavy metals in groundwater are closer to the actual situation of groundwater, guarantees high-precision detection, and achieves in-situ quantitative detection.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] A method for detecting heavy metals in groundwater includes the following steps:
[0008] S1. Set the parameters for the ASV detection device;
[0009] S2. Collect groundwater samples, use the ASV detection device to detect the groundwater samples, obtain environmental factor data of the groundwater samples, and obtain current dissolution peak data of typical heavy metal elements to be tested in the groundwater samples.
[0010] S3. Perform preprocessing and correction on the current dissolution peak data, including primary substrate subtraction, smoothing and noise reduction, and secondary substrate subtraction.
[0011] S4. Using environmental factor data and pre-processed corrected current leaching peak data as input, a trained machine learning model is used to correct and compensate for heavy metal detection data, and the corrected groundwater heavy metal concentration measurement results are obtained.
[0012] Furthermore, in step S1, the ASV detection device uses differential pulse stripping voltammetry for analysis, and the parameters that need to be set include: enrichment time, enrichment voltage, starting voltage, ending voltage, pulse period, amplitude, and sampling frequency.
[0013] Furthermore, in step S2, environmental factor data of the groundwater sample are measured using the sensors mounted on the ASV detection device, including temperature, conductivity, redox potential, turbidity, and pH.
[0014] Furthermore, in step S3, the first and second basis subtraction methods employ penalized least squares, as follows:
[0015] Step 1: Initialize parameters, including maximum number of iterations and smoothing parameters. and weighting coefficients The weighting coefficient The basic form is: ,in, For current dissolution peak data Length;
[0016] Step 2: Set the initial weights Substituting the other parameters into the following formula, we perform penalized least squares fitting of the baseline data, as follows:
[0017]
[0018] in, It is a second-order difference matrix. This represents the transpose of a second-order difference matrix. This represents the current dissolution peak data of the typical heavy metal element to be measured. Baseline data;
[0019] Step 3: Adjust the weighting coefficients. Update 1, 2, ... And calculate the change in weight coefficients before and after the update. :
[0020]
[0021]
[0022] Among them, superscript Used to identify the first iteration The function is used to calculate the norm;
[0023] Step 4, if If the change is less than the preset threshold, the iteration ends, and the baseline data for this iteration is output as the optimal baseline, along with the current dissolution peak data after subtracting the optimal baseline. , Otherwise, repeat steps 2-4 with the updated weighting coefficients.
[0024] Furthermore, in step S3, the smoothing and noise reduction employs a window-shifting polynomial fitting method with adaptive parameter selection, as follows:
[0025] Step a: For the current dissolution peak data after primary substrate subtraction, extract the noise data, peak width, and peak height, where the peak width... The width and height of the dissolution peaks are... For dissolution peak height, noise data for:
[0026]
[0027] This represents the current dissolution peak data after one substrate subtraction. 1, 2, ... , The length of the current dissolution peak data;
[0028] Step b: Based on the noise data, peak width, and peak height, generate a set of noise-free simulation signals using a Gaussian function. The simulation signals are as follows:
[0029]
[0030] In the formula, Potential, Peak potential, It can be determined based on the peak height;
[0031] Step c: Process the simulation signal using a window moving polynomial fitting iterative algorithm to determine the window width and polynomial order;
[0032] Step d: Using the window width and polynomial order determined in step c, perform window-shifting polynomial fitting to denoise and smooth the current dissolution peak data after first-substrate subtraction.
[0033] Furthermore, in step c, the current data is processed using a window-shifting polynomial fitting iterative algorithm as follows:
[0034] Step 1: Initialize the window width and polynomial order, set the width search step size and the termination width, set the order search step size and the termination order, and establish a search grid. Each cell in the search grid is a combination of the window width and the polynomial order.
[0035] Step 2: Select one cell element in the search grid, determine the current window width and polynomial order, process the simulated signal current data using the current window width and polynomial order, perform polynomial fitting within the window, retain the center point data and replace the original data within the window, traverse the entire simulated signal in turn, and calculate the signal-to-noise ratio corresponding to the current window width and polynomial order.
[0036] Step 3: Repeat step 2 until the signal-to-noise ratio calculation of all window width + polynomial order combinations is completed. Find the window width + polynomial order combination that maximizes the signal-to-noise ratio and output it.
[0037] Furthermore, in step S4, given the training sample set... The machine learning model is a support vector machine (SVM) model, and the SVM regression model is represented as follows:
[0038]
[0039] in, This represents the input data to the support vector machine, namely environmental factor data and preprocessed and corrected current dissolution peak data. This indicates the concentration of heavy metals in groundwater. This indicates the number of samples in the training sample set. For the output of the support vector machine, and To find the parameters of the support vector machine model, solve for the support vector machine regression model, such that... as close as possible The problem is transformed into:
[0040]
[0041] in, As a penalty factor, The sensitivity loss function;
[0042] The above problem is transformed into a solution using the duality of the Lagrange function. The solution is as follows:
[0043]
[0044] in, and For Lagrange multipliers, introduce kernel functions that satisfy the Mercer condition. Replace the inner product operation in the above formula The kernel function is as follows:
[0045]
[0046] Where p is the kernel parameter of the Gaussian kernel function.
[0047] Furthermore, the penalty factor and kernel parameters of the support vector machine model are determined using a reptilian search algorithm, as follows:
[0048] Step ①: Initialization phase. Initialize the initial position of each candidate solution group. The candidate solution group includes multiple candidate solutions. The position of a single candidate solution corresponds to the penalty factor and kernel parameter, respectively. Set the maximum number of iterations and the upper and lower bounds of the positions of each dimension of the candidate solution. The initialization formula is as follows:
[0049]
[0050] Indicates the first The candidate solution of the nth The initial position of the dimension. A random number between (0,1) For the first The upper limit of the position of the dimension, For the first The lower bound of the position;
[0051] Step 2: Calculate the fitness value of each candidate solution, update the individual historical extreme values of each candidate solution, and if the pre-set convergence condition is met, proceed to step 5; otherwise, proceed to step 3.
[0052] Step 3: For , , , and The update is performed using the following formula:
[0053]
[0054] in, Indicates the current iteration number. Indicates the first During the nth iteration The average position of the candidate solutions For the first The positions of the candidate solutions. The number of dimensions at which candidate solutions are located;
[0055]
[0056] in, Indicates the first The best solution and the current solution at the nth iteration Percentage difference in dimensional position, For sensitive parameters, The best solution of the candidate solution group Dimensional position, It is a relatively small constant;
[0057]
[0058] in, Indicates the first During the nth iteration The candidate solution of the nth The hunting factor corresponding to the dimensional position;
[0059]
[0060] in, This represents a reduction function. is a random integer between [1, N], where N is the number of candidate solutions in the candidate solution group;
[0061]
[0062] in, Indicates evolutionary factors. The value is a random number between (-1, 1), and T is the maximum number of iterations set.
[0063] Step 4: Update the position of each candidate solution in the candidate solution group, repeating step 2, where the position update method is as follows:
[0064] when hour,
[0065]
[0066] in, For sensitive parameters, A random number between (0,1);
[0067] when hour,
[0068]
[0069] in is a random integer between [1, N], where N is the number of candidate solutions in the candidate solution group;
[0070] when hour,
[0071]
[0072] when hour,
[0073]
[0074] Step 5: The candidate solution whose fitness value reaches the historical extreme value is taken as the optimal solution. The position of the candidate solution is the determined optimal penalty factor and optimal kernel parameter.
[0075] Furthermore, in step ②, the fitness value of the candidate solution is calculated as follows:
[0076] The positions of candidate solutions are obtained, and the corresponding penalty factors and kernel parameters are substituted into the support vector machine model. The support vector machine model is trained using the training sample set. The support vector machine model is tested using a pre-built test set, and the root mean square error is used as the fitness value.
[0077] A groundwater heavy metal detection system includes an ASV detection device, a parameter setting module, a data acquisition module, a data preprocessing module, and a calibration module.
[0078] The parameter setting module is used to set the parameters of the ASV detection device;
[0079] When collecting groundwater samples and using the ASV detection device to detect the groundwater samples, the data acquisition module obtains environmental factor data and current dissolution peak data of typical heavy metal elements to be tested in the groundwater samples.
[0080] The data preprocessing module is used to preprocess and correct the current dissolution peak data, including primary substrate subtraction, smoothing and noise reduction, and secondary substrate subtraction.
[0081] The calibration module is equipped with a trained machine learning model. The input of the machine learning model is environmental factor data and preprocessed calibration current leaching peak data, and the output is the calibration result of groundwater heavy metal concentration measurement.
[0082] Compared with the prior art, the present invention has the following beneficial effects:
[0083] (1) Noise reduction and basis subtraction were performed on the data to obtain pure current leaching peak data. The influence of environmental factors on the detection results of typical heavy metals was corrected by the support vector machine model. This can ensure that the detection results of typical heavy metals in groundwater are closer to the actual situation of groundwater, ensure high-precision detection, and realize in-situ quantitative detection.
[0084] (2) The penalty least squares algorithm can effectively fit the base, i.e. the baseline, to form a smooth baseline that moves along the bottom of the real baseline, ensuring the maximum reduction of the base and obtaining pure feature peaks, which is better than the base reduction method that uses inflection point interpolation fitting.
[0085] (3) Adaptive window moving polynomial fitting method is used to smooth and denoise the data. This method can adaptively select the appropriate window width and polynomial order for the data to be processed, so as to ensure the maximum removal of noise information. It does not require manual intervention and has a high degree of intelligence.
[0086] (4) A nonlinear model of support vector machine, one of the machine learning algorithms, was constructed to correct environmental factors (pH, temperature, conductivity, redox potential and turbidity), effectively compensating for the influence of environmental factors on ASV detection results, further improving the precision of ASV detection, so that while meeting the requirements of on-site in-situ detection, high-precision results are obtained, making the detection results close to the true value and restoring the true groundwater situation.
[0087] (5) It supports the use of the Reptile Search Algorithm (RSA) to optimize the selection of the penalty factor and kernel parameters of the support vector machine. It has low space and time complexity and effectively avoids the problems of long training time and large storage space required during model training. At the same time, after optimizing the values of the penalty factor and kernel parameters, the prediction accuracy of the model can be effectively improved, thereby improving the detection accuracy of the ASV detection equipment.
[0088] (6) By applying this application, the ASV detection equipment does not need to analyze blank samples and standard samples on site, which simplifies the operation steps of the ASV analysis equipment and enables the ASV equipment to directly measure unknown samples. At the same time, it can effectively eliminate the influence of environmental factors on the detection results of typical heavy metal ions. Attached Figure Description
[0089] Figure 1 This is a flowchart of a method for detecting heavy metals in groundwater. Detailed Implementation
[0090] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are implemented based on the technical solutions of the present invention, providing detailed implementation methods and specific operating procedures. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them, and the scope of protection of the present invention is not limited to the following embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0091] As used herein, "an embodiment" or "embodiment" refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the invention. In the description of the invention, it should be understood that the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0092] This specification provides method operation steps as shown in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operation steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only execution order. In actual system or server products, the method can be executed in the order shown in the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment), or the execution order of steps without timing constraints can be adjusted.
[0093] Example 1:
[0094] A method for detecting heavy metals in groundwater, such as Figure 1 As shown, it includes the following steps:
[0095] S1. Set the parameters for the ASV detection device;
[0096] The ASV detection device uses differential pulse stripping voltammetry for analysis. The parameters that need to be set include: enrichment time, enrichment voltage, start voltage, end voltage, pulse period, amplitude, and sampling frequency. The ASV detection device is equipped with a sensor.
[0097] S2. Collect groundwater samples, use the ASV detection device to detect the groundwater samples, obtain environmental factor data of the groundwater samples, and obtain current dissolution peak data of typical heavy metal elements to be tested in the groundwater samples.
[0098] Groundwater samples can be collected from groundwater monitoring wells, and environmental factor data of the groundwater samples, including temperature, conductivity, oxidation-reduction potential, turbidity, and pH, can be measured using temperature sensors, conductivity sensors, oxidation-reduction potential sensors, turbidity sensors, and pH sensors mounted on the ASV detection device.
[0099] S3. Perform preprocessing and correction on the current dissolution peak data, including primary substrate subtraction, smoothing and noise reduction, and secondary substrate subtraction.
[0100] After obtaining the leaching peak current data of typical heavy metals through the ASV detection device, the current data is preprocessed and corrected using a correction method. First, a base subtraction is performed, then smoothing and noise reduction are performed, and finally a second base subtraction is performed to obtain the purest current intensity data.
[0101] (1) The first and second basis subtraction methods adopt the penalized least squares method, as follows:
[0102] Step 1: Initialize parameters, including maximum number of iterations and smoothing parameters. and weighting coefficients Weighting coefficient The basic form is: ,in, For current dissolution peak data The length; in this embodiment, the maximum number of iterations is set to 100, and the smoothing parameter is set to 10. 4 , superscript Used to identify the first The next iteration.
[0103] Step 2: Set the initial weights Substituting the other parameters into the following formula, we perform penalized least squares fitting of the baseline data, as follows:
[0104]
[0105] in, It is a second-order difference matrix. This represents the transpose of a second-order difference matrix. This represents the current dissolution peak data of the typical heavy metal element to be measured. Baseline data;
[0106] Step 3: Adjust the weighting coefficients. Update 1, 2, ... And calculate the change in weight coefficients before and after the update. :
[0107]
[0108]
[0109] Among them, superscript Used to identify the first iteration The function is used to calculate the norm;
[0110] Step 4, if If the change is less than the preset threshold, the iteration ends, and the baseline data for this iteration is output as the optimal baseline, along with the current dissolution peak data after subtracting the optimal baseline. , Otherwise, steps 2-4 are repeated with the updated weighting coefficients to recalculate the baseline data. In this embodiment, the change threshold is set to 0.001.
[0111] (2) Smoothing and noise reduction adopts the window moving polynomial fitting method with adaptive parameter selection, as follows:
[0112] Step a: For the current dissolution peak data after primary substrate subtraction, extract the noise data, peak width, and peak height, where the peak width... The width and height of the dissolution peaks are... For dissolution peak height, noise data for:
[0113]
[0114] This represents the current dissolution peak data after one substrate subtraction. 1, 2, ... , The length of the current dissolution peak data;
[0115] Step b: Based on the noise data, peak width, and peak height, generate a set of noise-free simulation signals using a Gaussian function. The simulation signals are as follows:
[0116]
[0117] In the formula, Potential, Peak potential, It can be determined based on the peak height;
[0118] Step c: Process the simulation signal using a window-moving polynomial fitting iterative algorithm to determine the window width and polynomial order, as detailed below:
[0119] Step 1: Initialize the window width and polynomial order, set the width search step size and the ending width, set the order search step size and the ending order, and establish a search grid. Each cell in the search grid represents a combination of the window width and the polynomial order. In this embodiment, the initial window width is set to 3, the initial polynomial order is set to 2, the width search step size is set to 2 (meaning the window width increases by a step of 2), the ending width is set to 21 (meaning the maximum window width is 21), the order search step size is set to 1 (meaning the order increases by a step of 1), and the ending order is set to the window width - 1. Based on this, the combinations of window width and polynomial order in the determined search grid are: {3,2}; {5,2}; {5,3 ... 4};{7,2};{7,3};{7,4};{7,5};{7,6};{9,2};{9,3};…;{21,18};{21,19};{21,20};In other implementations, the window width, the initial value of the polynomial order, the step size, and the termination value are adjusted according to the actual situation.
[0120] Step 2: Select one cell element in the search grid, determine the current window width and polynomial order, process the simulated signal current data using the current window width and polynomial order, perform polynomial fitting within the window, retain the center point data and replace the original data within the window, traverse the entire simulated signal in turn, and calculate the signal-to-noise ratio corresponding to the current window width and polynomial order.
[0121] Step 3: Repeat step 2 until the signal-to-noise ratio calculation of all window width + polynomial order combinations is completed, and find the window width + polynomial order combination that maximizes the signal-to-noise ratio.
[0122] In the algorithm implementation, a three-level loop can be set up. The first level increases the window width by a step size. The second level determines the termination order based on the current window width and increases the polynomial order by a step size. The third level iterates through the entire simulation signal based on the window width and the polynomial order to obtain the signal-to-noise ratio (SNR) corresponding to the current window width and polynomial order. After the loops are completed, the combination of window width and polynomial order that yields the highest SNR is found.
[0123] Step d: Using the window width and polynomial order determined in step c, perform window-shifting polynomial fitting to denoise and smooth the current dissolution peak data after first-substrate subtraction.
[0124] S4. Using environmental factor data and pre-processed corrected current leaching peak data as input, a trained machine learning model is used to correct and compensate for heavy metal detection data, and the corrected groundwater heavy metal concentration measurement results are obtained.
[0125] In step S4, given the training sample set The machine learning model used in this application is a support vector machine model, and the support vector machine regression model is represented as follows:
[0126]
[0127] in, This represents the input data to the support vector machine, namely environmental factor data and preprocessed and corrected current dissolution peak data. This indicates the concentration of heavy metals in groundwater. This indicates the number of samples in the training sample set. For the output of the support vector machine, and For support vector machine model parameters;
[0128] I hope to learn a regression model that makes as close as possible , and For the parameters to be determined, the problem is transformed into:
[0129]
[0130] in, As a penalty factor, The sensitivity loss function;
[0131] The above problem is transformed into a solution using the duality of the Lagrange function. The solution is as follows:
[0132]
[0133] in, and To achieve nonlinear fitting of SVM, a kernel function satisfying the Mercer condition needs to be introduced, which is a Lagrange multiplier. Replace the inner product operation in the above formula The kernel function chosen is the Gaussian kernel function (RBF), as follows:
[0134]
[0135] Where p is the kernel parameter of the Gaussian kernel function.
[0136] The training sample set can be collected experimentally. First, prepare samples with known heavy metal ion concentrations to determine the concentration of heavy metal elements. Then, an ASV detection device was used to detect environmental factors and current leaching peak data of typical heavy metal elements in the groundwater sample. The current leaching peak data were preprocessed and corrected (first basis subtraction, smoothing and noise reduction, and second basis subtraction) to determine the environmental factors and the preprocessed and corrected current leaching peak data. By changing the concentration of the sample and performing multiple measurements and preprocessing corrections, multiple sets of environmental factor data, preprocessed and corrected current leaching peak data, and heavy metal element concentration values were obtained as a training sample set.
[0137] Generally, in addition to the training sample set, a test set and a validation set are needed to test the support vector machine model and verify its accuracy. Similarly, test and validation sets can be constructed, the support vector machine model can be trained using the training sample set first, and then evaluated using the test and validation sets, until a satisfactory support vector machine model is obtained.
[0138] Understandably, many parameters of a Support Vector Machine (SVM) are determined empirically or randomly. Iteratively updating these parameters to find the optimal combination requires significant time, effort, and computational resources. To address this issue, some have proposed using grid search to determine the optimal SVM parameters (penalty factor and kernel parameters). However, grid search methods suffer from high time and space complexity and computational cost. Therefore, in this application, the penalty factor and kernel parameters of the SVM model are determined using the Reptile Search Algorithm (RSA), a global optimization algorithm. The RSA algorithm is as follows:
[0139] Step ①: Initialization phase. Initialize the initial position of each candidate solution group. The candidate solution group includes multiple candidate solutions. The position of a single candidate solution corresponds to the penalty factor and kernel parameter, respectively. Set the maximum number of iterations and the upper and lower bounds of the positions of each dimension of the candidate solution. The initialization formula is as follows:
[0140]
[0141] Indicates the first The candidate solution of the nth In this application, the initial position of the candidate solution includes two dimensions. The positions of the two dimensions correspond to the penalty factor and kernel parameters of the support vector machine model, respectively. A random number between (0,1) For the preset first The upper limit of the position of the dimension, For the preset first The lower bound of the position;
[0142] Step 2: Calculate the fitness value of each candidate solution, update the individual historical extreme values of each candidate solution, and if the pre-set convergence condition is met, proceed to step 5; otherwise, proceed to step 3.
[0143] The fitness value of a candidate solution is calculated as follows:
[0144] The positions of candidate solutions are obtained, and the corresponding penalty factors and kernel parameters are substituted into the support vector machine model. The support vector machine model is trained using the training sample set. The support vector machine model is tested using a pre-built test set, and the total root mean square error is used as the fitness value.
[0145] Convergence conditions can be set as needed, such as reaching the maximum number of iterations, or the emergence of a better candidate solution, i.e., the fitness value of the candidate solution is lower than the set value, etc.
[0146] Step 3: For , , , and The update is performed using the following formula:
[0147]
[0148] in, Indicates the current iteration number. Indicates the first During the nth iteration The average position of the candidate solutions For the first The positions of the candidate solutions. The number of dimensions at which candidate solutions are located;
[0149]
[0150] in, Indicates the first The best solution and the current solution at the nth iteration Percentage difference in dimensional position, For sensitive parameters, The best solution of the candidate solution group Dimensional position, It is a relatively small constant;
[0151]
[0152] in, Indicates the first During the nth iteration The candidate solution of the nth The hunting factor corresponding to the dimensional position;
[0153]
[0154] in, This represents a reduction function. is a random integer between [1, N], where N is the number of candidate solutions in the candidate solution group;
[0155]
[0156] in, Indicates evolutionary factors. The value is a random number between (-1, 1), and T is the maximum number of iterations set.
[0157] Step 4: Update the position of each candidate solution in the candidate solution group, repeating step 2, where the position update method is as follows:
[0158] when hour,
[0159]
[0160] in, For sensitive parameters, A random number between (0,1);
[0161] when hour,
[0162]
[0163] in is a random integer between [1, N], where N is the number of candidate solutions in the candidate solution group;
[0164] when hour,
[0165]
[0166] when hour,
[0167]
[0168] Step 5: The candidate solution whose fitness value reaches the historical extreme value is taken as the optimal solution. The position of the candidate solution is the determined optimal penalty factor and optimal kernel parameter.
[0169] This invention performs a first-stage matrix subtraction, noise reduction, and a second-stage matrix subtraction on the acquired typical heavy metal leaching peak current data of ASV to obtain the characteristic peaks of typical heavy metal elements. The invention also uses a well-established RSA algorithm-optimized support vector machine nonlinear model to correct the influence of environmental factors (pH, temperature, conductivity, redox potential, and turbidity) on the ASV detection results, effectively improving the accuracy of the detection data and eliminating the need for on-site re-analysis of standard samples.
[0170] This application also provides a groundwater heavy metal detection system, including an ASV detection device, a parameter setting module, a data acquisition module, a data preprocessing module, and a calibration module;
[0171] The parameter setting module is used to set the parameters of the ASV detection device;
[0172] When collecting groundwater samples and using the ASV detection device to test the groundwater samples, the data acquisition module obtains environmental factor data and current dissolution peak data of typical heavy metal elements to be tested in the groundwater samples.
[0173] The data preprocessing module is used to preprocess and correct the current dissolution peak data, including primary substrate subtraction, smoothing and noise reduction, and secondary substrate subtraction.
[0174] The calibration module is equipped with a pre-trained machine learning model. The input of the machine learning model is environmental factor data and pre-processed and calibrated current leaching peak data, and the output is the calibrated groundwater heavy metal concentration measurement results.
[0175] The first-order basis subtraction, smoothing and noise reduction, and second-order basis subtraction in the data preprocessing module have been detailed above and will not be repeated here. The machine learning model in the correction module is a support vector machine model, and its training and parameter determination have been detailed above and will not be repeated here.
[0176] This application can provide end-to-end adaptive monitoring, as follows:
[0177] 1) Set the equipment detection parameters, place the ASV monitoring sensor into the groundwater monitoring well, start the equipment, and the equipment will enter the working state;
[0178] 2) According to the set parameters, detect the environmental factors of groundwater (pH, conductivity, redox potential, temperature and turbidity) and detect the current dissolution peak data of typical heavy metal ions in groundwater;
[0179] 3) Adaptive window polynomial fitting and penalized least squares method are used to automatically perform two basis subtraction and smoothing noise reduction on the current dissolution peak data to obtain clean data;
[0180] 4) Using the corrected current leaching peak data and the environmental factors (pH, conductivity, redox potential, temperature and turbidity) data detected by the sensor as input factors, the established RSA algorithm-optimized support vector machine nonlinear model is loaded into the system to correct and compensate the heavy metal detection data, and the corrected data is stored and displayed.
[0181] 5) After the test is completed, the data is summarized and visualized to allow users to clearly understand the distribution of heavy metals in the groundwater of the project site.
[0182] It should be noted that this application can be implemented in software and / or a combination of software and hardware, for example, using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In one embodiment, the software program of this application can be executed by a processor to implement the data preprocessing correction and machine learning model training and application steps or functions described above. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium, such as RAM memory, magnetic or optical drives, floppy disks, and similar devices. Furthermore, some steps or functions of this application can be implemented in hardware, for example, as circuitry that works with a processor to perform the various steps or functions.
[0183] Furthermore, a portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. The program instructions invoking the methods of this application may be stored in a fixed or removable recording medium, and / or transmitted via data streams in broadcast or other signal carrying media, and / or stored in the working memory of a computer device operating according to the program instructions. Here, one embodiment of this application includes an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein, when the computer program instructions are executed by the processor, the apparatus is triggered to operate the methods and / or technical solutions based on the foregoing embodiments of this application.
[0184] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A method for detecting heavy metals in groundwater, characterized in that, Includes the following steps: S1. Set the parameters for the ASV detection device; S2. Collect groundwater samples, use the ASV detection device to detect the groundwater samples, obtain environmental factor data of the groundwater samples, and obtain current dissolution peak data of typical heavy metal elements to be tested in the groundwater samples. S3. Perform preprocessing and correction on the current dissolution peak data, including primary substrate subtraction, smoothing and noise reduction, and secondary substrate subtraction. S4. Using environmental factor data and pre-processed corrected current leaching peak data as input, the trained machine learning model is used to correct and compensate the heavy metal detection data to obtain the corrected groundwater heavy metal concentration measurement results. In step S4, given the training sample set The machine learning model is a support vector machine (SVM) model, and the SVM regression model is represented as follows: in, This represents the input data to the support vector machine, namely environmental factor data and preprocessed and corrected current dissolution peak data. This indicates the concentration of heavy metals in groundwater. This indicates the number of samples in the training sample set. For the output of the support vector machine, and To find the parameters of the support vector machine model, solve for the support vector machine regression model, such that... as close as possible The problem is transformed into: in, As a penalty factor, The sensitivity loss function; The above problem is transformed into a solution using the duality of the Lagrange function. The solution is as follows: in, and For Lagrange multipliers, introduce kernel functions that satisfy the Mercer condition. Replace the inner product operation in the above formula The kernel function is as follows: Where p is the kernel parameter of the Gaussian kernel function; The penalty factor and kernel parameters of the support vector machine model are determined using a reptilian search algorithm, as follows: Step ①: Initialization phase. Initialize the initial position of each candidate solution group. The candidate solution group includes multiple candidate solutions. The position of a single candidate solution corresponds to the penalty factor and kernel parameter, respectively. Set the maximum number of iterations and the upper and lower bounds of the positions of each dimension of the candidate solution. The initialization formula is as follows: Indicates the first The candidate solution of the nth The initial position of the dimension. A random number between (0,1) For the first The upper limit of the position of the dimension, For the first The lower bound of the position; Step 2: Calculate the fitness value of each candidate solution, update the individual historical extreme values of each candidate solution, and if the pre-set convergence condition is met, proceed to step 5; otherwise, proceed to step 3. Step 3: For , , , and The update is performed using the following formula: in, Indicates the current iteration number. Indicates the first During the nth iteration The average position of the candidate solutions For the first The positions of the candidate solutions. The number of dimensions at which candidate solutions are located; in, Indicates the first The best solution and the current solution at the nth iteration Percentage difference in dimensional position, For sensitive parameters, The best solution of the candidate solution group Dimensional position, It is a relatively small constant; in, Indicates the first During the nth iteration The candidate solution of the nth The hunting factor corresponding to the dimensional position; in, This represents a reduction function. is a random integer between [1, N], where N is the number of candidate solutions in the candidate solution group; in, Indicates evolutionary factors. The value is a random number between (-1, 1), and T is the maximum number of iterations set. Step 4: Update the position of each candidate solution in the candidate solution group, repeating step 2. The position update method is as follows: when hour, in, For sensitive parameters, A random number between (0,1); when hour, in is a random integer between [1, N], where N is the number of candidate solutions in the candidate solution group; when hour, when hour, Step 5: The candidate solution whose fitness value reaches the historical extreme value is taken as the optimal solution. The position of the candidate solution is the determined optimal penalty factor and optimal kernel parameter. In step ②, the fitness value of the candidate solution is calculated as follows: The positions of candidate solutions are obtained, and the corresponding penalty factors and kernel parameters are substituted into the support vector machine model. The support vector machine model is trained using the training sample set. The support vector machine model is tested using a pre-built test set, and the root mean square error is used as the fitness value.
2. The method for detecting heavy metals in groundwater according to claim 1, characterized in that, In step S1, the ASV detection device uses differential pulse stripping voltammetry for analysis. The parameters that need to be set include: enrichment time, enrichment voltage, starting voltage, ending voltage, pulse period, amplitude, and sampling frequency.
3. The method for detecting heavy metals in groundwater according to claim 1, characterized in that, In step S2, environmental factor data of the groundwater sample are measured using the sensors mounted on the ASV detection device, including temperature, conductivity, redox potential, turbidity, and pH.
4. The method for detecting heavy metals in groundwater according to claim 1, characterized in that, In step S3, the first and second basis subtraction methods employ penalized least squares, as follows: Step 1: Initialize parameters, including maximum number of iterations and smoothing parameters. and weighting coefficients The weighting coefficient The basic form is: ,in, For current dissolution peak data Length; Step 2: Set the initial weights Substituting the other parameters into the following formula, we perform penalized least squares fitting of the baseline data, as follows: in, It is a second-order difference matrix. This represents the transpose of a second-order difference matrix. This represents the current dissolution peak data of the typical heavy metal element to be measured. Baseline data; Step 3: Adjust the weighting coefficients. Update 1, 2, ... And calculate the change in weight coefficients before and after the update. : Among them, superscript Used to identify the first iteration The function is used to calculate the norm; Step 4, if If the change is less than the preset threshold, the iteration ends, and the baseline data for this iteration is output as the optimal baseline, along with the current dissolution peak data after subtracting the optimal baseline. , Otherwise, repeat steps 2-4 with the updated weighting coefficients.
5. The method for detecting heavy metals in groundwater according to claim 1, characterized in that, In step S3, the smoothing and noise reduction adopts the window-shifting polynomial fitting method with adaptive parameter selection, as follows: Step a: For the current dissolution peak data after primary substrate subtraction, extract the noise data, peak width, and peak height, where the peak width... The width and height of the dissolution peaks are... For dissolution peak height, noise data for: This represents the current dissolution peak data after one substrate subtraction. 1, 2, ... , The length of the current dissolution peak data; Step b: Based on the noise data, peak width, and peak height, generate a set of noise-free simulation signals using a Gaussian function. The simulation signals are as follows: In the formula, Potential, Peak potential, It can be determined based on the peak height; Step c: Process the simulation signal using a window moving polynomial fitting iterative algorithm to determine the window width and polynomial order; Step d: Using the window width and polynomial order determined in step c, perform window-shifting polynomial fitting to denoise and smooth the current dissolution peak data after first-substrate subtraction.
6. The method for detecting heavy metals in groundwater according to claim 5, characterized in that, In step c, the current data is processed using a window-shifting polynomial fitting iterative algorithm as follows: Step 1: Initialize the window width and polynomial order, set the width search step size and the termination width, set the order search step size and the termination order, and establish a search grid. Each cell in the search grid is a combination of the window width and the polynomial order. Step 2: Select one cell element in the search grid, determine the current window width and polynomial order, process the simulated signal current data using the current window width and polynomial order, perform polynomial fitting within the window, retain the center point data and replace the original data within the window, traverse the entire simulated signal in turn, and calculate the signal-to-noise ratio corresponding to the current window width and polynomial order. Step 3: Repeat step 2 until the signal-to-noise ratio calculation of all window width + polynomial order combinations is completed. Find the window width + polynomial order combination that maximizes the signal-to-noise ratio and output it.
7. A system for implementing the method for detecting heavy metals in groundwater as described in any one of claims 1-6, characterized in that, It includes an ASV detection device, a parameter setting module, a data acquisition module, a data preprocessing module, and a calibration module; The parameter setting module is used to set the parameters of the ASV detection device; When collecting groundwater samples and using the ASV detection device to detect the groundwater samples, the data acquisition module obtains environmental factor data and current dissolution peak data of typical heavy metal elements to be tested in the groundwater samples. The data preprocessing module is used to preprocess and correct the current dissolution peak data, including primary substrate subtraction, smoothing and noise reduction, and secondary substrate subtraction. The calibration module is equipped with a trained machine learning model. The input of the machine learning model is environmental factor data and preprocessed calibration current leaching peak data, and the output is the calibration result of groundwater heavy metal concentration measurement.