A method, device and medium for methane gas concentration prediction based on laser technology and a closed-loop evolutionary algorithm

By using laser technology with digital twins and closed-loop evolutionary algorithms, a concentration prediction model was trained, which solved the problem of limited accuracy caused by individual differences in detection equipment, and achieved high-precision methane gas concentration prediction and equipment health status monitoring.

CN122712296BActive Publication Date: 2026-11-20CENT SOUTH UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611207958.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-11
Publication Date
2026-11-20
Estimated Expiration
2046-08-11

AI Technical Summary

Technical Problem

Existing methane gas concentration detection equipment suffers from individual variations due to manufacturing tolerances, which cannot effectively compensate for differences in the physical characteristics of the equipment, resulting in limited accuracy of measurement or prediction results.

Method used

Using laser technology based on digital twins and closed-loop evolution algorithms, a concentration prediction model is trained by acquiring high-dimensional vectors, achieving a deep correlation between the model and the equipment, directly mapping and solidifying physical manufacturing deviations, and performing concentration prediction.

Benefits of technology

It enables accurate compensation for physical manufacturing deviations of equipment when using the target model for concentration prediction, improving prediction accuracy and reliability, and providing timely health status alerts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122712296B_ABST
    Figure CN122712296B_ABST
Patent Text Reader

Abstract

The application relates to a method, device and medium for methane gas concentration prediction based on laser technology and a closed-loop evolutionary algorithm. The method comprises the following steps: obtaining a high-dimensional vector corresponding to each environment condition; determining an absorption spectrum of the high-dimensional vector based on an original transmission light intensity signal and a reference light intensity signal of the high-dimensional vector, and preprocessing the absorption spectrum to obtain a pretreated spectrum; training a concentration prediction model based on each pretreated spectrum and actual temperature, actual humidity, interference gas type and actual methane concentration corresponding to each pretreated spectrum, and obtaining a target model; writing the target model into a memory of a target device, obtaining environment parameters and a light intensity signal in an actual environment collected by the target device in a continuous time window, and determining an actual spectrum corresponding to the light intensity signal; and outputting a predicted concentration of the actual environment in the continuous time window by the target model based on the actual spectrum and the environment parameters. The method can improve the accuracy of the predicted concentration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of smart home security and gas sensing technology, and in particular to a method, apparatus and medium for predicting methane gas concentration based on laser technology using digital twin and closed-loop evolution algorithm. Background Technology

[0002] With the increasing prevalence of urban gas supply, household gas safety has become increasingly important. Improper management or aging equipment during use can lead to leaks and potentially cause safety accidents. Therefore, various sensors have been designed to detect whether methane concentrations exceed safe levels.

[0003] However, existing traditional detection equipment is typically calibrated once at the factory to establish a fixed concentration-signal conversion model. Because this model is static and generic, and manufacturing tolerances are unavoidable in actual equipment production, each device exhibits individual differences in its physical characteristics. Therefore, using a uniform static model cannot effectively compensate for the interference caused by these individual differences, ultimately limiting the accuracy of measurement or prediction results. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, and medium for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, in order to address the aforementioned technical problems.

[0005] A method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, the method comprising: S1. Obtain multiple high-dimensional vectors corresponding to various environmental conditions; the high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. S2. Based on the original transmitted light intensity signal and the reference light intensity signal of each of the high-dimensional vectors, determine the absorption spectrum of each of the high-dimensional vectors respectively, and preprocess each of the absorption spectra to obtain the preprocessed spectrum. S3. Based on each of the preprocessed spectra and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration, a concentration prediction model is trained to obtain a target model; the target model is a digital twin. S4. Write the target model into the memory of the target device, and obtain the environmental parameters and light intensity signals in the actual environment collected by the target device within a continuous time window, and determine the actual spectrum corresponding to the light intensity signal; S5. Based on the actual spectrum and the environmental parameters, the target model written in the target device outputs the predicted concentration of the actual environment within a continuous time window, so as to perform closed-loop evolution processing for the target model through the actual spectrum, the environmental parameters and the predicted concentration; the environmental parameters include the temperature, humidity and gas type of the actual environment.

[0006] In this application, each preprocessed spectrum and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration are data obtained directly or indirectly from the target device written into the target model. By training a concentration prediction model based on each preprocessed spectrum and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration, the target model is obtained and written into the memory of the target device. This achieves a deep association between the model and the device, and enables the physical manufacturing deviations of the target device to be directly mapped and solidified into the model parameters of the target model, thereby compensating for the prediction errors caused by the physical manufacturing deviations of the target device, so as to obtain accurate predicted concentrations when using the target model for concentration prediction.

[0007] In one embodiment, step S3 includes: S31. Use a one-dimensional convolutional layer of the concentration prediction model to extract the local and global spectral features of each preprocessed spectrum, and use the fully connected layer of the concentration prediction model to encode the actual temperature, actual humidity and interfering gas type corresponding to each preprocessed spectrum to obtain a temperature vector, a humidity vector and a type vector. S32. The local spectral features, global spectral features, temperature vector, humidity vector and type vector corresponding to each preprocessed spectrum are concatenated to obtain the concatenated vector corresponding to each preprocessed spectrum. S33. Based on each of the splicing vectors, the first initial predicted concentration corresponding to each of the preprocessed spectra is obtained through the concentration prediction model; S34. Based on the first initial predicted concentration and the actual methane concentration corresponding to each of the preprocessed spectra, determine the first model loss, and optimize the concentration prediction model based on the first model loss; S35. Based on the optimized concentration prediction model, repeat steps S3, S32, S33, and S34 until the iteration stopping condition is met to obtain the target model.

[0008] In this application, step S31 involves extracting local and global spectral features of each preprocessed spectrum using a one-dimensional convolutional layer of the concentration prediction model, and encoding the actual temperature, actual humidity, and interfering gas type corresponding to each preprocessed spectrum using a fully connected layer of the concentration prediction model to obtain temperature vector, humidity vector, and type vector; step S32 involves concatenating the local and global spectral features, temperature vector, humidity vector, and type vector corresponding to each preprocessed spectrum to obtain a concatenated vector corresponding to each preprocessed spectrum; and step S33 involves obtaining the first initial prediction corresponding to each preprocessed spectrum based on each concatenated vector using the concentration prediction model. Concentration; S34. Based on the first initial predicted concentration and the actual methane concentration corresponding to each preprocessed spectrum, determine the first model loss, and optimize the concentration prediction model based on the first model loss; S35. Repeat S31, S32, S33, and S34 based on the optimized concentration prediction model until the iteration stopping condition is met to obtain the target model. This allows the concentration prediction model to directly learn the concentration characteristics from the preprocessed spectrum, bypassing the simplified inversion steps based on physical formulas in traditional methods, and allowing the concentration prediction model to discover the most essential mapping relationship between the preprocessed spectrum and temperature, humidity, interfering gas type, and concentration.

[0009] In one embodiment, the method further includes: The maximum, minimum, and average values ​​of each predicted concentration output by the target model within a continuous time window are determined; the temperature difference between each temperature and the humidity difference between each humidity level collected by the target device within the continuous time window are determined; the status of doors and windows and the status of stoves in the actual environment are determined; and the prediction uncertainty value corresponding to each predicted concentration is determined. When the concentration difference between the maximum and minimum values ​​is less than a concentration threshold, the average value is less than an average value threshold, the absolute value of the temperature difference is less than a temperature threshold, the absolute value of the humidity difference is less than a humidity threshold, and all prediction uncertainty values ​​are less than uncertainty thresholds, the continuous time window is determined to be a reliable data window. When the concentration difference is less than the concentration threshold, the average value is less than the average value threshold, the absolute value of the temperature difference is less than the temperature threshold, the absolute value of the humidity difference is less than the humidity threshold, the time corresponding to the continuous time window is within a first preset time period, the door and window are in an open state, and the stove is in a closed state and the duration of the closed state exceeds a preset closed duration, the continuous time window is determined to be a reliable data window. Based on the temperature, humidity, gas type, and light intensity signals corresponding to at least one of the aforementioned reliable data windows, the target model is fine-tuned to predict gas concentration using the fine-tuned target model.

[0010] In this application, a continuous time window is determined as a reliable data window when the concentration difference between the maximum and minimum values ​​is less than a concentration threshold, the average value is less than an average value threshold, the absolute value of the temperature difference is less than a temperature threshold, the absolute value of the humidity difference is less than a humidity threshold, and all prediction uncertainty values ​​are less than uncertainty thresholds. A continuous time window is also determined as a reliable data window when the concentration difference is less than a concentration threshold, the average value is less than an average value threshold, the absolute value of the temperature difference is less than a temperature threshold, the absolute value of the humidity difference is less than a humidity threshold, the time corresponding to the continuous time window is within a first preset time period, the doors and windows are open, and the stove is closed. This allows for the determination of when the output of the target model is relatively reliable.

[0011] In one embodiment, the fine-tuning process of the target model includes: When the total duration of the multiple trusted data windows reaches a preset duration, the preset concentration is taken as the actual concentration of the actual environment in each trusted data window; Based on the temperature, humidity, light intensity signals, and gas type corresponding to the trusted data window, the target model is used to output a second initial predicted concentration. The second model loss is calculated based on the second initial predicted concentration and the preset concentration; The model parameters of the fully connected layer and / or output layer of the target model are fine-tuned using the second model loss to obtain the fine-tuned target model. The formula for calculating the second model loss (Loss) is: Loss = MSE(Second Initial Predicted Concentration, Preset Concentration) + λ × ||ΔW|| 2 MSE(Second Initial Predicted Concentration, Preset Concentration) represents the mean square error corresponding to the second initial predicted concentration and the preset concentration, λ is the regularization coefficient, and ΔW is the change in constraint weights.

[0012] In this application, when the total duration of multiple trusted data windows reaches a preset duration, a preset concentration is used as the actual concentration of the actual environment within each trusted data window. Based on the temperature, humidity, light intensity signal, and gas type corresponding to the trusted data window, a second initial predicted concentration is output using the target model. Based on the second initial predicted concentration and the preset concentration, a second model loss is calculated. Through the second model loss, the model parameters of the fully connected layer and / or output layer of the target model are fine-tuned to obtain the fine-tuned target model. This allows the fine-tuned target model to adapt to the gradual decay of hardware performance (such as laser aging), correct the nonlinear relationship of concentration inversion, eliminate systematic offsets caused by diurnal temperature differences and short-term dust coverage, maintain short-term accuracy, and thus improve the accuracy of prediction.

[0013] In one embodiment, the method further includes: The prediction uncertainty values ​​corresponding to each of the trusted data windows within the second preset time period are statistically analyzed. Based on the mean uncertainty U among the predicted uncertainty values. current By H=max(0,1-(U current / U base -1) / k a Determine the health status H of the target device; U base k is the baseline mean. a The attenuation coefficient; Based on the health level of the target device, determine the health status of the target device, and output a prompt message based on the health status.

[0014] In this application, the predicted uncertainty values ​​corresponding to each reliable data window within a second preset time period are statistically analyzed, and the mean uncertainty U among these predicted uncertainty values ​​is used as the basis for the method. current By H=max(0,1-(U current / U base -1) / k) determines the health level H of the target device. Based on the health level of the target device, the health status of the target device can be determined, and prompt information corresponding to the health status can be output.

[0015] In one embodiment, determining the health status of the target device based on its health level and outputting a prompt message based on the health status includes: When the health level is greater than or equal to the health threshold, the health status of the target device is determined to be normal, and a first prompt message is output. When the health status is less than the health threshold and greater than or equal to the performance degradation threshold, the health status of the target device is determined to be a performance degradation state, and a second prompt message is output. When the health status is less than the performance degradation threshold, the health status of the target device is determined to be a fault state, and a third prompt message is output; the first prompt message, the second prompt message, and the third prompt message are all inconsistent.

[0016] In this application, when the health level is greater than or equal to a health threshold, the target device is determined to be in a normal health state and a first prompt message is output; when the health level is less than the health threshold but greater than or equal to a performance degradation threshold, the target device is determined to be in a performance degradation state and a second prompt message is output; when the health level is less than the performance degradation threshold, the target device is determined to be in a fault state and a third prompt message is output. This allows users to directly judge the current status of the target device based on the output prompt messages, so that the target device can be replaced or repaired in a timely manner when it is in a fault state.

[0017] In one embodiment, the method further includes: Obtain the historical predicted concentration output by the target model, and determine three times the standard deviation based on the historical predicted concentration; When the continuous time window corresponding to the current time is a reliable data window, each predicted concentration corresponding to the current continuous time window is compared with three times the standard deviation to obtain the comparison results. If the comparison results indicate that multiple consecutive predicted concentrations are greater than three times the standard deviation, it is determined that the target model has a prediction bias.

[0018] In this application, by obtaining the historical predicted concentrations output by the target model, and determining three standard deviations based on the historical predicted concentrations, when the continuous time window corresponding to the current time is a reliable data window, each predicted concentration corresponding to the current continuous time window is compared with three standard deviations to obtain the comparison results. When the comparison results indicate that multiple consecutive predicted concentrations are greater than three standard deviations, it is determined that the target model has a prediction bias. This can promptly detect the prediction bias of the target model, so as to adjust the target model in a timely manner and avoid making incorrect judgments based on unreliable results output by the target model.

[0019] In one embodiment, step S5 is followed by: When the window preceding the continuous time window is a reliable data window, it is determined whether each predicted concentration output by the target model within the continuous time window is greater than an alarm threshold. If the predicted concentration is greater than the alarm threshold, an alarm message indicating that the methane concentration exceeds the limit will be output.

[0020] In this application, when the preceding window of the continuous time window is a reliable data window, it is determined whether each predicted concentration output by the target model within the continuous time window is greater than the alarm threshold. If there is a predicted concentration greater than the alarm threshold, a methane concentration exceeding the standard alarm prompt is output. This ensures that the predicted concentration output within the continuous time window is reliable, thereby avoiding false alarms.

[0021] An apparatus for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, for performing the above-described method, the apparatus comprising: The data acquisition module is used to acquire multiple high-dimensional vectors corresponding to various environmental conditions; the high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. The preprocessing module is used to determine the absorption spectrum of each of the high-dimensional vectors based on the original transmitted light intensity signal and the reference light intensity signal of each high-dimensional vector, and to preprocess each absorption spectrum to obtain a preprocessed spectrum. The model training module is used to train a concentration prediction model based on each of the preprocessed spectra and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration to obtain a target model; the target model is a digital twin. The actual parameter acquisition module is used to write the target model into the memory of the target device, and to acquire the environmental parameters and light intensity signals in the actual environment collected by the target device within a continuous time window, and to determine the actual spectrum corresponding to the light intensity signal; The prediction module is used to output the predicted concentration of the actual environment within a continuous time window based on the actual spectrum and the environmental parameters, using the target model written in the target device, so as to perform closed-loop evolution processing for the target model through the actual spectrum, the environmental parameters and the predicted concentration; the environmental parameters include the temperature, humidity and gas type of the actual environment.

[0022] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0023] The aforementioned method, apparatus, and medium for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms utilize data obtained directly or indirectly from the target device written into the target model. The concentration prediction model is trained based on the preprocessed spectra and the corresponding actual temperature, humidity, interfering gas type, and methane concentration to obtain the target model. Writing the target model into the target device's memory achieves a deep association between the model and the device, and allows for the direct mapping and embedding of physical manufacturing deviations of the target device into the model parameters. This compensates for prediction errors caused by the physical manufacturing deviations of the target device, resulting in accurate concentration predictions when using the target model for concentration prediction. Attached Figure Description

[0024] Figure 1 This is an application environment diagram of a method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, as shown in one embodiment. Figure 2 This is a flowchart illustrating a method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms in one embodiment. Figure 3 This is a schematic diagram of the overall process of a method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, as described in another embodiment. Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0026] The method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, provided in this application, can be applied to applications such as... Figure 1 In the application environment shown, terminal 102 interacts with server 104 via a wired / wireless channel. A data storage system stores the data that server 104 needs to process. The server acquires multiple high-dimensional vectors corresponding to various environmental conditions; these high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. Based on the original transmitted light intensity signal and reference light intensity signal of each high-dimensional vector, the server determines the absorption spectrum of each high-dimensional vector and preprocesses each absorption spectrum to obtain a preprocessed spectrum. Based on each preprocessed spectrum and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration, the server trains a concentration prediction model to obtain a target model; the target model is a digital twin. The server writes the target model to the memory of the target device and uses the target device to collect environmental parameters and light intensity signals in the actual environment to determine the actual spectrum corresponding to the light intensity signal. Based on the actual spectrum and environmental parameters, the server uses the target model written in the target device to output the predicted concentration of the actual environment; the environmental parameters include the actual temperature, humidity, and gas type. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, etc. The server 104 can be a single server, a server cluster consisting of multiple servers, or a cloud computing center consisting of multiple servers.

[0027] In one embodiment, such as Figure 2 As shown, a method for predicting gas concentration is provided, which can be applied to... Figure 1 Taking server 104 as an example, the following steps are included: S1. Obtain multiple high-dimensional vectors corresponding to various environmental conditions; the high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. The process of constructing environmental conditions includes: setting multiple expected temperatures within the expected temperature range using a first preset step size; setting multiple expected humidity levels within the expected humidity range using a second preset step size; setting multiple expected concentrations; determining interfering gases with controllable concentrations; forming multiple sets of operating condition parameters based on multiple expected temperatures, multiple expected humidity levels, multiple expected concentrations, and each interfering gas; obtaining multiple environmental conditions based on each set of operating condition parameters; each set of operating condition parameters includes one expected temperature, one expected humidity, one expected concentration, and one interfering gas, and each set of operating condition parameters can construct one environmental condition. For example, within the expected temperature range of -10°C to 60°C, multiple expected temperatures are set with any value between 5 and 10°C as the first preset step size; within the expected humidity range of 10%RH to 90%RH, any value between 20%RH is set as the second preset step size; within the range of 0 to 100%LEL (lower explosion limit, i.e., 0 to 5% volume concentration), 0ppm (pure air), several low concentration points (such as 50ppm, 200ppm), and several high concentration points (such as 1%LEL, 10%LEL) are set, and interfering gases such as water vapor (high humidity), ethanol vapor (simulating alcohol evaporation) and carbon dioxide are set to observe the cross-effect of interfering gases on the absorption spectrum.

[0028] The multiple high-dimensional vectors corresponding to each environmental condition are the response of the full waveform spectrum over a wide environmental range, rather than a few calibration points under finite conditions. This provides sufficient information for the model to learn complex nonlinear relationships.

[0029] Each environmental condition corresponds to multiple high-dimensional vectors. Actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal are information identified or collected from the environmental conditions using the target device. Actual temperature and actual humidity can be acquired by sensors in the target device. Actual methane concentration can be detected by a standard concentration sensor.

[0030] The original transmitted light intensity signal is the signal collected when the laser passes through the area containing interfering gases in the environmental conditions. The acquisition process of the original transmitted light intensity signal includes: scanning the environmental conditions for one complete cycle using the laser in the target device; collecting the light signal using the detector in the target device during the laser scanning process; converting the light signal into a time-varying voltage signal, and outputting the voltage signal as the original transmitted light intensity signal. Among these, the laser scanning for one complete cycle and the detector outputting the original voltage signal that varies with time is the core measurement process of Tunable Semiconductor Laser Absorption Spectroscopy (TDLAS) technology.

[0031] The reference intensity signal is the signal collected when the laser passes through an area in the environment free of interfering gases. It can also be understood as the background intensity when no interfering gases absorb the laser. The core purpose of the reference intensity signal is to eliminate the influence of laser power fluctuations and optical path jitter, retaining only the information about gas absorption. The reference intensity signal reproduces the profile of the laser power changing with the scanning current. The steps for obtaining the reference intensity signal are as follows: Step 1: During the laser scanning process, the laser wavelength will sweep across the absorption line (near the center frequency) and the "baseline" region far from the absorption line, and identify the voltage data points far from the absorption line (i.e. the part of the light intensity that is not attenuated by the gas absorption). Step 2: Using the voltage data points, fit a smooth curve (usually using polynomial fitting, spline interpolation, or moving average). The fitted curve is the reference light intensity signal.

[0032] Furthermore, the high-dimensional vector also includes a modulation signal used to infer the laser wavelength.

[0033] The laser wavelength (λ1) of a laser is determined by both the energy level structure of the laser medium and the optical path of the resonant cavity, and both the energy level structure and the optical path are affected by current and temperature. Temperature changes the bandgap and refractive index of the semiconductor material, thus altering the optical path of the resonant cavity, with the relationship Δλ1≈α. ΔT and α are the temperature drift coefficients, Δλ1 is the change in laser wavelength, and ΔT is the temperature change. Current, by altering the carrier concentration, can cause changes in refractive index (plasma effect) and slight variations in junction temperature (thermal effect), with the relationship Δλ1≈β. ΔI and β are the current tuning coefficients, and ΔI is the change in current.

[0034] The steps to deduce the laser wavelength from the modulation signal are as follows: Step 1: During the factory manufacturing or calibration of the target equipment, establish the "current-wavelength" correspondence using a wavelength meter or gas absorption line. This specifically includes: fixing the laser temperature; applying a series of known DC currents to the laser; measuring the output wavelength corresponding to each current point using a high-precision wavelength meter; and fitting I... AThe curve (t)-λ1(t) (usually linear: λ1(t)=kI) A (t)+b), k is the slope, b is the intercept, and λ1(t) is the laser wavelength curve.

[0035] Step 2, use ADC to synchronously acquire laser drive current I A (t), using λ1(t)=kI A (t)+b, directly calculate the instantaneous wavelength.

[0036] In the process of inferring the laser wavelength from the modulated signal, the effect of temperature is to shift the entire I... A The curve is (t)-λ1(t), rather than real-time modulation.

[0037] Furthermore, by binding high-dimensional vectors and the serial number of the target device, a database representing the mapping relationship between "spectrum-environment-concentration" is obtained. This database is the most comprehensive and initial "behavioral clone" of the target device. By binding high-dimensional vectors and the serial number of the target device, a unique, high-dimensional behavioral fingerprint database (a database representing the mapping relationship) can be established for the target device before it leaves the factory. Based on this behavioral fingerprint database, a target model that can accurately simulate the physical characteristics of the target device can be trained.

[0038] S2. Based on the original transmitted light intensity signal and the reference light intensity signal of each high-dimensional vector, determine the absorption spectrum of each high-dimensional vector, and preprocess each absorption spectrum to obtain the preprocessed spectrum. The absorption spectrum α(ν(t)) is expressed as α(ν(t)) = -ln[I(t) / I0(t)], where I(t) is the original transmitted light intensity signal, I0(t) is the reference light intensity signal, and ν is the optical frequency. When calculating the absorption spectrum of a high-dimensional vector, the original transmitted light intensity signal and the reference light intensity signal from that high-dimensional vector are used.

[0039] Preprocessing is performed on each absorption spectrum to obtain the preprocessed spectrum. This includes aligning each absorption spectrum on the frequency axis to obtain the aligned absorption spectrum; reducing the dimension of the aligned absorption spectrum to obtain the dimension-reduced absorption spectrum; and performing data augmentation processing such as noise addition and slight stretching on the dimension-reduced absorption spectrum to obtain the preprocessed spectrum. This increases the robustness of the model when training it using the preprocessed spectrum.

[0040] Spectral alignment is a crucial preprocessing step to eliminate laser wavelength drift and ensure that the concentration prediction model learns effective absorption characteristics. Its core logic is to mathematically transform the acquired time-domain / frequency-domain signals to a fixed frequency coordinate system, aligning the center of the methane absorption line to its theoretical position. Essentially, alignment transforms the data from the noisy time domain or the original frequency domain to a stable standard frequency domain. Without alignment, directly using the original absorption spectrum will encounter the following problems: 1. Physical drift: The center wavelength of a laser will drift with ambient temperature and aging. Two scans at the same concentration and under the same environment may have different positions of the absorption peak on the time axis.

[0041] 2. Model confusion: Concentration prediction models may mistakenly believe that the "shift in the position of the absorption peak" is a characteristic of a certain concentration or environmental change, causing the learning rules to fail and the generalization ability to be extremely poor.

[0042] The specific steps for spectral alignment are as follows: Step 1: Using the laser's current-frequency tuning coefficient k1, through ν raw (t)=ν start +k1×t transforms the absorption spectrum from the time axis to the original frequency axis; t is the time variable, ν raw (t) represents the original instantaneous frequency, ν start This is the starting frequency.

[0043] Step 2: Locate the measured absorption peak position. In the original frequency domain, use peak-finding algorithms (such as finding the minimum point or quadratic fitting interpolation) to find the frequency value corresponding to the methane characteristic absorption valley in the absorption curve. Step 3: Compare the measured peak position with the theoretical peak position and calculate the offset: The original frequency axis is shifted by Δν to obtain the aligned standard frequency axis. At this point, the absorption spectrum becomes the aligned absorption spectrum.

[0044] S3. Based on each preprocessed spectrum and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration, train the concentration prediction model to obtain the target model; the target model is a digital twin. In this context, a concentration prediction model refers to a model capable of predicting concentrations. For example, a DNN (Deep Neural Network) model. Each preprocessed spectrum serves as the main input to the concentration prediction model, while the corresponding actual temperature, humidity, and interfering gas type constitute the conditional inputs. The main inputs are the core data or primary independent variables used to directly derive the predicted concentration; they are the most crucial source of information for the target model's prediction. Conditional inputs are auxiliary variables that provide environmental background, physical constraints, or state context for the target model's prediction process. While not a direct basis for derivation, conditional inputs influence the mapping relationship between the core data and the final predicted concentration.

[0045] S4. Write the target model into the memory of the target device, and obtain the environmental parameters and light intensity signals in the actual environment collected by the target device within a continuous time window, and determine the actual spectrum corresponding to the light intensity signal; The process of writing the target model into the target device's memory includes writing a structured data packet containing the target model's network architecture, weight parameters, forward inference engine, and calibration data into the target device's memory. After the target model is written into the target device's memory, this digital twin is integrated with the target device, becoming a digital copy of its initial factory state.

[0046] The information written to the target device's memory also includes the target device's serial number and factory calibration information.

[0047] The light intensity signals collected in the actual environment include the actual transmitted light intensity signal I1(t) collected when the laser passes through the region where interfering gas is present in the actual environment, and the actual reference light intensity signal I2(t) collected when the laser passes through the region where no interfering gas is present in the actual environment. The actual spectrum corresponding to the light intensity signal is -ln[I1(t) / I2(t)].

[0048] Steps S1, S2, S3, and S4, in which the target model is written to the memory of the target device, are all steps performed before the target device leaves the factory.

[0049] The actual environment is the environment in which the target device is used after it leaves the factory. For example, if family A purchases the target device and installs it in the kitchen, then family A's kitchen is the actual environment in which the target device is located.

[0050] Furthermore, the structured data packets containing the target model's network architecture, weight parameters, forward inference engine, and calibration data undergo lightweight processing, and the lightweight data packets are written to the target device's memory. This lightweight processing includes, but is not limited to, pruning and parameter quantization. This reduces the computational resources required for the target model to perform predictions, ensuring the smooth operation of the target model written to the target device's memory.

[0051] S5. Based on the actual spectrum and environmental parameters, the target model written in the target device outputs the predicted concentration of the actual environment within a continuous time window, so as to perform closed-loop evolution processing for the target model through the actual spectrum, environmental parameters and predicted concentration; the environmental parameters include the actual environment's temperature, humidity and gas type.

[0052] The formula for calculating the predicted concentration in the target model is a0 + a1×x + a2×x² + bias, where a0, a1, and a2 are polynomial coefficients, x is the scalar value corresponding to the spliced ​​vector, and bias is the systematic bias.

[0053] The predicted concentration is the predicted concentration of methane in the actual environment. After acquiring environmental parameters and determining the actual spectrum corresponding to the light intensity signal, the target device inputs the environmental parameters and the actual spectrum into its own target model to obtain the predicted concentration in the actual environment.

[0054] Performing closed-loop evolution processing on the target model using actual spectra, environmental parameters, and predicted concentrations refers to fine-tuning the target model based on actual spectra, environmental parameters, and predicted concentrations, so that the target model and the target device can form a dynamic equilibrium relationship of mutual feedback and mutual adaptation in the actual environment.

[0055] In the aforementioned method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, the preprocessed spectra and their corresponding actual temperatures, humidity, interfering gas types, and methane concentrations are data directly or indirectly obtained from the target device and written into the target model. A concentration prediction model is trained based on these preprocessed spectra and their corresponding actual temperatures, humidity, interfering gas types, and methane concentrations to obtain the target model. This target model is then written into the target device's memory. This achieves a deep association between the model and the device, and allows the physical manufacturing deviations of the target device to be directly mapped and solidified into the model parameters of the target model. This compensates for prediction errors caused by the physical manufacturing deviations of the target device, resulting in accurate concentration predictions when using the target model for concentration prediction.

[0056] In one embodiment, step S3 includes: S31. Use the one-dimensional convolutional layer of the concentration prediction model to extract the local and global spectral features of each preprocessed spectrum, and use the fully connected layer of the concentration prediction model to encode the actual temperature, actual humidity and interfering gas type corresponding to each preprocessed spectrum to obtain temperature vector, humidity vector and type vector. Extracting local spectral features from each preprocessed spectrum aims to capture the first and second derivatives of the absorption lines. These local spectral features can be extracted using small convolutional kernels in a one-dimensional convolutional layer. For example, small convolutional kernels with sizes between 3 and 7 can be used to extract local spectral features. Small convolutional kernels can sensitively capture drastic changes at the center frequency of the absorption lines, which is crucial for accurately pinpointing peak positions and identifying subtle line distortions.

[0057] The purpose of extracting global spectral features is to extract characteristics of the entire absorption peak (such as peak area, pressure broadening, absorption linewidth, line shape, and baseline curvature). Global spectral features can be extracted using convolutional kernels with relatively large kernel sizes in a one-dimensional convolutional layer. For example, kernels with sizes of 15 to 25 can be used to extract global spectral features. The width of the convolutional kernel used for extracting global spectral features should be slightly larger than the full width at half maximum (FWHM) of the methane absorption line at typical pressures.

[0058] The extraction of local and global spectral features, along with the encoding of the actual temperature, humidity, and interfering gas types corresponding to each preprocessed spectrum, can be performed simultaneously in different branch channels.

[0059] Furthermore, the features extracted by the one-dimensional convolutional layer of the concentration prediction model also include global context features of each absorption spectrum. These global context features are concatenated with local spectral features, global spectral features, temperature vector, humidity vector, and type vector to obtain a concatenated vector. This allows for understanding baseline drift and the relative positions of multiple peaks across the entire laser scanning range through global context features. Notably, the extraction of global context features does not use extremely large convolutional kernels; instead, Global Average Pooling or a Transformer (self-attention mechanism) is introduced at the back end of the concentration prediction model to capture global context features.

[0060] S32. The local spectral features, global spectral features, temperature vector, humidity vector and type vector corresponding to each preprocessed spectrum are spliced ​​together to obtain the spliced ​​vector corresponding to each preprocessed spectrum. In vector concatenation, the local spectral features, global spectral features, temperature vector, humidity vector, and type vector corresponding to the same preprocessed spectrum are concatenated. Vector concatenation is essentially feature fusion.

[0061] The concatenation of local spectral features, global spectral features, temperature vector, humidity vector, and type vector is performed in the intermediate layer of the concentration prediction model.

[0062] S33. Based on each splicing vector, the first initial predicted concentration corresponding to each preprocessed spectrum is obtained through the concentration prediction model; The initial predicted concentration corresponding to each preprocessed spectrum is output through the output layer of the concentration prediction model. The neural network used in the output layer includes, but is not limited to, a Bayesian neural network.

[0063] S34. Based on the first initial predicted concentration and the actual methane concentration corresponding to each preprocessed spectrum, determine the first model loss, and optimize the concentration prediction model based on the first model loss. The loss of the first model is calculated using a loss function. This loss function includes, but is not limited to, a mean squared error calculation function or a mean absolute percentage error calculation function.

[0064] S35. Based on the optimized concentration prediction model, repeat steps S31, S32, S33, and S34 until the iteration stopping condition is met to obtain the target model.

[0065] In the training process of the concentration prediction model, each preprocessed spectrum and the corresponding actual temperature, actual humidity, interfering gas type and actual methane concentration can be divided into training set and validation set in proportion (e.g., 8:2). The backpropagation algorithm (e.g., Adam optimizer) is used for training until the accuracy of the concentration prediction model on the validation set converges (satisfying the iteration stopping condition), and the target model is obtained.

[0066] In this embodiment, step S31 involves extracting local and global spectral features of each preprocessed spectrum using a one-dimensional convolutional layer of the concentration prediction model, and encoding the actual temperature, actual humidity, and interfering gas type corresponding to each preprocessed spectrum using a fully connected layer of the concentration prediction model to obtain temperature vector, humidity vector, and type vector; step S32 involves concatenating the local and global spectral features, temperature vector, humidity vector, and type vector corresponding to each preprocessed spectrum to obtain a concatenated vector corresponding to each preprocessed spectrum; and step S33 involves obtaining the first initial prediction corresponding to each preprocessed spectrum based on each concatenated vector using the concentration prediction model. Concentration; S34. Based on the first initial predicted concentration and the actual methane concentration corresponding to each preprocessed spectrum, determine the first model loss, and optimize the concentration prediction model based on the first model loss; S35. Repeat S31, S32, S33, and S34 based on the optimized concentration prediction model until the iteration stopping condition is met to obtain the target model. This allows the concentration prediction model to directly learn the concentration characteristics from the preprocessed spectrum, bypassing the simplified inversion steps based on physical formulas in traditional methods, and allowing the concentration prediction model to discover the most essential mapping relationship between the preprocessed spectrum and temperature, humidity, interfering gas type, and concentration.

[0067] In one embodiment, the method further includes: Determine the maximum, minimum, and average values ​​of each predicted concentration output by the target model within a continuous time window; determine the temperature difference between each temperature and the humidity difference between each humidity level collected by the target device within a continuous time window; determine the status of doors and windows and the status of stoves in the actual environment; and determine the prediction uncertainty value corresponding to each predicted concentration. When the concentration difference between the maximum and minimum values ​​is less than the concentration threshold, the average value is less than the average value threshold, the absolute value of the temperature difference is less than the temperature threshold, the absolute value of the humidity difference is less than the humidity threshold, and all prediction uncertainty values ​​are less than the uncertainty threshold, the continuous time window is determined as a reliable data window. When the concentration difference is less than the concentration threshold, the average value is less than the average value threshold, the absolute value of the temperature difference is less than the temperature threshold, the absolute value of the humidity difference is less than the humidity threshold, the time corresponding to the continuous time window is within the first preset time period, the door and window status is open, the stove status is closed and the duration of the closed status exceeds the preset closed duration, the continuous time window is determined as a reliable data window. Based on the temperature, humidity, gas type, and light intensity signals corresponding to at least one reliable data window, the target model is fine-tuned to predict gas concentration.

[0068] The target device collects environmental parameters and light intensity signals multiple times within a continuous time window. The target model makes concentration predictions based on each collected environmental parameter and light intensity signal. Therefore, the target model outputs multiple predicted concentrations within a continuous time window, thus obtaining the maximum, minimum, and average values ​​of each predicted concentration.

[0069] The concentration difference between the predicted maximum value (max(C)) and minimum value (min(C)) is less than the concentration threshold δ. c The expression is max(C) - min(C) < δ c The mean (C) is less than the mean threshold C. threshold The expression is mean(C). <C threshold An average value less than the average value threshold indicates that there is almost no methane leakage in the actual environment within a continuous time window. A concentration difference less than the concentration threshold and an average value less than the average value threshold can rule out periods of leakage or drastic concentration fluctuations.

[0070] The temperature difference refers to the difference between the maximum and minimum temperatures collected by the target device within a continuous time window. The absolute value of the temperature difference, |ΔT|, is less than the temperature threshold δ. T The expression is |ΔT|<δ T .

[0071] The humidity difference refers to the difference between the maximum and minimum humidity values ​​collected by the target device within a continuous time window. The absolute value of the humidity difference, |ΔH|, is less than the humidity threshold δ. H The expression is |ΔH|<δ H .

[0072] The absolute value of the temperature difference is less than the temperature threshold, and the absolute value of the humidity difference is less than the humidity threshold. This can eliminate the possibility of optical path distortion caused by thermal expansion and contraction and prevent water vapor condensation interference, ensuring relatively stable optical conditions and no drastic jumps in the spectral baseline.

[0073] Door and window status refers to the condition of doors and windows in the actual environment where the target equipment is located. Stoves status refers to the condition of stoves in the actual environment where methane leakage may occur, such as gas stoves. Door and window status includes both open and closed states, as does stove status. An open door and window status indicates good ventilation and a low probability of methane accumulation.

[0074] The prediction uncertainty value is an inverse measure of the reliability of the target model's predicted concentration. A higher prediction uncertainty value indicates a less reliable predicted concentration, while a lower value indicates a more reliable prediction. If all prediction uncertainty values ​​are below the uncertainty threshold, data from periods when the target equipment is contaminated or malfunctioning can be actively excluded.

[0075] The prediction uncertainty values ​​corresponding to each predicted concentration are output by the target model along with the predicted concentration. That is, based on the actual spectrum and environmental parameters, the target model written in the target device outputs the predicted concentration of the actual environment and the prediction uncertainty values ​​corresponding to the predicted concentration.

[0076] When the laser exhibits spectral baseline elevation and signal-to-noise ratio decline, the target model will find that the absorption features are overwhelmed by noise, leading to increased prediction uncertainty. Similarly, when the laser experiences optical power attenuation causing a systematic reduction in the amplitude of the absorbed signal, the target model will also exhibit high prediction uncertainty due to the signal deviating from the amplitude range used during training.

[0077] The first preset time period is the time period during which equipment that operates using methane will not be used in the actual environment. For example, the probability of using a gas stove is very low between 02:00 and 05:00 in the morning, so 02:00 to 05:00 in the morning is the first preset time period.

[0078] The temperature, humidity, gas type, and light intensity signals corresponding to the trusted data window refer to the temperature, humidity, type of interfering gas, original transmitted light intensity signal, and reference light intensity signal collected within the trusted data window.

[0079] The continuous time window corresponds to a time within the first preset time period, the doors and windows are open, and the stove is closed. This allows for the use of external information to greatly improve the confidence level of the "zero gas" judgment.

[0080] The continuous time window is a reliable data window, indicating that the predicted concentrations output by the target model within the continuous time window are relatively reliable.

[0081] Within the reliable data window, the methane concentration should theoretically be 0 ppm. The difference between the actual predicted concentration and 0 is considered the current offset. Using a low-pass filter to slowly update the bias avoids short-term noise interference. The bias update formula is: New bias = Original bias × 0.9 Current offset × 0.1.

[0082] The concentration threshold, average threshold, temperature threshold, humidity threshold, and uncertainty threshold are all preset data. For example, the concentration threshold is 10 ppm, the average threshold is 50 ppm, the temperature threshold is 1°C, and the humidity threshold is 5%RH.

[0083] In this embodiment, a continuous time window is determined as a reliable data window when the concentration difference between the maximum and minimum values ​​is less than a concentration threshold, the average value is less than an average value threshold, the absolute value of the temperature difference is less than a temperature threshold, the absolute value of the humidity difference is less than a humidity threshold, and all prediction uncertainty values ​​are less than uncertainty thresholds. A continuous time window is also determined as a reliable data window when the concentration difference is less than a concentration threshold, the average value is less than an average value threshold, the absolute value of the temperature difference is less than a temperature threshold, the absolute value of the humidity difference is less than a humidity threshold, the time corresponding to the continuous time window is within a first preset time period, the doors and windows are open, and the stove is closed. This allows us to determine when the output of the target model is relatively reliable.

[0084] In one embodiment, the fine-tuning process of the target model includes: When the total duration of multiple trusted data windows reaches the preset duration, the preset concentration is used as the actual concentration trusted data window of the actual environment within each trusted data window. Based on the temperature, humidity, light intensity signals, and gas type corresponding to the reliable data window, the target model outputs the second initial predicted concentration. The second model loss is calculated based on the second initial predicted concentration and the preset concentration; The model parameters of the fully connected layers and / or output layers of the target model are fine-tuned using the second model loss to obtain the fine-tuned target model. The light intensity signal includes the original transmitted light intensity signal and the reference light intensity signal collected in the actual environment. When using the target model to output the second initial predicted concentration, the absorption spectrum corresponding to the actual environment is obtained based on the original transmitted light intensity signal and the reference light intensity signal collected in the actual environment, which is also the absorption spectrum corresponding to the reliable data window. The temperature, humidity, gas type and absorption spectrum corresponding to the reliable data window are then input into the target model to output the second initial predicted concentration.

[0085] The formula for calculating the second model loss (Loss) is: Loss = MSE(Second Initial Predicted Concentration, Preset Concentration) + λ × ||ΔW|| 2 MSE(Second Initial Predicted Concentration, Preset Concentration) represents the mean square error corresponding to the second initial predicted concentration and the preset concentration, λ is the regularization coefficient, and ΔW is the change in constraint weights.

[0086] The purpose of MSE (Second Initial Predicted Concentration, Preset Concentration) is to set the predicted concentration of the target model to 0. The change in constraint weights should not be too large to ensure that fine-tuning is a "small correction" rather than a "complete overhaul".

[0087] If the decrease in the second model loss is less than the threshold ε over several consecutive iterations, fine-tuning stops, and the fine-tuned target model is obtained; or if the standard deviation of the predicted concentration of the fine-tuned model on the validation set is less than the target value, fine-tuning stops, and the fine-tuned target model is obtained; if the second model loss increases instead of decreasing or the change in constraint weights exceeds the safe range, the model is immediately rolled back to the previous version of the target model, and the target device is marked as potentially requiring physical maintenance.

[0088] The total duration is obtained by adding the durations of each trusted data window. For example, trusted data window 1 is from 07:00 to 17:00, trusted data window 2 is from 17:01 to 06:59, and the sum of the durations of trusted data window 1 and trusted data window 2 is 24 hours. The preset duration is 24 hours, so after obtaining trusted data window 2, fine-tuning of the target model can be performed.

[0089] Based on the criteria for the trusted data window, it can be determined that the methane concentration in the actual environment is close to zero within the trusted data window. Therefore, the preset concentration can be directly used as the actual concentration of the environment within each trusted data window. The preset concentration is zero or a minimum value.

[0090] To maintain the model's generalization ability and prevent "catastrophic forgetting" during fine-tuning of the target model, a layered fine-tuning strategy is employed. This involves freezing the first few layers of the network (especially convolutional layers) and only unlocking and updating the last few layers of the target model (fully connected layers and output layers). The convolutional layers are responsible for extracting general spectral features (such as absorption line shapes). The fully connected layers and output layers are responsible for mapping spectral features to concentration values ​​and are the parts most affected by the aging of the target device. The model parameters fine-tuned include the bias terms and weight coefficients of the last few layers of the target model.

[0091] Furthermore, when the total duration of multiple trusted data windows reaches the preset duration, the model parameters to be fine-tuned are the bias terms of the target model output layer; when the number of currently stored target data reaches the preset number, the weight coefficients of the last M fully connected layers of the target model are fine-tuned to obtain the fine-tuned target model; the target data includes a temperature, a humidity, a gas type, and a light intensity signal obtained simultaneously.

[0092] Furthermore, when the time difference between the current time and the previous time of fine-tuning the target model is greater than a first preset time difference, the target model is fine-tuned. This avoids frequent calculations that consume the target device's computing resources.

[0093] By fine-tuning the target model, the target device (hardware) and its digital twin (target model) can form a dynamic equilibrium relationship of mutual feedback and co-adaptation in the real environment, enabling the target device and target model to co-evolve. The essence of co-evolution is that changes in the state of the target device (aging, contamination) drive adjustments to the target model, and the adjusted target model, in turn, corrects the perceived results output by the hardware, thereby achieving a closed-loop evolution for the target model.

[0094] Co-evolutionary drivers include state drift of physical entities (target devices), specifically including: 1. Physical Changes (Hardware Evolution): In a home environment, the optical window of the laser in the target device will slowly accumulate dust (reduced transmittance), the laser's luminous efficiency will decrease (reduced optical power), and the detector's sensitivity will change. This is the inevitable "aging" of hardware.

[0095] 2. Signal performance: For the same methane concentration, the original absorption spectrum waveform (baseline, amplitude, signal-to-noise ratio) will be systematically shifted when the sensor (target device) is "young" and "old".

[0096] The core characteristic of co-evolution is the degree of coupling between model parameters and hardware state. This can be defined by the following specific metrics: 1. Baseline Drift: This is the long-term moving average of the predicted concentration output by the digital twin under "zero gas" conditions. This baseline drift exhibits a continuous, smooth, and trending change over time, rather than random fluctuations. This demonstrates that the model follows hardware drift.

[0097] 2. Model confidence (prediction uncertainty value): This is the digital twin's estimate of the uncertainty of its own predictions. When co-evolution is effective, the confidence remains high; when hardware failure occurs (such as a broken lens), the confidence drops sharply, indicating that the model has perceived a mutation it cannot adapt to.

[0098] 3. Feature Layer Activation Distribution: This is the statistical distribution of activation values ​​of neurons in the intermediate layers of the target model. By comparing the statistical distribution at the time of manufacture with that after one year of operation, a systematic shift in the distribution pattern can be observed, proving that the feature extraction logic within the model has changed to adapt to the new environment.

[0099] In this embodiment, when the total duration of multiple trusted data windows reaches a preset duration, a preset concentration is used as the actual concentration of the actual environment within each trusted data window. Based on the temperature, humidity, light intensity signal, and gas type corresponding to the trusted data window, a second initial predicted concentration is output using the target model. Based on the second initial predicted concentration and the preset concentration, a second model loss is calculated. Through the second model loss, the model parameters of the fully connected layer and / or output layer of the target model are fine-tuned to obtain the fine-tuned target model. This allows the fine-tuned target model to adapt to the gradual decay of hardware performance (such as laser aging), correct the nonlinear relationship of concentration inversion, eliminate the systematic offset caused by diurnal temperature differences and short-term dust coverage, maintain short-term accuracy, and thus improve the accuracy of prediction.

[0100] In one embodiment, the method further includes: The prediction uncertainty values ​​corresponding to each reliable data window within the second preset time period are statistically analyzed. Based on the mean uncertainty U among the various predicted uncertainty values current By H=max(0,1-(U current / U base -1) / k a Determine the health status H of the target device; U base k is the baseline mean. a The attenuation coefficient; Based on the health status of the target device, determine the health condition of the target device and output a prompt message based on the health condition.

[0101] The second preset time period is a pre-defined time period. For example, if the prediction uncertainty values ​​corresponding to each reliable data window over the past 30 days are statistically analyzed, then the past 30 days would be the second preset time period.

[0102] The prediction uncertainty values ​​corresponding to each reliable data window are output along with the prediction concentration.

[0103] The baseline mean is the average of the prediction uncertainties output by the target model before it leaves the factory or after maintenance, based on various parameters collected under operating conditions with clean air. Specifically, temperature, humidity, gas type, and light intensity signals are collected multiple times under operating conditions without methane. The calibrated target model is then used to output multiple prediction uncertainty values ​​based on these multiple collections of temperature, humidity, gas type, and light intensity signals, thus obtaining the baseline mean. The calibrated target model can be understood as a model with higher prediction accuracy.

[0104] Furthermore, the attenuation coefficient is 0.5.

[0105] In this embodiment, by statistically analyzing the prediction uncertainty values ​​corresponding to each reliable data window within the second preset time period, and based on the mean uncertainty U among the prediction uncertainty values, current By H=max(0,1-(U current / U base -1) / k) determines the health level H of the target device. Based on the health level of the target device, the health status of the target device can be determined, and prompt information corresponding to the health status can be output.

[0106] In one embodiment, the health status of the target device is determined based on the target device's health level, and a prompt message is output based on the health status, including: When the health level is greater than or equal to the health threshold, the health status of the target device is determined to be normal, and the first prompt message is output. When the health status is less than the health threshold but greater than or equal to the performance degradation threshold, the health status of the target device is determined to be a performance degradation state, and a second prompt message is output. When the health status is less than the performance degradation threshold, the health status of the target device is determined to be a fault state, and a third prompt message is output; the first, second, and third prompt messages are all inconsistent.

[0107] In this context, a "normal health status" means that all functions of the target device are working properly and the information collected by the target device is highly reliable.

[0108] Performance degradation refers to a state where the various functions of the target device are deteriorating, but have not yet deteriorated to the point of being completely unusable, and the reliability of the information collected by the target device is generally low.

[0109] A fault state indicates that the target device is completely unusable and requires replacement or repair; the reliability of information collected from the target device is low. A health state that is also a fault state indicates that the evolution of the target model cannot compensate for hardware damage, so a third prompt message needs to be output to inform the user that physical maintenance (such as cleaning, repair, or replacement) of the target device is required.

[0110] When the prediction uncertainty increases while the health status is below the health threshold but greater than or equal to the performance degradation threshold, the regularization intensity is increased during the target model fine-tuning phase (by adjusting hyperparameters to increase the penalty for model complexity) to prevent the model from overfitting to noisy data. When the health status is in a performance degradation state, a more conservative fine-tuning strategy (such as adjusting only the bias) is triggered, and a "performance degradation" log is reported.

[0111] In a specific application, the health threshold is 0.8 and the performance degradation threshold is 0.5. When the health level is greater than or equal to 0.8, the green indicator light on the target device is constantly lit or flashing (outputting the first prompt message); when the health level is less than 0.8 but greater than or equal to 0.5, the yellow indicator light on the target device is constantly lit or flashing (outputting the second prompt message); when the health level is less than 0.5, the red indicator light on the target device is constantly lit or flashing (outputting the third prompt message).

[0112] In this embodiment, when the health level is greater than or equal to the health threshold, the target device is determined to be in a normal health state, and a first prompt message is output; when the health level is less than the health threshold but greater than or equal to the performance degradation threshold, the target device is determined to be in a performance degradation state, and a second prompt message is output; when the health level is less than the performance degradation threshold, the target device is determined to be in a fault state, and a third prompt message is output. This allows the user to directly judge the current status of the target device based on the output prompt message, so that the target device can be replaced or repaired in a timely manner when it is in a fault state.

[0113] In one embodiment, the method further includes: Obtain the historical predicted concentrations from the target model output, and determine three standard deviations based on the historical predicted concentrations. When the continuous time window corresponding to the current time is a reliable data window, the predicted concentrations corresponding to the current continuous time window are compared with three times the standard deviation to obtain the comparison results. If the comparison results show that multiple consecutive predicted concentrations are greater than three times the standard deviation, it is determined that the target model has prediction bias.

[0114] The historical predicted concentration is the predicted concentration output by the target model within each reliable data window after the target device is powered on this time. The standard deviation is the standard deviation between each historical predicted concentration. Three times the standard deviation is the standard deviation multiplied by three.

[0115] The continuous time window corresponding to the current time can be understood as a continuous time window whose end time node is the current time.

[0116] The predicted concentrations corresponding to the current continuous time window refer to the predicted concentrations output by the target model within the continuous time window.

[0117] Multiple consecutive predicted concentrations greater than three standard deviations refer to N consecutive predicted concentrations output by the target model that are greater than three standard deviations.

[0118] In this embodiment, by obtaining the historical predicted concentrations output by the target model, three times the standard deviation is determined based on the historical predicted concentrations. When the continuous time window corresponding to the current time is a reliable data window, each predicted concentration corresponding to the current continuous time window is compared with three times the standard deviation to obtain the comparison results. When the comparison results indicate that multiple consecutive predicted concentrations are greater than three times the standard deviation, it is determined that the target model has a prediction bias. This can promptly detect the situation where the target model has a prediction bias, so as to adjust the target model in a timely manner and avoid making incorrect judgments based on unreliable results output by the target model.

[0119] In one embodiment, step S5 is followed by: When the preceding window of the continuous time window is a reliable data window, determine whether the predicted concentrations output by the target model within the continuous time window are greater than the alarm threshold. If the predicted concentration is greater than the alarm threshold, an alarm message indicating that the methane concentration exceeds the limit will be output.

[0120] The window preceding the continuous time window is also a continuous time window. The window preceding the continuous time window is the reliable data window, which can indicate that the output of the target model at this time is relatively consistent with the actual situation and is relatively accurate. Therefore, it can be naturally determined that the reliability of the predicted concentration output by the target model at this time is relatively high.

[0121] In this embodiment, when the preceding window of the continuous time window is a reliable data window, it is determined whether each predicted concentration output by the target model within the continuous time window is greater than the alarm threshold. If there is a predicted concentration greater than the alarm threshold, a methane concentration exceeding the standard alarm is output. This ensures that the predicted concentration output within the continuous time window is reliable, thereby avoiding false alarms.

[0122] This application also provides an application scenario in which the above-described method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms is applied. Specifically, the application of this method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms in this scenario is as follows: like Figure 3As shown, the server acquires multiple high-dimensional vectors corresponding to various environmental conditions. Based on these high-dimensional vectors, it incrementally trains a concentration prediction model to obtain the target model, which is then lightweighted. The server writes the lightweight target model to the memory of the target device. The target device collects environmental parameters and light intensity signals in a real-world environment to determine the actual spectrum corresponding to the light intensity signals. Using the target model written to the target device, the server outputs the predicted concentration and prediction uncertainty values ​​for the actual environment within a continuous time window, and determines whether the continuous time window is a reliable data window. The server fine-tunes the target model based on the data from the reliable data window to perform concentration prediction using the fine-tuned target model.

[0123] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0124] Based on the same inventive concept, this application also provides an apparatus for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, which is used to implement the method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms described above. The solution provided by this apparatus is similar to the solution described in the above method. Therefore, the specific limitations of one or more apparatus embodiments for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms provided below can be found in the limitations of the method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms described above, and will not be repeated here.

[0125] In one embodiment, an apparatus for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms is provided, comprising: The data acquisition module is used to acquire multiple high-dimensional vectors corresponding to various environmental conditions; the high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. The preprocessing module is used to determine the absorption spectrum of each of the high-dimensional vectors based on the original transmitted light intensity signal and the reference light intensity signal of each high-dimensional vector, and to preprocess each absorption spectrum to obtain a preprocessed spectrum. The model training module is used to train a concentration prediction model based on each of the preprocessed spectra and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration to obtain a target model; the target model is a digital twin. The actual parameter acquisition module is used to write the target model into the memory of the target device, and to acquire the environmental parameters and light intensity signals in the actual environment collected by the target device within a continuous time window, and to determine the actual spectrum corresponding to the light intensity signal; The prediction module is used to output the predicted concentration of the actual environment within a continuous time window based on the actual spectrum and the environmental parameters, using the target model written in the target device, so as to perform closed-loop evolution processing for the target model through the actual spectrum, the environmental parameters and the predicted concentration; the environmental parameters include the temperature, humidity and gas type of the actual environment.

[0126] The various modules in the aforementioned device for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independent of the processor in a computer device, or stored in software within the memory of a computer device, allowing the processor to call and execute the corresponding operations of each module.

[0127] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores various types of data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms.

[0128] Those skilled in the art will understand that Figure 4The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0129] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0130] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0131] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0132] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0133] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0134] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0135] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, characterized in that, The method includes: S1. Obtain multiple high-dimensional vectors corresponding to various environmental conditions; the high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. S2. Based on the original transmitted light intensity signal and the reference light intensity signal of each of the high-dimensional vectors, determine the absorption spectrum of each of the high-dimensional vectors respectively, and preprocess each of the absorption spectra to obtain the preprocessed spectrum. S3. Based on each of the preprocessed spectra and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration, a concentration prediction model is trained to obtain a target model; the target model is a digital twin. S4. Write the target model into the memory of the target device, and obtain the environmental parameters and light intensity signals in the actual environment collected by the target device within a continuous time window, and determine the actual spectrum corresponding to the light intensity signal; S5. Based on the actual spectrum and the environmental parameters, the target model written in the target device outputs the predicted concentration of the actual environment within a continuous time window, so as to perform closed-loop evolution processing for the target model through the actual spectrum, the environmental parameters and the predicted concentration; the environmental parameters include the temperature, humidity and interfering gas type of the actual environment; The method further includes: The maximum, minimum, and average values ​​of each predicted concentration output by the target model within a continuous time window are determined; the temperature difference between each temperature and the humidity difference between each humidity level collected by the target device within the continuous time window are determined; the status of doors and windows and the status of stoves in the actual environment are determined; and the prediction uncertainty value corresponding to each predicted concentration is determined. When the concentration difference between the maximum and minimum values ​​is less than a concentration threshold, the average value is less than an average value threshold, the absolute value of the temperature difference is less than a temperature threshold, the absolute value of the humidity difference is less than a humidity threshold, and all prediction uncertainty values ​​are less than uncertainty thresholds, the continuous time window is determined to be a reliable data window. When the concentration difference is less than the concentration threshold, the average value is less than the average value threshold, the absolute value of the temperature difference is less than the temperature threshold, the absolute value of the humidity difference is less than the humidity threshold, the time corresponding to the continuous time window is within a first preset time period, the door and window are in an open state, and the stove is in a closed state and the duration of the closed state exceeds a preset closed duration, the continuous time window is determined to be a reliable data window. Based on the temperature, humidity, interfering gas type, and light intensity signals corresponding to at least one of the aforementioned reliable data windows, the target model is fine-tuned to predict gas concentration using the fine-tuned target model. The fine-tuning process of the target model includes: When the total duration of the multiple trusted data windows reaches a preset duration, the preset concentration is taken as the actual concentration of the actual environment in each trusted data window; Based on the temperature, humidity, light intensity signals, and interfering gas types corresponding to the trusted data window, the target model is used to output a second initial predicted concentration. The second model loss is calculated based on the second initial predicted concentration and the preset concentration; The model parameters of the fully connected layer and / or output layer of the target model are fine-tuned using the second model loss to obtain the fine-tuned target model. The formula for calculating the second model loss (Loss) is: Loss = MSE(Second Initial Predicted Concentration, Preset Concentration) + λ × ||ΔW|| 2 MSE(Second Initial Predicted Concentration, Preset Concentration) represents the mean square error corresponding to the second initial predicted concentration and the preset concentration, λ is the regularization coefficient, and ΔW is the change in constraint weights.

2. The method according to claim 1, characterized in that, Step S3 includes: S31. Use a one-dimensional convolutional layer of the concentration prediction model to extract the local and global spectral features of each preprocessed spectrum, and use the fully connected layer of the concentration prediction model to encode the actual temperature, actual humidity and interfering gas type corresponding to each preprocessed spectrum to obtain a temperature vector, a humidity vector and a type vector. S32. The local spectral features, global spectral features, temperature vector, humidity vector and type vector corresponding to each preprocessed spectrum are concatenated to obtain the concatenated vector corresponding to each preprocessed spectrum. S33. Based on each of the splicing vectors, the first initial predicted concentration corresponding to each of the preprocessed spectra is obtained through the concentration prediction model; S34. Based on the first initial predicted concentration and the actual methane concentration corresponding to each of the preprocessed spectra, determine the first model loss, and optimize the concentration prediction model based on the first model loss; S35. Based on the optimized concentration prediction model, repeat steps S31, S32, S33, and S34 until the iteration stopping condition is met to obtain the target model.

3. The method according to claim 1, characterized in that, The method further includes: The prediction uncertainty values ​​corresponding to each of the trusted data windows within the second preset time period are statistically analyzed. Based on the mean uncertainty U among the predicted uncertainty values. current By H=max(0,1-(U current / U base -1) / k a Determine the health status H of the target device; U base k is the baseline mean. a The attenuation coefficient; Based on the health level of the target device, determine the health status of the target device, and output a prompt message based on the health status.

4. The method according to claim 3, characterized in that, The process of determining the health status of the target device based on its health level and outputting a prompt message based on that health status includes: When the health level is greater than or equal to the health threshold, the health status of the target device is determined to be normal, and a first prompt message is output. When the health status is less than the health threshold and greater than or equal to the performance degradation threshold, the health status of the target device is determined to be a performance degradation state, and a second prompt message is output. When the health status is less than the performance degradation threshold, the health status of the target device is determined to be a fault state, and a third prompt message is output; the first prompt message, the second prompt message, and the third prompt message are all inconsistent.

5. The method according to claim 1, characterized in that, The method further includes: Obtain the historical predicted concentration output by the target model, and determine three times the standard deviation based on the historical predicted concentration; When the continuous time window corresponding to the current time is a reliable data window, each predicted concentration corresponding to the current continuous time window is compared with three times the standard deviation to obtain the comparison results. If the comparison results indicate that multiple consecutive predicted concentrations are greater than three times the standard deviation, it is determined that the target model has a prediction bias.

6. The method according to claim 1, characterized in that, Step S5 and the following steps include: When the window preceding the continuous time window is a reliable data window, it is determined whether each predicted concentration output by the target model within the continuous time window is greater than an alarm threshold. If the predicted concentration is greater than the alarm threshold, an alarm message indicating that the methane concentration exceeds the limit will be output.

7. An apparatus for predicting methane gas concentration using laser technology based on digital twins and closed-loop evolution algorithms, for performing the method according to any one of claims 1-6, characterized in that, The device includes: The data acquisition module is used to acquire multiple high-dimensional vectors corresponding to various environmental conditions; the high-dimensional vectors include the actual temperature, actual humidity, interfering gas type, actual methane concentration, original transmitted light intensity signal, and reference light intensity signal identified by the target device. The preprocessing module is used to determine the absorption spectrum of each of the high-dimensional vectors based on the original transmitted light intensity signal and the reference light intensity signal of each high-dimensional vector, and to preprocess each absorption spectrum to obtain a preprocessed spectrum. The model training module is used to train a concentration prediction model based on each of the preprocessed spectra and the corresponding actual temperature, actual humidity, interfering gas type, and actual methane concentration to obtain a target model; the target model is a digital twin. The actual parameter acquisition module is used to write the target model into the memory of the target device, and to acquire the environmental parameters and light intensity signals in the actual environment collected by the target device within a continuous time window, and to determine the actual spectrum corresponding to the light intensity signal; The prediction module is used to output the predicted concentration of the actual environment within a continuous time window using the target model written in the target device, based on the actual spectrum and the environmental parameters, so as to perform closed-loop evolution processing for the target model through the actual spectrum, the environmental parameters and the predicted concentration; the environmental parameters include the temperature, humidity and interfering gas type of the actual environment.

8. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • In-situ detection method and device for dissolved gas in transformer oil based on photoacoustic spectrometry technology

    CN121068490A

  • Wave self-locking method and system based on laser photoacoustic spectrometry gas detection

    CN121805159A