Rapid quantitative analysis method and system for heavy metal elements in fly ash
By combining LIBS technology with the XGBoost algorithm and introducing WOA optimization parameters, the efficiency and accuracy issues of heavy metal detection in fly ash are solved, enabling rapid and accurate analysis of fly ash resource utilization, and making it suitable for large-scale sample testing in industrial settings.
Patent Information
- Application Number
- CN202510814894.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-12-05
AI Technical Summary
Traditional methods for detecting heavy metals in fly ash suffer from problems such as cumbersome sample pretreatment, long detection cycles, and high equipment costs. Furthermore, LIBS technology is difficult to achieve accurate detection in complex matrices.
By combining laser-induced breakdown spectroscopy with the extreme gradient boosting algorithm (XGBoost) and introducing the Whale Optimization Algorithm (WOA) for parameter tuning, a quantitative analysis model for heavy metal elements in fly ash is constructed, and real-time cross-terminal analysis is achieved through a web-based interactive platform.
It enables rapid and accurate quantitative analysis of heavy metal elements in fly ash, improving detection efficiency and flexibility. It is suitable for large-scale sample testing in industrial settings, supports immediate decision-making, and provides real-time data support for the resource utilization of fly ash.
Smart Images

Figure CN121068563A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of quantitative analysis, and particularly relates to a fly ash heavy metal element rapid quantitative analysis method and system. BACKGROUND
[0002] Fly ash is a solid residue produced after the combustion of coal in power plants, industrial furnaces and large boilers. This material has a large specific surface area and high chemical activity, making it show good application prospects in catalysis, adsorption, water purification and rare metal extraction, and has been widely used in building materials and agricultural production. However, some heavy metal elements with stable chemical properties contained in fly ash may enter the environment through migration, leaching and other ways, posing a potential threat to the ecological system and human health, which limits its wider safe use. Therefore, developing accurate and efficient heavy metal detection technology has important scientific significance and practical value for environmental safety and promoting fly ash resource utilization.
[0003] In the field of fly ash composition analysis, traditional detection methods mainly rely on X-ray fluorescence spectroscopy (XRF) and inductively coupled plasma optical emission spectroscopy (ICP-OES). Although these methods have high accuracy, they generally have the disadvantages of complicated sample pretreatment steps, long detection period and high equipment cost. In recent years, laser-induced breakdown spectroscopy (LIBS) technology has attracted widespread attention due to its unique advantages. As a new detection technology based on atomic emission spectroscopy, LIBS not only has high sensitivity and high resolution, but also can realize multi-element synchronous detection, and has the advantages of rapidity, simplicity, on-site operation, non-destructive detection and other significant advantages. It has been successfully applied in soil heavy metal analysis, explosive detection and environmental monitoring and other fields.
[0004] However, LIBS technology still faces major challenges in fly ash detection. Due to the complex chemical composition of fly ash and the fluctuation of laser energy, the amount of LIBS spectral data obtained is large and the interference factors are many, and traditional single variable analysis methods are difficult to meet the requirements of accurate detection. SUMMARY
[0005] In the process of fly ash resource utilization, it is essential to accurately quantify the harmful heavy metals and beneficial elements in it. Although traditional laboratory analysis methods perform well in terms of accuracy, their time-consuming and labor-intensive nature, as well as their high dependence on specific equipment, limit their application in industrial scenarios that require rapid response and handling of large numbers of samples. The purpose of the present invention is to provide a fly ash heavy metal content rapid quantitative detection method combining laser-induced breakdown spectroscopy technology and eXtreme Gradient Boosting (XGBoost) algorithm. Considering the complex interaction relationship between multiple parameters in the XGBoost algorithm, the Whale Optimization Algorithm (WOA) is further introduced to realize efficient parameter optimization; By constructing a web-based interactive platform, the spectral analysis, model operation and data storage functions are integrated in the cloud to realize real-time analysis of fly ash components across terminals. This system not only breaks through the time and space barriers of traditional detection, but its "data transmission and analysis" feature also directly serves downstream application scenarios, providing immediate decision-making basis anytime and anywhere for subsequent resource utilization path selection. In addition, this web system is easy to operate and responds quickly, making it very suitable for rapid detection of large quantities of samples in industrial sites, greatly improving work efficiency and flexibility; The goal of the fly ash online analysis system is to help fly ash resource users quickly analyze the element content of fly ash. The online analysis system has the ability to analyze data anytime and anywhere, and can be accessed through web operations on PC and mobile phone. Users only need to log in to the system webpage through the device and upload the LIBS spectrum data table, and the system can analyze the data separately. The system's built-in model integration method will preprocess the data according to the user's selected preprocessing method, and make a quick prediction through the selected model.
[0006] The purpose of the present invention can be achieved by the following technical solutions: a fly ash heavy metal element rapid quantitative analysis method, comprising the following steps: A group of fly ash samples with known Cu content is used as calibration set samples, and LIBS spectrum is used to analyze the calibration set samples to obtain corresponding spectral data; Take the LIBS spectrum data as the independent variable and the heavy metal element content as the dependent variable, respectively, to construct an XGBoost quantitative analysis model; Optimize the XGBoost model hyperparameters based on WOA; Respectively use normalization, standard normal transformation, multivariate scatter correction, first derivative, second derivative and wavelet transform to further optimize the XGBoost model; Based on the optimal pretreatment method, an XGBoost model is constructed, and the importance value of the variable is calculated, and the feature variable most affecting the prediction is screened according to the importance value; For the test set samples, first, the LIBS spectrum is used for detection to obtain the spectrum data of the sample to be measured; then the same pretreatment and variable screening method as the calibration set samples is used; finally, the obtained spectrum data is substituted into the optimized XGBoost model to obtain the content of Cu in the test set samples.
[0007] As a further technical solution of the application: the spectral data is obtained through a self-built laser-induced breakdown spectroscopy platform.
[0008] As a further technical solution of the application: the platform mainly consists of a laser, a spectrometer, an optical fiber, a quartz lens, and an X-Y-Z three-dimensional adjustable sample stage and other equipment.
[0009] As a further technical solution of the application: the laser pulse repetition frequency and the laser energy are 1 Hz and 70 mJ respectively, and the optimal delay time and gate width are 1.5 μs and 2 ms respectively.
[0010] As a further technical solution of the application: the optimization process of the XGBoost quantitative analysis model super parameter is: According to the size of the fly ash LIBS spectrum data set, the optimization range of the XGBoost super parameters n_estimators, max_depth and learning_rate is set; Based on 5-fold cross-validation, the iteration number and the number of whales of the whale optimization algorithm are optimized; Based on the optimized whale algorithm, the XGBoost super parameters are optimized in the set range.
[0011] As a further technical solution of the application: in the further optimization process of the XGBoost model, R 2 CV and RMSE CV are used as evaluation indexes.
[0012] As a further technical solution of the application: for the determination of Cu element, the optimal pretreatment method is the first derivative method.
[0013] As a further technical solution of the application: for the determination of Cu element, the number of optimal input variables obtained is 63, 15 and 4 respectively.
[0014] As a further technical solution of the application: it further comprises the following steps: The system adopts the architecture combining Python and Java, covers the whole process from data import, preprocessing, model selection and optimization to result analysis; after the user completes the page click selection operation, the system will automatically match and execute the Python script according to the user's selection, calculate the key performance indicators including R², RMSE and MRE, and provide model parameter optimization result display and visualization chart.
[0015] A fly ash heavy metal element rapid quantitative analysis system, the system comprises: The sample data import module: after the user selects the target file through the data set entry button, the system will automatically analyze the file content and generate the corresponding spectrum in real time, so that the researcher can observe the spectral characteristics and peak distribution in real time; The model and preprocessing selection module: create a new modeling task, select the target data sample uploaded, and select the required preprocessing algorithm in the preprocessing method module; select the appropriate analysis model in the model selection area, and configure the cross-validation method and whether to use the WOA optimization algorithm for parameter optimization; The data display module: after the user completes the page click selection operation, the system will automatically match and execute the Python script according to the user's selection, calculate the key performance indicators including R², RMSE and MRE, and provide model parameter optimization result display and visualization chart.
[0016] The beneficial effects of the present application are: The present application proposes a fly ash heavy metal content rapid quantitative detection method combining laser-induced breakdown spectroscopy technology and XGBoost algorithm. Considering the complex interaction relationship between multiple parameters in the XGBoost algorithm, the whale optimization algorithm (WOA) is further introduced to realize efficient parameter tuning. The algorithm can effectively solve the optimization problem in continuous space by simulating the spiral search and surrounding predation behavior of whales, and has been successfully applied in engineering design and machine learning model tuning. The WOA algorithm has the advantages of strong global search ability, not easy to fall into local optimum, simple realization and the like. In this study, the WOA algorithm is applied to optimize the XGBoost parameters, which not only guarantees the prediction performance of the model, but also greatly shortens the time required for parameter tuning, providing a more efficient and practical technical solution for practical engineering applications.
[0017] The present application is to facilitate the resource users of fly ash to quickly analyze the element content, and further designs and develops an online analysis system for fly ash. The system adopts the architecture combining Python and Java, realizes the functions of spectrum data preprocessing, model selection, parameter optimization and result visualization. The system not only provides an efficient and real-time online analysis tool for the resource utilization of fly ash, but also provides valuable experience reference for the development of other element online analysis platforms. In addition, its successful development provides instant decision support for the selection of fly ash resource utilization path, and embodies important practical application value and broad development prospect. The core innovation of the present application is: The WOA algorithm is first introduced into the fly ash LIBS spectrum analysis, and through adaptive parameter optimization and feature selection, the detection precision problem of traditional LIBS technology in complex matrix is solved. The developed Python-Java hybrid architecture online analysis system realizes the full-process automation from data import to result visualization, and provides key technical support for industrial field application.
[0018] Multi-parameter collaborative optimization: the WOA algorithm simulates the "encircling predation" and "spiral bubble net predation" behavior mechanism of humpback whales, dynamically adjusts the key parameters such as n_estimators, max_depth and learning_rate of XGBoost, solves the problem that the traditional grid search is time-consuming and easy to fall into local optimum, and realizes higher prediction accuracy in fly ash LIBS data analysis. In addition, under the framework of 5-fold cross-validation, the number of iterations and population size of WOA are simultaneously optimized, the search step is dynamically adjusted through R2CV and RMSECV double indicators, and falling into local optimum is avoided.
[0019] Dynamic feature selection: the adaptive feature selection method based on variable importance analysis excludes the influence of fly ash matrix interference peaks, and overcomes the calculation redundancy and model overfitting problem of traditional LIBS full spectrum modeling. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0021] Figure 1 is a flowchart of a fly ash heavy metal element rapid quantitative analysis method of the present application; Figure 2 is a linear relationship diagram between test data and reference value of the present application; Figure 3is a system login interface schematic diagram of a fly ash heavy metal element rapid quantitative analysis system of the present application; Figure 4 is a data analysis interface schematic diagram of a fly ash heavy metal element rapid quantitative analysis system of the present application; Figure 5 is a module block diagram of a fly ash heavy metal element rapid quantitative analysis system of the present application. DETAILED DESCRIPTION
[0022] In order to make the personnel in the technical field better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should belong to the scope of protection of the present application.
[0023] Embodiment one As shown in the figure, the fly ash heavy metal element rapid quantitative analysis method provided by the embodiment of the present application specifically includes the following steps: Figure 1 Step 1: In this example, 30 kinds of fly ash are used, and the reference value of Cu element content is shown in Table 1. When modeling, 21 samples are selected from 30 samples as the calibration set by using KS algorithm, and the remaining 9 samples are used as the test set. It needs to be explained that: KS algorithm principle: all samples are regarded as training set candidate samples, and samples are selected from them into the training set. First, the two samples with the farthest Euclidean distance are selected into the training set, then the Euclidean distance of each sample to each known sample in the training set is calculated, the two samples farthest and closest to the selected samples are found, and the two samples are selected into the training set, and the above steps are repeated until the number of samples reaches the requirement.
[0024]
[0025]
[0026] Among them, the "*" in the above Table 1 indicates the sample selected as the test set, and the remaining samples are the calibration set; Step 2: The calibration set samples are analyzed by using LIBS spectrum to obtain the corresponding spectral data.
[0027] Specifically, the spectral data of this experiment were obtained by a self-built laser-induced breakdown spectroscopy (LIBS) platform. The platform was mainly composed of a laser emitter (Beijing Labo Photonics, Dawa 300; excitation wavelength: 1064 nm, pulse voltage: 720 V, laser frequency: 5 Hz), a spectrometer (Ocean Optics, MX2500+; wavelength range: 200-500 nm, resolution: 0.07 nm), optical fibers, a quartz lens (focal length: 50 mm), and an X-Y-Z three-dimensional adjustable sample stage. The laser pulse repetition frequency and laser energy were 1 Hz and 70 mJ, respectively. The optimal delay time and gate width were 1.5 μs and 2 ms, respectively. Before measurement, each powder sample was pressed into a thin sheet with uniform thickness using a tablet press. During the experiment, the pressed fly ash sample was fixed on the three-dimensional adjustable sample stage and measured at room temperature. A total of 900 LIBS spectral data were obtained by collecting 30 spectral data at different positions for each sample. Finally, the average spectrum of the 30 spectra of each sample was taken as the analysis spectrum.
[0028] Step 3: XGBoost quantitative analysis models were constructed with LIBS spectral data as the independent variable and Cu element content as the dependent variable, respectively. Step 4: The XGBoost model parameters (n_estimators, max_depth, and learning_rate) were optimized based on the whale optimization algorithm to improve the training efficiency and prediction performance of the XGBoost model.
[0029] Step 1: According to the size of the data set, the ranges of n_estimators, max_depth, and learning_rate were set to (50, 200), (3, 6), and (0.01, 0.1), respectively. Step 2: Whale algorithm iteration number and whale number optimization. Based on cross-validation, the iteration number and whale number of the whale algorithm were optimized. Finally, for Cu element determination, the whale number of the whale optimization algorithm was set to 30, and the optimal iteration number was set to 200.
[0030] Step 3: The parameters of XGBoost were optimized within the set range based on the optimized whale algorithm. Finally, the optimal n_estimators, max_depth, and learning_rate values were 199, 4, and 0.09984, respectively.
[0031] Step 5: The XGBoost model was further optimized using normalization, standard normal variate, multivariate scatter correction, first derivative, second derivative, and wavelet transform, respectively. 2 CVand RMSE CV As evaluation index. Finally, the optimal pretreatment method for Cu element determination is the first derivative method.
[0032] The system uses MySQL database to store experimental data, and designs a modelexperimentreultnormal data table as shown in Table 4-1 to record the complete information of model training and evaluation. The table structure includes basic information of the experiment (such as creation time, creator, sample name), model performance indicators (such as R², RMSEP, MREP), model parameters, training time, and storage path of visualization charts. Through the primary key id, the uniqueness of the data is ensured, and dynamic storage of model parameters and experimental results is supported, which is convenient for subsequent analysis and tracing.
[0033]
[0034]
[0035] Step 6: Based on the optimal pretreatment method, the XGBoost model is constructed, and the feature importance value of the variable is calculated. According to the importance evaluation of the features, the most influential feature variables for prediction are selected. Finally, for Cu element determination, the optimal number of input variables obtained is 63.
[0036] Step 7: For the test set samples, first, use laser-induced breakdown spectroscopy for detection to obtain the spectral data of the samples to be tested; then use the same method as the calibration set samples for normalization processing and variable selection; finally, substitute the obtained spectral data into the optimized XGBoost model to obtain the Cu content of the test set samples.
[0037] The obtained Cu element content of the test set samples is compared with the reference value, and the measurement results are shown in Fig. 6. Figure 2 Figure 2 , R P 2 represents the determination coefficient of the test set, RMSE P represents the root mean square error of the test set; MAE P represents the average absolute error of the test set. It can be seen that there is a good linear relationship between the test data and the reference value.
[0038] Step 8: In order to facilitate the rapid analysis of element content by fly ash resource users, an online analysis system for heavy metal elements in fly ash is further designed and developed. The system uses a combination of Python and Java architecture, covering the whole process from data import, pretreatment, model selection and optimization to result analysis. The system login interface and data analysis interface are shown in Figs. 7 and 8, respectively. Figure 3 and 4 As shown in the figure. The left side of the page shows the sample name and the corresponding calculated key indicators, the upper right side shows the comparison of relevant parameters with true value and predicted value, and the lower right side shows the sample spectrum graph and fitting graph. These designs greatly facilitate the operation and analysis of technical personnel.
[0039] Example two
[0040] As Figure 5 shown, the fly ash heavy metal element rapid quantitative analysis system provided by the embodiment of the application specifically comprises the following modules: Sample data import module: after the user selects the target file through the data set entry button, the system automatically parses the file content and generates the corresponding spectrum graph in real time, which facilitates researchers to observe the spectral characteristics and peak distribution in real time; The sample data import module of the application provides a convenient data sample import function. Users can select samples and enter data through an intuitive graphical interface. This function supports Excel file recognition and processing of spectral data. The system can automatically store the uploaded file to the server, realizing cloud management of data, ensuring that researchers can access and download the required data anytime and anywhere. When the user selects the target file through the "data set entry" button, the system will automatically parse the file content and generate the corresponding spectrum graph in real time, which facilitates researchers to observe the spectral characteristics and peak distribution in real time. Taking the fly ash spectrum data set as an example, after the user completes the basic data entry, the system will quickly generate the corresponding spectrum graph, which not only improves the efficiency of data processing, but also provides visual support for subsequent analysis and research, enabling researchers to easily observe data and analyze features. All data files are stored in cloud services, which greatly facilitates researchers to consult and download anytime and anywhere, supports access on any computer or mobile phone, and further improves the flexibility and collaboration efficiency of research work.
[0041] Model and preprocessing selection module: create a new modeling task, select the target data sample uploaded, and select the required preprocessing algorithm in the preprocessing method module; select the appropriate analysis model in the model selection area, and configure the cross-validation method and whether to use WOA optimization algorithm for parameter optimization; The model of the application and the preprocessing selection module, in the data modeling link, the user can operate according to the following process: clicking the ''data modeling'' button on the homepage to create a new modeling task, selecting the target data sample uploaded, and selecting the required preprocessing algorithm in the preprocessing method module. Then, select the appropriate analysis model in the model selection area, and configure the cross-validation method and whether to use the WOA optimization algorithm for parameter optimization. After setting, the system starts the modeling task through the asynchronous processing mechanism, and the user can switch to other analysis work without waiting for the current task to complete, which significantly improves the research efficiency and system utilization. After the modeling task is completed, the system automatically records the operation log, and stores the analysis results and operation records in the database. The user can access the modeling results, analysis reports and historical operation records at any time through the homepage, which is convenient for subsequent review and further analysis. This design enhances the user experience, and improves the transparency and traceability of research work.
[0042] The data display module: after the user completes the page click selection operation, the system will automatically match and execute the Python script according to the user's selection, calculate the key performance indicators including R², RMSE, MRE, and provide model parameter optimization result display and visualization chart; The data display module of the application covers the whole process from data import, preprocessing, model selection and optimization to result analysis. After the user completes the page click selection operation, the system will automatically match and execute the Python script according to the user's selection, calculate the key performance indicators including R 2 , RMSE P , MRE P , etc. and provide model parameter optimization result display and visualization chart, helping the user to obtain detailed analysis results. These analysis results provide data support for the user to assist decision-making. The system also supports multi-user concurrent access to ensure the safe storage and efficient management of data, thereby improving the flexibility and collaboration efficiency of research work. The sample name and the corresponding key indicators are displayed on the left side of the page, the relevant parameters and the comparison between the true value and the predicted value are displayed on the right side of the top, and the sample spectrum graph and the fitting graph are displayed on the right bottom. These designs greatly facilitate the operation and analysis of technical personnel.
[0043] The above describes one embodiment of the application in detail, but the content described is only the preferred embodiment of the application, and cannot be considered as limiting the scope of the application. Any equivalent changes and improvements made within the scope of the application shall still belong to the patent coverage of the application.
Claims
1. A method for rapid quantitative analysis of heavy metal elements in fly ash, characterized in that, The method comprises the following steps: A set of fly ash samples with known Cu content is used as calibration set samples, and LIBS spectrum is used to analyze the calibration set samples to obtain corresponding spectral data; XGBoost quantitative analysis model is constructed by taking LIBS spectral data as independent variable and corresponding heavy metal element content as dependent variable; The XGBoost model hyperparameters are optimized based on WOA; The XGBoost model is further optimized by using normalization, standard normal transformation, multivariate scatter correction, first derivative, second derivative and wavelet transformation respectively; Based on the optimal pretreatment method, the XGBoost model is constructed, and the importance value of the variable is calculated, and the feature variables most affecting the prediction are selected according to the importance value; For test set samples, first, LIBS spectrum is used for detection to obtain spectral data of the test set samples; then the same pretreatment and variable selection method as the calibration set samples is used; finally, the obtained spectral data is substituted into the optimized XGBoost model to obtain the content of Cu in the test set samples.
2. The method according to claim 1, characterized in that, The spectral data is obtained by a laser-induced breakdown spectroscopy platform.
3. The method according to claim 2, characterized in that, The platform mainly comprises a laser, a spectrometer, an optical fiber, a quartz lens and an X-Y-Z three-dimensional adjustable sample table.
4. The method according to claim 3, characterized in that, The laser pulse repetition frequency and laser energy are 1 Hz and 70 mJ respectively, and the optimal delay time and gate width are 1.5 μs and 2 ms respectively.
5. The method according to claim 1, characterized in that, The optimization process of the XGBoost quantitative analysis model hyperparameters is as follows: According to the size of the fly ash LIBS spectral data set, the optimization range of the XGBoost hyperparameters n_estimators, max_depth and learning_rate is set; Based on 5-fold cross-validation, the iteration number and the number of whales of the whale optimization algorithm are optimized; The XGBoost hyperparameters are optimized in the set range based on the optimized whale algorithm.
6. The method for rapid quantitative analysis of heavy metal elements in fly ash according to claim 1, characterized in that, R 2 CV and RMSE CV as evaluation metrics.
7. The method according to claim 1, characterized in that, For the determination of Cu element, the optimal pretreatment method is first derivative method.
8. The method for rapid quantitative analysis of heavy metal elements in fly ash according to claim 1, characterized in that, For Cu element determination, the optimal number of input variables obtained is 63, 15 and 4 respectively.
9. The method according to claim 1, characterized in that, The method further comprises the following steps: A Python and Java combined architecture is adopted to cover the whole process from data import, pretreatment, model selection and optimization to result analysis; After the user completes the page click selection operation, the system will automatically match and execute the Python script according to the user's selection, calculate the key performance indicators including R², RMSE and ARE, and provide model parameter optimization result display and visualization chart.
10. A fly ash heavy metal element rapid quantitative analysis system, characterized in that, The system is used to execute the method of any one of claims 1-9, and the system comprises: A sample data import module: after the user selects the target file through the data set import button, the system automatically analyzes the file content and generates the corresponding spectrum in real time, which is convenient for researchers to observe the spectral characteristics and peak distribution in real time; Model and preprocessing selection module: create a new modeling task, select the uploaded target data sample, and select the required preprocessing algorithm in the preprocessing method module; select the appropriate analysis model in the model selection area, and configure the cross-validation method and whether to use the WOA optimization algorithm for parameter optimization; Data display module: after the user completes the page click selection operation, the system will automatically match and execute the Python script according to the user's selection, calculate the key performance indicators including R², RMSE, MRE, and provide model parameter optimization result display and visualization charts.