Biogas slurry multi-parameter water quality detection method based on UV-Vis-NIR feature fusion
By using a UV-Vis-NIR feature fusion method and a weighted fusion approach, the prediction accuracy and robustness of biogas slurry water quality detection are improved. This solves the problems of long detection time and secondary pollution in existing technologies, and realizes rapid and non-destructive biogas slurry water quality detection.
Patent Information
- Application Number
- CN202510929406.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-11-28
AI Technical Summary
Existing technologies for biogas slurry water quality testing suffer from problems such as long testing time, large amount of chemical reagents used, and easy secondary pollution. Furthermore, the wavelength redundancy in spectroscopic methods is serious, resulting in low prediction accuracy.
The UV-Vis-NIR feature fusion method is adopted to improve the prediction accuracy of biogas slurry water quality components through weighted fusion. The steps include sample collection, preprocessing, single-spectral data screening, feature wavelength extraction, and multispectral weighted fusion prediction model. The weights are assigned using RF selection probability and VIP value.
It improves the model's prediction accuracy and robustness, reduces data processing volume, and enables rapid, non-destructive, and pollution-free biogas slurry water quality testing.
Smart Images

Figure CN121027006A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of spectral analysis, and particularly relates to a biogas slurry multi-parameter water quality detection method based on UV-Vis-NIR feature fusion. BACKGROUND
[0002] Biogas slurry is a liquid by-product discharged by anaerobic fermentation of organic matter, and has high comprehensive utilization potential. Rapid analysis of biogas slurry water quality parameters is of great significance for evaluating the nutritional value and optimizing the biogas production process. In the scenarios of anaerobic reactor operation, biogas slurry treatment and utilization, it is often necessary to detect conventional water quality parameters including chemical oxygen demand (COD), total nitrogen (TN), total phosphorus (TP) and ammonia nitrogen at high frequency and large sample size to evaluate the reactor operation state and biogas slurry water quality characteristics. According to the national standard, chemical analysis method is usually used to analyze these components, which has the problems of long detection time, large amount of chemical reagents and secondary pollution. Unlike traditional methods, spectral analysis of water quality has the advantages of rapidity, non-destructiveness and no secondary pollution.
[0003] Spectral detection technology relies on a stable and reliable prediction model to establish a quantitative relationship between spectral characteristics and concentration. Based on all wavelength points of spectrum modeling, the calculation is large, the wavelength is redundant, and the prediction accuracy is low, so the accurate extraction of spectral characteristics is the key to high-precision prediction. The invention patent [CN109507143B] uses a double genetic simulated annealing algorithm to select characteristic wavelengths and then establishes a regression model, which can simultaneously detect multiple biogas slurry characteristic parameters, but this method is based on near-infrared spectrum single-band spectral information to establish a model and does not involve multi-spectral information fusion technology. Multi-spectral fusion technology can extract more comprehensive water quality spectral information, combined with feature wavelength extraction algorithm to select feature dataset, so that the prediction effect is better. The invention patent [CN119757251A] proposes a sewage treatment effect detection method based on spectral analysis, which is characterized by fusing UV-Vis-NIR spectral data and using an intelligent encoder to generate a feature dataset to construct an intelligent spectral analysis model. SUMMARY
[0004] The purpose of the present application is to overcome the shortcomings of the prior art and provide a biogas slurry multi-parameter water quality detection method based on UV-Vis-NIR feature fusion, which uses a weighted fusion method to improve the prediction accuracy of the model for biogas slurry water quality components, and provides a green, rapid and efficient method for water quality detection in the links of anaerobic fermentation and biogas slurry treatment and utilization.
[0005] The technical problems of the present application are solved by the following technical solutions: A biogas slurry multi-parameter water quality detection method based on UV-Vis-NIR feature fusion, comprising the following steps: Step 1, collecting biogas slurry samples and pretreating them; Step 2, true value determination and single spectrum data acquisition are performed on the treated biogas slurry sample; Step 3, pre-treatment screening single spectrum data; Step 4, screening pre-treatment single spectrum characteristic wavelength extraction method, and obtaining single spectrum characteristic wavelength; Step 5, RF selection probability and variable importance projection VIP value are calculated according to the single spectrum characteristic wavelength respectively, and a multi-spectrum weighted fusion prediction model is constructed; Step 6, using the multi-spectrum weighted fusion prediction model constructed in step 5 to detect unknown concentration of the same kind of biogas slurry sample.
[0006] Moreover, the specific implementation method of step 1 is: collecting biogas slurry samples including anaerobic fermentation reactor, biogas slurry storage pool, biogas slurry transportation tank, and biogas fertilizer utilization scene, for the clear water sample of biogas slurry sample, using filter membrane for filtration, for the turbid water sample of biogas slurry sample, first centrifugation and then using filter membrane for filtration.
[0007] Moreover, the specific implementation method of step 2 is: using UV-Vis and NIR spectrum equipment to scan the filtrate sample respectively, and obtaining UV-Vis and NIR single spectrum raw data.
[0008] Moreover, the specific implementation method of step 3 is: pre-treating the single spectrum raw data, and establishing the regression model of each biogas water quality parameter and pre-treatment spectrum, and screening the single spectrum optimal pre-treatment method corresponding to each biogas water quality parameter according to the model prediction result.
[0009] Moreover, the specific implementation method of step 4 is: selecting characteristic wavelength extraction algorithm, respectively, and performing characteristic wavelength extraction algorithm optimization on the optimal pre-treatment UV-Vis and NIR single spectrum pre-treatment data, establishing the regression prediction model between each biogas water quality parameter and the characteristic wavelength spectrum data corresponding to different algorithms, screening the single spectrum optimal characteristic wavelength extraction method corresponding to each biogas water quality parameter according to the model prediction result, and respectively obtaining the UV-Vis and NIR single spectrum characteristic wavelength of each biogas water quality parameter.
[0010] Moreover, step 5 includes the following steps: Step 5.1, splicing the UV-Vis and NIR single spectrum characteristic wavelengths to obtain the fusion data set; Step 5.2, calculating the RF selection probability of the fusion data set: according to the frequency of each wavelength point being selected in the multiple sampling iterations of RF algorithm, calculating the probability of being selected, and removing the characteristic wavelength points with low selection frequency; Step 5.3, calculating the variable importance projection VIP index of the fusion data set: establishing an initial PLS regression model, and calculating the VIP value of each wavelength point; Step 5.4, normalize the RF selection probability and VIP value, and fuse the weight of the normalized RF selection probability and VIP value; Step 5.5, construct a weighted fusion regression prediction model.
[0011] Moreover, the specific implementation method of step 5.4 is to normalize the RF selection probability P i and the VIP value V i :
[0012]
[0013] wherein, is the normalized random selection probability of the i-th wavelength point, indicating its relative frequency of being selected in multiple rounds of random frog jumping algorithm, is the normalized VIP value of the i-th wavelength point, reflecting the importance of the wavelength point in the variable importance in modeling, n is the total number of wavelength points of the spectrum.
[0014] The information entropy corresponding to the two types of indicators is calculated respectively as H P and H V :
[0015]
[0016] wherein, is a small positive number to prevent from causing numerical errors; Calculate the entropy weight ω P and ω V :
[0017]
[0018] Fuse the two entropy weights to redistribute the weight:
[0019] wherein, represents the maximum VIP value in all wavelength points, ensuring that all VIP values are scaled to the range of 0-1, avoiding the interference of inconsistent dimensions on the fusion result.
[0020] Moreover, the specific implementation method of step 5.5 is to redistribute the weightW i The normalization processing is adopted, the sum of weights used for modeling is ensured to be 1, new weights of each wavelength point are obtained, the weighted values obtained by multiplying the spectral data of each wavelength point by the corresponding new weights are taken as the modeling spectral data, the biogas slurry water quality parameter value is taken as the modeling true value, and the weighted fusion regression prediction model is established.
[0021] Moreover, the specific implementation method of the step 6 is that the unknown sample filtrate is scanned by using the ultraviolet-visible spectrum equipment and the near-infrared spectrum equipment respectively to obtain the single spectrum original data of UV-Vis and NIR, the optimal method selected according to the prediction model is used for pre-processing and feature wavelength extraction, then the weighted value of the unknown sample spectral data is calculated, and the step 5 model is substituted to measure the water quality parameter content of the unknown biogas slurry sample.
[0022] The advantages and positive effects of the present application are: 1. The weighted fusion algorithm provided by the present application can enhance the modeling influence of the wavelength points with higher contribution degrees, so that the model is more focused on the key signals in the modeling process. In the contribution degree determination, the stability (RF selection probability) and the prediction contribution degree (VIP value) of the wavelength points are fused, and the weight distribution is optimized from multiple angles. This weight distribution strategy based on the contribution degree can not only improve the prediction accuracy of the model, but also enhance the robustness and generalization ability of the model in the complex data environment.
[0023] 2. The weighted fusion algorithm used in the present application assigns different weights to each wavelength point and removes the wavelength points with low RF selection probability, so that the number of feature wavelength points is reduced and the data processing amount is reduced. The fusion data processing process includes simple RF algorithm, PLS modeling and normalization processing, and does not involve complex calculation, so the calculation speed is fast.
[0024] 3. The present application can fuse the two kinds of spectral information at the feature level according to the complementary and multi-modal characteristics of the ultraviolet-visible spectrum and the near-infrared spectrum, so that the model has higher reliability and robustness. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 The flowchart of the present application; Figure 2 The flowchart of the present application for establishing a biogas slurry water quality multi-parameter detection model based on UV-Vis-NIR fusion; Figure 3 The flowchart of the present application for analyzing the water quality of the same type of unknown biogas slurry sample. DETAILED DESCRIPTION
[0026] The present application will be further described in detail below with reference to the accompanying drawings.
[0027] A biogas slurry multi-parameter water quality detection method based on UV-Vis-NIR feature fusion, as shown in Figure 1 includes the following steps: Step 1, collect and pretreat the biogas slurry sample.
[0028] Collect the biogas slurry sample including anaerobic fermentation reactor, biogas slurry storage tank, biogas slurry transportation tank and biogas fertilizer utilization scene. For the biogas slurry sample with clear water sample, use 0.45μm filter membrane for filtration. For the biogas slurry sample with turbid water sample, first centrifuge at 5000rpm for 5-10min, then use filter membrane for filtration.
[0029] Step 2, determine the true value of the treated biogas slurry sample and collect single spectrum data.
[0030] Use the method mentioned in international, national or industry standards and use ultraviolet-visible spectrum equipment and near infrared spectrum equipment to scan the filtrate sample respectively, to obtain the single spectrum original data of UV-Vis and NIR.
[0031] In the original spectrum data collection, the ultraviolet-visible spectrum collection wavelength range is 200-800nm; the near infrared spectrum wavelength collection range is 4000-12000cm -1 .
[0032] Step 3, pretreat and screen single spectrum data.
[0033] Pretreat the ultraviolet-visible spectrum and near infrared spectrum original data respectively: the processing algorithm used is the combination algorithm of multiple scattering correction (MSC), standard normal transformation (SNV), Savitzky-Golay convolution smoothing (SG), first derivative method (FD) and second derivative method (SD). The combination principle is the combination of smoothing, denoising algorithm and information strengthening algorithm, such as MSC+FD, SNV+FD, SG+FD, MSC+SD, SNV+SD and SG+SD. Among them, MSC+FD means that the original spectrum data is first processed by MSC, and then processed by FD, and the meaning of other combinations is similar. Establish the regression prediction model of pretreated spectrum data and biogas slurry parameter concentration value, compare the model performance index to screen out the optimal single spectrum pretreatment method of each water quality parameter of biogas slurry.
[0034] Step 4, screen the pretreated single spectrum characteristic wavelength extraction method, and obtain the single spectrum characteristic wavelength.
[0035] The selected characteristic wavelength extraction algorithm is used to extract the characteristic wavelength of the optimal pretreated UV-Vis and NIR single spectrum pretreated data, respectively, and the regression prediction model between the water quality parameters of each biogas slurry and the characteristic wavelength extracted by different algorithms is established, the corresponding single spectrum optimal characteristic wavelength extraction method of each biogas slurry water quality parameter is selected according to the model prediction result, and the UV-Vis and NIR single spectrum characteristic wavelength of each biogas slurry water quality parameter is obtained.
[0036] Step 5, calculate the RF selection probability and variable importance projection VIP value according to the single spectrum characteristic wavelength, and construct a multispectral weighted fusion prediction model.
[0037] Step 5.1, splice the UV-Vis and NIR single spectrum characteristic wavelength to obtain a fusion data set. For the fusion data set, considering that the contribution of different wavelength points to the model performance is significantly different, the present application highlights the influence of high contribution wavelength and weakens the interference of low contribution wavelength on model training by assigning appropriate weights to each wavelength point, thereby optimizing the modeling effect.
[0038] Step 5.2, calculate the RF selection probability of the fusion data set: according to the frequency of each wavelength point being selected in the multiple sampling iterations of the RF algorithm, record its selection probability, remove the characteristic wavelength points with low selection frequency, and then calculate the selection probability, reflecting the stability and representativeness of the wavelength in the feature selection process.
[0039] Step 5.3, calculate the variable importance projection VIP index of the fusion data set: establish an initial PLS regression model, and calculate the VIP value of each wavelength point to measure its relative contribution to the explanation ability of the response variable.
[0040] Step 5.4, normalize the RF selection probability and VIP value, and then calculate the information entropy of each. Information entropy is used to measure the information distribution degree of each index, and the smaller the entropy value, the more concentrated the information and the stronger the distinguishability, and the higher the weight.
[0041] The RF selection probability P i and the VIP value V i are normalized:
[0042]
[0043] wherein, is the normalized random selection probability of the i-th wavelength point, which represents the relative frequency of being selected in multiple rounds of random frog jumping algorithm, The normalized VIP value of the ith wavelength point reflects the importance of the variable in the modeling of the wavelength point, n The total number of wavelength points of the spectrum.
[0044] The information entropy of the two types of indicators is calculated respectively H P And H V :
[0045]
[0046] Wherein, is a small positive number to prevent from causing numerical errors; Calculate the entropy weight ω P And ω V :
[0047]
[0048] The two entropy weights are redistributed as follows:
[0049] Wherein, represents the maximum value in all wavelength point VIP values, ensuring that all VIP values are scaled to the range of 0-1, avoiding dimensional inconsistency that interferes with the fusion result.
[0050] This strategy comprehensively considers the stability (selection probability) and prediction contribution (VIP value) of the wavelength point, realizes multi-angle modeling feature evaluation; The information entropy principle is introduced in the fusion process to ensure that the fusion weight has a theoretical basis and the weighting is more scientific; effectively suppresses redundant and noisy features, highlights key information bands, and improves the accuracy and generalization ability of modeling.
[0051] Step 5.5, construct a weighted fusion regression prediction model.
[0052] The redistributed weight W i The normalized processing ensures that the sum of the weights used for modeling is 1, and the new weight of each wavelength point is obtained, so that the weighted value obtained by multiplying the spectral data of each wavelength point by the corresponding new weight is used as the modeling spectral data, and the biogas liquid quality parameter value is used as the modeling true value. Establish a weighted fusion regression prediction PLS model.
[0053] Step 6, use the multispectral weighted fusion prediction model constructed in step 5 to detect unknown concentration of the same type of biogas liquid sample.
[0054] Meanwhile, based on the weighted fusion regression prediction model constructed according to the present application, a man-machine interaction sample detection interface is established, based on virtual instrument technology, taking the man-machine interface as a template, using the combination of MATLAB and LABVIEW, the functions of spectral data preprocessing, characteristic wavelength extraction and multispectral information fusion modeling are software-encapsulated, and the MATLAB tool is called by the host computer software background to process and model the data, thereby forming a prediction model. The unknown sample detection function is set to detect the water quality of the same type of biogas liquid unknown sample. For the input unknown sample spectral data, according to the best spectral preprocessing method and characteristic wavelength extraction method of the prediction model, one-key preprocessing, one-key characteristic wavelength extraction and one-key weighted fusion are performed, and the concentration value of the biogas liquid water quality parameter is obtained by substituting into the model.
[0055] (1) A biogas liquid water sample spectral detection interface is built based on LabVIEW, including a login interface with functions such as login, registration, account creation, account password input, and sub-interfaces including modeling, spectral data preprocessing, characteristic wavelength extraction, characteristic level fusion and unknown sample detection, which realize software encapsulation of corresponding functions. In each functional sub-interface, interface design and module addition are performed in cooperation with each functional feature, and the MATLAB tool is called by the host computer software background to process and model the data. Once the interface is designed, it can be used multiple times, and is not only suitable for the present method, but also can be used for spectral data processing and sample detection of other index parameters.
[0056] (2) A UV-Vis-NIR spectral fusion prediction model is quickly established in the interface. The spectral data and true value of the biogas liquid sample are input by using the functions of the first four sub-interfaces, a biogas liquid water quality prediction model is established, and the best preprocessing method and characteristic wavelength selection method selected by the model are output.
[0057] (3) The biogas liquid sample to be detected is detected by using the fifth sub-interface (unknown sample detection sub-interface) to detect the concentration value of the water quality parameter of the same type of biogas liquid unknown sample. The spectral data of the sample to be detected is scanned and obtained by using ultraviolet-visible spectral equipment and near-infrared spectral equipment. The spectral data is uploaded by logging into the detection interface system. A variety of preprocessing combinations and characteristic wavelength extraction modules have been added in the fifth sub-interface, and when the spectral data of the sample to be detected is processed, the best method selected by the prediction model is used for preprocessing and characteristic wavelength extraction, the information fusion sub-interface function is called to process the unknown sample spectral data to obtain the weighted value, and the water quality parameter content of the unknown biogas liquid sample can be measured by substituting into the model of step 5.
[0058] According to the above-mentioned biogas liquid multi-parameter water quality detection method based on UV-Vis-NIR characteristic fusion, the effect of the present application is verified by testing the biogas liquid sample.
[0059] S1: Biogas slurry sample collection; Biogas slurry samples were collected from anaerobic fermentation reactors treating excess sludge, with a sample number of 120. The samples were all treated in the same way, i.e., centrifuged at 5000 rpm for 10 min and then filtered through a 0.45 μm filter membrane to obtain the filtrate as the biogas slurry sample.
[0060] S2: Determination of sample true values and collection of spectral data; The biogas slurry water quality parameters were detected using standard determination methods, including COD, TN, ammonia nitrogen, and TP. The specific determination methods are shown in Table 1.
[0061] Table 1. Actual values of parameters detected by chemical methods
[0062] The UV-Vis spectral collection range was 200-800 nm. Specifically, each water sample was loaded into a cuvette with a 10 mm light path, and a UV-visible spectrometer produced by the American PerkinElmer company was used for spectral analysis of the sample. The scanning mode was selected as Lambda35, the scanning range was set to 200-800 nm, the data collection interval was 1 nm, and the scanning speed was 400 nm / min. To ensure the accuracy of the measurement results, the background was zeroed before formal scanning with ultrapure water. Each sample was scanned three times to take the average value, and all experiments were performed under the same conditions to ensure the consistency and repeatability of the results. The spectral data were stored on the computer.
[0063] The wavelength collection range of near-infrared spectroscopy was 4000-12000 cm -1 . 1-2 mL of sample was added to the sample cup, and the biogas slurry sample was scanned using a Fourier transform near-infrared (FT-NIR) spectrometer produced by the American PerkinElmer company. The spectral scanning parameters were set to a resolution of 16 cm -1 , a scanning interval of 2 cm -1 , and a scanning number of 32, with a background rescan performed once every three samples. To ensure the accuracy and stability of the experimental results, the indoor temperature and humidity were kept basically stable during the experiment, and each sample was scanned three times to take the average value. Each spectrum contained 4001 variables, with a starting wavenumber range of 12000 cm -1 to an ending wavenumber of 4000 cm -1 . Finally, it was received by the spectrometer, and the spectral data were displayed and stored on the computer.
[0064] S3: Single-spectrum data preprocessing and screening of specific biogas slurry water quality parameters; The analysis is carried out under the MATLAB software environment. The pretreatment methods involved in the method are roughly divided into two categories: one is to eliminate the interference of spectral data itself (MSC, SNV, SG), and the other is to strengthen the information in the spectral data (FD, SD). The two kinds of pretreatment methods are combined in this implementation case, and a total of 6 groups of pretreatment combinations (MSC+FD, SNV+FD, SG+FD, MSC+SD, SNV+SD and SG+SD) are obtained, from which a best pretreatment method is selected. Before pretreatment, the Monte Carlo algorithm is used to remove outliers from the spectral data. The sample absorbance is used as the independent variable, and the sample true value is used as the dependent variable to form a spectral data set. The data set is divided into training set and test set by K-S classification algorithm, and the training set and test set account for 75% and 25% of the total data respectively. The spectral data is divided and PLS regression is performed. The performance index values (RMSEC, RMSEP, and RPD) of each pretreatment prediction model are obtained, and the optimal pretreatment combination is selected by comparing the numerical values.
[0065] S4: Single-spectrum characteristic wavelength extraction method screening for specific biogas slurry water quality parameters; The CARS and RF are used to extract the characteristic wavelengths of each parameter of the biogas slurry in UV-Vis and NIR respectively for the spectral data processed by the optimal pretreatment method; when CARS feature extraction is used, the total number of sampling is set to 100 times; when RF feature extraction is used, the RF algorithm is parameterized, the iteration number N is set to 10000 times, the number of initialization variable set is set to 10, and other parameters are set to default values; the spectral features and water quality true values are used to establish PLS regression model, and UV-Vis and NIR single-spectrum feature prediction models are established, the performance index values of the prediction models are compared, and the best characteristic wavelength extraction method for each water quality parameter of the biogas slurry in UV-Vis and NIR is selected, and the corresponding characteristic wavelength points are obtained.
[0066] S5: Establishment of multi-spectral information fusion prediction model; The characteristic wavelengths of UV-Vis and NIR characteristic wavelengths are fused, and the characteristic wavelength data of UV-Vis and NIR spectrum are simply spliced to form a fusion data set.
[0067] The weighted fusion method in the random class method is used for characteristic fusion, and the software environment is MATLAB, and the specific steps are as follows: Two kinds of index values are calculated: RF selection frequency ): RF iteratively samples the wavelength set multiple times, records the frequency of each wavelength point being selected, removes the feature wavelength points whose selection frequency is lower than 50%, and then calculates the probability of being selected to reflect the stability and representativeness of the wavelength in the feature selection process.
[0068] VIP value of VIP: Based on PLS, an initial regression model is established, and the VIP value of each wavelength point is calculated to measure its relative contribution to the explanatory ability of the response variable. On this basis, the
[0069] and are normalized.
[0070]
[0071]
[0072] Then, let the information entropy of the two types of indicators be and .
[0073]
[0074]
[0075] where is a small positive number to prevent from causing numerical errors, and in this paper . Calculate the entropy weight and .
[0076]
[0077]
[0078] Finally, the two entropy weights are fused to redistribute the weights.
[0079]
[0080] Construct a weighted fusion PLS prediction model to verify the accuracy and robustness of the model. For Wi The normalization processing is adopted to ensure that the sum of the weights used for modeling is 1, and new weights of each wavelength point are obtained. The weighted values obtained by multiplying the spectral data of each wavelength point by the corresponding new weight are taken as the modeling spectral data, and the biogas slurry water quality parameter value is taken as the modeling true value, so as to establish a PLS prediction model. The model evaluation index is used to compare and verify the performance of the model. Through the above steps, the information fusion prediction model is established, and the performance of the fusion prediction model of COD, TN, TP and ammonia nitrogen in the biogas slurry water quality parameter is significantly better than that of the UN-Vis or NIR single spectrum characteristic fitting model.
[0081] S6: using the multispectral weighted fusion prediction model constructed in step 5 to detect unknown concentration biogas slurry samples of the same kind; The concentration value of the water quality parameter of the unknown sample of the same kind of biogas slurry is detected. The ultraviolet-visible spectrum equipment and the near-infrared spectrum equipment are used to scan the unknown sample filtrate to obtain the spectral data of the sample to be detected. When the spectral data of the sample to be detected are processed, the optimal method selected according to the prediction model is used for pretreatment and characteristic wavelength extraction, and then the weighted values of the unknown sample spectral data are obtained, which are substituted into the model of step 5 to determine the water quality parameter of the unknown biogas slurry sample.
[0082] Meanwhile, based on the weighted fusion regression prediction model constructed in the present application, a human-computer interaction sample detection interface is established. LABVIEW is used as the upper computer software, and MATLAB function nodes are called in the background for mathematical calculation, so as to realize the development of the operation interface. In the specific implementation process, the script node in the LABVIEW software is used to realize the background calling of MATLAB. As shown in Figure 2 the process of establishing a kind of biogas slurry water quality multi-parameter detection model based on UV-Vis-NIR on the operation interface is shown, as shown in Figure 3 the process of analyzing the water quality of the unknown sample of the same kind of biogas slurry by using the model is shown. The development process of each module of the operation interface is as follows: a. login interface design. In order to ensure data security, the system requires the staff to input the account number and password for identity verification to access the monitoring and historical data. The login interface design includes a title, an account input box, a password input box, a login button and a registration option, has wide applicability, and is commonly used for identity verification of test systems.
[0083] b. main display interface design.
[0084] The modeling, spectral data pretreatment, characteristic wavelength extraction, characteristic level fusion and unknown sample detection buttons are linked to the sub-interface, so as to ensure the quick switching between multiple operation interfaces and improve the user experience.
[0085] c. sub-interface design.
[0086] The five sub-interfaces of modeling, spectral data preprocessing, feature wavelength extraction, information fusion and unknown sample detection are set up and linked with the main interface. In the modeling sub-interface, the main component button and PLS modeling are linked to call the corresponding MATLAB functions, and the interface can establish a mathematical model between spectral data and true value. In the spectral data preprocessing sub-interface, various combined preprocessing method buttons are embedded to call the corresponding MATLAB scripts to complete data processing and output the pretreated EXCEL spectral data. In the feature wavelength extraction sub-interface, RF algorithm and CARS algorithm buttons are embedded to link to the corresponding sub-interface for corresponding feature wavelength extraction analysis, and the analysis results are output in EXCEL file. The information fusion sub-interface completes the information fusion integration operation. In addition, the above four sub-interfaces also design the to-be-tested sample selection path according to the requirements, embed the KS algorithm of MATLAB to divide the samples into training set and prediction set, and have the functions of graphical visualization, key data saving, display and EXCEL file output. In the unknown sample detection sub-interface, the preprocessing, feature wavelength extraction and information fusion buttons are set to call the corresponding MATLAB algorithm to calculate the input spectral data and display the calculated concentration value.
[0087] It should be emphasized that the embodiments of the present application are illustrative rather than restrictive, and thus the present application includes but is not limited to the embodiments described in the specific embodiments, and any other embodiments derived by those skilled in the art according to the technical solutions of the present application also belong to the protection scope of the present application.
Claims
1. A method for detecting multiple parameters of biogas slurry water quality based on UV-Vis-NIR feature fusion, characterized in that: The method comprises the following steps: Step 1, collecting and pretreating the biogas slurry sample; Step 2, determining the true value and collecting the single-spectrum data of the pretreated biogas slurry sample; Step 3, screening the single-spectrum data after pretreatment; Step 4, screening the single-spectrum characteristic wavelength extraction method and obtaining the single-spectrum characteristic wavelength; Step 5, calculating the random frog jump RF selection probability and variable importance projection VIP value according to the single-spectrum characteristic wavelength respectively, and constructing a multispectral weighted fusion prediction model; Step 6, detecting unknown concentration biogas slurry samples of the same kind by using the multispectral weighted fusion prediction model constructed in step 5.
2. The method according to claim 1, characterized in that: The specific implementation method of step 1 is: collecting the biogas slurry sample including an anaerobic fermentation reactor, a biogas slurry storage pool, a biogas slurry transportation tank and a biogas fertilizer utilization scene, filtering the biogas slurry sample with a filter for the biogas slurry sample with clear water, and first centrifuging and then filtering the biogas slurry sample with a filter for the biogas slurry sample with turbid water.
3. The method according to claim 1, characterized in that: The specific implementation method of step 2 is: scanning the filtrate sample by using an ultraviolet-visible spectrum device and a near-infrared spectrum device respectively to obtain the single-spectrum original data of UV-Vis and NIR.
4. The method according to claim 1, characterized in that: The specific implementation method of step 3 is: pretreating the single-spectrum original data, establishing a regression model of each biogas water quality parameter and the pretreated spectrum, and screening the single-spectrum optimal pretreatment method corresponding to each biogas water quality parameter according to the model prediction result.
5. The method according to claim 1, characterized in that: The specific implementation method of step 4 is: Selecting a characteristic wavelength extraction algorithm, respectively optimizing the characteristic wavelength extraction algorithm for the UV-Vis and NIR single-spectrum pretreated data, establishing a regression prediction model between each biogas water quality parameter and the characteristic wavelength spectrum corresponding to different algorithms, screening the single-spectrum optimal characteristic wavelength extraction method corresponding to each biogas water quality parameter according to the model prediction result, and respectively obtaining the UV-Vis and NIR single-spectrum characteristic wavelength of each biogas water quality parameter.
6. The method according to claim 1, characterized in that: The step 5 comprises the following steps: Step 5.1, splicing the UV-Vis and NIR single-spectrum characteristic wavelengths to obtain a fusion data set; Step 5.2, calculating the RF selection probability of the fusion data set: calculating the probability of being selected according to the frequency of being selected in the RF algorithm multiple sampling iterations, and removing the characteristic wavelength points with low selection frequency; Step 5.3, calculating the variable importance projection VIP index of the fusion data set: establishing an initial PLS regression model and calculating the VIP value of each wavelength point; Step 5.4, normalizing the RF selection probability and the VIP value, and then fusing and weighting the weights of the normalized RF selection probability and the VIP value; Step 5.5, constructing a weighted fusion regression prediction model.
7. The method according to claim 6, characterized in that: The specific implementation method of the step 5.4 is: selecting the probability of RF P i and VIP value V i Normalization processing is performed: ; ; wherein, is the normalized random selection probability of the i-th wavelength point, indicating its relative frequency of being selected in the multi-round random frog algorithm, is the normalized VIP value of the i-th wavelength point, reflecting the variable importance of the wavelength point in modeling, n is the total number of wavelength points of the spectrum; The information entropy of the two types of indexes is calculated respectively as H P and H V : ; ; wherein is a small positive number, preventing causing numerical errors; Computing entropy weights ω P and ω V : ; ; Fusing two entropy weight redistribution weights: ; wherein, represents the maximum value among all wavelength point VIP values, ensuring that all VIP values are scaled to the range of 0~1, avoiding the interference of inconsistent dimensions on the fusion result.
8. The method according to claim 7, characterized in that: The specific implementation method of the step 5.5 is: reassigning weights W i The normalization processing is adopted to ensure that the total of the weights used for modeling is 1, new weights of each wavelength point are obtained, the weighted values obtained by multiplying the spectral data of each wavelength point by the corresponding new weights are taken as the modeling spectral data, the biogas slurry water quality parameter value is taken as the modeling true value, and the weighted fusion regression prediction model is established.
Citation Information
Patent Citations
Simultaneous and rapid detection method of near-infrared spectroscopy for physicochemical properties of biogas slurry
CN109507143B
Sewage treatment effect detection method based on spectral analysis
CN119757251A
Cited By
Water tower wall condensate water quality detection method and system
CN122171477A