Near-infrared instrument-based chemical reaction organic matter real-time detection system
By combining near-infrared spectral signal acquisition with Dirichlet process hybrid modeling, the real-time and adaptability issues of organic matter detection in chemical reactions were solved, enabling online identification and concentration prediction of organic components during chemical reactions, thus improving the real-time performance and accuracy of detection.
Patent Information
- Application Number
- CN202511847965.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-01-20
AI Technical Summary
Existing near-infrared spectroscopy-based organic compound detection systems for chemical reactions cannot adapt to changes in composition and spectral drift, lack online learning and structural adaptation capabilities, and are difficult to achieve truly real-time intelligent detection, especially in the identification and concentration prediction of multiple components in complex reaction scenarios.
An online identification and concentration prediction system for organic components in chemical reaction processes is constructed using near-infrared spectral signal acquisition, nonlinear feature extraction, Dirichlet process hybrid modeling, and multi-model fusion methods. The system includes near-infrared spectral acquisition, spectral preprocessing, feature mapping, cluster identification, concentration estimation, and feedback update modules, enabling adaptive and real-time concentration estimation.
It achieves high-dimensional expression and unsupervised clustering recognition of organic features in chemical reaction samples, improving the characterization ability and adaptability of complex chemical reaction systems. It has a closed-loop feedback model adaptive mechanism, which enhances the real-time performance and accuracy of detection, and is suitable for online real-time organic detection under varying operating conditions.
Smart Images

Figure CN121366653A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of spectral analysis and industrial process monitoring, and particularly relates to a real-time detection system for organic substances in chemical reaction based on near-infrared instrument. BACKGROUND
[0002] With the development of intelligent manufacturing and industrial automation, online detection and control of chemical reaction process gradually become a key technology to improve production efficiency and safety. Traditional chemical reaction organic substance monitoring methods mostly rely on manual sampling and offline analysis by laboratory instruments, which has problems such as large response delay, untimely information update, weak process intervention ability, and is difficult to meet the needs of modern chemical process for high-frequency real-time monitoring and dynamic modeling.
[0003] Existing detection systems based on near-infrared spectrum generally use fixed modeling and supervised learning methods, which cannot adapt to component changes, spectral drift or nonlinear evolution of reaction state in the reaction process, and most methods rely on pre-labeled samples, static model training, and lack of online learning and structure adaptive ability. Especially in the identification and concentration prediction of multiple components in complex reaction scenarios, traditional methods have significant shortcomings in feature extraction, model updating and result fusion, and it is difficult to realize real-time intelligent detection in a true sense.
[0004] Therefore, how to provide a real-time detection system for organic substances in chemical reaction based on near-infrared instrument is a problem that those skilled in the art need to solve. SUMMARY
[0005] One object of the present application is to provide a real-time detection system for organic substances in chemical reaction based on near-infrared instrument. The present application uses near-infrared spectrum signal acquisition, nonlinear feature extraction, Dirichlet process hybrid modeling and multi-model fusion methods to complete online identification and concentration prediction of organic components in chemical reaction process, and has the advantages of modeling adaptation, strong real-time detection and high concentration estimation accuracy.
[0006] According to the real-time detection system for organic substances in chemical reaction based on near-infrared instrument, the following steps are included:
[0007] A near-infrared spectrum acquisition module is used to acquire near-infrared spectrum signals of reaction samples in the chemical reaction process, and generate a time series of original spectrum data stream;
[0008] A spectrum preprocessing module is used to receive the original spectrum data stream, preprocess the original spectrum data stream, and generate a standardized spectrum matrix;
[0009] The feature mapping module is configured to receive the normalized spectral matrix, perform nonlinear mapping on the normalized spectral matrix based on a kernel principal component regression method, and generate a high-dimensional vector set representing spectral features;
[0010] The clustering recognition module is configured to receive the high-dimensional vector set, input the high-dimensional vector set into a Dirichlet process mixture model to perform unsupervised clustering analysis, and generate a class label set and a corresponding posterior probability distribution set;
[0011] The concentration estimation module is configured to construct a weighting strategy based on the class label set and the posterior probability distribution set, weight and fuse concentration prediction results of each class, and generate an organic matter concentration prediction value at the current time;
[0012] The feedback updating module is configured to receive the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the previous time, calculate a prediction difference, and adjust structure parameters of the Dirichlet process mixture model and kernel principal component regression parameters based on the prediction difference;
[0013] The output interface module is configured to receive the organic matter concentration prediction value at the current time and a time sequence thereof, and generate detection output data.
[0014] Optionally, the generation of the time sequence of the original spectral data stream comprises:
[0015] The near-infrared spectral acquisition unit is configured to acquire a near-infrared spectral signal of a reaction sample, wherein the near-infrared spectral signal is a spectral response signal generated after near-infrared light irradiation on the reaction sample in a chemical reaction process, and the spectral response signal comprises three components: a reflection signal, a transmission signal, and a scattering signal;
[0016] The reflection signal is a reflection light intensity sequence generated by near-infrared light on the surface of the reaction sample, and the reflection spectrum is constituted by taking wavelength as an index;
[0017] The transmission signal is a transmission light intensity sequence after the near-infrared light penetrates the reaction sample, and the transmission spectrum is constituted by taking wavelength as an index;
[0018] The scattering signal is an output intensity sequence after the near-infrared light is scattered multiple times inside the reaction sample, and the scattering spectrum is constituted by taking wavelength as an index;
[0019] The data vector composition unit is configured to compose the near-infrared spectral signal into a light intensity data vector composed of the reflection signal, the transmission signal, and the scattering signal, cover a wavelength range of 780 nm to 2500 nm, and form an original spectral data vector with light intensity values as components and wavelengths as dimensions.
[0020] Optionally, the preprocessing comprises noise suppression, baseline correction, and normalization processing.
[0021] Optionally, the generation of the high-dimensional vector set comprises:
[0022] a sample set construction unit configured to receive the normalized spectral matrix and construct an input sample set, wherein each sample is a vector formed by light intensity values corresponding to a plurality of wavelength points;
[0023] a kernel mapping construction unit configured to perform nonlinear mapping on the input sample set based on a preset kernel function, to generate a kernel similarity matrix between samples, for representing nonlinear correlations between different samples in a high-dimensional kernel space;
[0024] a local space partition unit configured to perform density estimation and structure analysis on sample distribution in the kernel similarity matrix between samples, and divide the input sample set into a plurality of local sample sets according to local clustering characteristics of the samples in the kernel space, to form a plurality of local kernel spaces;
[0025] a local feature extraction unit configured to construct a local kernel similarity sub-matrix for each local kernel space, and perform feature extraction on each local kernel similarity sub-matrix, to obtain a principal component feature vector set reflecting local sample structure;
[0026] a principal component fusion unit configured to fuse the principal component feature vector sets of the local sample structures, to construct a unified global principal component basis set as a mapping reference of the feature mapping module;
[0027] a nonlinear feature generation unit configured to project all input samples in the normalized spectral matrix into the global principal component basis set, to generate a high-dimensional vector set representing nonlinear structure features of the spectrum.
[0028] Optionally, the generating of the class label set and the corresponding posterior probability distribution set comprises:
[0029] a sample input unit configured to receive the high-dimensional vector set, construct a sample set, and input the sample set into a Dirichlet process mixture model;
[0030] a model construction unit configured to construct a non-parametric mixture model with a Dirichlet process as a prior distribution based on the sample set, set concentration parameters and base distribution parameters, generate an initial class label set for each sample, and sample corresponding class parameters from the base distribution parameters to generate an initial class parameter set;
[0031] a class sampling unit configured to receive the initial class label set and the initial class parameter set, perform Gibbs sampling on each sample, and reassign class labels according to conditional distributions of the samples and the classes, to generate an updated class label set;
[0032] A parameter updating unit is configured to receive the updated category label set and the corresponding sample set, perform statistical analysis on a sample subset corresponding to each category, and update a parameter set of the corresponding category, including a mean parameter and a covariance parameter;
[0033] A category expansion unit is configured to detect samples not covered in the current category structure, generate new category parameters based on the concentration parameter and the base distribution parameter, integrate the new category samples and the parameters into the updated category label set and the parameter set, and construct an expanded category label set and parameter set;
[0034] A posterior probability calculation unit is configured to receive the expanded category label set and the parameter set, calculate the posterior probability of each sample under all categories, and generate a posterior probability distribution set;
[0035] An output unit is configured to output the finally generated category label set and the corresponding posterior probability distribution set.
[0036] Optionally, the generation of the organic matter concentration prediction value at the current time includes:
[0037] A local prediction unit is configured to receive the high-dimensional vector set, the category label set, and the category parameter set, divide each sample in the high-dimensional vector set into a plurality of subsets according to the category label, and input each subset into a kernel principal component regression model corresponding to the category label to generate a local concentration prediction result set of each sample under different categories;
[0038] A weight acquisition unit is configured to receive the posterior probability distribution set, extract the posterior probability value of each sample under all categories from the posterior probability distribution set, and construct a weight mapping structure corresponding to the local concentration prediction result set in the sample index and the category dimension;
[0039] A weight matrix construction unit is configured to generate a sample-category two-dimensional weight matrix based on the weight mapping structure and the sample category index, to represent the belonging probability of each sample under each category;
[0040] A weighted fusion unit is configured to perform corresponding operation on the sample-category two-dimensional weight matrix and the local concentration prediction result set, and perform weighted fusion on all category local prediction results of each sample according to the weight value to generate the organic matter concentration prediction value at the current time.
[0041] Optionally, the process of calculating the prediction difference and adjusting the structure parameter of the Dirichlet process mixture model and the kernel principal component regression parameter includes:
[0042] A prediction value storage unit is configured to receive the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the previous time, respectively, and establish a prediction value mapping relationship table based on the sample index;
[0043] a difference calculation unit configured to receive the prediction value mapping relationship table, perform element-by-element difference calculation on the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the previous time, take absolute values, and generate prediction differences;
[0044] an error comparison unit configured to receive the prediction differences, compare the difference value of each sample with an error threshold, mark samples with differences exceeding the threshold, generate an error identification set, and simultaneously count the proportion of samples exceeding the threshold;
[0045] a model update determination unit configured to compare the proportion of samples exceeding the threshold with a preset structure adjustment threshold, and output a model structure update instruction when the proportion of samples exceeding the threshold reaches the preset structure adjustment threshold;
[0046] a Dirichlet structure adjustment unit configured to, after receiving the model structure update instruction, obtain a category label set and a posterior probability distribution set of the current period, analyze the distribution of samples in the error identification set in the category label set, calculate a category coverage degree and correct a concentration parameter based on the distribution, and generate a new category parameter set according to the corrected concentration parameter and a current base distribution parameter;
[0047] a structure expansion execution unit configured to combine the new category parameter set with a current category parameter set, update the category label set and the category parameter set, and write them into a Dirichlet process mixture model to form an expanded Dirichlet model structure;
[0048] a mapping update unit configured to, based on the expanded category label set and a standardized spectrum matrix, recalculate a kernel similarity matrix between samples and redivide a local kernel space, perform principal component extraction on each local space, generate a new local principal component set, and combine the new local principal component set into an updated global principal component basis set;
[0049] a parameter replacement unit configured to write the updated global principal component basis set into a kernel principal component regression model to replace original principal component bases, for concentration prediction operations in a next control period.
[0050] Optionally, the generation of the detection output data comprises:
[0051] a concentration result collection unit configured to receive the organic matter concentration prediction value at the current time, and generate a concentration result mapping set based on a sample index;
[0052] a timestamp marking unit configured to obtain time information corresponding to the current control period, and write the time information into the concentration result mapping set to form a concentration record set with time labels;
[0053] A historical data management unit is configured to receive a time-labeled concentration record set in a plurality of continuous control periods and arrange the time-labeled concentration record set in chronological order to construct a concentration prediction time series database;
[0054] A data format construction unit is configured to set an output field structure based on the concentration prediction time series database, including a sample index field, a timestamp field, a predicted concentration field and a period identification field, and organize the standardized detection output data.
[0055] An output data generation unit is configured to serialize and encode the standardized detection output data to generate detection output data.
[0056] The present application has the following advantages:
[0057] (1) The present application introduces a nonlinear feature mapping module constructed by near-infrared spectrum acquisition, spectrum preprocessing and kernel principal component regression method, realizes high-dimensional expression of organic matter characteristics in chemical reaction samples, completes unsupervised clustering recognition of unknown components combined with Dirichlet process mixture model, and outputs accurate category label set and posterior probability distribution, which provides structural basis for subsequent concentration prediction, and significantly improves the characterization ability and adaptability of complex chemical reaction system.
[0058] (2) The present application constructs a weighted fusion mechanism based on category label and posterior probability distribution, fuses local prediction results under multiple categories to generate current concentration prediction value, introduces a prediction error feedback mechanism, automatically triggers model structure adjustment based on the change of concentration prediction value, completes synchronous update of Dirichlet mixture model structure parameters and kernel principal component basis, constructs a closed-loop feedback type model adaptive mechanism, and effectively enhances the robustness and continuous learning ability of the model in dynamic reaction process.
[0059] (3) The present application constructs a complete near-infrared detection system process from spectrum signal acquisition, data processing, feature modeling, clustering analysis, concentration prediction to result output, has full-process closed-loop processing ability from original signal to final detection output, does not depend on manual annotation or static model training, is suitable for online real-time organic matter detection task under variable working conditions, and improves the real-time performance, accuracy and industrial adaptability of detection. BRIEF DESCRIPTION OF DRAWINGS
[0060] The accompanying drawings are included to provide a further understanding of the present application, and constitute a part of the specification, which together with the embodiments of the present application, serve to explain the present application, and do not constitute a limitation of the present application. In the drawings:
[0061] Figure 1 A flow chart of a chemical reaction organic matter real-time detection system based on near-infrared instrument is provided.
[0062] Figure 2 The structural diagram of improved kernel principal component regression feature extraction and high-dimensional vector set generation in the application. DETAILED DESCRIPTION
[0063] The application will now be described in further detail with reference to the drawings. These drawings show only the essential features of the application and are therefore not to scale, and they are used only for illustrating the principles of the application.
[0064] Reference Figures 1-2 A real-time detection system for organic matter in chemical reaction based on near-infrared instrument, comprising the following steps:
[0065] A near-infrared spectrum acquisition module is configured to acquire the near-infrared spectrum signal of the reaction sample during the chemical reaction process and generate a time-series raw spectrum data stream.
[0066] A spectrum preprocessing module is configured to receive the raw spectrum data stream, preprocess the raw spectrum data stream, and generate a standardized spectrum matrix.
[0067] A feature mapping module is configured to receive the standardized spectrum matrix, perform nonlinear mapping on the standardized spectrum matrix based on a kernel principal component regression method, and generate a high-dimensional vector set representing the spectral features.
[0068] A clustering and identification module is configured to receive the high-dimensional vector set, input the high-dimensional vector set into a Dirichlet process mixture model to perform unsupervised clustering analysis, and generate a class label set and a corresponding posterior probability distribution set.
[0069] A concentration estimation module is configured to construct a weighting strategy based on the class label set and the posterior probability distribution set, weight and fuse the concentration prediction results of each class, and generate a predicted value of the organic matter concentration at the current time.
[0070] A feedback updating module is configured to receive the predicted value of the organic matter concentration at the current time and the predicted value of the organic matter concentration at the previous time, calculate a prediction difference, and adjust the structure parameters of the Dirichlet process mixture model and the kernel principal component regression parameters based on the prediction difference.
[0071] An output interface module is configured to receive the predicted value of the organic matter concentration at the current time and a time series thereof, and generate detection output data.
[0072] In this embodiment, the generation of the time-series raw spectrum data stream comprises:
[0073] The near-infrared spectrum acquisition unit is configured to acquire the near-infrared spectrum signal of the reaction sample, which is a spectral response signal generated after near-infrared light is irradiated onto the reaction sample in the chemical reaction process, and the spectral response signal comprises three components: a reflection signal, a transmission signal, and a scattering signal.
[0074] The reflection signal is a reflection light intensity sequence generated by near-infrared light on the surface of the reaction sample, and a reflection spectrum is formed by indexing the wavelength;
[0075] The transmission signal is a transmission light intensity sequence after the near-infrared light penetrates the reaction sample, and a transmission spectrum is formed by indexing the wavelength;
[0076] The scattering signal is an output intensity sequence after the near-infrared light is scattered multiple times inside the reaction sample, and a scattering spectrum is formed by indexing the wavelength;
[0077] The data vector is composed of the light intensity data vector composed of the reflection signal, the transmission signal, and the scattering signal, covers a wavelength range of 780 nm to 2500 nm, forms an original spectrum data vector with light intensity values as components and wavelengths as dimensions;
[0078] The original spectrum data vector is a basic unit of a time sequence original spectrum data stream, generated by a near-infrared spectrum acquisition module and input to a spectrum preprocessing module for subsequent processing.
[0079] In this embodiment, the preprocessing includes noise suppression, baseline correction, and normalization processing;
[0080] Noise suppression is a smoothing process for high-frequency interference in the spectrum by means of sliding average or wavelet denoising, etc., to reduce random errors. Baseline correction uses least squares straight line or polynomial fitting method to calculate and deduct the overall drift trend in the spectrum curve caused by light source fluctuation or sample background. Normalization processing standardizes the spectrum intensity to a unified interval by maximum and minimum value method or vector normalization, so that the light intensity distribution between different samples is comparable.
[0081] In this embodiment, the generation of the high-dimensional vector set includes:
[0082] The sample set construction unit receives the standardized spectrum matrix and constructs an input sample set, where each sample is a vector composed of light intensity values corresponding to multiple wavelength points;
[0083] The kernel mapping construction unit performs nonlinear mapping on the input sample set based on a preset kernel function, generates a kernel similarity matrix between samples, and uses it to represent the nonlinear correlation between different samples in the high-dimensional kernel space;
[0084] The preset kernel function is a function for mapping the input sample in the standardized spectrum matrix from the original space to the high-dimensional feature space, for describing the nonlinear relationship between samples. The kernel function is calculated according to the distance or similarity between samples, and is commonly in the form of radial basis kernel or polynomial kernel, and the kernel similarity matrix is generated by calculating the mapping relationship between sample pairs;
[0085] The local space partition unit performs density estimation and structure analysis on sample distribution in the kernel similarity matrix between samples, divides the input sample set into a plurality of local sample subsets according to local clustering characteristics of the samples in the kernel space, and forms a plurality of local kernel spaces;
[0086] The density estimation and structure analysis calculates the local density of each sample point in the kernel similarity matrix, judges the clustering degree of the sample in the high-dimensional space by using a statistical method based on the number of adjacent samples, and divides sample groups with similar density characteristics in combination with the distribution distance between clustering centers, to construct a plurality of local kernel subspaces;
[0087] The local clustering characteristics of the sample in the kernel space refer to a region with a high similarity value between the sample and its adjacent samples in the kernel similarity matrix, forming a high-density local cluster. The characteristics are measured by summing the similarity or the number of adjacent samples within a specific radius neighborhood, to identify potential substructures;
[0088] The local feature extraction unit constructs a local kernel similarity submatrix for each local kernel space, and performs feature extraction operations in each local kernel similarity submatrix to obtain a principal component feature vector set reflecting the local sample structure;
[0089] The feature extraction operation includes centering the local kernel similarity submatrix, calculating its eigenvalues and corresponding eigenvectors, selecting the first several principal components with the largest eigenvalues to form a feature basis, and mapping the local sample set to the basis to extract the main variation direction in the high-dimensional space as the feature expression;
[0090] The principal component fusion unit fuses the principal component feature vector sets of the local sample structures to construct a unified global principal component basis set as a mapping reference for the feature mapping module;
[0091] The nonlinear feature generation unit projects all input samples in the standardized spectral matrix into the global principal component basis set to generate a high-dimensional vector set representing the nonlinear structure characteristics of the spectrum.
[0092] In the embodiment, the generation of the class label set and the corresponding posterior probability distribution set includes:
[0093] The sample input unit is configured to receive the high-dimensional vector set, construct a sample set, and input the sample set to the Dirichlet process mixture model;
[0094] The model construction unit is configured to construct a non-parametric mixture model with a Dirichlet process as a prior distribution based on the sample set, set a concentration parameter and a base distribution parameter, generate an initial class label for each sample to form an initial class label set, and sample a corresponding class parameter from the base distribution parameter to generate an initial class parameter set;
[0095] The non-parametric mixture model with the Dirichlet process as the prior distribution is constructed by taking the Dirichlet process as an infinite-dimensional prior distribution for generating a parameter set of a potentially infinite number of mixture components under the premise of an unknown number of classes. Specifically, the concentration parameter is set to control the probability of generating a new class, and the base distribution is introduced as the basis for generating each class parameter. Through this prior mechanism, the class attribution of each sample is modeled, so that the model can automatically adjust the number of classes and assign class labels to each sample, thereby forming a mixture model with an expandable class structure. The model does not predefine a fixed total number of classes, and dynamically generates and updates the class structure through Bayesian inference;
[0096] The concentration parameter is a hyperparameter for controlling the probability of generating a new class. The greater the value, the more the model tends to generate more classes. The base distribution parameter is used to define the prior distribution structure of each class parameter, which is usually a conjugate distribution of the sample distribution family, and is used to sample and generate class parameters. Both of them determine the flexibility and class division ability of the model;
[0097] The class sampling unit is configured to receive the initial class label set and the initial class parameter set, perform Gibbs sampling operation on each sample, reassign class labels according to the conditional distribution of the sample and each class, and generate an updated class label set.
[0098] The Gibbs sampling operation is performed in the Dirichlet process mixture model, in which each sample point is iterated in turn. For the current sample, the class assignment and parameter state of other samples are fixed, the conditional probability of the sample under all existing classes is calculated, and the probability of generating a new class is combined to sample and determine the new class attribution of the current sample. This operation is repeated for multiple rounds, so that the model gradually converges to the posterior distribution in the class space, thereby realizing the dynamic reconstruction of the class structure and the update of the sample division;
[0099] The parameter updating unit is configured to receive the updated class label set and the corresponding sample set, perform statistical analysis on the sample subset corresponding to each class, and update the parameter set of the corresponding class, including the mean parameter and the covariance parameter.
[0100] The class expansion unit is configured to detect samples not covered in the current class structure, sample and generate new class parameters based on the concentration parameter and the base distribution parameter, and incorporate the new class samples and parameters into the updated class label set and the parameter set to construct an expanded class label set and a parameter set.
[0101] detecting a sample not covered in the current category structure refers to, after completing a round of category sampling, counting the category assignment results of each sample, if a category only contains the current single sample or the posterior probability of the sample under all existing categories is lower than a set threshold, it is determined that the sample is not effectively covered, the sample is marked as a potential new category candidate, and submitted to the category expansion unit, the unit generates new category parameters from the base distribution according to the concentration parameter of Dirichlet process, and the sample is classified into a new category, so as to realize the dynamic expansion of the model structure;
[0102] a posterior probability calculation unit, configured to receive the expanded category label set and the parameter set, calculate the posterior probability of each sample under all categories, and generate a posterior probability distribution set;
[0103] an output unit, configured to output the finally generated category label set and the corresponding posterior probability distribution set.
[0104] In the embodiment, the generation of the organic matter concentration prediction value at the current time includes:
[0105] a local prediction unit, configured to receive the high-dimensional vector set, the category label set and the category parameter set, divide each sample in the high-dimensional vector set into a plurality of subsets according to the category label, and input into the kernel principal component regression model corresponding to each category label respectively, to generate a local concentration prediction result set of each sample under different categories;
[0106] a weight acquisition unit, configured to receive the posterior probability distribution set, extract the posterior probability value of each sample under all categories from the posterior probability distribution set, and construct a weight mapping structure corresponding to the local concentration prediction result set in the sample index and the category dimension;
[0107] The weight mapping structure refers to a two-dimensional index relationship structure that one-to-one corresponds the posterior probability value of each sample under each category to the corresponding local concentration prediction result. The structure takes the sample number and the category number as the index dimension, forms a sample-category corresponding matrix, and is used to support the subsequent weighted fusion calculation.
[0108] a weight matrix construction unit, configured to generate a sample-category two-dimensional weight matrix based on the weight mapping structure and the sample category index, for representing the belonging probability of each sample under each category;
[0109] a weighted fusion unit, configured to perform corresponding operation on the sample-category two-dimensional weight matrix and the local concentration prediction result set, and perform weighted fusion on all category local prediction results of each sample according to the weight value, to generate the organic matter concentration prediction value at the current time;
[0110] The corresponding operation refers to matching the weight matrix with the elements in the local concentration prediction result set having the same sample number and category number one by one in the weighted fusion process, and performing weighted summation operation according to the corresponding relationship to obtain the final concentration prediction value of each sample;
[0111] The weight value refers to a coefficient used in the weighted fusion process, derived from the posterior probability of the sample under different categories, representing the relative confidence degree of the sample belonging to each category, and each sample corresponds to multiple weight values, respectively corresponding to the belonging possibility thereof under different categories, for weighted processing of the local prediction result.
[0112] In the embodiment, the process of calculating the prediction difference and adjusting the Dirichlet process mixture model structure parameter and the kernel principal component regression parameter includes:
[0113] The prediction value storage unit is configured to receive the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the last time, and establish a prediction value mapping relationship table based on the sample index;
[0114] The difference calculation unit is configured to receive the prediction value mapping relationship table, perform element-by-element difference calculation on the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the last time, take the absolute value, and generate the prediction difference;
[0115] The error comparison unit is configured to receive the prediction difference, compare the difference value of each sample in the prediction difference with the error threshold, mark the samples whose difference exceeds the threshold, generate an error identification set, and simultaneously count the proportion of the out-of-limit samples;
[0116] The error threshold is a limiting parameter for judging the change amplitude of the organic matter concentration prediction value in two consecutive prediction periods, specifically, a fixed numerical range is set, when the prediction value difference of the corresponding samples in the current period and the last period exceeds the numerical value, the prediction abnormal sample is considered, and the model structure updating determination process is triggered;
[0117] The model updating determination unit is configured to compare the proportion of the out-of-limit samples with a preset structure adjustment threshold, and output a model structure updating instruction when the proportion of the out-of-limit samples reaches the preset structure adjustment threshold;
[0118] The preset structure adjustment threshold refers to the proportion threshold of the number of samples whose error exceeds the error threshold to the total number of samples in a prediction period, which is used to judge whether the current model structure needs to be adjusted, and when the proportion of the out-of-limit samples exceeds the threshold, the model parameter updating and structure expansion process is triggered;
[0119] a Dirichlet structure adjustment unit, configured to, after receiving a model structure update instruction, acquire a category label set and a posterior probability distribution set of a current period, analyze a distribution of samples in the error identifier set in the category label set, calculate a category coverage degree based on the distribution, correct a concentration parameter based on the category coverage degree, and sample a new category parameter set based on the corrected concentration parameter and a current base distribution parameter;
[0120] The category coverage degree refers to a coverage capability of each category in the current category structure on all input samples, specifically, a proportion of a number of samples included in each category to a total number of samples, and is used to measure an adaptation degree of the model to a sample distribution under an existing structure, and a low coverage degree reflects insufficient category division;
[0121] a structure expansion execution unit, configured to combine the new category parameter set and a current category parameter set, update a category label set and a category parameter set, and write the updated category label set and the category parameter set into a Dirichlet process mixture model to form an expanded Dirichlet model structure;
[0122] a mapping update unit, configured to, based on the expanded category label set and a standardized spectrum matrix, recalculate a kernel similarity matrix between samples and redivide a local kernel space, perform a principal component extraction operation on each local space, generate a new local principal component set, and combine the new local principal component set into an updated global principal component basis set;
[0123] The principal component extraction operation is performed on each local kernel space, first, a kernel similarity submatrix between all samples in the local kernel space is calculated; then, a centering operation is performed on the kernel similarity submatrix, and eigenvalues and corresponding eigenvectors of the kernel similarity submatrix are calculated; then, eigenvectors corresponding to the first several eigenvalues are selected as a principal component basis vector set; finally, the principal component basis vector set is used to represent principal component features of a local sample structure;
[0124] a parameter replacement unit, configured to write the updated global principal component basis set into a kernel principal component regression model to replace original principal component bases, and used for concentration prediction in a next control period.
[0125] In the embodiment, the generation of the detection output data includes:
[0126] a concentration result acquisition unit, configured to receive an organic matter concentration prediction value at a current time, and generate a concentration result mapping set based on a sample index;
[0127] a timestamp marking unit, configured to acquire time information corresponding to a current control period, and write the time information into the concentration result mapping set to form a concentration record set with a time label;
[0128] The time information refers to a system timestamp corresponding to each concentration prediction data, is usually recorded in the format of year, month, day, hour, minute and second, is used for identifying a specific time point at which the data is generated, and ensures that the detection result is traceable and analyzable in time sequence;
[0129] The historical data management unit is configured to receive a time-labeled concentration record set in a plurality of continuous control periods, and arrange the time-labeled concentration record set in chronological order to construct a concentration prediction time sequence database.
[0130] The data format construction unit is configured to set an output field structure based on the concentration prediction time sequence database, including a sample index field, a timestamp field, a predicted concentration field and a period identification field, and organize the standardized detection output data.
[0131] The output data generation unit is configured to serialize and encode the standardized detection output data to generate detection output data.
[0132] Embodiment 1:
[0133] In order to verify the feasibility of the application in implementation, the application is applied to a certain chemical reaction control scene, and the target is to perform real-time dynamic detection on the concentration of a key organic component in a reaction process, so as to support rapid closed-loop adjustment of reaction parameters. The real-time detection system for organic matter in a chemical reaction based on a near-infrared instrument provided by the application is applied to such a scene, and the core target is to replace the traditional manual sampling and laboratory detection mode, reduce detection delay, and improve reaction stability and process quality control capability.
[0134] In this application, the reaction system is a multi-component dynamic change system, the chemical reaction is intense, and the product component is sensitive to temperature and raw material ratio. In this environment, the deployment process of the system of the application is as follows:
[0135] A near-infrared spectrum acquisition probe is installed on a pipeline at a discharge side of a reaction device, and an acquisition frequency of one time per second is set through a real-time control module. In the entire detection period, the spectrum acquisition module continuously acquires reflection signals, transmission signals and scattering signals of a sample in a near-infrared waveband (780 nm~2500 nm) in a reaction process. These signals are combined into complete spectrum response data, and are structured to form a sequence of original spectrum data vectors with light intensity as a value and wavelength as an index.
[0136] The acquired original spectrum data is first input into a spectrum pretreatment module to perform a plurality of steps of standardization operation, including performing noise suppression by using a convolution smoothing filter, performing baseline correction by using a least square fitting method, and normalizing to a range of [0, 1], to output a standardized spectrum matrix. The standardized spectrum matrix is then input into a feature mapping module.
[0137] In the feature mapping module, the system constructs an input sample set, sets a radial basis kernel function and performs kernel mapping operations to generate a kernel similarity matrix between samples. The system performs structural analysis on the matrix through density estimation, automatically divides the samples into multiple local kernel spaces. For each local kernel space, a corresponding sub-matrix is constructed and principal component extraction operations are performed to generate a local principal component set. The system fuses all local principal component sets into a unified global principal component basis, maps the standardized spectral matrix to the basis, and generates a high-dimensional vector set with non-linear structure representation capability.
[0138] The high-dimensional vector set is input into the Dirichlet process mixture model in the clustering recognition module. The model sets the concentration parameter and Gaussian base distribution as the priori, and uses the Gibbs sampling method to perform unsupervised clustering on the samples. The model updates the class label and posterior probability according to the sampling result of each round, and dynamically expands the class structure. After clustering, the system outputs the class label of each sample and its posterior probability in all classes.
[0139] Enter the concentration estimation process. The high-dimensional vector set and the class label set are sent to multiple corresponding kernel principal component regression sub-models for local prediction. The system combines the posterior probability obtained by clustering to construct a weight matrix, and performs weighted fusion of the corresponding samples to output the final organic component concentration prediction value. The prediction value and the previous cycle prediction value are sent to the difference analysis module to perform point-by-point difference calculation and comparison with the error threshold.
[0140] When the system monitors that the prediction difference of consecutive samples exceeds the error threshold, and the proportion is higher than the preset structure adjustment threshold, the model structure adjustment process is automatically triggered. At this time, the system reanalyzes the distribution of error samples in the class structure, dynamically adjusts the concentration parameter and class expansion structure of the Dirichlet model, and updates the global principal component basis structure in the feature mapping module, thereby realizing the incremental iteration and structure adaptation of the model.
[0141] The concentration prediction value is updated synchronously with the time sequence and input into the output interface module. The module formats and combines the timestamp, concentration prediction value, predicted class and confidence of each sample into detection output data, and serializes the data in a standard structured data format, and outputs it to the field control system for process optimization. In order to evaluate the performance of the system, the following data statistical table is constructed:
[0142] Table 1: Sample prediction accuracy statistical table in continuous detection cycle
[0143] Detection period Total sample number Excessive error threshold sample number Model structure update number Average prediction error (%) Maximum prediction error (%) 1st period 300 18 0 0.22 0.48 2nd period 300 21 1 0.26 0.55 3rd period 300 14 0 0.19 0.41 4th period 300 25 1 0.31 0.62 5th period 300 11 0 0.16 0.38
[0144] Table 2: Comparison table of class number and convergence rate after model structure expansion
[0145] Number of classes before update Number of classes after update Clustering round number (average) Convergence round number change rate (%) Average posterior confidence 4 6 15 -28.3% 0.89 5 8 13 -34.1% 0.91
[0146] According to the data in Table 1 and Table 2, we can draw the following detailed analysis: in Table 1, the system processes 300 samples per cycle in five consecutive detection cycles, maintains a low average prediction error, ranging from 0.16% to 0.31%. The maximum prediction error is also controlled within 0.62%. Among them, in the 2nd cycle and the 4th cycle, the number of over-error threshold samples is 21 and 25 respectively, which exceeds the preset structure adjustment threshold of the system, successfully triggering the model structure updating mechanism. This shows that the system has the ability to respond to the fluctuation of prediction error, and can maintain the overall prediction stability through structure adjustment. Table 2 further shows that after the number of categories increases after structure expansion (such as from 4 to 6, from 5 to 8), the average number of rounds of clustering decreases from 15 rounds before adjustment to 13 rounds, and the convergence speed increases by 28.3% to 34.1%. In addition, the average posteriori confidence increases to 0.89 and 0.91, reflecting that after the optimization of the category structure, the sample clustering is more concentrated and stable.
[0147] In summary, the embodiments show that the system of the present application can realize high-frequency and high-accuracy online detection without relying on external intervention, has the characteristics of dynamic adaptation, multi-model fusion, self-feedback optimization, etc., and significantly improves the detection ability and response efficiency of the organic matter concentration in the chemical process.
[0148] The above describes only the preferred specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can make equivalent replacements or changes to the technical solutions and inventive concepts of the present application within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application.
Claims
1. A near-infrared instrument-based real-time detection system for organic chemicals in chemical reactions, characterized in that, The method comprises the steps of: a near-infrared spectrum acquisition module for acquiring the near-infrared spectrum signal of the reaction sample in the chemical reaction process to generate a time sequence of original spectrum data stream; a spectrum preprocessing module for receiving the original spectrum data stream, preprocessing the original spectrum data stream to generate a standardized spectrum matrix; a feature mapping module for receiving the standardized spectrum matrix, performing nonlinear mapping on the standardized spectrum matrix based on a kernel principal component regression method to generate a high-dimensional vector set representing spectral features; a clustering identification module for receiving the high-dimensional vector set, inputting the high-dimensional vector set into a Dirichlet process mixture model to perform unsupervised clustering analysis, generating a class label set and a corresponding posterior probability distribution set; a concentration estimation module for constructing a weighted strategy based on the class label set and the posterior probability distribution set, weighting and fusing the concentration prediction results of each class to generate an organic matter concentration prediction value at the current time; a feedback update module for receiving the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the last time, calculating a prediction difference, and adjusting the Dirichlet process mixture model structure parameters and the kernel principal component regression parameters based on the prediction difference; an output interface module for receiving the organic matter concentration prediction value at the current time and its time sequence to generate detection output data.
2. The system for real-time detection of organic chemicals in chemical reactions based on near-infrared instrument according to claim 1, characterized in that, The generation of the time sequence of original spectrum data stream comprises: a near-infrared spectrum acquisition unit, the near-infrared spectrum signal of the reaction sample is a spectrum response signal generated after near-infrared light irradiation to the reaction sample in the chemical reaction process, the spectrum response signal includes three components of reflection signal, transmission signal and scattering signal; the reflection signal is a reflection light intensity sequence generated by near-infrared light on the surface of the reaction sample, constituting a reflection spectrum with wavelength as index; the transmission signal is a transmission light intensity sequence after near-infrared light penetrating the reaction sample, constituting a transmission spectrum with wavelength as index; the scattering signal is an output intensity sequence after near-infrared light scattering multiple times inside the reaction sample, constituting a scattering spectrum with wavelength as index; a data vector composition unit, the near-infrared spectrum signal is composed of the light intensity data vector composed of the reflection signal, the transmission signal and the scattering signal, covering a wavelength range of 780nm to 2500nm, forming an original spectrum data vector with light intensity value as component and wavelength as dimension.
3. The system according to claim 1, wherein, The preprocessing comprises: noise suppression, baseline correction and normalization processing.
4. The system for real-time detection of organic chemicals in chemical reactions based on near-infrared instrument according to claim 1, characterized in that, The generation of the high-dimensional vector set comprises: a sample set construction unit for receiving the standardized spectrum matrix and constructing an input sample set; a kernel mapping construction unit for performing nonlinear mapping on the input sample set based on a preset kernel function to generate a kernel similarity matrix between samples; a local space division unit for performing density estimation and structure analysis on the sample distribution in the kernel similarity matrix between samples, dividing the input sample set into multiple local sub-sample sets according to the local aggregation characteristics of the samples in the kernel space to form several local kernel spaces; a local feature extraction unit for constructing a local kernel similarity sub-matrix for each local kernel space and performing feature extraction operation in each local kernel similarity sub-matrix to obtain a principal component feature vector set reflecting the local sample structure; The principal component fusion unit fuses the principal component feature vector sets of the local sample structures to construct a unified global principal component base set; The nonlinear feature generation unit projects all input samples in the standardized spectral matrix into the global principal component base set to generate a high-dimensional vector set representing the nonlinear structural features of the spectrum.
5. The system for real-time detection of organic chemicals in chemical reactions based on near-infrared instrument according to claim 1, characterized in that, The generation of the category label set and the corresponding posterior probability distribution set includes: The sample input unit receives the high-dimensional vector set, constructs a sample set, and inputs the sample set into the Dirichlet process mixture model; The model construction unit constructs a non-parametric mixture model with the Dirichlet process as the prior distribution based on the sample set, sets the concentration parameter and the base distribution parameter, generates an initial category label for each sample to form an initial category label set, and samples the corresponding category parameter from the base distribution parameter to generate an initial category parameter set; The category sampling unit receives the initial category label set and the initial category parameter set, performs Gibbs sampling operation on each sample, reassigns the category label according to the conditional distribution of the sample and each category, and generates an updated category label set; The parameter updating unit receives the updated category label set and the corresponding sample set, performs statistical analysis on the sample subset corresponding to each category, and updates the parameter set of the corresponding category, including the mean parameter and the covariance parameter; The category expansion unit detects samples not covered in the current category structure, samples new category parameters based on the concentration parameter and the base distribution parameter, and integrates the new category samples and parameters into the updated category label set and the parameter set to construct an expanded category label set and parameter set; The posterior probability calculation unit receives the expanded category label set and the parameter set, calculates the posterior probability of each sample under all categories, and generates a posterior probability distribution set; The output unit outputs the finally generated category label set and the corresponding posterior probability distribution set.
6. The system for real-time detection of organic chemicals in chemical reactions based on near-infrared instrument according to claim 1, characterized in that, The generation of the organic matter concentration prediction value at the current time includes: The local prediction unit receives the high-dimensional vector set, the category label set, and the category parameter set, divides each sample in the high-dimensional vector set into several subsets according to the category label, and inputs them into the kernel principal component regression model corresponding to each category label to generate a local concentration prediction result set of each sample under different categories; The weight acquisition unit receives the posterior probability distribution set, extracts the posterior probability value of each sample under all categories, and constructs a weight mapping structure corresponding to the local concentration prediction result set in the sample index and category dimension; The weight matrix construction unit generates a sample-category two-dimensional weight matrix based on the weight mapping structure and the sample category index, which represents the belonging probability of each sample under each category; The weighted fusion unit performs corresponding operation on the sample-category two-dimensional weight matrix and the local concentration prediction result set, and performs weighted fusion on the local prediction results of all categories of each sample according to the weight value to generate the organic matter concentration prediction value at the current time.
7. The system according to claim 1, wherein the system is characterized by: The calculation of the prediction difference and the process of adjusting the structure parameter of the Dirichlet process mixture model and the parameter of the kernel principal component regression include: A prediction value storage unit is configured to receive the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the previous time, and establish a prediction value mapping table based on the sample index; A difference calculation unit is configured to receive the prediction value mapping table, perform element-by-element difference calculation on the organic matter concentration prediction value at the current time and the organic matter concentration prediction value at the previous time, take the absolute value, and generate a prediction difference; An error comparison unit is configured to receive the prediction difference, compare the difference value of each sample in the prediction difference with an error threshold, mark the samples whose difference exceeds the threshold, and generate an error identification set while counting the proportion of the samples exceeding the threshold; A model update determination unit is configured to compare the proportion of the samples exceeding the threshold with a preset structure adjustment threshold, and output a model structure update instruction when the proportion of the samples exceeding the threshold reaches the preset structure adjustment threshold; A Dirichlet structure adjustment unit is configured to, after receiving the model structure update instruction, obtain the category label set and the posterior probability distribution set of the current period, analyze the distribution of the samples in the error identification set in the category label set, calculate the category coverage based on the distribution and correct the concentration parameter, and generate a new category parameter set based on the corrected concentration parameter and the current base distribution parameter; A structure expansion execution unit is configured to combine the new category parameter set with the current category parameter set, update the category label set and the category parameter set, and write them into the Dirichlet process mixture model to form an expanded Dirichlet model structure; A mapping update unit is configured to, based on the expanded category label set and the standardized spectral matrix, recalculate the kernel similarity matrix between samples and redivide the local kernel space, perform principal component extraction on each local space to generate a new local principal component set, and combine the new local principal component set into an updated global principal component basis set; A parameter replacement unit is configured to write the updated global principal component basis set into the kernel principal component regression model.
8. The system for real-time detection of organic chemicals in chemical reactions based on near-infrared instruments according to claim 1, wherein, The generation of the detection output data includes: A concentration result collection unit is configured to receive the organic matter concentration prediction value at the current time, and generate a concentration result mapping set based on the sample index; A timestamp marking unit is configured to obtain time information corresponding to the current control period, and write the time information into the concentration result mapping set to form a time-labeled concentration record set; A historical data management unit is configured to receive the time-labeled concentration record set in a plurality of consecutive control periods, and arrange them in chronological order to construct a concentration prediction time series database; A data format construction unit is configured to set the output field structure based on the concentration prediction time series database, including a sample index field, a timestamp field, a prediction concentration field and a period identification field, and organize the output field structure into standardized detection output data; An output data generation unit is configured to serialize and encode the standardized detection output data to generate detection output data.