Method for detecting methanol and ethanol in vehicle gasoline based on near infrared spectrum

By constructing a near-infrared spectroscopy-based detection model for automotive gasoline, the problems of unstable detection accuracy and poor adaptability were solved, achieving efficient and accurate detection of methanol and ethanol, adapting to multiple environmental scenarios, and improving detection accuracy and stability.

CN121703045APending Publication Date: 2026-03-20GANSU PROD QUALITY SUPERVISION & INSPECTION RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-12
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies for detecting methanol and ethanol in automotive gasoline suffer from unstable detection accuracy and poor adaptability, failing to meet the demand for rapid and high-precision on-site detection, and not fully utilizing the environmental adaptation and data collaborative processing capabilities of intelligent sensing systems.

Method used

By analyzing environmental data to determine normal labels, constructing a detection model for automotive gasoline, obtaining real-time environmental vectors, and combining near-infrared spectral data, we can achieve synergistic optimization of environmental characteristics and sample gradients, iterative error purification, and benchmark environment screening, thus constructing a high-precision detection method adaptable to multiple environments.

Benefits of technology

It enables efficient and accurate detection of methanol and ethanol in automotive gasoline under various environments, improving detection accuracy and stability, adapting to various on-site testing scenarios, and enhancing the quality of spectral data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121703045A_ABST
    Figure CN121703045A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of optical metrology, and particularly discloses a method for detecting methanol and ethanol in automotive gasoline based on near infrared spectroscopy, which comprises the following steps: acquiring detection environment data, and determining normal label and environment combination data; acquiring gasoline sample data to determine gasoline gradient sample data; determining an initial environment prediction error value of each first environment combination vector in the environment combination data; determining an iterative environment prediction error value and a reference environment vector of each second environment combination vector in the environment sampling data, and constructing a vehicle gasoline detection model; and acquiring real-time environment data and the to-be-detected vehicle gasoline, and determining the detected methanol concentration and the detected ethanol concentration of the to-be-detected gasoline. According to the method, collaborative optimization of environment characteristics and sample gradients and collaboration of error iteration purification and benchmark environment screening can be achieved, high efficiency of real-time detection and result precision are considered, detection precision and stability are improved, real-time efficient detection is achieved, and the method is adaptive to various detection scenes on site.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical metrology, and in particular to a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy. Background Technology

[0002] The detection of methanol and ethanol content in automotive gasoline is crucial for ensuring fuel quality and safety. Early detection methods primarily relied on chemical titration and gas chromatography, which are cumbersome, time-consuming, and dependent on specialized laboratories and personnel, failing to meet the needs of rapid on-site testing. With advancements in detection technology, near-infrared spectroscopy has gradually been applied in this field due to its speed and efficiency. However, traditional near-infrared detection ignores environmental interference with spectral signals, lacks gradient representativeness in sample selection, and suffers from poor model adaptability, resulting in significant fluctuations and deviations in detection accuracy under different environments. This makes it difficult to meet the practical needs of precise on-site testing. Furthermore, existing solutions do not fully integrate the environmental adaptability and data collaborative processing capabilities of intelligent sensing systems, fail to leverage the precise sensing characteristics of intelligent sensors to offset environmental interference, and do not improve the stability of spectral data through the signal optimization functions of intelligent sensing elements. Therefore, a high-precision detection method adaptable to multiple environments is urgently needed.

[0003] Therefore, this invention proposes a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy. Summary of the Invention

[0004] This invention provides a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy. By analyzing all acquired detection environment data, the method determines the normal labels for all detection environments, the environmental combination data of automotive gasoline, and the gasoline sample data to determine the gasoline gradient sample data. It also determines the initial environmental prediction error value of each initial environmental combination vector in the environmental combination data, the iterative environmental prediction error value of each second environmental combination vector in the environmental sampling data, the automotive gasoline environmental data, and the baseline environmental vector. A detection model for automotive gasoline is then constructed. Real-time environmental data is acquired to determine the real-time environmental vector, and real-time near-infrared spectral data of the automotive gasoline to be tested is obtained. Finally, the detection model is used to determine the detection concentrations of methanol and ethanol in the gasoline to be tested. This method achieves accurate characterization of the normal environmental label, synergistic optimization of environmental features and sample gradients, and synergistic error iteration and baseline environmental screening. It balances the efficiency and accuracy of real-time detection, improves detection precision and stability, achieves real-time and efficient detection, and is adaptable to various on-site detection scenarios.

[0005] This invention provides a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, comprising: S1: Acquire detection environment data for multiple detection environments of automotive gasoline, analyze the detection environment data of all detection environments, determine the normal label of all detection environments, and determine the environmental combination data of automotive gasoline; S2: Obtain gasoline sample data for automotive gasoline, and analyze the gasoline sample data to determine the gasoline gradient sample data for automotive gasoline; S3: Based on the environmental combination data of vehicle gasoline and gasoline gradient sample data, determine the initial environmental prediction error value of all initial environmental detection models for each first environmental combination vector in the environmental combination data; S4: Based on the initial environmental prediction error value of each first environmental combination vector in the gasoline gradient sample data and environmental combination data, determine the iterative environmental prediction error value of each second environmental combination vector in the environmental sampling data, vehicle gasoline environmental data and benchmark environmental vector, and construct a vehicle gasoline detection model. S5: Obtain real-time environmental data to determine the real-time environmental vector, obtain the gasoline to be tested and perform near-infrared spectroscopy detection, determine the real-time near-infrared spectral data, and based on the real-time spectral vector, real-time environmental vector, and gasoline detection model, determine the detection methanol concentration and detection ethanol concentration of the gasoline to be tested.

[0006] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy involves acquiring detection environment data from multiple detection environments, analyzing the detection environment data from all environments, and determining the normality label for all detection environments, including: The detection environment data of multiple detection environments for detecting methanol and ethanol concentrations in automotive gasoline are acquired. Feature extraction is performed on the detection environment data of each detection environment to determine the detection environment vector of each detection environment. The detection environment vector includes environmental feature values ​​of multiple environmental features. The detection environment vectors of all detection environments are standardized to determine the standardized environment vector for each detection environment, and the standardized environment matrix for all detection environments is determined. Principal component analysis was performed on the standard environment matrix of all detection environments to determine the principal component environment matrix of all detection environments and the variance contribution rate of each principal component in the principal component environment matrix. Based on the principal component environment matrix of all detection environments and the variance contribution rate of all principal components in the principal component environment matrix, the normal label of the principal component environment matrix of all detection environments is calculated, where the normal label includes approximate and non-approximate labels.

[0007] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, determining environmental composition data of automotive gasoline, includes: If the normal labels of the principal component environment matrices of all detected environments are approximate, the joint probability density is determined based on the multivariate normal distribution; if the normal labels of the principal component environment matrices of all detected environments are not approximate, the joint probability density is determined based on the Gaussian coupling connection function. Based on the joint probability density, the 1% contour lines of all detection environments are determined and isosurfaces are cut. The space inside the cut isosurfaces is coarsely meshed. Based on all mesh points with a joint probability density greater than 1% after coarse meshing, the initial high-density point set and the first environment combination vector of each point in the initial high-density point set are determined. Based on the first environmental combination vector of all points in the initial high-density point set, determine the environmental combination data of automotive gasoline.

[0008] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy includes acquiring gasoline sample data, analyzing the gasoline sample data to determine gasoline gradient sample data, and comprising: Obtain gasoline sample data for vehicles, including multiple gasoline samples and the actual methanol concentration and actual ethanol concentration of each gasoline sample; Based on the actual methanol concentration and actual ethanol concentration of each gasoline sample, a concentration level label is determined for each gasoline sample, which includes low, medium and high concentration levels. Based on the concentration level labels of all gasoline samples, all automotive gasoline samples were extracted from the gasoline sample data to determine the gasoline gradient sample data for automotive gasoline.

[0009] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, based on environmental combination data of automotive gasoline and gasoline gradient sample data, determines the initial environmental prediction error value of all initial environmental detection models for each first environmental combination vector in the environmental combination data, including: For each automotive gasoline sample in the gasoline gradient sample data, near-infrared spectroscopy detection is performed under each first environmental combination vector in the environmental combination data to determine the sample environmental detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environmental combination vector; Preprocessing and feature extraction are performed on the sample environment detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector to determine the near-infrared spectral vector of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector. Based on the number of automotive gasoline samples in the gasoline gradient sample data, determine the specified number of partitions and the initial training number; Based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, the near-infrared spectral vector of each first environment combination vector is divided into a specified number of parts. Each part of each first environment combination vector is selected as the initial detection test data, and the initial training number of parts other than the specified parts are used as the initial detection training data. The initial detection test data and the initial detection training data selected each time are determined as an initial model construction data for each first environment combination vector. Using the near-infrared spectral vectors of all automotive gasoline samples in the initial detection training data of each initial model construction data of each first environment combination vector as independent variables, and the actual methanol concentration and actual ethanol concentration of all automotive gasoline samples in the gasoline gradient sample data as dependent variables, the initial environment detection model of each initial model construction data of each first environment combination vector is constructed. The near-infrared spectral vector of each gasoline sample in the initial detection test data of each initial model construction data of each first environmental combination vector is input into the corresponding environmental detection model to determine the predicted methanol concentration and predicted ethanol concentration of each gasoline sample in the initial detection test data of each initial model construction data of each first environmental combination vector. Based on the predicted methanol concentration and predicted ethanol concentration of all automotive gasoline samples in the detection test data of each initial model construction data of each first environment combination vector, and the actual methanol concentration and actual ethanol concentration of all automotive gasoline samples in the gasoline gradient sample data, the actual prediction error value of the initial environment detection model of each initial model construction data of each first environment combination vector is determined. The actual prediction error value of the initial environment detection model is determined based on the data of all initial models constructed for each first environment combination vector.

[0010] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, comprising determining the iterative environmental prediction error value of environmental sampling data, the iterative environmental prediction error value of each second environmental combination vector in environmental sampling data, automotive gasoline environmental data, and a baseline environmental vector based on the initial environmental prediction error value of each first environmental combination vector in gasoline gradient sample data and environmental combination data, automotive gasoline environmental data, and a baseline environmental vector, including: The initial environment prediction error and the set error threshold of each first environment combination vector are judged. If the initial environment prediction error is greater than the set error threshold, the error label of the first environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the set error threshold, the error label of the first environment combination vector is determined to be normal. Spatial filling sampling is performed on the points corresponding to the first environmental combination vector with high error label to determine the environmental sampling data of vehicle gasoline. The environmental sampling data includes multiple second environmental combination vectors. The number of iterations for training is determined based on the initial number of training units and the specified number of partitions. Preprocessing and feature extraction are performed on the sample environment detection data of each vehicle gasoline sample in the gasoline gradient sample data based on each second environmental combination vector in the environmental sampling data to determine the near-infrared spectral vector of each vehicle gasoline sample in the gasoline gradient sample data based on each second environmental combination vector. Based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, the near-infrared spectral vector of each second environment combination vector, the specified number of divisions, and the number of iterations for training, the iterative environment prediction error value of each second environment combination vector is determined iteratively. For each second environment combination vector, the iterative environment prediction error and the iterative error threshold are judged. If the iterative environment prediction error is greater than the iterative error threshold, the error label of the second environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the iterative error threshold, the error label of the second environment combination vector is determined to be normal. Until the error labels of all second environment combination vectors are normal or the number of iterations equals the maximum iteration threshold, the first environment combination vectors and second environment combination vectors with all error labels being normal are determined to be automotive gasoline environment data. In the automotive gasoline environmental data, the first or second environmental combination vector with the smallest initial environmental prediction error value or iterative environmental prediction error value is selected as the baseline environmental vector.

[0011] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, comprising constructing a detection model for automotive gasoline, including: Based on the predicted methanol and ethanol concentrations of all automotive gasoline samples in all detection and test data of the benchmark environmental vector, and the predicted methanol and ethanol concentrations of all automotive gasoline samples in all detection and test data of each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data other than the benchmark environmental vector, the benchmark prediction deviation between the benchmark environmental vector and each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data is determined, wherein the benchmark prediction deviation includes the benchmark methanol deviation and the benchmark ethanol deviation. Based on the baseline environment vector and each first environment combination vector or second environment combination vector other than the baseline environment vector in the vehicle gasoline environment data, determine the environment offset vector between the baseline environment vector and each first environment combination vector or second environment combination vector in the vehicle gasoline environment data. Using the environmental offset vector of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data as the independent variable, and the benchmark prediction deviation of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data as the dependent variable, a fitting error model of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data is constructed, and the environmental correction function of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data is determined. A gasoline detection model is constructed based on all actual prediction errors of the first or second environmental combination vector corresponding to the baseline environmental vector, the near-infrared spectral vectors of all gasoline samples in all test data, the baseline environmental vector, and the environmental correction function of each first or second environmental combination vector.

[0012] Preferably, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy includes acquiring real-time environmental data to determine a real-time environmental vector, acquiring the automotive gasoline to be tested and performing near-infrared spectral detection to determine real-time near-infrared spectral data, and determining the detection concentrations of methanol and ethanol in the gasoline based on the real-time spectral vector, the real-time environmental vector, and an automotive gasoline detection model. The method comprises: Acquire the gasoline to be tested and real-time environmental data, extract features from the real-time environmental data, and determine the real-time environmental vector; Near-infrared spectroscopy is performed on the gasoline to be tested to determine the real-time near-infrared spectral data of the gasoline; Feature extraction is performed on the real-time near-infrared spectral data of the gasoline to be tested to determine the real-time spectral vector of the gasoline to be tested; The real-time spectral vector and real-time environmental vector of the gasoline to be tested are input into the vehicle gasoline detection model to determine the detection concentration of methanol and ethanol in the gasoline to be tested.

[0013] The beneficial effects of this invention compared to existing technologies are as follows: By analyzing all acquired detection environment data, the normal labels of all detection environments and environmental combination data of automotive gasoline are determined. The gasoline sample data is analyzed to determine the gasoline gradient sample data of automotive gasoline. The initial environmental prediction error values ​​of all initial environmental detection models, environmental sampling data, iterative environmental prediction error values ​​of each second environmental combination vector in the environmental sampling data, automotive gasoline environmental data, and benchmark environmental vectors are determined for each first environmental combination vector in the environmental combination data. An automotive gasoline detection model is then constructed. Real-time environmental data is acquired to determine real-time environmental vectors. Real-time near-infrared spectral data of the automotive gasoline to be tested is acquired. Combined with the automotive gasoline detection model, the detection methanol concentration and ethanol concentration of the gasoline to be tested are determined. This invention can achieve accurate characterization of environmental normal labels, synergistic optimization of environmental features and sample gradients, and synergistic error iteration purification and benchmark environment screening. It balances the efficiency and accuracy of real-time detection, improves detection precision and stability, achieves real-time and efficient detection, and is adaptable to various on-site detection scenarios. This method can be deeply adapted to intelligent sensing elements, enhancing the quality of spectral data through their high-precision signal acquisition capabilities; at the same time, it integrates the multi-dimensional data integration advantages of intelligent sensing systems to achieve real-time linkage between environmental data and spectral data; in addition, it can give full play to the autonomous calibration characteristics of intelligent sensors, further expanding their application scope in automotive gasoline testing scenarios.

[0014] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in this application.

[0015] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0016] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, as described in an embodiment of the present invention. Detailed Implementation

[0017] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention. Example 1:

[0018] This invention provides a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, referencing... Figure 1 ,include: S1: Acquire detection environment data for multiple detection environments of automotive gasoline, analyze the detection environment data of all detection environments, determine the normal label of all detection environments, and determine the environmental combination data of automotive gasoline; S2: Obtain gasoline sample data for automotive gasoline, and analyze the gasoline sample data to determine the gasoline gradient sample data for automotive gasoline; S3: Based on the environmental combination data of vehicle gasoline and gasoline gradient sample data, determine the initial environmental prediction error value of all initial environmental detection models for each first environmental combination vector in the environmental combination data; S4: Based on the initial environmental prediction error value of each first environmental combination vector in the gasoline gradient sample data and environmental combination data, determine the iterative environmental prediction error value of each second environmental combination vector in the environmental sampling data, vehicle gasoline environmental data and benchmark environmental vector, and construct a vehicle gasoline detection model. S5: Obtain real-time environmental data to determine the real-time environmental vector, obtain the gasoline to be tested and perform near-infrared spectroscopy detection, determine the real-time near-infrared spectral data, and based on the real-time spectral vector, real-time environmental vector, and gasoline detection model, determine the detection methanol concentration and detection ethanol concentration of the gasoline to be tested.

[0019] In this embodiment, relevant testing environment data for multiple testing environments used to test automotive gasoline are acquired. All collected testing environment data are analyzed to determine the normal distribution label for each testing environment. The normal distribution label is used to accurately characterize the distribution characteristics of the testing environment data and is mainly divided into two types: approximate and non-approximate. Simultaneously, the environmental combination data required for automotive gasoline testing is determined. This environmental combination data includes all valid testing environment combinations that have undergone preliminary screening.

[0020] In this embodiment, gasoline sample data for automotive gasoline is acquired. This data includes multiple different types of automotive gasoline samples, along with the actual methanol and ethanol concentrations for each sample. These actual concentrations are determined using precise and reliable detection methods, accurately reflecting the actual component content of each sample. The collected gasoline sample data is analyzed in depth. Based on the differences in the actual methanol and ethanol concentrations of each sample, different concentration levels are identified, and representative samples are selected to determine the gasoline gradient sample data for automotive gasoline. The gasoline gradient sample data comprehensively covers automotive gasoline samples at low, medium, and high concentration levels, fully reflecting the spectral characteristics of automotive gasoline at different methanol and ethanol concentrations.

[0021] In this embodiment, for each first environmental combination vector in the environmental combination data, each automotive gasoline sample in the gasoline gradient sample data is placed in the detection environment corresponding to that first environmental combination vector for near-infrared spectroscopy detection to obtain the spectral data of each sample in that environment. Based on these spectral data and the actual concentration data of the gasoline gradient samples, all initial environmental detection models corresponding to that first environmental combination vector are constructed, and the initial environmental prediction error value of each initial environmental detection model is calculated through model testing. These initial environmental prediction error values ​​are used to measure the detection accuracy of the initial detection model under each first environmental combination vector.

[0022] In this embodiment, a first environmental combination vector with a large initial error is selected and subjected to space-filling sampling to determine the environmental sampling data for automotive gasoline. This environmental sampling data contains multiple new second environmental combination vectors. For each second environmental combination vector, the relevant detection and model building process is repeated, iteratively calculating the iterative environmental prediction error value for each second environmental combination vector. This iterative optimization continues until the errors of all environmental combination vectors reach a set requirement or the maximum number of iterations is reached. At this point, all first and second environmental combination vectors with acceptable errors are integrated to determine the automotive gasoline environmental data. Simultaneously, the environmental combination vector with the smallest error is selected from the automotive gasoline environmental data as the baseline environmental vector. Combining the baseline environmental vector, error data, and spectral data, the final automotive gasoline detection model is constructed.

[0023] In this embodiment, environmental data from the testing site is acquired in real time. Feature extraction is performed on the real-time environmental data, redundant information is removed, and a real-time environmental vector characterizing the real-time environmental state is determined. Simultaneously, a sample of the gasoline to be tested is acquired, and near-infrared spectroscopy is performed on the sample. Real-time near-infrared spectral data of the sample is acquired, and feature extraction and purification are performed on the spectral data to determine the real-time spectral vector of the gasoline to be tested. The real-time spectral vector and the real-time environmental vector are input into the previously constructed gasoline testing model according to the model's required format. The model automatically calls its internal deviation correction and analysis modules, combining baseline environmental data and error correction functions to eliminate the influence of real-time environmental interference on the test results. Finally, the methanol and ethanol concentrations of the gasoline to be tested are accurately calculated and output.

[0024] The beneficial effects of the above technology are as follows: By analyzing the detection environment data of all acquired detection environments, the normal labels of all detection environments and the environmental combination data of automotive gasoline are determined. The gasoline sample data obtained is analyzed to determine the gasoline gradient sample data of automotive gasoline. The initial environmental prediction error values ​​of all initial environmental detection models for each first environmental combination vector in the environmental combination data, the iterative environmental prediction error values ​​of each second environmental combination vector in the environmental sampling data, the automotive gasoline environmental data, and the benchmark environmental vector are determined. An automotive gasoline detection model is then constructed. Real-time environmental data is acquired to determine the real-time environmental vector. Real-time near-infrared spectral data of the automotive gasoline to be tested is acquired. Combined with the automotive gasoline detection model, the detection methanol concentration and ethanol concentration of the gasoline to be tested are determined. This technology can achieve accurate characterization of environmental normal labels, synergistic optimization of environmental features and sample gradients, and synergistic error iteration purification and benchmark environment screening. It balances the efficiency and accuracy of real-time detection, improves detection precision and stability, achieves real-time and efficient detection, and is adaptable to various on-site detection scenarios. Example 2:

[0025] Based on Example 1, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy is provided. This method acquires detection environment data from multiple detection environments for automotive gasoline, analyzes the detection environment data from all environments, and determines the normality label for all detection environments, including: The detection environment data of multiple detection environments for detecting methanol and ethanol concentrations in automotive gasoline are acquired. Feature extraction is performed on the detection environment data of each detection environment to determine the detection environment vector of each detection environment. The detection environment vector includes environmental feature values ​​of multiple environmental features. The detection environment vectors of all detection environments are standardized to determine the standardized environment vector for each detection environment, and the standardized environment matrix for all detection environments is determined. Principal component analysis was performed on the standard environment matrix of all detection environments to determine the principal component environment matrix of all detection environments and the variance contribution rate of each principal component in the principal component environment matrix. Based on the principal component environment matrix of all detection environments and the variance contribution rate of all principal components in the principal component environment matrix, the normal label of the principal component environment matrix of all detection environments is calculated, where the normal label includes approximate and non-approximate labels.

[0026] In this embodiment, relevant detection environment data for multiple detection environments used to detect the concentration of methanol and ethanol in automotive gasoline are acquired. This detection environment data covers relevant data under various environmental conditions that may be encountered during the detection process, including but not limited to environmental parameters related to the detection such as temperature, humidity, electromagnetic fields, vibration, and light intensity. Comprehensive feature extraction is performed on the detection environment data for each collected detection environment to extract relevant environmental features that reflect the core characteristics of that detection environment, thereby determining the detection environment vector corresponding to each detection environment. Each detection environment vector consists of multiple environmental feature values ​​corresponding to various environmental features, each with a specific feature value. These environmental features collectively constitute the detection environment vector. Environmental features can include temperature, humidity, light intensity, electromagnetic field strength, vibration frequency, etc.

[0027] In this embodiment, the detection environment vectors corresponding to all detection environments are standardized. Standardization transforms environmental features with different dimensions and numerical ranges into dimensionless values ​​with a mean of 0 and a standard deviation of 1. After standardization, the detection environment vector for each detection environment is transformed into a standardized standard environment vector. Simultaneously, the standard environment vectors corresponding to all detection environments are integrated to form a standard environment matrix for all detection environments. Each row in the standard environment matrix corresponds to a standard environment vector for one detection environment, and each column corresponds to a standardized feature value for one environmental feature.

[0028] In this embodiment, the standard environment matrix is ​​an N3×n dimensional matrix, where N3 represents the number of detected environments and n represents the number of environmental features in the detected environment vector.

[0029] In this embodiment, principal component analysis (PCA) is performed on the standard environment matrix of all integrated detection environments. The core function of PCA is to reduce the dimensionality of the high-dimensional standard environment matrix, eliminating redundant information between environmental features while retaining the core information of the original environmental data, thus reducing the complexity of data processing. Through PCA, the original high-dimensional standard environment vectors are transformed into low-dimensional principal component vectors. The principal component vectors of all detection environments are integrated to form the principal component environment matrix of all detection environments. Simultaneously, PCA can also determine the variance contribution rate corresponding to each principal component in the principal component environment matrix. The variance contribution rate measures the proportion of total information of the original environmental data that each principal component can explain. The larger the variance contribution rate of each principal component, the more original environmental data information it carries, and the better it reflects the core characteristics of the original detection environment. Determining the variance contribution rate provides an important reference for the subsequent calculation of normal labels.

[0030] In this embodiment, the principal component environment matrix is ​​an N3×N1 dimensional matrix, where N3 represents the number of detection environments and N1 represents the number of filtered principal component features.

[0031] In this embodiment, based on the principal component environment matrix of all detection environments and the variance contribution rate of all principal components in the principal component environment matrix, the normal label of the principal component environment matrix of all detection environments is calculated. The calculation formula is expressed as follows: ; in, Let represent the variance contribution rate of the i-th principal element in the principal element environment matrix of all detection environments, and Nu represent the minimum number of principal elements that satisfy the cumulative variance contribution rate requirement. This represents the skewness of the k-th principal element in the principal environment matrix. This represents the kurtosis of the k-th principal element in the principal component environment matrix. This represents the normal deviation statistic of the k-th principal element in the principal component environment matrix. represents the test statistic of the k-th principal component in the principal component environment matrix, NL represents the normal label of the principal component environment matrix, N3 represents the number of detected environments, N1 represents the number of principal component features after screening, and N2 represents the number of candidate principal components. The cumulative distribution function representing the standard normal distribution is... The function value is output. This represents the first indicator function of the k-th principal element in the principal element environment matrix.

[0032] In this embodiment, Indicates taking The smaller value in, when When it is large, ,Pick ,when When smaller, The two are similar.

[0033] In this embodiment, This represents an adjustment factor based on the number of detection environments.

[0034] In this embodiment, This represents an adaptive normal threshold based on the number of detection environments.

[0035] In this embodiment, This represents the cumulative variance contribution rate of the first j principal elements in the principal element environment matrix of all detected environments.

[0036] The beneficial effects of the above technologies are as follows: acquiring detection environment data from multiple detection environments for automotive gasoline, analyzing the detection environment data from all detection environments, determining the normality label of all detection environments, improving the standardization and usability of environmental data, providing reliable data support for improving the accuracy of subsequent detection of methanol and ethanol in automotive gasoline, and realizing the quantitative determination of environmental distribution characteristics. Example 3:

[0037] Based on Example 2, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy is provided to determine environmental combination data of automotive gasoline, including: If the normal labels of the principal component environment matrices of all detected environments are approximate, the joint probability density is determined based on the multivariate normal distribution; if the normal labels of the principal component environment matrices of all detected environments are not approximate, the joint probability density is determined based on the Gaussian coupling connection function. Based on the joint probability density, the 1% contour lines of all detection environments are determined and isosurfaces are cut. The space inside the cut isosurfaces is coarsely meshed. Based on all mesh points with a joint probability density greater than 1% after coarse meshing, the initial high-density point set and the first environment combination vector of each point in the initial high-density point set are determined. Based on the first environmental combination vector of all points in the initial high-density point set, determine the environmental combination data of automotive gasoline.

[0038] In this embodiment, the normal label type corresponding to the principal component environment matrix of all detected environments is first determined. Normal labels are categorized into only two types: approximate and non-approximate. When the normal labels of the principal component environment matrices of all detected environments are approximate, a multivariate normal distribution is used to determine the joint probability density of all detected environments. This method adapts to the characteristic of the environment data being approximately normally distributed, accurately characterizing the joint distribution pattern among multiple environmental features and quantifying the probability of different environment combinations occurring. When the normal labels of the principal component environment matrices of all detected environments are non-approximate, a Gaussian coupling connection function is used to determine the joint probability density.

[0039] In this embodiment, after obtaining the joint probability density of all detection environments, the 1% contour lines corresponding to all detection environments are determined based on the joint probability density. The 1% contour lines are closed curves or surfaces formed by all environment points with a joint probability density value equal to 1%, serving as the boundaries between valid and invalid environment combinations. Based on these 1% contour lines, the space corresponding to all detection environments is cut into isosurfaces. The core purpose of this cutting is to eliminate invalid environment combinations with a joint probability density lower than 1%, retaining only valid environment regions with a joint probability density higher than 1%. The valid space within the cut isosurfaces is then coarsely meshed, dividing the valid space into multiple uniform grids according to fixed rules, with each grid corresponding to a specific environment region. All grid points with a joint probability density greater than 1% after coarse meshing are selected. These qualified grid points are integrated to form an initial high-density point set. Each point in the initial high-density point set corresponds to a specific detection environment, which is the first environment combination vector for that point. Each first environment combination vector contains specific values ​​of multiple environment features, accurately representing a valid detection environment.

[0040] In this embodiment, after obtaining the initial high-density point set and the first environment combination vector corresponding to each point in the set, all first environment combination vectors are comprehensively sorted, analyzed, and filtered. Duplicate first environment combination vectors in the initial high-density point set are removed to avoid redundancy in environment combinations, while high-probability valid environment combination vectors that may have been missed are added to determine the environment combination data required for vehicle gasoline detection.

[0041] The beneficial effects of the above technologies are: determining environmental combination data for automotive gasoline can be adapted to different environmental distribution characteristics, ensuring the accuracy of joint density calculation, improving the relevance and effectiveness of environmental combination data, and adapting to the actual needs of detection scenarios. Example 4:

[0042] Based on Example 1, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy is provided, which acquires gasoline sample data of automotive gasoline, analyzes the gasoline sample data to determine gasoline gradient sample data of automotive gasoline, including: Obtain gasoline sample data for vehicles, including multiple gasoline samples and the actual methanol concentration and actual ethanol concentration of each gasoline sample; Based on the actual methanol concentration and actual ethanol concentration of each gasoline sample, a concentration level label is determined for each gasoline sample, which includes low, medium and high concentration levels. Based on the concentration level labels of all gasoline samples, all automotive gasoline samples were extracted from the gasoline sample data to determine the gasoline gradient sample data for automotive gasoline.

[0043] In this embodiment, gasoline sample data for automotive gasoline is acquired. The gasoline sample data includes multiple different automotive gasoline samples, as well as the actual methanol concentration and actual ethanol concentration corresponding to each automotive gasoline sample. These actual concentration values ​​are obtained through accurate and reliable detection methods, which can truly and objectively reflect the real content of methanol and ethanol in each automotive gasoline sample. These automotive gasoline samples come from diverse sources, covering various types of automotive gasoline from different manufacturers, with different blending methods and different usage scenarios, and encompassing as many sample types as possible that will be encountered in actual testing work, ensuring the richness and comprehensiveness of the basic sample data.

[0044] In this embodiment, based on the actual methanol and ethanol concentrations of each gasoline sample, a corresponding concentration level label is assigned to each gasoline sample. The concentration level labels are specifically divided into three categories: low, medium, and high. The classification takes into account the actual concentration values ​​of methanol and ethanol, and sets a unified classification standard in combination with the conventional distribution range of methanol and ethanol content in gasoline, ensuring that each gasoline sample can be accurately classified into the corresponding concentration level. The concentration level labels clearly distinguish samples of different concentrations.

[0045] In this embodiment, based on the pre-determined concentration level labels of all gasoline samples, an orderly extraction process is carried out on all automotive gasoline samples in the gasoline sample data. The extraction process strictly follows the principle of level balance, extracting typical samples from low-concentration levels, representative samples from mid-concentration levels, and samples that reflect the characteristics of high-concentration levels. This ensures that the number of samples in each concentration level is reasonable and the characteristics are distinct. After standardized extraction, sorting, and optimization, the gasoline gradient sample data for automotive gasoline is finally determined.

[0046] The beneficial effects of the above technologies are: obtaining gasoline sample data for automotive gasoline, analyzing gasoline sample data to determine gasoline gradient sample data for automotive gasoline, and accurately determining gasoline gradient sample data covering the entire concentration range. Example 5:

[0047] Based on Example 3, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, based on environmental combination data of automotive gasoline and gasoline gradient sample data, determines the initial environmental prediction error value of all initial environmental detection models for each first environmental combination vector in the environmental combination data, including: For each automotive gasoline sample in the gasoline gradient sample data, near-infrared spectroscopy detection is performed under each first environmental combination vector in the environmental combination data to determine the sample environmental detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environmental combination vector; Preprocessing and feature extraction are performed on the sample environment detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector to determine the near-infrared spectral vector of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector. Based on the number of automotive gasoline samples in the gasoline gradient sample data, determine the specified number of partitions and the initial training number; Based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, the near-infrared spectral vector of each first environment combination vector is divided into a specified number of parts. Each part of each first environment combination vector is selected as the initial detection test data, and the initial training number of parts other than the specified parts are used as the initial detection training data. The initial detection test data and the initial detection training data selected each time are determined as an initial model construction data for each first environment combination vector. Using the near-infrared spectral vectors of all automotive gasoline samples in the initial detection training data of each initial model construction data of each first environment combination vector as independent variables, and the actual methanol concentration and actual ethanol concentration of all automotive gasoline samples in the gasoline gradient sample data as dependent variables, the initial environment detection model of each initial model construction data of each first environment combination vector is constructed. The near-infrared spectral vector of each gasoline sample in the initial detection test data of each initial model construction data of each first environmental combination vector is input into the corresponding environmental detection model to determine the predicted methanol concentration and predicted ethanol concentration of each gasoline sample in the initial detection test data of each initial model construction data of each first environmental combination vector. Based on the predicted methanol concentration and predicted ethanol concentration of all automotive gasoline samples in the detection test data of each initial model construction data of each first environment combination vector, and the actual methanol concentration and actual ethanol concentration of all automotive gasoline samples in the gasoline gradient sample data, the actual prediction error value of the initial environment detection model of each initial model construction data of each first environment combination vector is determined. The actual prediction error value of the initial environment detection model is determined based on the data of all initial models constructed for each first environment combination vector.

[0048] In this embodiment, a comprehensive near-infrared spectroscopy detection operation is performed on each automotive gasoline sample included in the gasoline gradient sample data. The detection process strictly follows unified standards and specifications to ensure the accuracy and consistency of the detection results. During detection, each automotive gasoline sample must be placed in the detection environment corresponding to each first environmental combination vector in the environmental combination data. That is, each sample must be detected one by one among all the selected valid environmental combinations, without missing any environmental combination. Through near-infrared spectroscopy detection, the spectral correlation data of each automotive gasoline sample under the corresponding first environmental combination vector is collected, thereby determining the sample environmental detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environmental combination vector. These data completely record the spectral response characteristics of the sample under the corresponding environmental conditions.

[0049] In this embodiment, preprocessing and feature extraction operations are performed on the sample environment detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector. Both preprocessing and feature extraction are performed independently on the detection data of a single sample under a single environment. The preprocessing operation mainly eliminates irrelevant interference factors generated during the detection process, such as random noise, baseline drift, and light scattering in the spectral data. These interference factors affect the accuracy and validity of the spectral data. Preprocessing can purify the spectral data and retain effective information related to methanol and ethanol concentration. The feature extraction operation extracts key information reflecting the characteristics of methanol and ethanol concentration in the automotive gasoline sample from the preprocessed spectral data, eliminating redundant and useless spectral data. After preprocessing and feature extraction, the near-infrared spectral vector of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector is finally determined. This vector can accurately characterize the spectral characteristics of the sample under the corresponding environment.

[0050] In this embodiment, based on the total number of automotive gasoline samples in the gasoline gradient sample data, the specified number of data partitions and the initial training quantity are reasonably determined. The specified number of partitions refers to the number of parts into which all near-infrared spectral vectors corresponding to each first environment combination vector are divided. The initial training quantity refers to the number of training data parts used each time the initial model is built. The core of determining the specified number of partitions and the initial training quantity is to ensure the rationality and representativeness of the training and test data. The larger the total number of samples, the more appropriate the specified number of partitions can be. The initial training quantity is adapted based on the specified number of partitions, and is less than the specified number of partitions.

[0051] In this embodiment, based on the determined concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, all near-infrared spectral vectors corresponding to each first environment combination vector are ordered and divided. The number of divisions strictly follows the previously determined specified number of divisions to ensure that the spectral vectors under each first environment combination vector are uniformly divided into the specified number of divisions, and that each division contains samples of low, medium, and high concentration levels, ensuring the representativeness of each data set. After the division is completed, each spectral vector under each first environment combination vector is selected as the initial detection test data. At the same time, the remaining initial training data under the first environment combination vector, excluding the currently selected data, are used as the initial detection training data. Each selection will form a corresponding set of initial detection test data and initial detection training data. This selection process will be repeated until each spectral vector under each first environment combination vector has been selected as initial detection test data once. The initial detection test data and initial detection training data obtained each time together constitute an initial model construction data for the first environment combination vector. Each first environment combination vector will correspond to multiple initial model construction data.

[0052] In this embodiment, for each initial model construction data of each first environment combination vector, a corresponding initial environment detection model is constructed. During model construction, the range and content of the independent and dependent variables are strictly determined. The near-infrared spectral vectors of all automotive gasoline samples included in the initial detection training data of the initial model construction data are used as independent variables. These spectral vectors are effective data after preprocessing and feature extraction, accurately reflecting the correlation between the spectral characteristics of the samples and the methanol and ethanol concentrations. The actual methanol and ethanol concentrations of all automotive gasoline samples in the gasoline gradient sample data are used as dependent variables. These actual concentration data are true values ​​obtained through accurate detection and serve as the reference standard for model fitting. The independent and dependent variables are correlated and fitted to ultimately construct the initial environment detection model corresponding to each initial model construction data of each first environment combination vector. This model can predict methanol and ethanol concentrations from near-infrared spectral vectors.

[0053] In this embodiment, the initial environmental detection model is based on multivariate quantitative correlation fitting. Relying on the inherent correspondence between near-infrared spectra and substance concentration, the near-infrared spectral vector in the initial detection training data is used as the input carrier. Methanol and ethanol of different concentrations will produce unique selective absorption and reflection of near-infrared light, forming spectral signal features strongly correlated with concentration. Then, the actual methanol concentration and actual ethanol concentration in the gasoline gradient sample data are used as the dependent variables for fitting. Through multivariate fitting algorithm, the hidden quantitative law between each spectral feature value in the near-infrared spectral vector and the actual methanol and ethanol concentration is automatically learned and mined. At the same time, during the fitting process, iterative optimization is carried out based on a large number of samples in the training data, and the correlation parameters inside the model are continuously adjusted to eliminate the influence of spectral noise and slight environmental interference. Finally, a quantitative prediction model corresponding to the first environmental combination vector and the initial model construction data is established, which can realize the mapping from spectral features to concentration values. This model can capture the specific law of spectral features changing with methanol and ethanol concentration under corresponding environmental conditions, thereby realizing the prediction of the concentration of unknown samples.

[0054] In this embodiment, model testing is performed on each initial model construction data for each first environment combination vector, with the testing process strictly corresponding to the constructed initial environment detection model. The near-infrared spectral vectors of each gasoline sample included in the initial detection test data of the initial model construction data are input one by one into the corresponding initial environment detection model. The initial environment detection model automatically analyzes and calculates based on the input near-infrared spectral vectors, and then outputs the predicted methanol concentration and predicted ethanol concentration for each gasoline sample. These predicted concentration data represent the model's preliminary judgment of the sample concentration, determining the predicted methanol concentration and predicted ethanol concentration for each gasoline sample in the initial detection test data of each initial model construction data for each first environment combination vector.

[0055] In this embodiment, based on the predicted methanol and predicted ethanol concentrations of all automotive gasoline samples in the initial detection test data of each initial model construction data for each first environmental combination vector, and combined with the actual methanol and actual ethanol concentrations of all automotive gasoline samples in the gasoline gradient sample data, error calculation is performed. Error calculation involves comparing the predicted methanol concentration of each sample in the initial detection test data with the actual methanol concentration of that sample, and comparing the predicted ethanol concentration with the actual ethanol concentration, summarizing the concentration differences of all samples, and calculating the overall actual prediction error value of the initial environmental detection model.

[0056] In this embodiment, after obtaining the actual prediction error value of the initial environment detection model corresponding to all initial model construction data of each first environment combination vector, the statistical result of all valid actual prediction error values, such as the average value, is calculated, and the statistical result is used as the initial environment prediction error value of the first environment combination vector.

[0057] The beneficial effects of the above technology are as follows: Based on the environmental combination data of automotive gasoline and the gasoline gradient sample data, the initial environmental prediction error value of all initial environmental detection models for each first environmental combination vector in the environmental combination data is determined. This can take into account both sample concentration gradient and environmental diversity, construct multiple sets of initial detection models and accurately quantify the error, and achieve collaborative error assessment of environment and sample. Example 6:

[0058] Based on Example 5, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, which determines the iterative environmental prediction error value of environmental sampling data, the iterative environmental prediction error value of each second environmental combination vector in environmental sampling data, automotive gasoline environmental data, and a baseline environmental vector based on the initial environmental prediction error value of each first environmental combination vector in gasoline gradient sample data and environmental combination data, includes: The initial environment prediction error and the set error threshold of each first environment combination vector are judged. If the initial environment prediction error is greater than the set error threshold, the error label of the first environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the set error threshold, the error label of the first environment combination vector is determined to be normal. Spatial filling sampling is performed on the points corresponding to the first environmental combination vector with high error label to determine the environmental sampling data of vehicle gasoline. The environmental sampling data includes multiple second environmental combination vectors. The number of iterations for training is determined based on the initial number of training units and the specified number of partitions. Preprocessing and feature extraction are performed on the sample environment detection data of each vehicle gasoline sample in the gasoline gradient sample data based on each second environmental combination vector in the environmental sampling data to determine the near-infrared spectral vector of each vehicle gasoline sample in the gasoline gradient sample data based on each second environmental combination vector. Based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, the near-infrared spectral vector of each second environment combination vector, the specified number of divisions, and the number of iterations for training, the iterative environment prediction error value of each second environment combination vector is determined iteratively. For each second environment combination vector, the iterative environment prediction error and the iterative error threshold are judged. If the iterative environment prediction error is greater than the iterative error threshold, the error label of the second environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the iterative error threshold, the error label of the second environment combination vector is determined to be normal. Until the error labels of all second environment combination vectors are normal or the number of iterations equals the maximum iteration threshold, the first environment combination vectors and second environment combination vectors with all error labels being normal are determined to be automotive gasoline environment data. In the automotive gasoline environmental data, the first or second environmental combination vector with the smallest initial environmental prediction error value or iterative environmental prediction error value is selected as the baseline environmental vector.

[0059] In this embodiment, the initial environment prediction error value corresponding to each first environment combination vector is compared with a pre-set error threshold. If the initial environment prediction error value of a certain first environment combination vector is greater than the set error threshold, it indicates that the prediction accuracy of the detection model under that environment combination does not meet the requirements, and the error label of that first environment combination vector is determined to be high error. If the initial environment prediction error value of a certain first environment combination vector is greater than the set error threshold, the error label of that first environment combination vector is determined to be normal. Through this judgment method, all first environment combination vectors are divided into two categories, high error and normal, according to their error level.

[0060] In this embodiment, for each point corresponding to the first environment combination vector that is determined to have a high error, a space-filling sampling operation is performed. The space-filling sampling can be a Latin hypercube or a Sobol sequence. The purpose of space-filling sampling is to supplement the effective environment combinations within the high-error environment region, making up for the deficiencies of the original first environment combination vector in that region, and ensuring the comprehensiveness and effectiveness of the environment combinations. The sampling process follows spatial distribution rules, rationally selecting new environment combination points within the spatial range corresponding to the high-error first environment combination vector. These new environment combination points, after being processed, constitute the environmental sampling data for automotive gasoline. Specifically, the environmental sampling data includes multiple new second environment combination vectors, each corresponding to a new detection environment, which can specifically fill the detection gaps in the high-error environment region.

[0061] In this embodiment, based on the previously determined initial training quantity and the specified number of partitions, and combined with the actual needs of iterative optimization, the number of iterative training quantities is determined by adding a number of partitions to the initial training quantity. The iterative training quantity is greater than the initial training quantity but less than the specified number of partitions. If the difference between the specified number of partitions and the initial training quantity is small, the number of partitions is increased by 1. If the difference between the specified number of partitions and the initial training quantity is large, the number of partitions is increased according to the difference.

[0062] In this embodiment, for each automotive gasoline sample in the gasoline gradient sample data, sample environmental detection data under each second environmental combination vector in the environmental sampling data is obtained. Preprocessing and feature extraction operations are performed on these detection data one by one to determine the near-infrared spectral vector of each automotive gasoline sample in the gasoline gradient sample data based on each second environmental combination vector. This vector can accurately characterize the spectral characteristics of the sample under the corresponding second environmental combination.

[0063] In this embodiment, based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, and combined with the near-infrared spectral vector corresponding to each second environment combination vector, a predetermined number of partitions, and the number of iterations for training, iterative calculations are performed to gradually determine the iterative environment prediction error value for each second environment combination vector. The iterative process repeatedly adjusts the partitioning of training and test data according to established rules, builds the detection model multiple times, and calculates the error value. Each iteration optimizes based on the previous error result, continuously reducing the prediction error of the second environment combination vector, ensuring that the iterative environment prediction error value gradually approaches the set error threshold, and improving the prediction accuracy of the detection model under each second environment combination vector.

[0064] In this embodiment, the iterative environment prediction error value corresponding to each second environment combination vector is compared with the iterative error threshold. The judgment logic is consistent with the error label judgment logic of the first environment combination vector to ensure the uniformity of the judgment standard. If the iterative environment prediction error value of a certain second environment combination vector is greater than the iterative error threshold, it indicates that the detection accuracy under that second environment combination still does not meet the requirements, and its error label is determined to be high error. If the iterative environment prediction error is greater than the iterative error threshold, the error label of the second environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the iterative error threshold, the error label of the second environment combination vector is determined to be normal. Through this judgment, second environment combination vectors that meet the error requirements are further screened out, while second environment combination vectors that still have high errors are marked, providing a basis for subsequent iterative optimization.

[0065] In this embodiment, the process of error label determination, space-filling sampling, and iterative error value calculation is repeated until either of two termination conditions is met. The first termination condition is that the error labels of all second environment combination vectors are determined to be normal, indicating that the detection accuracy under all environment combinations has reached the set requirements, and further iteration is unnecessary. The second termination condition is that the number of iterations reaches a preset maximum iteration threshold, which can be 3. Even if some second environment combination vectors still have high error labels, the iteration operation stops to avoid inefficiency caused by infinite iteration. When either termination condition is met, all first environment combination vectors with normal error labels and all second environment combination vectors with normal error labels are integrated together to determine the vehicle gasoline environment data. This environment data has been error-verified and meets the accuracy requirements for detecting methanol and ethanol in vehicle gasoline.

[0066] In this embodiment, a comprehensive error value comparison analysis is performed on all first and second environment combination vectors with normal error labels in the finally determined automotive gasoline environmental data. The initial environmental prediction error value corresponding to each first environment combination vector is extracted, and the iterative environmental prediction error value corresponding to each second environment combination vector is extracted. All these error values ​​are sorted, and the environment combination vector with the smallest error value is selected. This environment combination vector, whether it is a first or second environment combination vector, is determined as the baseline environment vector. The baseline environment vector has the highest detection accuracy among all qualified environment combinations and will serve as the reference standard for subsequent methanol and ethanol detection of automotive gasoline.

[0067] The beneficial effects of the above technology are as follows: Based on the initial environmental prediction error value of each first environmental combination vector in the gasoline gradient sample data and environmental combination data, the iterative environmental prediction error value of each second environmental combination vector in the environmental sampling data, vehicle gasoline environmental data and benchmark environmental vector are determined. This can achieve closed-loop optimization of environmental error, improve the effectiveness and reliability of environmental data, and achieve accurate selection of benchmark environmental vector. Example 7:

[0068] Based on Example 6, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy is proposed, which constructs a detection model for automotive gasoline, including: Based on the predicted methanol and ethanol concentrations of all automotive gasoline samples in all detection and test data of the benchmark environmental vector, and the predicted methanol and ethanol concentrations of all automotive gasoline samples in all detection and test data of each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data other than the benchmark environmental vector, the benchmark prediction deviation between the benchmark environmental vector and each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data is determined, wherein the benchmark prediction deviation includes the benchmark methanol deviation and the benchmark ethanol deviation. Based on the baseline environment vector and each first environment combination vector or second environment combination vector other than the baseline environment vector in the vehicle gasoline environment data, determine the environment offset vector between the baseline environment vector and each first environment combination vector or second environment combination vector in the vehicle gasoline environment data. Using the environmental offset vector of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data as the independent variable, and the benchmark prediction deviation of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data as the dependent variable, a fitting error model of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data is constructed, and the environmental correction function of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data is determined. A gasoline detection model is constructed based on all actual prediction errors of the first or second environmental combination vector corresponding to the baseline environmental vector, the near-infrared spectral vectors of all gasoline samples in all test data, the baseline environmental vector, and the environmental correction function of each first or second environmental combination vector.

[0069] In this embodiment, the predicted methanol and ethanol concentrations of all automotive gasoline samples included in all detection and testing data corresponding to the baseline environmental vector are first determined. Simultaneously, the predicted methanol and ethanol concentrations of all automotive gasoline samples included in all detection and testing data of each first environmental combination vector or second environmental combination vector (excluding the baseline environmental vector) within the automotive gasoline environmental data are determined. These two types of predicted concentrations are systematically compared and analyzed, and the deviation between them is calculated. This deviation is the baseline prediction deviation. The baseline prediction deviation specifically comprises two components: the baseline methanol deviation and the baseline ethanol deviation. The baseline methanol deviation quantifies the difference in predicted methanol concentration between the two types of samples, and the baseline ethanol deviation quantifies the difference in predicted ethanol concentration between the two types of samples. Through this comparative calculation, the difference in predicted concentration between the baseline environmental vector and all other qualified environmental combination vectors can be accurately captured.

[0070] In this embodiment, a baseline environmental vector is used as the sole reference standard. For each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data (excluding the baseline environmental vector), the environmental feature difference between them and the baseline environmental vector is calculated one by one. This environmental feature difference is accurately represented by an environmental offset vector, which is obtained by calculating the difference between the environmental feature values ​​of the baseline environmental vector and the corresponding non-baseline environmental combination vector. It can comprehensively and accurately reflect the degree of deviation of the non-baseline environmental combination vector from the baseline environmental vector in each environmental feature, and also clearly show the direction of the deviation. Each qualified non-baseline environmental combination vector corresponds to a unique environmental offset vector.

[0071] In this embodiment, after obtaining the environmental offset vectors and benchmark prediction deviations corresponding to all non-benchmark environmental combination vectors, the fitting error model is constructed. During the construction process, the environmental offset vector is explicitly used as the independent variable, and the benchmark prediction deviation as the dependent variable. For the benchmark environmental vector and each qualified non-benchmark environmental combination vector, a corresponding fitting error model is constructed. The fitting error model explores the inherent quantitative correlation between environmental feature offsets and detection prediction deviations. Using the environmental offset vector as the independent variable, it fully quantifies the degree and direction of deviation of each non-benchmark environmental combination vector relative to the benchmark environmental vector in various environmental feature dimensions in the automotive gasoline environmental data. Using the benchmark prediction deviation as the dependent variable, it accurately reflects the numerical difference between the non-benchmark environment and the benchmark environment in the methanol and ethanol concentration prediction results. Through a regression fitting algorithm, it learns and fits the stable law of prediction deviation changes caused by environmental offset changes, transforming fuzzy environmental interference into a calculable numerical mapping relationship. Finally, based on the fitted mapping law, an environmental correction function that can directly calculate the corresponding prediction deviation correction amount according to the environmental offset is derived, realizing the quantification and correctability of the impact of environmental differences on the detection results.

[0072] In this embodiment, the automotive gasoline detection model is a comprehensive quantitative model that integrates the core prediction capability of the benchmark environment with the deviation correction capability of the entire environment. The basic accuracy benchmark of the model is determined by the actual prediction error corresponding to the benchmark environment. Based on the near-infrared spectral vector of all detection and test data under the benchmark environment, a core quantitative mapping relationship between spectral features and the actual concentration of methanol and ethanol is constructed to ensure that the model has the basis for accurate prediction under the optimal environment. At the same time, environmental correction functions for each qualified environmental combination are integrated. After receiving the spectral vector of the sample to be tested and the real-time environmental vector, the model first completes the basic concentration prediction through the core mapping relationship, and then calls the matching environmental correction function to calculate the deviation correction amount according to the environmental offset corresponding to the real-time environment to calibrate the basic prediction result. Finally, the detection error caused by the difference between the real-time environment and the benchmark environment is eliminated, and the methanol and ethanol concentration result with the same accuracy as the benchmark environment is output, realizing the unification and accuracy of detection results under multiple environmental scenarios.

[0073] The beneficial effects of the above technologies are: constructing a vehicle gasoline detection model can achieve quantitative fitting of environmental offset and prediction deviation, thereby improving the multi-environment versatility and accuracy of the vehicle gasoline detection model. Example 8:

[0074] Based on Example 1, a method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy is provided. This method involves acquiring real-time environmental data to determine a real-time environmental vector, acquiring the automotive gasoline to be tested and performing near-infrared spectral detection to determine real-time near-infrared spectral data, and determining the detection concentrations of methanol and ethanol in the gasoline based on the real-time spectral vector, the real-time environmental vector, and an automotive gasoline detection model. The method includes: Acquire the gasoline to be tested and real-time environmental data, extract features from the real-time environmental data, and determine the real-time environmental vector; Near-infrared spectroscopy is performed on the gasoline to be tested to determine the real-time near-infrared spectral data of the gasoline; Feature extraction is performed on the real-time near-infrared spectral data of the gasoline to be tested to determine the real-time spectral vector of the gasoline to be tested; The real-time spectral vector and real-time environmental vector of the gasoline to be tested are input into the vehicle gasoline detection model to determine the detection concentration of methanol and ethanol in the gasoline to be tested.

[0075] In this embodiment, the gasoline to be tested and real-time environmental data are acquired. The gasoline to be tested can be derived from various gasoline samples collected on-site. The collection process must ensure that the samples are free from contamination and deterioration, and that the storage conditions meet the testing standards to ensure that the samples can accurately reflect the characteristics of the actual gasoline to be tested. The real-time environmental data consists of all relevant environmental parameters collected during on-site testing. The collected real-time environmental data undergoes systematic feature extraction to form a real-time environmental vector, which can accurately characterize the overall state of the on-site real-time testing environment.

[0076] In this embodiment, near-infrared spectroscopy is performed on the gasoline to be tested. The testing operation must strictly follow standardized procedures, using a near-infrared spectrometer adapted for automotive gasoline testing, and adjusting the instrument parameters to optimal settings. The gasoline sample to be tested is placed in a dedicated sample cell, ensuring the sample cell is clean and free of impurities to avoid affecting the spectral detection signal. The near-infrared spectrometer emits near-infrared light to illuminate the gasoline sample, and the absorption and reflection signals of the sample to the near-infrared light are collected. The signal intensity at different wavelengths is recorded to form complete real-time near-infrared spectral data. This spectral data contains the spectral response characteristics of all components in the gasoline to be tested, especially the characteristic absorption signals corresponding to methanol and ethanol components. During the testing process, factors such as instrument fluctuations and sample shaking must be avoided to prevent abnormal spectral data.

[0077] In this embodiment, feature extraction is performed on the real-time near-infrared spectral data of the gasoline to be tested. First, the acquired raw real-time near-infrared spectral data is purified to eliminate irrelevant interference factors such as random noise, baseline drift, and light scattering generated during the detection process. The purified spectral data can more clearly present the characteristic absorption peaks corresponding to methanol and ethanol components. Subsequently, from the purified spectral data, spectral signals corresponding to characteristic wavelengths highly correlated with methanol and ethanol concentrations are accurately selected, redundant spectral information unrelated to methanol and ethanol concentrations is removed, and the selected core spectral features are quantized and processed, transforming them into standardized real-time spectral vectors.

[0078] In this embodiment, the real-time spectral vector and real-time environmental vector of the gasoline to be tested are input into the constructed automotive gasoline detection model. After receiving the input data, the detection model automatically starts its internal analysis and calculation process, calls the preset fitting error model and environmental correction function in the model, and accurately calculates the corresponding environmental offset and deviation correction value based on the real-time environmental vector. At the same time, combined with the spectral feature information in the real-time spectral vector, it accurately identifies the concentration-related characteristics of methanol and ethanol in the gasoline to be tested. Through the collaborative analysis and deviation correction within the model, the influence of real-time environmental interference on the detection results is eliminated, and finally, the detection methanol concentration and detection ethanol concentration of the gasoline to be tested are accurately calculated and output. This concentration result can truly and accurately reflect the actual content of methanol and ethanol in the gasoline to be tested.

[0079] The beneficial effects of the above technologies are as follows: real-time environmental data is acquired to determine the real-time environmental vector; the gasoline to be tested is acquired and near-infrared spectral detection is performed to determine the real-time near-infrared spectral data; based on the real-time spectral vector, the real-time environmental vector, and the gasoline detection model, the detection methanol concentration and detection ethanol concentration of the gasoline to be tested are determined. This can adapt to real-time environmental changes on site, realize the collaborative adaptation detection of real-time environment and spectral characteristics, and improve the accuracy of real-time on-site detection of gasoline.

[0080] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy, characterized in that, include: S1: Acquire detection environment data for multiple detection environments of automotive gasoline, analyze the detection environment data of all detection environments, determine the normal label of all detection environments, and determine the environmental combination data of automotive gasoline; S2: Obtain gasoline sample data for automotive gasoline, and analyze the gasoline sample data to determine the gasoline gradient sample data for automotive gasoline; S3: Based on the environmental combination data of vehicle gasoline and gasoline gradient sample data, determine the initial environmental prediction error value of all initial environmental detection models for each first environmental combination vector in the environmental combination data; S4: Based on the initial environmental prediction error value of each first environmental combination vector in the gasoline gradient sample data and environmental combination data, determine the iterative environmental prediction error value of each second environmental combination vector in the environmental sampling data, vehicle gasoline environmental data and benchmark environmental vector, and construct a vehicle gasoline detection model. S5: Obtain real-time environmental data to determine the real-time environmental vector, obtain the gasoline to be tested and perform near-infrared spectroscopy detection, determine the real-time near-infrared spectral data, and based on the real-time spectral vector, real-time environmental vector, and gasoline detection model, determine the detection methanol concentration and detection ethanol concentration of the gasoline to be tested.

2. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 1, characterized in that, Acquire testing environment data from multiple testing environments for automotive gasoline, analyze the testing environment data from all testing environments, and determine the normality labels for all testing environments, including: The detection environment data of multiple detection environments for detecting methanol and ethanol concentrations in automotive gasoline are acquired. Feature extraction is performed on the detection environment data of each detection environment to determine the detection environment vector of each detection environment. The detection environment vector includes environmental feature values ​​of multiple environmental features. The detection environment vectors of all detection environments are standardized to determine the standardized environment vector for each detection environment, and the standardized environment matrix for all detection environments is determined. Principal component analysis was performed on the standard environment matrix of all detection environments to determine the principal component environment matrix of all detection environments and the variance contribution rate of each principal component in the principal component environment matrix. Based on the principal component environment matrix of all detection environments and the variance contribution rate of all principal components in the principal component environment matrix, the normal label of the principal component environment matrix of all detection environments is calculated, where the normal label includes approximate and non-approximate labels.

3. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 2, characterized in that, Determine the environmental combination data for automotive gasoline, including: If the normal labels of the principal component environment matrices of all detected environments are approximate, the joint probability density is determined based on the multivariate normal distribution; if the normal labels of the principal component environment matrices of all detected environments are not approximate, the joint probability density is determined based on the Gaussian coupling connection function. Based on the joint probability density, the 1% contour lines of all detection environments are determined and isosurfaces are cut. The space inside the cut isosurfaces is coarsely meshed. Based on all mesh points with a joint probability density greater than 1% after coarse meshing, the initial high-density point set and the first environment combination vector of each point in the initial high-density point set are determined. Based on the first environmental combination vector of all points in the initial high-density point set, determine the environmental combination data of automotive gasoline.

4. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 1, characterized in that, Acquire gasoline sample data for automotive use, analyze the gasoline sample data to determine gasoline gradient sample data for automotive use, including: Obtain gasoline sample data for vehicles, including multiple gasoline samples and the actual methanol concentration and actual ethanol concentration of each gasoline sample; Based on the actual methanol concentration and actual ethanol concentration of each gasoline sample, a concentration level label is determined for each gasoline sample, which includes low, medium and high concentration levels. Based on the concentration level labels of all gasoline samples, all automotive gasoline samples were extracted from the gasoline sample data to determine the gasoline gradient sample data for automotive gasoline.

5. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 3, characterized in that, Based on environmental combination data of automotive gasoline and gasoline gradient sample data, the initial environmental prediction error values ​​of all initial environmental detection models for each first environmental combination vector in the environmental combination data are determined, including: For each automotive gasoline sample in the gasoline gradient sample data, near-infrared spectroscopy detection is performed under each first environmental combination vector in the environmental combination data to determine the sample environmental detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environmental combination vector; Preprocessing and feature extraction are performed on the sample environment detection data of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector to determine the near-infrared spectral vector of each automotive gasoline sample in the gasoline gradient sample data based on each first environment combination vector. Based on the number of automotive gasoline samples in the gasoline gradient sample data, determine the specified number of partitions and the initial training number; Based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, the near-infrared spectral vector of each first environment combination vector is divided into a specified number of parts. Each part of each first environment combination vector is selected as the initial detection test data, and the initial training number of parts other than the specified parts are used as the initial detection training data. The initial detection test data and the initial detection training data selected each time are determined as an initial model construction data for each first environment combination vector. Using the near-infrared spectral vectors of all automotive gasoline samples in the initial detection training data of each initial model construction data of each first environment combination vector as independent variables, and the actual methanol concentration and actual ethanol concentration of all automotive gasoline samples in the gasoline gradient sample data as dependent variables, the initial environment detection model of each initial model construction data of each first environment combination vector is constructed. The near-infrared spectral vector of each gasoline sample in the initial detection test data of each initial model construction data of each first environmental combination vector is input into the corresponding environmental detection model to determine the predicted methanol concentration and predicted ethanol concentration of each gasoline sample in the initial detection test data of each initial model construction data of each first environmental combination vector. Based on the predicted methanol concentration and predicted ethanol concentration of all automotive gasoline samples in the detection test data of each initial model construction data of each first environment combination vector, and the actual methanol concentration and actual ethanol concentration of all automotive gasoline samples in the gasoline gradient sample data, the actual prediction error value of the initial environment detection model of each initial model construction data of each first environment combination vector is determined. The actual prediction error value of the initial environment detection model is determined based on the data of all initial models constructed for each first environment combination vector.

6. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 5, characterized in that, Based on the initial environmental prediction error value of each first environmental combination vector in the gasoline gradient sample data and environmental combination data, the iterative environmental prediction error value of each second environmental combination vector in the environmental sampling data, vehicle gasoline environmental data, and baseline environmental vector are determined, including: The initial environment prediction error and the set error threshold of each first environment combination vector are judged. If the initial environment prediction error is greater than the set error threshold, the error label of the first environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the set error threshold, the error label of the first environment combination vector is determined to be normal. Spatial filling sampling is performed on the points corresponding to the first environmental combination vector with high error label to determine the environmental sampling data of vehicle gasoline. The environmental sampling data includes multiple second environmental combination vectors. The number of iterations for training is determined based on the initial number of training units and the specified number of partitions. Preprocessing and feature extraction are performed on the sample environment detection data of each vehicle gasoline sample in the gasoline gradient sample data based on each second environmental combination vector in the environmental sampling data to determine the near-infrared spectral vector of each vehicle gasoline sample in the gasoline gradient sample data based on each second environmental combination vector. Based on the concentration level labels of all automotive gasoline samples in the gasoline gradient sample data, the near-infrared spectral vector of each second environment combination vector, the specified number of divisions, and the number of iterations for training, the iterative environment prediction error value of each second environment combination vector is determined iteratively. For each second environment combination vector, the iterative environment prediction error and the iterative error threshold are judged. If the iterative environment prediction error is greater than the iterative error threshold, the error label of the second environment combination vector is determined to be high error. If the initial environment prediction error is less than or equal to the iterative error threshold, the error label of the second environment combination vector is determined to be normal. Until the error labels of all second environment combination vectors are normal or the number of iterations equals the maximum iteration threshold, the first environment combination vectors and second environment combination vectors with all error labels being normal are determined to be automotive gasoline environment data. In the automotive gasoline environmental data, the first or second environmental combination vector with the smallest initial environmental prediction error value or iterative environmental prediction error value is selected as the baseline environmental vector.

7. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 6, characterized in that, Constructing a detection model for automotive gasoline, including: Based on the predicted methanol and ethanol concentrations of all automotive gasoline samples in all detection and test data of the benchmark environmental vector, and the predicted methanol and ethanol concentrations of all automotive gasoline samples in all detection and test data of each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data other than the benchmark environmental vector, the benchmark prediction deviation between the benchmark environmental vector and each first environmental combination vector or second environmental combination vector in the automotive gasoline environmental data is determined, wherein the benchmark prediction deviation includes the benchmark methanol deviation and the benchmark ethanol deviation. Based on the baseline environment vector and each first environment combination vector or second environment combination vector other than the baseline environment vector in the vehicle gasoline environment data, determine the environment offset vector between the baseline environment vector and each first environment combination vector or second environment combination vector in the vehicle gasoline environment data. Using the environmental offset vector of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data as the independent variable, and the benchmark prediction deviation of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data as the dependent variable, a fitting error model of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data is constructed, and the environmental correction function of each first environmental combination vector or second environmental combination vector in the benchmark environmental vector and the vehicle gasoline environmental data is determined. A gasoline detection model is constructed based on all actual prediction errors of the first or second environmental combination vector corresponding to the baseline environmental vector, the near-infrared spectral vectors of all gasoline samples in all test data, the baseline environmental vector, and the environmental correction function of each first or second environmental combination vector.

8. The method for detecting methanol and ethanol in automotive gasoline based on near-infrared spectroscopy according to claim 1, characterized in that, Real-time environmental data is acquired to determine the real-time environmental vector. The gasoline to be tested is acquired and subjected to near-infrared spectroscopy to determine the real-time near-infrared spectral data. Based on the real-time spectral vector, the real-time environmental vector, and the gasoline detection model, the detection concentrations of methanol and ethanol in the gasoline to be tested are determined, including: Acquire the gasoline to be tested and real-time environmental data, extract features from the real-time environmental data, and determine the real-time environmental vector; Near-infrared spectroscopy is performed on the gasoline to be tested to determine the real-time near-infrared spectral data of the gasoline; Feature extraction is performed on the real-time near-infrared spectral data of the gasoline to be tested to determine the real-time spectral vector of the gasoline to be tested; The real-time spectral vector and real-time environmental vector of the gasoline to be tested are input into the vehicle gasoline detection model to determine the detection concentration of methanol and ethanol in the gasoline to be tested.